ome-files  0.1.1
Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | Private Member Functions | List of all members
ome::files::in::OMETIFFReader Class Reference

TIFF reader with support for OME-XML metadata. More...

#include <ome/files/in/OMETIFFReader.h>

+ Inheritance diagram for ome::files::in::OMETIFFReader:
+ Collaboration diagram for ome::files::in::OMETIFFReader:

Public Member Functions

 OMETIFFReader ()
 Constructor.
 
virtual ~OMETIFFReader ()
 Destructor.
 
bool isSingleFile (const boost::filesystem::path &id) const
 Is this a single-file format? More...
 
bool isThisType (const boost::filesystem::path &name, bool open) const
 Check if the given file is a valid instance of this file format. More...
 
void close (bool fileOnly=false)
 Close the currently open file. More...
 
const std::vector< std::string > & getDomains () const
 Get the domains represented by the current file. More...
 
const std::vector< boost::filesystem::path > getSeriesUsedFiles (bool noPixels) const
 Get the files used by the active series. More...
 
FormatReader::FileGroupOption fileGroupOption (const std::string &id)
 Returns an enum indicating that we cannot, must, or might group the files in this dataset. 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...
 
void initFile (const boost::filesystem::path &id)
 Initialize the given file. More...
 
ome::compat::shared_ptr< ome::xml::meta::MetadataStoregetMetadataStoreForConversion ()
 Get a MetadataStore suitable for writing. More...
 
ome::compat::shared_ptr< ome::xml::meta::MetadataStoregetMetadataStoreForDisplay ()
 Get a MetadataStore suitable for display. More...
 
- Public Member Functions inherited from ome::files::detail::FormatReader
virtual ~FormatReader ()
 Destructor.
 
const std::set< MetadataOptions::MetadataLevel > & getSupportedMetadataLevels ()
 Get the supported metadata levels. More...
 
void setMetadataOptions (const MetadataOptions &options)
 Set metadata options. More...
 
const 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 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...
 
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...
 
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...
 
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...
 
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...
 
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...
 
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...
 
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::map< std::string, boost::filesystem::path > uuid_file_map
 Map UUID to filename.
 
typedef std::map< boost::filesystem::path, boost::filesystem::path > invalid_file_map
 Map filename to another file.
 
typedef std::map< boost::filesystem::path, ome::compat::shared_ptr< ome::files::tiff::TIFF > > tiff_map
 Map filename to open TIFF handle.
 
- Protected Types inherited from ome::files::detail::FormatReader
typedef std::vector< ome::compat::shared_ptr< ::ome::files::CoreMetadata > > coremetadata_list_type
 List type for storing CoreMetadata.
 

Protected Member Functions

bool isFilenameThisTypeImpl (const boost::filesystem::path &name) const
 isThisType file implementation for readers. More...
 
void getLookupTable (dimension_size_type plane, VariantPixelBuffer &buf) const
 Get the color lookup table associated with an image plane. More...
 
void openBytesImpl (dimension_size_type plane, VariantPixelBuffer &buf, dimension_size_type x, dimension_size_type y, dimension_size_type w, dimension_size_type h) const
 Obtain a sub-image of an image plane. More...
 
const ome::compat::shared_ptr< const tiff::IFDifdAtIndex (dimension_size_type plane) const
 Get the IFD index for a plane in the current series. More...
 
void addTIFF (const boost::filesystem::path &tiff)
 Add a TIFF file to the internal TIFF map. More...
 
const ome::compat::shared_ptr< const ome::files::tiff::TIFFgetTIFF (const boost::filesystem::path &tiff) const
 Get a an open TIFF file from the internal TIFF map. More...
 
void closeTIFF (const boost::filesystem::path &tiff)
 Close an open TIFF file from the internal TIFF map. More...
 
- Protected Member Functions inherited from ome::files::detail::FormatReader
 FormatReader (const ReaderProperties &)
 Constructor.
 
