CR2RE Pipeline Reference Manual 1.6.7
Functions
Image object

Functions

cpl_image * hdrl_image_get_image (hdrl_image *himg)
 get data as cpl image
 
const cpl_image * hdrl_image_get_image_const (const hdrl_image *himg)
 get data as cpl image
 
cpl_image * hdrl_image_get_error (hdrl_image *himg)
 get error as cpl image
 
const cpl_image * hdrl_image_get_error_const (const hdrl_image *himg)
 get error as cpl image
 
cpl_mask * hdrl_image_get_mask (hdrl_image *himg)
 get cpl bad pixel mask from image
 
const cpl_mask * hdrl_image_get_mask_const (const hdrl_image *himg)
 get cpl bad pixel mask from image
 
hdrl_image * hdrl_image_create (const cpl_image *image, const cpl_image *error)
 create a new hdrl_image from to existing images by copying them
 
hdrl_image * hdrl_image_new (cpl_size nx, cpl_size ny)
 create new zero filled hdrl image
 
void hdrl_image_delete (hdrl_image *himg)
 delete hdrl_image
 
hdrl_image * hdrl_image_duplicate (const hdrl_image *himg)
 copy hdrl_image
 
cpl_error_code hdrl_image_reject_from_mask (hdrl_image *self, const cpl_mask *map)
 set bpm of hdrl_image
 
cpl_error_code hdrl_image_reject (hdrl_image *self, cpl_size xpos, cpl_size ypos)
 mark pixel as bad
 
int hdrl_image_is_rejected (hdrl_image *self, cpl_size xpos, cpl_size ypos)
 return if pixel is marked bad
 
cpl_size hdrl_image_count_rejected (const hdrl_image *self)
 return number of rejected pixels
 
cpl_error_code hdrl_image_reject_value (hdrl_image *self, cpl_value mode)
 Reject pixels with the specified special value(s)
 
cpl_error_code hdrl_image_accept (hdrl_image *self, cpl_size xpos, cpl_size ypos)
 mark pixel as good
 
cpl_error_code hdrl_image_accept_all (hdrl_image *self)
 Accept all pixels in an image.
 
cpl_size hdrl_image_get_size_x (const hdrl_image *self)
 return size of X dimension of image
 
cpl_size hdrl_image_get_size_y (const hdrl_image *self)
 return size of Y dimension of image
 
hdrl_value hdrl_image_get_pixel (const hdrl_image *self, cpl_size xpos, cpl_size ypos, int *pis_rejected)
 get pixel values of hdrl_image
 
cpl_error_code hdrl_image_set_pixel (hdrl_image *self, cpl_size xpos, cpl_size ypos, hdrl_value value)
 set pixel values of hdrl_image
 
hdrl_image * hdrl_image_extract (const hdrl_image *self, cpl_size llx, cpl_size lly, cpl_size urx, cpl_size ury)
 extract copy of window from image
 
cpl_error_code hdrl_image_turn (hdrl_image *self, int rot)
 Rotate an image by a multiple of 90 degrees clockwise.
 
cpl_error_code hdrl_image_copy (hdrl_image *dst, const hdrl_image *src, cpl_size xpos, cpl_size ypos)
 Copy one image into another.
 
cpl_error_code hdrl_image_insert (hdrl_image *self, const cpl_image *image, const cpl_image *error, cpl_size xpos, cpl_size ypos)
 Copy cpl images into an hdrl image.
 
cpl_error_code hdrl_image_dump_structure (const hdrl_image *himg, FILE *stream)
 Dump structural information of a HDRL image.
 
cpl_error_code hdrl_image_dump_window (const hdrl_image *himg, cpl_size llx, cpl_size lly, cpl_size urx, cpl_size ury, FILE *stream)
 Dump pixel values in a HDRL image.
 
cpl_error_code hdrl_image_add_image (hdrl_image *self, const hdrl_image *other)
 Add two images, store the result in the first image.
 
hdrl_image * hdrl_image_add_image_create (const hdrl_image *self, const hdrl_image *other)
 Add two images.
 
cpl_error_code hdrl_image_add_scalar (hdrl_image *self, hdrl_value value)
 Elementwise addition of a scalar to an image.
 
cpl_error_code hdrl_image_sub_image (hdrl_image *self, const hdrl_image *other)
 Subtract two images, store the result in the first image.
 
hdrl_image * hdrl_image_sub_image_create (const hdrl_image *self, const hdrl_image *other)
 Subtract two images.
 
