ome-files  0.5.0
Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | List of all members
ome::files::detail::FormatReader Class Referenceabstract

Interface for all biological file format readers (default behaviour). More...

#include <ome/files/detail/FormatReader.h>

+ Inheritance diagram for ome::files::detail::FormatReader:
+ Collaboration diagram for ome::files::detail::FormatReader:

Public Member Functions

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 MetadataOptionsgetMetadataOptions () const
 Get metadata options. More...
 
MetadataOptionsgetMetadataOptions ()
 Get metadata options. More...
 
const MetadataMapgetGlobalMetadata () const
 Get global metadata map. More...
 
const MetadataMap::value_typegetMetadataValue (const std::string &field) const
 Get a global metadata value. More...
 
const MetadataMapgetSeriesMetadata () const
 Get series metadata map. More...
 
const MetadataMap::value_typegetSeriesMetadataValue (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...
 
void getLookupTable (dimension_size_type plane, VariantPixelBuffer &buf) const
 Get the color lookup table associated with an image plane. More...
 
ModulogetModuloZ ()
 Get the Modulo subdivision of the Z dimension. More...
 
const ModulogetModuloZ () const
 Get the Modulo subdivision of the Z dimension. More...
 
ModulogetModuloT ()
 Get the Modulo subdivision of the T dimension. More...
 
const ModulogetModuloT () const
 Get the Modulo subdivision of the T dimension. More...
 
ModulogetModuloC ()
 Get the Modulo subdivision of the C dimension. More...
 
const ModulogetModuloC () 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...
 
void close (bool fileOnly=false)
 Close the currently open file. 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< FileInfogetAdvancedUsedFiles (bool noPixels=false) const
 Get the files used by this dataset. More...
 
std::vector< FileInfogetAdvancedSeriesUsedFiles (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 Types

typedef std::vector< std::shared_ptr<::ome::files::CoreMetadata > > coremetadata_list_type
 List type for storing CoreMetadata.
 

Protected Member Functions

 FormatReader (const ReaderProperties &)
 Constructor.
 
virtual void initFile (const boost::filesystem::path &id)
 Initialize the given file. More...
 
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::MetadataStoremakeFilterMetadata ()
 Create a configured FilterMetadata instance. More...
 
const CoreMetadatagetCoreMetadata (dimension_size_type index) const
 Get CoreMetadata by core index. More...
 
CoreMetadatagetCoreMetadata (dimension_size_type index)
 Get CoreMetadata by core index. More...
 
virtual bool isFilenameThisTypeImpl (const boost::filesystem::path &name) const
 isThisType file implementation for readers. 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...
 
virtual 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 =0
 Obtain a sub-image of an image plane. 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

const ReaderPropertiesreaderProperties
 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::MetadataStoremetadataStore
 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...
 

Detailed Description

Interface for all biological file format readers (default behaviour).

Differences from the Java implementation:

Member Function Documentation

◆ close()

void ome::files::detail::FormatReader::close ( bool  fileOnly = false)
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.

Parameters
fileOnlyclose 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.
Exceptions
Onerror; exception type may vary.

Implements ome::files::FormatHandler.

Reimplemented in ome::files::in::OMETIFFReader, ome::files::in::MinimalTIFFReader, and ome::files::in::TIFFReader.

References core, coreIndex, currentId, in, plane, resolution, and series.

Referenced by ome::files::in::MinimalTIFFReader::close(), ome::files::in::OMETIFFReader::close(), and initFile().

+ Here is the caller graph for this function:

◆ coreIndexToSeries()

dimension_size_type ome::files::detail::FormatReader::coreIndexToSeries ( dimension_size_type  index) const
virtual

Get the series corresponding to the specified core index.

Parameters
indexthe core index to use.
Returns
the series for the index.

Implements ome::files::FormatReader.

References core, coreIndex, hasFlattenedResolutions(), and series.

Referenced by getSeriesCount(), and setCoreIndex().

+ Here is the caller graph for this function:

◆ fileGroupOption()

FormatReader::FileGroupOption ome::files::detail::FormatReader::fileGroupOption ( const std::string &  id)
virtual

Returns an enum indicating that we cannot, must, or might group the files in this dataset.

Parameters
idfilename to check.
Returns
the grouping option for the specified file.

Implements ome::files::FormatReader.

Reimplemented in ome::files::in::OMETIFFReader.

References ome::files::FormatReader::CANNOT_GROUP.

◆ getAdvancedSeriesUsedFiles()

std::vector< FileInfo > ome::files::detail::FormatReader::getAdvancedSeriesUsedFiles ( bool  noPixels = false) const
virtual

Get the files used by the active series.

Parameters
noPixelsexclude pixel data files if true, or include them if false.
Returns
a list of FileInfo objects representing each used file.

Implements ome::files::FormatReader.

References ome::common::canonical(), ome::files::FileInfo::filename, getCurrentFile(), getFormat(), getSeriesUsedFiles(), ome::files::FileInfo::reader, and ome::files::FileInfo::usedToInitialize.

◆ getAdvancedUsedFiles()

std::vector< FileInfo > ome::files::detail::FormatReader::getAdvancedUsedFiles ( bool  noPixels = false) const
virtual

Get the files used by this dataset.

Parameters
noPixelsexclude pixel data files if true, or include them if false.
Returns
a list of FileInfo objects representing each used file.

Implements ome::files::FormatReader.

References ome::common::canonical(), ome::files::FileInfo::filename, getCurrentFile(), getFormat(), getUsedFiles(), ome::files::FileInfo::reader, and ome::files::FileInfo::usedToInitialize.

◆ getBitsPerPixel()

pixel_size_type ome::files::detail::FormatReader::getBitsPerPixel ( ) const
virtual

Get the number of valid bits per pixel.

The number of valid bits per pixel is always less than or equal to the number of bits per pixel that correspond to getPixelType().

Returns
the number of valid bits per pixel.
Todo:
: Move this logic into a CoreMetadata accessor. Why are we modifying coremetadata during an explicitly nonmodifying operation??

Implements ome::files::FormatReader.

References ome::files::FormatHandler::assertId(), ome::files::bitsPerPixel(), ome::files::CoreMetadata::bitsPerPixel, currentId, getCoreIndex(), getCoreMetadata(), and getPixelType().

◆ getCompressionSuffixes()

const std::vector< boost::filesystem::path > & ome::files::detail::FormatReader::getCompressionSuffixes ( ) const
virtual

Get the default compression suffixes for this file format.

Returns
a list of file suffixes.

Implements ome::files::FormatHandler.

References ome::files::detail::ReaderProperties::compression_suffixes, and readerProperties.

◆ getCoreIndex()

dimension_size_type ome::files::detail::FormatReader::getCoreIndex ( ) const
virtual

◆ getCoreMetadata() [1/2]

const CoreMetadata& ome::files::detail::FormatReader::getCoreMetadata ( dimension_size_type  index) const
inlineprotected

Get CoreMetadata by core index.

Parameters
indexthe core index.
Returns
the CoreMetadata.
Exceptions
std::range_errorif the core index is invalid.
std::logic_errorif the metadata is null.

Referenced by getBitsPerPixel(), getDimensionOrder(), getEffectiveSizeC(), getImageCount(), getModuloC(), getModuloT(), getModuloZ(), ome::files::in::OMETIFFReader::getOptimalTileHeight(), ome::files::in::OMETIFFReader::getOptimalTileWidth(), getPixelType(), getRGBChannelCount(), getSeriesMetadata(), ome::files::in::OMETIFFReader::getSeriesUsedFiles(), getSizeC(), getSizeT(), getSizeX(), getSizeY(), getSizeZ(), getThumbSize(), ome::files::in::OMETIFFReader::ifdAtIndex(), isFalseColor(), isIndexed(), isInterleaved(), isLittleEndian(), isMetadataComplete(), isOrderCertain(), and isThumbnailSeries().

+ Here is the caller graph for this function:

◆ getCoreMetadata() [2/2]

CoreMetadata& ome::files::detail::FormatReader::getCoreMetadata ( dimension_size_type  index)
inlineprotected

Get CoreMetadata by core index.

Parameters
indexthe core index.
Returns
the CoreMetadata.
Exceptions
std::range_errorif the core index is invalid.
std::logic_errorif the metadata is null.

References ome::files::getIndex(), ome::files::getZCTCoords(), and ome::files::detail::ReaderProperties::name.

◆ getCoreMetadataList()

const std::vector< std::shared_ptr<::ome::files::CoreMetadata > > & ome::files::detail::FormatReader::getCoreMetadataList ( ) const
virtual

Get the core metadata.

A CoreMetadata object exists to describe the each series in the dataset.

Returns
a const reference to the core metadata.

Implements ome::files::FormatReader.

References ome::files::FormatHandler::assertId(), core, and currentId.

◆ getCurrentFile()

const boost::optional< boost::filesystem::path > & ome::files::detail::FormatReader::getCurrentFile ( ) const
virtual

Get the currently open file.

Returns
the filename.

Implements ome::files::FormatReader.

References currentId.

Referenced by getAdvancedSeriesUsedFiles(), and getAdvancedUsedFiles().

+ Here is the caller graph for this function:

◆ getDatasetStructureDescription()

const std::string & ome::files::detail::FormatReader::getDatasetStructureDescription ( ) const
virtual

Get a short description of the dataset structure.

Returns
a short description.

Implements ome::files::FormatReader.

References datasetDescription.

◆ getDimensionOrder()

const std::string & ome::files::detail::FormatReader::getDimensionOrder ( ) const
virtual

Get the dimension order.

The dimension order is a five-character string representing the order in which planes will be returned. Valid orders are:

  • XYCTZ
  • XYCZT
  • XYTCZ
  • XYTZC
  • XYZCT
  • XYZTC

In cases where the channels are interleaved (e.g. CXYTZ), C will be the first dimension after X and Y (e.g. XYCTZ) and the isInterleaved() method will return true.

Returns
the dimension order.

Implements ome::files::FormatReader.

References ome::files::FormatHandler::assertId(), currentId, ome::files::CoreMetadata::dimensionOrder, getCoreIndex(), and getCoreMetadata().

Referenced by getIndex(), getZCTCoords(), getZCTModuloCoords(), and readPlane().

+ Here is the caller graph for this function:

◆ getDomains()

const std::vector< std::string > & ome::files::detail::FormatReader::getDomains ( ) const
virtual

Get the domains represented by the current file.

Returns
a list of domains.

Implements ome::files::FormatReader.

Reimplemented in ome::files::in::OMETIFFReader.

References ome::files::FormatHandler::assertId(), currentId, and domains.

◆ getEffectiveSizeC()

dimension_size_type ome::files::detail::FormatReader::getEffectiveSizeC ( ) const
virtual

Get the effective size of the C dimension.

This guarantees that

regardless of the result of isRGB().

Returns
the effective C dimension size.

Implements ome::files::FormatReader.

References getCoreIndex(), getCoreMetadata(), and ome::files::CoreMetadata::sizeC.

Referenced by getIndex(), getOptimalTileHeight(), getOptimalTileWidth(), getZCTCoords(), and getZCTModuloCoords().

+ Here is the caller graph for this function:

◆ getFormat()

const std::string & ome::files::detail::FormatReader::getFormat ( ) const
virtual

Get the name of this file format.

Returns
the file format name.

Implements ome::files::FormatHandler.

References ome::files::detail::ReaderProperties::name, and readerProperties.

Referenced by getAdvancedSeriesUsedFiles(), and getAdvancedUsedFiles().

+ Here is the caller graph for this function:

◆ getFormatDescription()

const std::string & ome::files::detail::FormatReader::getFormatDescription ( ) const
virtual

Get the description of this file format.

Returns
the file format description.

Implements ome::files::FormatHandler.

References ome::files::detail::ReaderProperties::description, and readerProperties.

◆ getGlobalMetadata()

const MetadataMap & ome::files::detail::FormatReader::getGlobalMetadata ( ) const
virtual

Get global metadata map.

Obtain the map containing the global metadata field/value pairs the current dataset.

Returns
the global metadata map.

Implements ome::files::FormatReader.

References metadata.

◆ getImageCount()

dimension_size_type ome::files::detail::FormatReader::getImageCount ( ) const
virtual

Determine the number of image planes in the current series.

Returns
the number of image planes.

Implements ome::files::FormatReader.

References ome::files::FormatHandler::assertId(), currentId, getCoreIndex(), getCoreMetadata(), and ome::files::CoreMetadata::imageCount.

Referenced by getIndex(), getZCTCoords(), getZCTModuloCoords(), ome::files::in::OMETIFFReader::initFile(), and setPlane().

+ Here is the caller graph for this function:

◆ getIndex() [1/2]

dimension_size_type ome::files::detail::FormatReader::getIndex ( dimension_size_type  z,
dimension_size_type  c,
dimension_size_type  t 
) const
virtual

Get the linear index of a Z, C and T coordinate.

The index is computed using the DimensionOrder.

Parameters
zthe Z coordinate (real size).
cthe C coordinate (real size).
tthe T coordinate (real size).
Returns
the linear index.
Todo:

unify with the pixel buffer dimension indexes.

Don't use separate values to match the return of getZCTCoords.

Implements ome::files::FormatReader.

References ome::files::FormatHandler::assertId(), currentId, getDimensionOrder(), getEffectiveSizeC(), getImageCount(), ome::files::getIndex(), getSizeT(), and getSizeZ().

◆ getIndex() [2/2]

dimension_size_type ome::files::detail::FormatReader::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
virtual

Get the linear index of a Z, C, T, ModuloZ, ModuloC and ModuloT coordinate.

The index is computed using the DimensionOrder.

Note
The Z, C and T coordinates take the modulo dimension sizes into account. The effective size for each of these dimensions is limited to the total size of the dimension divided by the modulo size.
Parameters
zthe Z coordinate (effective size).
cthe C coordinate (effective size).
tthe T coordinate (effective size).
moduloZthe ModuloZ coordinate (effective size).
moduloCthe ModuloC coordinate (effective size).
moduloTthe ModuloT coordinate (effective size).
Returns
the linear index.
Todo:

unify with the pixel buffer dimension indexes.

Don't use separate values to match the return of getZCTModuloCoords.

Implements ome::files::FormatReader.

References ome::files::FormatHandler::assertId(), currentId, getDimensionOrder(), getEffectiveSizeC(), getImageCount(), ome::files::getIndex(), getModuloC(), getModuloT(), getModuloZ(), getSizeT(), and getSizeZ().

◆ getLookupTable()

void ome::files::detail::FormatReader::getLookupTable ( dimension_size_type  plane,
VariantPixelBuffer buf 
) const
virtual

Get the color lookup table associated with an image plane.

If no image planes have been opened, or if isIndexed() returns false, then this may throw an exception.

The VariantPixelBuffer will use the X dimension for the value index and the sub-channel dimension for the color samples (order is RGB). Depending upon the image type, the size of the X dimension may vary. It will typically be 2^8 or 2^16, but other sizes are possible.

Parameters
bufthe destination pixel buffer.
planethe plane index within the series.
Exceptions
FormatExceptionif a lookup table could not be obtained.

Implements ome::files::FormatReader.

Reimplemented in ome::files::in::OMETIFFReader, and ome::files::in::MinimalTIFFReader.

References ome::files::FormatHandler::assertId(), and currentId.

◆ getMetadataOptions() [1/2]

const MetadataOptions & ome::files::detail::FormatReader::getMetadataOptions ( ) const
virtual

Get metadata options.

Returns
the current options.

Implements ome::files::MetadataConfigurable.

References metadataOptions.

◆ getMetadataOptions() [2/2]

MetadataOptions & ome::files::detail::FormatReader::getMetadataOptions ( )
virtual

Get metadata options.

Returns
the current options.

Implements ome::files::MetadataConfigurable.

References metadataOptions.

◆ getMetadataStore() [1/2]

const std::shared_ptr<::ome::xml::meta::MetadataStore > & ome::files::detail::FormatReader::getMetadataStore ( ) const
virtual

Get the current metadata store for this reader.

Returns
the metadata store, which will never be null.

Implements ome::files::FormatReader.

References metadataStore.

Referenced by ome::files::in::OMETIFFReader::getMetadataStoreForConversion(), ome::files::in::OMETIFFReader::getMetadataStoreForDisplay(), ome::files::in::MinimalTIFFReader::initFile(), initFile(), ome::files::in::OMETIFFReader::initFile(), makeFilterMetadata(), and setId().

+ Here is the caller graph for this function:

◆ getMetadataStore() [2/2]

std::shared_ptr<::ome::xml::meta::MetadataStore > & ome::files::detail::FormatReader::getMetadataStore ( )
virtual

Get the current metadata store for this reader.

Returns
the metadata store, which will never be null.

Implements ome::files::FormatReader.

References metadataStore.

◆ getMetadataValue()

const MetadataMap::value_type & ome::files::detail::FormatReader::getMetadataValue ( const std::string &  field) const
virtual

Get a global metadata value.

Obtain the specified metadata field's value for the current dataset.

Parameters
fieldthe name associated with the metadata field.
Returns
the value.
Exceptions
boost::bad_geton failure if the key was not found.

Implements ome::files::FormatReader.

References ome::files::MetadataMap::get(), and metadata.

◆ getModuloC() [1/2]

Modulo & ome::files::detail::FormatReader::getModuloC ( )
virtual

Get the Modulo subdivision of the C dimension.

Returns
the Modulo defining the C dimension subdivision.

Implements ome::files::FormatReader.

References getCoreIndex(), getCoreMetadata(), and ome::files::CoreMetadata::moduloC.

Referenced by getIndex(), getZCTModuloCoords(), and setId().

+ Here is the caller graph for this function:

◆ getModuloC() [2/2]

const Modulo & ome::files::detail::FormatReader::getModuloC ( ) const
virtual

Get the Modulo subdivision of the C dimension.

Returns
the Modulo defining the C dimension subdivision.

Implements ome::files::FormatReader.

References getCoreIndex(), getCoreMetadata(), and ome::files::CoreMetadata::moduloC.

◆ getModuloT() [1/2]

Modulo & ome::files::detail::FormatReader::getModuloT ( )
virtual

Get the Modulo subdivision of the T dimension.

Returns
the Modulo defining the T dimension subdivision.

Implements ome::files::FormatReader.

References getCoreIndex(), getCoreMetadata(), and ome::files::CoreMetadata::moduloT.

Referenced by getIndex(), getZCTModuloCoords(), and setId().

+ Here is the caller graph for this function:

◆ getModuloT() [2/2]

const Modulo & ome::files::detail::FormatReader::getModuloT ( ) const
virtual

Get the Modulo subdivision of the T dimension.

Returns
the Modulo defining the T dimension subdivision.

Implements ome::files::FormatReader.

References getCoreIndex(), getCoreMetadata(), and ome::files::CoreMetadata::moduloT.

◆ getModuloZ() [1/2]

Modulo & ome::files::detail::FormatReader::getModuloZ ( )
virtual

Get the Modulo subdivision of the Z dimension.

Returns
the Modulo defining the Z dimension subdivision.

Implements ome::files::FormatReader.

References getCoreIndex(), getCoreMetadata(), and ome::files::CoreMetadata::moduloZ.

Referenced by getIndex(), getZCTModuloCoords(), and setId().

+ Here is the caller graph for this function:

◆ getModuloZ() [2/2]

const Modulo & ome::files::detail::FormatReader::getModuloZ ( ) const
virtual

Get the Modulo subdivision of the Z dimension.

Returns
the Modulo defining the Z dimension subdivision.

Implements ome::files::FormatReader.

References getCoreIndex(), getCoreMetadata(), and ome::files::CoreMetadata::moduloZ.

◆ getOptimalTileHeight() [1/2]

dimension_size_type ome::files::detail::FormatReader::getOptimalTileHeight ( dimension_size_type  channel) const
virtual

Get the optimal sub-image height.

This is intended for use with openBytes().

Parameters
channelthe channel to use, range [0, EffectiveSizeC).
Returns
the optimal height.

Implements ome::files::FormatReader.

Reimplemented in ome::files::in::OMETIFFReader.

References ome::files::FormatHandler::assertId(), ome::files::bytesPerPixel(), currentId, getPixelType(), getRGBChannelCount(), getSizeX(), and getSizeY().

◆ getOptimalTileHeight() [2/2]

dimension_size_type ome::files::detail::FormatReader::getOptimalTileHeight ( ) const
virtual

Get the optimal sub-image height.

This is intended for use with openBytes(). Note that this overload does not have a channel argument, and so the value returned is the smallest height for all channels for convienience and compatibility with the Java implementation. If the optimal height varies widely between channels, this may result in suboptimal performance; specify the channel to get the optimal height for each channel.

Returns
the optimal height.

Implements ome::files::FormatReader.

References ome::files::FormatHandler::assertId(), currentId, and getEffectiveSizeC().

◆ getOptimalTileWidth() [1/2]

dimension_size_type ome::files::detail::FormatReader::getOptimalTileWidth ( dimension_size_type  channel) const
virtual

Get the optimal sub-image width.

This is intended for use with openBytes().

Parameters
channelthe channel to use, range [0, EffectiveSizeC).
Returns
the optimal width.

Implements ome::files::FormatReader.

Reimplemented in ome::files::in::OMETIFFReader.

References ome::files::FormatHandler::assertId(), currentId, and getSizeX().

◆ getOptimalTileWidth() [2/2]

dimension_size_type ome::files::detail::FormatReader::getOptimalTileWidth ( ) const
virtual

Get the optimal sub-image width.

This is intended for use with openBytes(). Note that this overload does not have a channel argument, and so the value returned is the smallest width for all channels for convienience and compatibility with the Java implementation. If the optimal width varies widely between channels, this may result in suboptimal performance; specify the channel to get the optimal width for each channel.

Returns
the optimal width.

Implements ome::files::FormatReader.

References ome::files::FormatHandler::assertId(), currentId, and getEffectiveSizeC().

◆ getPixelType()

ome::xml::model::enums::PixelType ome::files::detail::FormatReader::getPixelType ( ) const
virtual

Get the pixel type.

Returns
the pixel type.

Implements ome::files::FormatReader.

References ome::files::FormatHandler::assertId(), currentId, getCoreIndex(), getCoreMetadata(), and ome::files::CoreMetadata::pixelType.

Referenced by getBitsPerPixel(), getOptimalTileHeight(), and readPlane().

+ Here is the caller graph for this function:

◆ getPlane()

dimension_size_type ome::files::detail::FormatReader::getPlane ( ) const
virtual

Get the active plane.

Returns
the active plane.

Implements ome::files::FormatReader.

References ome::files::FormatHandler::assertId(), currentId, and plane.

◆ getPossibleDomains()

const std::vector< std::string > & ome::files::detail::FormatReader::getPossibleDomains ( const std::string &  id) const
virtual

Get the possible domains represented in which this format is used.

Parameters
idfilename to check.
Returns
a list of domains.
Exceptions
FormatExceptionif there was a problem parsing the metadata of the file.
Todo:
can this be a reference to static data?

Implements ome::files::FormatReader.

References domains.

◆ getRequiredDirectories()

uint32_t ome::files::detail::FormatReader::getRequiredDirectories ( const std::vector< std::string > &  files) const
virtual

Get required parent directories.

Get the number of parent directories that are important when processing the given list of files. The number of directories is relative to the common parent. For example, given a list with these two files:

  • /path/to/file/foo
  • /path/to/file/that/is/related

A return value of 0 indicates that /path/to/file/ is irrelevant. A return value of 1 indicates that /path/to/ is irrelevant. Return values less than 0 are invalid.

All listed files are assumed to belong to datasets of the same format.

Parameters
filesthe file list being processed.
Returns
the number of important parent directories for the file list.
Exceptions
FormatExceptionif there was a problem parsing the metadata of the file.
Todo:
This could use a much better explanation, it's not at all clear what the return value means. Is it an index into files? Is it an index into the path components? Of which of the files? In which order? From the root or common parent? Is the order of files important?

Implements ome::files::FormatReader.

◆ getResolution()

dimension_size_type ome::files::detail::FormatReader::getResolution ( ) const
virtual

Get the active resolution level.

Returns
the resolution level.
See also
getResolutionCount()

Implements ome::files::FormatReader.

References resolution.

◆ getResolutionCount()

dimension_size_type ome::files::detail::FormatReader::getResolutionCount ( ) const
virtual

Get the number of resolutions for the current series.

Resolutions are stored in descending order of size, so the largest resolution is first and the smallest resolution is last.

Returns
the number of resolutions.

Implements ome::files::FormatReader.

References ome::files::FormatHandler::assertId(), core, currentId, getSeries(), hasFlattenedResolutions(), and seriesToCoreIndex().

Referenced by setResolution().

+ Here is the caller graph for this function:

◆ getRGBChannelCount()

dimension_size_type ome::files::detail::FormatReader::getRGBChannelCount ( dimension_size_type  channel) const
virtual

Get the number of channels returned for a call to openBytes().

The most common case where this value is greater than 1 is for interleaved RGB data, such as a 24-bit color image plane. However, it is possible for this value to be greater than 1 for non-interleaved data, such as an RGB TIFF with Planar rather than Chunky configuration.

Parameters
channelthe channel to use, range [0, EffectiveSizeC).
Returns
the number of channels.

Implements ome::files::FormatReader.

References ome::files::FormatHandler::assertId(), currentId, getCoreIndex(), getCoreMetadata(), and ome::files::CoreMetadata::sizeC.

Referenced by getOptimalTileHeight(), and isRGB().

+ Here is the caller graph for this function:

◆ getSeries()

dimension_size_type ome::files::detail::FormatReader::getSeries ( ) const
virtual

Get the active series.

Returns
the active series.

Implements ome::files::FormatReader.

References series.

Referenced by getResolutionCount(), ome::files::in::MinimalTIFFReader::ifdAtIndex(), and setResolution().

+ Here is the caller graph for this function:

◆ getSeriesCount()

dimension_size_type ome::files::detail::FormatReader::getSeriesCount ( ) const
virtual

Get the number of image series in this file.

Returns
the number of image series.
Exceptions
std::logic_errorif the sub-resolution metadata (if any) is invalid; this will only occur if the reader sets invalid metadata.

Implements ome::files::FormatReader.

References ome::files::FormatHandler::assertId(), core, coreIndexToSeries(), currentId, and hasFlattenedResolutions().

Referenced by getUsedFiles(), and setId().

+ Here is the caller graph for this function:

◆ getSeriesMetadata()

const MetadataMap & ome::files::detail::FormatReader::getSeriesMetadata ( ) const
virtual

Get series metadata map.

Obtain the map containing the series metadata field/value pairs the active series in the current dataset.

Returns
the series metadata map.

Implements ome::files::FormatReader.

References ome::files::FormatHandler::assertId(), currentId, getCoreIndex(), getCoreMetadata(), and ome::files::CoreMetadata::seriesMetadata.

Referenced by getSeriesMetadataValue(), and setId().

+ Here is the caller graph for this function:

◆ getSeriesMetadataValue()

const MetadataMap::value_type & ome::files::detail::FormatReader::getSeriesMetadataValue ( const MetadataMap::key_type field) const
virtual

Get a series metadata value.

Obtain the specified metadata field's value for the active series in the current dataset.

Parameters
fieldthe name associated with the metadata field.
Returns
the value.
Exceptions
boost::bad_geton failure if the key was not found.

Implements ome::files::FormatReader.

References ome::files::FormatHandler::assertId(), currentId, ome::files::MetadataMap::get(), and getSeriesMetadata().

◆ getSeriesUsedFiles()

const std::vector< boost::filesystem::path > ome::files::detail::FormatReader::getSeriesUsedFiles ( bool  noPixels = false) const
virtual

Get the files used by the active series.

Parameters
noPixelsexclude pixel data files if true, or include them if false.
Returns
a list of filenames.

Implements ome::files::FormatReader.

Reimplemented in ome::files::in::OMETIFFReader.

References currentId.

Referenced by getAdvancedSeriesUsedFiles(), and getUsedFiles().

+ Here is the caller graph for this function:

◆ getSizeC()

dimension_size_type ome::files::detail::FormatReader::getSizeC ( ) const
virtual

Get the size of the C dimension.

Returns
the C dimension size.

Implements ome::files::FormatReader.

References ome::files::FormatHandler::assertId(), currentId, getCoreIndex(), and getCoreMetadata().

◆ getSizeT()

dimension_size_type ome::files::detail::FormatReader::getSizeT ( ) const
virtual

Get the size of the T dimension.

Returns
the T dimension size.

Implements ome::files::FormatReader.

References ome::files::FormatHandler::assertId(), currentId, getCoreIndex(), getCoreMetadata(), and ome::files::CoreMetadata::sizeT.

Referenced by getIndex(), getZCTCoords(), and getZCTModuloCoords().

+ Here is the caller graph for this function:

◆ getSizeX()

dimension_size_type ome::files::detail::FormatReader::getSizeX ( ) const
virtual

Get the size of the X dimension.

Returns
the X dimension size.

Implements ome::files::FormatReader.

References ome::files::FormatHandler::assertId(), currentId, getCoreIndex(), getCoreMetadata(), and ome::files::CoreMetadata::sizeX.

Referenced by getOptimalTileHeight(), getOptimalTileWidth(), getThumbSize(), openBytes(), and readPlane().

+ Here is the caller graph for this function:

◆ getSizeY()

dimension_size_type ome::files::detail::FormatReader::getSizeY ( ) const
virtual

Get the size of the Y dimension.

Returns
the Y dimension size.

Implements ome::files::FormatReader.

References ome::files::FormatHandler::assertId(), currentId, getCoreIndex(), getCoreMetadata(), and ome::files::CoreMetadata::sizeY.

Referenced by getOptimalTileHeight(), getThumbSize(), openBytes(), and readPlane().

+ Here is the caller graph for this function:

◆ getSizeZ()

dimension_size_type ome::files::detail::FormatReader::getSizeZ ( ) const
virtual

Get the size of the Z dimension.

Returns
the Z dimension size.

Implements ome::files::FormatReader.

References ome::files::FormatHandler::assertId(), currentId, getCoreIndex(), getCoreMetadata(), and ome::files::CoreMetadata::sizeZ.

Referenced by getIndex(), getZCTCoords(), and getZCTModuloCoords().

+ Here is the caller graph for this function:

◆ getSuffixes()

const std::vector< boost::filesystem::path > & ome::files::detail::FormatReader::getSuffixes ( ) const
virtual

Get the default file suffixes for this file format.

Returns
a list of file suffixes.

Implements ome::files::FormatHandler.

References readerProperties, and ome::files::detail::ReaderProperties::suffixes.

Referenced by ome::files::in::OMETIFFReader::isFilenameThisTypeImpl().

+ Here is the caller graph for this function:

◆ getSupportedMetadataLevels()

const std::set< MetadataOptions::MetadataLevel > & ome::files::detail::FormatReader::getSupportedMetadataLevels ( )
virtual

Get the supported metadata levels.

Returns
a set of supported metadata levels.

Implements ome::files::MetadataConfigurable.

References ome::files::detail::ReaderProperties::metadata_levels, and readerProperties.

◆ getThumbSize()

std::array< dimension_size_type, 2 > ome::files::detail::FormatReader::getThumbSize ( ) const
protected

Get the thumbnail size of the X and Y dimensions.

Returns
an array containing the X and Y dimension thumbnail size (in that order).

References ome::files::FormatHandler::assertId(), currentId, getCoreIndex(), getCoreMetadata(), getSizeX(), getSizeY(), ome::files::CoreMetadata::thumbSizeX, and ome::files::CoreMetadata::thumbSizeY.

Referenced by getThumbSizeX(), and getThumbSizeY().

+ Here is the caller graph for this function:

◆ getThumbSizeX()

dimension_size_type ome::files::detail::FormatReader::getThumbSizeX ( ) const
virtual

Get the thumbnail size of the X dimension.

Returns
the X dimension thumbnail size.

Implements ome::files::FormatReader.

References getThumbSize().

◆ getThumbSizeY()

dimension_size_type ome::files::detail::FormatReader::getThumbSizeY ( ) const
virtual

Get the thumbnail size of the Y dimension.

Returns
the Y dimension thumbnail size.

Implements ome::files::FormatReader.

References getThumbSize().

◆ getUnderlyingReaders()

std::vector< std::shared_ptr<::ome::files::FormatReader > > ome::files::detail::FormatReader::getUnderlyingReaders ( ) const
virtual

Get all underlying readers.

Note
If there are no underlying readers, the list will be empty.
Returns
a list of readers.

Implements ome::files::FormatReader.

◆ getUsedFiles()

const std::vector< boost::filesystem::path > ome::files::detail::FormatReader::getUsedFiles ( bool  noPixels = false) const
virtual

Get the files used by this dataset.

Parameters
noPixelsexclude pixel data files if true, or include them if false.
Returns
a list of filenames.

Implements ome::files::FormatReader.

References getSeriesCount(), getSeriesUsedFiles(), and setSeries().

Referenced by getAdvancedUsedFiles(), initFile(), and isUsedFile().

+ Here is the caller graph for this function:

◆ getZCTCoords()

std::array< dimension_size_type, 3 > ome::files::detail::FormatReader::getZCTCoords ( dimension_size_type  index) const
virtual

Get the Z, C and T coordinate of a linear index.

Parameters
indexthe linear index.
Returns
an array containing Z, C and T values (real sizes).
Todo:
unify with the pixel buffer dimension indexes.

Implements ome::files::FormatReader.

References ome::files::FormatHandler::assertId(), currentId, getDimensionOrder(), getEffectiveSizeC(), getImageCount(), getSizeT(), getSizeZ(), and ome::files::getZCTCoords().

◆ getZCTModuloCoords()

std::array< dimension_size_type, 6 > ome::files::detail::FormatReader::getZCTModuloCoords ( dimension_size_type  index) const
virtual

Get the Z, C, T, ModuloZ, ModuloC and ModuloT coordinate of a linear index.

Note
The Z, C and T coordinates are not the same as those returned by getZCTCoords(dimension_size_type) because the size of the modulo dimensions is taken into account. The effective size for each of these dimensions is limited to the total size of the dimension divided by the modulo size.
Parameters
indexthe linear index.
Returns
an array containing Z, C, T, ModuloZ, ModuloC and ModuloT values (effective sizes).
Todo:
unify with the pixel buffer dimension indexes.

Implements ome::files::FormatReader.

References ome::files::FormatHandler::assertId(), currentId, getDimensionOrder(), getEffectiveSizeC(), getImageCount(), getModuloC(), getModuloT(), getModuloZ(), getSizeT(), getSizeZ(), and ome::files::getZCTCoords().

◆ hasCompanionFiles()

bool ome::files::detail::FormatReader::hasCompanionFiles ( ) const
virtual

Does this format support multi-file datasets?

Returns
true if multiple files are supported, false otherwise.

Implements ome::files::FormatReader.

References companionFiles.

◆ hasFlattenedResolutions()

bool ome::files::detail::FormatReader::hasFlattenedResolutions ( ) const
virtual

Get resolution flattening.

Returns
true if flattening is enabled, false otherwise.

Implements ome::files::FormatReader.

References flattenedResolutions.

Referenced by coreIndexToSeries(), getResolutionCount(), getSeriesCount(), and seriesToCoreIndex().

+ Here is the caller graph for this function:

◆ initFile()

void ome::files::detail::FormatReader::initFile ( const boost::filesystem::path &  id)
protectedvirtual

Initialize the given file.

This will parse header information, etc. and is called by setId. Most subclasses should override this method to perform initialization operations such as parsing metadata.

Parameters
idthe filename to open.
Exceptions
FormatExceptionif a parsing error occurs processing the file.
See also
ome::files::FormatHandler::setId.

Reimplemented in ome::files::in::OMETIFFReader, and ome::files::in::MinimalTIFFReader.

References ome::files::MetadataMap::clear(), close(), core, coreIndex, currentId, getMetadataStore(), getUsedFiles(), metadata, and series.

Referenced by ome::files::in::MinimalTIFFReader::initFile(), ome::files::in::OMETIFFReader::initFile(), and setId().

+ Here is the caller graph for this function:

◆ isFalseColor()

bool ome::files::detail::FormatReader::isFalseColor ( ) const
virtual

Get whether the image planes are false color.

This will be false if isIndexed() is false, or if isIndexed() is true and the lookup table represents "real" color data. This will be true if isIndexed() is true and the lookup table is only present to aid in visualization.

Returns
true if false color, false otherwise.

Implements ome::files::FormatReader.

References ome::files::FormatHandler::assertId(), currentId, ome::files::CoreMetadata::falseColor, getCoreIndex(), and getCoreMetadata().

◆ isFilenameThisTypeImpl()

bool ome::files::detail::FormatReader::isFilenameThisTypeImpl ( const boost::filesystem::path &  name) const
protectedvirtual

isThisType file implementation for readers.

Readers which require opening a file in order to determine its type should override this method with their own implementation. Reader implementations should open the specified file using their preferred method and check its validity.

Parameters
namethe file to open for checking.
Returns
true if the file is valid, false otherwise.

Reimplemented in ome::files::in::OMETIFFReader, and ome::files::in::MinimalTIFFReader.

Referenced by isThisType().

+ Here is the caller graph for this function:

◆ isGroupFiles()

bool ome::files::detail::FormatReader::isGroupFiles ( ) const
virtual

Get file grouping.

Returns
true if grouping is enabled, false otherwise.

Implements ome::files::FormatReader.

References group.

Referenced by ome::files::in::OMETIFFReader::isFilenameThisTypeImpl().

+ Here is the caller graph for this function:

◆ isIndexed()

bool ome::files::detail::FormatReader::isIndexed ( ) const
virtual

Get whether the image planes are indexed color.

This value does not affect getSizeC(), getEffectiveSizeC() or getRGBChannelCount().

Returns
true if indexed, false otherwise.

Implements ome::files::FormatReader.

References ome::files::FormatHandler::assertId(), currentId, getCoreIndex(), getCoreMetadata(), and ome::files::CoreMetadata::indexed.

◆ isInterleaved() [1/2]

bool ome::files::detail::FormatReader::isInterleaved ( ) const
virtual

Get whether or not the channels are interleaved.

This method exists because X and Y must appear first in the dimension order. For interleaved data, getDimensionOrder() returns XYCTZ or XYCZT and this method returns true.

Note that this flag returns whether or not the data returned by openBytes() is interleaved. In most cases, this will match the interleaving in the original file, but for some formats (e.g. TIFF) channel re-ordering is done internally and the return value of this method will not match what is in the original file.

Returns
true if the channels are interleaved, false otherwise.

Implements ome::files::FormatReader.

Referenced by readPlane().

+ Here is the caller graph for this function:

◆ isInterleaved() [2/2]

bool ome::files::detail::FormatReader::isInterleaved ( dimension_size_type  channel) const
virtual

Get whether or not the given channel is interleaved.

Some data with multiple channels within C have the sub-channels of one sub-dimension interleaved, and the other not. For example, SDTReader handles spectral-lifetime data with interleaved lifetime bins and non-interleaved spectral channels.

Parameters
channelthe channel to use, range [0, EffectiveSizeC).
Returns
true if the sub-channel is interleaved, false otherwise.

Implements ome::files::FormatReader.

References ome::files::FormatHandler::assertId(), currentId, getCoreIndex(), getCoreMetadata(), and ome::files::CoreMetadata::interleaved.

◆ isLittleEndian()

bool ome::files::detail::FormatReader::isLittleEndian ( ) const
virtual

Get whether the data is in little-endian format.

Returns
false if big endian, true if little endian.

Implements ome::files::FormatReader.

References ome::files::FormatHandler::assertId(), currentId, getCoreIndex(), getCoreMetadata(), and ome::files::CoreMetadata::littleEndian.

Referenced by readPlane().

+ Here is the caller graph for this function:

◆ isMetadataComplete()

bool ome::files::detail::FormatReader::isMetadataComplete ( ) const
virtual

Get status of metadata parsing.

Returns
true if this format's metadata is completely parsed, false otherwise.

Implements ome::files::FormatReader.

References ome::files::FormatHandler::assertId(), currentId, getCoreIndex(), getCoreMetadata(), and ome::files::CoreMetadata::metadataComplete.

◆ isMetadataFiltered()

bool ome::files::detail::FormatReader::isMetadataFiltered ( ) const
virtual

Get metadata filtering.

Returns
true if metadata filtering is enabled, false if disabled.

Implements ome::files::FormatReader.

References filterMetadata.

Referenced by makeFilterMetadata().

+ Here is the caller graph for this function:

◆ isNormalized()

bool ome::files::detail::FormatReader::isNormalized ( ) const
virtual

Get float normalization.

Returns
true if float normalization is enabled, false otherwise.

Implements ome::files::FormatReader.

References normalizeData.

◆ isOrderCertain()

bool ome::files::detail::FormatReader::isOrderCertain ( ) const
virtual

Get whether the dimension order and sizes are known, or merely guesses.

Returns
true if the order is known, false otherwise.

Implements ome::files::FormatReader.

References ome::files::FormatHandler::assertId(), currentId, getCoreIndex(), getCoreMetadata(), and ome::files::CoreMetadata::orderCertain.

◆ isOriginalMetadataPopulated()

bool ome::files::detail::FormatReader::isOriginalMetadataPopulated ( ) const
virtual

Get proprietary metadata storage.

Returns
true if proprietary metadata is saved in the MetadataStore, false otherwise.
Todo:
The name of this method is awful.

Implements ome::files::FormatReader.

References saveOriginalMetadata.

◆ isRGB()

bool ome::files::detail::FormatReader::isRGB ( dimension_size_type  channel) const
virtual

Check if the image planes for a channel have more than one sub-channel per openBytes() call.

Parameters
channelthe channel to use, range [0, EffectiveSizeC).
Returns
true if and only if getRGBChannelCount() returns a value greater than 1, false otherwise.

Implements ome::files::FormatReader.

References ome::files::FormatHandler::assertId(), currentId, and getRGBChannelCount().

◆ isSingleFile()

bool ome::files::detail::FormatReader::isSingleFile ( const boost::filesystem::path &  id) const
virtual

Is this a single-file format?

Parameters
idfilename to check.
Returns
true if this is a single-file format, false otherwise.
Exceptions
FormatExceptionif there was a problem parsing the metadata of the file.

Implements ome::files::FormatReader.

Reimplemented in ome::files::in::OMETIFFReader.

◆ isStreamThisTypeImpl()

bool ome::files::detail::FormatReader::isStreamThisTypeImpl ( std::istream &  stream) const
protectedvirtual

isThisType stream implementation for readers.

Readers which require opening a file in order to determine its type, and which can handle istream data, should override this method with their own implementation. Reader implementations should check the validity of the stream data.

Parameters
streamthe input stream to check.
Returns
true if the stream is valid, false otherwise.

Referenced by isThisType().

+ Here is the caller graph for this function:

◆ isThisType() [1/4]

bool ome::files::detail::FormatReader::isThisType ( const boost::filesystem::path &  name,
bool  open = true 
) const
virtual

Check if the given file is a valid instance of this file format.

Parameters
namethe file to open for checking.
openIf true, and the file extension is insufficient to determine the file type, the file may be opened for further analysis, or other relatively expensive file system operations (such as file existence tests and directory listings) may be performed. If false, file system access is not allowed.
Returns
true if the file is valid, false otherwise.
Todo:
Could this method be static?

Implements ome::files::FormatHandler.

Reimplemented in ome::files::in::OMETIFFReader.

References ome::common::canonical(), ome::files::FormatHandler::checkSuffix(), ome::files::detail::ReaderProperties::compression_suffixes, isFilenameThisTypeImpl(), readerProperties, ome::files::detail::ReaderProperties::suffixes, suffixNecessary, and suffixSufficient.

Referenced by ome::files::in::OMETIFFReader::isThisType(), and isThisType().

+ Here is the caller graph for this function:

◆ isThisType() [2/4]

bool ome::files::detail::FormatReader::isThisType ( const uint8_t *  begin,
std::size_t  length 
) const
virtual

Check if the given buffer is a valid header for this file format.

The buffer is defined as a half-open range using two iterators.

Parameters
beginthe start of the buffer.
lengththe buffer length.
Returns
true if the file is valid, false otherwise.
Todo:
Could this method be static and/or const?

Implements ome::files::FormatReader.

References isThisType().

◆ isThisType() [3/4]

bool ome::files::detail::FormatReader::isThisType ( const uint8_t *  begin,
const uint8_t *  end 
) const
virtual

Check if the given buffer is a valid header for this file format.

The buffer is defined as a half-open range using two iterators.

Parameters
beginthe start of the buffer.
endone past the end of the buffer.
Returns
true if the file is valid, false otherwise.
Todo:
Could this method be static and/or const?

Implements ome::files::FormatReader.

References isThisType().

◆ isThisType() [4/4]

bool ome::files::detail::FormatReader::isThisType ( std::istream &  stream) const
virtual

Check if the given input stream is a valid stream for this file format.

Parameters
streamthe input stream to check.
Returns
true if the file is valid, false otherwise.
Todo:
Could this method be static and/or const?

Implements ome::files::FormatReader.

References isStreamThisTypeImpl().

◆ isThumbnailSeries()

bool ome::files::detail::FormatReader::isThumbnailSeries ( ) const
virtual

Get whether the current series is a lower resolution copy of a different series.

Returns
true if a low resolution copy, false otherwise.

Implements ome::files::FormatReader.

References ome::files::FormatHandler::assertId(), currentId, getCoreIndex(), getCoreMetadata(), and ome::files::CoreMetadata::thumbnail.

◆ isUsedFile()

bool ome::files::detail::FormatReader::isUsedFile ( const boost::filesystem::path &  file)
protectedvirtual

Check if a file is in the used files list.

Parameters
filethe file to check.
Returns
true if the file is used, false if not used.
Todo:
: Use a set rather than a list?

References ome::common::canonical(), and getUsedFiles().

◆ makeFilterMetadata()

std::shared_ptr<::ome::xml::meta::MetadataStore > ome::files::detail::FormatReader::makeFilterMetadata ( )
protectedvirtual

Create a configured FilterMetadata instance.

This creates, configures and returns an instance of ome::xml::meta::FilterMetadata.

Returns
a FilterMetadata instance.

References getMetadataStore(), and isMetadataFiltered().

◆ openBytes() [1/2]

void ome::files::detail::FormatReader::openBytes ( dimension_size_type  plane,
VariantPixelBuffer buf 
) const
virtual

Obtain an image plane.

Obtain and copy the image plane from the current series into a VariantPixelBuffer of size

Parameters
planethe plane index within the series.
bufthe destination pixel buffer.
Exceptions
FormatExceptionif there was a problem parsing the metadata of the file.

Implements ome::files::FormatReader.

References getSizeX(), and getSizeY().

◆ openBytes() [2/2]

void ome::files::detail::FormatReader::openBytes ( dimension_size_type  plane,
VariantPixelBuffer buf,
dimension_size_type  x,
dimension_size_type  y,
dimension_size_type  w,
dimension_size_type  h 
) const
virtual

Obtain a sub-image of an image plane.

Obtain and copy the sub-image of an image plane from the current series into a VariantPixelBuffer of size

Parameters
planethe plane index within the series.
bufthe destination pixel buffer.
xthe X coordinate of the upper-left corner of the sub-image.
ythe Y coordinate of the upper-left corner of the sub-image.
wthe width of the sub-image.
hthe height of the sub-image.
Exceptions
FormatExceptionif there was a problem parsing the metadata of the file.

Implements ome::files::FormatReader.

References openBytesImpl(), and setPlane().

◆ openBytesImpl()

virtual void ome::files::detail::FormatReader::openBytesImpl ( dimension_size_type  plane,
VariantPixelBuffer buf,
dimension_size_type  x,
dimension_size_type  y,
dimension_size_type  w,
dimension_size_type  h 
) const
protectedpure virtual

Obtain a sub-image of an image plane.

Obtain and copy the sub-image of an image plane from the current series into a VariantPixelBuffer of size

Parameters
planethe plane index within the series.
bufthe destination pixel buffer.
xthe X coordinate of the upper-left corner of the sub-image.
ythe Y coordinate of the upper-left corner of the sub-image.
wthe width of the sub-image.
hthe height of the sub-image.
Exceptions
FormatExceptionif there was a problem parsing the metadata of the file.

Implemented in ome::files::in::OMETIFFReader, and ome::files::in::MinimalTIFFReader.

Referenced by openBytes().

+ Here is the caller graph for this function:

◆ openThumbBytes()

void ome::files::detail::FormatReader::openThumbBytes ( dimension_size_type  plane,
VariantPixelBuffer buf 
) const
virtual

Obtain a thumbnail of an image plane.

Obtail and copy the thumbnail for the specified image plane from the current series into a VariantPixelBuffer.

Parameters
planethe plane index within the series.
bufthe destination pixel buffer.
Todo:
Implement openThumbBytes. This requires implementing image rescaling/resampling.

Implements ome::files::FormatReader.

References ome::files::FormatHandler::assertId(), and currentId.

◆ readPlane() [1/2]

void ome::files::detail::FormatReader::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 
)
protectedvirtual

Read a raw plane.

Note that the pixel buffer must be of the correct size to store the pixel data.

Parameters
sourcethe stream to read the plane from.
destthe pixel buffer in which to store the plane.
xthe left edge of the plane.
ythe top edge of the plane.
wthe width of the plane.
hthe height of the plane.
samplesthe number of samples per pixel.

References ome::files::bytesPerPixel(), ome::files::byteswap(), ome::files::ENDIAN_BIG, ome::files::ENDIAN_LITTLE, getPixelType(), getSizeX(), getSizeY(), isInterleaved(), and isLittleEndian().

◆ readPlane() [2/2]

void ome::files::detail::FormatReader::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 
)
protectedvirtual

