imagedatalocal.h 4.08 KB
 schultezub committed Jul 13, 2012 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 #ifndef IMAGEDATALOCAL_H__ #define IMAGEDATALOCAL_H__ #include "tgt/vector.h" #include "core/datastructures/imagedata.h" #include "core/tools/endianhelper.h" #include "core/tools/weaklytypedpointer.h" #include #include #include namespace TUMVis { /** * Abstract base class for strongly typed (templated) ImageDataRAM * * \todo implement padding, add some kind of cool iterators */ class ImageDataLocal : public ImageData { public: /** * Creates a new ImageData representation in local memory. * * \param dimensionality Dimensionality of data * \param size Size of this image (number of elements per dimension) */ ImageDataLocal(size_t dimensionality, const tgt::svec3& size, WeaklyTypedPointer::BaseType baseType, size_t numChannels); /** * Destructor */ virtual ~ImageDataLocal(); /** * \see AbstractData::clone() **/ virtual ImageDataLocal* clone() const = 0; /** * \see ImageData::getSubImage */ virtual ImageDataLocal* getSubImage(const tgt::svec3& llf, const tgt::svec3& urb) const = 0; /** * Returns the WeaklyTypedPointer to the image data. * \return Pointer to the image data. */ virtual WeaklyTypedPointer& getImageData() = 0; /** * Returns the WeaklyTypedPointer to the image data. * \return Pointer to the image data. */ virtual const WeaklyTypedPointer& getImageData() const = 0; /** * Returns the normalized value of the element at the given position and channel. * - for \em unsigned integer types, the value range is mapped linearly to [0.0;1.0] * - for \em signed integer types, the value range is mapped linearly to [-1.0;1.0] * - floating point types are not mapped * * Simple algorithms on images might not always want to test for the actual base data type. * For them access to the normalized element values provided here might be enough. * * \note This method is virtual => slow! * \sa ImageDataLocal::setElementNormalized * \param position Element position within the image * \param channel Image channel * \return A normalized float representation of the element at the given position and channel. */ virtual float getElementNormalized(const tgt::svec3& position, size_t channel) const = 0; /** * Sets the element at the given position and channel denormalized from the given value \a value. * - for \em unsigned integer types, the value range is mapped linearly to [0.0;1.0] * - for \em signed integer types, the value range is mapped linearly to [-1.0;1.0] * - floating point types are not mapped * * Simple algorithms on images might not always want to test for the actual base data type. * For them access to the normalized element values provided here might be enough. * * \note This method is virtual => slow! * \sa ImageDataLocal::getElementNormalized * \param position Element position within the image * \param channel Image channel * \param value Normalized Value to set */ virtual void setElementNormalized(const tgt::svec3& position, size_t channel, float value) = 0; protected: WeaklyTypedPointer::BaseType _baseType; size_t _numChannels; static const std::string loggerCat_; private: // We don't want this data to be copied - clone() must be enough // (read: We are too lazy to implement a correct copy constructor / assignment-operator) ImageDataLocal(const ImageDataLocal& rhs); ImageDataLocal& operator=(const ImageDataLocal& rhs); }; } #endif // IMAGEDATALOCAL_H__