ifw-odp
2.0.0-alpha
|
This class is C++ wrapper for a CPL and CLIPM recipes. It provides a simplified interface that allows to call CPL routines from INS applications. More...
#include <recipe.hpp>
Public Member Functions | |
Recipe () | |
Class constructor. More... | |
~Recipe () | |
Class destructor. More... | |
void | GetCenterGauss (const odp::Image *image, cpl_size llx, cpl_size lly, cpl_size urx, cpl_size ury, CenterGauss *cen_gauss, const int robustness=0) |
Compute the center gauss of an image subwindow. More... | |
void | GetCenterMoment (const odp::Image *image, cpl_size llx, cpl_size lly, cpl_size urx, cpl_size ury, bool wdw_enlarge, double gain, CenterGauss *cenMoment) |
Compute the center moment of an image subwindow. More... | |
void | GetMultiCenterGauss (const odp::Image *image, const odp::Matrix *ref, unsigned int areasize, odp::Matrix *center, odp::Matrix *center_err, odp::Matrix *sigma, odp::Matrix *sigma_err, odp::Matrix *fwhm, odp::Matrix *fwhm_err, odp::Matrix *intensities, odp::Array *err_codes, const int robustness) |
Compute multiple center gauss of an image. More... | |
void | GetIqe (const odp::Image *image, const cpl_size startX, const cpl_size startY, const cpl_size endX, const cpl_size endY, Iqe *iqe) |
Compute image quality estimator over an image subwindow. More... | |
void | GetSlitPos (const odp::Image *image, const int max_width, SlitPos *slit) |
Computes the slit data. More... | |
void | AlignPoints (const odp::Matrix *matrix1, const odp::Matrix *matrix2, unsigned int mode, odp::Matrix *trans, odp::Matrix *shift, odp::Matrix *rot) |
Linear transformation between two set of points. More... | |
void | AlignCorrelate (const odp::Image *img1, const odp::Image *img2, const odp::Matrix *ref, unsigned int wsize, double maxd, unsigned int mode, odp::Matrix *trans, odp::Matrix *shift, odp::Matrix *pixels, odp::Matrix *locs, odp::Matrix *uncer, odp::Array *err_codes) |
Crosscorrelation of two images. More... | |
std::vector< double > | GetRngPoisson2d (int llx, int lly, int urx, int ury, int homogenity, int npairs) |
Generates a set of random numbers within a box. More... | |
void | GetRngPoisson2d (double llx, double lly, double urx, double ury, int homogenity, int npairs, void **buffer_ptr, cpl_type cpltype=CPL_TYPE_DOUBLE) |
Generates a set of random numbers within a box. More... | |
void | GetRectangularAperture (const odp::Image *image, const cpl_size llx, const cpl_size lly, const cpl_size urx, const cpl_size ury, RectAperture *aperture, odp::Matrix *stat) |
Wrapper to the CLIPM rectangular characterization. More... | |
void | GetCircularAperture (const odp::Image *image, const cpl_size llx, const cpl_size lly, const cpl_size urx, const cpl_size ury, CircularAperture *aperture, odp::Matrix *stat) |
Wrapper to the CLIPM circular characterization. More... | |
void | EstimateBackground (const odp::Image *img, const cpl_size llx, const cpl_size lly, const cpl_size urx, const cpl_size ury, double *sigma, cpl_size *nused, double *background) |
Estimate the background in an image region. More... | |
void | EstimateFwhm (const odp::Image *img, double peak_pos1, double peak_pos2, double bckg_level, double *fwhm) |
Estimate the FWHM of a round object. More... | |
void | GetBarycentre (const odp::Image *img, const cpl_size llx, const cpl_size lly, const cpl_size urx, const cpl_size ury, double bckg_level, double cut_level, double centre[2], double *weight, cpl_size *nused) |
Compute the barycentre of an object. More... | |
void | DetectCircularApertures (const odp::Image *img, const cpl_size llx, const cpl_size lly, const cpl_size urx, const cpl_size ury, odp::Matrix *stat) |
Wrapper to the CLIPM detect circular aperture. 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... | |
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 and CLIPM recipes. It provides a simplified interface that allows to call CPL routines from INS applications.
Recipe - CPL and CLIPM recipe wrapper class
odp::Recipe::Recipe | ( | ) |
Class constructor.
odp::Recipe::~Recipe | ( | ) |
Class destructor.
void odp::Recipe::AlignCorrelate | ( | const odp::Image * | img1, |
const odp::Image * | img2, | ||
const odp::Matrix * | ref, | ||
unsigned int | wsize, | ||
double | maxd, | ||
unsigned int | mode, | ||
odp::Matrix * | trans, | ||
odp::Matrix * | shift, | ||
odp::Matrix * | pixels, | ||
odp::Matrix * | locs, | ||
odp::Matrix * | uncer, | ||
odp::Array * | err_codes | ||
) |
Crosscorrelation of two images.
[in] | img1 | First image to cross-correlate. |
[in] | img2 | Second image to cross-correlate. |
[in] | ref | Reference points. |
[in] | wsize | Window size for each of the reference subwindows. |
[in] | maxd | Maximum search distance. |
[in] | mode | Alignment mode. |
[out] | trans | Transformation matrix. |
[out] | shift | Shift matrix. |
[out] | pixels | Transformation shifting matrix. |
[out] | locs | Shift location matrix. |
[out] | uncer | Uncertainties matrix for each cetroid. |
[out] | err_codes | List of error codes for correlation and centroding. |
Interface to a clipm recipe function. It does the cross correlation between two images by correlation of a set of subwindows.
Please note that output matrix objects will be deleted before to point to the new allocated matrices. If output matrix objects are null, they are not going to be created.
void odp::Recipe::AlignPoints | ( | const odp::Matrix * | matrix1, |
const odp::Matrix * | matrix2, | ||
unsigned int | mode, | ||
odp::Matrix * | trans, | ||
odp::Matrix * | shift, | ||
odp::Matrix * | rot | ||
) |
Linear transformation between two set of points.
[in] | matrix1 | First set of points (CPL matrix). |
[in] | matrix2 | Second set of points (CPL matrix). |
[in] | mode | Aligning mode. |
[out] | trans | Output transformation (CPL matrix). |
[out] | shift | Output shift (CPL matrix). |
[out] | rot | Output residuals (CPL matrix). |
Interface to a clipm recipe function. It does the linear transformation between two set of points.
Please note that output matrix objects will be deleted before to point to the new allocated matrices. If output matrix objects are null, they are not going to be created.
void odp::Recipe::DetectCircularApertures | ( | const odp::Image * | img, |
const cpl_size | llx, | ||
const cpl_size | lly, | ||
const cpl_size | urx, | ||
const cpl_size | ury, | ||
odp::Matrix * | stat | ||
) |
Wrapper to the CLIPM detect circular aperture.
[in] | img | Image to analyze. |
[in] | llx | Lower left X coordinate of the box |
[in] | lly | Lower left Y coordinate of the box |
[in] | urx | Upper right X coordinate of the box |
[in] | ury | Upper right Y coordinate of the box |
[out] | stat | Matrix with the list of circular apertures detected |
Interface to a clipm recipe function. This method is a wrapper for the function detecting circular apertures.
void odp::Recipe::EstimateBackground | ( | const odp::Image * | img, |
const cpl_size | llx, | ||
const cpl_size | lly, | ||
const cpl_size | urx, | ||
const cpl_size | ury, | ||
double * | sigma, | ||
cpl_size * | nused, | ||
double * | background | ||
) |
Estimate the background in an image region.
[in] | img | Input image |
[in] | llx | Lower left X coordinate of the box |
[in] | lly | Lower left Y coordinate of the box |
[in] | urx | Upper right X coordinate of the box |
[in] | ury | Upper right Y coordinate of the box |
[out] | sigma | (Optional output) background sigma, can be nullptr, returns -1.0 in the case of error |
[out] | nused | (Optional output) number of found background pixels, can be nullptr, returns 0 in the case of error |
[out] | background | Estimated background value. |
void odp::Recipe::EstimateFwhm | ( | const odp::Image * | img, |
double | peak_pos1, | ||
double | peak_pos2, | ||
double | bckg_level, | ||
double * | fwhm | ||
) |
Estimate the FWHM of a round object.
[in] | img | Input image |
[in] | peak_pos1 | Peak position1 |
[in] | peak_pos2 | Peak position2 |
[in] | bckg_level | Input background level to subtract |
[out] | fwhm | Full with half maximum |
void odp::Recipe::GetBarycentre | ( | const odp::Image * | img, |
const cpl_size | llx, | ||
const cpl_size | lly, | ||
const cpl_size | urx, | ||
const cpl_size | ury, | ||
double | bckg_level, | ||
double | cut_level, | ||
double | centre[2], | ||
double * | weight, | ||
cpl_size * | nused | ||
) |
Compute the barycentre of an object.
[in] | img | Input image |
[in] | llx | Lower left X coordinate of the box |
[in] | lly | Lower left Y coordinate of the box |
[in] | urx | Upper right X coordinate of the box |
[in] | ury | Upper right Y coordinate of the box |
[in] | bckg_level | Input background level to subtract |
[in] | cut_level | Lower limit of values to use (separately from bckg_level) (values can be equal to or greater) |
[out] | centre | Mandatory (double) buffer of size 2 to contain the barycentre position after true |
[out] | weight | (Optional) output weight of the peak, can be nullptr |
[out] | nused | (Optional output) number of found background pixels, can be nullptr, returns 0 in the case of error |
void odp::Recipe::GetCenterGauss | ( | const odp::Image * | image, |
cpl_size | llx, | ||
cpl_size | lly, | ||
cpl_size | urx, | ||
cpl_size | ury, | ||
CenterGauss * | cen_gauss, | ||
const int | robustness = 0 |
||
) |
Compute the center gauss of an image subwindow.
[in] | image | Image object to compute the center gauss. |
[in] | llx | Lower left X coordinate |
[in] | lly | Lower left Y coordinate |
[in] | urx | Upper right X coordinate |
[in] | ury | Upper right Y coordinate |
[out] | cen_gauss | Center gauss information. |
[in] | robustness | Algorithm robustness. |
Interface to a clipm recipe function. It obtains the center gauss of an image subwindow.
void odp::Recipe::GetCenterMoment | ( | const odp::Image * | image, |
cpl_size | llx, | ||
cpl_size | lly, | ||
cpl_size | urx, | ||
cpl_size | ury, | ||
bool | wdw_enlarge, | ||
double | gain, | ||
CenterGauss * | cenMoment | ||
) |
Compute the center moment of an image subwindow.
[in] | image | Image object to compute the center moment. |
[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] | wdw_enlarge | Flag to allow the function to increase the window size when it detects that the window cuts the wings of the centered object, default should be 0. |
[in] | gain | (Optional) detector gain input in unit [1/electrons], required for computation of center error. |
[out] | cenMoment | Center moment information. |
Interface to a clipm recipe function. It obtains the center moment of an image subwindow.
void odp::Recipe::GetCircularAperture | ( | const odp::Image * | image, |
const cpl_size | llx, | ||
const cpl_size | lly, | ||
const cpl_size | urx, | ||
const cpl_size | ury, | ||
CircularAperture * | aperture, | ||
odp::Matrix * | stat | ||
) |
Wrapper to the CLIPM circular characterization.
[in] | image | Image to analyze. |
[in] | llx | Lower left X coordinate of the box |
[in] | lly | Lower left Y coordinate of the box |
[in] | urx | Upper right X coordinate of the box |
[in] | ury | Upper right Y coordinate of the box |
[out] | aperture | Circular aperture data |
[out] | stat | Statistical information |
Interface to a clipm recipe function. This method is a wrapper for the circular aperture.
void odp::Recipe::GetIqe | ( | const odp::Image * | image, |
const cpl_size | startX, | ||
const cpl_size | startY, | ||
const cpl_size | endX, | ||
const cpl_size | endY, | ||
Iqe * | iqe | ||
) |
Compute image quality estimator over an image subwindow.
[in] | image | Image to compute the IQE |
[in] | startX | Lower left X coordinate |
[in] | startY | Lower left Y coordinate |
[in] | endX | Upper right X coordinate |
[in] | endY | Upper right Y coordinate |
[out] | iqe | Information about the IQE |
Get the image quality estimator using a CPL function.
void odp::Recipe::GetMultiCenterGauss | ( | const odp::Image * | image, |
const odp::Matrix * | ref, | ||
unsigned int | areasize, | ||
odp::Matrix * | center, | ||
odp::Matrix * | center_err, | ||
odp::Matrix * | sigma, | ||
odp::Matrix * | sigma_err, | ||
odp::Matrix * | fwhm, | ||
odp::Matrix * | fwhm_err, | ||
odp::Matrix * | intensities, | ||
odp::Array * | err_codes, | ||
const int | robustness | ||
) |
Compute multiple center gauss of an image.
[in] | image | Image to compute the multiple center gauss. |
[in] | ref | Matrix containing the reference points. |
[in] | areasize | Size of area to compute the center gauss. |
[out] | center | Output matrix containing the computed center. |
[out] | center_err | Output matrix containing the error of the computed center. |
[out] | sigma | Output matrix containing the computed sigma. |
[out] | sigma_err | Output matrix containing the error of the computed sigma. |
[out] | fwhm | Output matrix containing the computed FWHM. |
[out] | fwhm_err | Output matrix containing the error of the computed FWHM. |
[out] | intensities | Output matrix containing the computed intesities. |
[out] | err_codes | Output array containing the error codes. |
[in] | robustness | Algorithm robustness. |
Interface to a clipm recipe function. It obtains the center gauss of an image subwindow.
Apply a gaussian fit over a set of image subwindows. CPL matrices are used for input and output data.
Please note that output matrix objects will be deleted before to point to the new allocated matrices. If output matrix objects are null, they are not going to be created.
void odp::Recipe::GetRectangularAperture | ( | const odp::Image * | image, |
const cpl_size | llx, | ||
const cpl_size | lly, | ||
const cpl_size | urx, | ||
const cpl_size | ury, | ||
RectAperture * | aperture, | ||
odp::Matrix * | stat | ||
) |
Wrapper to the CLIPM rectangular characterization.
[in] | image | Image to analyze. |
[in] | llx | Lower left X coordinate of the box |
[in] | lly | Lower left Y coordinate of the box |
[in] | urx | Upper right X coordinate of the box |
[in] | ury | Upper right Y coordinate of the box |
[out] | aperture | Rectangular aperture data |
[out] | stat | Statistical information |
Interface to a clipm recipe function. This method is a wrapper for the rectangular aperture.
std::vector< double > odp::Recipe::GetRngPoisson2d | ( | int | llx, |
int | lly, | ||
int | urx, | ||
int | ury, | ||
int | homogenity, | ||
int | npairs | ||
) |
Generates a set of random numbers within a box.
[in] | llx | Lower left X coordinate of the box |
[in] | lly | Lower left Y coordinate of the box |
[in] | urx | Upper right X coordinate of the box |
[in] | ury | Upper right Y coordinate of the box |
[in] | homogenity | Homogenity factor |
[in] | npairs | Number of pairs. |
Interface to a clipm recipe function. This is a method that generates a set of random offsets within a box following the Poisson law.
void odp::Recipe::GetRngPoisson2d | ( | double | llx, |
double | lly, | ||
double | urx, | ||
double | ury, | ||
int | homogenity, | ||
int | npairs, | ||
void ** | buffer_ptr, | ||
cpl_type | cpltype = CPL_TYPE_DOUBLE |
||
) |
Generates a set of random numbers within a box.
[in] | llx | Lower left X coordinate of the box |
[in] | lly | Lower left Y coordinate of the box |
[in] | urx | Upper right X coordinate of the box |
[in] | ury | Upper right Y coordinate of the box |
[in] | homogenity | Homogenity factor |
[in] | npairs | Number of pairs. |
[out] | buffer_ptr | Output buffer with the random values. |
[in] | cpltype | CPL type. |
Interface to a clipm recipe function. This is a method that generates a set of random offsets within a box following the Poisson law.
void odp::Recipe::GetSlitPos | ( | const odp::Image * | image, |
const int | max_width, | ||
SlitPos * | slit | ||
) |
Computes the slit data.
[in] | image | Image to compute the slit position. |
[in] | max_width | Maximum slit width. |
[out] | slit | structure with the slit information |
Interface to clipm recipe function. It obtain the center position and tilt angle of the slit.