HAWKI Pipeline Reference Manual 1.8.12
|
Data Structures | |
struct | _hawki_distortion_obj_function_args_ |
Functions | |
int | hawki_distortion_apply_maps (cpl_imagelist *ilist, cpl_image **dist_x, cpl_image **dist_y) |
Apply the distortion correction. | |
double | hawki_distortion_compute_rms (const cpl_table **ref_catalogues, const cpl_bivector *cat_offsets, const cpl_table *matching_sets, int ncats, hawki_distortion *distortion) |
This private function computes the rms, which is the objective function of the minimization algorithm. | |
int | hawki_distortion_correct_alldetectors (cpl_image **ilist, const cpl_frame *frame_dist_x, const cpl_frame *frame_dist_y) |
Apply the distortion correction. | |
int | hawki_distortion_correct_coords (const hawki_distortion *distortion, double x_pos, double y_pos, double *x_pos_distcorr, double *y_pos_distcorr) |
Apply the distortion correction to one detector position. | |
cpl_image * | hawki_distortion_correct_detector (cpl_image *image, cpl_image *dist_x, cpl_image *dist_y) |
Apply the distortion correction to one chip. | |
void | hawki_distortion_delete (hawki_distortion *distortion) |
Deallocates a hawki_distortion structure. | |
void | hawki_distortion_get_flag_vars (double *x_val, double *y_val, int *pos_flag, int nvals, int *nvalid, double *var_x, double *var_y) |
Compute the standard deviation of two vectors, not using flagged values. | |
int | hawki_distortion_get_size_x (const hawki_distortion *distortion) |
Gives the dimension in X of the distortion solution. | |
int | hawki_distortion_get_size_y (const hawki_distortion *distortion) |
Gives the dimension in Y of the distortion solution. | |
hawki_distortion * | hawki_distortion_grid_new (int detector_nx, int detector_ny, int grid_size) |
Allocate a new distortion solution. | |
int | hawki_distortion_interpolate_distortion (const hawki_distortion *distortion, double x_pos, double y_pos, double *x_dist, double *y_dist) |
Interpolates the distortion solution at a given position. | |
int | hawki_distortion_inverse_correct_coords (const hawki_distortion *distortion, double x_pos, double y_pos, double *x_pos_distinvcorr, double *y_pos_distinvcorr) |
Apply the inverse distortion correction to one detector position. | |
hawki_distortion * | hawki_distortion_load (const cpl_frame *dist_x, const cpl_frame *dist_y, int idet) |
Loads the distortion solution for one detector. |
int hawki_distortion_apply_maps | ( | cpl_imagelist * | ilist, |
cpl_image ** | dist_x, | ||
cpl_image ** | dist_y | ||
) |
Apply the distortion correction.
ilist | the input image list (chips 1 2 3 4) |
dist | the distortion file |
Definition at line 617 of file hawki_distortion.c.
References hawki_distortion_correct_detector().
double hawki_distortion_compute_rms | ( | const cpl_table ** | ref_catalogues, |
const cpl_bivector * | cat_offsets, | ||
const cpl_table * | matching_sets, | ||
int | ncats, | ||
hawki_distortion * | distortion | ||
) |
This private function computes the rms, which is the objective function of the minimization algorithm.
Definition at line 930 of file hawki_distortion.c.
References hawki_distortion_get_flag_vars(), and hawki_distortion_interpolate_distortion().
int hawki_distortion_correct_alldetectors | ( | cpl_image ** | ilist, |
const cpl_frame * | frame_dist_x, | ||
const cpl_frame * | frame_dist_y | ||
) |
Apply the distortion correction.
ilist | the input image list (chips 1 2 3 4) |
dist | the distortion file |
Definition at line 287 of file hawki_distortion.c.
References hawki_distortion_correct_detector(), hawki_distortion_delete(), and hawki_distortion_load().
int hawki_distortion_correct_coords | ( | const hawki_distortion * | distortion, |
double | x_pos, | ||
double | y_pos, | ||
double * | x_pos_distcorr, | ||
double * | y_pos_distcorr | ||
) |
Apply the distortion correction to one detector position.
distortion | the distortion solution |
x_pos | the X position in detector that we want to correct. |
y_pos | the Y position in detector that we want to correct. |
x_pos_distcorr | the X position in detector corrected from distortion |
y_pos_distcorr | the Y position in detector corrected from distortion |
This function will interpolate the distortion solution (given in variable distortion,
Definition at line 423 of file hawki_distortion.c.
References hawki_distortion_interpolate_distortion().
cpl_image* hawki_distortion_correct_detector | ( | cpl_image * | image, |
cpl_image * | dist_x, | ||
cpl_image * | dist_y | ||
) |
Apply the distortion correction to one chip.
image | the input image |
dist | the distortion table |
Definition at line 371 of file hawki_distortion.c.
Referenced by hawki_distortion_apply_maps(), and hawki_distortion_correct_alldetectors().
void hawki_distortion_delete | ( | hawki_distortion * | distortion | ) |
Deallocates a hawki_distortion structure.
distortion | The distortion to allocate |
Definition at line 163 of file hawki_distortion.c.
Referenced by hawki_distortion_correct_alldetectors().
void hawki_distortion_get_flag_vars | ( | double * | x_val, |
double * | y_val, | ||
int * | pos_flag, | ||
int | nvals, | ||
int * | nvalid, | ||
double * | var_x, | ||
double * | var_y | ||
) |
Compute the standard deviation of two vectors, not using flagged values.
Definition at line 1198 of file hawki_distortion.c.
Referenced by hawki_distortion_compute_rms().
int hawki_distortion_get_size_x | ( | const hawki_distortion * | distortion | ) |
Gives the dimension in X of the distortion solution.
dist | the distortion solution |
Definition at line 252 of file hawki_distortion.c.
int hawki_distortion_get_size_y | ( | const hawki_distortion * | distortion | ) |
Gives the dimension in Y of the distortion solution.
dist | the distortion solution |
Definition at line 269 of file hawki_distortion.c.
hawki_distortion* hawki_distortion_grid_new | ( | int | detector_nx, |
int | detector_ny, | ||
int | grid_size | ||
) |
Allocate a new distortion solution.
detector_nx | The dimensions in X of a HAWK-I detector |
detector_nx | The dimensions in Y of a HAWK-I detector |
grid_size | The number of points in the distortion grid |
Definition at line 132 of file hawki_distortion.c.
int hawki_distortion_interpolate_distortion | ( | const hawki_distortion * | distortion, |
double | x_pos, | ||
double | y_pos, | ||
double * | x_dist, | ||
double * | y_dist | ||
) |
Interpolates the distortion solution at a given position.
distortion | the distortion solution |
x_pos | the X position in detector that we want to correct. |
y_pos | the Y position in detector that we want to correct. |
x_dist | the distortion in X at position x_pos, y_pos |
y_dist | the distortion in Y at position x_pos, y_pos |
This private function uses the four reference points found in distortion closer to x_pos, y_pos. Then it weights each point with the 3rd power of the distance to the target pixel and uses a linear interpolation.
If this function is used in a multithread environment with a CPL version not thread-safe, there is no risk as long as these two premises are hold: -The caller must check if distortion->dist_x and distortion->dist_y are not null before calling this function, because this is check by cpl_image_get_size_x and cpl_image_get. -The caller must check in advance that the mask has all the points valid, because cpl_image_get checks for the validity of the pixel in the mask, if it is not valid, enters the error handling of CPL, which is not thread-safe, at least before CPL 5.2. The rest of the calls are read-only, so it should be safe.
Definition at line 526 of file hawki_distortion.c.
Referenced by hawki_distortion_compute_rms(), hawki_distortion_correct_coords(), and hawki_distortion_inverse_correct_coords().
int hawki_distortion_inverse_correct_coords | ( | const hawki_distortion * | distortion, |
double | x_pos, | ||
double | y_pos, | ||
double * | x_pos_distinvcorr, | ||
double * | y_pos_distinvcorr | ||
) |
Apply the inverse distortion correction to one detector position.
distortion | the distortion solution |
x_pos | the X position in detector that we want to decorrect. |
y_pos | the Y position in detector that we want to decorrect. |
x_pos_distcorr | the X position in detector decorrected from distortion |
y_pos_distcorr | the Y position in detector decorrected from distortion |
This function is the inverse function of hawki_distortion_correct_coords. WARNING: Although this is the "inverse" of hawki_distortion_correct_coords, applying this function to positions delivered by hawki_distortion_correct_coords will not provide the original positions back. We are simply not using the same position to interpolate the distortion table.
Definition at line 467 of file hawki_distortion.c.
References hawki_distortion_interpolate_distortion().
hawki_distortion* hawki_distortion_load | ( | const cpl_frame * | dist_x, |
const cpl_frame * | dist_y, | ||
int | idet | ||
) |
Loads the distortion solution for one detector.
dist_x | the image with distortion in X |
dist_y | the image with distortion in Y |
idet | the detector to read. |
Definition at line 182 of file hawki_distortion.c.
References hawki_get_ext_from_detector(), and hawki_load_frame_detector().
Referenced by hawki_distortion_correct_alldetectors().