ome-files
0.5.0
|
TIFF reader with support for ImageJ extensions. More...
#include <ome/files/in/TIFFReader.h>
Public Member Functions | |
TIFFReader () | |
Constructor. | |
virtual | ~TIFFReader () |
Destructor. | |
void | close (bool fileOnly=false) |
Close the currently open file. More... | |
Public Member Functions inherited from ome::files::in::MinimalTIFFReader | |
MinimalTIFFReader () | |
Constructor. | |
MinimalTIFFReader (const ome::files::detail::ReaderProperties &readerProperties) | |
Constructor with reader properties (for derived readers). More... | |
virtual | ~MinimalTIFFReader () |
Destructor. | |
void | getLookupTable (dimension_size_type plane, VariantPixelBuffer &buf) const |
Get the color lookup table associated with an image plane. More... | |
std::shared_ptr< ome::files::tiff::TIFF > | getTIFF () |
Get open TIFF file. More... | |
const std::shared_ptr< ome::files::tiff::TIFF > | getTIFF () const |
Get open TIFF file. More... | |
Public Member Functions inherited from ome::files::detail::FormatReader | |
virtual | ~FormatReader () |
Destructor. | |
const std::set< MetadataOptions::MetadataLevel > & | getSupportedMetadataLevels () |
Get the supported metadata levels. More... | |
void | setMetadataOptions (const MetadataOptions &options) |
Set metadata options. More... | |
const MetadataOptions & | getMetadataOptions () const |
Get metadata options. More... | |
MetadataOptions & | getMetadataOptions () |
Get metadata options. More... | |
const MetadataMap & | getGlobalMetadata () const |
Get global metadata map. More... | |
const MetadataMap::value_type & | getMetadataValue (const std::string &field) const |
Get a global metadata value. More... | |
const MetadataMap & | getSeriesMetadata () const |
Get series metadata map. More... | |
const MetadataMap::value_type & | getSeriesMetadataValue (const MetadataMap::key_type &field) const |
Get a series metadata value. More... | |
bool | isThisType (const boost::filesystem::path &name, bool open=true) const |
Check if the given file is a valid instance of this file format. More... | |
bool | isThisType (const uint8_t *begin, std::size_t length) const |
Check if the given buffer is a valid header for this file format. More... | |
bool | isThisType (const uint8_t *begin, const uint8_t *end) const |
Check if the given buffer is a valid header for this file format. More... | |
bool | isThisType (std::istream &stream) const |
Check if the given input stream is a valid stream for this file format. More... | |
dimension_size_type | getImageCount () const |
Determine the number of image planes in the current series. More... | |
bool | isRGB (dimension_size_type channel) const |
Check if the image planes for a channel have more than one sub-channel per openBytes() call. More... | |
dimension_size_type | getSizeX () const |
Get the size of the X dimension. More... | |
dimension_size_type | getSizeY () const |
Get the size of the Y dimension. More... | |
dimension_size_type | getSizeZ () const |
Get the size of the Z dimension. More... | |
dimension_size_type | getSizeT () const |
Get the size of the T dimension. More... | |
dimension_size_type | getSizeC () const |
Get the size of the C dimension. More... | |
ome::xml::model::enums::PixelType | getPixelType () const |
Get the pixel type. More... | |
pixel_size_type | getBitsPerPixel () const |
Get the number of valid bits per pixel. More... | |
dimension_size_type | getEffectiveSizeC () const |
Get the effective size of the C dimension. More... | |
dimension_size_type | getRGBChannelCount (dimension_size_type channel) const |
Get the number of channels returned for a call to openBytes(). More... | |
bool | isIndexed () const |
Get whether the image planes are indexed color. More... | |
bool | isFalseColor () const |
Get whether the image planes are false color. More... | |
Modulo & | getModuloZ () |
Get the Modulo subdivision of the Z dimension. More... | |
const Modulo & | getModuloZ () const |
Get the Modulo subdivision of the Z dimension. More... | |
Modulo & | getModuloT () |
Get the Modulo subdivision of the T dimension. More... | |
const Modulo & | getModuloT () const |
Get the Modulo subdivision of the T dimension. More... | |
Modulo & | getModuloC () |
Get the Modulo subdivision of the C dimension. More... | |
const Modulo & | getModuloC () const |
Get the Modulo subdivision of the C dimension. More... | |
dimension_size_type | getThumbSizeX () const |
Get the thumbnail size of the X dimension. More... | |
dimension_size_type | getThumbSizeY () const |
Get the thumbnail size of the Y dimension. More... | |
bool | isLittleEndian () const |
Get whether the data is in little-endian format. More... | |
const std::string & | getDimensionOrder () const |
Get the dimension order. More... | |
bool | isOrderCertain () const |
Get whether the dimension order and sizes are known, or merely guesses. More... | |
bool | isThumbnailSeries () const |
Get whether the current series is a lower resolution copy of a different series. More... | |
bool | isInterleaved () const |
Get whether or not the channels are interleaved. More... | |
bool | isInterleaved (dimension_size_type subC) const |
Get whether or not the given channel is interleaved. More... | |
void | openBytes (dimension_size_type plane, VariantPixelBuffer &buf) const |
Obtain an image plane. More... | |
void | openBytes (dimension_size_type plane, VariantPixelBuffer &buf, dimension_size_type x, dimension_size_type y, dimension_size_type w, dimension_size_type h) const |
Obtain a sub-image of an image plane. More... | |
void | openThumbBytes (dimension_size_type plane, VariantPixelBuffer &buf) const |
Obtain a thumbnail of an image plane. More... | |
dimension_size_type | getSeriesCount () const |
Get the number of image series in this file. More... | |
void | setSeries (dimension_size_type series) const |
Set the active series. More... | |
dimension_size_type | getSeries () const |
Get the active series. More... | |
void | setPlane (dimension_size_type plane) const |
Set the active plane. More... | |
dimension_size_type | getPlane () const |
Get the active plane. More... | |
void | setGroupFiles (bool group) |
Set file grouping. More... | |
bool | isGroupFiles () const |
Get file grouping. More... | |
FileGroupOption | fileGroupOption (const std::string &id) |
Returns an enum indicating that we cannot, must, or might group the files in this dataset. More... | |
bool | isMetadataComplete () const |
Get status of metadata parsing. More... | |
void | setNormalized (bool normalize) |
Set float normalization. More... | |
bool | isNormalized () const |
Get float normalization. More... | |
void | setOriginalMetadataPopulated (bool populate) |
Specifies whether or not to save proprietary metadata in the MetadataStore. More... | |
bool | isOriginalMetadataPopulated () const |
Get proprietary metadata storage. More... | |
const std::vector< boost::filesystem::path > | getUsedFiles (bool noPixels=false) const |
Get the files used by this dataset. More... | |
const std::vector< boost::filesystem::path > | getSeriesUsedFiles (bool noPixels=false) const |
Get the files used by the active series. More... | |
std::vector< FileInfo > | getAdvancedUsedFiles (bool noPixels=false) const |
Get the files used by this dataset. More... | |
std::vector< FileInfo > | getAdvancedSeriesUsedFiles (bool noPixels=false) const |
Get the files used by the active series. More... | |
const boost::optional< boost::filesystem::path > & | getCurrentFile () const |
Get the currently open file. More... | |
dimension_size_type | getIndex (dimension_size_type z, dimension_size_type c, dimension_size_type t) const |
Get the linear index of a Z , C and T coordinate. More... | |
dimension_size_type | getIndex (dimension_size_type z, dimension_size_type c, dimension_size_type t, dimension_size_type moduloZ, dimension_size_type moduloC, dimension_size_type moduloT) const |
Get the linear index of a Z , C , T , ModuloZ , ModuloC and ModuloT coordinate. More... | |
std::array< dimension_size_type, 3 > | getZCTCoords (dimension_size_type index) const |
Get the Z , C and T coordinate of a linear index. More... | |
std::array< dimension_size_type, 6 > | getZCTModuloCoords (dimension_size_type index) const |
Get the Z , C , T , ModuloZ , ModuloC and ModuloT coordinate of a linear index. More... | |
const std::vector< std::shared_ptr<::ome::files::CoreMetadata > > & | getCoreMetadataList () const |
Get the core metadata. More... | |
void | setMetadataFiltered (bool filter) |
Set metadata filtering. More... | |
bool | isMetadataFiltered () const |
Get metadata filtering. More... | |
void | setMetadataStore (std::shared_ptr<::ome::xml::meta::MetadataStore > &store) |
Set the default metadata store for this reader. More... | |
const std::shared_ptr<::ome::xml::meta::MetadataStore > & | getMetadataStore () const |
Get the current metadata store for this reader. More... | |
std::shared_ptr<::ome::xml::meta::MetadataStore > & | getMetadataStore () |
Get the current metadata store for this reader. More... | |
std::vector< std::shared_ptr<::ome::files::FormatReader > > | getUnderlyingReaders () const |
Get all underlying readers. More... | |
bool | isSingleFile (const boost::filesystem::path &id) const |
Is this a single-file format? More... | |
uint32_t | getRequiredDirectories (const std::vector< std::string > &files) const |
Get required parent directories. More... | |
const std::string & | getDatasetStructureDescription () const |
Get a short description of the dataset structure. More... | |
const std::vector< std::string > & | getPossibleDomains (const std::string &id) const |
Get the possible domains represented in which this format is used. More... | |
bool | hasCompanionFiles () const |
Does this format support multi-file datasets? More... | |
const std::vector< std::string > & | getDomains () const |
Get the domains represented by the current file. More... | |
dimension_size_type | getOptimalTileWidth (dimension_size_type channel) const |
Get the optimal sub-image width. More... | |
dimension_size_type | getOptimalTileHeight (dimension_size_type channel) const |
Get the optimal sub-image height. More... | |
dimension_size_type | getOptimalTileWidth () const |
Get the optimal sub-image width. More... | |
dimension_size_type | getOptimalTileHeight () const |
Get the optimal sub-image height. More... | |
dimension_size_type | seriesToCoreIndex (dimension_size_type series) const |
Get the first core index corresponding to the specified series. More... | |
dimension_size_type | coreIndexToSeries (dimension_size_type index) const |
Get the series corresponding to the specified core index. More... | |
dimension_size_type | getCoreIndex () const |
Get the CoreMetadata index of the current resolution/series. More... | |
void | setCoreIndex (dimension_size_type index) const |
Set the current resolution/series (ignoring sub-resolutions). More... | |
dimension_size_type | getResolutionCount () const |
Get the number of resolutions for the current series. More... | |
void | setResolution (dimension_size_type resolution) const |
Set the active resolution level. More... | |
dimension_size_type | getResolution () const |
Get the active resolution level. More... | |
bool | hasFlattenedResolutions () const |
Get resolution flattening. More... | |
void | setFlattenedResolutions (bool flatten) |
Set resolution flattening. More... | |
void | setId (const boost::filesystem::path &id) |
Set the current file name. More... | |
const std::string & | getFormat () const |
Get the name of this file format. More... | |
const std::string & | getFormatDescription () const |
Get the description of this file format. More... | |
const std::vector< boost::filesystem::path > & | getSuffixes () const |
Get the default file suffixes for this file format. More... | |
const std::vector< boost::filesystem::path > & | getCompressionSuffixes () const |
Get the default compression suffixes for this file format. More... | |
Public Member Functions inherited from ome::files::FormatHandler | |
virtual | ~FormatHandler () |
Destructor. | |
Public Member Functions inherited from ome::files::MetadataConfigurable | |
virtual | ~MetadataConfigurable () |
Destructor. | |
Protected Member Functions | |
void | readIFDs () |
Read metadata from IFDs. | |
Protected Member Functions inherited from ome::files::in::MinimalTIFFReader | |
void | initFile (const boost::filesystem::path &id) |
Initialize the given file. More... | |
bool | isFilenameThisTypeImpl (const boost::filesystem::path &name) const |
isThisType file implementation for readers. More... | |
const std::shared_ptr< const tiff::IFD > | ifdAtIndex (dimension_size_type plane) const |
Get the IFD index for a plane in the current series. More... | |
void | openBytesImpl (dimension_size_type plane, VariantPixelBuffer &buf, dimension_size_type x, dimension_size_type y, dimension_size_type w, dimension_size_type h) const |
Obtain a sub-image of an image plane. More... | |
Protected Member Functions inherited from ome::files::detail::FormatReader | |
FormatReader (const ReaderProperties &) | |
Constructor. | |
virtual bool | isUsedFile (const boost::filesystem::path &file) |
Check if a file is in the used files list. More... | |
virtual void | readPlane (std::istream &source, VariantPixelBuffer &dest, dimension_size_type x, dimension_size_type y, dimension_size_type w, dimension_size_type h, dimension_size_type samples) |
Read a raw plane. More... | |
virtual void | readPlane (std::istream &source, VariantPixelBuffer &dest, dimension_size_type x, dimension_size_type y, dimension_size_type w, dimension_size_type h, dimension_size_type scanlinePad, dimension_size_type samples) |
Read a raw plane with scanline padding. More... | |
virtual std::shared_ptr<::ome::xml::meta::MetadataStore > | makeFilterMetadata () |
Create a configured FilterMetadata instance. More... | |
const CoreMetadata & | getCoreMetadata (dimension_size_type index) const |
Get CoreMetadata by core index. More... | |
CoreMetadata & | getCoreMetadata (dimension_size_type index) |
Get CoreMetadata by core index. More... | |
virtual bool | isStreamThisTypeImpl (std::istream &stream) const |
isThisType stream implementation for readers. More... | |
std::array< dimension_size_type, 2 > | getThumbSize () const |
Get the thumbnail size of the X and Y dimensions. More... | |
Protected Member Functions inherited from ome::files::FormatReader | |
FormatReader () | |
Constructor. | |
Protected Member Functions inherited from ome::files::FormatHandler | |
FormatHandler () | |
Constructor. | |
Protected Member Functions inherited from ome::files::MetadataConfigurable | |
MetadataConfigurable () | |
Constructor. | |
Protected Attributes | |
boost::optional< tiff::ImageJMetadata > | ijmeta |
ImageJ metadata. | |
Protected Attributes inherited from ome::files::in::MinimalTIFFReader | |
std::shared_ptr< ome::files::tiff::TIFF > | tiff |
Underlying TIFF file. | |
tiff::SeriesIFDRange | seriesIFDRange |
Mapping between series index and start and end IFD as a half-open range. | |
Protected Attributes inherited from ome::files::detail::FormatReader | |
const ReaderProperties & | readerProperties |
Reader properties specific to the derived file format. | |
boost::optional< boost::filesystem::path > | currentId |
The identifier (path) of the currently open file. | |
std::shared_ptr< std::istream > | in |
Current input. | |
::ome::files::MetadataMap | metadata |
Mapping of metadata key/value pairs. | |
dimension_size_type | coreIndex |
The number of the current series (flattened). More... | |
dimension_size_type | series |
The number of the current series (non-flattened). More... | |
dimension_size_type | plane |
The number of the current plane in the current series. More... | |
coremetadata_list_type | core |
Core metadata values. | |
dimension_size_type | resolution |
The number of the current resolution. More... | |
bool | flattenedResolutions |
Whether or not resolutions are flattened. | |
bool | suffixNecessary |
Whether the file extension matching one of the reader's suffixes is necessary to identify the file as an instance of this format. | |
bool | suffixSufficient |
Whether the file extension matching one of the reader's suffixes is sufficient to identify the file as an instance of this format. | |
bool | companionFiles |
Whether this format supports multi-file datasets. | |
std::string | datasetDescription |
Short description of the structure of the dataset. | |
bool | normalizeData |
Whether or not to normalize float data. | |
bool | filterMetadata |
Whether or not to filter out invalid metadata. | |
bool | saveOriginalMetadata |
Whether or not to save proprietary metadata in the MetadataStore. | |
bool | indexedAsRGB |
Whether or not MetadataStore sets C = 3 for indexed color images. | |
bool | group |
Whether or not to group multi-file formats. | |
std::vector< std::string > | domains |
List of domains in which this format is used. | |
std::shared_ptr<::ome::xml::meta::MetadataStore > | metadataStore |
Current metadata store. More... | |
MetadataOptions | metadataOptions |
Metadata parsing options. | |
Additional Inherited Members | |
Public Types inherited from ome::files::FormatReader | |
enum | FileGroupOption { MUST_GROUP, CAN_GROUP, CANNOT_GROUP } |
File grouping options. More... | |
Static Public Member Functions inherited from ome::files::FormatHandler | |
static bool | checkSuffix (const boost::filesystem::path &name, const boost::filesystem::path &suffix) |
Perform suffix matching for the given filename. More... | |
static bool | checkSuffix (const boost::filesystem::path &name, const std::vector< boost::filesystem::path > &suffixes) |
Perform suffix matching for the given filename. More... | |
static bool | checkSuffix (const boost::filesystem::path &name, const std::vector< boost::filesystem::path > &suffixes, const std::vector< boost::filesystem::path > &compression_suffixes) |
Perform suffix matching for the given filename. More... | |
static void | assertId (const boost::optional< boost::filesystem::path > &id, bool notNull=true) |
Assert that the current file is valid. More... | |
Protected Types inherited from ome::files::detail::FormatReader | |
typedef std::vector< std::shared_ptr<::ome::files::CoreMetadata > > | coremetadata_list_type |
List type for storing CoreMetadata. | |
TIFF reader with support for ImageJ extensions.
|
virtual |
Close the currently open file.
An exception may be thrown when closing the file, for example if there are problems flushing any pending writes, or if there are any inconsistencies in the metadata which prevent completing any final writes. The causes are reader- or writer-dependent, and the exception type is dependent upon the implementation details of the reader or writer in use. It is advised to always explicitly close writers, since if this is automatically called at destruction time, any errors will be lost. If an exception is thrown, the object may be left in an inconsistent state and should not be reused.
fileOnly | close the open file only if true , or else free all internal state if false ; only meaningful for readers, since writers will always free all internal state. |
On | error; exception type may vary. |
Reimplemented from ome::files::in::MinimalTIFFReader.
References ome::files::in::MinimalTIFFReader::close(), and ijmeta.
Referenced by ~TIFFReader().