cpl_error_code hdrl_image_sub_scalar (hdrl_image *self, hdrl_value value)
 Elementwise subtraction of a scalar from an image.
 
cpl_error_code hdrl_image_mul_image (hdrl_image *self, const hdrl_image *other)
 Multiply two images, store the result in the first image.
 
hdrl_image * hdrl_image_mul_image_create (const hdrl_image *self, const hdrl_image *other)
 Multiply two images.
 
cpl_error_code hdrl_image_mul_scalar (hdrl_image *self, hdrl_value value)
 Elementwise multiplication of an image with a scalar.
 
cpl_error_code hdrl_image_div_image (hdrl_image *self, const hdrl_image *other)
 Divide two images, store the result in the first image.
 
hdrl_image * hdrl_image_div_image_create (const hdrl_image *self, const hdrl_image *other)
 Divide two images and return the resulting image.
 
cpl_error_code hdrl_image_div_scalar (hdrl_image *self, hdrl_value value)
 Elementwise division of an image with a scalar.
 
hdrl_value hdrl_image_get_mean (const hdrl_image *self)
 computes mean pixel value and associated error of an image.
 
hdrl_value hdrl_image_get_sigclip_mean (const hdrl_image *self, double kappa_low, double kappa_high, int niter)
 computes the sigma-clipped mean and associated error of an image.
 
hdrl_value hdrl_image_get_minmax_mean (const hdrl_image *self, double nlow, double nhigh)
 computes the minmax rejected mean and the associated error of an image.
 
hdrl_value hdrl_image_get_mode (const hdrl_image *self, double histo_min, double histo_max, double bin_size, hdrl_mode_type method, cpl_size error_niter)
 computes the mode and the associated error of an image.
 
hdrl_value hdrl_image_get_median (const hdrl_image *self)
 computes the median and associated error of an image.
 
hdrl_value hdrl_image_get_weighted_mean (const hdrl_image *self)
 computes the weighted mean and associated error of an image.
 
double hdrl_image_get_stdev (const hdrl_image *self)
 computes the standard deviation of the data of an image
 
hdrl_value hdrl_image_get_sum (const hdrl_image *self)
 computes the sum of all pixel values and the associated error of an image.
 
hdrl_value hdrl_image_get_sqsum (const hdrl_image *self)
 computes the sum of all pixel values and the error of a squared image.
 
cpl_error_code hdrl_image_pow_scalar (hdrl_image *self, const hdrl_value exponent)
 computes the power of an image by a scalar
 
hdrl_image * hdrl_image_pow_scalar_create (const hdrl_image *self, const hdrl_value exponent)
 computes the power of an image by a scalar creating a new image
 
cpl_error_code hdrl_image_exp_scalar (hdrl_image *self, const hdrl_value base)
 computes the exponential of an image by a scalar
 
hdrl_image * hdrl_image_exp_scalar_create (const hdrl_image *self, const hdrl_value base)
 computes the exponential of an image by a scalar creating a new image
 

Detailed Description

hdrl_image is a two dimensional array object containing data and its associated errors. It provides a similar api to cpl_image and performs linear error propagation where it makes sense.

Function Documentation

◆ hdrl_image_accept()

cpl_error_code hdrl_image_accept ( hdrl_image *  self,
cpl_size  xpos,
cpl_size  ypos 
)

mark pixel as good

Parameters
selfimage
xposx coordinate (FITS CONVENTION)
yposy coordinate (FITS CONVENTION)
See also
cpl_image_accept

Definition at line 493 of file hdrl_image.c.

References hdrl_image_get_error(), and hdrl_image_get_image().

◆ hdrl_image_accept_all()

cpl_error_code hdrl_image_accept_all ( hdrl_image *  self)

Accept all pixels in an image.

Parameters
selfinput image
See also
cpl_image_accept_all

Definition at line 508 of file hdrl_image.c.

References hdrl_image_get_error(), and hdrl_image_get_image().

◆ hdrl_image_add_image()

cpl_error_code hdrl_image_add_image ( hdrl_image *  self,
const hdrl_image *  other 
)

Add two images, store the result in the first image.

Parameters
selffirst operand.
othersecond operand.
Returns
the cpl-error-code or CPL_ERROR_NONE

The first input image is modified to contain the result of the operation.

The bad pixel map of the first image becomes the union of the bad pixel maps of the input images.

Possible cpl-error-code set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_INCOMPATIBLE_INPUT if the input images have different sizes

Definition at line 59 of file hdrl_image_math.c.

