Common Pipeline Library Reference 7.3.2
Loading...
Searching...
No Matches
Functions
High level functions to handle apertures

Functions

void cpl_apertures_delete (cpl_apertures *self)
 Destructor for cpl_apertures.
 
void cpl_apertures_dump (const cpl_apertures *self, FILE *fp)
 Dump a cpl_apertures to an opened file pointer.
 
cpl_apertures * cpl_apertures_extract (const cpl_image *in_image, const cpl_vector *sigmas, cpl_size *pisigma)
 Simple detection of apertures in an image.
 
cpl_apertures * cpl_apertures_extract_mask (const cpl_image *in_image, const cpl_mask *selection)
 Simple apertures creation from a user supplied selection mask.
 
cpl_apertures * cpl_apertures_extract_sigma (const cpl_image *in_image, double sigma)
 Simple apertures detection in an image using a provided sigma.
 
cpl_apertures * cpl_apertures_extract_window (const cpl_image *in_image, const cpl_vector *sigmas, cpl_size llx, cpl_size lly, cpl_size urx, cpl_size ury, cpl_size *pisigma)
 Simple detection of apertures in an image window.
 
cpl_size cpl_apertures_get_bottom (const cpl_apertures *self, cpl_size ind)
 Get the bottommost y position in an aperture.
 
cpl_size cpl_apertures_get_bottom_x (const cpl_apertures *self, cpl_size ind)
 Get the x position of the bottommost y position in an aperture.
 
double cpl_apertures_get_centroid_x (const cpl_apertures *self, cpl_size ind)
 Get the X-centroid of an aperture.
 
double cpl_apertures_get_centroid_y (const cpl_apertures *self, cpl_size ind)
 Get the Y-centroid of an aperture.
 
double cpl_apertures_get_flux (const cpl_apertures *self, cpl_size ind)
 Get the flux of an aperture.
 
cpl_bivector * cpl_apertures_get_fwhm (const cpl_image *in_image, const cpl_apertures *aperts)
 Compute FWHM values in x and y for a list of apertures.
 
cpl_size cpl_apertures_get_left (const cpl_apertures *self, cpl_size ind)
 Get the leftmost x position in an aperture.
 
cpl_size cpl_apertures_get_left_y (const cpl_apertures *self, cpl_size ind)
 Get the y position of the leftmost x position in an aperture.
 
double cpl_apertures_get_max (const cpl_apertures *self, cpl_size ind)
 Get the maximum value of an aperture.
 
double cpl_apertures_get_max_x (const cpl_apertures *self, cpl_size ind)
 Get the average X-position of an aperture.
 
double cpl_apertures_get_max_y (const cpl_apertures *self, cpl_size ind)
 Get the average Y-position of an aperture.
 
cpl_size cpl_apertures_get_maxpos_x (const cpl_apertures *self, cpl_size ind)
 Get the X-position of the aperture maximum value.
 
cpl_size cpl_apertures_get_maxpos_y (const cpl_apertures *self, cpl_size ind)
 Get the Y-position of the aperture maximum value.
 
double cpl_apertures_get_mean (const cpl_apertures *self, cpl_size ind)
 Get the mean value of an aperture.
 
double cpl_apertures_get_median (const cpl_apertures *self, cpl_size ind)
 Get the median value of an aperture.
 
double cpl_apertures_get_min (const cpl_apertures *self, cpl_size ind)
 Get the minimum value of an aperture.
 
cpl_size cpl_apertures_get_minpos_x (const cpl_apertures *self, cpl_size ind)
 Get the X-position of the aperture minimum value.
 
cpl_size cpl_apertures_get_minpos_y (const cpl_apertures *self, cpl_size ind)
 Get the Y-position of the aperture minimum value.
 
cpl_size cpl_apertures_get_npix (const cpl_apertures *self, cpl_size ind)
 Get the number of pixels of an aperture.
 
double cpl_apertures_get_pos_x (const cpl_apertures *self, cpl_size ind)
 Get the average X-position of an aperture.
 
