#include <image.h>
Public Member Functions | |
Image () | |
Constructor for the class Image. Initializes the size to zero. | |
~Image () | |
Destructor for the class Image. Releases the memory used by the pixels. | |
bool | IsPointInside (unsigned int x, unsigned int y) const |
Test if a point is in our 2d-array. | |
unsigned int | GetSizeX () const |
Returns the size along X of the image. | |
unsigned int | GetSizeY () const |
Returns the size along Y of the image. | |
int | GetData (int x, int y) const |
Returns the data value for a given point. | |
bool | ReadFile (const std::string &filename) |
Reads the data file and fills the 2d data array. A data file has the following structure: . | |
int | GetMin () const |
Return the smallest pixel value from the 2d-array. | |
int | GetMax () const |
Return the largest pixel value from the 2d-array. | |
void | AdjustPaletteColors () |
Computes the extrema of the 2d data array. | |
Protected Member Functions | |
void | ResetMem () |
Reset the 2d-array holding the pixels. | |
Protected Attributes | |
std::vector< std::vector< int > > | m_data |
2d-array holding the pixels values. | |
int | m_nX |
int | m_nY |
int | m_min |
Smallest pixel value (i.e. from the 2d-array). | |
int | m_max |
Largest pixel value (i.e. from the 2d-array). |
Definition at line 15 of file image.h.
Image::Image | ( | ) |
Image::~Image | ( | ) |
Destructor for the class Image. Releases the memory used by the pixels.
Definition at line 18 of file image.cpp.
References ResetMem().
void Image::ResetMem | ( | ) | [protected] |
Reset the 2d-array holding the pixels.
Definition at line 23 of file image.cpp.
References m_data.
Referenced by ReadFile(), and ~Image().
bool Image::IsPointInside | ( | unsigned int | x, | |
unsigned int | y | |||
) | const |
Test if a point is in our 2d-array.
Definition at line 153 of file image.cpp.
References GetSizeX(), and GetSizeY().
Referenced by GetData(), Visu2D::HandleMouse(), and Visu2D::SetTextInfo().
unsigned int Image::GetSizeX | ( | ) | const |
Returns the size along X of the image.
Definition at line 157 of file image.cpp.
References m_data.
Referenced by AdjustPaletteColors(), IsPointInside(), and Visu2D::UpdateDataAndPixmap().
unsigned int Image::GetSizeY | ( | ) | const |
Returns the size along Y of the image.
Definition at line 162 of file image.cpp.
References m_data.
Referenced by AdjustPaletteColors(), IsPointInside(), and Visu2D::UpdateDataAndPixmap().
int Image::GetData | ( | int | x, | |
int | y | |||
) | const |
Returns the data value for a given point.
x | : abscissa of the point | |
y | : ordinate of the point |
Definition at line 145 of file image.cpp.
References IsPointInside(), and m_data.
Referenced by AdjustPaletteColors(), Visu2D::SetTextInfo(), Rectangle::SumValues(), and Visu2D::UpdateDataAndPixmap().
bool Image::ReadFile | ( | const std::string & | filename | ) |
Reads the data file and fills the 2d data array. A data file has the following structure:
.
filename | : name of the data file |
A data file has the following structure:
Which would look like :
Definition at line 31 of file image.cpp.
References AdjustPaletteColors(), m_data, m_nX, m_nY, and ResetMem().
Referenced by WFrame::ReadImage().
int Image::GetMin | ( | ) | const |
Return the smallest pixel value from the 2d-array.
Definition at line 171 of file image.cpp.
References m_min.
Referenced by WFrame::ReadImage().
int Image::GetMax | ( | ) | const |
Return the largest pixel value from the 2d-array.
Definition at line 175 of file image.cpp.
References m_max.
Referenced by WFrame::ReadImage().
void Image::AdjustPaletteColors | ( | ) |
Computes the extrema of the 2d data array.
Definition at line 128 of file image.cpp.
References GetData(), GetSizeX(), GetSizeY(), m_max, and m_min.
Referenced by ReadFile().
std::vector< std::vector < int > > Image::m_data [protected] |
2d-array holding the pixels values.
Definition at line 30 of file image.h.
Referenced by GetData(), GetSizeX(), GetSizeY(), ReadFile(), and ResetMem().
int Image::m_nX [protected] |
max size in X of 2d-array holding the pixels values.
Definition at line 33 of file image.h.
Referenced by ReadFile().
int Image::m_nY [protected] |
max size in Y of 2d-array holding the pixels values.
Definition at line 36 of file image.h.
Referenced by ReadFile().
int Image::m_min [protected] |
Smallest pixel value (i.e. from the 2d-array).
Definition at line 39 of file image.h.
Referenced by AdjustPaletteColors(), and GetMin().
int Image::m_max [protected] |
Largest pixel value (i.e. from the 2d-array).
Definition at line 42 of file image.h.
Referenced by AdjustPaletteColors(), and GetMax().