bioformats  5.1.1
FormatWriter.h
1 /*
2  * #%L
3  * OME-BIOFORMATS C++ library for image IO.
4  * Copyright © 2006 - 2015 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 
200  virtual
201  bool
202  canDoStacks() const = 0;
203 
209  virtual
210  void
211  setMetadataRetrieve(ome::compat::shared_ptr< ::ome::xml::meta::MetadataRetrieve>& retrieve) = 0;
212 
218  virtual
219  const ome::compat::shared_ptr< ::ome::xml::meta::MetadataRetrieve>&
220  getMetadataRetrieve() const = 0;
221 
227  virtual
228  ome::compat::shared_ptr< ::ome::xml::meta::MetadataRetrieve>&
229  getMetadataRetrieve() = 0;
230 
236  virtual
237  void
238  setFramesPerSecond(frame_rate_type rate) = 0;
239 
245  virtual
246  frame_rate_type
247  getFramesPerSecond() const = 0;
248 
254  virtual
255  const std::set<ome::xml::model::enums::PixelType>&
256  getPixelTypes() const = 0;
257 
264  virtual
265  const std::set<ome::xml::model::enums::PixelType>&
266  getPixelTypes(const std::string& codec) const = 0;
267 
274  virtual
275  bool
277 
285  virtual
286  bool
288  const std::string& codec) const = 0;
289 
295  virtual
296  const std::set<std::string>&
297  getCompressionTypes() const = 0;
298 
304  virtual
305  void
306  setCompression(const std::string& compression) = 0;
307 
313  virtual
314  const boost::optional<std::string>&
315  getCompression() const = 0;
316 
323  virtual
324  void
325  setInterleaved(bool interleaved) = 0;
326 
332  virtual
333  const boost::optional<bool>&
334  getInterleaved() const = 0;
335 
341  virtual
342  void
343  changeOutputFile(const boost::filesystem::path& id) = 0;
344 
354  virtual
355  void
356  setWriteSequentially(bool sequential = true) = 0;
357 
363  virtual
364  bool
365  getWriteSequentially() const = 0;
366  };
367 
368  }
369 }
370 
371 #endif // OME_BIOFORMATS_FORMATWRITER_H
372 
373 /*
374  * Local Variables:
375  * mode:C++
376  * End:
377  */
virtual frame_rate_type getFramesPerSecond() const =0
Get the frame rate to use when writing.
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
uint16_t frame_rate_type
Frame rate type.
Definition: FormatWriter.h:86
virtual const ome::compat::shared_ptr< ::ome::xml::meta::MetadataRetrieve > & getMetadataRetrieve() const =0
Get the current metadata store for this writer.
virtual dimension_size_type getSeries() const =0
Get the active series.
Interface for all biological file format writers.
Definition: FormatWriter.h:82
virtual void setCompression(const std::string &compression)=0
Set the compression type to use when writing.
Array type substitution.
virtual bool getWriteSequentially() const =0
Check if planes are written sequentially.
FormatWriter & operator=(const FormatWriter &)
Assignment operator (deleted).
virtual ~FormatWriter()
Destructor.
Definition: FormatWriter.h:104
Open Microscopy Environment C++ implementation.
Definition: CoreMetadata.cpp:40
virtual const std::set< std::string > & getCompressionTypes() const =0
Get supported compression 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 const boost::optional< std::string > & getCompression() const =0
Get the compression type to use when writing.
virtual const std::set< ome::xml::model::enums::PixelType > & getPixelTypes() const =0
Get supported pixel types.
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.
virtual void setSeries(dimension_size_type series) const =0
Set the active series.
PixelType enumeration.
Definition: PixelType.h:70
virtual bool isSupportedType(ome::xml::model::enums::PixelType type) const =0
Check if the pixel type is supported.
Buffer for all pixel types.
Definition: VariantPixelBuffer.h:72
virtual bool canDoStacks() const =0
Get whether or not the writer can save multiple images in a single file.
FormatWriter()
Constructor.
Definition: FormatWriter.h:90
virtual const boost::optional< bool > & getInterleaved() const =0
Set subchannel interleaving.
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