double cpl_apertures_get_pos_y (const cpl_apertures *self, cpl_size ind)
 Get the average Y-position of an aperture.
 
cpl_size cpl_apertures_get_right (const cpl_apertures *self, cpl_size ind)
 Get the rightmost x position in an aperture.
 
cpl_size cpl_apertures_get_right_y (const cpl_apertures *self, cpl_size ind)
 Get the y position of the rightmost x position in an aperture.
 
cpl_size cpl_apertures_get_size (const cpl_apertures *self)
 Get the number of apertures.
 
double cpl_apertures_get_stdev (const cpl_apertures *self, cpl_size ind)
 Get the standard deviation of an aperture.
 
cpl_size cpl_apertures_get_top (const cpl_apertures *self, cpl_size ind)
 Get the topmost y position in an aperture.
 
cpl_size cpl_apertures_get_top_x (const cpl_apertures *self, cpl_size ind)
 Get the x position of the topmost y position in an aperture.
 
cpl_apertures * cpl_apertures_new_from_image (const cpl_image *in_image, const cpl_image *lab)
 Compute statistics on selected apertures.
 
cpl_error_code cpl_apertures_sort_by_flux (cpl_apertures *self)
 Sort by decreasing aperture flux.
 
cpl_error_code cpl_apertures_sort_by_max (cpl_apertures *self)
 Sort by decreasing aperture peak value.
 
cpl_error_code cpl_apertures_sort_by_npix (cpl_apertures *self)
 Sort by decreasing aperture size.
 

Detailed Description

The aperture object contains a list of zones in an image. It is typically used to contain the results of an objects detection, or if one wants to work on a very specific zone in an image.

This module provides functions to handle cpl_apertures.

Function Documentation

◆ cpl_apertures_delete()

void cpl_apertures_delete ( cpl_apertures *  self)

Destructor for cpl_apertures.

Parameters
selfThe object to delete.
Returns
void
Note
If self is NULL, nothing is done and no error is set.

This function deallocates all memory allocated for the object.

References cpl_free().

Referenced by cpl_apertures_sort_by_flux(), cpl_apertures_sort_by_max(), cpl_apertures_sort_by_npix(), and cpl_geom_img_offset_combine().

◆ cpl_apertures_dump()

void cpl_apertures_dump ( const cpl_apertures *  self,
FILE *  fp 
)

Dump a cpl_apertures to an opened file pointer.

Parameters
selfThe cpl_apertures to dump
fpFile pointer, may use stdout or stderr
Returns
void

This function dumps all information in a cpl_apertures to the passed file pointer. If the object is unallocated or contains nothing, this function does nothing.

References CPL_SIZE_FORMAT.

◆ cpl_apertures_extract()

cpl_apertures * cpl_apertures_extract ( const cpl_image *  in_image,
const cpl_vector *  sigmas,
cpl_size pisigma 
)

Simple detection of apertures in an image.

Parameters
in_imageThe image to process
sigmasPositive, decreasing sigmas to apply
pisigmaIndex of the sigma that was used or unchanged on error
Returns
The detected apertures or NULL on error
See also
cpl_apertures_extract_sigma()

pisigma may be NULL.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if self or sigmas is NULL
  • CPL_ERROR_DATA_NOT_FOUND if the apertures cannot be detected

References cpl_apertures_extract_sigma(), cpl_ensure, CPL_ERROR_DATA_NOT_FOUND, CPL_ERROR_NULL_INPUT, cpl_errorstate_get(), cpl_errorstate_set(), cpl_vector_get(), and cpl_vector_get_size().

Referenced by cpl_apertures_extract_window(), and cpl_geom_img_offset_combine().

◆ cpl_apertures_extract_mask()

cpl_apertures * cpl_apertures_extract_mask ( const cpl_image *  in_image,
const cpl_mask *  selection 
)

Simple apertures creation from a user supplied selection mask.

