ifw-odp
2.0.0-alpha
|
This class is C++ wrapper for a CPL image object. It provides a simplified interface that allows to call CPL routines from from INS applications. More...
#include <image.hpp>
Public Member Functions | |
Image () | |
Class constructor. More... | |
Image (const cpl_size size_x, const cpl_size size_y, const cpl_type type) | |
Class constructor. More... | |
Image (const Image &image) | |
Copy constructor. More... | |
Image (const Mask &mask) | |
Copy constructor. More... | |
Image (const Image &image, cpl_type type) | |
Copy constructor. More... | |
Image (const Image &image, const cpl_size llx, const cpl_size lly, const cpl_size urx, const cpl_size ury) | |
Copy constructor. More... | |
Image (const Mask &mask, const cpl_size llx, const cpl_size lly, const cpl_size urx, const cpl_size ury) | |
Copy constructor. More... | |
Image (const Image *image, const cpl_size llx, const cpl_size lly, const cpl_size urx, const cpl_size ury) | |
Copy constructor. More... | |
Image (const Image *image, const cpl_size startx, const cpl_size starty, const cpl_size size_single_det_x, const cpl_size size_single_det_y, const cpl_size size_gap_x, const cpl_size size_gap_y) | |
Copy constructor. More... | |
virtual | ~Image () |
Class destructor. More... | |
void | GetImagePtr (void **data_ptr) const |
Get pointer to image data. More... | |
cpl_size | GetTypeSize () const |
Get size of the image built-in type. More... | |
void * | GetImagePtr () const |
Get pointer to image data. More... | |
cpl_size | GetWidth () const |
Get image width. More... | |
cpl_size | GetHeight () const |
Get image height. More... | |
cpl_size | GetSize () const |
Get image size. More... | |
bool | IsImage () const |
Check is CPL image is valid. More... | |
bool | Status () const |
Get image status. More... | |
cpl_type | GetCplType () const |
Get CPL image type. More... | |
cpl_image * | GetCplImage () const |
Get CPL image. More... | |
void | SetCplImage (cpl_image *image) |
Set CPL image. More... | |
void | Copy (const Image &, const cpl_size pos_x, const cpl_size pos_y) |
Copy input image object in the coordinates specified. More... | |
void | Save (const std::string filename, cpl_type type=CPL_TYPE_FLOAT) |
Save CPL image into a FITS file. More... | |
void | Load (const std::string filename, const cpl_size plane=0, const cpl_size extension=0, cpl_type type=CPL_TYPE_FLOAT) |
Load CPL image from a FITS file. More... | |
void | Load (const std::string filename, const cpl_size llx, const cpl_size lly, const cpl_size urx, const cpl_size ury, const cpl_size plane=0, const cpl_size extension=0, cpl_type type=CPL_TYPE_FLOAT) |
Load CPL image from a FITS file subwindow. More... | |
void | Unload () |
Release CPL image. More... | |
double | Get (cpl_size xpos, cpl_size ypos) const |
Get the value of a pixel at a given position. More... | |
void | Get (cpl_size xpos, cpl_size ypos, double *value) |
Get the value of a pixel at a given position. More... | |
void | Set (cpl_size xpos, cpl_size ypos, double value) |
Set the value of a pixel at a given position. More... | |
void | SetBadPixelMap (const Mask &mask) |
Set the bad pixel map. More... | |
cpl_size | CountBadPixelMap () |
Count the bad pixels. More... | |
void | Exponential (const double base) |
Computes the image exponential. More... | |
void | Logarithm (const double base) |
Computes the image logarithm. More... | |
void | Power (const double exponent) |
Computes the image power. More... | |
void | Absolute () |
Computes the image absolute. More... | |
void | Normalise (cpl_norm norm=CPL_NORM_SCALE) |
Normalize the CPL image. More... | |
void | Turn (int rotation=-1) |
Rotate CPL image. More... | |
void | FFT (Image *imaginary, unsigned mode=CPL_FFT_DEFAULT) |
Fast Fourier Transfor of a CPL image. More... | |
void | Threshold (double lo_cut, double hi_cut, double assign_lo_cut, double assign_hi_cut) |
Threshold a CPL image to a given interval. More... | |
void | Rebin (cpl_size xstart, cpl_size ystart, cpl_size xstep, cpl_size ystep, Image &new_image) |
Image rebin. More... | |
void | FillNoise (const double min_pix, const double max_pix) |
It generates a CPL image with uniform random noise distribution. More... | |
void | FillGaussian (const double cen_x, const double cen_y, const double norm, const double sigma_x, const double sigma_y) |
It generates an image from a 2d gaussian function. More... | |
Image & | operator+ (const double) |
Overload operator+. More... | |
Image & | operator+ (const Image &) |
Overload operator+. More... | |
Image & | operator- (const double) |
Overload operator-. More... | |
Image & | operator- (const Image &) |
Overload operator-. More... | |
Image & | operator/ (const double) |
Overload operator/. More... | |
Image & | operator/ (const Image &) |
Overload operator/. More... | |
Image & | operator* (const double) |
Overload operator*. More... | |
Image & | operator* (const Image &) |
Overload operator*. More... | |
Image & | operator+= (const double) |
Overload operator+=. More... | |
Image & | operator+= (const Image &) |
Overload operator+=. More... | |
Image & | operator-= (const double) |
Overload operator-=. More... | |
Image & | operator-= (const Image &) |
Overload operator-=. More... | |
Image & | operator/= (const double) |
Overload operator/=. More... | |
Image & | operator/= (const Image &) |
Overload operator/=. More... | |
Image & | operator*= (const double) |
Overload operator*=. More... | |
Image & | operator*= (const Image &) |
Overload operator*=. More... | |
Image & | operator= (const Image &) |
Overload operator=. More... | |
bool | operator== (const Image &) const |
Overload operator==. More... | |
bool | operator!= (const Image &) const |
Overload operator!=. More... | |
Public Member Functions inherited from odp::Error | |
Error () | |
Class constructor. More... | |
virtual | ~Error () |
Class destructor. More... | |
void | ResetCplError () |
Reset CPL error and internal error flag. More... | |
bool | CheckCplError () const |
Check if there is an error in CPL. More... | |
Protected Attributes | |
cpl_type | m_cpl_type |
cpl_image * | m_cpl_image |
Additional Inherited Members | |
Protected Member Functions inherited from odp::Error | |
void | AddCplError () const |
Add CPL error to the error stack. More... | |
std::string | GetErrorMsg () const |
Get CPL error message. More... | |
Static Protected Member Functions inherited from odp::Error | |
static void | DumpError (unsigned self, unsigned first, unsigned last) |
Dump current CPL error. More... | |
This class is C++ wrapper for a CPL image object. It provides a simplified interface that allows to call CPL routines from from INS applications.
Image - CPL image wrapper class
odp::Image::Image | ( | ) |
Class constructor.
|
explicit |
Class constructor.
[in] | size_x | Width of the CPL image. |
[in] | size_y | Height of the CPL image. |
[in] | type | Type of the CPL image. |
Allocates the CPL image according to the dimensions and type specified.
|
explicit |
Copy constructor.
[in] | image | Object to be copied. |
CPL image is duplicated
|
explicit |
Copy constructor.
[in] | mask | object to be copied. |
CPL image is created from a mask object
|
explicit |
Copy constructor.
[in] | image | Object to be copied. |
[in] | type | Type of the CPL image. If the type choosen is not the same of the source image, image will be casted. |
CPL image of type specified is created.
|
explicit |
Copy constructor.
[in] | image | Reference object to be copied. |
[in] | llx | Lower left X coordinate. |
[in] | lly | Lower left Y coordinate. |
[in] | urx | Upper right X coordinate. |
[in] | ury | Upper right Y coordinate. |
Copy constructor that allows to get an image object from a window of the input image. Please note that these function might fail if the window is too small (CPL problem). Input is a reference of an image object.
|
explicit |
Copy constructor.
[in] | mask | reference object to be copied. |
[in] | llx | Lower left X coordinate. |
[in] | lly | Lower left Y coordinate. |
[in] | urx | Upper right X coordinate. |
[in] | ury | Upper right Y coordinate. |
Copy constructor that allows to get an image object from a mask image. Please note that these function might fail if the window is too small (CPL problem). Input is a reference of an image object.
|
explicit |
Copy constructor.
[in] | image | Pointer to the object to be copied. |
[in] | llx | Lower left X coordinate. |
[in] | lly | Lower left Y coordinate. |
[in] | urx | Upper right X coordinate. |
[in] | ury | Upper right Y coordinate. |
Copy constructor that allows to get an image object from a window of the input image. Please note that these function might fail if the window is too small (CPL problem). Input is a reference of an image object.
|
explicit |
Copy constructor.
[in] | image | Pointer to the object to be copied. |
[in] | startx | Initial X position |
[in] | starty | Initial Y position |
[in] | size_single_det_x | Size along X of a single detector (pixels). |
[in] | size_single_det_y | Size along Y of a single detector (pixels). |
[in] | size_gap_x | Size along X of the gap (pixels). |
[in] | size_gap_y | Size along Y of the gap (pixels). |
Special copy constructor that will create the new object based on the input but introducing an artificial gap in the image. This functionality is useful when it is needed to visualize the gap of a CCD mosaic.
|
virtual |
Class destructor.
void odp::Image::Absolute | ( | ) |
Computes the image absolute.
Interface to CPL image absolute function. It modifies the internal CPL by setting each pixel of the image object to its absolute value.
void odp::Image::Copy | ( | const Image & | image, |
const cpl_size | pos_x, | ||
const cpl_size | pos_y | ||
) |
Copy input image object in the coordinates specified.
[in] | image | Image to be copied. |
[in] | pos_x | Coordinate X where the image will be copied. |
[in] | pos_y | Coordinate Y where the image will be copied. |
cpl_size odp::Image::CountBadPixelMap | ( | ) |
Count the bad pixels.
void odp::Image::Exponential | ( | const double | base | ) |
Computes the image exponential.
[in] | base | Base of the exponential used in the computation. |
Interface to CPL exponential function. It modifies the internal CPL image object by computing the base-scalar exponential of each of its pixels.
void odp::Image::FFT | ( | Image * | imaginary, |
unsigned | mode = CPL_FFT_DEFAULT |
||
) |
Fast Fourier Transfor of a CPL image.
[in,out] | imaginary | The image imaginary part. |
[in] | mode | the desired FFT options |
Interface to CPL image FFT function.
void odp::Image::FillGaussian | ( | const double | cen_x, |
const double | cen_y, | ||
const double | norm, | ||
const double | sigma_x, | ||
const double | sigma_y | ||
) |
It generates an image from a 2d gaussian function.
[in] | cen_x | Center position along X of the gaussian. |
[in] | cen_y | Centerl position along Y of the gaussian. |
[in] | norm | Norm of the gaussian. |
[in] | sigma_x | Sigma along X of the gaussian. |
[in] | sigma_y | Sigma along Y of the gaussian. |
Interface to CPL image generation function. It generates an image from a 2d gaussian function.
void odp::Image::FillNoise | ( | const double | min_pix, |
const double | max_pix | ||
) |
It generates a CPL image with uniform random noise distribution.
[in] | min_pix | Minimum pixel value in the generated image. |
[in] | max_pix | Maximum pixel value in the generated image. |
Interface to CPL image generation function. It generates an image with uniform random noise distribution.
double odp::Image::Get | ( | cpl_size | xpos, |
cpl_size | ypos | ||
) | const |
Get the value of a pixel at a given position.
[in] | xpos | Pixel x position (FITS convention, 1 for leftmost) |
[in] | ypos | Pixel y position (FITS convention, 1 for lowest) |
void odp::Image::Get | ( | cpl_size | xpos, |
cpl_size | ypos, | ||
double * | value | ||
) |
Get the value of a pixel at a given position.
[in] | xpos | Pixel x position (FITS convention, 1 for leftmost) |
[in] | ypos | Pixel y position (FITS convention, 1 for lowest) |
[out] | value | The pixel value |
|
inline |
Get CPL image.
|
inline |
Get CPL image type.
|
inline |
Get image height.
void odp::Image::GetImagePtr | ( | void ** | data_ptr | ) | const |
Get pointer to image data.
[out] | data_ptr | Pointer to the image data |
|
inline |
Get pointer to image data.
|
inline |
Get image size.
cpl_size odp::Image::GetTypeSize | ( | ) | const |
Get size of the image built-in type.
|
inline |
Get image width.
|
inline |
Check is CPL image is valid.
void odp::Image::Load | ( | const std::string | filename, |
const cpl_size | plane = 0 , |
||
const cpl_size | extension = 0 , |
||
cpl_type | type = CPL_TYPE_FLOAT |
||
) |
Load CPL image from a FITS file.
[in] | filename | Absolute or relative path name of the file to be loaded. |
[in] | plane | Plane number to be loaded, default is zero. |
[in] | extension | Extension id to be loaded, default is zero. |
[in] | type | CPL type used to store the input image, default is FLOAT. |
void odp::Image::Load | ( | const std::string | filename, |
const cpl_size | llx, | ||
const cpl_size | lly, | ||
const cpl_size | urx, | ||
const cpl_size | ury, | ||
const cpl_size | plane = 0 , |
||
const cpl_size | extension = 0 , |
||
cpl_type | type = CPL_TYPE_FLOAT |
||
) |
Load CPL image from a FITS file subwindow.
[in] | filename | Absolute or relative path name of the file to be loaded. |
[in] | llx | Lower left X coordinate |
[in] | lly | Lower left Y coordinate |
[in] | urx | Upper right X coordinate |
[in] | ury | Upper right Y coordinate |
[in] | plane | Plane number of the cube to be loaded, default is zero for non cube files. |
[in] | extension | Extension number to be loaded, default is zero. |
[in] | type | CPL type used to store the input image, default is FLOAT. |
void odp::Image::Logarithm | ( | const double | base | ) |
Computes the image logarithm.
[in] | base | Base of the logarithm used in the computation. |
Interface to CPL logarihm function. It modifies the internal CPL image by computing the base-scalar logarithm of each of its pixels.
void odp::Image::Normalise | ( | cpl_norm | norm = CPL_NORM_SCALE | ) |
Normalize the CPL image.
[in] | norm | Normalization according to the CPL definition. |
Interface to CPL image normalise function. It modifies the internal CPL by normalizing the internal image object according to certain criteria.
CPL_NORM_SCALE sets the pixel interval to [0,1]. CPL_NORM_MEAN sets the mean value to 1. CPL_NORM_FLUX sets the flux to 1. CPL_NORM_ABSFLUX sets the absolute flux to 1.
bool odp::Image::operator!= | ( | const Image & | image | ) | const |
Overload operator!=.
[in] | image | Input image to be compared |
Image & odp::Image::operator* | ( | const double | scalar | ) |
Overload operator*.
[in] | scalar | Input scalar to be multiplied |
Overload operator*.
[in] | image | Input image to be multiplied |
Image & odp::Image::operator*= | ( | const double | scalar | ) |
Overload operator*=.
[in] | scalar | Input scalar to be multiplied |
Overload operator*=.
[in] | image | Input image to be multiplied |
Image & odp::Image::operator+ | ( | const double | scalar | ) |
Overload operator+.
[in] | scalar | Input number to be added. |
Overload operator+.
[in] | image | Input image to be added |
Image & odp::Image::operator+= | ( | const double | scalar | ) |
Overload operator+=.
[in] | scalar | Input scalar to be added |
Overload operator+=.
[in] | image | Input image to be added |
Image & odp::Image::operator- | ( | const double | scalar | ) |
Overload operator-.
[in] | scalar | Input number to be subtracted. |
Overload operator-.
[in] | image | Input image to be subtracted |
Image & odp::Image::operator-= | ( | const double | scalar | ) |
Overload operator-=.
[in] | scalar | Input scalar to be subtracted |
Overload operator-=.
[in] | image | Input image to be subtracted |
Image & odp::Image::operator/ | ( | const double | scalar | ) |
Overload operator/.
[in] | scalar | Input number to be divided |
Overload operator/.
[in] | image | Input image to be divided |
Image & odp::Image::operator/= | ( | const double | scalar | ) |
Overload operator/=.
[in] | scalar | Input scalar to be divided |
Overload operator/=.
[in] | image | Input image to be divided |
Overload operator=.
[in] | image | Input image to be copied |
bool odp::Image::operator== | ( | const Image & | image | ) | const |
Overload operator==.
[in] | image | Input image to be compared |
void odp::Image::Power | ( | const double | exponent | ) |
Computes the image power.
[in] | exponent | Exponent used in the computation of the power. |
Interface to CPL image power function. It modifies the internal CPL by lifting each of its pixels to exponent.
void odp::Image::Rebin | ( | cpl_size | xstart, |
cpl_size | ystart, | ||
cpl_size | xstep, | ||
cpl_size | ystep, | ||
Image & | new_image | ||
) |
Image rebin.
[in] | xstart | start x position of binning |
[in] | ystart | start y position of binning |
[in] | xstep | bin size along x. |
[in] | ystep | bin size along y. |
[out] | new_image | output rebin image. |
void odp::Image::Save | ( | const std::string | filename, |
cpl_type | type = CPL_TYPE_FLOAT |
||
) |
Save CPL image into a FITS file.
[in] | filename | Absolute path name of the file to be saved. |
[in] | type | Data type of the image to be saved. |
void odp::Image::Set | ( | cpl_size | xpos, |
cpl_size | ypos, | ||
double | value | ||
) |
Set the value of a pixel at a given position.
[in] | xpos | Pixel x position (FITS convention, 1 for leftmost) |
[in] | ypos | Pixel y position (FITS convention, 1 for lowest) |
[in] | value | The pixel value |
void odp::Image::SetBadPixelMap | ( | const Mask & | mask | ) |
Set the bad pixel map.
[in] | mask | Inpu mask containing the bad pixels. |
void odp::Image::SetCplImage | ( | cpl_image * | image | ) |
Set CPL image.
[in] | image | CPL image |
|
inline |
Get image status.
void odp::Image::Threshold | ( | double | lo_cut, |
double | hi_cut, | ||
double | assign_lo_cut, | ||
double | assign_hi_cut | ||
) |
Threshold a CPL image to a given interval.
[in] | lo_cut | Lower bound |
[in] | hi_cut | Higher bound |
[in] | assign_lo_cut | Value to assign to pixels below low bound. |
[in] | assign_hi_cut | Value to assign to pixels above high bound. |
Interface to CPL threshold function.
void odp::Image::Turn | ( | int | rotation = -1 | ) |
Rotate CPL image.
[in] | rotation | Multiple of 90 degrees to rotate. |
Interface to CPL image turn function. It rotates the image object by a multiple of 90 deg clockwise.
void odp::Image::Unload | ( | ) |
Release CPL image.
Delete image object from memory.
|
protected |
|
protected |