imagedata.h 2.94 KB
Newer Older
schultezub's avatar
schultezub committed
1
2
#ifndef IMAGEDATA_H__
#define IMAGEDATA_H__
schultezub's avatar
schultezub committed
3

4
5
#include "tgt/bounds.h"
#include "tgt/vector.h"
schultezub's avatar
schultezub committed
6
7
#include "core/datastructures/abstractdata.h"
#include "core/datastructures/imagemappinginformation.h"
schultezub's avatar
schultezub committed
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

namespace TUMVis {

    /**
     * Stores basic information about one (semantic) image of arbitrary dimension.
     * Different representations (e.g. local memory, OpenGL texture, OpenCL buffer) are
     * to be defined by inheritance.
     * 
     * \todo 
     */
    class ImageData : public AbstractData {
    public:
        ImageData(size_t dimensionality, const tgt::svec3& size);

        virtual ~ImageData();

        /**
         * Dimensionality of this image.
         * \return _dimensionality
         */
        size_t getDimensionality() const;

        /**
         * Size of this image (number of elements per dimension).
         * \return _size
         */
        const tgt::svec3& getSize() const;

36
37
38
39
40
41
        /**
         * Returns the number of elements (= tgt::hmul(getSize())).
         * \return  _numElements
         */
        size_t getNumElements() const;

schultezub's avatar
schultezub committed
42
43
44
45
46
47
48
        /**
         * Mapping information of this image
         * \return _mappingInformation
         */
        const ImageMappingInformation& getMappingInformation() const;

        /**
49
50
         * Returns the image extent in world coordinates.
         * \return  The image extent in world coordinates.
schultezub's avatar
schultezub committed
51
         */
52
        tgt::Bounds getWorldBounds() const;
schultezub's avatar
schultezub committed
53
54
55
56
57
58
59
60
61

        /**
         * Returns the subimage of this image given by \a llf and \a urb.
         * TODO: Check whether it is necessary to adjust image mapping!
         *
         * \param   llf     Lower-Left-Front coordinates of subimage
         * \param   urb     Upper-Right-Back coordinates of subimage
         * \return  An image containing the subimage of this with the given coordinates.
         */
schultezub's avatar
schultezub committed
62
        virtual ImageData* getSubImage(const tgt::svec3& llf, const tgt::svec3& urb) const = 0;
schultezub's avatar
schultezub committed
63

schultezub's avatar
schultezub committed
64
    protected:
65
66
67
68
69
70
71
72
73
        /**
         * Transforms a vector based position to the corresponding array index.
         * \note    Caution, this method might return wrong results for non-continuous storage.
         *          In this case you should provide an appropriate overload.
         * \param   position    Vector based image coordinates
         * \return  Array index when image is stored continuously.
         */
        size_t positionToIndex(const tgt::svec3& position) const;

schultezub's avatar
schultezub committed
74
75
        size_t _dimensionality;                         ///< Dimensionality of this image
        tgt::svec3 _size;                               ///< Size of this image (number of elements per dimension)
76
        size_t _numElements;                            ///< number of elements (= tgt::hmul(size))
schultezub's avatar
schultezub committed
77
78
79
80
81
82
83
        ImageMappingInformation _mappingInformation;    ///< Mapping information of this image

        static const std::string loggerCat_;
    };

}

schultezub's avatar
schultezub committed
84
#endif // IMAGEDATA_H__