ome-files  0.5.0
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
ome::files::detail::FormatWriter Class Reference

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

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

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

Public Member Functions

virtual ~FormatWriter ()
 Destructor.
 
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...
 
virtual dimension_size_type getSeriesCount () const
 Get the number of image series in this file. More...
 
void setLookupTable (dimension_size_type plane, const VariantPixelBuffer &buf)
 Set the color lookup table associated with the current series. More...
 
void saveBytes (dimension_size_type plane, VariantPixelBuffer &buf)
 Save an image plane. 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...
 
bool canDoStacks () const
 Get whether or not the writer can save multiple images in a single file. More...
 
void setMetadataRetrieve (std::shared_ptr<::ome::xml::meta::MetadataRetrieve > &retrieve)
 Set the default metadata store for this writer. More...
 
const std::shared_ptr<::ome::xml::meta::MetadataRetrieve > & getMetadataRetrieve () const
 Get the current metadata store for this writer. More...
 
std::shared_ptr<::ome::xml::meta::MetadataRetrieve > & getMetadataRetrieve ()
 Get the current metadata store for this writer. More...
 
virtual dimension_size_type getImageCount () const
 Determine the number of image planes in the current series. More...
 
virtual bool isRGB (dimension_size_type channel) const
 Does a channel contain subchannels? More...
 
virtual dimension_size_type getSizeX () const
 Get the size of the X dimension. More...
 
virtual dimension_size_type getSizeY () const
 Get the size of the Y dimension. More...
 
virtual dimension_size_type getSizeZ () const
 Get the size of the Z dimension. More...
 
virtual dimension_size_type getSizeT () const
 Get the size of the T dimension. More...
 
virtual dimension_size_type getSizeC () const
 Get the size of the C dimension. More...
 
virtual ome::xml::model::enums::PixelType getPixelType () const
 Get the pixel type. More...
 
virtual pixel_size_type getBitsPerPixel () const
 Get the number of valid bits per pixel. More...
 
virtual dimension_size_type getEffectiveSizeC () const
 Get the effective size of the C dimension. More...
 
virtual dimension_size_type getRGBChannelCount (dimension_size_type channel) const
 Get the number of channels required for a call to saveBytes(). More...
 
virtual const std::string & getDimensionOrder () const
 Get the dimension order. More...
 
virtual 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...
 
virtual std::array< dimension_size_type, 3 > getZCTCoords (dimension_size_type index) const
 Get the Z, C and T coordinate of a linear index. More...
 
void setFramesPerSecond (frame_rate_type rate)
 Set the frame rate to use when writing. More...
 
frame_rate_type getFramesPerSecond () const
 Get the frame rate to use when writing. More...
 
const std::set< ome::xml::model::enums::PixelTypegetPixelTypes () const
 Get supported pixel types. More...
 
const std::set< ome::xml::model::enums::PixelTypegetPixelTypes (const std::string &codec) const
 Get supported pixel types for the given codec. More...
 
bool isSupportedType (ome::xml::model::enums::PixelType type) const
 Check if the pixel type is supported. More...
 
bool isSupportedType (ome::xml::model::enums::PixelType type, const std::string &codec) const
 Check if the pixel type is supported by the given codex. More...
 
const std::set< std::string > & getCompressionTypes () const
 Get supported compression types. More...
 
const std::set< std::string > & getCompressionTypes (ome::xml::model::enums::PixelType type) const
 Get supported compression types for a given pixel type. More...
 
void setCompression (const std::string &compression)
 Set the compression type to use when writing. More...
 
const boost::optional< std::string > & getCompression () const
 Get the compression type to use when writing. More...
 
void setInterleaved (bool interleaved)
 Set subchannel interleaving. More...
 
const boost::optional< bool > & getInterleaved () const
 Set subchannel interleaving. More...
 
void changeOutputFile (const boost::filesystem::path &id)
 Switch the output file for the current dataset. More...
 
void setWriteSequentially (bool sequential=true)
 Write planes sequentially. More...
 
bool getWriteSequentially () const
 Check if planes are written sequentially. More...
 
