116 bool allocate(
const unsigned int a_width,
117 const unsigned int a_height,
118 const unsigned int a_slices,
119 const GLenum a_format = GL_RGB,
120 const GLenum a_type = GL_UNSIGNED_BYTE);
129 bool convert(
const unsigned int a_newFormat);
159 const unsigned char a_transparencyLevel);
163 const unsigned char a_g,
164 const unsigned char a_b,
181 virtual void getVoxelLocation(
const cVector3d& a_texCoord,
int& a_voxelX,
int& a_voxelY,
int& a_voxelZ,
bool a_clampToImageSize =
true)
const;
187 virtual unsigned char*
getVoxelData(
const unsigned int a_x,
188 const unsigned int a_y,
189 const unsigned int a_z)
const;
193 const unsigned int a_y,
194 const unsigned int a_z,
199 const unsigned int a_y,
200 const unsigned int a_z,
217 const unsigned int a_y,
218 const unsigned int a_z,
223 const unsigned int a_y,
224 const unsigned int a_z,
225 const unsigned char a_r,
226 const unsigned char a_g,
231 const unsigned int a_y,
232 const unsigned int a_z,
233 const unsigned char a_grayLevel);
253 virtual bool loadFromFile(
const std::string& a_filename);
256 virtual int loadFromFiles(
const std::vector<std::string>& a_filename);
259 virtual int loadFromFiles(
const std::string& a_basename,
const std::string& a_extension,
unsigned long a_max = 9999);
262 virtual bool addFromFile(
const std::string& a_filename,
unsigned long a_index=-1);
265 virtual bool saveToFiles(
const std::string& a_basename,
const std::string& a_extension);
Implements a 2D image data structure.
This class implements a 2D image data structure.
Definition CImage.h:84
This class implements an array of 2D image structures.
Definition CMultiImage.h:89
void cleanup()
This method deletes memory and rid ourselves of any image previously stored.
Definition CMultiImage.cpp:103
virtual void setTransparentColor(const unsigned char a_r, const unsigned char a_g, const unsigned char a_b, const unsigned char a_transparencyLevel)
This method defines a pixel color to be transparent for all images.
Definition CMultiImage.h:162
virtual unsigned int getImageCount() const
This method returns the number of images stored.
Definition CMultiImage.h:126
virtual unsigned char * getVoxelData(const unsigned int a_x, const unsigned int a_y, const unsigned int a_z) const
This method returns a pointer to voxel memory data.
Definition CMultiImage.cpp:989
virtual bool addFromFile(const std::string &a_filename, unsigned long a_index=-1)
This method adds an image file to the set if size and format are compatible.
Definition CMultiImage.cpp:1202
cMultiImage()
Default constructor of cMultiImage.
Definition CMultiImage.cpp:63
bool removeImage(unsigned long a_index)
This method removes an image from the set.
Definition CMultiImage.cpp:470
bool addImage(cImage &a_image, unsigned long a_index=-1)
This method adds an image to the set if size and format are compatible.
Definition CMultiImage.cpp:341
bool allocate(const unsigned int a_width, const unsigned int a_height, const unsigned int a_slices, const GLenum a_format=GL_RGB, const GLenum a_type=GL_UNSIGNED_BYTE)
This method allocates a new multi image array by defining its size, pixel format and pixel type.
Definition CMultiImage.cpp:132
unsigned long m_currentIndex
Index of the currently selected image.
Definition CMultiImage.h:300
virtual void setVoxelColor(const unsigned int a_x, const unsigned int a_y, const unsigned int a_z, const cColorb &a_color)
This method sets the color of an image voxel at location (x,y,z).
Definition CMultiImage.cpp:828
virtual void setVoxelColor(const unsigned int a_x, const unsigned int a_y, const unsigned int a_z, const unsigned char a_r, const unsigned char a_g, const unsigned char a_b)
This method sets the color of an image voxel at location (x,y,z).
Definition CMultiImage.h:222
virtual bool getVoxelColorInterpolated(const double a_x, const double a_y, const double a_z, cColorb &a_color) const
This method returns the interpolated color of an image voxel at location (x,y,z).
Definition CMultiImage.cpp:671
virtual bool addFromFilePrealloc(const std::string &a_filename, unsigned long a_index)
Add an image file to a preallocated set if size and format are compatible.
Definition CMultiImage.cpp:1232
cMultiImagePtr copy()
This method creates a copy itself.
Definition CMultiImage.cpp:205
virtual void getVoxelLocationInterpolated(const cVector3d &a_texCoord, double &a_voxelX, double &a_voxelY, double &a_voxelZ, bool a_clampToImageSize=true) const
This method retrieves the voxel location from a texture coordinate.
Definition CMultiImage.cpp:550
virtual int loadFromFiles(const std::vector< std::string > &a_filename)
This method loads an image set from a set of files.
Definition CMultiImage.cpp:1145
unsigned long m_imageCount
Number of images contained in the structure.
Definition CMultiImage.h:297
virtual ~cMultiImage()
Destructor of cMultiImage.
Definition CMultiImage.cpp:75
virtual bool selectImage(unsigned long a_index)
This method sets the current image.
Definition CMultiImage.cpp:311
bool convert(const unsigned int a_newFormat)
This method converts the image to a new format passed as argument.
Definition CMultiImage.cpp:231
unsigned char * getArray()
This method returns a pointer to the actual image data array. Use with care!
Definition CMultiImage.h:243
virtual bool getVoxelColor(const unsigned int a_x, const unsigned int a_y, const unsigned int a_z, cColorb &a_color) const
This method returns the color of an image voxel at location (x,y,z).
Definition CMultiImage.cpp:583
void defaults()
This method initializes all member variables.
Definition CMultiImage.cpp:87
virtual bool saveToFiles(const std::string &a_basename, const std::string &a_extension)
This method saves all images to a set of files.
Definition CMultiImage.cpp:1263
void erase()
This method deletes all image data from memory.
Definition CMultiImage.h:123
virtual void setTransparentColor(const cColorb &a_color, const unsigned char a_transparencyLevel)
This method defines a pixel color for all images to be transparent.
Definition CMultiImage.cpp:930
virtual void setTransparency(const unsigned char a_transparencyLevel)
This method defines a transparent level to all pixels of image set.
Definition CMultiImage.cpp:959
static cMultiImagePtr create()
Shared cMultiImage allocator.
Definition CMultiImage.h:103
unsigned char * m_array
The image array data that holds all images contiguously.
Definition CMultiImage.h:294
bool addImagePrealloc(cImage &a_image, unsigned long a_index)
Add an image to a preallocated set if size and format are compatible.
Definition CMultiImage.cpp:427
virtual void flipHorizontal()
This method flips all images horizontally.
Definition CMultiImage.cpp:1032
virtual bool loadFromFile(const std::string &a_filename)
This method loads an image file.
Definition CMultiImage.cpp:1055
virtual void getVoxelLocation(const cVector3d &a_texCoord, int &a_voxelX, int &a_voxelY, int &a_voxelZ, bool a_clampToImageSize=true) const
This method retrieves the nearest voxel location from a texture coordinate.
Definition CMultiImage.cpp:517
virtual unsigned long getCurrentIndex()
This method returns the index number of the current image.
Definition CMultiImage.h:139
Definition CAudioBuffer.cpp:57
std::shared_ptr< cMultiImage > cMultiImagePtr
Definition CMultiImage.h:67
This class defines a color using a GLubyte representation for each component.
Definition CColor.h:1185
This class defines a color using a GLfloat representation for each component.
Definition CColor.h:139
This class implements a 3D vector.
Definition CVector3d.h:89