ome-files  0.5.0
VariantPixelBuffer.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_VARIANTPIXELBUFFER_H
39 #define OME_FILES_VARIANTPIXELBUFFER_H
40 
41 #include <memory>
42 
43 #include <ome/files/PixelBuffer.h>
44 #include <ome/files/PixelProperties.h>
45 
46 #include <ome/common/variant.h>
47 
48 // Required with Boost 1.53 after variant include.
49 #include <boost/preprocessor.hpp>
50 
51 namespace ome
52 {
53  namespace files
54  {
55 
79  {
80  private:
81  /*
82  * The following series of typedefs may appear a little
83  * complicated, and perhaps unnecessary, but they do have a
84  * purpose. They exist to work around pre-C++11 compiler
85  * limitations (lack of variadic templates), primarily a limit
86  * to the maximum number of types which may be used with
87  * boost::variant. To exceed this limit (minimum guaranteed is
88  * 10), boost::mpl sequences are used to define the variant
89  * types. These also have length limits, so the type list is
90  * built up by defining separate type sequences, then
91  * concatenating them, and transforming them to provide list
92  * variants. Note that none of this is code per se; it's all
93  * compile-time template expansion which evaluates to a list of
94  * permitted types.
95  */
96 
98  typedef boost::mpl::vector<PixelProperties<::ome::xml::model::enums::PixelType::INT8>,
105 
107  typedef boost::mpl::vector< PixelProperties<::ome::xml::model::enums::PixelType::FLOAT>,
111 
113  typedef boost::mpl::joint_view<integer_pixel_types,
114  float_pixel_types>::type basic_pixel_types_view;
115 
117  template<typename T>
118  struct make_buffer
119  {
121  typedef std::shared_ptr<PixelBuffer<typename T::std_type>> type;
122  };
123 
125  typedef boost::mpl::transform_view<basic_pixel_types_view, make_buffer<boost::mpl::_1>>::type pixel_buffer_types_view;
126 
128  typedef boost::mpl::vector<> empty_types;
129 
131  typedef boost::mpl::insert_range<empty_types, boost::mpl::end<empty_types>::type, pixel_buffer_types_view>::type pixel_buffer_types;
132 
133  public:
135  typedef boost::make_variant_over<pixel_buffer_types>::type variant_buffer_type;
136 
139 
141  typedef boost::multi_array_types::size_type size_type;
142 
144  typedef std::array<boost::multi_array_types::index, PixelBufferBase::dimensions> indices_type;
145 
148 
151 
152  public:
160  explicit
162  buffer(createBuffer(boost::extents[1][1][1][1][1][1][1][1][1]))
163  {
164  }
165 
176  template<class ExtentList>
177  explicit
178  VariantPixelBuffer(const ExtentList& extents,
180  const storage_order_type& storage = PixelBufferBase::default_storage_order()):
181  buffer(createBuffer(extents, pixeltype, storage))
182  {
183  }
184 
195  explicit
196  VariantPixelBuffer(const range_type& range,
198  const storage_order_type& storage = PixelBufferBase::default_storage_order()):
199  buffer(createBuffer(range, pixeltype, storage))
200  {
201  }
202 
211  explicit
213 
219  template<typename T>
220  explicit
221  VariantPixelBuffer(std::shared_ptr<PixelBuffer<T>>& buffer):
222  buffer(buffer)
223  {
224  }
225 
227  virtual
229  {}
230 
236  variant_buffer_type&
238  {
239  return buffer;
240  }
241 
247  const variant_buffer_type&
248  vbuffer() const
249  {
250  return buffer;
251  }
252 
253  protected:
265  template<class T, class ExtentList>
266  static variant_buffer_type
267  makeBuffer(const ExtentList& extents,
268  const storage_order_type& storage,
270  {
271  return variant_buffer_type(std::shared_ptr<PixelBuffer<T>>(new PixelBuffer<T>(extents, pixeltype, ENDIAN_NATIVE, storage)));
272  }
273 
285  template<class T>
286  static variant_buffer_type
287  makeBuffer(const range_type& range,
288  const storage_order_type& storage,
290  {
291  return variant_buffer_type(std::shared_ptr<PixelBuffer<T>>(new PixelBuffer<T>(range, pixeltype, ENDIAN_NATIVE, storage)));
292  }
293 
294  // No switch default to avoid -Wunreachable-code errors.
295  // However, this then makes -Wswitch-default complain. Disable
296  // temporarily.
297 #ifdef __GNUC__
298 # pragma GCC diagnostic push
299 # pragma GCC diagnostic ignored "-Wswitch-default"
300 #endif
301 
302 #define OME_FILES_VARIANTPIXELBUFFER_CREATEEXTENTS_CASE(maR, maProperty, maType) \
303  case ::ome::xml::model::enums::PixelType::maType: \
304  buf = makeBuffer<PixelProperties<::ome::xml::model::enums::PixelType::maType>::std_type>(extents, storage, pixeltype); \
305  break;
306 
318  template<class ExtentList>
319  static variant_buffer_type
320  createBuffer(const ExtentList& extents,
322  const storage_order_type& storage = PixelBufferBase::default_storage_order())
323  {
324  variant_buffer_type buf;
325 
326  switch(pixeltype)
327  {
328  BOOST_PP_SEQ_FOR_EACH(OME_FILES_VARIANTPIXELBUFFER_CREATEEXTENTS_CASE, _, OME_XML_MODEL_ENUMS_PIXELTYPE_VALUES);
329  }
330 
331  return buf;
332  }
333 
334 #undef OME_FILES_VARIANTPIXELBUFFER_CREATEEXTENTS_CASE
335 
336 #define OME_FILES_VARIANTPIXELBUFFER_CREATERANGE_CASE(maR, maProperty, maType) \
337  case ::ome::xml::model::enums::PixelType::maType: \
338  buf = makeBuffer<PixelProperties<::ome::xml::model::enums::PixelType::maType>::std_type>(range, storage, pixeltype); \
339  break;
340 
352  static variant_buffer_type
353  createBuffer(const range_type& range,
355  const storage_order_type& storage = PixelBufferBase::default_storage_order())
356  {
357  variant_buffer_type buf;
358 
359  switch(pixeltype)
360  {
361  BOOST_PP_SEQ_FOR_EACH(OME_FILES_VARIANTPIXELBUFFER_CREATERANGE_CASE, _, OME_XML_MODEL_ENUMS_PIXELTYPE_VALUES);
362  }
363 
364  return buf;
365  }
366 
367 #undef OME_FILES_VARIANTPIXELBUFFER_CREATERANGE_CASE
368 
369 #ifdef __GNUC__
370 # pragma GCC diagnostic pop
371 #endif
372 
373  public:
384  template<class ExtentList>
385  void
386  setBuffer(const ExtentList& extents,
388  const storage_order_type& storage = PixelBufferBase::default_storage_order())
389  {
390  buffer = createBuffer(extents, pixeltype, storage);
391  }
392 
403  void
404  setBuffer(const range_type& range,
406  const storage_order_type& storage = PixelBufferBase::default_storage_order())
407  {
408  buffer = createBuffer(range, pixeltype, storage);
409  }
410 
418  bool
419  managed() const;
420 
426  size_type
427  num_elements() const;
428 
434  size_type
435  num_dimensions() const;
436 
444  const size_type *
445  shape() const;
446 
454  const boost::multi_array_types::index *
455  strides() const;
456 
465  const boost::multi_array_types::index *
466  index_bases() const;
467 
478  template <typename T>
479  const T *
480  origin() const;
481 
487  const storage_order_type&
488  storage_order() const;
489 
496  pixelType() const;
497 
503  EndianType
504  endianType() const;
505 
514  template<typename T>
516  array();
517 
526  template<typename T>
527  const typename PixelBuffer<T>::array_ref_type&
528  array() const;
529 
535  raw_type *
536  data();
537 
543  const raw_type *
544  data() const;
545 
553  template<typename T>
554  T *
555  data();
556 
564  template<typename T>
565  const T *
566  data() const;
567 
578  bool
579  valid() const;
580 
592  operator = (const VariantPixelBuffer& rhs);
593 
600  bool
601  operator == (const VariantPixelBuffer& rhs) const;
602 
609  bool
610  operator != (const VariantPixelBuffer& rhs) const;
611 
620  template <typename InputIterator>
621  void
622  assign(InputIterator begin,
623  InputIterator end);
624 
635  template<class charT, class traits>
636  inline void
637  read(std::basic_istream<charT,traits>& stream);
638 
649  template<class charT, class traits>
650  inline void
651  write(std::basic_ostream<charT,traits>& stream) const;
652 
653  protected:
655  variant_buffer_type buffer;
656  };
657 
658  namespace detail
659  {
660 
662  template<typename T>
663  struct VariantPixelBufferVisitor : public boost::static_visitor<PixelBuffer<T> *>
664  {
673  operator() (std::shared_ptr<PixelBuffer<T>>& v) const
674  {
675  if (!v)
676  throw std::runtime_error("Null pixel type");
677  return v.get();
678  }
679 
686  template <typename U>
688  operator() (U& /* v */) const
689  {
690  throw std::runtime_error("Unsupported pixel type conversion for buffer");
691  }
692  };
693 
695  template<typename T>
696  struct VariantPixelBufferConstVisitor : public boost::static_visitor<const PixelBuffer<T> *>
697  {
705  const PixelBuffer<T> *
706  operator() (const std::shared_ptr<PixelBuffer<T>>& v) const
707  {
708  if (!v)
709  throw std::runtime_error("Null pixel type");
710  return v.get();
711  }
712 
719  template <typename U>
720  const PixelBuffer<T> *
721  operator() (U& /* v */) const
722  {
723  throw std::runtime_error("Unsupported pixel type conversion for buffer");
724  }
725  };
726 
728  template <typename InputIterator>
729  struct VariantPixelBufferAssignVisitor : public boost::static_visitor<>
730  {
732  InputIterator begin;
734  InputIterator end;
735 
742  VariantPixelBufferAssignVisitor(InputIterator begin, InputIterator end):
743  begin(begin), end(end)
744  {}
745 
752  void
753  operator() (std::shared_ptr<PixelBuffer<typename std::iterator_traits<InputIterator>::value_type>>& v) const
754  {
755  if (!v)
756  throw std::runtime_error("Null pixel type");
757  v->array().assign(begin, end);
758  }
759 
765  template <typename T>
766  void
767  operator() (T& /* v */) const
768  {
769  throw std::runtime_error("Unsupported pixel type conversion for assignment");
770  }
771  };
772 
774  template<class charT, class traits>
775  struct VariantPixelBufferReadVisitor : public boost::static_visitor<>
776  {
778  std::basic_istream<charT,traits>& stream;
779 
785  VariantPixelBufferReadVisitor(std::basic_istream<charT,traits>& stream):
786  stream(stream)
787  {}
788 
794  template <typename T>
795  void
796  operator() (T& v) const
797  {
798  if (!v)
799  throw std::runtime_error("Null pixel type");
800  v->read(stream);
801  }
802  };
803 
805  template<class charT, class traits>
806  struct VariantPixelBufferWriteVisitor : public boost::static_visitor<>
807  {
809  std::basic_ostream<charT,traits>& stream;
810 
816  VariantPixelBufferWriteVisitor(std::basic_ostream<charT,traits>& stream):
817  stream(stream)
818  {}
819 
825  template <typename T>
826  void
827  operator() (const T& v) const
828  {
829  if (!v)
830  throw std::runtime_error("Null pixel type");
831  v->write(stream);
832  }
833  };
834 
836  struct CopySubchannelVisitor : public boost::static_visitor<>
837  {
842 
850  dimension_size_type subC):
851  dest(dest),
852  subC(subC)
853  {}
854 
860  template<typename T>
861  void
862  operator()(const T& v)
863  {
864  // Shape is the same as the source buffer, but with one subchannel.
865  std::array<VariantPixelBuffer::size_type, 9> dest_shape;
866  const VariantPixelBuffer::size_type *shape_ptr(v->shape());
867  std::copy(shape_ptr, shape_ptr + PixelBufferBase::dimensions,
868  dest_shape.begin());
869  dest_shape[DIM_SUBCHANNEL] = 1;
870 
871  // Default to planar ordering; since openByes/saveBytes
872  // don't use ZTC the DimensionOrder doesn't matter here so
873  // long as it matches what the TIFF reader/writer uses.
875 
878  dest.setBuffer(dest_shape, v->pixelType(), order);
879 
880  T& destbuf = boost::get<T>(dest.vbuffer());
881 
882  typename boost::multi_array_types::index_gen indices;
883  typedef boost::multi_array_types::index_range range;
884  destbuf->array() = v->array()[boost::indices[range()][range()][range()][range()][range()][range(subC,subC+1)][range()][range()][range()]];
885  }
886  };
887 
889  struct MergeSubchannelVisitor : public boost::static_visitor<>
890  {
895 
903  dimension_size_type subC):
904  dest(dest),
905  subC(subC)
906  {}
907 
913  template<typename T>
914  void
915  operator()(const T& v)
916  {
917  T& destbuf = boost::get<T>(dest.vbuffer());
918 
919  typename boost::multi_array_types::index_gen indices;
920  typedef boost::multi_array_types::index_range range;
921  destbuf->array()[boost::indices[range()][range()][range()][range()][range()][range(subC,subC+1)][range()][range()][range()]] = v->array();
922  }
923  };
924 
925  }
926 
928  template<typename T>
929  inline typename PixelBuffer<T>::array_ref_type&
931  {
933  return boost::apply_visitor(v, buffer)->array();
934  }
935 
937  template<typename T>
938  inline const typename PixelBuffer<T>::array_ref_type&
940  {
942  return boost::apply_visitor(v, buffer)->array();
943  }
944 
945  template<typename T>
946  inline T *
948  {
950  return boost::apply_visitor(v, buffer)->data();
951  }
952 
953  template<typename T>
954  inline const T *
956  {
958  return boost::apply_visitor(v, buffer)->data();
959  }
960 
961  template<typename T>
962  inline const T *
964  {
966  return boost::apply_visitor(v, buffer)->origin();
967  }
968 
976  template <typename InputIterator>
977  inline void
978  VariantPixelBuffer::assign(InputIterator begin,
979  InputIterator end)
980  {
982  boost::apply_visitor(v, buffer);
983  }
984 
985  template<class charT, class traits>
986  inline void
987  VariantPixelBuffer::read(std::basic_istream<charT,traits>& stream)
988  {
990  boost::apply_visitor(v, buffer);
991  }
992 
993  template<class charT, class traits>
994  inline void
995  VariantPixelBuffer::write(std::basic_ostream<charT,traits>& stream) const
996  {
998  boost::apply_visitor(v, buffer);
999  }
1000 
1001  }
1002 }
1003 
1004 namespace std
1005 {
1006 
1014  template<class charT, class traits>
1015  inline std::basic_istream<charT,traits>&
1016  operator>> (std::basic_istream<charT,traits>& is,
1018  {
1019  buf.read(is);
1020  return is;
1021  }
1022 
1030  template<class charT, class traits>
1031  inline std::basic_ostream<charT,traits>&
1032  operator<< (std::basic_ostream<charT,traits>& os,
1033  const ::ome::files::VariantPixelBuffer& buf)
1034  {
1035  buf.write(os);
1036  return os;
1037  }
1038 
1039 }
1040 
1041 #endif // OME_FILES_VARIANTPIXELBUFFER_H
1042 
1043 /*
1044  * Local Variables:
1045  * mode:C++
1046  * End:
1047  */
VariantPixelBufferWriteVisitor(std::basic_ostream< charT, traits > &stream)
Constructor.
Definition: VariantPixelBuffer.h:816
boost::mpl::joint_view< integer_pixel_types, float_pixel_types >::type basic_pixel_types_view
Aggregate view of all numeric types.
Definition: VariantPixelBuffer.h:114
boost::multi_array_ref< value_type, dimensions > array_ref_type
Type for multi-dimensional pixel array view referencing external data.
Definition: PixelBuffer.h:246
VariantPixelBuffer & dest
Destination pixel buffer.
Definition: VariantPixelBuffer.h:892
void read(std::basic_istream< charT, traits > &stream)
Read raw pixel data from a stream in physical storage order.
Definition: VariantPixelBuffer.h:987
VariantPixelBuffer(const ExtentList &extents, ::ome::xml::model::enums::PixelType pixeltype=::ome::xml::model::enums::PixelType::UINT8, const storage_order_type &storage=PixelBufferBase::default_storage_order())
Construct from extents (internal storage).
Definition: VariantPixelBuffer.h:178
Properties of BIT pixels.
Definition: PixelProperties.h:299
InputIterator end
Input end.
Definition: VariantPixelBuffer.h:734
Buffer for a specific pixel type.
Definition: PixelBuffer.h:235
void setBuffer(const range_type &range, ::ome::xml::model::enums::PixelType pixeltype=::ome::xml::model::enums::PixelType::UINT8, const storage_order_type &storage=PixelBufferBase::default_storage_order())
Set the buffer from ranges (internal storage).
Definition: VariantPixelBuffer.h:404
boost::mpl::vector empty_types
Empty vector placeholder.
Definition: VariantPixelBuffer.h:128
std::size_t dimension_size_type
Size type for image dimensions.
Definition: Types.h:58
const storage_order_type & storage_order() const
Get the array storage order.
Definition: VariantPixelBuffer.cpp:375
static variant_buffer_type makeBuffer(const range_type &range, const storage_order_type &storage, ::ome::xml::model::enums::PixelType pixeltype)
Create buffer from ranges (helper).
Definition: VariantPixelBuffer.h:287
virtual ~VariantPixelBuffer()
Destructor.
Definition: VariantPixelBuffer.h:228
InputIterator begin
Input start.
Definition: VariantPixelBuffer.h:732
EndianType endianType() const
Get the endianness of the pixel type stored in the buffer.
Definition: VariantPixelBuffer.cpp:389
VariantPixelBufferReadVisitor(std::basic_istream< charT, traits > &stream)
Constructor.
Definition: VariantPixelBuffer.h:785
STL namespace.
void setBuffer(const ExtentList &extents, ::ome::xml::model::enums::PixelType pixeltype=::ome::xml::model::enums::PixelType::UINT8, const storage_order_type &storage=PixelBufferBase::default_storage_order())
Set the buffer from extents (helper).
Definition: VariantPixelBuffer.h:386
Map a given PixelPropertiesType enum to the corresponding language types.
Definition: PixelProperties.h:60
PixelBuffer< T >::array_ref_type & array()
Get the pixel data.
Definition: VariantPixelBuffer.h:930
bool valid() const
Check the buffer validity.
Definition: VariantPixelBuffer.cpp:326
variant_buffer_type & vbuffer()
Get a reference to the variant buffer.
Definition: VariantPixelBuffer.h:237
VariantPixelBuffer & dest
Destination pixel buffer.
Definition: VariantPixelBuffer.h:839
const T * origin() const
Get the origin of the array.
Definition: VariantPixelBuffer.h:963
std::basic_ostream< charT, traits > & stream
The output stream.
Definition: VariantPixelBuffer.h:809
Properties of COMPLEXFLOAT pixels.
Definition: PixelProperties.h:334
VariantPixelBuffer()
Default constructor.
Definition: VariantPixelBuffer.h:161
dimension_size_type subC
Subchannel to copy.
Definition: VariantPixelBuffer.h:841
::ome::xml::model::enums::PixelType pixelType() const
Get the type of pixels stored in the buffer.
Definition: VariantPixelBuffer.cpp:382
boost::mpl::vector< PixelProperties<::ome::xml::model::enums::PixelType::INT8 >, PixelProperties<::ome::xml::model::enums::PixelType::INT16 >, PixelProperties<::ome::xml::model::enums::PixelType::INT32 >, PixelProperties<::ome::xml::model::enums::PixelType::UINT8 >, PixelProperties<::ome::xml::model::enums::PixelType::UINT16 >, PixelProperties<::ome::xml::model::enums::PixelType::UINT32 >, PixelProperties<::ome::xml::model::enums::PixelType::BIT > > integer_pixel_types
Integer pixel types.
Definition: VariantPixelBuffer.h:104
boost::mpl::transform_view< basic_pixel_types_view, make_buffer< boost::mpl::_1 > >::type pixel_buffer_types_view
Aggregate view of all buffer types.
Definition: VariantPixelBuffer.h:125
Properties of UINT16 pixels.
Definition: PixelProperties.h:207
Convert T into a buffer.
Definition: VariantPixelBuffer.h:118
dimension_size_type subC
Subchannel to copy.
Definition: VariantPixelBuffer.h:894
Properties of INT32 pixels.
Definition: PixelProperties.h:161
VariantPixelBuffer & operator=(const VariantPixelBuffer &rhs)
Assign a pixel buffer.
Definition: VariantPixelBuffer.cpp:410
Open Microscopy Environment C++.
Copy a single subchannel from a PixelBuffer.
Definition: VariantPixelBuffer.h:836
const variant_buffer_type & vbuffer() const
Get a reference to the variant buffer.
Definition: VariantPixelBuffer.h:248
boost::general_storage_order< dimensions > storage_order_type
Storage ordering type for controlling pixel memory layout.
Definition: PixelBuffer.h:120
Native endian.
Definition: Types.h:71
static storage_order_type make_storage_order(ome::xml::model::enums::DimensionOrder order, bool interleaved)
Generate storage ordering for a given dimension order.
Definition: PixelBuffer.cpp:54
MergeSubchannelVisitor(VariantPixelBuffer &dest, dimension_size_type subC)
Constructor.
Definition: VariantPixelBuffer.h:902
void operator()(const T &v)
Copy subchannel.
Definition: VariantPixelBuffer.h:862
static variant_buffer_type createBuffer(const range_type &range, ::ome::xml::model::enums::PixelType pixeltype=::ome::xml::model::enums::PixelType::UINT8, const storage_order_type &storage=PixelBufferBase::default_storage_order())
Create buffer from ranges (helper).
Definition: VariantPixelBuffer.h:353
boost::mpl::insert_range< empty_types, boost::mpl::end< empty_types >::type, pixel_buffer_types_view >::type pixel_buffer_types
List of all pixel buffer types.
Definition: VariantPixelBuffer.h:131
Read data into a PixelBuffer.
Definition: VariantPixelBuffer.h:775
Merge a single subchannel into a PixelBuffer.
Definition: VariantPixelBuffer.h:889
VariantPixelBuffer(std::shared_ptr< PixelBuffer< T >> &buffer)
Construct from existing pixel buffer.
Definition: VariantPixelBuffer.h:221
EndianType
Endianness.
Definition: Types.h:67
PixelProperties<::ome::xml::model::enums::PixelType::UINT8 >::std_type raw_type
Raw pixel type used in public interfaces.
Definition: VariantPixelBuffer.h:138
Properties of INT16 pixels.
Definition: PixelProperties.h:138
CopySubchannelVisitor(VariantPixelBuffer &dest, dimension_size_type subC)
Constructor.
Definition: VariantPixelBuffer.h:849
bool operator!=(const VariantPixelBuffer &rhs) const
Compare a pixel buffer for inequality.
Definition: VariantPixelBuffer.cpp:423
Find a PixelBuffer data array of a specific pixel type.
Definition: VariantPixelBuffer.h:696
VariantPixelBufferAssignVisitor(InputIterator begin, InputIterator end)
Constructor.
Definition: VariantPixelBuffer.h:742
boost::mpl::vector< PixelProperties<::ome::xml::model::enums::PixelType::FLOAT >, PixelProperties<::ome::xml::model::enums::PixelType::DOUBLE >, PixelProperties<::ome::xml::model::enums::PixelType::COMPLEXFLOAT >, PixelProperties<::ome::xml::model::enums::PixelType::COMPLEXDOUBLE > > float_pixel_types
Floating-point pixel types.
Definition: VariantPixelBuffer.h:110
size_type num_dimensions() const
Get the number of dimensions in the multi-dimensional array.
Definition: VariantPixelBuffer.cpp:347
bool managed() const
Check if the buffer is internally managed.
Definition: VariantPixelBuffer.cpp:333
void operator()(const T &v)
Merge subchannel.
Definition: VariantPixelBuffer.h:915
Assign a PixelBuffer from an input iterator.
Definition: VariantPixelBuffer.h:729
void write(std::basic_ostream< charT, traits > &stream) const
Write raw pixel data to a stream in physical storage order.
Definition: VariantPixelBuffer.h:995
variant_buffer_type buffer
Pixel storage.
Definition: VariantPixelBuffer.h:655
Write data from a PixelBuffer.
Definition: VariantPixelBuffer.h:806
std::basic_istream< charT, traits > & stream
The input stream.
Definition: VariantPixelBuffer.h:778
VariantPixelBuffer(const range_type &range, ::ome::xml::model::enums::PixelType pixeltype=::ome::xml::model::enums::PixelType::UINT8, const storage_order_type &storage=PixelBufferBase::default_storage_order())
Construct from ranges (internal storage).
Definition: VariantPixelBuffer.h:196
Properties of UINT32 pixels.
Definition: PixelProperties.h:230
boost::detail::multi_array::extent_gen< dimensions > range_type
Extent range type.
Definition: PixelBuffer.h:123
static variant_buffer_type createBuffer(const ExtentList &extents, ::ome::xml::model::enums::PixelType pixeltype=::ome::xml::model::enums::PixelType::UINT8, const storage_order_type &storage=PixelBufferBase::default_storage_order())
Create buffer from extents (internal storage).
Definition: VariantPixelBuffer.h:320
const boost::multi_array_types::index * index_bases() const
Get the index bases of the multi-dimensional array.
Definition: VariantPixelBuffer.cpp:368
Find a PixelBuffer data array of a specific pixel type.
Definition: VariantPixelBuffer.h:663
PixelBufferBase::range_type range_type
Extent range type.
Definition: VariantPixelBuffer.h:150
static const uint16_t dimensions
Total number of supported dimensions.
Definition: PixelBuffer.h:107
const size_type * shape() const
Get the shape of the multi-dimensional array.
Definition: VariantPixelBuffer.cpp:354
bool operator==(const VariantPixelBuffer &rhs) const
Compare a pixel buffer for equality.
Definition: VariantPixelBuffer.cpp:417
size_type num_elements() const
Get the number of pixel elements in the multi-dimensional array.
Definition: VariantPixelBuffer.cpp:340
const boost::multi_array_types::index * strides() const
Get the strides of the multi-dimensional array.
Definition: VariantPixelBuffer.cpp:361
Properties of UINT8 pixels.
Definition: PixelProperties.h:184
static variant_buffer_type makeBuffer(const ExtentList &extents, const storage_order_type &storage, ::ome::xml::model::enums::PixelType pixeltype)
Create buffer from extents (helper).
Definition: VariantPixelBuffer.h:267
static storage_order_type default_storage_order()
Generate default storage ordering.
Definition: PixelBuffer.cpp:133
raw_type * data()
Get raw buffered data.
Definition: VariantPixelBuffer.cpp:396
std::shared_ptr< PixelBuffer< typename T::std_type > > type
Buffer type.
Definition: VariantPixelBuffer.h:121
Buffer for all pixel types.
Definition: VariantPixelBuffer.h:78
Properties of DOUBLE pixels.
Definition: PixelProperties.h:276
boost::multi_array_types::size_type size_type
Size type.
Definition: VariantPixelBuffer.h:141
void assign(InputIterator begin, InputIterator end)
Assign pixel values.
Definition: VariantPixelBuffer.h:978
boost::make_variant_over< pixel_buffer_types >::type variant_buffer_type
Buffer type, allowing assignment of all buffer types.
Definition: VariantPixelBuffer.h:135
PixelBufferBase::storage_order_type storage_order_type
Storage ordering type for controlling pixel memory layout.
Definition: VariantPixelBuffer.h:147
std::array< boost::multi_array_types::index, PixelBufferBase::dimensions > indices_type
Type used to index all dimensions in public interfaces.
Definition: VariantPixelBuffer.h:144
Properties of COMPLEXDOUBLE pixels.
Definition: PixelProperties.h:357
Logical sub-channel (typically used for RGB channel sub-components) (S).
Definition: PixelBuffer.h:85