Read a raw plane with scanline padding.

Note that the pixel buffer must be of the correct size to store the pixel data.

Parameters
sourcethe stream to read the plane from.
destthe pixel buffer in which to store the plane.
xthe left edge of the plane.
ythe top edge of the plane.
wthe width of the plane.
hthe height of the plane.
scanlinePadthe scanline padding.
samplesthe number of samples per pixel.

References ome::files::DIM_CHANNEL, ome::files::DIM_MODULO_C, ome::files::DIM_MODULO_T, ome::files::DIM_MODULO_Z, ome::files::DIM_SPATIAL_X, ome::files::DIM_SPATIAL_Y, ome::files::DIM_SPATIAL_Z, ome::files::DIM_SUBCHANNEL, ome::files::DIM_TEMPORAL_T, ome::files::PixelBufferBase::dimensions, getDimensionOrder(), getPixelType(), isInterleaved(), ome::files::PixelBufferBase::make_storage_order(), ome::files::VariantPixelBuffer::pixelType(), ome::files::VariantPixelBuffer::setBuffer(), ome::files::VariantPixelBuffer::shape(), ome::files::VariantPixelBuffer::storage_order(), and ome::files::VariantPixelBuffer::vbuffer().

◆ seriesToCoreIndex()

dimension_size_type ome::files::detail::FormatReader::seriesToCoreIndex ( dimension_size_type  series) const
virtual