References hdrl_image_get_error(), hdrl_image_get_error_const(), hdrl_image_get_image(), and hdrl_image_get_image_const().

Referenced by hdrl_image_add_image_create(), hdrl_imagelist_add_image(), hdrl_imagelist_add_imagelist(), hdrl_spectrum1D_add_spectrum(), and hdrl_spectrum1D_add_spectrum_create().

◆ hdrl_image_add_image_create()

hdrl_image * hdrl_image_add_image_create ( const hdrl_image *  self,
const hdrl_image *  other 
)

Add two images.

Parameters
selffirst operand
othersecond operand
Returns
1 newly allocated image or NULL on error

Creates a new image, being the result of the operation, and returns it to the caller. The returned image must be deallocated using hdrl_image_delete().

The bad pixels map of the result is the union of the bad pixels maps of the input images.

Possible cpl-error-code set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_INCOMPATIBLE_INPUT if the input images have different sizes

Definition at line 89 of file hdrl_image_math.c.

References hdrl_image_add_image(), hdrl_image_delete(), and hdrl_image_duplicate().

◆ hdrl_image_add_scalar()

cpl_error_code hdrl_image_add_scalar ( hdrl_image *  self,
hdrl_value  value 
)

Elementwise addition of a scalar to an image.

Parameters
selfImage to be modified in place.
valueNumber to add
Returns
CPL_ERROR_NONE or the relevant the cpl-error-code on error

Modifies the image by adding a number to each of its pixels with error propagation.

Possible cpl-error-code set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL

Definition at line 117 of file hdrl_image_math.c.

References hdrl_image_get_error(), and hdrl_image_get_image().

Referenced by cr2res_qc_detlin(), hdrl_imagelist_add_scalar(), hdrl_spectrum1D_add_scalar(), and hdrl_spectrum1D_add_scalar_create().

◆ hdrl_image_copy()

cpl_error_code hdrl_image_copy ( hdrl_image *  dst,
const hdrl_image *  src,
cpl_size  xpos,
cpl_size  ypos 
)

Copy one image into another.

Parameters
dstthe image in which im2 is inserted
srcthe inserted image
xposthe x pixel position in im1 where the lower left pixel of im2 should go (from 1 to the x size of im1)
yposthe y pixel position in im1 where the lower left pixel of im2 should go (from 1 to the y size of im1)
Returns
CPL_ERROR_NONE or the relevant cpl_error_code on error.
See also
cpl_image_copy
Note
The two pixel buffers may not overlap

Definition at line 686 of file hdrl_image.c.

References hdrl_image_get_error(), hdrl_image_get_error_const(), hdrl_image_get_image(), and hdrl_image_get_image_const().

◆ hdrl_image_count_rejected()

cpl_size hdrl_image_count_rejected ( const hdrl_image *  self)

return number of rejected pixels

Parameters
selfimage
Returns
number of rejected pixels
See also
cpl_image_count_rejected

Definition at line 461 of file hdrl_image.c.

References hdrl_image_get_image_const().

◆ hdrl_image_create()

hdrl_image * hdrl_image_create ( const cpl_image *  image,
const cpl_image *  error 
)

create a new hdrl_image from to existing images by copying them

Parameters
imagedata to copy
errorerrors to copy
Returns
hdrl_image
Note
The bad pixel mask of the error-image (error) is completely ignored. The bad pixel mask associated with the passed image (image) becomes the only relevant bad pixel mask.

Definition at line 295 of file hdrl_image.c.

Referenced by cr2res_extract_median(), cr2res_extract_sum_tilt(), cr2res_extract_sum_vert(), cr2res_io_load_image(), cr2res_io_save_BPM(), hdrl_flat_compute(), hdrl_imagelist_create(), hdrl_maglim_compute(), and hdrl_overscan_compute().

◆ hdrl_image_delete()

void hdrl_image_delete ( hdrl_image *  himg)

◆ hdrl_image_div_image()

cpl_error_code hdrl_image_div_image ( hdrl_image *  self,
const hdrl_image *  other 
)

Divide two images, store the result in the first image.

Parameters
selffirst operand
othersecond operand
Returns
the cpl-error-code or CPL_ERROR_NONE
See also
hdrl_image_add_image()
Note
The result of division with a zero-valued pixel is marked as a bad pixel. Additionally, the value and the error are set to NAN

Possible cpl-error-code set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_INCOMPATIBLE_INPUT if the input images have different sizes

Definition at line 273 of file hdrl_image_math.c.

References hdrl_image_get_error(), hdrl_image_get_error_const(), hdrl_image_get_image(), and hdrl_image_get_image_const().

