ome-files 0.1.0

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | Private Member Functions | 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:
[legend]
Collaboration diagram for ome::files::detail::FormatReader:
[legend]

## 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 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...
void | getLookupTable (dimension_size_type plane, VariantPixelBuffer &buf) const
| Get the color lookup table associated with an image plane. 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...
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.
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...
ome::compat::array< dimension_size_type, 3 > | getZCTCoords (dimension_size_type index) const
| Get the `Z`, `C` and `T` coordinate of a linear index. More...
ome::compat::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< ome::compat::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 (ome::compat::shared_ptr< ::ome::xml::meta::MetadataStore > &store)
| Set the default metadata store for this reader. More...
const ome::compat::shared_ptr< ::ome::xml::meta::MetadataStore > & | getMetadataStore () const
| Get the current metadata store for this reader. More...
ome::compat::shared_ptr< ::ome::xml::meta::MetadataStore > & | getMetadataStore ()
| Get the current metadata store for this reader. More...
std::vector< ome::compat::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< ome::compat::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 ome::compat::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 | 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...
ome::compat::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 ReaderProperties & | readerProperties
| Reader properties specific to the derived file format.
boost::optional< boost::filesystem::path > | currentId
| The identifier (path) of the currently open file.
ome::compat::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.
ome::compat::shared_ptr< ::ome::xml::meta::MetadataStore > | metadataStore
| Current metadata store. More...
MetadataOptions | metadataOptions
| Metadata parsing options.

## Private Member Functions
| FormatReader (const FormatReader &)
| Copy constructor (deleted).
FormatReader & | operator= (const FormatReader &)
| Assignment operator (deleted).

## 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:

- MetadataMap methods replace the use of FormatReader add*Meta/get*Meta methods; the metadata objects themselves provide these methods.
- flattenHashTables isn't implemented; MetadataMaps are self-flattening when streamed, and have a flatten method and visitors to generate a flat form.
- No getRotationTransform; add to AffineTransform itself.

## Member Function Documentation

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

  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.

Exceptions

  On | error; 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:

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

Get the series corresponding to the specified core index.

Parameters

  index | the 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:

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

  id | filename 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.

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

Get the files used by the active series.

Parameters

  noPixels | exclude 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.

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

Get the files used by this dataset.

Parameters

  noPixels | exclude 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.

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().

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.

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

Get the CoreMetadata index of the current resolution/series.

Returns
  the index.

Implements ome::files::FormatReader.

References coreIndex.

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:

const CoreMetadata& ome::files::detail::FormatReader::getCoreMetadata | ( | dimension_size_type | index | ) | const
| inline protected

Get CoreMetadata by core index.

Parameters

  index | the core index.

Returns
  the CoreMetadata.

Exceptions

  std::range_error | if the core index is invalid.
  std::logic_error | if 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:

CoreMetadata& ome::files::detail::FormatReader::getCoreMetadata | ( | dimension_size_type | index | ) |
| inline protected

Get CoreMetadata by core index.

Parameters

  index | the core index.

Returns
  the CoreMetadata.

Exceptions

  std::range_error | if the core index is invalid.
  std::logic_error | if the metadata is null.

const std::vector< ome::compat::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.

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:

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.

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:

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.

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

Get the effective size of the C dimension.

This guarantees that

getEffectiveSizeC() * getSizeZ() * getSizeT() == getImageCount()

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:

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:

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.

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.

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:

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

  z | the `Z` coordinate (real size).
  c | the `C` coordinate (real size).
  t | the `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().

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

  z | the `Z` coordinate (effective size).
  c | the `C` coordinate (effective size).
  t | the `T` coordinate (effective size).
  moduloZ | the `ModuloZ` coordinate (effective size).
  moduloC | the `ModuloC` coordinate (effective size).
  moduloT | the `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().

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

  buf | the destination pixel buffer.
  plane | the plane index within the series.

Exceptions

  FormatException | if 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.

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

Get metadata options.

Returns
  the current options.

Implements ome::files::MetadataConfigurable.

