ome-files 0.1.0

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

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

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

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

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

Inheritance diagram for ome::files::FormatWriter:
[legend]
Collaboration diagram for ome::files::FormatWriter:
[legend]

## Public Types
typedef uint16_t | frame_rate_type
| Frame rate type.

## Public Member Functions
virtual | ~FormatWriter ()
| Destructor.
virtual void | setLookupTable (dimension_size_type plane, const VariantPixelBuffer &buf)=0
| Set the color lookup table associated with the current series. More...
virtual void | saveBytes (dimension_size_type plane, VariantPixelBuffer &buf)=0
| Save an image plane. More...
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...
virtual void | setSeries (dimension_size_type series) const =0
| Set the active series. More...
virtual dimension_size_type | getSeries () const =0
| Get the active series. More...
virtual void | setPlane (dimension_size_type plane) const =0
| Set the active plane. More...
virtual dimension_size_type | getPlane () const =0
| Get the active plane. 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 | setInterleaved (bool interleaved)=0
| Set subchannel interleaving. More...
virtual const boost::optional< bool > & | getInterleaved () const =0
| Set subchannel interleaving. 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::files::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::files::FormatHandler
| FormatHandler ()
| Constructor.

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

## Additional Inherited Members
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.

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

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

Switch the output file for the current dataset.

Parameters

  id | the new file name.

Implemented in ome::files::detail::FormatWriter.

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

Get the compression type to use when writing.

Returns
  the compression type.

Implemented in ome::files::detail::FormatWriter.

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

Get supported compression types.

Returns
  the supported compression types.

Implemented in ome::files::detail::FormatWriter.

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

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

Set subchannel interleaving.

Returns
  the current interleaving setting; `false` if unset.

Implemented in ome::files::detail::FormatWriter.

virtual const ome::compat::shared_ptr< ::ome::xml::meta::MetadataRetrieve>& ome::files::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::files::detail::FormatWriter.

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

Get the current metadata store for this writer.

Returns
  the metadata store, which will never be `null`.

Implemented in ome::files::detail::FormatWriter.

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

Get supported pixel types.

Returns
  the supported pixel types.

Implemented in ome::files::detail::FormatWriter.

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

Get supported pixel types for the given codec.

Parameters

  codec | the codec to check.

Returns
  the supported pixel types.

Implemented in ome::files::detail::FormatWriter.

virtual dimension_size_type ome::files::FormatWriter::getPlane | ( |  | ) | const
| pure virtual

Get the active plane.

Returns
  the active plane.

Implemented in ome::files::detail::FormatWriter.

virtual dimension_size_type ome::files::FormatWriter::getSeries | ( |  | ) | const
| pure virtual

Get the active series.

Returns
  the active series.

Implemented in ome::files::detail::FormatWriter.

virtual bool ome::files::FormatWriter::getWriteSequentially | ( |  | ) | const
| pure virtual

Check if planes are written sequentially.

Returns
  `true` if sequential, `false` if not.

Implemented in ome::files::detail::FormatWriter.

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

Check if the pixel type is supported.

Parameters

  type | the pixel type to check.

Returns
  `true` if supported, `false` otherwise.

Implemented in ome::files::detail::FormatWriter.

virtual bool ome::files::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

  type | the pixel type to check.
  codec | the codec to check.

Returns
  `true` if supported, `false` otherwise.

Implemented in ome::files::detail::FormatWriter.

virtual void ome::files::FormatWriter::saveBytes | ( | dimension_size_type | plane,
|  | 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

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

Exceptions

  FormatException | if any of the parameters are invalid.

Implemented in ome::files::detail::FormatWriter.

virtual void ome::files::FormatWriter::saveBytes | ( | dimension_size_type | plane,
|  | 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

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

Exceptions

  FormatException | if any of the parameters are invalid.

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

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

Set the compression type to use when writing.

Parameters

  compression | the compression type.

Implemented in ome::files::detail::FormatWriter.

virtual void ome::files::FormatWriter::setFramesPerSecond | ( | frame_rate_type | rate | ) |
| pure virtual

Set the frame rate to use when writing.

Parameters

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

Implemented in ome::files::detail::FormatWriter.

virtual void ome::files::FormatWriter::setInterleaved | ( | bool | interleaved | ) |
| pure virtual

Set subchannel interleaving.

Parameters

  interleaved | `true` to enable interleaving (chunky) or `false` to disable interleaving (planar).

Implemented in ome::files::detail::FormatWriter.

virtual void ome::files::FormatWriter::setLookupTable | ( | dimension_size_type | plane,
|  | 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

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

Implemented in ome::files::detail::FormatWriter.

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

Set the default metadata store for this writer.

Parameters

  retrieve | a metadata retrieve implementation.

Implemented in ome::files::detail::FormatWriter.

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

Set the active plane.

Parameters

  plane | the plane to activate.

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

Implemented in ome::files::detail::FormatWriter, ome::files::out::OMETIFFWriter, and ome::files::out::MinimalTIFFWriter.

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

Set the active series.

Parameters

  series | the series to activate.

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

Implemented in ome::files::detail::FormatWriter, ome::files::out::OMETIFFWriter, and ome::files::out::MinimalTIFFWriter.

virtual void ome::files::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

  sequential | `true` if sequential, `false` if not.

Implemented in ome::files::detail::FormatWriter.

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

- ome/files/FormatWriter.h