Referenced by cr2res_calib_image(), hdrl_image_div_image_create(), hdrl_imagelist_div_image(), hdrl_imagelist_div_imagelist(), hdrl_spectrum1D_div_spectrum(), and hdrl_spectrum1D_div_spectrum_create().

◆ hdrl_image_div_image_create()

hdrl_image * hdrl_image_div_image_create ( const hdrl_image *  self,
const hdrl_image *  other 
)

Divide two images and return the resulting image.

Parameters
selffirst operand
othersecond operand
Returns
1 newly allocated image or NULL on error
See also
hdrl_image_add_image_create()
Note
The result of division with a zero-valued pixel is marked as a bad pixel. Additionally, the value and the error are set to NAN

Possible cpl-error-code set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_INCOMPATIBLE_INPUT if the input images have different sizes

Definition at line 302 of file hdrl_image_math.c.

References hdrl_image_delete(), hdrl_image_div_image(), and hdrl_image_duplicate().

Referenced by cr2res_master_flat().

◆ hdrl_image_div_scalar()

cpl_error_code hdrl_image_div_scalar ( hdrl_image *  self,
hdrl_value  value 
)

Elementwise division of an image with a scalar.

Parameters
selfImage to be modified in place.
valueNon-zero number to divide with
Returns
CPL_ERROR_NONE or the relevant the cpl-error-code on error
See also
cpl_image_add_image_scalar()

Possible cpl-error-code set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL

Definition at line 329 of file hdrl_image_math.c.

References hdrl_image_get_error(), and hdrl_image_get_image().

Referenced by hdrl_fringe_compute(), hdrl_imagelist_div_scalar(), hdrl_spectrum1D_div_scalar(), and hdrl_spectrum1D_div_scalar_create().

◆ hdrl_image_dump_structure()

cpl_error_code hdrl_image_dump_structure ( const hdrl_image *  himg,
FILE *  stream 
)

Dump structural information of a HDRL image.

Parameters
himgImage to dump
streamOutput stream, accepts stdout or stderr
Returns
CPL_ERROR_NONE or the relevant cpl-error-code on error

Possible cpl-error-code set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_FILE_IO if a write operation fails

Definition at line 767 of file hdrl_image.c.

References hdrl_image_get_image_const().

Referenced by hdrl_imagelist_dump_structure().

◆ hdrl_image_dump_window()

cpl_error_code hdrl_image_dump_window ( const hdrl_image *  himg,
cpl_size  llx,
cpl_size  lly,
cpl_size  urx,
cpl_size  ury,
FILE *  stream 
)

Dump pixel values in a HDRL image.

Parameters
himgImage to dump
llxLower left x position (FITS convention, 1 for leftmost)
llyLower left y position (FITS convention, 1 for lowest)
urxSpecifies the window position
urySpecifies the window position
streamOutput stream, accepts stdout or stderr
Returns
CPL_ERROR_NONE or the relevant cpl-error-code on error

Possible cpl-error-code set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_FILE_IO if a write operation fails
  • CPL_ERROR_ACCESS_OUT_OF_RANGE if the defined window is not in the image
  • CPL_ERROR_ILLEGAL_INPUT if the window definition is wrong (e.g llx > urx)

Definition at line 793 of file hdrl_image.c.

References hdrl_image_get_image_const().

Referenced by hdrl_imagelist_dump_window().

◆ hdrl_image_exp_scalar()

cpl_error_code hdrl_image_exp_scalar ( hdrl_image *  self,
const hdrl_value  base 
)

computes the exponential of an image by a scalar

Parameters
selfinput image
basebase of the power
Returns
CPL_ERROR_NONE or the relevant the cpl-error-code on error

Definition at line 649 of file hdrl_image_math.c.

References hdrl_image_get_error(), and hdrl_image_get_image().

Referenced by hdrl_image_exp_scalar_create(), hdrl_spectrum1D_exp_scalar(), and hdrl_spectrum1D_exp_scalar_create().

◆ hdrl_image_exp_scalar_create()

hdrl_image * hdrl_image_exp_scalar_create ( const hdrl_image *  self,
const hdrl_value  base 
)

computes the exponential of an image by a scalar creating a new image

Parameters
selfinput image
basebase of the power
Returns
new image containing the powered data or NULL on error
See also
hdrl_image_pow_scalar

Definition at line 669 of file hdrl_image_math.c.

References hdrl_image_delete(), hdrl_image_duplicate(), and hdrl_image_exp_scalar().