Parameters
in_imageThe image to process
selectionThe mask of selected pixels
Returns
The list of detected apertures or NULL if nothing detected or on error.
See also
cpl_image_labelise_mask_create(), cpl_apertures_new_from_image()

The values selected for inclusion in the apertures must have the non-zero value in the selection mask, and must not be flagged as bad in the bad pixel map of the image.

The input image type can be CPL_TYPE_DOUBLE, CPL_TYPE_FLOAT or CPL_TYPE_INT.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_INCOMPATIBLE_INPUT if self and selection have different sizes.
  • CPL_ERROR_TYPE_MISMATCH if self is of a complex type
  • CPL_ERROR_DATA_NOT_FOUND if the selection mask is empty

References CPL_ERROR_DATA_NOT_FOUND, cpl_errorstate_get(), cpl_errorstate_is_equal(), cpl_image_delete(), and cpl_image_labelise_mask_create().

Referenced by cpl_apertures_extract_sigma().

◆ cpl_apertures_extract_sigma()

cpl_apertures * cpl_apertures_extract_sigma ( const cpl_image *  in_image,
double  sigma 
)

Simple apertures detection in an image using a provided sigma.

Parameters
in_imageThe image to process
sigmaDetection level
Returns
The list of detected apertures or NULL on error
Note
In order to avoid (the potentially many) detections of small objects the mask of detected pixels is subjected to a 3x3 morphological opening filter.
See also
cpl_apertures_extract_mask(), cpl_mask_filter()

The threshold used for the detection is the median plus the average distance to the median times sigma.

The input image type can be CPL_TYPE_DOUBLE, CPL_TYPE_FLOAT or CPL_TYPE_INT.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_ILLEGAL_INPUT if sigma is non-positive
  • CPL_ERROR_TYPE_MISMATCH if self is of a complex type
  • CPL_ERROR_DATA_NOT_FOUND if the no apertures are found

References cpl_apertures_extract_mask(), CPL_BORDER_ZERO, cpl_ensure, CPL_ERROR_ILLEGAL_INPUT, CPL_ERROR_NULL_INPUT, CPL_FILTER_OPENING, cpl_image_get_median_dev(), cpl_mask_delete(), cpl_mask_filter(), cpl_mask_new(), cpl_mask_not(), and cpl_mask_threshold_image_create().

Referenced by cpl_apertures_extract().

◆ cpl_apertures_extract_window()

cpl_apertures * cpl_apertures_extract_window ( const cpl_image *  in_image,
const cpl_vector *  sigmas,
cpl_size  llx,
cpl_size  lly,
cpl_size  urx,
cpl_size  ury,
cpl_size pisigma 
)

Simple detection of apertures in an image window.

Parameters
in_imageThe image to process
sigmasPositive, decreasing sigmas to apply
llxLower left x position (FITS convention)
llyLower left y position (FITS convention)
urxUpper right x position (FITS convention)
uryUpper right y position (FITS convention)
pisigmaIndex of the sigma that was used or undefined on error
Returns
The list of detected apertures or NULL on error
See also
cpl_apertures_extract()
cpl_image_extract()

References cpl_apertures_extract(), cpl_ensure, cpl_error_get_code(), CPL_ERROR_NULL_INPUT, cpl_image_delete(), and cpl_image_extract().

◆ cpl_apertures_get_bottom()

cpl_size cpl_apertures_get_bottom ( const cpl_apertures *  self,
cpl_size  ind 
)

Get the bottommost y position in an aperture.

Parameters
selfThe cpl_apertures object
indThe aperture index (1 for the first one)
Returns
the bottommost y position in the aperture or negative on error
Note
In case of an error the _cpl_error_code_ code is set
See also
cpl_apertures_get_maxpos_x()

References cpl_ensure, CPL_ERROR_ACCESS_OUT_OF_RANGE, CPL_ERROR_ILLEGAL_INPUT, and CPL_ERROR_NULL_INPUT.

◆ cpl_apertures_get_bottom_x()

cpl_size cpl_apertures_get_bottom_x ( const cpl_apertures *  self,
cpl_size  ind 
)

