bioformats  5.1.8
FormatWriter.h
1 /*
2  * #%L
3  * OME-BIOFORMATS C++ library for image IO.
4  * Copyright © 2006 - 2016 Open Microscopy Environment:
5  * - Massachusetts Institute of Technology
6  * - National Institutes of Health
7  * - University of Dundee
8  * - Board of Regents of the University of Wisconsin-Madison
9  * - Glencoe Software, Inc.
10  * %%
11  * Redistribution and use in source and binary forms, with or without
12  * modification, are permitted provided that the following conditions are met:
13  *
14  * 1. Redistributions of source code must retain the above copyright notice,
15  * this list of conditions and the following disclaimer.
16  * 2. Redistributions in binary form must reproduce the above copyright notice,
17  * this list of conditions and the following disclaimer in the documentation
18  * and/or other materials provided with the distribution.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
24  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30  * POSSIBILITY OF SUCH DAMAGE.
31  *
32  * The views and conclusions contained in the software and documentation are
33  * those of the authors and should not be interpreted as representing official
34  * policies, either expressed or implied, of any organization.
35  * #L%
36  */
37 
38 #ifndef OME_BIOFORMATS_FORMATWRITER_H
39 #define OME_BIOFORMATS_FORMATWRITER_H
40 
41 #include <set>
42 #include <string>
43 #include <vector>
44 #include <map>
45 
46 #include <boost/optional.hpp>
47 
48 #include <ome/bioformats/CoreMetadata.h>
49 #include <ome/bioformats/FileInfo.h>
50 #include <ome/bioformats/FormatHandler.h>
51 #include <ome/bioformats/MetadataConfigurable.h>
52 #include <ome/bioformats/MetadataMap.h>
53 #include <ome/bioformats/Types.h>
54 
55 #include <ome/compat/array.h>
56 
57 #include <ome/xml/meta/MetadataRetrieve.h>
58 
59 namespace ome
60 {
61  namespace bioformats
62  {
63 
64  class VariantPixelBuffer;
65 
82  class FormatWriter : virtual public FormatHandler
83  {
84  public:
86  typedef uint16_t frame_rate_type;
87 
88  protected:
91  {}
92 
93  private:
95  FormatWriter (const FormatWriter&);
96 
99  operator= (const FormatWriter&);
100 
101  public:
103  virtual
105  {}
106 
117  virtual
118  void
120  const VariantPixelBuffer& buf) = 0;
121 
138  virtual
139  void
141  VariantPixelBuffer& buf) = 0;
142 
163  virtual
164  void
166  VariantPixelBuffer& buf,
170  dimension_size_type h) = 0;
171 
180  virtual
181  void
182  setSeries(dimension_size_type series) const = 0;
183 
189  virtual
191  getSeries() const = 0;
192 
201  virtual void
202  setPlane(dimension_size_type plane) const = 0;
203 
209  virtual dimension_size_type
210  getPlane() const = 0;
211 
219  virtual
220  bool
221  canDoStacks() const = 0;
222 
228  virtual
229  void
230  setMetadataRetrieve(ome::compat::shared_ptr< ::ome::xml::meta::MetadataRetrieve>& retrieve) = 0;
231 
237  virtual
238  const ome::compat::shared_ptr< ::ome::xml::meta::MetadataRetrieve>&
239  getMetadataRetrieve() const = 0;
240 
246  virtual
247  ome::compat::shared_ptr< ::ome::xml::meta::MetadataRetrieve>&
248  getMetadataRetrieve() = 0;
249 
255  virtual
256  void
257  setFramesPerSecond(frame_rate_type rate) = 0;
258 
264  virtual
265  frame_rate_type
266  getFramesPerSecond() const = 0;
267 
273  virtual
274  const std::set<ome::xml::model::enums::PixelType>&
275  getPixelTypes() const = 0;
276 
283  virtual
284  const std::set<ome::xml::model::enums::PixelType>&
285  getPixelTypes(const std::string& codec) const = 0;
286 
293  virtual
294  bool
296 
304  virtual
305  bool
307  const std::string& codec) const = 0;
308 
314  virtual
315  const std::set<std::string>&
316  getCompressionTypes() const = 0;
317 
323  virtual
324  void
325  setCompression(const std::string& compression) = 0;
326 
332  virtual
333  const boost::optional<std::string>&
334  getCompression() const = 0;
335 
342  virtual
343  void
344  setInterleaved(bool interleaved) = 0;
345 
351  virtual
352  const boost::optional<bool>&
353  getInterleaved() const = 0;
354 
360  virtual
361  void
362  changeOutputFile(const boost::filesystem::path& id) = 0;
363 
373  virtual
374  void
375  setWriteSequentially(bool sequential = true) = 0;
376 
382  virtual
383  bool
384  getWriteSequentially() const = 0;
385  };
386 
387  }
388 }
389 
390 #endif // OME_BIOFORMATS_FORMATWRITER_H
391 
392 /*
393  * Local Variables:
394  * mode:C++
395  * End:
396  */
virtual bool isSupportedType(ome::xml::model::enums::PixelType type) const =0
Check if the pixel type is supported.
virtual void setMetadataRetrieve(ome::compat::shared_ptr< ::ome::xml::meta::MetadataRetrieve > &retrieve)=0
Set the default metadata store for this writer.
Interface for all biological file format readers and writers.
Definition: FormatHandler.h:64
virtual void setPlane(dimension_size_type plane) const =0
Set the active plane.
virtual dimension_size_type getSeries() const =0
Get the active series.
virtual const ome::compat::shared_ptr< ::ome::xml::meta::MetadataRetrieve > & getMetadataRetrieve() const =0
Get the current metadata store for this writer.
uint16_t frame_rate_type
Frame rate type.
Definition: FormatWriter.h:86
Interface for all biological file format writers.
Definition: FormatWriter.h:82
virtual const boost::optional< bool > & getInterleaved() const =0
Set subchannel interleaving.
virtual void setCompression(const std::string &compression)=0
Set the compression type to use when writing.
Array type substitution.
FormatWriter & operator=(const FormatWriter &)
Assignment operator (deleted).
virtual ~FormatWriter()
Destructor.
Definition: FormatWriter.h:104
virtual frame_rate_type getFramesPerSecond() const =0
Get the frame rate to use when writing.
virtual bool canDoStacks() const =0
Get whether or not the writer can save multiple images in a single file.
Open Microscopy Environment C++ implementation.
Definition: CoreMetadata.cpp:40
virtual const std::set< ome::xml::model::enums::PixelType > & getPixelTypes() const =0
Get supported pixel types.
virtual void setWriteSequentially(bool sequential=true)=0
Write planes sequentially.
virtual void saveBytes(dimension_size_type plane, VariantPixelBuffer &buf)=0
Save an image plane.
virtual bool getWriteSequentially() const =0
Check if planes are written sequentially.
virtual void setInterleaved(bool interleaved)=0
Set subchannel interleaving.
virtual void setLookupTable(dimension_size_type plane, const VariantPixelBuffer &buf)=0
Set the color lookup table associated with the current series.
PixelType enumeration.
Definition: PixelType.h:69
virtual dimension_size_type getPlane() const =0
Get the active plane.
virtual const std::set< std::string > & getCompressionTypes() const =0
Get supported compression types.
Buffer for all pixel types.
Definition: VariantPixelBuffer.h:75
FormatWriter()
Constructor.
Definition: FormatWriter.h:90
virtual void setFramesPerSecond(frame_rate_type rate)=0
Set the frame rate to use when writing.
virtual void changeOutputFile(const boost::filesystem::path &id)=0
Switch the output file for the current dataset.
std::size_t dimension_size_type
Size type for image dimensions.
Definition: Types.h:59
virtual void setSeries(dimension_size_type series) const =0
Set the active series.
virtual const boost::optional< std::string > & getCompression() const =0
Get the compression type to use when writing.