bioformats  5.1.8
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
ome::bioformats::in::MinimalTIFFReader Class Reference

Basic TIFF reader. More...

#include <ome/bioformats/in/MinimalTIFFReader.h>

+ Inheritance diagram for ome::bioformats::in::MinimalTIFFReader:
+ Collaboration diagram for ome::bioformats::in::MinimalTIFFReader:

Public Member Functions

 MinimalTIFFReader ()
 Constructor.
 
 MinimalTIFFReader (const ome::bioformats::detail::ReaderProperties &readerProperties)
 Constructor with reader properties (for derived readers).
 
virtual ~MinimalTIFFReader ()
 Destructor.
 
void close (bool fileOnly=false)
 Close the currently open file. More...
 
void getLookupTable (dimension_size_type plane, VariantPixelBuffer &buf) const
 Get the color lookup table associated with an image plane. More...
 
ome::compat::shared_ptr< ome::bioformats::tiff::TIFFgetTIFF ()
 Get open TIFF file. More...
 
const ome::compat::shared_ptr< ome::bioformats::tiff::TIFFgetTIFF () const
 Get open TIFF file. More...
 
- Public Member Functions inherited from ome::bioformats::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 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...
 
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...
 
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< 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::bioformats::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::bioformats::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::bioformats::FormatHandler
virtual ~FormatHandler ()
 Destructor.
 
- Public Member Functions inherited from ome::bioformats::MetadataConfigurable
virtual ~MetadataConfigurable ()
 Destructor.
 

Protected Member Functions

void initFile (const boost::filesystem::path &id)
 Initialize the given file. More...
 
virtual void readIFDs ()
 Read metadata from IFDs.
 
bool isFilenameThisTypeImpl (const boost::filesystem::path &name) const
 isThisType file implementation for readers. 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 openBytesImpl (dimension_size_type plane, VariantPixelBuffer &buf, dimension_size_type x, dimension_size_type y, dimension_size_type w, dimension_size_type h) const
 Obtain a sub-image of an image plane. More...
 
- Protected Member Functions inherited from ome::bioformats::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::bioformats::FormatReader
 FormatReader ()
 Constructor.
 
- Protected Member Functions inherited from ome::bioformats::FormatHandler
 FormatHandler ()
 Constructor.
 
- Protected Member Functions inherited from ome::bioformats::MetadataConfigurable
 MetadataConfigurable ()
 Constructor.
 

Protected Attributes

ome::compat::shared_ptr< ome::bioformats::tiff::TIFFtiff
 Underlying TIFF file.
 
tiff::SeriesIFDRange seriesIFDRange
 Mapping between series index and start and end IFD as a half-open range.
 
- Protected Attributes inherited from ome::bioformats::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::bioformats::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.
 

Additional Inherited Members

- Public Types inherited from ome::bioformats::FormatReader
enum  FileGroupOption { MUST_GROUP, CAN_GROUP, CANNOT_GROUP }
 File grouping options. More...
 
- Static Public Member Functions inherited from ome::bioformats::FormatHandler
static bool checkSuffix (const boost::filesystem::path &name, const boost::filesystem::path &suffix)
 Perform suffix matching for the given filename. More...
 
static bool checkSuffix (const boost::filesystem::path &name, const std::vector< boost::filesystem::path > &suffixes)
 Perform suffix matching for the given filename. More...
 
static bool checkSuffix (const boost::filesystem::path &name, const std::vector< boost::filesystem::path > &suffixes, const std::vector< boost::filesystem::path > &compression_suffixes)
 Perform suffix matching for the given filename. More...
 
static void assertId (const boost::optional< boost::filesystem::path > &id, bool notNull=true)
 Assert that the current file is valid. More...
 
- Protected Types inherited from ome::bioformats::detail::FormatReader
typedef std::vector< ome::compat::shared_ptr< ::ome::bioformats::CoreMetadata > > coremetadata_list_type
 List type for storing CoreMetadata.
 

Detailed Description

Basic TIFF reader.

Note
Any derived reader which does not implement its own openBytesImpl() must fill seriesIFDRange.

Member Function Documentation

void ome::bioformats::in::MinimalTIFFReader::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.

Reimplemented from ome::bioformats::detail::FormatReader.

Reimplemented in ome::bioformats::in::TIFFReader.

References ome::bioformats::detail::FormatReader::close(), and tiff.

Referenced by ome::bioformats::in::TIFFReader::close(), and ~MinimalTIFFReader().

+ Here is the caller graph for this function:

void ome::bioformats::in::MinimalTIFFReader::getLookupTable ( dimension_size_type  plane,
VariantPixelBuffer buf 
) const
virtual

Get the color lookup table associated with an image plane.

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

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

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

Reimplemented from ome::bioformats::detail::FormatReader.

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

ome::compat::shared_ptr< ome::bioformats::tiff::TIFF > ome::bioformats::in::MinimalTIFFReader::getTIFF ( )

Get open TIFF file.

Note
This will be null if setId has not been called.
Returns
a reference to the TIFF file.

References tiff.

const ome::compat::shared_ptr< ome::bioformats::tiff::TIFF > ome::bioformats::in::MinimalTIFFReader::getTIFF ( ) const

Get open TIFF file.

Note
This will be null if setId has not been called.
Returns
a reference to the TIFF file.

References tiff.

const ome::compat::shared_ptr< const tiff::IFD > ome::bioformats::in::MinimalTIFFReader::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::bioformats::detail::FormatReader::getSeries(), ome::bioformats::tiff::ifdIndex(), seriesIFDRange, and tiff.

Referenced by getLookupTable(), and openBytesImpl().

+ Here is the caller graph for this function:

void ome::bioformats::in::MinimalTIFFReader::initFile ( const boost::filesystem::path &  id)
protectedvirtual

Initialize the given file.

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

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

Reimplemented from ome::bioformats::detail::FormatReader.

References ome::bioformats::fillMetadata(), ome::bioformats::detail::FormatReader::getMetadataStore(), ome::bioformats::detail::FormatReader::initFile(), readIFDs(), and tiff.

bool ome::bioformats::in::MinimalTIFFReader::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::bioformats::detail::FormatReader.

void ome::bioformats::in::MinimalTIFFReader::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::bioformats::detail::FormatReader.

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


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