Get the first core index corresponding to the specified series.

Parameters
seriesthe series to use.
Returns
the first for index for the series.

Implements ome::files::FormatReader.

References core, coreIndex, hasFlattenedResolutions(), resolution, and series.

Referenced by getResolutionCount(), setCoreIndex(), setResolution(), and setSeries().

+ Here is the caller graph for this function:

◆ setCoreIndex()

void ome::files::detail::FormatReader::setCoreIndex ( dimension_size_type  index) const
virtual

Set the current resolution/series (ignoring sub-resolutions).

Equivalent to setSeries(), but with flattened resolutions always set to false.

Parameters
indexthe core index to set.
Todo:
Remove use of stateful API which requires use of series switching in const methods.
Exceptions
std::logic_errorif the index is invalid.

Implements ome::files::FormatReader.

References core, coreIndex, coreIndexToSeries(), plane, resolution, series, and seriesToCoreIndex().

◆ setFlattenedResolutions()

void ome::files::detail::FormatReader::setFlattenedResolutions ( bool  flatten)
virtual

Set resolution flattening.

This controls whether or not resolution levels are flattened into individual series. This alters the behaviour of setSeries() and getSeries() but does not affect the behaviour of setCoreIndex() and getCoreIndex(), which are resolution-independent.

Parameters
flattentrue to enable flattening, false to disable.

