ome-files  0.1.1
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 <ome/files/PixelBuffer.h>
42 #include <ome/files/PixelProperties.h>
43 
44 #include <ome/common/variant.h>
45 
46 #include <ome/compat/memory.h>
47 
48 namespace ome
49 {
50  namespace files
51  {
52 
76  {
77  private:
78  /*
79  * The following series of typedefs may appear a little
80  * complicated, and perhaps unnecessary, but they do have a
81  * purpose. They exist to work around pre-C++11 compiler
82  * limitations (lack of variadic templates), primarily a limit
83  * to the maximum number of types which may be used with
84  * boost::variant. To exceed this limit (minimum guaranteed is
85  * 10), boost::mpl sequences are used to define the variant
86  * types. These also have length limits, so the type list is
87  * built up by defining separate type sequences, then
88  * concatenating them, and transforming them to provide list
89  * variants. Note that none of this is code per se; it's all
90  * compile-time template expansion which evaluates to a list of
91  * permitted types.
92  */
93 
95  typedef boost::mpl::vector<PixelProperties< ::ome::xml::model::enums::PixelType::INT8>,
102 
104  typedef boost::mpl::vector< PixelProperties< ::ome::xml::model::enums::PixelType::FLOAT>,
108 
110  typedef boost::mpl::joint_view<integer_pixel_types,
111  float_pixel_types>::type basic_pixel_types_view;
112 
114  template<typename T>
115  struct make_buffer
116  {
118  typedef ome::compat::shared_ptr<PixelBuffer<typename T::std_type> > type;
119  };
120 
122  typedef boost::mpl::transform_view<basic_pixel_types_view, make_buffer<boost::mpl::_1> >::type pixel_buffer_types_view;
123 
125  typedef boost::mpl::vector<> empty_types;
126 
128  typedef boost::mpl::insert_range<empty_types, boost::mpl::end<empty_types>::type, pixel_buffer_types_view>::type pixel_buffer_types;
129 
130  public:
132  typedef boost::make_variant_over<pixel_buffer_types>::type variant_buffer_type;
133 
136 
138  typedef boost::multi_array_types::size_type size_type;
139 
141  typedef ome::compat::array<boost::multi_array_types::index, PixelBufferBase::dimensions> indices_type;
142 
145 
148 
149  public:
157  explicit
159  buffer(createBuffer(boost::extents[1][1][1][1][1][1][1][1][1]))
160  {
161  }
162 
173  template<class ExtentList>
174  explicit
175  VariantPixelBuffer(const ExtentList& extents,
177  const storage_order_type& storage = PixelBufferBase::default_storage_order()):
178  buffer(createBuffer(extents, pixeltype, storage))
179  {
180  }
181 
192  explicit
193  VariantPixelBuffer(const range_type& range,
195  const storage_order_type& storage = PixelBufferBase::default_storage_order()):
196  buffer(createBuffer(range, pixeltype, storage))
197  {
198  }
199 
208  explicit
210 
216  template<typename T>
217  explicit
218  VariantPixelBuffer(ome::compat::shared_ptr<PixelBuffer<T> >& buffer):
219  buffer(buffer)
220  {
221  }
222 
224  virtual
226  {}
227 
233  variant_buffer_type&
235  {
236  return buffer;
237  }
238 
244  const variant_buffer_type&
245  vbuffer() const
246  {
247  return buffer;
248  }
249 
250  protected:
262  template<class T, class ExtentList>
263  static variant_buffer_type
264  makeBuffer(const ExtentList& extents,
265  const storage_order_type& storage,
267  {
268  return variant_buffer_type(ome::compat::shared_ptr<PixelBuffer<T> >(new PixelBuffer<T>(extents, pixeltype, ENDIAN_NATIVE, storage)));
269  }
270 
282  template<class T>
283  static variant_buffer_type
284  makeBuffer(const range_type& range,
285  const storage_order_type& storage,
287  {
288  return variant_buffer_type(ome::compat::shared_ptr<PixelBuffer<T> >(new PixelBuffer<T>(range, pixeltype, ENDIAN_NATIVE, storage)));
289  }
290 
291  // No switch default to avoid -Wunreachable-code errors.
292  // However, this then makes -Wswitch-default complain. Disable
293  // temporarily.
294 #ifdef __GNUC__
295 # pragma GCC diagnostic push
296 # pragma GCC diagnostic ignored "-Wswitch-default"
297 #endif
298 
299 #define OME_FILES_VARIANTPIXELBUFFER_CREATEEXTENTS_CASE(maR, maProperty, maType) \
300  case ::ome::xml::model::enums::PixelType::maType: \
301  buf = makeBuffer<PixelProperties< ::ome::xml::model::enums::PixelType::maType>::std_type>(extents, storage, pixeltype); \
302  break;
303 
315  template<class ExtentList>
316  static variant_buffer_type
317  createBuffer(const ExtentList& extents,
319  const storage_order_type& storage = PixelBufferBase::default_storage_order())
320  {
321  variant_buffer_type buf;
322 
323  switch(pixeltype)
324  {
325  BOOST_PP_SEQ_FOR_EACH(OME_FILES_VARIANTPIXELBUFFER_CREATEEXTENTS_CASE, size, OME_XML_MODEL_ENUMS_PIXELTYPE_VALUES);
326  }
327 
328  return buf;
329  }
330 
331 #undef OME_FILES_VARIANTPIXELBUFFER_CREATEEXTENTS_CASE
332 
333 #define OME_FILES_VARIANTPIXELBUFFER_CREATERANGE_CASE(maR, maProperty, maType) \
334  case ::ome::xml::model::enums::PixelType::maType: \
335  buf = makeBuffer<PixelProperties< ::ome::xml::model::enums::PixelType::maType>::std_type>(range, storage, pixeltype); \
336  break;
337 
349  static variant_buffer_type
350  createBuffer(const range_type& range,
352  const storage_order_type& storage = PixelBufferBase::default_storage_order())
353  {
354  variant_buffer_type buf;
355 
356  switch(pixeltype)
357  {
358  BOOST_PP_SEQ_FOR_EACH(OME_FILES_VARIANTPIXELBUFFER_CREATERANGE_CASE, size, OME_XML_MODEL_ENUMS_PIXELTYPE_VALUES);
359  }
360 
361  return buf;
362  }
363 
364 #undef OME_FILES_VARIANTPIXELBUFFER_CREATERANGE_CASE
365 
366 #ifdef __GNUC__
367 # pragma GCC diagnostic pop
368 #endif
369 
370  public:
381  template<class ExtentList>
382  void
383  setBuffer(const ExtentList& extents,
385  const storage_order_type& storage = PixelBufferBase::default_storage_order())
386  {
387  buffer = createBuffer(extents, pixeltype, storage);
388  }
389 
400  void
401  setBuffer(const range_type& range,
403  const storage_order_type& storage = PixelBufferBase::default_storage_order())
404  {
405  buffer = createBuffer(range, pixeltype, storage);
406  }
407 
415  bool
416  managed() const;
417 
421  size_type
422  num_elements() const;
423 
427  size_type
428  num_dimensions() const;
429 
437  const size_type *
438  shape() const;
439 
447  const boost::multi_array_types::index *
448  strides() const;
449 
458  const boost::multi_array_types::index *
459  index_bases() const;
460 
471  template <typename T>
472  const T *
473  origin() const;
474 
480  const storage_order_type&
481  storage_order() const;
482 
487  pixelType() const;
488 
492  EndianType
493  endianType() const;
494 
503  template<typename T>
505  array();
506 
515  template<typename T>
516  const typename PixelBuffer<T>::array_ref_type&
517  array() const;
518 
524  raw_type *
525  data();
526 
532  const raw_type *
533  data() const;
534 
542  template<typename T>
543  T *
544  data();
545 
553  template<typename T>
554  const T *
555  data() const;
556 
567  bool
568  valid() const;
569 
581  operator = (const VariantPixelBuffer& rhs);
582 
589  bool
590  operator == (const VariantPixelBuffer& rhs) const;
591 
598  bool
599  operator != (const VariantPixelBuffer& rhs) const;
600 
609  template <typename InputIterator>
610  void
611  assign(InputIterator begin,
612  InputIterator end);
613 
624  template<class charT, class traits>
625  inline void
626  read(std::basic_istream<charT,traits>& stream);
627 
638  template<class charT, class traits>
639  inline void
640  write(std::basic_ostream<charT,traits>& stream) const;
641 
642  protected:
644  variant_buffer_type buffer;
645  };
646 
647  namespace detail
648  {
649 
651  template<typename T>
652  struct VariantPixelBufferVisitor : public boost::static_visitor<PixelBuffer<T>&>
653  {
662  operator() (ome::compat::shared_ptr<PixelBuffer<T> >& v) const
663  {
664  if (!v)
665  throw std::runtime_error("Null pixel type");
666  return *v;
667  }
668 
675  template <typename U>
677  operator() (U& /* v */) const
678  {
679  throw std::runtime_error("Unsupported pixel type conversion for buffer");
680  }
681  };
682 
684  template<typename T>
685  struct VariantPixelBufferConstVisitor : public boost::static_visitor<const PixelBuffer<T>&>
686  {
694  const PixelBuffer<T>&
695  operator() (const ome::compat::shared_ptr<PixelBuffer<T> >& v) const
696  {
697  if (!v)
698  throw std::runtime_error("Null pixel type");
699  return *v;
700  }
701 
708  template <typename U>
709  const PixelBuffer<T>&
710  operator() (U& /* v */) const
711  {
712  throw std::runtime_error("Unsupported pixel type conversion for buffer");
713  }
714  };
715 
717  template <typename InputIterator>
718  struct VariantPixelBufferAssignVisitor : public boost::static_visitor<>
719  {
721  InputIterator begin;
723  InputIterator end;
724 
731  VariantPixelBufferAssignVisitor(InputIterator begin, InputIterator end):
732  begin(begin), end(end)
733  {}
734 
741  void
742  operator() (ome::compat::shared_ptr<PixelBuffer<typename std::iterator_traits<InputIterator>::value_type> >& v) const
743  {
744  if (!v)
745  throw std::runtime_error("Null pixel type");
746  v->array().assign(begin, end);
747  }
748 
754  template <typename T>
755  void
756  operator() (T& /* v */) const
757  {
758  throw std::runtime_error("Unsupported pixel type conversion for assignment");
759  }
760  };
761 
763  template<class charT, class traits>
764  struct VariantPixelBufferReadVisitor : public boost::static_visitor<>
765  {
767  std::basic_istream<charT,traits>& stream;
768 
774  VariantPixelBufferReadVisitor(std::basic_istream<charT,traits>& stream):
775  stream(stream)
776  {}
777 
783  template <typename T>
784  void
785  operator() (T& v) const
786  {
787  if (!v)
788  throw std::runtime_error("Null pixel type");
789  v->read(stream);
790  }
791  };
792 
794  template<class charT, class traits>
795  struct VariantPixelBufferWriteVisitor : public boost::static_visitor<>
796  {
798  std::basic_ostream<charT,traits>& stream;
799 
805  VariantPixelBufferWriteVisitor(std::basic_ostream<charT,traits>& stream):
806  stream(stream)
807  {}
808 
814  template <typename T>
815  void
816  operator() (const T& v) const
817  {
818  if (!v)
819  throw std::runtime_error("Null pixel type");
820  v->write(stream);
821  }
822  };
823 
825  struct CopySubchannelVisitor : public boost::static_visitor<>
826  {
831 
839  dimension_size_type subC):
840  dest(dest),
841  subC(subC)
842  {}
843 
849  template<typename T>
850  void
851  operator()(const T& v)
852  {
853  // Shape is the same as the source buffer, but with one subchannel.
854  ome::compat::array<VariantPixelBuffer::size_type, 9> dest_shape;
855  const VariantPixelBuffer::size_type *shape_ptr(v->shape());
856  std::copy(shape_ptr, shape_ptr + PixelBufferBase::dimensions,
857  dest_shape.begin());
858  dest_shape[DIM_SUBCHANNEL] = 1;
859 
860  // Default to planar ordering; since openByes/saveBytes
861  // don't use ZTC the DimensionOrder doesn't matter here so
862  // long as it matches what the TIFF reader/writer uses.
864 
867  dest.setBuffer(dest_shape, v->pixelType(), order);
868 
869  T& destbuf = boost::get<T>(dest.vbuffer());
870 
871  typename boost::multi_array_types::index_gen indices;
872  typedef boost::multi_array_types::index_range range;
873  destbuf->array() = v->array()[boost::indices[range()][range()][range()][range()][range()][range(subC,subC+1)][range()][range()][range()]];
874  }
875  };
876 
878  struct MergeSubchannelVisitor : public boost::static_visitor<>
879  {
884 
892  dimension_size_type subC):
893  dest(dest),
894  subC(subC)
895  {}
896 
902  template<typename T>
903  void
904  operator()(const T& v)
905  {
906  T& destbuf = boost::get<T>(dest.vbuffer());
907 
908  typename boost::multi_array_types::index_gen indices;
909  typedef boost::multi_array_types::index_range range;
910  destbuf->array()[boost::indices[range()][range()][range()][range()][range()][range(subC,subC+1)][range()][range()][range()]] = v->array();
911  }
912  };
913 
914  }
915 
917  template<typename T>
918  inline typename PixelBuffer<T>::array_ref_type&
920  {
922  return boost::apply_visitor(v, buffer).array();
923  }
924 
926  template<typename T>
927  inline const typename PixelBuffer<T>::array_ref_type&
929  {
931  return boost::apply_visitor(v, buffer).array();
932  }
933 
934  template<typename T>
935  inline T *
937  {
939  return boost::apply_visitor(v, buffer).data();
940  }
941 
942  template<typename T>
943  inline const T *
945  {
947  return boost::apply_visitor(v, buffer).data();
948  }
949 
950  template<typename T>
951  inline const T *
953  {
955  return boost::apply_visitor(v, buffer).origin();
956  }
957 
965  template <typename InputIterator>
966  inline void
967  VariantPixelBuffer::assign(InputIterator begin,
968  InputIterator end)
969  {
971  boost::apply_visitor(v, buffer);
972  }
973 
974  template<class charT, class traits>
975  inline void
976  VariantPixelBuffer::read(std::basic_istream<charT,traits>& stream)
977  {
979  boost::apply_visitor(v, buffer);
980  }
981 
982  template<class charT, class traits>
983  inline void
984  VariantPixelBuffer::write(std::basic_ostream<charT,traits>& stream) const
985  {
987  boost::apply_visitor(v, buffer);
988  }
989 
990  }
991 }
992 
993 namespace std
994 {
995 
1003  template<class charT, class traits>
1004  inline std::basic_istream<charT,traits>&
1005  operator>> (std::basic_istream<charT,traits>& is,
1007  {
1008  buf.read(is);
1009  return is;
1010  }
1011 
1019  template<class charT, class traits>
1020  inline std::basic_ostream<charT,traits>&
1021  operator<< (std::basic_ostream<charT,traits>& os,
1022  const ::ome::files::VariantPixelBuffer& buf)
1023  {
1024  buf.write(os);
1025  return os;
1026  }
1027 
1028 }
1029 
1030 #endif // OME_FILES_VARIANTPIXELBUFFER_H
1031 
1032 /*
1033  * Local Variables:
1034  * mode:C++
1035  * End:
1036  */
VariantPixelBufferWriteVisitor(std::basic_ostream< charT, traits > &stream)
Constructor.
Definition: VariantPixelBuffer.h:805
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:350
boost::mpl::joint_view< integer_pixel_types, float_pixel_types >::type basic_pixel_types_view
Aggregate view of all numeric types.
Definition: VariantPixelBuffer.h:111
boost::multi_array_ref< value_type, dimensions > array_ref_type
Type for multi-dimensional pixel array view referencing external data.
Definition: PixelBuffer.h:247
VariantPixelBuffer & dest
Destination pixel buffer.
Definition: VariantPixelBuffer.h:881
const boost::multi_array_types::index * index_bases() const
Get the index bases of the multi-dimensional array.
Definition: VariantPixelBuffer.cpp:368
void read(std::basic_istream< charT, traits > &stream)
Read raw pixel data from a stream in physical storage order.
Definition: VariantPixelBuffer.h:976
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:401
InputIterator end
Input end.
Definition: VariantPixelBuffer.h:723
Buffer for a specific pixel type.
Definition: PixelBuffer.h:236
bool operator!=(const VariantPixelBuffer &rhs) const
Compare a pixel buffer for inequality.
Definition: VariantPixelBuffer.cpp:423
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:101
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:175
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:264
size_type num_dimensions() const
Get the number of dimensions in the multi-dimensional array.
Definition: VariantPixelBuffer.cpp:347
boost::mpl::vector empty_types
Empty vector placeholder.
Definition: VariantPixelBuffer.h:125
std::size_t dimension_size_type
Size type for image dimensions.
Definition: Types.h:59
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:383
virtual ~VariantPixelBuffer()
Destructor.
Definition: VariantPixelBuffer.h:225
InputIterator begin
Input start.
Definition: VariantPixelBuffer.h:721
VariantPixelBufferReadVisitor(std::basic_istream< charT, traits > &stream)
Constructor.
Definition: VariantPixelBuffer.h:774
STL namespace.
Properties of UINT16 pixels.
Definition: PixelProperties.h:208
Map a given PixelPropertiesType enum to the corresponding language types.
Definition: PixelProperties.h:61
Properties of COMPLEX pixels.
Definition: PixelProperties.h:335
Properties of UINT32 pixels.
Definition: PixelProperties.h:231
PixelBuffer< T >::array_ref_type & array()
Get the pixel data.
Definition: VariantPixelBuffer.h:919
const boost::multi_array_types::index * strides() const
Get the strides of the multi-dimensional array.
Definition: VariantPixelBuffer.cpp:361
variant_buffer_type & vbuffer()
Get a reference to the variant buffer.
Definition: VariantPixelBuffer.h:234
VariantPixelBuffer & dest
Destination pixel buffer.
Definition: VariantPixelBuffer.h:828
const size_type * shape() const
Get the shape of the multi-dimensional array.
Definition: VariantPixelBuffer.cpp:354
PixelProperties< ::ome::xml::model::enums::PixelType::UINT8 >::std_type raw_type
Raw pixel type used in public interfaces.
Definition: VariantPixelBuffer.h:135
std::basic_ostream< charT, traits > & stream
The output stream.
Definition: VariantPixelBuffer.h:798
VariantPixelBuffer()
Default constructor.
Definition: VariantPixelBuffer.h:158
dimension_size_type subC
Subchannel to copy.
Definition: VariantPixelBuffer.h:830
Properties of INT32 pixels.
Definition: PixelProperties.h:162
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:122
Convert T into a buffer.
Definition: VariantPixelBuffer.h:115
ome::compat::shared_ptr< PixelBuffer< typename T::std_type > > type
Buffer type.
Definition: VariantPixelBuffer.h:118
Properties of DOUBLECOMPLEX pixels.
Definition: PixelProperties.h:358
dimension_size_type subC
Subchannel to copy.
Definition: VariantPixelBuffer.h:883
const T * origin() const
Get the origin of the array.
Definition: VariantPixelBuffer.h:952
VariantPixelBuffer & operator=(const VariantPixelBuffer &rhs)
Assign a pixel buffer.
Definition: VariantPixelBuffer.cpp:410
Copy a single subchannel from a PixelBuffer.
Definition: VariantPixelBuffer.h:825
Properties of UINT8 pixels.
Definition: PixelProperties.h:185
boost::general_storage_order< dimensions > storage_order_type
Storage ordering type for controlling pixel memory layout.
Definition: PixelBuffer.h:121
Native endian.
Definition: Types.h:72
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:891
void operator()(const T &v)
Copy subchannel.
Definition: VariantPixelBuffer.h:851
boost::mpl::vector< PixelProperties< ::ome::xml::model::enums::PixelType::FLOAT >, PixelProperties< ::ome::xml::model::enums::PixelType::DOUBLE >, PixelProperties< ::ome::xml::model::enums::PixelType::COMPLEX >, PixelProperties< ::ome::xml::model::enums::PixelType::DOUBLECOMPLEX > > float_pixel_types
Floating-point pixel types.
Definition: VariantPixelBuffer.h:107
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:128
Read data into a PixelBuffer.
Definition: VariantPixelBuffer.h:764
Merge a single subchannel into a PixelBuffer.
Definition: VariantPixelBuffer.h:878
bool valid() const
Check the buffer validity.
Definition: VariantPixelBuffer.cpp:326
size_type num_elements() const
Get the number of pixel elements in the multi-dimensional array.
Definition: VariantPixelBuffer.cpp:340
EndianType
Endianness.
Definition: Types.h:68
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:193
const variant_buffer_type & vbuffer() const
Get a reference to the variant buffer.
Definition: VariantPixelBuffer.h:245
Properties of DOUBLE pixels.
Definition: PixelProperties.h:277
CopySubchannelVisitor(VariantPixelBuffer &dest, dimension_size_type subC)
Constructor.
Definition: VariantPixelBuffer.h:838
Find a PixelBuffer data array of a specific pixel type.
Definition: VariantPixelBuffer.h:685
VariantPixelBufferAssignVisitor(InputIterator begin, InputIterator end)
Constructor.
Definition: VariantPixelBuffer.h:731
void write(std::basic_ostream< charT, traits > &stream) const
Write raw pixel data to a stream in physical storage order.
Definition: VariantPixelBuffer.h:984
void operator()(const T &v)
Merge subchannel.
Definition: VariantPixelBuffer.h:904
Assign a PixelBuffer from an input iterator.
Definition: VariantPixelBuffer.h:718
EndianType endianType() const
Get the endianness of the pixel type stored in the buffer.
Definition: VariantPixelBuffer.cpp:389
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:284
variant_buffer_type buffer
Pixel storage.
Definition: VariantPixelBuffer.h:644
Write data from a PixelBuffer.
Definition: VariantPixelBuffer.h:795
ome::compat::array< boost::multi_array_types::index, PixelBufferBase::dimensions > indices_type
Type used to index all dimensions in public interfaces.
Definition: VariantPixelBuffer.h:141
std::basic_istream< charT, traits > & stream
The input stream.
Definition: VariantPixelBuffer.h:767
boost::detail::multi_array::extent_gen< dimensions > range_type
Extent range type.
Definition: PixelBuffer.h:124
Find a PixelBuffer data array of a specific pixel type.
Definition: VariantPixelBuffer.h:652
PixelBufferBase::range_type range_type
Extent range type.
Definition: VariantPixelBuffer.h:147
static const uint16_t dimensions
Total number of supported dimensions.
Definition: PixelBuffer.h:108
bool operator==(const VariantPixelBuffer &rhs) const
Compare a pixel buffer for equality.
Definition: VariantPixelBuffer.cpp:417
Properties of BIT pixels.
Definition: PixelProperties.h:300
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:317
const storage_order_type & storage_order() const
Get the array storage order.
Definition: VariantPixelBuffer.cpp:375
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
Buffer for all pixel types.
Definition: VariantPixelBuffer.h:75
VariantPixelBuffer(ome::compat::shared_ptr< PixelBuffer< T > > &buffer)
Construct from existing pixel buffer.
Definition: VariantPixelBuffer.h:218
boost::multi_array_types::size_type size_type
Size type.
Definition: VariantPixelBuffer.h:138
bool managed() const
Check if the buffer is internally managed.
Definition: VariantPixelBuffer.cpp:333
void assign(InputIterator begin, InputIterator end)
Assign pixel values.
Definition: VariantPixelBuffer.h:967
boost::make_variant_over< pixel_buffer_types >::type variant_buffer_type
Buffer type, allowing assignment of all buffer types.
Definition: VariantPixelBuffer.h:132
PixelBufferBase::storage_order_type storage_order_type
Storage ordering type for controlling pixel memory layout.
Definition: VariantPixelBuffer.h:144
::ome::xml::model::enums::PixelType pixelType() const
Get the type of pixels stored in the buffer.
Definition: VariantPixelBuffer.cpp:382
Properties of INT16 pixels.
Definition: PixelProperties.h:139
Logical sub-channel (typically used for RGB channel sub-components) (S).
Definition: PixelBuffer.h:86