virtual bool isUsedFile (const boost::filesystem::path &file)
 Check if a file is in the used files list. More...
 
virtual void readPlane (std::istream &source, VariantPixelBuffer &dest, dimension_size_type x, dimension_size_type y, dimension_size_type w, dimension_size_type h, dimension_size_type samples)
 Read a raw plane. More...
 
virtual void readPlane (std::istream &source, VariantPixelBuffer &dest, dimension_size_type x, dimension_size_type y, dimension_size_type w, dimension_size_type h, dimension_size_type scanlinePad, dimension_size_type samples)
 Read a raw plane with scanline padding. More...
 
virtual ome::compat::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 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...
 
- 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

ome::common::Logger logger
 Message logger.
 
uuid_file_map files
 UUID to filename mapping.
 
invalid_file_map invalidFiles
 Invalid filename to valid filename mapping.
 
tiff_map tiffs
 Open TIFF files.
 
boost::filesystem::path metadataFile
 Metadata file.
 
std::vector< boost::filesystem::path > usedFiles
 Used files.
 
bool hasSPW
 Has screen-plate-well metadata.
 
- Protected Attributes inherited from ome::files::detail::FormatReader
const ReaderPropertiesreaderProperties
 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::MetadataStoremetadataStore
 Current metadata store. More...
 
MetadataOptions metadataOptions
 Metadata parsing options.
 

Private Member Functions

void findUsedFiles (const ome::xml::meta::OMEXMLMetadata &meta, const boost::filesystem::path &currentId, const boost::filesystem::path &currentDir, const boost::optional< std::string > &currentUUID)
 Get UUID to file associations and used files. More...
 
void getAcquisitionDates (const ome::xml::meta::OMEXMLMetadata &meta, std::vector< boost::optional< ome::xml::model::primitives::Timestamp > > &timestamps)
 Get acquisition dates for each image. More...
 
void cleanMetadata (ome::xml::meta::OMEXMLMetadata &meta)
 Clean up OME-XML metadata. More...
 
dimension_size_type seriesFileSamplesPerPixel (const ome::xml::meta::OMEXMLMetadata &meta, ome::xml::meta::BaseMetadata::index_type series)
 Get the samples per pixel from the first IFD for a series. More...
 
void seriesIndexStart (const ome::xml::meta::OMEXMLMetadata &meta, ome::xml::meta::BaseMetadata::index_type series, boost::optional< ome::xml::model::primitives::NonNegativeInteger > &zIndexStart, boost::optional< ome::xml::model::primitives::NonNegativeInteger > &tIndexStart, boost::optional< ome::xml::model::primitives::NonNegativeInteger > &cIndexStart)
 Get starting index for each dimension. More...
 
bool getTiffDataValues (const ome::xml::meta::OMEXMLMetadata &meta, ome::xml::meta::BaseMetadata::index_type series, ome::xml::meta::BaseMetadata::index_type tiffData, boost::optional< ome::xml::model::primitives::NonNegativeInteger > &tdIFD, ome::xml::model::primitives::NonNegativeInteger &numPlanes, ome::xml::model::primitives::NonNegativeInteger &firstZ, ome::xml::model::primitives::NonNegativeInteger &firstT, ome::xml::model::primitives::NonNegativeInteger &firstC)
 Get values from a TiffData element. More...
 
void fixOMEROMetadata (ome::xml::meta::OMEXMLMetadata &meta, ome::xml::meta::BaseMetadata::index_type series)
 Fix invalid OMERO OME-TIFF metadata. More...
 
void fixDimensions (ome::xml::meta::BaseMetadata::index_type series)
 Attempt to correct logically inconsistent dimensions. More...
 

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

TIFF reader with support for OME-XML metadata.

Member Function Documentation

void ome::files::in::OMETIFFReader::addTIFF ( const boost::filesystem::path &  tiff)
protected