void setId (const boost::filesystem::path &id)
 Set the current file name. More...
 
void close (bool fileOnly=false)
 Close the currently open file. 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...
 
dimension_size_type setTileSizeX (boost::optional< dimension_size_type > size)
 Set the requested tile width. More...
 
dimension_size_type getTileSizeX () const
 Get the effective tile width. More...
 
dimension_size_type setTileSizeY (boost::optional< dimension_size_type > size)
 Set the requested tile height. More...
 
dimension_size_type getTileSizeY () const
 Get the effective tile height. More...
 
- Public Member Functions inherited from ome::files::FormatWriter
virtual void saveBytes (dimension_size_type plane, VariantPixelBuffer &buf, dimension_size_type x, dimension_size_type y, dimension_size_type w, dimension_size_type h)=0
 Save an image plane. More...
 
- Public Member Functions inherited from ome::files::FormatHandler
virtual ~FormatHandler ()
 Destructor.
 

Protected Member Functions

 FormatWriter (const WriterProperties &)
 Constructor.
 
- Protected Member Functions inherited from ome::files::FormatWriter
 FormatWriter ()
 Constructor.
 
- Protected Member Functions inherited from ome::files::FormatHandler
 FormatHandler ()
 Constructor.
 

Protected Attributes

const WriterPropertieswriterProperties
 Writer properties specific to the derived file format.
 
boost::optional< boost::filesystem::path > currentId
 The identifier (path) of the currently open file.
 
std::shared_ptr< std::ostream > out
 Current output.
 
dimension_size_type series
 Current series.
 
dimension_size_type plane
 Current plane.
 
boost::optional< std::string > compression
 The compression type to use.
 
boost::optional< bool > interleaved
 Subchannel interleaving enabled.
 
bool sequential
 Planes are written sequentially.
 
frame_rate_type framesPerSecond
 The frames per second to use when writing.
 
boost::optional< dimension_size_typetile_size_x
 Tile size X.
 
boost::optional< dimension_size_typetile_size_y
 Tile size Y.
 
std::shared_ptr<::ome::xml::meta::MetadataRetrievemetadataRetrieve
 Current metadata store. More...
 

Additional Inherited Members

- Public Types inherited from ome::files::FormatWriter
typedef uint16_t frame_rate_type
 Frame rate type.
 
- 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 writers (default behaviour).

Note
The ColorModel isn't stored here; this is Java-specific and not implemented in C++.
The current output stream isn't stored here; this is the responsibility of the individual writer. Having a reference to the base ostream here and keeping this in sync with the derived writer is an unnecessary complication.

Member Function Documentation

◆ canDoStacks()

bool ome::files::detail::FormatWriter::canDoStacks ( ) const
virtual

Get whether or not the writer can save multiple images in a single file.

Returns
true if the writer supports multiple images, false otherwise.

Implements ome::files::FormatWriter.

References ome::files::detail::WriterProperties::stacks, and writerProperties.

◆ changeOutputFile()

void ome::files::detail::FormatWriter::changeOutputFile ( const boost::filesystem::path &  id)
virtual

Switch the output file for the current dataset.

Parameters
idthe new file name.

Implements ome::files::FormatWriter.

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

◆ close()

void ome::files::detail::FormatWriter::close ( bool  fileOnly = false)
virtual

Close the currently open file.

An exception may be thrown when closing the file, for example if there are problems flushing any pending writes, or if there are any inconsistencies in the metadata which prevent completing any final writes. The causes are reader- or writer-dependent, and the exception type is dependent upon the implementation details of the reader or writer in use. It is advised to always explicitly close writers, since if this is automatically called at destruction time, any errors will be lost. If an exception is thrown, the object may be left in an inconsistent state and should not be reused.

Parameters
fileOnlyclose the open file only if true, or else free all internal state if false; only meaningful for readers, since writers will always free all internal state.
Exceptions
Onerror; exception type may vary.

Implements ome::files::FormatHandler.

Reimplemented in ome::files::out::OMETIFFWriter, and ome::files::out::MinimalTIFFWriter.