Get the x position of the bottommost y position in an aperture.

Parameters
selfThe cpl_apertures object
indThe aperture index (1 for the first one)
Returns
the bottommost x position of the aperture or negative on error
Note
An aperture may have multiple bottom x positions, in which case one of these is returned.
See also
cpl_apertures_get_maxpos_x()

References cpl_ensure, CPL_ERROR_ACCESS_OUT_OF_RANGE, CPL_ERROR_ILLEGAL_INPUT, and CPL_ERROR_NULL_INPUT.

◆ cpl_apertures_get_centroid_x()

double cpl_apertures_get_centroid_x ( const cpl_apertures *  self,
cpl_size  ind 
)

Get the X-centroid of an aperture.

Parameters
selfThe cpl_apertures object
indThe aperture index (1 for the first one)
Returns
The X-centroid position of the aperture or negative on error
Note
In case of an error the _cpl_error_code_ code is set

For a concave aperture the centroid may not belong to the aperture.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_ILLEGAL_INPUT if ind is non-positive
  • CPL_ERROR_ACCESS_OUT_OF_RANGE if ind exceeds the number of apertures in self

References cpl_ensure, CPL_ERROR_ACCESS_OUT_OF_RANGE, CPL_ERROR_ILLEGAL_INPUT, and CPL_ERROR_NULL_INPUT.

◆ cpl_apertures_get_centroid_y()

double cpl_apertures_get_centroid_y ( const cpl_apertures *  self,
cpl_size  ind 
)

Get the Y-centroid of an aperture.

Parameters
selfThe cpl_apertures object
indThe aperture index (1 for the first one)
Returns
The X-centroid position of the aperture or negative on error
Note
In case of an error the _cpl_error_code_ code is set
See also
cpl_apertures_get_centroid_x()

References cpl_ensure, CPL_ERROR_ACCESS_OUT_OF_RANGE, CPL_ERROR_ILLEGAL_INPUT, and CPL_ERROR_NULL_INPUT.

◆ cpl_apertures_get_flux()

double cpl_apertures_get_flux ( const cpl_apertures *  self,
cpl_size  ind 
)

Get the flux of an aperture.

Parameters
selfThe cpl_apertures object
indThe aperture index (1 for the first one)
Returns
The flux of the aperture or undefined on error
See also
cpl_apertures_get_max()

References cpl_ensure, CPL_ERROR_ACCESS_OUT_OF_RANGE, CPL_ERROR_ILLEGAL_INPUT, and CPL_ERROR_NULL_INPUT.

◆ cpl_apertures_get_fwhm()

cpl_bivector * cpl_apertures_get_fwhm ( const cpl_image *  in_image,
const cpl_apertures *  aperts 
)

Compute FWHM values in x and y for a list of apertures.

Parameters
in_imageThe image to process
apertsThe list of apertures
Returns
A newly allocated object containing the fwhms in x and y or NULL
See also
cpl_image_get_fwhm()
Deprecated:
Replace this call with a loop over cpl_image_get_fwhm()

References cpl_apertures_get_pos_x(), cpl_apertures_get_pos_y(), cpl_apertures_get_size(), cpl_bivector_delete(), cpl_bivector_get_x_data(), cpl_bivector_get_y_data(), cpl_bivector_new(), cpl_ensure, CPL_ERROR_DATA_NOT_FOUND, CPL_ERROR_ILLEGAL_INPUT, CPL_ERROR_NULL_INPUT, cpl_errorstate_get(), cpl_errorstate_set(), and cpl_image_get_fwhm().

◆ cpl_apertures_get_left()

cpl_size cpl_apertures_get_left ( const cpl_apertures *  self,
cpl_size  ind 
)

Get the leftmost x position in an aperture.

Parameters
selfThe cpl_apertures object
indThe aperture index (1 for the first one)
Returns
the leftmost x position of the aperture or negative on error
Note
In case of an error the _cpl_error_code_ code is set
See also
cpl_apertures_get_maxpos_x()