References metadataOptions.

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

Get metadata options.

Returns
  the current options.

Implements ome::files::MetadataConfigurable.

References metadataOptions.

const ome::compat::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(), makeFilterMetadata(), and setId().

Here is the caller graph for this function:

ome::compat::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.

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

  field | the name associated with the metadata field.

Returns
  the value.

Exceptions

  boost::bad_get | on failure if the key was not found.

Implements ome::files::FormatReader.

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

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:

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.

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:

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.

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:

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.

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

  channel | the 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().

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().

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

  channel | the 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().

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().

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:

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.

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

  id | filename to check.

Returns
  a list of domains.

Exceptions

  FormatException | if 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.

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

  files | the file list being processed.

Returns
  the number of important parent directories for the file list.

Exceptions

  FormatException | if 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.

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.

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:

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

  channel | the channel to use, range [0, EffectiveSizeC).

Returns
  the number of channels.

Implements ome::files::FormatReader.

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

Referenced by getOptimalTileHeight(), and isRGB().

Here is the caller graph for this function:

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:

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_error | if 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 ome::files::in::OMETIFFReader::getMetadataStoreForConversion(), ome::files::in::OMETIFFReader::getMetadataStoreForDisplay(), getUsedFiles(), and setId().

Here is the caller graph for this function:

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:

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

  field | the name associated with the metadata field.

Returns
  the value.

Exceptions

  boost::bad_get | on failure if the key was not found.

Implements ome::files::FormatReader.

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

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

  noPixels | exclude 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:

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().

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:

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(), and openBytes().

Here is the caller graph for this function:

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(), and openBytes().

Here is the caller graph for this function:

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:

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.

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.

ome::compat::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:

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().

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().

std::vector< ome::compat::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.

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

Get the files used by this dataset.

Parameters

  noPixels | exclude 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:

ome::compat::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

  index | the 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().

ome::compat::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

  index | the 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().

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.

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:

void ome::files::detail::FormatReader::initFile | ( | const boost::filesystem::path & | id | ) |
| protected virtual

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

  id | the filename to open.

Exceptions

  FormatException | if 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:

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().

bool ome::files::detail::FormatReader::isFilenameThisTypeImpl | ( | const boost::filesystem::path & | name | ) | const
| protected virtual

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

  name | the 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:

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.

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.

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:

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

  channel | the 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.

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 ome::files::in::OMETIFFReader::getMetadataStoreForConversion().

Here is the caller graph for this function:

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.

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:

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.

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.

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.

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

  channel | the 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().

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

Is this a single-file format?

Parameters

  id | filename to check.

Returns
  `true` if this is a single-file format, `false` otherwise.

Exceptions

  FormatException | if there was a problem parsing the metadata of the file.

Implements ome::files::FormatReader.

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

bool ome::files::detail::FormatReader::isStreamThisTypeImpl | ( | std::istream & | stream | ) | const
| protected virtual

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

  stream | the input stream to check.

Returns
  `true` if the stream is valid, `false` otherwise.

Referenced by isThisType().