References compression, currentId, framesPerSecond, metadataRetrieve, out, plane, sequential, and series.

Referenced by ome::files::out::MinimalTIFFWriter::close(), ome::files::out::OMETIFFWriter::close(), and ~FormatWriter().

+ Here is the caller graph for this function:

◆ getBitsPerPixel()

pixel_size_type ome::files::detail::FormatWriter::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.

References getSeries(), metadataRetrieve, and series.

◆ getCompression()

const boost::optional< std::string > & ome::files::detail::FormatWriter::getCompression ( ) const
virtual

Get the compression type to use when writing.

Returns
the compression type.

Implements ome::files::FormatWriter.

References compression.

Referenced by ome::files::out::MinimalTIFFWriter::setupIFD(), and ome::files::out::OMETIFFWriter::setupIFD().

+ Here is the caller graph for this function:

◆ getCompressionSuffixes()

const std::vector< boost::filesystem::path > & ome::files::detail::FormatWriter::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::WriterProperties::compression_suffixes, and writerProperties.

◆ getCompressionTypes() [1/2]

const std::set< std::string > & ome::files::detail::FormatWriter::getCompressionTypes ( ) const
virtual

Get supported compression types.

Returns
the supported compression types.

Implements ome::files::FormatWriter.

References ome::files::detail::WriterProperties::compression_types, and writerProperties.

◆ getCompressionTypes() [2/2]

const std::set< std::string > & ome::files::detail::FormatWriter::getCompressionTypes ( ome::xml::model::enums::PixelType  type) const
virtual

Get supported compression types for a given pixel type.

Parameters
typethe pixel type to use.
Returns
the supported compression types.

Implements ome::files::FormatWriter.

References ome::files::detail::WriterProperties::pixel_compression_types, and writerProperties.

◆ getDimensionOrder()

const std::string & ome::files::detail::FormatWriter::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.

References getSeries(), metadataRetrieve, and series.

Referenced by getIndex(), and getZCTCoords().

+ Here is the caller graph for this function:

◆ getEffectiveSizeC()

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

Get the effective size of the C dimension.

This guarantees that

regardless of the result of isRGB().

Returns
the effective C dimension size.

References getSeries(), metadataRetrieve, and series.

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

+ Here is the caller graph for this function:

◆ getFormat()

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

Get the name of this file format.

Returns
the file format name.

Implements ome::files::FormatHandler.

References ome::files::detail::WriterProperties::name, and writerProperties.

◆ getFormatDescription()

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

Get the description of this file format.

Returns
the file format description.

Implements ome::files::FormatHandler.

References ome::files::detail::WriterProperties::description, and writerProperties.

◆ getFramesPerSecond()

FormatWriter::frame_rate_type ome::files::detail::FormatWriter::getFramesPerSecond ( ) const
virtual

Get the frame rate to use when writing.

Returns
the frame rate (number of frames per second).

Implements ome::files::FormatWriter.

References framesPerSecond.

◆ getImageCount()

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

Determine the number of image planes in the current series.

Returns
the number of image planes.

References getEffectiveSizeC(), getSizeT(), and getSizeZ().

Referenced by getIndex(), getZCTCoords(), ome::files::out::MinimalTIFFWriter::setId(), and setPlane().

+ Here is the caller graph for this function:

◆ getIndex()

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

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

The index is computed using the DimensionOrder.

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

unify with the pixel buffer dimension indexes.

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

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

◆ getInterleaved()

const boost::optional< bool > & ome::files::detail::FormatWriter::getInterleaved ( ) const
virtual

Set subchannel interleaving.

Returns
the current interleaving setting; false if unset.

Implements ome::files::FormatWriter.

References interleaved.

Referenced by ome::files::out::MinimalTIFFWriter::setupIFD(), and ome::files::out::OMETIFFWriter::setupIFD().

+ Here is the caller graph for this function:

◆ getMetadataRetrieve() [1/2]

const std::shared_ptr<::ome::xml::meta::MetadataRetrieve > & ome::files::detail::FormatWriter::getMetadataRetrieve ( ) const
virtual

Get the current metadata store for this writer.