References cpl_ensure, CPL_ERROR_ACCESS_OUT_OF_RANGE, CPL_ERROR_ILLEGAL_INPUT, and CPL_ERROR_NULL_INPUT.

◆ cpl_apertures_get_left_y()

cpl_size cpl_apertures_get_left_y ( const cpl_apertures *  self,
cpl_size  ind 
)

Get the y position of the leftmost x position in an aperture.

Parameters
selfThe cpl_apertures object
indThe aperture index (1 for the first one)
Returns
the y position of the leftmost x position or negative on error
Note
An aperture may have multiple leftmost x positions, in which case one of these is returned.
See also
cpl_apertures_get_maxpos_x()

References cpl_ensure, CPL_ERROR_ACCESS_OUT_OF_RANGE, CPL_ERROR_ILLEGAL_INPUT, and CPL_ERROR_NULL_INPUT.

◆ cpl_apertures_get_max()

double cpl_apertures_get_max ( const cpl_apertures *  self,
cpl_size  ind 
)

Get the maximum value of an aperture.

Parameters
selfThe cpl_apertures object
indThe aperture index (1 for the first one)
Returns
The maximum value of the aperture or undefined on error
Note
In case of an error the _cpl_error_code_ code is set

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_ILLEGAL_INPUT if ind is non-positive
  • CPL_ERROR_ACCESS_OUT_OF_RANGE if ind exceeds the number of apertures in self

References cpl_ensure, CPL_ERROR_ACCESS_OUT_OF_RANGE, CPL_ERROR_ILLEGAL_INPUT, and CPL_ERROR_NULL_INPUT.

◆ cpl_apertures_get_max_x()

double cpl_apertures_get_max_x ( const cpl_apertures *  self,
cpl_size  ind 
)

Get the average X-position of an aperture.

Parameters
selfThe cpl_apertures object
indThe aperture index (1 for the first one)
Returns
The average X-position of the aperture or negative on error
Deprecated:
Replace this function with cpl_apertures_get_pos_x()

References cpl_apertures_get_pos_x().

◆ cpl_apertures_get_max_y()

double cpl_apertures_get_max_y ( const cpl_apertures *  self,
cpl_size  ind 
)

Get the average Y-position of an aperture.

Parameters
selfThe cpl_apertures object
indThe aperture index (1 for the first one)
Returns
The average Y-position of the aperture or negative on error
Deprecated:
Replace this function with cpl_apertures_get_pos_y()

References cpl_apertures_get_pos_y().

◆ cpl_apertures_get_maxpos_x()

cpl_size cpl_apertures_get_maxpos_x ( const cpl_apertures *  self,
cpl_size  ind 
)

Get the X-position of the aperture maximum value.

Parameters
selfThe cpl_apertures object
indThe aperture index (1 for the first one)
Returns
The X-position of the aperture maximum value or negative on error
Note
In case of an error the _cpl_error_code_ code is set
See also
cpl_apertures_get_centroid_x()

References cpl_ensure, CPL_ERROR_ACCESS_OUT_OF_RANGE, CPL_ERROR_ILLEGAL_INPUT, and CPL_ERROR_NULL_INPUT.

◆ cpl_apertures_get_maxpos_y()

cpl_size cpl_apertures_get_maxpos_y ( const cpl_apertures *  self,
cpl_size  ind 
)

Get the Y-position of the aperture maximum value.

Parameters
selfThe cpl_apertures object
indThe aperture index (1 for the first one)
Returns
The Y-position of the aperture maximum value or negative on error
Note
In case of an error the _cpl_error_code_ code is set
See also
cpl_apertures_get_maxpos_x()

References cpl_ensure, CPL_ERROR_ACCESS_OUT_OF_RANGE, CPL_ERROR_ILLEGAL_INPUT, and CPL_ERROR_NULL_INPUT.

◆ cpl_apertures_get_mean()

double cpl_apertures_get_mean ( const cpl_apertures *  self,
cpl_size  ind 
)

Get the mean value of an aperture.

