38 #ifndef OME_BIOFORMATS_VARIANTPIXELBUFFER_H
39 #define OME_BIOFORMATS_VARIANTPIXELBUFFER_H
41 #include <ome/bioformats/PixelBuffer.h>
92 typedef boost::mpl::vector<PixelProperties< ::ome::xml::model::enums::PixelType::INT8>,
101 typedef boost::mpl::vector< PixelProperties< ::ome::xml::model::enums::PixelType::FLOAT>,
115 typedef ome::compat::shared_ptr<PixelBuffer<typename T::std_type> >
type;
125 typedef boost::mpl::insert_range<empty_types, boost::mpl::end<empty_types>::type, pixel_buffer_types_view>::type
pixel_buffer_types;
138 typedef ome::compat::array<boost::multi_array_types::index, PixelBufferBase::dimensions>
indices_type;
170 template<
class ExtentList>
241 const variant_buffer_type&
259 template<
class T,
class ExtentList>
260 static variant_buffer_type
262 const storage_order_type& storage,
280 static variant_buffer_type
282 const storage_order_type& storage,
292 # pragma GCC diagnostic push
293 # pragma GCC diagnostic ignored "-Wswitch-default"
307 template<
class ExtentList>
308 static variant_buffer_type
313 variant_buffer_type buf;
317 case ::ome::xml::model::enums::PixelType::INT8:
318 buf = makeBuffer<PixelProperties< ::ome::xml::model::enums::PixelType::INT8>::std_type>(extents, storage, pixeltype);
320 case ::ome::xml::model::enums::PixelType::INT16:
321 buf = makeBuffer<PixelProperties< ::ome::xml::model::enums::PixelType::INT16>::std_type>(extents, storage, pixeltype);
323 case ::ome::xml::model::enums::PixelType::INT32:
324 buf = makeBuffer<PixelProperties< ::ome::xml::model::enums::PixelType::INT32>::std_type>(extents, storage, pixeltype);
326 case ::ome::xml::model::enums::PixelType::UINT8:
327 buf = makeBuffer<PixelProperties< ::ome::xml::model::enums::PixelType::UINT8>::std_type>(extents, storage, pixeltype);
329 case ::ome::xml::model::enums::PixelType::UINT16:
330 buf = makeBuffer<PixelProperties< ::ome::xml::model::enums::PixelType::UINT16>::std_type>(extents, storage, pixeltype);
332 case :: ome::xml::model::enums::PixelType::UINT32:
333 buf = makeBuffer<PixelProperties< ::ome::xml::model::enums::PixelType::UINT32>::std_type>(extents, storage, pixeltype);
335 case ::ome::xml::model::enums::PixelType::FLOAT:
336 buf = makeBuffer<PixelProperties< ::ome::xml::model::enums::PixelType::FLOAT>::std_type>(extents, storage, pixeltype);
338 case ::ome::xml::model::enums::PixelType::DOUBLE:
339 buf = makeBuffer<PixelProperties< ::ome::xml::model::enums::PixelType::DOUBLE>::std_type>(extents, storage, pixeltype);
341 case ::ome::xml::model::enums::PixelType::BIT:
342 buf = makeBuffer<PixelProperties< ::ome::xml::model::enums::PixelType::BIT>::std_type>(extents, storage, pixeltype);
344 case ::ome::xml::model::enums::PixelType::COMPLEX:
345 buf = makeBuffer<PixelProperties< ::ome::xml::model::enums::PixelType::COMPLEX>::std_type>(extents, storage, pixeltype);
347 case ::ome::xml::model::enums::PixelType::DOUBLECOMPLEX:
348 buf = makeBuffer<PixelProperties< ::ome::xml::model::enums::PixelType::DOUBLECOMPLEX>::std_type>(extents, storage, pixeltype);
366 static variant_buffer_type
371 variant_buffer_type buf;
375 case ::ome::xml::model::enums::PixelType::INT8:
376 buf = makeBuffer<PixelProperties< ::ome::xml::model::enums::PixelType::INT8>::std_type>(range, storage, pixeltype);
378 case ::ome::xml::model::enums::PixelType::INT16:
379 buf = makeBuffer<PixelProperties< ::ome::xml::model::enums::PixelType::INT16>::std_type>(range, storage, pixeltype);
381 case ::ome::xml::model::enums::PixelType::INT32:
382 buf = makeBuffer<PixelProperties< ::ome::xml::model::enums::PixelType::INT32>::std_type>(range, storage, pixeltype);
384 case ::ome::xml::model::enums::PixelType::UINT8:
385 buf = makeBuffer<PixelProperties< ::ome::xml::model::enums::PixelType::UINT8>::std_type>(range, storage, pixeltype);
387 case ::ome::xml::model::enums::PixelType::UINT16:
388 buf = makeBuffer<PixelProperties< ::ome::xml::model::enums::PixelType::UINT16>::std_type>(range, storage, pixeltype);
390 case :: ome::xml::model::enums::PixelType::UINT32:
391 buf = makeBuffer<PixelProperties< ::ome::xml::model::enums::PixelType::UINT32>::std_type>(range, storage, pixeltype);
393 case ::ome::xml::model::enums::PixelType::FLOAT:
394 buf = makeBuffer<PixelProperties< ::ome::xml::model::enums::PixelType::FLOAT>::std_type>(range, storage, pixeltype);
396 case ::ome::xml::model::enums::PixelType::DOUBLE:
397 buf = makeBuffer<PixelProperties< ::ome::xml::model::enums::PixelType::DOUBLE>::std_type>(range, storage, pixeltype);
399 case ::ome::xml::model::enums::PixelType::BIT:
400 buf = makeBuffer<PixelProperties< ::ome::xml::model::enums::PixelType::BIT>::std_type>(range, storage, pixeltype);
402 case ::ome::xml::model::enums::PixelType::COMPLEX:
403 buf = makeBuffer<PixelProperties< ::ome::xml::model::enums::PixelType::COMPLEX>::std_type>(range, storage, pixeltype);
405 case ::ome::xml::model::enums::PixelType::DOUBLECOMPLEX:
406 buf = makeBuffer<PixelProperties< ::ome::xml::model::enums::PixelType::DOUBLECOMPLEX>::std_type>(range, storage, pixeltype);
414 # pragma GCC diagnostic pop
428 template<
class ExtentList>
494 const boost::multi_array_types::index *
505 const boost::multi_array_types::index *
518 template <
typename T>
527 const storage_order_type&
656 template <
typename InputIterator>
658 assign(InputIterator begin,
671 template<
class charT,
class traits>
673 read(std::basic_istream<charT,traits>& stream);
685 template<
class charT,
class traits>
687 write(std::basic_ostream<charT,traits>& stream)
const;
712 throw std::runtime_error(
"Null pixel type");
722 template <
typename U>
726 throw std::runtime_error(
"Unsupported pixel type conversion for buffer");
745 throw std::runtime_error(
"Null pixel type");
755 template <
typename U>
759 throw std::runtime_error(
"Unsupported pixel type conversion for buffer");
764 template <
typename InputIterator>
779 begin(begin), end(end)
789 operator() (ome::compat::shared_ptr<
PixelBuffer<
typename std::iterator_traits<InputIterator>::value_type> >& v)
const
792 throw std::runtime_error(
"Null pixel type");
793 v->array().assign(begin, end);
801 template <
typename T>
805 throw std::runtime_error(
"Unsupported pixel type conversion for assignment");
810 template<
class charT,
class traits>
814 std::basic_istream<charT,traits>&
stream;
830 template <
typename T>
835 throw std::runtime_error(
"Null pixel type");
841 template<
class charT,
class traits>
845 std::basic_ostream<charT,traits>&
stream;
861 template <
typename T>
866 throw std::runtime_error(
"Null pixel type");
901 ome::compat::array<VariantPixelBuffer::size_type, 9> dest_shape;
914 dest.
setBuffer(dest_shape, v->pixelType(), order);
916 T& destbuf = boost::get<T>(dest.
vbuffer());
918 typename boost::multi_array_types::index_gen indices;
919 typedef boost::multi_array_types::index_range range;
920 destbuf->array() = v->array()[boost::indices[range()][range()][range()][range()][range()][range(subC,subC+1)][range()][range()][range()]];
953 T& destbuf = boost::get<T>(dest.
vbuffer());
955 typename boost::multi_array_types::index_gen indices;
956 typedef boost::multi_array_types::index_range range;
957 destbuf->array()[boost::indices[range()][range()][range()][range()][range()][range(subC,subC+1)][range()][range()][range()]] = v->array();
965 inline typename PixelBuffer<T>::array_ref_type&
969 return boost::apply_visitor(v,
buffer).array();
978 return boost::apply_visitor(v,
buffer).array();
986 return boost::apply_visitor(v,
buffer).data();
994 return boost::apply_visitor(v,
buffer).data();
1002 return boost::apply_visitor(v,
buffer).origin();
1012 template <
typename InputIterator>
1018 boost::apply_visitor(v,
buffer);
1021 template<
class charT,
class traits>
1026 boost::apply_visitor(v,
buffer);
1029 template<
class charT,
class traits>
1034 boost::apply_visitor(v,
buffer);
1050 template<
class charT,
class traits>
1051 inline std::basic_istream<charT,traits>&
1052 operator>> (std::basic_istream<charT,traits>& is,
1066 template<
class charT,
class traits>
1067 inline std::basic_ostream<charT,traits>&
1068 operator<< (std::basic_ostream<charT,traits>& os,
1069 const ::ome::bioformats::VariantPixelBuffer& buf)
1077 #endif // OME_BIOFORMATS_VARIANTPIXELBUFFER_H
uint8
Definition: PixelType.h:83
Variant type limit workaround.
Open Microscopy Environment C++ implementation.
Definition: CoreMetadata.cpp:40
XYZTC.
Definition: DimensionOrder.h:79
PixelType enumeration.
Definition: PixelType.h:70