bioformats
5.1.8
|
Interface for all biological file format writers (default behaviour). More...
#include <ome/bioformats/detail/FormatWriter.h>
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 (ome::compat::shared_ptr< ::ome::xml::meta::MetadataRetrieve > &retrieve) |
Set the default metadata store for this writer. More... | |
const ome::compat::shared_ptr< ::ome::xml::meta::MetadataRetrieve > & | getMetadataRetrieve () const |
Get the current metadata store for this writer. More... | |
ome::compat::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 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... | |
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::PixelType > & | getPixelTypes () const |
Get supported pixel types. More... | |
const std::set< ome::xml::model::enums::PixelType > & | getPixelTypes (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... | |
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... | |
Public Member Functions inherited from ome::bioformats::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::bioformats::FormatHandler | |
virtual | ~FormatHandler () |
Destructor. | |
Protected Member Functions | |
FormatWriter (const WriterProperties &) | |
Constructor. | |
Protected Member Functions inherited from ome::bioformats::FormatWriter | |
FormatWriter () | |
Constructor. | |
Protected Member Functions inherited from ome::bioformats::FormatHandler | |
FormatHandler () | |
Constructor. | |
Protected Attributes | |
const WriterProperties & | writerProperties |
Writer 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::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. | |
ome::compat::shared_ptr< ::ome::xml::meta::MetadataRetrieve > | metadataRetrieve |
Current metadata store. More... | |
Private Member Functions | |
FormatWriter (const FormatWriter &) | |
Copy constructor (deleted). | |
FormatWriter & | operator= (const FormatWriter &) |
Assignment operator (deleted). | |
Additional Inherited Members | |
Public Types inherited from ome::bioformats::FormatWriter | |
typedef uint16_t | frame_rate_type |
Frame rate type. | |
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... | |
Interface for all biological file format writers (default behaviour).
ColorModel
isn't stored here; this is Java-specific and not implemented in C++.
|
virtual |
Get whether or not the writer can save multiple images in a single file.
true
if the writer supports multiple images, false
otherwise. Implements ome::bioformats::FormatWriter.
References ome::bioformats::detail::WriterProperties::stacks, and writerProperties.
|
virtual |
Switch the output file for the current dataset.
id | the new file name. |
Implements ome::bioformats::FormatWriter.
References ome::bioformats::FormatHandler::assertId(), currentId, and setId().
|
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.
fileOnly | close 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. |
On | error; exception type may vary. |
Implements ome::bioformats::FormatHandler.
Reimplemented in ome::bioformats::out::OMETIFFWriter, and ome::bioformats::out::MinimalTIFFWriter.
References compression, currentId, framesPerSecond, metadataRetrieve, out, plane, sequential, and series.
Referenced by ome::bioformats::out::MinimalTIFFWriter::close(), ome::bioformats::out::OMETIFFWriter::close(), and ~FormatWriter().
|
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().
References getSeries(), metadataRetrieve, and series.
|
virtual |
Get the compression type to use when writing.
Implements ome::bioformats::FormatWriter.
References compression.
|
virtual |
Get the default compression suffixes for this file format.
Implements ome::bioformats::FormatHandler.
References ome::bioformats::detail::WriterProperties::compression_suffixes, and writerProperties.
|
virtual |
Get supported compression types.
Implements ome::bioformats::FormatWriter.
References ome::bioformats::detail::WriterProperties::compression_types, and writerProperties.
|
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
.
References getSeries(), metadataRetrieve, and series.
Referenced by getIndex(), and getZCTCoords().
|
virtual |
Get the effective size of the C dimension.
This guarantees that
regardless of the result of isRGB().
References getSeries(), metadataRetrieve, and series.
Referenced by getImageCount(), getIndex(), and getZCTCoords().
|
virtual |
Get the name of this file format.
Implements ome::bioformats::FormatHandler.
References ome::bioformats::detail::WriterProperties::name, and writerProperties.
|
virtual |
Get the description of this file format.
Implements ome::bioformats::FormatHandler.
References ome::bioformats::detail::WriterProperties::description, and writerProperties.
|
virtual |
Get the frame rate to use when writing.
Implements ome::bioformats::FormatWriter.
References framesPerSecond.
|
virtual |
Determine the number of image planes in the current series.
References getEffectiveSizeC(), getSizeT(), and getSizeZ().
Referenced by getIndex(), getZCTCoords(), ome::bioformats::out::MinimalTIFFWriter::setId(), and setPlane().
|
virtual |
Get the linear index of a Z
, C
and T
coordinate.
The index is computed using the DimensionOrder.
z | the Z coordinate (real size). |
c | the C coordinate (real size). |
t | the T coordinate (real size). |
unify with the pixel buffer dimension indexes.
Don't use separate values to match the return of getZCTCoords.
References ome::bioformats::FormatHandler::assertId(), currentId, getDimensionOrder(), getEffectiveSizeC(), getImageCount(), ome::bioformats::getIndex(), getSizeT(), and getSizeZ().
|
virtual |
Set subchannel interleaving.
false
if unset. Implements ome::bioformats::FormatWriter.
References interleaved.
Referenced by ome::bioformats::out::MinimalTIFFWriter::setupIFD(), and ome::bioformats::out::OMETIFFWriter::setupIFD().
|
virtual |
Get the current metadata store for this writer.
null
. Implements ome::bioformats::FormatWriter.
References metadataRetrieve.
Referenced by ome::bioformats::out::MinimalTIFFWriter::setId(), and ome::bioformats::out::OMETIFFWriter::setId().
|
virtual |
Get the current metadata store for this writer.
null
. Implements ome::bioformats::FormatWriter.
References metadataRetrieve.
|
virtual |
Get the pixel type.
References getSeries(), metadataRetrieve, and series.
Referenced by ome::bioformats::out::MinimalTIFFWriter::setupIFD(), and ome::bioformats::out::OMETIFFWriter::setupIFD().
|
virtual |
Get supported pixel types.
Implements ome::bioformats::FormatWriter.
Referenced by isSupportedType().
|
virtual |
Get supported pixel types for the given codec.
codec | the codec to check. |
Implements ome::bioformats::FormatWriter.
References ome::bioformats::detail::WriterProperties::codec_pixel_types, and writerProperties.
|
virtual |
Get the active plane.
Implements ome::bioformats::FormatWriter.
References ome::bioformats::FormatHandler::assertId(), currentId, and plane.
Referenced by ome::bioformats::out::MinimalTIFFWriter::setPlane(), ome::bioformats::out::OMETIFFWriter::setPlane(), setPlane(), ome::bioformats::out::MinimalTIFFWriter::setupIFD(), and ome::bioformats::out::OMETIFFWriter::setupIFD().
|
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.
channel | the channel to use, range [0, EffectiveSizeC). |
References getSeries(), metadataRetrieve, and series.
Referenced by isRGB(), ome::bioformats::out::MinimalTIFFWriter::setupIFD(), and ome::bioformats::out::OMETIFFWriter::setupIFD().
|
virtual |
Get the active series.
Implements ome::bioformats::FormatWriter.
References ome::bioformats::FormatHandler::assertId(), currentId, and series.
Referenced by getBitsPerPixel(), getDimensionOrder(), getEffectiveSizeC(), getPixelType(), getRGBChannelCount(), getSizeC(), getSizeT(), getSizeX(), getSizeY(), getSizeZ(), ome::bioformats::out::MinimalTIFFWriter::saveBytes(), ome::bioformats::out::OMETIFFWriter::saveBytes(), saveBytes(), ome::bioformats::out::MinimalTIFFWriter::setSeries(), ome::bioformats::out::OMETIFFWriter::setSeries(), and setSeries().
|
virtual |
Get the number of image series in this file.
std::logic_error | if the sub-resolution metadata (if any) is invalid; this will only occur if the reader sets invalid metadata. |
References metadataRetrieve.
Referenced by ome::bioformats::out::OMETIFFWriter::fillMetadata(), and setSeries().
|
virtual |
Get the size of the C dimension.
References getSeries(), metadataRetrieve, and series.
|
virtual |
Get the size of the T dimension.
References getSeries(), metadataRetrieve, and series.
Referenced by getImageCount(), getIndex(), and getZCTCoords().
|
virtual |
Get the size of the X dimension.
References getSeries(), metadataRetrieve, and series.
Referenced by ome::bioformats::out::MinimalTIFFWriter::setupIFD(), and ome::bioformats::out::OMETIFFWriter::setupIFD().
|
virtual |
Get the size of the Y dimension.
References getSeries(), metadataRetrieve, and series.
Referenced by ome::bioformats::out::MinimalTIFFWriter::setupIFD(), and ome::bioformats::out::OMETIFFWriter::setupIFD().
|
virtual |
Get the size of the Z dimension.
References getSeries(), metadataRetrieve, and series.
Referenced by getImageCount(), getIndex(), and getZCTCoords().
|
virtual |
Get the default file suffixes for this file format.
Implements ome::bioformats::FormatHandler.
References ome::bioformats::detail::WriterProperties::suffixes, and writerProperties.
|
virtual |
Check if planes are written sequentially.
true
if sequential, false
if not. Implements ome::bioformats::FormatWriter.
References sequential.
|
virtual |
Get the Z
, C
and T
coordinate of a linear index.
index | the linear index. |
Z
, C
and T
values (real sizes).References ome::bioformats::FormatHandler::assertId(), currentId, getDimensionOrder(), getEffectiveSizeC(), getImageCount(), getSizeT(), getSizeZ(), and ome::bioformats::getZCTCoords().
Referenced by ome::bioformats::out::MinimalTIFFWriter::setupIFD(), and ome::bioformats::out::OMETIFFWriter::setupIFD().
|
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.
channel | the channel to use, range [0, EffectiveSizeC). |
true
if and only if getRGBChannelCount(channel)
returns a value greater than 1, false
otherwise. References getRGBChannelCount().
Referenced by ome::bioformats::out::MinimalTIFFWriter::setupIFD(), and ome::bioformats::out::OMETIFFWriter::setupIFD().
|
virtual |
Check if the pixel type is supported.
type | the pixel type to check. |
true
if supported, false
otherwise. Implements ome::bioformats::FormatWriter.
|
virtual |
Check if the pixel type is supported by the given codex.
type | the pixel type to check. |
codec | the codec to check. |
true
if supported, false
otherwise. Implements ome::bioformats::FormatWriter.
References getPixelTypes().
|
virtual |
Check if the given file is a valid instance of this file format.
name | the file to open for checking. |
open | If 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. |
true
if the file is valid, false
otherwise.Implements ome::bioformats::FormatHandler.
References ome::bioformats::FormatHandler::checkSuffix(), ome::bioformats::detail::WriterProperties::compression_suffixes, ome::bioformats::detail::WriterProperties::suffixes, and writerProperties.
|
virtual |
Save an image plane.
Write an image plane from a VariantPixelBuffer of size
to the current series in the current file.
plane | the plane index within the series. |
buf | the source pixel buffer. |
FormatException | if any of the parameters are invalid. |
Implements ome::bioformats::FormatWriter.
References ome::bioformats::FormatHandler::assertId(), currentId, getSeries(), and metadataRetrieve.
|
virtual |
Set the compression type to use when writing.
compression | the compression type. |
Implements ome::bioformats::FormatWriter.
References compression, ome::bioformats::detail::WriterProperties::compression_types, and writerProperties.
|
virtual |
Set the frame rate to use when writing.
rate | the frame rate (number of frames per second). |
Implements ome::bioformats::FormatWriter.
References framesPerSecond.
|
virtual |
Set the current file name.
Note this will throw FormatException if there are problems opening the file.
id | the filename to open. |
Implements ome::bioformats::FormatHandler.
Reimplemented in ome::bioformats::out::OMETIFFWriter, and ome::bioformats::out::MinimalTIFFWriter.
References ome::common::canonical(), currentId, and out.
Referenced by changeOutputFile(), and ome::bioformats::out::OMETIFFWriter::setId().
|
virtual |
Set subchannel interleaving.
interleaved | true to enable interleaving (chunky) or false to disable interleaving (planar). |
Implements ome::bioformats::FormatWriter.
References interleaved.
|
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.
plane | the plane index within the series. |
buf | the source pixel buffer. |
Implements ome::bioformats::FormatWriter.
References ome::bioformats::FormatHandler::assertId(), and currentId.
|
virtual |
Set the default metadata store for this writer.
retrieve | a metadata retrieve implementation. |
Implements ome::bioformats::FormatWriter.
References ome::bioformats::FormatHandler::assertId(), currentId, and metadataRetrieve.
|
virtual |
Set the active plane.
plane | the plane to activate. |
Implements ome::bioformats::FormatWriter.
Reimplemented in ome::bioformats::out::OMETIFFWriter, and ome::bioformats::out::MinimalTIFFWriter.
References ome::bioformats::FormatHandler::assertId(), currentId, getImageCount(), getPlane(), and plane.
Referenced by ome::bioformats::out::MinimalTIFFWriter::setPlane(), and ome::bioformats::out::OMETIFFWriter::setPlane().
|
virtual |
Set the active series.
series | the series to activate. |
Implements ome::bioformats::FormatWriter.
Reimplemented in ome::bioformats::out::OMETIFFWriter, and ome::bioformats::out::MinimalTIFFWriter.
References ome::bioformats::FormatHandler::assertId(), currentId, getSeries(), getSeriesCount(), plane, and series.
Referenced by ome::bioformats::out::MinimalTIFFWriter::setSeries(), and ome::bioformats::out::OMETIFFWriter::setSeries().
|
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.
sequential | true if sequential, false if not. |
Implements ome::bioformats::FormatWriter.
References sequential.
|
protected |
Current metadata store.
Should never be accessed directly as the semantics of getMetadataRetrieve() prevent "null" access.
Referenced by close(), ome::bioformats::out::OMETIFFWriter::fillMetadata(), getBitsPerPixel(), getDimensionOrder(), getEffectiveSizeC(), getMetadataRetrieve(), getPixelType(), getRGBChannelCount(), getSeriesCount(), getSizeC(), getSizeT(), getSizeX(), getSizeY(), getSizeZ(), saveBytes(), ome::bioformats::out::MinimalTIFFWriter::setId(), ome::bioformats::out::OMETIFFWriter::setId(), and setMetadataRetrieve().