Implements ome::files::FormatReader.

References ome::files::FormatHandler::assertId(), currentId, and flattenedResolutions.

◆ setGroupFiles()

void ome::files::detail::FormatReader::setGroupFiles ( bool  group)
virtual

Set file grouping.

This specifies whether or not to force grouping in multi-file formats.

Parameters
grouptrue to enable grouping, false to disable.

Implements ome::files::FormatReader.

References ome::files::FormatHandler::assertId(), currentId, and group.

◆ setId()

void ome::files::detail::FormatReader::setId ( const boost::filesystem::path &  id)
virtual

Set the current file name.

Note this will throw FormatException if there are problems opening the file.

Parameters
idthe filename to open.
Todo:
Implement addModuloAlong. Requires bits of MetadataTools OMEXMLServiceImpl.

Implements ome::files::FormatHandler.

References ome::files::MetadataMap::begin(), ome::common::canonical(), currentId, ome::files::MetadataMap::end(), ome::files::fillOriginalMetadata(), getMetadataStore(), getModuloC(), getModuloT(), getModuloZ(), getSeriesCount(), getSeriesMetadata(), initFile(), metadata, saveOriginalMetadata, series, ome::files::MetadataMap::set(), setSeries(), and ome::common::trim().

◆ setMetadataFiltered()