Here is the caller graph for this function:

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

  name | the file to open for checking.
  open | If `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::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:

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

  begin | the start of the buffer.
  length | the 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().

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

  begin | the start of the buffer.
  end | one 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().

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

  stream | the 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().

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.

bool ome::files::detail::FormatReader::isUsedFile | ( | const boost::filesystem::path & | file | ) |
| protected virtual

Check if a file is in the used files list.

Parameters

  file | the 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().

ome::compat::shared_ptr<::ome::xml::meta::MetadataStore > ome::files::detail::FormatReader::makeFilterMetadata | ( |  | ) |
| protected virtual

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().

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

getSizeX * getSizeY * bytesPerPixel * getRGBChannelCount(channel)

Parameters

  plane | the plane index within the series.
  buf | the destination pixel buffer.

Exceptions

  FormatException | if there was a problem parsing the metadata of the file.

Implements ome::files::FormatReader.

References getSizeX(), and getSizeY().

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

w * h * bytesPerPixel * getRGBChannelCount(channel)

Parameters

  plane | the plane index within the series.
  buf | the destination pixel buffer.
  x | the `X` coordinate of the upper-left corner of the sub-image.
  y | the `Y` coordinate of the upper-left corner of the sub-image.
  w | the width of the sub-image.
  h | the height of the sub-image.

Exceptions

  FormatException | if there was a problem parsing the metadata of the file.

Implements ome::files::FormatReader.

References openBytesImpl(), and setPlane().

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
| protected pure 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

w * h * bytesPerPixel * getRGBChannelCount(channel)

Parameters

  plane | the plane index within the series.
  buf | the destination pixel buffer.
  x | the `X` coordinate of the upper-left corner of the sub-image.
  y | the `Y` coordinate of the upper-left corner of the sub-image.
  w | the width of the sub-image.
  h | the height of the sub-image.

Exceptions

  FormatException | if 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:

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

  plane | the plane index within the series.
  buf | the destination pixel buffer.

Todo:
  Implement openThumbBytes. This requires implementing image rescaling/resampling.

Implements ome::files::FormatReader.

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

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
| ) |  |
| protected virtual

Read a raw plane.

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

Parameters

  source | the stream to read the plane from.
  dest | the pixel buffer in which to store the plane.
  x | the left edge of the plane.
  y | the top edge of the plane.
  w | the width of the plane.
  h | the height of the plane.
  samples | the number of samples per pixel.

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
| ) |  |
| protected virtual

Read a raw plane with scanline padding.

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

Parameters

  source | the stream to read the plane from.
  dest | the pixel buffer in which to store the plane.
  x | the left edge of the plane.
  y | the top edge of the plane.
  w | the width of the plane.
  h | the height of the plane.
  scanlinePad | the scanline padding.
  samples | the 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().

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

  series | the 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:

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

  index | the core index to set.

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

Exceptions

  std::logic_error | if the index is invalid.

Implements ome::files::FormatReader.

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

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

  flatten | `true` to enable flattening, `false` to disable.

Implements ome::files::FormatReader.

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

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

  group | `true` to enable grouping, `false` to disable.

Implements ome::files::FormatReader.

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

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

  id | the 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().

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

  filter | `true` to enable filtering, `false` to disable.

Implements ome::files::FormatReader.

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

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

Set metadata options.

Parameters

  options | the options to set.

Implements ome::files::MetadataConfigurable.

References metadataOptions.

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

Set the default metadata store for this reader.

Parameters

  store | a metadata store implementation.

Implements ome::files::FormatReader.

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

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

Set float normalization.

Parameters

  normalize | `true` to enable normalization, or `false` to disable.

Implements ome::files::FormatReader.

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

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

Set the active plane.

Parameters

  plane | the 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:

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

  resolution | the resolution to set.

See also
  getResolutionCount()

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

Exceptions

  std::logic_error | if the resolution is invalid.

Implements ome::files::FormatReader.

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

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

  series | the series to activate.

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

Exceptions

  std::logic_error | if the series is invalid.

Implements ome::files::FormatReader.

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

Referenced by ome::files::in::OMETIFFReader::getMetadataStoreForConversion(), getUsedFiles(), and setId().

Here is the caller graph for this function:

## Member Data Documentation

dimension_size_type ome::files::detail::FormatReader::coreIndex
| mutable protected

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().

ome::compat::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().

dimension_size_type ome::files::detail::FormatReader::plane
| mutable protected

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::ifdAtIndex(), ome::files::in::OMETIFFReader::initFile(), setCoreIndex(), setPlane(), setResolution(), and setSeries().

dimension_size_type ome::files::detail::FormatReader::resolution
| mutable protected

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().

dimension_size_type ome::files::detail::FormatReader::series
| mutable protected

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(), ome::files::in::OMETIFFReader::initFile(), initFile(), seriesToCoreIndex(), setCoreIndex(), setId(), and setSeries().

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

- ome/files/detail/FormatReader.h
- ome/files/detail/FormatReader.cpp