◆ hdrl_image_extract()

hdrl_image * hdrl_image_extract ( const hdrl_image *  self,
cpl_size  llx,
cpl_size  lly,
cpl_size  urx,
cpl_size  ury 
)

extract copy of window from image

Parameters
selfimage to extract from
llxlower left x coordinate of window (FITS convention)
llylower left y coordinate of window (FITS convention)
urxupper right x coordinate of window (FITS convention)
uryupper right y coordinate of window (FITS convention)
Returns
newly allocated hdrl_image containing the window
See also
cpl_image_extract

If the coordinates are < 1 the dimension of the image is added to them. So llx = 0 wraps to hdrl_image_get_size_x(self).

Definition at line 625 of file hdrl_image.c.

References hdrl_image_get_error_const(), hdrl_image_get_image_const(), hdrl_image_get_size_x(), and hdrl_image_get_size_y().

◆ hdrl_image_get_error()

cpl_image * hdrl_image_get_error ( hdrl_image *  himg)

◆ hdrl_image_get_error_const()

const cpl_image * hdrl_image_get_error_const ( const hdrl_image *  himg)

◆ hdrl_image_get_image()

cpl_image * hdrl_image_get_image ( hdrl_image *  himg)

◆ hdrl_image_get_image_const()

const cpl_image * hdrl_image_get_image_const ( const hdrl_image *  himg)

◆ hdrl_image_get_mask()

cpl_mask * hdrl_image_get_mask ( hdrl_image *  himg)

get cpl bad pixel mask from image

Parameters
himghdrl image
Returns
cpl_mask, created when it does not exist

Definition at line 157 of file hdrl_image.c.

References hdrl_image_get_error(), and hdrl_image_get_image().

Referenced by cr2res_calib_image(), cr2res_qc_detlin(), hdrl_bpm_3d_compute(), hdrl_fit_polynomial_imagelist(), hdrl_fit_polynomial_imagelist2(), hdrl_fringe_compute(), hdrl_fringe_correct(), and hdrl_maglim_compute().

◆ hdrl_image_get_mask_const()

const cpl_mask * hdrl_image_get_mask_const ( const hdrl_image *  himg)

get cpl bad pixel mask from image

Parameters
himghdrl image
Returns
cpl_mask or NULL if no mask exists

Definition at line 175 of file hdrl_image.c.

References hdrl_image_get_image_const().

Referenced by hdrl_image_reject_from_mask(), hdrl_lacosmic_edgedetect(), hdrl_overscan_correct(), and hdrl_resample_imagelist_to_table().

◆ hdrl_image_get_mean()

hdrl_value hdrl_image_get_mean ( const hdrl_image *  self)

computes mean pixel value and associated error of an image.

Parameters
selfinput image
Returns
mean and its error in a hdrl_value structure

Definition at line 402 of file hdrl_image_math.c.

◆ hdrl_image_get_median()

hdrl_value hdrl_image_get_median ( const hdrl_image *  self)

computes the median and associated error of an image.

Parameters
selfinput image
Returns
median and its error in a hdrl_value structure

This function computes the median and the associated error of the image. For the error propagation the error is scaled by the sqrt of the statistical efficiency of the median on normal distributed data which is $ \frac{\pi}{ 2 } $

Definition at line 501 of file hdrl_image_math.c.

◆ hdrl_image_get_minmax_mean()

hdrl_value hdrl_image_get_minmax_mean ( const hdrl_image *  self,
double  nlow,
double  nhigh 
)

computes the minmax rejected mean and the associated error of an image.

Parameters
selfinput image
nlownumber of low pixels to reject
nhighnumber of high pixels to reject
Returns
minmax rejected mean and its error in a hdrl_value structure
See also
hdrl_minmax_clip() for the algorithm

Definition at line 448 of file hdrl_image_math.c.

◆ hdrl_image_get_mode()

hdrl_value hdrl_image_get_mode ( const hdrl_image *  self,
double  histo_min,
double  histo_max,
double  bin_size,
hdrl_mode_type  method,
cpl_size  error_niter 
)

computes the mode and the associated error of an image.

Parameters
selfinput image
histo_minminimum value of low pixels to use
histo_maxmaximum value of high pixels to be use
bin_sizesize of the histogram bin
methodmethod to use for the mode computation
error_niternumber of iterations to compute the error of the mode
Returns
the mode and its error in a hdrl_value structure
See also
hdrl_mode_clip() for the algorithm

Definition at line 474 of file hdrl_image_math.c.

Referenced by hdrl_maglim_compute().