void ome::files::detail::FormatReader::setMetadataFiltered ( bool  filter)
virtual

Set metadata filtering.

If filtering is enabled, "ugly" metadata (entries with unprintable characters, and extremely large entries) should be discarded from the metadata table.

Parameters
filtertrue to enable filtering, false to disable.

Implements ome::files::FormatReader.

References ome::files::FormatHandler::assertId(), currentId, and filterMetadata.

◆ setMetadataOptions()

void ome::files::detail::FormatReader::setMetadataOptions ( const MetadataOptions options)
virtual

Set metadata options.

Parameters
optionsthe options to set.

Implements ome::files::MetadataConfigurable.

References metadataOptions.

◆ setMetadataStore()

void ome::files::detail::FormatReader::setMetadataStore ( std::shared_ptr<::ome::xml::meta::MetadataStore > &  store)
virtual

Set the default metadata store for this reader.

Parameters
storea metadata store implementation.

Implements ome::files::FormatReader.

References ome::files::FormatHandler::assertId(), currentId, and metadataStore.

◆ setNormalized()

void ome::files::detail::FormatReader::setNormalized ( bool  normalize)
virtual

Set float normalization.

Parameters
normalizetrue to enable normalization, or false to disable.

Implements ome::files::FormatReader.

References ome::files::FormatHandler::assertId(), currentId, and normalizeData.