Returns
the metadata store, which will never be null.

Implements ome::files::FormatWriter.

References metadataRetrieve.

Referenced by ome::files::out::MinimalTIFFWriter::setId(), and ome::files::out::OMETIFFWriter::setId().

+ Here is the caller graph for this function:

◆ getMetadataRetrieve() [2/2]

std::shared_ptr<::ome::xml::meta::MetadataRetrieve > & ome::files::detail::FormatWriter::getMetadataRetrieve ( )
virtual

Get the current metadata store for this writer.

Returns
the metadata store, which will never be null.

Implements ome::files::FormatWriter.

References metadataRetrieve.

◆ getPixelType()

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

Get the pixel type.

Returns
the pixel type.

References getSeries(), metadataRetrieve, and series.

Referenced by ome::files::out::MinimalTIFFWriter::setupIFD(), and ome::files::out::OMETIFFWriter::setupIFD().

+ Here is the caller graph for this function:

◆ getPixelTypes() [1/2]

const std::set< ome::xml::model::enums::PixelType > ome::files::detail::FormatWriter::getPixelTypes ( ) const
virtual

Get supported pixel types.

Returns
the supported pixel types.

Implements ome::files::FormatWriter.

◆ getPixelTypes() [2/2]

const std::set< ome::xml::model::enums::PixelType > ome::files::detail::FormatWriter::getPixelTypes ( const std::string &  codec) const
virtual

Get supported pixel types for the given codec.

Parameters
codecthe codec to check.
Returns
the supported pixel types.

Implements ome::files::FormatWriter.

References ome::files::detail::WriterProperties::pixel_compression_types, and writerProperties.

◆ getPlane()

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

Get the active plane.

Returns
the active plane.

Implements ome::files::FormatWriter.

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

Referenced by ome::files::out::MinimalTIFFWriter::setPlane(), ome::files::out::OMETIFFWriter::setPlane(), setPlane(), ome::files::out::MinimalTIFFWriter::setupIFD(), and ome::files::out::OMETIFFWriter::setupIFD().

+ Here is the caller graph for this function:

◆ getRGBChannelCount()

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

Get the number of channels required for a call to saveBytes().

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

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

References getSeries(), metadataRetrieve, and series.

Referenced by isRGB(), ome::files::out::MinimalTIFFWriter::setupIFD(), and ome::files::out::OMETIFFWriter::setupIFD().

+ Here is the caller graph for this function:

◆ getSeries()

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

◆ getSeriesCount()

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

Get the number of image series in this file.

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

References metadataRetrieve.

Referenced by ome::files::out::OMETIFFWriter::fillMetadata(), and setSeries().

+ Here is the caller graph for this function:

◆ getSizeC()

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

Get the size of the C dimension.

Returns
the C dimension size.

References getSeries(), metadataRetrieve, and series.

◆ getSizeT()

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

Get the size of the T dimension.

Returns
the T dimension size.

References getSeries(), metadataRetrieve, and series.

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

+ Here is the caller graph for this function:

◆ getSizeX()

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

Get the size of the X dimension.

Returns
the X dimension size.

References getSeries(), metadataRetrieve, and series.

Referenced by ome::files::out::MinimalTIFFWriter::setupIFD(), and ome::files::out::OMETIFFWriter::setupIFD().

+ Here is the caller graph for this function:

◆ getSizeY()

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

Get the size of the Y dimension.

Returns
the Y dimension size.

References getSeries(), metadataRetrieve, and series.

Referenced by ome::files::out::MinimalTIFFWriter::setupIFD(), and ome::files::out::OMETIFFWriter::setupIFD().

+ Here is the caller graph for this function:

◆ getSizeZ()

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

Get the size of the Z dimension.

Returns
the Z dimension size.

References getSeries(), metadataRetrieve, and series.

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

+ Here is the caller graph for this function:

◆ getSuffixes()

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

Get the default file suffixes for this file format.

Returns
a list of file suffixes.

Implements ome::files::FormatHandler.

References ome::files::detail::WriterProperties::suffixes, and writerProperties.

◆ getTileSizeX()