◆ hdrl_image_get_pixel()

hdrl_value hdrl_image_get_pixel ( const hdrl_image *  self,
cpl_size  xpos,
cpl_size  ypos,
int *  pis_rejected 
)

get pixel values of hdrl_image

Parameters
selfimage
xposx coordinate (FITS CONVENTION)
yposy coordinate (FITS CONVENTION)
pis_rejectedint pointer to store if pixel is bad, may be NULL
Returns
data value of the pixel
See also
cpl_image_get

Definition at line 559 of file hdrl_image.c.

References hdrl_image_get_error_const(), and hdrl_image_get_image_const().

Referenced by cr2res_extract_traces(), hdrl_bpm_3d_compute(), hdrl_fit_polynomial_imagelist2(), and hdrl_spectrum1D_get_flux_value().

◆ hdrl_image_get_sigclip_mean()

hdrl_value hdrl_image_get_sigclip_mean ( const hdrl_image *  self,
double  kappa_low,
double  kappa_high,
int  niter 
)

computes the sigma-clipped mean and associated error of an image.

Parameters
selfinput image
kappa_lowlow sigma bound
kappa_highhigh sigma bound
nitermaximum number of clipping iterators
Returns
clipped mean and its error in a hdrl_value structure
See also
hdrl_kappa_sigma_clip() for the algorithm

Definition at line 425 of file hdrl_image_math.c.

◆ hdrl_image_get_size_x()

cpl_size hdrl_image_get_size_x ( const hdrl_image *  self)

◆ hdrl_image_get_size_y()

cpl_size hdrl_image_get_size_y ( const hdrl_image *  self)

◆ hdrl_image_get_sqsum()

hdrl_value hdrl_image_get_sqsum ( const hdrl_image *  self)

computes the sum of all pixel values and the error of a squared image.

Parameters
selfinput image
Returns
squared sum and its error in a hdrl_value structure

Definition at line 585 of file hdrl_image_math.c.

References hdrl_image_delete(), hdrl_image_get_sum(), and hdrl_image_pow_scalar_create().

◆ hdrl_image_get_stdev()

double hdrl_image_get_stdev ( const hdrl_image *  self)

computes the standard deviation of the data of an image

Parameters
selfinput image
Returns
CPL_ERROR_NONE or the relevant the cpl-error-code on error
See also
cpl_image_get_stdev

Definition at line 540 of file hdrl_image_math.c.

References hdrl_image_get_image_const().

Referenced by hdrl_maglim_compute().

◆ hdrl_image_get_sum()

hdrl_value hdrl_image_get_sum ( const hdrl_image *  self)

computes the sum of all pixel values and the associated error of an image.

Parameters
selfinput image
Returns
sum and its error in a hdrl_value structure

Definition at line 555 of file hdrl_image_math.c.

Referenced by hdrl_image_get_sqsum().

◆ hdrl_image_get_weighted_mean()

hdrl_value hdrl_image_get_weighted_mean ( const hdrl_image *  self)

computes the weighted mean and associated error of an image.

Parameters
selfinput image
Returns
weighted mean and its error in a hdrl_value structure

Definition at line 520 of file hdrl_image_math.c.

◆ hdrl_image_insert()

cpl_error_code hdrl_image_insert ( hdrl_image *  self,
const cpl_image *  image,
const cpl_image *  error,
cpl_size  xpos,
cpl_size  ypos 
)

Copy cpl images into an hdrl image.

Parameters
selfthe image in which the cpl images are inserted
imagethe inserted image
errorthe inserted error, may be NULL
xposthe x pixel position in im1 where the lower left pixel of im2 should go (from 1 to the x size of im1)
yposthe y pixel position in im1 where the lower left pixel of im2 should go (from 1 to the y size of im1)
Returns
CPL_ERROR_NONE or the relevant cpl_error_code on error.
See also
hdrl_image_copy
Note
The pixel buffers may not overlap

Definition at line 715 of file hdrl_image.c.

References hdrl_image_get_error(), and hdrl_image_get_image().

Referenced by cr2res_calib_image().

◆ hdrl_image_is_rejected()

int hdrl_image_is_rejected ( hdrl_image *  self,
cpl_size  xpos,
cpl_size  ypos 
)

return if pixel is marked bad

Parameters
selfimage
xposx coordinate (FITS CONVENTION)
yposy coordinate (FITS CONVENTION)
See also
cpl_image_is_rejected

Definition at line 445 of file hdrl_image.c.

References hdrl_image_get_image().