Parameters
selfThe cpl_apertures object
indThe aperture index (1 for the first one)
Returns
The mean value of the aperture or undefined on error
See also
cpl_apertures_get_max()

References cpl_ensure, CPL_ERROR_ACCESS_OUT_OF_RANGE, CPL_ERROR_ILLEGAL_INPUT, and CPL_ERROR_NULL_INPUT.

◆ cpl_apertures_get_median()

double cpl_apertures_get_median ( const cpl_apertures *  self,
cpl_size  ind 
)

Get the median value of an aperture.

Parameters
selfThe cpl_apertures object
indThe aperture index (1 for the first one)
Returns
The median value of the aperture or undefined on error
See also
cpl_apertures_get_max()

References cpl_ensure, CPL_ERROR_ACCESS_OUT_OF_RANGE, CPL_ERROR_ILLEGAL_INPUT, and CPL_ERROR_NULL_INPUT.

◆ cpl_apertures_get_min()

double cpl_apertures_get_min ( const cpl_apertures *  self,
cpl_size  ind 
)

Get the minimum value of an aperture.

Parameters
selfThe cpl_apertures object
indThe aperture index (1 for the first one)
Returns
The minimum value of the aperture or undefined on error
See also
cpl_apertures_get_max()

References cpl_ensure, CPL_ERROR_ACCESS_OUT_OF_RANGE, CPL_ERROR_ILLEGAL_INPUT, and CPL_ERROR_NULL_INPUT.

◆ cpl_apertures_get_minpos_x()

cpl_size cpl_apertures_get_minpos_x ( const cpl_apertures *  self,
cpl_size  ind 
)

Get the X-position of the aperture minimum value.

Parameters
selfThe cpl_apertures object
indThe aperture index (1 for the first one)
Returns
The X-position of the aperture minimum value or negative on error
Note
In case of an error the _cpl_error_code_ code is set
See also
cpl_apertures_get_maxpos_x()

References cpl_ensure, CPL_ERROR_ACCESS_OUT_OF_RANGE, CPL_ERROR_ILLEGAL_INPUT, and CPL_ERROR_NULL_INPUT.

◆ cpl_apertures_get_minpos_y()

cpl_size cpl_apertures_get_minpos_y ( const cpl_apertures *  self,
cpl_size  ind 
)

Get the Y-position of the aperture minimum value.

Parameters
selfThe cpl_apertures object
indThe aperture index (1 for the first one)
Returns
The Y-position of the aperture minimum value or negative on error
Note
In case of an error the _cpl_error_code_ code is set
See also
cpl_apertures_get_minpos_x()

References cpl_ensure, CPL_ERROR_ACCESS_OUT_OF_RANGE, CPL_ERROR_ILLEGAL_INPUT, and CPL_ERROR_NULL_INPUT.

◆ cpl_apertures_get_npix()

cpl_size cpl_apertures_get_npix ( const cpl_apertures *  self,
cpl_size  ind 
)

Get the number of pixels of an aperture.

Parameters
selfThe cpl_apertures object
indThe aperture index (1 for the first one)
Returns
The number of pixels of the aperture or negative on error
Note
In case of an error the _cpl_error_code_ code is set

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_ILLEGAL_INPUT if ind is non-positive
  • CPL_ERROR_ACCESS_OUT_OF_RANGE if ind exceeds the number of apertures in self

References cpl_ensure, CPL_ERROR_ACCESS_OUT_OF_RANGE, CPL_ERROR_ILLEGAL_INPUT, and CPL_ERROR_NULL_INPUT.

◆ cpl_apertures_get_pos_x()

double cpl_apertures_get_pos_x ( const cpl_apertures *  self,
cpl_size  ind 
)

Get the average X-position of an aperture.

Parameters
selfThe cpl_apertures object
indThe aperture index (1 for the first one)
Returns
The average X-position of the aperture or negative on error
Note
In case of an error the _cpl_error_code_ code is set
See also
cpl_apertures_get_centroid_x()

