38 #ifndef OME_FILES_PIXELBUFFER_H    39 #define OME_FILES_PIXELBUFFER_H    48 #define BOOST_DISABLE_ASSERTS 1    49 #include <boost/multi_array.hpp>    51 #include <ome/files/PixelProperties.h>    59 #include <ome/xml/model/enums/DimensionOrder.h>   114       typedef boost::multi_array_types::index 
index;
   117       typedef ome::compat::array<boost::multi_array_types::index,
   124       typedef boost::detail::multi_array::extent_gen<dimensions> 
range_type;
   136         pixeltype(pixeltype),
   137         endiantype(endiantype)
   179       static storage_order_type
   191       static storage_order_type
   253       typedef boost::multi_array<value_type, dimensions> 
array_type;
   263         multiarray(
ome::compat::shared_ptr<array_type>(new array_type(
boost::extents[1][1][1][1][1][1][1][1][1],
   278       template<
class ExtentList>
   285         multiarray(
ome::compat::shared_ptr<array_type>(new array_type(extents, storage)))
   302       template<
class ExtentList>
   305                   const ExtentList&                    extents,
   310         multiarray(
ome::compat::shared_ptr<array_ref_type>(new array_ref_type(pixeldata, extents, storage)))
   330         multiarray(
ome::compat::shared_ptr<array_type>(new array_type(range, storage)))
   354         multiarray(
ome::compat::shared_ptr<array_ref_type>(new array_ref_type(pixeldata, range, storage)))
   368         multiarray(buffer.multiarray)
   390       const array_ref_type&
   404         return array().data();
   418         return array().data();
   434         bool is_valid = 
true;
   440         catch (
const std::runtime_error&)
   458         return (boost::get<ome::compat::shared_ptr<array_type> >(&multiarray) != 0);
   467         return array().num_elements();
   476         return array().num_dimensions();
   489         return array().shape();
   499       const boost::multi_array_types::index *
   502         return array().strides();
   513       const boost::multi_array_types::index *
   516         return array().index_bases();
   532         return array().origin();
   543         return array().storage_order();
   559         array() = rhs.
array();
   574       operator = (
const array_ref_type& rhs)
   589         return array() == rhs.
array();
   599       operator == (
const array_ref_type& rhs)
 const   601         return array() == rhs;
   613         return array() != rhs.
array();
   623       operator != (
const array_ref_type& rhs)
 const   625         return array() != rhs;
   637         return array() < rhs.
array();
   647       operator < (
const array_ref_type& rhs)
 const   649         return array() < rhs;
   661         return array() <= rhs.
array();
   671       operator <= (
const array_ref_type& rhs)
 const   673         return array() <= rhs;
   685         return array() > rhs.
array();
   695       operator > (
const array_ref_type& rhs)
 const   697         return array() > rhs;
   709         return array() >= rhs.
array();
   719       operator >= (
const array_ref_type& rhs)
 const   721         return array() >= rhs;
   732       template <
typename InputIterator>
   737         array().assign(begin, end);
   753         return array()(indices);
   769         return array()(indices);
   782       template<
class charT, 
class traits>
   784       read(std::basic_istream<charT,traits>& stream)
   786         stream.read(reinterpret_cast<char *>(data()),
   787                     static_cast<std::streamsize>(num_elements() * 
sizeof(value_type)));
   800       template<
class charT, 
class traits>
   802       write(std::basic_ostream<charT,traits>& stream)
 const   804         stream.write(reinterpret_cast<const char *>(data()),
   805                      static_cast<std::streamsize>(num_elements() * 
sizeof(value_type)));
   824       boost::variant<ome::compat::shared_ptr<array_type>,
   841         template <
typename U>
   843         operator() (U& v)
 const   846             throw std::runtime_error(
"Null array type");
   861         template <
typename U>
   863         operator() (U& v)
 const   866             throw std::runtime_error(
"Null array type");
   878       return boost::apply_visitor(v, multiarray);
   886       return boost::apply_visitor(v, multiarray);
   902   template<
typename T, 
class charT, 
class traits>
   903   inline std::basic_istream<charT,traits>&
   904   operator>> (std::basic_istream<charT,traits>& is,
   918   template<
typename T, 
class charT, 
class traits>
   919   inline std::basic_ostream<charT,traits>&
   920   operator<< (std::basic_ostream<charT,traits>& os,
   921               const ::ome::files::PixelBuffer<T>& buf)
   929 #endif // OME_FILES_PIXELBUFFER_H 
EndianType endianType() const 
Get the endian type in use. 
Definition: PixelBuffer.h:162
boost::multi_array_ref< value_type, dimensions > array_ref_type
Type for multi-dimensional pixel array view referencing external data. 
Definition: PixelBuffer.h:247
boost::variant< ome::compat::shared_ptr< array_type >, ome::compat::shared_ptr< array_ref_type > > multiarray
Multi-dimensional pixel array. 
Definition: PixelBuffer.h:825
Buffer for a specific pixel type. 
Definition: PixelBuffer.h:236
void assign(InputIterator begin, InputIterator end)
Assign pixel values. 
Definition: PixelBuffer.h:734
size_type num_elements() const 
Get the number of pixel elements in the multi-dimensional array. 
Definition: PixelBuffer.h:465
virtual ~PixelBuffer()
Destructor. 
Definition: PixelBuffer.h:372
const size_type * shape() const 
Get the shape of the multi-dimensional array. 
Definition: PixelBuffer.h:487
Spatial y dimension (Y). 
Definition: PixelBuffer.h:82
value_type * data()
Get the raw data. 
Definition: PixelBuffer.h:402
const value_type * origin() const 
Get the origin of the array. 
Definition: PixelBuffer.h:530
bool valid() const 
Check the buffer validity. 
Definition: PixelBuffer.h:432
const boost::multi_array_types::index * index_bases() const 
Get the index bases of the multi-dimensional array. 
Definition: PixelBuffer.h:514
boost::multi_array_types::index index
Index type. 
Definition: PixelBuffer.h:114
void write(std::basic_ostream< charT, traits > &stream) const 
Write raw pixel data to a stream in physical storage order. 
Definition: PixelBuffer.h:802
Base class for all PixelBuffer types. 
Definition: PixelBuffer.h:104
Logical subdivision of the temporal t dimension (t). 
Definition: PixelBuffer.h:88
value_type & at(const indices_type &indices)
Get the pixel value at an index. 
Definition: PixelBuffer.h:751
PixelBufferBase(::ome::xml::model::enums::PixelType pixeltype, EndianType endiantype)
Constructor. 
Definition: PixelBuffer.h:134
PixelBuffer(value_type *pixeldata, const ExtentList &extents,::ome::xml::model::enums::PixelType pixeltype=::ome::xml::model::enums::PixelType::UINT8, EndianType endiantype=ENDIAN_NATIVE, const storage_order_type &storage=PixelBufferBase::default_storage_order())
Construct from extents (external storage). 
Definition: PixelBuffer.h:304
Logical subdivision of the logical channel dimension (c). 
Definition: PixelBuffer.h:89
ome::compat::array< boost::multi_array_types::index, PixelBufferBase::dimensions > indices_type
Type used to index all dimensions in public interfaces. 
Definition: PixelBuffer.h:118
::ome::xml::model::enums::PixelType pixelType() const 
Get the pixel type in use. 
Definition: PixelBuffer.h:151
Spatial x dimension (X). 
Definition: PixelBuffer.h:81
const storage_order_type & storage_order() const 
Get the array storage order. 
Definition: PixelBuffer.h:541
boost::general_storage_order< dimensions > storage_order_type
Storage ordering type for controlling pixel memory layout. 
Definition: PixelBuffer.h:121
PixelBuffer(value_type *pixeldata, const range_type &range,::ome::xml::model::enums::PixelType pixeltype=::ome::xml::model::enums::PixelType::UINT8, EndianType endiantype=ENDIAN_NATIVE, const storage_order_type &storage=PixelBufferBase::default_storage_order())
Construct from ranges (external storage). 
Definition: PixelBuffer.h:348
Native endian. 
Definition: Types.h:72
Find a PixelBuffer data array of a specific pixel type. 
Definition: PixelBuffer.h:833
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
size_type num_dimensions() const 
Get the number of dimensions in the multi-dimensional array. 
Definition: PixelBuffer.h:474
virtual ~PixelBufferBase()
Destructor. 
Definition: PixelBuffer.h:142
EndianType
Endianness. 
Definition: Types.h:68
const value_type & at(const indices_type &indices) const 
Get the pixel value at an index. 
Definition: PixelBuffer.h:767
void read(std::basic_istream< charT, traits > &stream)
Read raw pixel data from a stream in physical storage order. 
Definition: PixelBuffer.h:784
bool managed() const 
Check if the buffer is internally managed. 
Definition: PixelBuffer.h:456
PixelBuffer(const range_type &range,::ome::xml::model::enums::PixelType pixeltype=::ome::xml::model::enums::PixelType::UINT8, EndianType endiantype=ENDIAN_NATIVE, const storage_order_type &storage=PixelBufferBase::default_storage_order())
Construct from ranges (internal storage). 
Definition: PixelBuffer.h:325
Temporal t dimension (T). 
Definition: PixelBuffer.h:84
const boost::multi_array_types::index * strides() const 
Get the strides of the multi-dimensional array. 
Definition: PixelBuffer.h:500
Dimensions
Dimensions. 
Definition: PixelBuffer.h:79
Find a PixelBuffer data array of a specific pixel type. 
Definition: PixelBuffer.h:853
boost::detail::multi_array::extent_gen< dimensions > range_type
Extent range type. 
Definition: PixelBuffer.h:124
boost::multi_array_types::size_type size_type
Size type. 
Definition: PixelBuffer.h:111
PixelBuffer(const PixelBuffer &buffer)
Copy constructor. 
Definition: PixelBuffer.h:366
array_ref_type & array()
Get the pixel data. 
Definition: PixelBuffer.h:875
const ::ome::xml::model::enums::PixelType pixeltype
Pixel type stored in this buffer. 
Definition: PixelBuffer.h:196
static const uint16_t dimensions
Total number of supported dimensions. 
Definition: PixelBuffer.h:108
PixelBuffer()
Default constructor. 
Definition: PixelBuffer.h:261
Spatial z dimension (Z). 
Definition: PixelBuffer.h:83
boost::multi_array< value_type, dimensions > array_type
Type for multi-dimensional pixel array view. 
Definition: PixelBuffer.h:253
PixelBuffer(const ExtentList &extents,::ome::xml::model::enums::PixelType pixeltype=::ome::xml::model::enums::PixelType::UINT8, EndianType endiantype=ENDIAN_NATIVE, const storage_order_type &storage=PixelBufferBase::default_storage_order())
Construct from extents (internal storage). 
Definition: PixelBuffer.h:280
static storage_order_type default_storage_order()
Generate default storage ordering. 
Definition: PixelBuffer.cpp:133
const EndianType endiantype
Endian type stored in this buffer. 
Definition: PixelBuffer.h:199
Logical subdivision of the spatial z dimension (z). 
Definition: PixelBuffer.h:87
Logical channel (typically detectors of specific wavelengths) (C). 
Definition: PixelBuffer.h:85
T value_type
Pixel value type. 
Definition: PixelBuffer.h:240
const value_type * data() const 
Get the raw data. 
Definition: PixelBuffer.h:416
Logical sub-channel (typically used for RGB channel sub-components) (S). 
Definition: PixelBuffer.h:86