dimension_size_type ome::files::detail::FormatWriter::getTileSizeX ( ) const
virtual

Get the effective tile width.

This is intended for use with saveBytes().

Returns
the effective tile width.

Implements ome::files::FormatWriter.

Reimplemented in ome::files::out::OMETIFFWriter, and ome::files::out::MinimalTIFFWriter.

References currentId, getSeries(), metadataRetrieve, and tile_size_x.

Referenced by ome::files::out::MinimalTIFFWriter::getTileSizeX(), ome::files::out::OMETIFFWriter::getTileSizeX(), and setTileSizeX().

+ Here is the caller graph for this function:

◆ getTileSizeY()

dimension_size_type ome::files::detail::FormatWriter::getTileSizeY ( ) const
virtual

Get the effective tile height.

This is intended for use with saveBytes().

Returns
the effective tile height.

Implements ome::files::FormatWriter.

Reimplemented in ome::files::out::OMETIFFWriter, and ome::files::out::MinimalTIFFWriter.

References currentId, getSeries(), metadataRetrieve, and tile_size_y.

Referenced by ome::files::out::MinimalTIFFWriter::getTileSizeY(), ome::files::out::OMETIFFWriter::getTileSizeY(), and setTileSizeY().

+ Here is the caller graph for this function:

◆ getWriteSequentially()

bool ome::files::detail::FormatWriter::getWriteSequentially ( ) const
virtual

Check if planes are written sequentially.

Returns
true if sequential, false if not.

Implements ome::files::FormatWriter.

References sequential.

◆ getZCTCoords()

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

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

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

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

Referenced by ome::files::out::MinimalTIFFWriter::setupIFD(), and ome::files::out::OMETIFFWriter::setupIFD().

+ Here is the caller graph for this function:

◆ isRGB()

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

Does a channel contain subchannels?

Check if the image planes in the file have more than one subchannel per openBytes() call for the specified channel.

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

References getRGBChannelCount().

Referenced by ome::files::out::MinimalTIFFWriter::setupIFD(), and ome::files::out::OMETIFFWriter::setupIFD().

+ Here is the caller graph for this function:

◆ isSupportedType() [1/2]

bool ome::files::detail::FormatWriter::isSupportedType ( ome::xml::model::enums::PixelType  type) const
virtual

Check if the pixel type is supported.

Parameters
typethe pixel type to check.
Returns
true if supported, false otherwise.

Implements ome::files::FormatWriter.

◆ isSupportedType() [2/2]

bool ome::files::detail::FormatWriter::isSupportedType ( ome::xml::model::enums::PixelType  type,
const std::string &  codec 
) const
virtual

Check if the pixel type is supported by the given codex.

Parameters
typethe pixel type to check.
codecthe codec to check.
Returns
true if supported, false otherwise.

Implements ome::files::FormatWriter.

References ome::files::detail::WriterProperties::pixel_compression_types, and writerProperties.

◆ isThisType()

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

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

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

Implements ome::files::FormatHandler.

References ome::files::FormatHandler::checkSuffix(), ome::files::detail::WriterProperties::compression_suffixes, ome::files::detail::WriterProperties::suffixes, and writerProperties.

◆ saveBytes()

void ome::files::detail::FormatWriter::saveBytes ( dimension_size_type  plane,
VariantPixelBuffer buf 
)
virtual

Save an image plane.

Write an image plane from a VariantPixelBuffer of size

to the current series in the current file.

Parameters
planethe plane index within the series.
bufthe source pixel buffer.
Exceptions
FormatExceptionif any of the parameters are invalid.

Implements ome::files::FormatWriter.

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

◆ setCompression()

void ome::files::detail::FormatWriter::setCompression ( const std::string &  compression)
virtual

Set the compression type to use when writing.

Parameters
compressionthe compression type.

Implements ome::files::FormatWriter.

References compression, ome::files::detail::WriterProperties::compression_types, and writerProperties.

◆ setFramesPerSecond()

void ome::files::detail::FormatWriter::setFramesPerSecond ( frame_rate_type  rate)
virtual

Set the frame rate to use when writing.