Referenced by hdrl_fit_polynomial_imagelist(), and hdrl_fit_polynomial_imagelist2().

◆ hdrl_image_mul_image()

cpl_error_code hdrl_image_mul_image ( hdrl_image *  self,
const hdrl_image *  other 
)

Multiply two images, store the result in the first image.

Parameters
selffirst operand.
othersecond operand.
Returns
the cpl-error-code or CPL_ERROR_NONE
See also
hdrl_image_add_image()

Definition at line 201 of file hdrl_image_math.c.

References hdrl_image_get_error(), hdrl_image_get_error_const(), hdrl_image_get_image(), and hdrl_image_get_image_const().

Referenced by hdrl_image_mul_image_create(), hdrl_imagelist_mul_image(), hdrl_imagelist_mul_imagelist(), hdrl_spectrum1D_mul_spectrum(), and hdrl_spectrum1D_mul_spectrum_create().

◆ hdrl_image_mul_image_create()

hdrl_image * hdrl_image_mul_image_create ( const hdrl_image *  self,
const hdrl_image *  other 
)

Multiply two images.

Parameters
selffirst operand
othersecond operand
Returns
1 newly allocated image or NULL on error
See also
hdrl_image_add_image_create()

Definition at line 222 of file hdrl_image_math.c.

References hdrl_image_delete(), hdrl_image_duplicate(), and hdrl_image_mul_image().

◆ hdrl_image_mul_scalar()

cpl_error_code hdrl_image_mul_scalar ( hdrl_image *  self,
hdrl_value  value 
)

Elementwise multiplication of an image with a scalar.

Parameters
selfImage to be modified in place.
valueNumber to multiply with
Returns
CPL_ERROR_NONE or the relevant the cpl-error-code on error
See also
hdrl_image_add_scalar()

Definition at line 245 of file hdrl_image_math.c.

References hdrl_image_get_error(), and hdrl_image_get_image().

Referenced by cr2res_calib_image(), cr2res_extract_traces(), hdrl_fringe_correct(), hdrl_imagelist_mul_scalar(), hdrl_spectrum1D_mul_scalar(), and hdrl_spectrum1D_mul_scalar_create().

◆ hdrl_image_new()

hdrl_image * hdrl_image_new ( cpl_size  nx,
cpl_size  ny 
)

create new zero filled hdrl image

Parameters
nxsize in x
nysize in y
Returns
hdrl_image or NULL on error

Definition at line 311 of file hdrl_image.c.

Referenced by cr2res_calib_image(), cr2res_extract_slitdec_curved(), cr2res_qc_detlin(), cr2res_slit_curv_compute_order_trace(), cr2res_slit_curv_gen_map(), cr2res_wave_gen_wave_map(), hdrl_fit_polynomial_imagelist(), and hdrl_fit_polynomial_imagelist2().

◆ hdrl_image_pow_scalar()

cpl_error_code hdrl_image_pow_scalar ( hdrl_image *  self,
const hdrl_value  exponent 
)

computes the power of an image by a scalar

Parameters
selfinput image
exponentexponent of the power
Returns
CPL_ERROR_NONE or the relevant the cpl-error-code on error

Definition at line 606 of file hdrl_image_math.c.

References hdrl_image_get_error(), and hdrl_image_get_image().

Referenced by hdrl_image_pow_scalar_create(), hdrl_imagelist_pow_scalar(), hdrl_spectrum1D_pow_scalar(), and hdrl_spectrum1D_pow_scalar_create().

◆ hdrl_image_pow_scalar_create()

hdrl_image * hdrl_image_pow_scalar_create ( const hdrl_image *  self,
const hdrl_value  exponent 
)

computes the power of an image by a scalar creating a new image

Parameters
selfinput image
exponentexponent of the power
Returns
new image containing the powered data or NULL on error
See also
hdrl_image_pow_scalar

Definition at line 626 of file hdrl_image_math.c.

References hdrl_image_delete(), hdrl_image_duplicate(), and hdrl_image_pow_scalar().

Referenced by hdrl_image_get_sqsum().

◆ hdrl_image_reject()

cpl_error_code hdrl_image_reject ( hdrl_image *  self,
cpl_size  xpos,
cpl_size  ypos 
)

mark pixel as bad

Parameters
selfimage
xposx coordinate (FITS CONVENTION)
yposy coordinate (FITS CONVENTION)
See also
cpl_image_reject

Definition at line 427 of file hdrl_image.c.

References hdrl_image_get_error(), and hdrl_image_get_image().

