bioformats  5.1.0
Classes | Public Types | Public Member Functions | Protected Member Functions | Private Member Functions | List of all members
ome::bioformats::FormatWriter Class Referenceabstract

Interface for all biological file format writers. More...

#include <ome/bioformats/FormatWriter.h>

+ Inheritance diagram for ome::bioformats::FormatWriter:
+ Collaboration diagram for ome::bioformats::FormatWriter:

Classes

class  SaveSeries
 Sentry for saving and restoring writer series state. More...
 

Public Types

typedef uint16_t frame_rate_type
 Frame rate type.
 

Public Member Functions

virtual ~FormatWriter ()
 Destructor.
 
virtual void setLookupTable (const VariantPixelBuffer &buf)=0
 Set the color lookup table associated with the current series. More...
 
virtual void saveBytes (dimension_size_type no, VariantPixelBuffer &buf)=0
 Save an image plane. More...
 
virtual void saveBytes (dimension_size_type no, VariantPixelBuffer &buf, dimension_size_type x, dimension_size_type y, dimension_size_type w, dimension_size_type h)=0
 Save an image plane. More...
 
virtual void setSeries (dimension_size_type no) const =0
 Set the active series. More...
 
virtual dimension_size_type getSeries () const =0
 Get the active series. More...
 
virtual bool canDoStacks () const =0
 Get whether or not the writer can save multiple images in a single file. More...
 
virtual void setMetadataRetrieve (ome::compat::shared_ptr< ::ome::xml::meta::MetadataRetrieve > &retrieve)=0
 Set the default metadata store for this writer. More...
 
virtual const ome::compat::shared_ptr< ::ome::xml::meta::MetadataRetrieve > & getMetadataRetrieve () const =0
 Get the current metadata store for this writer. More...
 
virtual ome::compat::shared_ptr< ::ome::xml::meta::MetadataRetrieve > & getMetadataRetrieve ()=0
 Get the current metadata store for this writer. More...
 
virtual void setFramesPerSecond (frame_rate_type rate)=0
 Set the frame rate to use when writing. More...
 
virtual frame_rate_type getFramesPerSecond () const =0
 Get the frame rate to use when writing. More...
 
virtual const std::set< ome::xml::model::enums::PixelType > & getPixelTypes () const =0
 Get supported pixel types. More...
 
virtual const std::set< ome::xml::model::enums::PixelType > & getPixelTypes (const std::string &codec) const =0
 Get supported pixel types for the given codec. More...
 
virtual bool isSupportedType (ome::xml::model::enums::PixelType type) const =0
 Check if the pixel type is supported. More...
 
virtual bool isSupportedType (ome::xml::model::enums::PixelType type, const std::string &codec) const =0
 Check if the pixel type is supported by the given codex. More...
 
virtual const std::set< std::string > & getCompressionTypes () const =0
 Get supported compression types. More...
 
virtual void setCompression (const std::string &compression)=0
 Set the compression type to use when writing. More...
 
virtual const boost::optional< std::string > & getCompression () const =0
 Get the compression type to use when writing. More...
 
virtual void changeOutputFile (const boost::filesystem::path &id)=0
 Switch the output file for the current dataset. More...
 
virtual void setWriteSequentially (bool sequential=true)=0
 Write planes sequentially. More...
 
virtual bool getWriteSequentially () const =0
 Check if planes are written sequentially. More...
 
- Public Member Functions inherited from ome::bioformats::FormatHandler
virtual ~FormatHandler ()
 Destructor.
 
virtual bool isThisType (const boost::filesystem::path &name, bool open=true) const =0
 Check if the given file is a valid instance of this file format. More...
 
virtual const std::string & getFormat () const =0
 Get the name of this file format. More...
 
virtual const std::string & getFormatDescription () const =0
 Get the description of this file format. More...
 
virtual const std::vector< boost::filesystem::path > & getSuffixes () const =0
 Get the default file suffixes for this file format. More...
 
virtual const std::vector< boost::filesystem::path > & getCompressionSuffixes () const =0
 Get the default compression suffixes for this file format. More...
 
virtual void setId (const boost::filesystem::path &id)=0
 Set the current file name. More...
 
virtual void close (bool fileOnly=false)=0
 Close the currently open file. More...
 

Protected Member Functions

 FormatWriter ()
 Constructor.
 
- Protected Member Functions inherited from ome::bioformats::FormatHandler
 FormatHandler ()
 Constructor.
 

Private Member Functions

 FormatWriter (const FormatWriter &)
 Copy constructor (deleted).
 
FormatWriteroperator= (const FormatWriter &)
 Assignment operator (deleted).
 

Additional Inherited Members

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

Detailed Description

Interface for all biological file format writers.

Note
No IOException in C++.
getColorModel and setColorModel not implemented; it is Java-specific and if needed will require reimplementing in C++.
getCodecOptions and setCodec options not implemented; these rely on the Java-specific ColorModel and its design reflects that of Java c javax.imageio which we can't use here, though bits of it might require reimplementing.
Todo:
Implement saveBytes methods using 2D Region with and/or in terms of Boost.MultiArray index ranges.

Member Function Documentation

virtual bool ome::bioformats::FormatWriter::canDoStacks ( ) const
pure 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.

Implemented in ome::bioformats::detail::FormatWriter.

virtual void ome::bioformats::FormatWriter::changeOutputFile ( const boost::filesystem::path &  id)
pure virtual

Switch the output file for the current dataset.

