OpenCMISS-Zinc C++ API Documentation
 All Classes Namespaces Files Functions Typedefs Enumerations Enumerator Pages
streamimage.hpp
Go to the documentation of this file.
1 
4 /* OpenCMISS-Zinc Library
5 *
6 * This Source Code Form is subject to the terms of the Mozilla Public
7 * License, v. 2.0. If a copy of the MPL was not distributed with this
8 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
9 #ifndef CMZN_STREAMIMAGE_HPP__
10 #define CMZN_STREAMIMAGE_HPP__
11 
12 #include "opencmiss/zinc/streamimage.h"
13 #include "opencmiss/zinc/fieldimage.hpp"
14 #include "opencmiss/zinc/stream.hpp"
15 
16 namespace OpenCMISS
17 {
18 namespace Zinc
19 {
20 
31 {
32 public:
34  { }
35 
36  // takes ownership of C handle, responsibility for destroying it
37  explicit StreaminformationImage(cmzn_streaminformation_image_id streaminformation_image_id) :
38  Streaminformation(reinterpret_cast<cmzn_streaminformation_id>(streaminformation_image_id))
39  { }
40 
46  bool isValid() const
47  {
48  return (0 != id);
49  }
50 
56  cmzn_streaminformation_image_id getDerivedId() const
57  {
58  return reinterpret_cast<cmzn_streaminformation_image_id>(id);
59  }
60 
65  enum Attribute
66  {
67  ATTRIBUTE_RAW_WIDTH_PIXELS = CMZN_STREAMINFORMATION_IMAGE_ATTRIBUTE_RAW_WIDTH_PIXELS,
71  ATTRIBUTE_RAW_HEIGHT_PIXELS = CMZN_STREAMINFORMATION_IMAGE_ATTRIBUTE_RAW_HEIGHT_PIXELS,
75  ATTRIBUTE_BITS_PER_COMPONENT = CMZN_STREAMINFORMATION_IMAGE_ATTRIBUTE_BITS_PER_COMPONENT,
79  ATTRIBUTE_COMPRESSION_QUALITY = CMZN_STREAMINFORMATION_IMAGE_ATTRIBUTE_COMPRESSION_QUALITY
85  };
86 
92  {
93  FILE_FORMAT_INVALID = CMZN_STREAMINFORMATION_IMAGE_FILE_FORMAT_INVALID,
95  FILE_FORMAT_BMP = CMZN_STREAMINFORMATION_IMAGE_FILE_FORMAT_BMP,
98  FILE_FORMAT_DICOM = CMZN_STREAMINFORMATION_IMAGE_FILE_FORMAT_DICOM,
101  FILE_FORMAT_JPG = CMZN_STREAMINFORMATION_IMAGE_FILE_FORMAT_JPG,
104  FILE_FORMAT_GIF = CMZN_STREAMINFORMATION_IMAGE_FILE_FORMAT_GIF,
107  FILE_FORMAT_PNG = CMZN_STREAMINFORMATION_IMAGE_FILE_FORMAT_PNG,
110  FILE_FORMAT_SGI = CMZN_STREAMINFORMATION_IMAGE_FILE_FORMAT_SGI,
113  FILE_FORMAT_TIFF = CMZN_STREAMINFORMATION_IMAGE_FILE_FORMAT_TIFF,
116  FILE_FORMAT_ANALYZE = CMZN_STREAMINFORMATION_IMAGE_FILE_FORMAT_ANALYZE,
119  FILE_FORMAT_ANALYZE_OBJECT_MAP = CMZN_STREAMINFORMATION_IMAGE_FILE_FORMAT_ANALYZE_OBJECT_MAP
122  };
123 
128  {
129  PIXEL_FORMAT_INVALID = CMZN_STREAMINFORMATION_IMAGE_PIXEL_FORMAT_INVALID,
131  PIXEL_FORMAT_LUMINANCE = CMZN_STREAMINFORMATION_IMAGE_PIXEL_FORMAT_LUMINANCE,
134  PIXEL_FORMAT_LUMINANCE_ALPHA = CMZN_STREAMINFORMATION_IMAGE_PIXEL_FORMAT_LUMINANCE_ALPHA,
137  PIXEL_FORMAT_RGB = CMZN_STREAMINFORMATION_IMAGE_PIXEL_FORMAT_RGB,
140  PIXEL_FORMAT_RGBA = CMZN_STREAMINFORMATION_IMAGE_PIXEL_FORMAT_RGBA,
143  PIXEL_FORMAT_ABGR = CMZN_STREAMINFORMATION_IMAGE_PIXEL_FORMAT_ABGR,
146  PIXEL_FORMAT_BGR = CMZN_STREAMINFORMATION_IMAGE_PIXEL_FORMAT_BGR
149  };
150 
162  int setAttributeInteger(Attribute attribute, int value)
163  {
164  return cmzn_streaminformation_image_set_attribute_integer(getDerivedId(),
165  static_cast<cmzn_streaminformation_image_attribute>(attribute), value);
166  }
167 
177  int setAttributeReal(Attribute attribute, double value)
178  {
179  return cmzn_streaminformation_image_set_attribute_real(getDerivedId(),
180  static_cast<cmzn_streaminformation_image_attribute>(attribute), value);
181  }
182 
190  int setFileFormat(FileFormat imageFileFormat)
191  {
192  return cmzn_streaminformation_image_set_file_format(getDerivedId(),
193  static_cast<cmzn_streaminformation_image_file_format>(imageFileFormat));
194  }
195 
203  int setPixelFormat(PixelFormat imagePixelFormat)
204  {
205  return cmzn_streaminformation_image_set_pixel_format(getDerivedId(),
206  static_cast<cmzn_streaminformation_image_pixel_format>(imagePixelFormat));
207  }
208 
209 };
210 
212 {
213  return StreaminformationImage(cmzn_streaminformation_cast_image(id));
214 }
215 
217 {
218  return StreaminformationImage(
219  reinterpret_cast<cmzn_streaminformation_image_id>(
220  cmzn_field_image_create_streaminformation_image(getDerivedId())));
221 }
222 
223 inline int FieldImage::read(const StreaminformationImage& streaminformationImage)
224 {
225  return cmzn_field_image_read(getDerivedId(), streaminformationImage.getDerivedId());
226 }
227 
228 inline int FieldImage::write(const StreaminformationImage& streaminformationImage)
229 {
230  return cmzn_field_image_write(getDerivedId(), streaminformationImage.getDerivedId());
231 }
232 
233 } // namespace Zinc
234 }
235 #endif
int write(const StreaminformationImage &streaminformationImage)
Definition: streamimage.hpp:228
int read(const StreaminformationImage &streaminformationImage)
Definition: streamimage.hpp:223
PixelFormat
Definition: streamimage.hpp:127
int setAttributeReal(Attribute attribute, double value)
Definition: streamimage.hpp:177
FileFormat
Definition: streamimage.hpp:91
int setPixelFormat(PixelFormat imagePixelFormat)
Definition: streamimage.hpp:203
StreaminformationImage castImage()
Definition: streamimage.hpp:211
Attribute
Definition: streamimage.hpp:65
Base type listing resources and options for stream I/O.
Definition: stream.hpp:213
int setFileFormat(FileFormat imageFileFormat)
Definition: streamimage.hpp:190
bool isValid() const
Definition: streamimage.hpp:46
int setAttributeInteger(Attribute attribute, int value)
Definition: streamimage.hpp:162
An image-specific stream information object.
Definition: streamimage.hpp:30
cmzn_streaminformation_image_id getDerivedId() const
Definition: streamimage.hpp:56
StreaminformationImage createStreaminformationImage()
Definition: streamimage.hpp:216