ifw-odp 5.1.1
 
Loading...
Searching...
No Matches
recipe.hpp
Go to the documentation of this file.
1
7
8#ifndef ODP_RECIPE_HPP
9#define ODP_RECIPE_HPP
10
11
12#ifndef __cplusplus
13#error This is a C++ include file and cannot be used from plain C
14#endif
15
16// System header files
17#include <iostream>
18#include <sstream>
19#include <string>
20#include <vector>
21#include <algorithm>
22#include <array>
23
24// Local header files
28
29namespace ifw::odp {
30
31
39 typedef struct
40 {
41 double xpos; // x position of the object
42 double xposErr; // x position error
43 double ypos; // y position of the object
44 double yposErr; // y position error
45 double fwhmX; // FWHM along the first axis
46 double fwhmXErr; // FWHM error along the first axis
47 double fwhmY; // FWHM along the second axis
48 double fwhmYErr; // FWHM error along the second axis
49 double angle; // the angle of the first axis with the horizontal in degrees
50 double angleErr; // the angle error
51 double peak; // the peak value of the object
52 double peakErr; // the peak error
53 double bckgrd; // the background computed
54 double bckgrdErr;// the background error
55 } Iqe;
56
65 {
67 std::string Center() {
68 std::ostringstream strs;
69 strs << center[0] << " " << center[1];
70 return strs.str();
71 }
72
73 std::array<double, 2> center;
74 std::array<double, 2> center_err;
75 std::array<double, 2> fwhm;
76 std::array<double, 2> fwhm_err;
77 std::array<double, 2> sigma;
78 std::array<double, 2> sigma_err;
79 double intensity; // Intensity at the center
80 };
81
89 typedef struct
90 {
91 double center_x; // X slit center
92 double center_y; // Y slit center
93 double angle; // slit angle (tilt)
94 } SlitPos;
95
96 typedef struct
97 {
98 double length;
99 double width;
100 } Size;
101
109 typedef struct
110 {
113 } RectAperture;
114
122 typedef struct
123 {
124 double center_x;
125 double center_y;
126 double radius;
127 double r_sigma;
129
142 class Recipe : virtual public odp::Error
143 {
144 public:
150 Recipe();
151
157 ~Recipe();
158
159 // Recipes functions
160
179 void GetCenterGauss(const odp::Image *image,
180 cpl_size llx,
181 cpl_size lly,
182 cpl_size urx,
183 cpl_size ury,
184 CenterGauss *cen_gauss,
185 const int robustness=0);
186
216 void GetCenterMoment(const odp::Image *image,
217 cpl_size llx,
218 cpl_size lly,
219 cpl_size urx,
220 cpl_size ury,
221 bool wdw_enlarge,
222 double gain,
223 CenterGauss *cenMoment);
224
255 void GetMultiCenterGauss(const odp::Image *image,
256 const odp::Matrix *ref,
257 unsigned int areasize,
258 odp::Matrix *center,
259 odp::Matrix *center_err,
260 odp::Matrix *sigma,
261 odp::Matrix *sigma_err,
262 odp::Matrix *fwhm,
263 odp::Matrix *fwhm_err,
264 odp::Matrix *intensities,
265 odp::Array *err_codes,
266 const int robustness);
267
285 void GetIqe(const odp::Image *image,
286 const cpl_size startX,
287 const cpl_size startY,
288 const cpl_size endX,
289 const cpl_size endY,
290 Iqe *iqe) ;
291
306 void GetSlitPos(const odp::Image *image,
307 const int max_width,
308 SlitPos *slit);
309
331 void AlignPoints(const odp::Matrix *matrix1,
332 const odp::Matrix *matrix2,
333 unsigned int mode,
334 odp::Matrix *trans,
335 odp::Matrix *shift,
336 odp::Matrix *rot);
337
365 void AlignCorrelate(const odp::Image *img1,
366 const odp::Image *img2,
367 const odp::Matrix *ref,
368 unsigned int wsize,
369 double maxd,
370 unsigned int mode,
371 odp::Matrix *trans,
372 odp::Matrix *shift,
373 odp::Matrix *pixels,
374 odp::Matrix *locs,
375 odp::Matrix *uncer,
376 odp::Array *err_codes);
377
397 std::vector<double> GetRngPoisson2d(int llx,
398 int lly,
399 int urx,
400 int ury,
401 int homogenity,
402 int npairs);
403
404
424 void GetRngPoisson2d(double llx,
425 double lly,
426 double urx,
427 double ury,
428 int homogenity,
429 int npairs,
430 void **buffer_ptr,
431 cpl_type cpltype=CPL_TYPE_DOUBLE);
432
451 void GetRectangularAperture(const odp::Image *image,
452 const cpl_size llx,
453 const cpl_size lly,
454 const cpl_size urx,
455 const cpl_size ury,
456 RectAperture *aperture,
457 odp::Matrix *stat);
458
477 void GetCircularAperture(const odp::Image *image,
478 const cpl_size llx,
479 const cpl_size lly,
480 const cpl_size urx,
481 const cpl_size ury,
482 CircularAperture *aperture,
483 odp::Matrix *stat);
484
503 void EstimateBackground(const odp::Image *img,
504 const cpl_size llx,
505 const cpl_size lly,
506 const cpl_size urx,
507 const cpl_size ury,
508 double *sigma,
509 cpl_size *nused,
510 double *background);
511
524 void EstimateFwhm(const odp::Image *img,
525 double peak_pos1,
526 double peak_pos2,
527 double bckg_level,
528 double *fwhm);
529
550 void GetBarycentre(const odp::Image *img,
551 const cpl_size llx,
552 const cpl_size lly,
553 const cpl_size urx,
554 const cpl_size ury,
555 double bckg_level,
556 double cut_level,
557 double centre[2],
558 double *weight,
559 cpl_size *nused);
560
577 void DetectCircularApertures(const odp::Image *img,
578 const cpl_size llx,
579 const cpl_size lly,
580 const cpl_size urx,
581 const cpl_size ury,
582 odp::Matrix *stat);
583
584
585 private:
586 static bool m_random_seed;
587
588 };
589
590}
591#endif
592
593
594
This class is C++ wrapper for a CPL array object. It provides a simplified interface to the INS softw...
Definition array.hpp:39
This class handle the errors produced by the calling of image processing routines.
Definition error.hpp:34
This class is C++ wrapper for a CPL image object. It provides a simplified interface that allows to c...
Definition image.hpp:41
This class is C++ wrapper for a CPL matrix object. It provides a simplified interface that allows to ...
Definition matrix.hpp:38
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.
Definition recipe.cpp:546
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.
Definition recipe.cpp:26
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.
Definition recipe.cpp:182
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.
Definition recipe.cpp:247
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.
Definition recipe.cpp:493
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.
Definition recipe.cpp:62
void EstimateFwhm(const odp::Image *img, double peak_pos1, double peak_pos2, double bckg_level, double *fwhm)
Estimate the FWHM of a round object.
Definition recipe.cpp:525
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.
Definition recipe.cpp:457
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.
Definition recipe.cpp:291
Recipe()
Class constructor.
Definition recipe.cpp:15
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.
Definition recipe.cpp:100
void GetSlitPos(const odp::Image *image, const int max_width, SlitPos *slit)
Computes the slit data.
Definition recipe.cpp:225
~Recipe()
Class destructor.
Definition recipe.cpp:21
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.
Definition recipe.cpp:361
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.
Definition recipe.cpp:579
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.
Definition recipe.cpp:420
Array class source file.
Definition array.cpp:14
Definition recipe.hpp:65
std::array< double, 2 > fwhm
Definition recipe.hpp:75
double intensity
Definition recipe.hpp:79
std::array< double, 2 > center_err
Definition recipe.hpp:74
std::array< double, 2 > fwhm_err
Definition recipe.hpp:76
std::array< double, 2 > center
Definition recipe.hpp:73
CenterGauss()
Definition recipe.hpp:66
std::string Center()
Definition recipe.hpp:67
std::array< double, 2 > sigma
Definition recipe.hpp:77
std::array< double, 2 > sigma_err
Definition recipe.hpp:78
Definition recipe.hpp:123
double center_y
Definition recipe.hpp:125
double r_sigma
Definition recipe.hpp:127
double center_x
Definition recipe.hpp:124
double radius
Definition recipe.hpp:126
Definition recipe.hpp:40
double angleErr
Definition recipe.hpp:50
double yposErr
Definition recipe.hpp:44
double fwhmXErr
Definition recipe.hpp:46
double xpos
Definition recipe.hpp:41
double ypos
Definition recipe.hpp:43
double peakErr
Definition recipe.hpp:52
double fwhmY
Definition recipe.hpp:47
double bckgrd
Definition recipe.hpp:53
double fwhmX
Definition recipe.hpp:45
double bckgrdErr
Definition recipe.hpp:54
double peak
Definition recipe.hpp:51
double fwhmYErr
Definition recipe.hpp:48
double angle
Definition recipe.hpp:49
double xposErr
Definition recipe.hpp:42
Definition recipe.hpp:110
SlitPos position
Definition recipe.hpp:111
Size size
Definition recipe.hpp:112
Definition recipe.hpp:97
double length
Definition recipe.hpp:98
double width
Definition recipe.hpp:99
Definition recipe.hpp:90
double center_x
Definition recipe.hpp:91
double angle
Definition recipe.hpp:93
double center_y
Definition recipe.hpp:92