◆ setOriginalMetadataPopulated()

void ome::files::detail::FormatReader::setOriginalMetadataPopulated ( bool  populate)
virtual

Specifies whether or not to save proprietary metadata in the MetadataStore.

Parameters
populatetrue to save or false to discard.

Implements ome::files::FormatReader.

References ome::files::FormatHandler::assertId(), currentId, and saveOriginalMetadata.

◆ setPlane()

void ome::files::detail::FormatReader::setPlane ( dimension_size_type  plane) const
virtual

Set the active plane.

Parameters
planethe plane to activate.
Todo:
Remove use of stateful API which requires use of plane switching in const methods.

Implements ome::files::FormatReader.

References ome::files::FormatHandler::assertId(), currentId, getImageCount(), and plane.

Referenced by ome::files::in::OMETIFFReader::getLookupTable(), and openBytes().

+ Here is the caller graph for this function:

◆ setResolution()

void ome::files::detail::FormatReader::setResolution ( dimension_size_type  resolution) const
virtual

Set the active resolution level.

Note
This also resets the current plane to 0.
Parameters
resolutionthe resolution to set.
See also
getResolutionCount()
Todo:
Remove use of stateful API which requires use of series switching in const methods.
Exceptions
std::logic_errorif the resolution is invalid.

Implements ome::files::FormatReader.