Add a TIFF file to the internal TIFF map.

Parameters
tiffthe TIFF file to add.

References tiffs.

Referenced by initFile().

+ Here is the caller graph for this function:

void ome::files::in::OMETIFFReader::cleanMetadata ( ome::xml::meta::OMEXMLMetadata meta)
private

Clean up OME-XML metadata.

Remove invalid channels.

Parameters
metathe metadata store to clean up.

References ome::xml::meta::OMEXMLMetadata::getImageCount(), ome::xml::meta::OMEXMLMetadata::getPixelsSizeC(), and ome::files::removeChannels().

Referenced by initFile().

+ Here is the caller graph for this function:

void ome::files::in::OMETIFFReader::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.
Todo:

Reimplemented from ome::files::detail::FormatReader.

References ome::files::detail::FormatReader::close(), files, hasSPW, invalidFiles, metadataFile, tiffs, and usedFiles.

Referenced by ~OMETIFFReader().

+ Here is the caller graph for this function:

void ome::files::in::OMETIFFReader::closeTIFF ( const boost::filesystem::path &  tiff)
protected

Close an open TIFF file from the internal TIFF map.

If the file is currently open, it will be closed.

Parameters
tiffthe TIFF file to add.

References tiffs.

FormatReader::FileGroupOption ome::files::in::OMETIFFReader::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.

Reimplemented from ome::files::detail::FormatReader.

References ome::files::FormatReader::CAN_GROUP, ome::files::detail::FormatReader::group, isSingleFile(), and ome::files::FormatReader::MUST_GROUP.

void ome::files::in::OMETIFFReader::findUsedFiles ( const ome::xml::meta::OMEXMLMetadata meta,
const boost::filesystem::path &  currentId,
const boost::filesystem::path &  currentDir,
const boost::optional< std::string > &  currentUUID 
)
private

Get UUID to file associations and used files.

Updates both the files map and the used files list.

Parameters
metathe metadata store to use.
currentIdthe current file.
currentDirthe current directory.
currentUUIDthe current UUID (if any).

References canonical(), ome::files::detail::FormatReader::currentId, files, ome::xml::meta::OMEXMLMetadata::getImageCount(), ome::xml::meta::OMEXMLMetadata::getTiffDataCount(), ome::xml::meta::OMEXMLMetadata::getUUIDFileName(), ome::xml::meta::OMEXMLMetadata::getUUIDValue(), logger, ome::files::detail::FormatReader::series, and usedFiles.

Referenced by initFile().

+ Here is the caller graph for this function:

void ome::files::in::OMETIFFReader::fixDimensions ( ome::xml::meta::BaseMetadata::index_type  series)
private

Attempt to correct logically inconsistent dimensions.

If the product of SizeZ, SizeT and SizeC is not equal to the total image count, attempt to correct it by finding the dimension equal to the image count, and setting all other dimension sizes to 1. If a match isn't found, fall back to setting SizeT to the image count.

Parameters
seriesthe series to correct.

References ome::files::detail::FormatReader::core.

Referenced by initFile().

+ Here is the caller graph for this function:

void ome::files::in::OMETIFFReader::fixOMEROMetadata ( ome::xml::meta::OMEXMLMetadata meta,
ome::xml::meta::BaseMetadata::index_type  series 
)
private

Fix invalid OMERO OME-TIFF metadata.

OMERO has in the past written OME-TIFF with incorrect DimensionOrder. Attempt to identify such data and reset the dimension order to XYZCT.

Parameters
metathe metadata store to query.
seriesthe series to correct.

References ome::files::detail::FormatReader::core, files, ome::xml::meta::OMEXMLMetadata::getChannelCount(), ome::xml::meta::OMEXMLMetadata::getChannelName(), ome::xml::meta::OMEXMLMetadata::getTiffDataCount(), and ome::xml::meta::OMEXMLMetadata::getUUIDFileName().

