ome-files  0.3.0
FormatWriter.h
1 /*
2  * #%L
3  * OME-FILES 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_FILES_FORMATWRITER_H
39 #define OME_FILES_FORMATWRITER_H
40 
41 #include <array>
42 #include <memory>
43 #include <set>
44 #include <string>
45 #include <vector>
46 #include <map>
47 
48 #include <boost/optional.hpp>
49 
50 #include <ome/files/CoreMetadata.h>
51 #include <ome/files/FileInfo.h>
52 #include <ome/files/FormatHandler.h>
53 #include <ome/files/MetadataConfigurable.h>
54 #include <ome/files/MetadataMap.h>
55 #include <ome/files/Types.h>
56 
57 #include <ome/xml/meta/MetadataRetrieve.h>
58 
59 namespace ome
60 {
61  namespace files
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(std::shared_ptr<::ome::xml::meta::MetadataRetrieve>& retrieve) = 0;
231 
237  virtual
238  const std::shared_ptr<::ome::xml::meta::MetadataRetrieve>&
239  getMetadataRetrieve() const = 0;
240 
246  virtual
247  std::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 
324  virtual
325  const std::set<std::string>&
327 
333  virtual
334  void
335  setCompression(const std::string& compression) = 0;
336 
342  virtual
343  const boost::optional<std::string>&
344  getCompression() const = 0;
345 
352  virtual
353  void
354  setInterleaved(bool interleaved) = 0;
355 
361  virtual
362  const boost::optional<bool>&
363  getInterleaved() const = 0;
364 
370  virtual
371  void
372  changeOutputFile(const boost::filesystem::path& id) = 0;
373 
383  virtual
384  void
385  setWriteSequentially(bool sequential = true) = 0;
386 
392  virtual
393  bool
394  getWriteSequentially() const = 0;
395  };
396 
397  }
398 }
399 
400 #endif // OME_FILES_FORMATWRITER_H
401 
402 /*
403  * Local Variables:
404  * mode:C++
405  * End:
406  */
virtual void changeOutputFile(const boost::filesystem::path &id)=0
Switch the output file for the current dataset.
virtual ~FormatWriter()
Destructor.
Definition: FormatWriter.h:104
Interface for all biological file format writers.
Definition: FormatWriter.h:82
virtual void setLookupTable(dimension_size_type plane, const VariantPixelBuffer &buf)=0
Set the color lookup table associated with the current series.
std::size_t dimension_size_type
Size type for image dimensions.
Definition: Types.h:58
FormatWriter()
Constructor.
Definition: FormatWriter.h:90
virtual void setSeries(dimension_size_type series) const =0
Set the active series.
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 dimension_size_type getSeries() const =0
Get the active series.
virtual bool canDoStacks() const =0
Get whether or not the writer can save multiple images in a single file.
virtual dimension_size_type getPlane() const =0
Get the active plane.
Open Microscopy Environment C++.
virtual void setPlane(dimension_size_type plane) const =0
Set the active plane.
virtual void setFramesPerSecond(frame_rate_type rate)=0
Set the frame rate to use when writing.
virtual const std::shared_ptr<::ome::xml::meta::MetadataRetrieve > & getMetadataRetrieve() const =0
Get the current metadata store for this writer.
virtual const std::set< std::string > & getCompressionTypes() const =0
Get supported compression types.
virtual void setInterleaved(bool interleaved)=0
Set subchannel interleaving.
virtual frame_rate_type getFramesPerSecond() const =0
Get the frame rate to use when writing.
virtual void setCompression(const std::string &compression)=0
Set the compression type to use when writing.
virtual void setMetadataRetrieve(std::shared_ptr<::ome::xml::meta::MetadataRetrieve > &retrieve)=0
Set the default metadata store for this writer.
virtual bool isSupportedType(ome::xml::model::enums::PixelType type) const =0
Check if the pixel type is supported.
uint16_t frame_rate_type
Frame rate type.
Definition: FormatWriter.h:86
virtual void setWriteSequentially(bool sequential=true)=0
Write planes sequentially.
virtual const boost::optional< bool > & getInterleaved() const =0
Set subchannel interleaving.
Buffer for all pixel types.
Definition: VariantPixelBuffer.h:75
FormatWriter & operator=(const FormatWriter &)
Assignment operator (deleted).
Interface for all biological file format readers and writers.
Definition: FormatHandler.h:63
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.