References coreIndex, getResolutionCount(), getSeries(), plane, resolution, and seriesToCoreIndex().

◆ setSeries()

void ome::files::detail::FormatReader::setSeries ( dimension_size_type  series) const
virtual

Set the active series.

Note
This also resets the resolution to 0 and the current plane to 0.
Parameters
seriesthe series to activate.
Todo:
Remove use of stateful API which requires use of series switching in const methods.
Exceptions
std::logic_errorif the series is invalid.

Implements ome::files::FormatReader.

References coreIndex, plane, resolution, series, and seriesToCoreIndex().

Referenced by getUsedFiles(), and setId().

+ Here is the caller graph for this function:

Member Data Documentation

◆ coreIndex

dimension_size_type ome::files::detail::FormatReader::coreIndex
mutableprotected

The number of the current series (flattened).

Todo:
Remove use of stateful API which requires use of series switching in const methods.

Referenced by close(), coreIndexToSeries(), getCoreIndex(), initFile(), seriesToCoreIndex(), setCoreIndex(), setResolution(), and setSeries().

◆ metadataStore

std::shared_ptr<::ome::xml::meta::MetadataStore> ome::files::detail::FormatReader::metadataStore
protected

Current metadata store.

Should never be accessed directly as the semantics of getMetadataStore() prevent "null" access.