Parameters
idthe new file name.

Implemented in ome::bioformats::detail::FormatWriter.

virtual const boost::optional<std::string>& ome::bioformats::FormatWriter::getCompression ( ) const
pure virtual

Get the compression type to use when writing.

Returns
the compression type.

Implemented in ome::bioformats::detail::FormatWriter.

virtual const std::set<std::string>& ome::bioformats::FormatWriter::getCompressionTypes ( ) const
pure virtual

Get supported compression types.

Returns
the supported compression types.

Implemented in ome::bioformats::detail::FormatWriter.

virtual frame_rate_type ome::bioformats::FormatWriter::getFramesPerSecond ( ) const
pure virtual

Get the frame rate to use when writing.

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

Implemented in ome::bioformats::detail::FormatWriter.

virtual const ome::compat::shared_ptr< ::ome::xml::meta::MetadataRetrieve>& ome::bioformats::FormatWriter::getMetadataRetrieve ( ) const
pure virtual

Get the current metadata store for this writer.

Returns
the metadata store, which will never be null.

Implemented in ome::bioformats::detail::FormatWriter.

virtual ome::compat::shared_ptr< ::ome::xml::meta::MetadataRetrieve>& ome::bioformats::FormatWriter::getMetadataRetrieve ( )
pure virtual

Get the current metadata store for this writer.

Returns
the metadata store, which will never be null.

Implemented in ome::bioformats::detail::FormatWriter.

virtual const std::set<ome::xml::model::enums::PixelType>& ome::bioformats::FormatWriter::getPixelTypes ( ) const
pure virtual

Get supported pixel types.

Returns
the supported pixel types.

Implemented in ome::bioformats::detail::FormatWriter.

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

Get supported pixel types for the given codec.

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

Implemented in ome::bioformats::detail::FormatWriter.

virtual dimension_size_type ome::bioformats::FormatWriter::getSeries ( ) const
pure virtual

Get the active series.

Returns
the active series.

Implemented in ome::bioformats::detail::FormatWriter.

Referenced by ome::bioformats::FormatWriter::SaveSeries::~SaveSeries().

+ Here is the caller graph for this function:

virtual bool ome::bioformats::FormatWriter::getWriteSequentially ( ) const
pure virtual

Check if planes are written sequentially.

Returns
true if sequential, false if not.

Implemented in ome::bioformats::detail::FormatWriter.

virtual bool ome::bioformats::FormatWriter::isSupportedType ( ome::xml::model::enums::PixelType  type) const
pure virtual

Check if the pixel type is supported.

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

Implemented in ome::bioformats::detail::FormatWriter.

virtual bool ome::bioformats::FormatWriter::isSupportedType ( ome::xml::model::enums::PixelType  type,
const std::string &  codec 
) const
pure 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.

Implemented in ome::bioformats::detail::FormatWriter.

virtual void ome::bioformats::FormatWriter::saveBytes ( dimension_size_type  no,
VariantPixelBuffer buf 
)
pure virtual

Save an image plane.

Write an image plane from a VariantPixelBuffer of size

getSizeX * getSizeY * bytesPerPixel * getRGBChannelCount()

to the current series in the current file.

Parameters
nothe image index within the file.
bufthe source pixel buffer.
Exceptions
FormatExceptionif any of the parameters are invalid.

Implemented in ome::bioformats::detail::FormatWriter.

virtual void ome::bioformats::FormatWriter::saveBytes ( dimension_size_type  no,
VariantPixelBuffer buf,
dimension_size_type  x,
dimension_size_type  y,
dimension_size_type  w,
dimension_size_type  h 
)
pure virtual

Save an image plane.

Write an image plane from a VariantPixelBuffer of size

getSizeX * getSizeY * bytesPerPixel * getRGBChannelCount()

to the current series in the current file.

Parameters
nothe image index within the file.
bufthe source 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 any of the parameters are invalid.

Implemented in ome::bioformats::detail::FormatWriter.

virtual void ome::bioformats::FormatWriter::setCompression ( const std::string &  compression)
pure virtual

Set the compression type to use when writing.

Parameters
compressionthe compression type.

Implemented in ome::bioformats::detail::FormatWriter.

virtual void ome::bioformats::FormatWriter::setFramesPerSecond ( frame_rate_type  rate)
pure virtual

Set the frame rate to use when writing.

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

Implemented in ome::bioformats::detail::FormatWriter.

virtual void ome::bioformats::FormatWriter::setLookupTable ( const VariantPixelBuffer buf)
pure 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
bufthe source pixel buffer.

Implemented in ome::bioformats::detail::FormatWriter.

virtual void ome::bioformats::FormatWriter::setMetadataRetrieve ( ome::compat::shared_ptr< ::ome::xml::meta::MetadataRetrieve > &  retrieve)
pure virtual

Set the default metadata store for this writer.

Parameters
retrievea metadata retrieve implementation.

Implemented in ome::bioformats::detail::FormatWriter.

virtual void ome::bioformats::FormatWriter::setSeries ( dimension_size_type  no) const
pure virtual

Set the active series.

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

Implemented in ome::bioformats::detail::FormatWriter.

Referenced by ome::bioformats::FormatWriter::SaveSeries::~SaveSeries().

+ Here is the caller graph for this function:

virtual void ome::bioformats::FormatWriter::setWriteSequentially ( bool  sequential = true)
pure 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.

Implemented in ome::bioformats::detail::FormatWriter.


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