Referenced by hdrl_fit_polynomial_imagelist(), hdrl_fit_polynomial_imagelist2(), and hdrl_spectrum1D_reject_pixels().

◆ hdrl_image_reject_from_mask()

cpl_error_code hdrl_image_reject_from_mask ( hdrl_image *  self,
const cpl_mask *  map 
)

set bpm of hdrl_image

Parameters
selfimage on which to set bpm
mapbpm to set
See also
cpl_image_reject_from_mask

Definition at line 407 of file hdrl_image.c.

References hdrl_image_get_error(), hdrl_image_get_image(), and hdrl_image_get_mask_const().

Referenced by cr2res_qc_detlin(), hdrl_fringe_compute(), and hdrl_maglim_compute().

◆ hdrl_image_reject_value()

cpl_error_code hdrl_image_reject_value ( hdrl_image *  self,
cpl_value  mode 
)

Reject pixels with the specified special value(s)

Parameters
selfInput image to modify
modeBit field specifying which special value(s) to reject
See also
cpl_image_reject_value

Definition at line 477 of file hdrl_image.c.

References hdrl_image_get_image().

Referenced by cr2res_io_load_MASTER_DARK(), cr2res_io_load_MASTER_FLAT(), and cr2res_qc_detlin().

◆ hdrl_image_set_pixel()

cpl_error_code hdrl_image_set_pixel ( hdrl_image *  self,
cpl_size  xpos,
cpl_size  ypos,
hdrl_value  value 
)

set pixel values of hdrl_image

Parameters
selfimage
xposx coordinate (FITS CONVENTION)
yposy coordinate (FITS CONVENTION)
valuedata value to set

Definition at line 594 of file hdrl_image.c.

References hdrl_image_get_error(), and hdrl_image_get_image().

Referenced by cr2res_extract_traces(), hdrl_fit_polynomial_imagelist(), and hdrl_fit_polynomial_imagelist2().

◆ hdrl_image_sub_image()

cpl_error_code hdrl_image_sub_image ( hdrl_image *  self,
const hdrl_image *  other 
)

Subtract two images, store the result in the first image.

Parameters
selffirst operand.
othersecond operand.
Returns
the cpl-error-code or CPL_ERROR_NONE
See also
hdrl_image_add_image()

Definition at line 137 of file hdrl_image_math.c.

References hdrl_image_get_error(), hdrl_image_get_error_const(), hdrl_image_get_image(), and hdrl_image_get_image_const().

Referenced by cr2res_calib_image(), hdrl_fringe_correct(), hdrl_image_sub_image_create(), hdrl_imagelist_sub_image(), hdrl_imagelist_sub_imagelist(), hdrl_spectrum1D_sub_spectrum(), and hdrl_spectrum1D_sub_spectrum_create().

◆ hdrl_image_sub_image_create()

hdrl_image * hdrl_image_sub_image_create ( const hdrl_image *  self,
const hdrl_image *  other 
)

Subtract two images.

Parameters
selffirst operand
othersecond operand
Returns
1 newly allocated image or NULL on error
See also
hdrl_image_add_image_create()

Definition at line 158 of file hdrl_image_math.c.

References hdrl_image_delete(), hdrl_image_duplicate(), and hdrl_image_sub_image().

Referenced by hdrl_bpm_3d_compute().

◆ hdrl_image_sub_scalar()

cpl_error_code hdrl_image_sub_scalar ( hdrl_image *  self,
hdrl_value  value 
)

Elementwise subtraction of a scalar from an image.

Parameters
selfImage to be modified in place.
valueNumber to subtract
Returns
CPL_ERROR_NONE or the relevant the cpl-error-code on error
See also
hdrl_image_add_scalar()

Definition at line 181 of file hdrl_image_math.c.

References hdrl_image_get_error(), and hdrl_image_get_image().

Referenced by hdrl_fringe_compute(), hdrl_imagelist_sub_scalar(), hdrl_spectrum1D_sub_scalar(), and hdrl_spectrum1D_sub_scalar_create().

◆ hdrl_image_turn()

cpl_error_code hdrl_image_turn ( hdrl_image *  self,
int  rot 
)

Rotate an image by a multiple of 90 degrees clockwise.

Parameters
selfThe image to rotate in place.
rotThe multiple: -1 is a rotation of 90 deg counterclockwise.
Returns
CPL_ERROR_NONE on success, otherwise the relevant cpl_error_code
See also
cpl_image_turn

Definition at line 663 of file hdrl_image.c.

References hdrl_image_get_error(), and hdrl_image_get_image().