Parameters
ratethe frame rate (number of frames per second).

Implements ome::files::FormatWriter.

References framesPerSecond.

◆ setId()

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

Set the current file name.

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

Parameters
idthe filename to open.

Implements ome::files::FormatHandler.

Reimplemented in ome::files::out::OMETIFFWriter, and ome::files::out::MinimalTIFFWriter.

References ome::common::canonical(), currentId, and out.

Referenced by changeOutputFile(), and ome::files::out::OMETIFFWriter::setId().

+ Here is the caller graph for this function:

◆ setInterleaved()

void ome::files::detail::FormatWriter::setInterleaved ( bool  interleaved)
virtual

Set subchannel interleaving.

Parameters
interleavedtrue to enable interleaving (chunky) or false to disable interleaving (planar).

Implements ome::files::FormatWriter.

References interleaved.

◆ setLookupTable()

void ome::files::detail::FormatWriter::setLookupTable ( dimension_size_type  plane,
const VariantPixelBuffer buf 
)
virtual

Set the color lookup table associated with the current series.

If the pixel type of the lookup table is unsupported by the file format, this method will throw an exception.

Parameters
planethe plane index within the series.
bufthe source pixel buffer.

Implements ome::files::FormatWriter.

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

◆ setMetadataRetrieve()

void ome::files::detail::FormatWriter::setMetadataRetrieve ( std::shared_ptr<::ome::xml::meta::MetadataRetrieve > &  retrieve)
virtual

Set the default metadata store for this writer.

Parameters
retrievea metadata retrieve implementation.

Implements ome::files::FormatWriter.

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

◆ setPlane()

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

Set the active plane.

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

Implements ome::files::FormatWriter.

Reimplemented in ome::files::out::OMETIFFWriter, and ome::files::out::MinimalTIFFWriter.

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

Referenced by ome::files::out::MinimalTIFFWriter::setPlane(), and ome::files::out::OMETIFFWriter::setPlane().

+ Here is the caller graph for this function:

◆ setSeries()

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

Set the active series.

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

Implements ome::files::FormatWriter.

Reimplemented in ome::files::out::OMETIFFWriter, and ome::files::out::MinimalTIFFWriter.

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

Referenced by ome::files::out::MinimalTIFFWriter::setSeries(), and ome::files::out::OMETIFFWriter::setSeries().

+ Here is the caller graph for this function:

◆ setTileSizeX()

dimension_size_type ome::files::detail::FormatWriter::setTileSizeX ( boost::optional< dimension_size_type size)
virtual

Set the requested tile width.

The requested tile width may not be supported by the underlying file format. If the width requested is unsupported, the writer may set the nearest supported size, or the full image width or greater if no smaller tile sizes are supported. Call getTileSizeX() to get the effective size in use by the writer, or use the return value.

Parameters
sizethe requested tile width.
Returns
the effective tile width.

Implements ome::files::FormatWriter.

References getTileSizeX(), and tile_size_x.

◆ setTileSizeY()

dimension_size_type ome::files::detail::FormatWriter::setTileSizeY ( boost::optional< dimension_size_type size)
virtual

Set the requested tile height.

The requested tile height may not be supported by the underlying file format. If the height requested is unsupported, the writer may set the nearest supported size, or the full image height or greater if no smaller tile sizes are supported. Call getTileSizeY() to get the effective size in use by the writer, or use the return value.

Parameters
sizethe requested tile height.
Returns
the effective tile height.

Implements ome::files::FormatWriter.

References getTileSizeY(), and tile_size_y.

◆ setWriteSequentially()

void ome::files::detail::FormatWriter::setWriteSequentially ( bool  sequential = true)
virtual

Write planes sequentially.

Set if planes will be written sequentially. If planes are written sequentially and this flag is set, then performance will be slightly improved.

Parameters
sequentialtrue if sequential, false if not.

Implements ome::files::FormatWriter.

References sequential.

Member Data Documentation

◆ metadataRetrieve

std::shared_ptr<::ome::xml::meta::MetadataRetrieve> ome::files::detail::FormatWriter::metadataRetrieve
protected

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