Referenced by initFile().

+ Here is the caller graph for this function:

void ome::files::in::OMETIFFReader::getAcquisitionDates ( const ome::xml::meta::OMEXMLMetadata meta,
std::vector< boost::optional< ome::xml::model::primitives::Timestamp > > &  timestamps 
)
private

Get acquisition dates for each image.

If no date was specified for the image, the timestamp will be unset.

Parameters
metathe metadata store to use.
timestampsthe acquisition dates, indexed by image.

References ome::xml::meta::OMEXMLMetadata::getImageAcquisitionDate(), and ome::xml::meta::OMEXMLMetadata::getImageCount().

Referenced by initFile().

+ Here is the caller graph for this function:

const std::vector< std::string > & ome::files::in::OMETIFFReader::getDomains ( ) const
virtual

Get the domains represented by the current file.

Returns
a list of domains.

Reimplemented from ome::files::detail::FormatReader.

References ome::files::FormatHandler::assertId(), ome::files::detail::FormatReader::currentId, ome::files::getDomainCollection(), and hasSPW.

void ome::files::in::OMETIFFReader::getLookupTable ( dimension_size_type  plane,
VariantPixelBuffer buf 
) const
protectedvirtual

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.

Reimplemented from ome::files::detail::FormatReader.

References ome::files::FormatHandler::assertId(), ome::files::detail::FormatReader::currentId, ifdAtIndex(), and ome::files::detail::FormatReader::setPlane().

ome::compat::shared_ptr< ome::xml::meta::MetadataStore > ome::files::in::OMETIFFReader::getMetadataStoreForConversion ( )

Get a MetadataStore suitable for writing.

Note
This will be suitable for use with FormatWriter, but will likely not generate valid OME-XML due to the likelihood of containing both BinData and TiffData elements.
Returns
the metadata store.

References ome::files::detail::FormatReader::getMetadataStore(), ome::files::detail::FormatReader::getSeriesCount(), ome::files::detail::FormatReader::isLittleEndian(), and ome::files::detail::FormatReader::setSeries().

Referenced by initFile().

+ Here is the caller graph for this function:

ome::compat::shared_ptr< ome::xml::meta::MetadataStore > ome::files::in::OMETIFFReader::getMetadataStoreForDisplay ( )

Get a MetadataStore suitable for display.

Note
This will not be suitable for use with FormatWriter due to not containing required BinData BigEndian attributes.
Returns
the metadata store.

References ome::files::addMetadataOnly(), ome::files::detail::FormatReader::getMetadataStore(), ome::files::detail::FormatReader::getSeriesCount(), logger, and ome::files::removeBinData().

dimension_size_type ome::files::in::OMETIFFReader::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.

Reimplemented from ome::files::detail::FormatReader.

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

dimension_size_type ome::files::in::OMETIFFReader::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.

Reimplemented from ome::files::detail::FormatReader.

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

const std::vector< boost::filesystem::path > ome::files::in::OMETIFFReader::getSeriesUsedFiles ( bool  noPixels) 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.

Reimplemented from ome::files::detail::FormatReader.

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

const ome::compat::shared_ptr< const ome::files::tiff::TIFF > ome::files::in::OMETIFFReader::getTIFF ( const boost::filesystem::path &  tiff) const
protected

Get a an open TIFF file from the internal TIFF map.

If the file does not exist in the map, the file will be added to the internal map first. If the file is not currently open it will be opened.

Parameters
tiffthe TIFF file to get.
Returns
the open TIFF.
Exceptions
FormatExceptionif invalid.

References ome::files::tiff::TIFF::open(), and tiffs.

Referenced by ifdAtIndex(), and initFile().

+ Here is the caller graph for this function:

Get values from a TiffData element.

Parameters
metathe metadata store to query.
seriesthe series to check.
tiffDatathe TiffData index to check.
tdIFDthe starting IFD.
numPlanesthe number of planes.
firstZthe first Z plane.
firstTthe first T plane.
firstCthe first C plane.
Returns
true if read successfully, false otherwise.