References cpl_ensure, CPL_ERROR_ACCESS_OUT_OF_RANGE, CPL_ERROR_ILLEGAL_INPUT, and CPL_ERROR_NULL_INPUT.

Referenced by cpl_apertures_get_fwhm(), cpl_apertures_get_max_x(), and cpl_geom_img_offset_combine().

◆ cpl_apertures_get_pos_y()

double cpl_apertures_get_pos_y ( const cpl_apertures *  self,
cpl_size  ind 
)

Get the average Y-position of an aperture.

Parameters
selfThe cpl_apertures object
indThe aperture index (1 for the first one)
Returns
The average Y-position of the aperture or negative on error
See also
cpl_apertures_get_pos_x()

References cpl_ensure, CPL_ERROR_ACCESS_OUT_OF_RANGE, CPL_ERROR_ILLEGAL_INPUT, and CPL_ERROR_NULL_INPUT.

Referenced by cpl_apertures_get_fwhm(), cpl_apertures_get_max_y(), and cpl_geom_img_offset_combine().

◆ cpl_apertures_get_right()

cpl_size cpl_apertures_get_right ( const cpl_apertures *  self,
cpl_size  ind 
)

Get the rightmost x position in an aperture.

Parameters
selfThe cpl_apertures object
indThe aperture index (1 for the first one)
Returns
the rightmost x position in an aperture or negative on error
Note
In case of an error the _cpl_error_code_ code is set
See also
cpl_apertures_get_maxpos_x()

References cpl_ensure, CPL_ERROR_ACCESS_OUT_OF_RANGE, CPL_ERROR_ILLEGAL_INPUT, and CPL_ERROR_NULL_INPUT.

◆ cpl_apertures_get_right_y()

cpl_size cpl_apertures_get_right_y ( const cpl_apertures *  self,
cpl_size  ind 
)

Get the y position of the rightmost x position in an aperture.

Parameters
selfThe cpl_apertures object
indThe aperture index (1 for the first one)
Returns
the y position of the rightmost x position or negative on error
Note
An aperture may have multiple rightmost x positions, in which case one of these is returned.
See also
cpl_apertures_get_maxpos_x()

References cpl_ensure, CPL_ERROR_ACCESS_OUT_OF_RANGE, CPL_ERROR_ILLEGAL_INPUT, and CPL_ERROR_NULL_INPUT.

◆ cpl_apertures_get_size()

cpl_size cpl_apertures_get_size ( const cpl_apertures *  self)

Get the number of apertures.

Parameters
selfThe cpl_apertures object
Returns
The number of apertures or -1 on error

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL

References cpl_ensure, and CPL_ERROR_NULL_INPUT.

Referenced by cpl_apertures_get_fwhm().

◆ cpl_apertures_get_stdev()

double cpl_apertures_get_stdev ( const cpl_apertures *  self,
cpl_size  ind 
)

Get the standard deviation of an aperture.

Parameters
selfThe cpl_apertures object
indThe aperture index (1 for the first one)
Returns
The standard deviation of the aperture or negative on error
See also
cpl_apertures_get_max()

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_ILLEGAL_INPUT if ind is non-positive
  • CPL_ERROR_ACCESS_OUT_OF_RANGE if ind exceeds the number of apertures in self
  • CPL_ERROR_DATA_NOT_FOUND if the aperture comprises less than two pixels

References cpl_ensure, CPL_ERROR_ACCESS_OUT_OF_RANGE, CPL_ERROR_DATA_NOT_FOUND, CPL_ERROR_ILLEGAL_INPUT, and CPL_ERROR_NULL_INPUT.

◆ cpl_apertures_get_top()

cpl_size cpl_apertures_get_top ( const cpl_apertures *  self,
cpl_size  ind 
)

Get the topmost y position in an aperture.

Parameters
selfThe cpl_apertures object
indThe aperture index (1 for the first one)
Returns
the topmost y position in the aperture or negative on error
Note
In case of an error the _cpl_error_code_ code is set
See also
cpl_apertures_get_maxpos_x()

