schultezub committed Jul 07, 2012 1 2 ``````#ifndef IMAGEDATADISK_H__ #define IMAGEDATADISK_H__ `````` schultezub committed Jul 06, 2012 3 4 `````` #include "tgt/vector.h" `````` schultezub committed Jul 07, 2012 5 6 7 8 9 10 ``````#include "core/datastructures/imagedata.h" #include "core/tools/endianhelper.h" #include "core/tools/typetraits.h" #include "core/tools/weaklytypedpointer.h" `````` schultezub committed Jul 06, 2012 11 12 13 14 15 16 17 18 ``````#include #include namespace TUMVis { /** * Subclass of ImageData offering access to image data stored in binary form on the local harddisk. * `````` schultezub committed Jul 10, 2012 19 `````` * \todo Number of channels `````` schultezub committed Jul 06, 2012 20 21 22 23 24 25 26 27 28 `````` */ class ImageDataDisk : public ImageData { public: /** * Creates a new ImageData disk representation. * * \param url Path to file with raw data * \param dimensionality Dimensionality of data * \param size Size of this image (number of elements per dimension) `````` schultezub committed Jul 07, 2012 29 `````` * \param type Base type of data `````` schultezub committed Aug 10, 2012 30 `````` * \param numChannels Number of channels per element `````` schultezub committed Jul 06, 2012 31 32 33 34 35 36 `````` * \param offset Offset of first data element in file (in bytes) * \param endianness Endianess of data * \param stride Number of _elemments_ _between_ adjacent elements for each dimension (\see ImageDataDisk::_stride). */ ImageDataDisk( const std::string& url, `````` schultezub committed Jul 11, 2012 37 `````` size_t dimensionality, `````` schultezub committed Jul 07, 2012 38 `````` const tgt::svec3& size, `````` schultezub committed Jul 11, 2012 39 40 `````` WeaklyTypedPointer::BaseType type, size_t numChannels, `````` schultezub committed Jul 06, 2012 41 42 `````` size_t offset = 0, EndianHelper::Endianness endianness = EndianHelper::LITTLE_ENDIAN, `````` schultezub committed Jul 07, 2012 43 `````` const tgt::svec3& stride = tgt::svec3::zero `````` schultezub committed Jul 06, 2012 44 45 46 47 48 `````` ); /** * Destructor */ `````` schultezub committed Jul 07, 2012 49 50 51 52 53 54 `````` virtual ~ImageDataDisk(); /** * \see AbstractData::clone() **/ `````` schultezub committed Jul 09, 2012 55 `````` virtual ImageDataDisk* clone() const; `````` schultezub committed Jul 06, 2012 56 57 58 59 `````` /** * \see ImageData::getSubImage */ `````` schultezub committed Jul 09, 2012 60 `````` virtual ImageDataDisk* getSubImage(const tgt::svec3& llf, const tgt::svec3& urb) const; `````` schultezub committed Jul 06, 2012 61 62 63 64 65 66 `````` /** * Downloads the whole image data to local memory. * \return Pointer to the image data in the local memory. */ `````` schultezub committed Jul 07, 2012 67 `````` WeaklyTypedPointer getImageData() const; `````` schultezub committed Jul 06, 2012 68 `````` `````` schultezub committed Jul 18, 2012 69 70 71 72 73 74 75 76 77 78 79 80 81 `````` /** * Returns the base type of the data * \return _type */ WeaklyTypedPointer::BaseType getBaseType() const; /** * Returns the number of channels per element * \return _numChannels */ size_t getNumChannels() const; `````` schultezub committed Jul 06, 2012 82 83 84 85 86 87 88 89 90 91 `````` private: /** * Calculates the canonical stride for the given image size. * \param size Image size (number of elements per dimension). * \return (0, size.x, size.x * size.y) */ tgt::svec3 getCanonicStride(const tgt::svec3& size) const; std::string _url; ///< path to file with raw data size_t _offset; ///< offset of first data element in file (in bytes) `````` schultezub committed Jul 11, 2012 92 93 `````` WeaklyTypedPointer::BaseType _type; ///< base type of data size_t _numChannels; ///< number of channels per element `````` schultezub committed Jul 06, 2012 94 95 96 97 98 99 100 101 102 `````` EndianHelper::Endianness _endianess; ///< endianess of data /** * Number of _elemments_ _between_ adjacent elements for each dimension. * If the stride is 0 for a dimension, the elements are assumed to be tightly packed, hence for * the x-dimension 0, for the y-dimension _size.x and for the z-dimension (_size.x * _size.y). **/ tgt::svec3 _stride; `````` schultezub committed Jul 09, 2012 103 `````` static const std::string loggerCat_; `````` schultezub committed Jul 06, 2012 104 105 106 107 `````` }; } `````` schultezub committed Jul 07, 2012 108 ``#endif // IMAGEDATADISK_H__``