References ome::files::detail::FormatReader::core, ome::xml::meta::OMEXMLMetadata::getTiffDataFirstC(), ome::xml::meta::OMEXMLMetadata::getTiffDataFirstT(), ome::xml::meta::OMEXMLMetadata::getTiffDataFirstZ(), ome::xml::meta::OMEXMLMetadata::getTiffDataIFD(), and ome::xml::meta::OMEXMLMetadata::getTiffDataPlaneCount().

Referenced by initFile().

+ Here is the caller graph for this function:

const ome::compat::shared_ptr< const tiff::IFD > ome::files::in::OMETIFFReader::ifdAtIndex ( dimension_size_type  plane) const
protected

Get the IFD index for a plane in the current series.

Parameters
planethe plane index within the series.
Returns
the IFD index.
Exceptions
FormatExceptionif out of range.

References ome::files::detail::FormatReader::getCoreIndex(), ome::files::detail::FormatReader::getCoreMetadata(), getTIFF(), and ome::files::detail::FormatReader::plane.

Referenced by getLookupTable(), and openBytesImpl().

+ Here is the caller graph for this function:

void ome::files::in::OMETIFFReader::initFile ( const boost::filesystem::path &  id)
virtual
bool ome::files::in::OMETIFFReader::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 from ome::files::detail::FormatReader.

References ome::files::createOMEXMLMetadata(), metadataFile, and ome::files::verifyMinimum().

bool ome::files::in::OMETIFFReader::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.

Reimplemented from ome::files::detail::FormatReader.

References ome::files::FormatHandler::checkSuffix(), and ome::files::createOMEXMLMetadata().

Referenced by fileGroupOption().

+ Here is the caller graph for this function:

bool ome::files::in::OMETIFFReader::isThisType ( const boost::filesystem::path &  name,
bool  open 
) 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?

Reimplemented from ome::files::detail::FormatReader.

References ome::files::FormatHandler::checkSuffix(), and ome::files::detail::FormatReader::isThisType().

void ome::files::in::OMETIFFReader::openBytesImpl ( dimension_size_type  plane,
VariantPixelBuffer buf,
dimension_size_type  x,
dimension_size_type  y,
dimension_size_type  w,
dimension_size_type  h 
) const
protectedvirtual

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::detail::FormatReader.

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

dimension_size_type ome::files::in::OMETIFFReader::seriesFileSamplesPerPixel ( const ome::xml::meta::OMEXMLMetadata meta,
ome::xml::meta::BaseMetadata::index_type  series 
)
private

Get the samples per pixel from the first IFD for a series.

Parameters
metathe metadata store to query.
seriesthe series to check.
Returns
the samples per pixel.
void ome::files::in::OMETIFFReader::seriesIndexStart ( const ome::xml::meta::OMEXMLMetadata meta,
ome::xml::meta::BaseMetadata::index_type  series,
boost::optional< ome::xml::model::primitives::NonNegativeInteger > &  zIndexStart,
boost::optional< ome::xml::model::primitives::NonNegativeInteger > &  tIndexStart,
boost::optional< ome::xml::model::primitives::NonNegativeInteger > &  cIndexStart 
)
private

Get starting index for each dimension.

This is to cater for files which have been incorrectly written, where the starting index is not zero.

Parameters
metathe metadata store to query.
seriesthe series to check.
zIndexStartthe Z starting index.
tIndexStartthe T starting index.
cIndexStartthe C starting index.

References ome::xml::meta::OMEXMLMetadata::getTiffDataCount(), ome::xml::meta::OMEXMLMetadata::getTiffDataFirstC(), and ome::xml::meta::OMEXMLMetadata::getTiffDataFirstT().

Referenced by initFile().

+ Here is the caller graph for this function:


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