References cpl_ensure, CPL_ERROR_ACCESS_OUT_OF_RANGE, CPL_ERROR_ILLEGAL_INPUT, and CPL_ERROR_NULL_INPUT.

◆ cpl_apertures_get_top_x()

cpl_size cpl_apertures_get_top_x ( const cpl_apertures *  self,
cpl_size  ind 
)

Get the x position of the topmost y position in an aperture.

Parameters
selfThe cpl_apertures object
indThe aperture index (1 for the first one)
Returns
the x position of the topmost y position or negative on error
Note
An aperture may have multiple topmost x positions, in which case one of these is returned.
See also
cpl_apertures_get_maxpos_x()

References cpl_ensure, CPL_ERROR_ACCESS_OUT_OF_RANGE, CPL_ERROR_ILLEGAL_INPUT, and CPL_ERROR_NULL_INPUT.

◆ cpl_apertures_new_from_image()

cpl_apertures * cpl_apertures_new_from_image ( const cpl_image *  in_image,
const cpl_image *  lab 
)

Compute statistics on selected apertures.

Parameters
in_imageReference image
labLabelized image (of type CPL_TYPE_INT)
Returns
An CPL apertures object or NULL on error
Note
The returned object must be deleted using cpl_apertures_delete().
See also
cpl_image_labelise_mask_create()

The labelized image must contain at least one pixel for each value from 1 to the maximum value in the image.

For the centroiding computation of an aperture, if some pixels have values lower or equal to 0, all the values of the aperture are locally shifted such as the minimum value of the aperture has a value of epsilon. The centroid is then computed on these positive values. In principle, centroid should always be computed on positive values, this is done to avoid raising an error in case the caller of the function wants to use it on negative values images without caring about the centroid results. In such cases, the centroid result would be meaningful, but slightly depend on the hardcoded value chosen for epsilon (1e-10).

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL
  • CPL_ERROR_TYPE_MISMATCH if lab is not of type CPL_TYPE_INT or if self is of a complex type
  • CPL_ERROR_ILLEGAL_INPUT if lab has a negative value or zero maximum
  • CPL_ERROR_INCOMPATIBLE_INPUT if lab and self have different sizes.
  • CPL_ERROR_DATA_NOT_FOUND if one of the lab values is missing.

◆ cpl_apertures_sort_by_flux()

cpl_error_code cpl_apertures_sort_by_flux ( cpl_apertures *  self)

Sort by decreasing aperture flux.

Parameters
selfApertures to sort (MODIFIED)
Returns
the _cpl_error_code_ or CPL_ERROR_NONE
See also
cpl_apertures_sort_by_npix()

References cpl_apertures_delete(), cpl_calloc(), cpl_ensure_code, CPL_ERROR_NONE, CPL_ERROR_NULL_INPUT, cpl_free(), and cpl_malloc().

◆ cpl_apertures_sort_by_max()

cpl_error_code cpl_apertures_sort_by_max ( cpl_apertures *  self)

Sort by decreasing aperture peak value.

Parameters
selfApertures to sort (MODIFIED)
Returns
the _cpl_error_code_ or CPL_ERROR_NONE
See also
cpl_apertures_sort_by_npix()

References cpl_apertures_delete(), cpl_calloc(), cpl_ensure_code, CPL_ERROR_NONE, CPL_ERROR_NULL_INPUT, cpl_free(), and cpl_malloc().

◆ cpl_apertures_sort_by_npix()

cpl_error_code cpl_apertures_sort_by_npix ( cpl_apertures *  self)

Sort by decreasing aperture size.

Parameters
selfApertures to sort (MODIFIED)
Returns
CPL_ERROR_NONE or the relevant _cpl_error_code_

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT if an input pointer is NULL

References cpl_apertures_delete(), cpl_calloc(), cpl_ensure_code, CPL_ERROR_NONE, CPL_ERROR_NULL_INPUT, cpl_free(), and cpl_malloc().

Referenced by cpl_geom_img_offset_combine().