ome-files 0.2.2

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 <set>
42 #include <string>
43 #include <vector>
44 #include <map>
45
46 #include <boost/optional.hpp>
47
48 #include <ome/files/CoreMetadata.h>
49 #include <ome/files/FileInfo.h>
50 #include <ome/files/FormatHandler.h>
51 #include <ome/files/MetadataConfigurable.h>
52 #include <ome/files/MetadataMap.h>
53 #include <ome/files/Types.h>
54
55 #include <ome/compat/array.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:
90 FormatWriter()
91 {}
92
93 private:
95 FormatWriter (const FormatWriter&);
96
98 FormatWriter&
99 operator= (const FormatWriter&);
100
101 public:
103 virtual
104 ~FormatWriter()
105 {}
106
117 virtual
118 void
119 setLookupTable(dimension_size_type plane,
120 const VariantPixelBuffer& buf) = 0;
121
138 virtual
139 void
140 saveBytes(dimension_size_type plane,
141 VariantPixelBuffer& buf) = 0;
142
163 virtual
164 void
165 saveBytes(dimension_size_type plane,
166 VariantPixelBuffer& buf,
167 dimension_size_type x,
168 dimension_size_type y,
169 dimension_size_type w,
170 dimension_size_type h) = 0;
171
180 virtual
181 void
182 setSeries(dimension_size_type series) const = 0;
183
189 virtual
190 dimension_size_type
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
295 isSupportedType(ome::xml::model::enums::PixelType type) const = 0;
296
304 virtual
305 bool
306 isSupportedType(ome::xml::model::enums::PixelType type,
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_FILES_FORMATWRITER_H
391
392 /*
393 * Local Variables:
394 * mode:C++
395 * End:
396 */
ome::files::FormatWriter::getMetadataRetrieve
virtual const ome::compat::shared_ptr< ::ome::xml::meta::MetadataRetrieve > & getMetadataRetrieve() const =0
Get the current metadata store for this writer.
ome::files::FormatWriter::changeOutputFile
virtual void changeOutputFile(const boost::filesystem::path &id)=0
Switch the output file for the current dataset.
ome::files::FormatWriter::~FormatWriter
virtual ~FormatWriter()
Destructor.
Definition: FormatWriter.h:104
ome::files::FormatWriter
Interface for all biological file format writers.
Definition: FormatWriter.h:82
ome::files::FormatWriter::setLookupTable
virtual void setLookupTable(dimension_size_type plane, const VariantPixelBuffer &buf)=0
Set the color lookup table associated with the current series.
ome::files::dimension_size_type
std::size_t dimension_size_type
Size type for image dimensions.
Definition: Types.h:59
ome::files::FormatWriter::setMetadataRetrieve
virtual void setMetadataRetrieve(ome::compat::shared_ptr< ::ome::xml::meta::MetadataRetrieve > &retrieve)=0
Set the default metadata store for this writer.
ome::files::FormatWriter::FormatWriter
FormatWriter()
Constructor.
Definition: FormatWriter.h:90
ome::files::FormatWriter::setSeries
virtual void setSeries(dimension_size_type series) const =0
Set the active series.
ome::files::FormatWriter::saveBytes
virtual void saveBytes(dimension_size_type plane, VariantPixelBuffer &buf)=0
Save an image plane.
ome::files::FormatWriter::getWriteSequentially
virtual bool getWriteSequentially() const =0
Check if planes are written sequentially.
ome::files::FormatWriter::getSeries
virtual dimension_size_type getSeries() const =0
Get the active series.
ome::files::FormatWriter::canDoStacks
virtual bool canDoStacks() const =0
Get whether or not the writer can save multiple images in a single file.
ome::files::FormatWriter::getPlane
virtual dimension_size_type getPlane() const =0
Get the active plane.
ome
Open Microscopy Environment C++.
ome::files::FormatWriter::setPlane
virtual void setPlane(dimension_size_type plane) const =0
Set the active plane.
ome::files::FormatWriter::setFramesPerSecond
virtual void setFramesPerSecond(frame_rate_type rate)=0
Set the frame rate to use when writing.
ome::xml::model::enums::PixelType
ome::files::FormatWriter::getCompressionTypes
virtual const std::set< std::string > & getCompressionTypes() const =0
Get supported compression types.
ome::files::FormatWriter::getPixelTypes
virtual const std::set< ome::xml::model::enums::PixelType > & getPixelTypes() const =0
Get supported pixel types.
ome::files::FormatWriter::setInterleaved
virtual void setInterleaved(bool interleaved)=0
Set subchannel interleaving.
ome::files::FormatWriter::getFramesPerSecond
virtual frame_rate_type getFramesPerSecond() const =0
Get the frame rate to use when writing.
ome::files::FormatWriter::setCompression
virtual void setCompression(const std::string &compression)=0
Set the compression type to use when writing.
ome::files::FormatWriter::isSupportedType
virtual bool isSupportedType(ome::xml::model::enums::PixelType type) const =0
Check if the pixel type is supported.
ome::files::FormatWriter::frame_rate_type
uint16_t frame_rate_type
Frame rate type.
Definition: FormatWriter.h:86
ome::files::FormatWriter::setWriteSequentially
virtual void setWriteSequentially(bool sequential=true)=0
Write planes sequentially.
ome::files::FormatWriter::getInterleaved
virtual const boost::optional< bool > & getInterleaved() const =0
Set subchannel interleaving.
ome::files::VariantPixelBuffer
Buffer for all pixel types.
Definition: VariantPixelBuffer.h:75
array.h
ome::files::FormatWriter::operator=
FormatWriter & operator=(const FormatWriter &)
Assignment operator (deleted).
ome::files::FormatHandler
Interface for all biological file format readers and writers.
Definition: FormatHandler.h:63
ome::files::FormatWriter::getCompression
virtual const boost::optional< std::string > & getCompression() const =0
Get the compression type to use when writing.