38 #ifndef OME_BIOFORMATS_VARIANTPIXELBUFFER_H
39 #define OME_BIOFORMATS_VARIANTPIXELBUFFER_H
41 #include <ome/bioformats/PixelBuffer.h>
42 #include <ome/bioformats/PixelProperties.h>
95 typedef boost::mpl::vector<PixelProperties< ::ome::xml::model::enums::PixelType::INT8>,
104 typedef boost::mpl::vector< PixelProperties< ::ome::xml::model::enums::PixelType::FLOAT>,
118 typedef ome::compat::shared_ptr<PixelBuffer<typename T::std_type> >
type;
128 typedef boost::mpl::insert_range<empty_types, boost::mpl::end<empty_types>::type, pixel_buffer_types_view>::type
pixel_buffer_types;
141 typedef ome::compat::array<boost::multi_array_types::index, PixelBufferBase::dimensions>
indices_type;
173 template<
class ExtentList>
244 const variant_buffer_type&
262 template<
class T,
class ExtentList>
263 static variant_buffer_type
265 const storage_order_type& storage,
283 static variant_buffer_type
285 const storage_order_type& storage,
295 # pragma GCC diagnostic push
296 # pragma GCC diagnostic ignored "-Wswitch-default"
310 template<
class ExtentList>
311 static variant_buffer_type
316 variant_buffer_type buf;
320 case ::ome::xml::model::enums::PixelType::INT8:
321 buf = makeBuffer<PixelProperties< ::ome::xml::model::enums::PixelType::INT8>::std_type>(extents, storage, pixeltype);
323 case ::ome::xml::model::enums::PixelType::INT16:
324 buf = makeBuffer<PixelProperties< ::ome::xml::model::enums::PixelType::INT16>::std_type>(extents, storage, pixeltype);
326 case ::ome::xml::model::enums::PixelType::INT32:
327 buf = makeBuffer<PixelProperties< ::ome::xml::model::enums::PixelType::INT32>::std_type>(extents, storage, pixeltype);
329 case ::ome::xml::model::enums::PixelType::UINT8:
330 buf = makeBuffer<PixelProperties< ::ome::xml::model::enums::PixelType::UINT8>::std_type>(extents, storage, pixeltype);
332 case ::ome::xml::model::enums::PixelType::UINT16:
333 buf = makeBuffer<PixelProperties< ::ome::xml::model::enums::PixelType::UINT16>::std_type>(extents, storage, pixeltype);
335 case :: ome::xml::model::enums::PixelType::UINT32:
336 buf = makeBuffer<PixelProperties< ::ome::xml::model::enums::PixelType::UINT32>::std_type>(extents, storage, pixeltype);
338 case ::ome::xml::model::enums::PixelType::FLOAT:
339 buf = makeBuffer<PixelProperties< ::ome::xml::model::enums::PixelType::FLOAT>::std_type>(extents, storage, pixeltype);
341 case ::ome::xml::model::enums::PixelType::DOUBLE:
342 buf = makeBuffer<PixelProperties< ::ome::xml::model::enums::PixelType::DOUBLE>::std_type>(extents, storage, pixeltype);
344 case ::ome::xml::model::enums::PixelType::BIT:
345 buf = makeBuffer<PixelProperties< ::ome::xml::model::enums::PixelType::BIT>::std_type>(extents, storage, pixeltype);
347 case ::ome::xml::model::enums::PixelType::COMPLEX:
348 buf = makeBuffer<PixelProperties< ::ome::xml::model::enums::PixelType::COMPLEX>::std_type>(extents, storage, pixeltype);
350 case ::ome::xml::model::enums::PixelType::DOUBLECOMPLEX:
351 buf = makeBuffer<PixelProperties< ::ome::xml::model::enums::PixelType::DOUBLECOMPLEX>::std_type>(extents, storage, pixeltype);
369 static variant_buffer_type
374 variant_buffer_type buf;
378 case ::ome::xml::model::enums::PixelType::INT8:
379 buf = makeBuffer<PixelProperties< ::ome::xml::model::enums::PixelType::INT8>::std_type>(range, storage, pixeltype);
381 case ::ome::xml::model::enums::PixelType::INT16:
382 buf = makeBuffer<PixelProperties< ::ome::xml::model::enums::PixelType::INT16>::std_type>(range, storage, pixeltype);
384 case ::ome::xml::model::enums::PixelType::INT32:
385 buf = makeBuffer<PixelProperties< ::ome::xml::model::enums::PixelType::INT32>::std_type>(range, storage, pixeltype);
387 case ::ome::xml::model::enums::PixelType::UINT8:
388 buf = makeBuffer<PixelProperties< ::ome::xml::model::enums::PixelType::UINT8>::std_type>(range, storage, pixeltype);
390 case ::ome::xml::model::enums::PixelType::UINT16:
391 buf = makeBuffer<PixelProperties< ::ome::xml::model::enums::PixelType::UINT16>::std_type>(range, storage, pixeltype);
393 case :: ome::xml::model::enums::PixelType::UINT32:
394 buf = makeBuffer<PixelProperties< ::ome::xml::model::enums::PixelType::UINT32>::std_type>(range, storage, pixeltype);
396 case ::ome::xml::model::enums::PixelType::FLOAT:
397 buf = makeBuffer<PixelProperties< ::ome::xml::model::enums::PixelType::FLOAT>::std_type>(range, storage, pixeltype);
399 case ::ome::xml::model::enums::PixelType::DOUBLE:
400 buf = makeBuffer<PixelProperties< ::ome::xml::model::enums::PixelType::DOUBLE>::std_type>(range, storage, pixeltype);
402 case ::ome::xml::model::enums::PixelType::BIT:
403 buf = makeBuffer<PixelProperties< ::ome::xml::model::enums::PixelType::BIT>::std_type>(range, storage, pixeltype);
405 case ::ome::xml::model::enums::PixelType::COMPLEX:
406 buf = makeBuffer<PixelProperties< ::ome::xml::model::enums::PixelType::COMPLEX>::std_type>(range, storage, pixeltype);
408 case ::ome::xml::model::enums::PixelType::DOUBLECOMPLEX:
409 buf = makeBuffer<PixelProperties< ::ome::xml::model::enums::PixelType::DOUBLECOMPLEX>::std_type>(range, storage, pixeltype);
417 # pragma GCC diagnostic pop
431 template<
class ExtentList>
497 const boost::multi_array_types::index *
508 const boost::multi_array_types::index *
521 template <
typename T>
530 const storage_order_type&
659 template <
typename InputIterator>
661 assign(InputIterator begin,
674 template<
class charT,
class traits>
676 read(std::basic_istream<charT,traits>& stream);
688 template<
class charT,
class traits>
690 write(std::basic_ostream<charT,traits>& stream)
const;
715 throw std::runtime_error(
"Null pixel type");
725 template <
typename U>
729 throw std::runtime_error(
"Unsupported pixel type conversion for buffer");
748 throw std::runtime_error(
"Null pixel type");
758 template <
typename U>
762 throw std::runtime_error(
"Unsupported pixel type conversion for buffer");
767 template <
typename InputIterator>
782 begin(begin), end(end)
792 operator() (ome::compat::shared_ptr<
PixelBuffer<
typename std::iterator_traits<InputIterator>::value_type> >& v)
const
795 throw std::runtime_error(
"Null pixel type");
796 v->array().assign(begin, end);
804 template <
typename T>
808 throw std::runtime_error(
"Unsupported pixel type conversion for assignment");
813 template<
class charT,
class traits>
817 std::basic_istream<charT,traits>&
stream;
833 template <
typename T>
838 throw std::runtime_error(
"Null pixel type");
844 template<
class charT,
class traits>
848 std::basic_ostream<charT,traits>&
stream;
864 template <
typename T>
869 throw std::runtime_error(
"Null pixel type");
904 ome::compat::array<VariantPixelBuffer::size_type, 9> dest_shape;
917 dest.
setBuffer(dest_shape, v->pixelType(), order);
919 T& destbuf = boost::get<T>(dest.
vbuffer());
921 typename boost::multi_array_types::index_gen indices;
922 typedef boost::multi_array_types::index_range range;
923 destbuf->array() = v->array()[boost::indices[range()][range()][range()][range()][range()][range(subC,subC+1)][range()][range()][range()]];
956 T& destbuf = boost::get<T>(dest.
vbuffer());
958 typename boost::multi_array_types::index_gen indices;
959 typedef boost::multi_array_types::index_range range;
960 destbuf->array()[boost::indices[range()][range()][range()][range()][range()][range(subC,subC+1)][range()][range()][range()]] = v->array();
968 inline typename PixelBuffer<T>::array_ref_type&
972 return boost::apply_visitor(v,
buffer).array();
981 return boost::apply_visitor(v,
buffer).array();
989 return boost::apply_visitor(v,
buffer).data();
997 return boost::apply_visitor(v,
buffer).data();
1000 template<
typename T>
1005 return boost::apply_visitor(v,
buffer).origin();
1015 template <
typename InputIterator>
1021 boost::apply_visitor(v,
buffer);
1024 template<
class charT,
class traits>
1029 boost::apply_visitor(v,
buffer);
1032 template<
class charT,
class traits>
1037 boost::apply_visitor(v,
buffer);
1053 template<
class charT,
class traits>
1054 inline std::basic_istream<charT,traits>&
1055 operator>> (std::basic_istream<charT,traits>& is,
1069 template<
class charT,
class traits>
1070 inline std::basic_ostream<charT,traits>&
1071 operator<< (std::basic_ostream<charT,traits>& os,
1072 const ::ome::bioformats::VariantPixelBuffer& buf)
1080 #endif // OME_BIOFORMATS_VARIANTPIXELBUFFER_H
uint8
Definition: PixelType.h:82
Memory type substitution.
Variant type limit workaround.
Open Microscopy Environment C++ implementation.
Definition: CoreMetadata.cpp:40
XYZTC.
Definition: DimensionOrder.h:78
PixelType enumeration.
Definition: PixelType.h:69