Referenced by getMetadataStore(), ome::files::in::OMETIFFReader::initFile(), and setMetadataStore().

◆ plane

dimension_size_type ome::files::detail::FormatReader::plane
mutableprotected

The number of the current plane in the current series.

Todo:
Remove use of stateful API which requires use of series switching in const methods.

Referenced by close(), getPlane(), ome::files::in::OMETIFFReader::getSeriesUsedFiles(), ome::files::in::OMETIFFReader::ifdAtIndex(), ome::files::in::OMETIFFReader::initFile(), setCoreIndex(), setPlane(), setResolution(), and setSeries().

◆ resolution

dimension_size_type ome::files::detail::FormatReader::resolution
mutableprotected

The number of the current resolution.

Todo:
Remove use of stateful API which requires use of series switching in const methods.

Referenced by close(), getResolution(), seriesToCoreIndex(), setCoreIndex(), setResolution(), and setSeries().

◆ series

dimension_size_type ome::files::detail::FormatReader::series
mutableprotected

The number of the current series (non-flattened).

Todo:
Remove use of stateful API which requires use of series switching in const methods.

Referenced by close(), coreIndexToSeries(), ome::files::in::OMETIFFReader::findUsedFiles(), getSeries(), initFile(), ome::files::in::OMETIFFReader::initFile(), seriesToCoreIndex(), setCoreIndex(), setId(), and setSeries().


The documentation for this class was generated from the following files: