Common Pipeline Library Reference 7.3.2
|
cpl_error_code | cpl_imagelist_add (cpl_imagelist *in1, const cpl_imagelist *in2) |
Add two image lists, the first one is replaced by the result. | |
cpl_error_code | cpl_imagelist_subtract (cpl_imagelist *in1, const cpl_imagelist *in2) |
Subtract two image lists, the first one is replaced by the result. | |
cpl_error_code | cpl_imagelist_multiply (cpl_imagelist *in1, const cpl_imagelist *in2) |
Multiply two image lists, the first one is replaced by the result. | |
cpl_error_code | cpl_imagelist_divide (cpl_imagelist *in1, const cpl_imagelist *in2) |
Divide two image lists, the first one is replaced by the result. | |
cpl_error_code | cpl_imagelist_add_image (cpl_imagelist *imlist, const cpl_image *img) |
Add an image to an image list. | |
cpl_error_code | cpl_imagelist_subtract_image (cpl_imagelist *imlist, const cpl_image *img) |
Subtract an image from an image list. | |
cpl_error_code | cpl_imagelist_multiply_image (cpl_imagelist *imlist, const cpl_image *img) |
Multiply an image list by an image. | |
cpl_error_code | cpl_imagelist_divide_image (cpl_imagelist *imlist, const cpl_image *img) |
Divide an image list by an image. | |
cpl_error_code | cpl_imagelist_add_scalar (cpl_imagelist *imlist, double addend) |
Elementwise addition of a scalar to each image in the imlist. | |
cpl_error_code | cpl_imagelist_subtract_scalar (cpl_imagelist *imlist, double subtrahend) |
Elementwise subtraction of a scalar from each image in the imlist. | |
cpl_error_code | cpl_imagelist_multiply_scalar (cpl_imagelist *imlist, double factor) |
Elementwise multiplication of the imlist with a scalar. | |
cpl_error_code | cpl_imagelist_divide_scalar (cpl_imagelist *imlist, double divisor) |
Elementwise division of each image in the imlist with a scalar. | |
cpl_error_code | cpl_imagelist_logarithm (cpl_imagelist *imlist, double base) |
Compute the elementwise logarithm of each image in the imlist. | |
cpl_error_code | cpl_imagelist_exponential (cpl_imagelist *imlist, double base) |
Compute the elementwise exponential of each image in the imlist. | |
cpl_error_code | cpl_imagelist_power (cpl_imagelist *imlist, double exponent) |
Compute the elementwise power of each image in the imlist. | |
cpl_error_code | cpl_imagelist_normalise (cpl_imagelist *imlist, cpl_norm mode) |
Normalize each image in the list. | |
cpl_error_code | cpl_imagelist_threshold (cpl_imagelist *imlist, double lo_cut, double hi_cut, double assign_lo_cut, double assign_hi_cut) |
Threshold all pixel values to an interval. | |
cpl_image * | cpl_image_new_from_accepted (const cpl_imagelist *imlist) |
Create a contribution map from the bad pixel maps of the images. | |
cpl_image * | cpl_imagelist_collapse_create (const cpl_imagelist *imlist) |
Average an imagelist to a single image. | |
cpl_image * | cpl_imagelist_collapse_minmax_create (const cpl_imagelist *self, cpl_size nlow, cpl_size nhigh) |
Average with rejection an imagelist to a single image. | |
cpl_image * | cpl_imagelist_collapse_sigclip_create (const cpl_imagelist *self, double kappalow, double kappahigh, double keepfrac, cpl_collapse_mode mode, cpl_image *contrib) |
Collapse an imagelist with kappa-sigma-clipping rejection. | |
cpl_image * | cpl_imagelist_collapse_median_create (const cpl_imagelist *self) |
Create a median image from the input imagelist. | |
cpl_imagelist * | cpl_imagelist_swap_axis_create (const cpl_imagelist *ilist, cpl_swap_axis mode) |
Swap the axis of an image list. | |
cpl_imagelist * | cpl_imagelist_new (void) |
Create an empty imagelist. | |
cpl_imagelist * | cpl_imagelist_load (const char *filename, cpl_type im_type, cpl_size xtnum) |
Load a FITS file extension into a list of images. | |
cpl_imagelist * | cpl_imagelist_load_window (const char *filename, cpl_type im_type, cpl_size xtnum, cpl_size llx, cpl_size lly, cpl_size urx, cpl_size ury) |
Load images windows from a FITS file extension into an image list. | |
cpl_size | cpl_imagelist_get_size (const cpl_imagelist *imlist) |
Get the number of images in the imagelist. | |
cpl_image * | cpl_imagelist_get (cpl_imagelist *imlist, cpl_size inum) |
Get an image from a list of images. | |
const cpl_image * | cpl_imagelist_get_const (const cpl_imagelist *imlist, cpl_size inum) |
Get an image from a list of images. | |
cpl_error_code | cpl_imagelist_set (cpl_imagelist *self, cpl_image *im, cpl_size pos) |
Insert an image into an imagelist. | |
cpl_image * | cpl_imagelist_unset (cpl_imagelist *self, cpl_size pos) |
Remove an image from an imagelist. | |
void | cpl_imagelist_empty (cpl_imagelist *self) |
Empty an imagelist and deallocate all its images. | |
void | cpl_imagelist_unwrap (cpl_imagelist *self) |
Free memory used by a cpl_imagelist object, except the images. | |
void | cpl_imagelist_delete (cpl_imagelist *self) |
Free all memory used by a cpl_imagelist object including the images. | |
cpl_error_code | cpl_imagelist_cast (cpl_imagelist *self, const cpl_imagelist *other, cpl_type type) |
Cast an imagelist, optionally in-place. | |
cpl_imagelist * | cpl_imagelist_duplicate (const cpl_imagelist *imlist) |
Copy an image list. | |
cpl_error_code | cpl_imagelist_erase (cpl_imagelist *imlist, const cpl_vector *valid) |
Reject one or more images in a list according to an array of flags. | |
cpl_error_code | cpl_imagelist_save (const cpl_imagelist *self, const char *filename, cpl_type type, const cpl_propertylist *plist, unsigned mode) |
Save an imagelist to disk in FITS format. | |
int | cpl_imagelist_is_uniform (const cpl_imagelist *imlist) |
Determine if an imagelist contains images of equal size and type. | |
cpl_error_code | cpl_imagelist_dump_structure (const cpl_imagelist *self, FILE *stream) |
Dump structural information of images in an imagelist. | |
cpl_error_code | cpl_imagelist_dump_window (const cpl_imagelist *self, cpl_size llx, cpl_size lly, cpl_size urx, cpl_size ury, FILE *stream) |
Dump pixel values of images in a CPL imagelist. | |
This module provides functions to create, use, and destroy a cpl_imagelist. A cpl_imagelist is an ordered list of cpl_images. All images in a list must have the same pixel-type and the same dimensions. It is allowed to insert the same image into different positions in the list. Different images in the list are allowed to share the same bad pixel map.
cpl_image * cpl_image_new_from_accepted | ( | const cpl_imagelist * | imlist | ) |
Create a contribution map from the bad pixel maps of the images.
imlist | The imagelist |
The returned map counts for each pixel the number of good pixels in the list. The returned map has to be deallocated with cpl_image_delete().
Possible _cpl_error_code_ set in this function:
References cpl_ensure, CPL_ERROR_ILLEGAL_INPUT, CPL_ERROR_NULL_INPUT, cpl_image_add_scalar(), cpl_image_get_bpm_const(), cpl_image_get_size_x(), cpl_image_get_size_y(), cpl_image_new(), cpl_imagelist_get_const(), cpl_imagelist_get_size(), cpl_imagelist_is_uniform(), and CPL_TYPE_INT.
Referenced by cpl_imagelist_collapse_create().
cpl_error_code cpl_imagelist_add | ( | cpl_imagelist * | in1, |
const cpl_imagelist * | in2 | ||
) |
Add two image lists, the first one is replaced by the result.
in1 | first input image list (modified) |
in2 | image list to add |
The two input lists must have the same size, the image number n in the list in2 is added to the image number n in the list in1.
Possible _cpl_error_code_ set in this function:
cpl_error_code cpl_imagelist_add_image | ( | cpl_imagelist * | imlist, |
const cpl_image * | img | ||
) |
Add an image to an image list.
imlist | input image list (modified) |
img | image to add |
The passed image is added to each image of the passed image list.
Possible _cpl_error_code_ set in this function:
cpl_error_code cpl_imagelist_add_scalar | ( | cpl_imagelist * | imlist, |
double | addend | ||
) |
Elementwise addition of a scalar to each image in the imlist.
imlist | Imagelist to be modified in place. |
addend | Number to add |
Possible _cpl_error_code_ set in this function:
References cpl_ensure_code, cpl_error_get_code(), CPL_ERROR_NONE, CPL_ERROR_NULL_INPUT, and cpl_image_add_scalar().
cpl_error_code cpl_imagelist_cast | ( | cpl_imagelist * | self, |
const cpl_imagelist * | other, | ||
cpl_type | type | ||
) |
Cast an imagelist, optionally in-place.
self | Destination imagelist |
other | Source imagelist, or NULL to cast in-place |
type | If called with empty self, cast to this pixel-type |
Possible _cpl_error_code_ set in this function:
References CPL_ERROR_INCOMPATIBLE_INPUT, CPL_ERROR_NONE, CPL_ERROR_NULL_INPUT, cpl_free(), cpl_image_cast(), cpl_image_delete(), cpl_image_get_bpm_const(), cpl_image_get_type(), cpl_image_unset_bpm(), cpl_imagelist_delete(), cpl_imagelist_get_const(), cpl_imagelist_get_size(), cpl_imagelist_new(), cpl_imagelist_set(), cpl_imagelist_unset(), and cpl_malloc().
cpl_image * cpl_imagelist_collapse_create | ( | const cpl_imagelist * | imlist | ) |
Average an imagelist to a single image.
imlist | the input images list |
The returned image has to be deallocated with cpl_image_delete().
The bad pixel maps of the images in the input list are taken into account, the result image pixels are flagged as rejected for those where there were no good pixel at the same position in the input image list.
For integer pixel types, the averaging is performed using integer division.
Possible _cpl_error_code_ set in this function:
References cpl_ensure, CPL_ERROR_ILLEGAL_INPUT, CPL_ERROR_NULL_INPUT, cpl_image_accept_all(), cpl_image_add(), cpl_image_delete(), cpl_image_divide(), cpl_image_duplicate(), cpl_image_fill_rejected(), cpl_image_get_bpm_const(), cpl_image_new_from_accepted(), and cpl_imagelist_is_uniform().
cpl_image * cpl_imagelist_collapse_median_create | ( | const cpl_imagelist * | self | ) |
Create a median image from the input imagelist.
self | The input image list |
The input image list can be of type CPL_TYPE_INT, CPL_TYPE_FLOAT and CPL_TYPE_DOUBLE.
On success each pixel in the created image is the median of the values on the same pixel position in the input image list. If for a given pixel all values in the input image list are rejected, the resulting pixel is set to zero and flagged as rejected.
The median is defined here as the middle value of an odd number of sorted samples and for an even number of samples as the mean of the two central values. Note that with an even number of samples the median may not be among the input samples.
Also, note that in the case of an even number of integer data, the mean value will be computed using integer arithmetic. Cast your integer data to a floating point pixel type if that is not the desired behavior.
Possible _cpl_error_code_ set in this function:
References cpl_ensure, CPL_ERROR_ILLEGAL_INPUT, CPL_ERROR_INVALID_TYPE, CPL_ERROR_NULL_INPUT, cpl_image_get_size_x(), cpl_image_get_size_y(), cpl_image_get_type(), cpl_imagelist_get_const(), and cpl_imagelist_is_uniform().
cpl_image * cpl_imagelist_collapse_minmax_create | ( | const cpl_imagelist * | self, |
cpl_size | nlow, | ||
cpl_size | nhigh | ||
) |
Average with rejection an imagelist to a single image.
self | The image list to average |
nlow | Number of low rejected values |
nhigh | Number of high rejected values |
The input images are averaged, for each pixel position the nlow lowest pixels and the nhigh highest pixels are discarded for the average computation.
The input image list can be of type CPL_TYPE_INT, CPL_TYPE_FLOAT and CPL_TYPE_DOUBLE. The created image will be of the same type.
On success each pixel in the created image is the average of the non-rejected values on the pixel position in the input image list.
For a given pixel position any bad pixels (i.e. values) are handled as follows: Given n bad values on a given pixel position, n/2 of those values are assumed to be low outliers and n/2 of those values are assumed to be high outliers. Any low or high rejection will first reject up to n/2 bad values and if more values need to be rejected that rejection will take place on the good values. This rationale behind this is to allow the rejection of outliers to include bad pixels without introducing a bias. If for a given pixel all values in the input image list are rejected, the resulting pixel is set to zero and flagged as rejected.
Possible _cpl_error_code_ set in this function:
References cpl_ensure, CPL_ERROR_ILLEGAL_INPUT, CPL_ERROR_INVALID_TYPE, CPL_ERROR_NULL_INPUT, cpl_image_get_size_x(), cpl_image_get_size_y(), cpl_image_get_type(), cpl_imagelist_get_const(), cpl_imagelist_get_size(), and cpl_imagelist_is_uniform().
cpl_image * cpl_imagelist_collapse_sigclip_create | ( | const cpl_imagelist * | self, |
double | kappalow, | ||
double | kappahigh, | ||
double | keepfrac, | ||
cpl_collapse_mode | mode, | ||
cpl_image * | contrib | ||
) |
Collapse an imagelist with kappa-sigma-clipping rejection.
self | The input imagelist |
kappalow | kappa-factor for lower clipping threshold |
kappahigh | kappa-factor for upper clipping threshold |
keepfrac | The fraction of values to keep (0.0 < keepfrac <= 1.0) |
mode | Clipping mode, CPL_COLLAPSE_MEAN or CPL_COLLAPSE_MEDIAN |
contrib | Pre-allocated integer-image for contribution map or NULL |
The collapsing is an iterative process which will stop when it converges (i.e. an iteration did not reject any values for a given pixel) or when the next iteration would reduce the fraction of values to keep to less than or equal to keepfrac.
A call with keepfrac == 1.0 will thus perform no clipping.
Supported modes: CPL_COLLAPSE_MEAN: The center value of the acceptance range will be the mean. CPL_COLLAPSE_MEDIAN: The center value of the acceptance range will be the median. CPL_COLLAPSE_MEDIAN_MEAN: The center value of the acceptance range will be the median in the first iteration and in subsequent iterations it will be the mean.
For each pixel position the pixels whose value is higher than center + kappahigh * stdev or lower than center - kappalow * stdev are discarded for the subsequent center and stdev computation, where center is defined according to the clipping mode, and stdev is the standard deviation of the values at that pixel position. Since the acceptance interval must be non-empty, the sum of kappalow and kappahigh must be positive. A typical call has both kappalow and kappahigh positive.
The minimum number of values that the clipping can select is 2. This is because the clipping criterion is based on the sample standard deviation, which needs at least two values to be defined. This means that all calls with (positive) values of keepfrac less than 2/n will behave the same. To ensure that the values in (at least) i planes out of n are kept, keepfrac can be set to (i - 0.5) / n, e.g. to keep at least 50 out of 100 values, keepfrac can be set to 0.495.
The output pixel is set to the mean of the non-clipped values, also in the median mode. Regardless of the input pixel type, the mean is computed in double precision. The result is then cast to the output-pixel type, which is identical to the input pixel type.
The input parameter contrib is optional. It must be either NULL or point to a pre-allocated image of type CPL_TYPE_INT and size equal to the images in the imagelist. On success, it will contain the contribution map, i.e. the number of kept (non-clipped) values after the iterative process on every pixel.
Bad pixels are ignored from the start. This means that with a sufficient number of bad pixels, the fraction of good values will be less than keepfrac. In this case no iteration is performed at all. If there is at least one good value available, then the mean will be based on the good value(s). If for a given pixel position there are no good values, then that pixel is set to zero, rejected as bad and if available the value in the contribution map is set to zero.
The input imagelist can be of type CPL_TYPE_INT, CPL_TYPE_FLOAT and CPL_TYPE_DOUBLE.
Possible _cpl_error_code_ set in this function:
References cpl_ensure, CPL_ERROR_ACCESS_OUT_OF_RANGE, CPL_ERROR_DATA_NOT_FOUND, CPL_ERROR_ILLEGAL_INPUT, CPL_ERROR_INVALID_TYPE, CPL_ERROR_NULL_INPUT, CPL_ERROR_UNSUPPORTED_MODE, cpl_image_get_data_int(), cpl_image_get_size_x(), cpl_image_get_size_y(), cpl_image_get_type(), cpl_imagelist_get_const(), cpl_imagelist_get_size(), cpl_imagelist_is_uniform(), and CPL_TYPE_INT.
void cpl_imagelist_delete | ( | cpl_imagelist * | self | ) |
Free all memory used by a cpl_imagelist object including the images.
self | The image list or NULL |
References cpl_imagelist_empty(), and cpl_imagelist_unwrap().
Referenced by cpl_fit_imagelist_polynomial_window(), cpl_geom_img_offset_combine(), cpl_imagelist_cast(), and cpl_imagelist_load_frameset().
cpl_error_code cpl_imagelist_divide | ( | cpl_imagelist * | in1, |
const cpl_imagelist * | in2 | ||
) |
Divide two image lists, the first one is replaced by the result.
in1 | first input image list (modified) |
in2 | image list to divide |
cpl_error_code cpl_imagelist_divide_image | ( | cpl_imagelist * | imlist, |
const cpl_image * | img | ||
) |
Divide an image list by an image.
imlist | input image list (modified) |
img | image for division |
cpl_error_code cpl_imagelist_divide_scalar | ( | cpl_imagelist * | imlist, |
double | divisor | ||
) |
Elementwise division of each image in the imlist with a scalar.
imlist | Imagelist to be modified in place. |
divisor | Non-zero number to divide with |
Possible _cpl_error_code_ set in this function:
References cpl_ensure_code, cpl_error_get_code(), CPL_ERROR_NONE, CPL_ERROR_NULL_INPUT, and cpl_image_divide_scalar().
cpl_error_code cpl_imagelist_dump_structure | ( | const cpl_imagelist * | self, |
FILE * | stream | ||
) |
Dump structural information of images in an imagelist.
self | Imagelist to dump |
stream | Output stream, accepts stdout or stderr |
Possible _cpl_error_code_ set in this function:
References cpl_ensure_code, CPL_ERROR_FILE_IO, cpl_error_get_code(), CPL_ERROR_NONE, CPL_ERROR_NULL_INPUT, cpl_image_dump_structure(), and cpl_imagelist_get_const().
cpl_error_code cpl_imagelist_dump_window | ( | const cpl_imagelist * | self, |
cpl_size | llx, | ||
cpl_size | lly, | ||
cpl_size | urx, | ||
cpl_size | ury, | ||
FILE * | stream | ||
) |
Dump pixel values of images in a CPL imagelist.
self | Imagelist to dump |
llx | Specifies the window position |
lly | Specifies the window position |
urx | Specifies the window position |
ury | Specifies the window position |
stream | Output stream, accepts stdout or stderr |
Possible _cpl_error_code_ set in this function:
References cpl_ensure_code, CPL_ERROR_FILE_IO, cpl_error_get_code(), CPL_ERROR_NONE, CPL_ERROR_NULL_INPUT, cpl_image_dump_window(), and cpl_imagelist_get_const().
cpl_imagelist * cpl_imagelist_duplicate | ( | const cpl_imagelist * | imlist | ) |
Copy an image list.
imlist | Source image list. |
Copy an image list into a new image list object. The returned image list must be deallocated using cpl_imagelist_delete().
Possible _cpl_error_code_ set in this function:
References cpl_ensure, CPL_ERROR_NULL_INPUT, cpl_image_duplicate(), cpl_imagelist_new(), and cpl_imagelist_set().
void cpl_imagelist_empty | ( | cpl_imagelist * | self | ) |
Empty an imagelist and deallocate all its images.
self | The image list or NULL |
NULL
nothing is done and no error is set.After the call the image list can be populated again. It must eventually be deallocted with a call to cpl_imagelist_delete().
References cpl_image_delete(), cpl_image_get_bpm_const(), cpl_image_unset_bpm(), and cpl_imagelist_unset().
Referenced by cpl_imagelist_delete().
cpl_error_code cpl_imagelist_erase | ( | cpl_imagelist * | imlist, |
const cpl_vector * | valid | ||
) |
Reject one or more images in a list according to an array of flags.
imlist | Non-empty imagelist to examine for image rejection. |
valid | Vector of flags (>=-0.5: valid, <-0.5: invalid) |
This function takes an imagelist and a vector of flags. The imagelist and vector must have equal lengths.
Images flagged as invalid are removed from the list.
The removal of image(s) will reduce the length of the list accordingly.
Possible _cpl_error_code_ set in this function:
References cpl_ensure_code, CPL_ERROR_INCOMPATIBLE_INPUT, CPL_ERROR_NONE, CPL_ERROR_NULL_INPUT, cpl_image_delete(), cpl_image_get_bpm_const(), cpl_image_unset_bpm(), cpl_vector_get(), and cpl_vector_get_size().
cpl_error_code cpl_imagelist_exponential | ( | cpl_imagelist * | imlist, |
double | base | ||
) |
Compute the elementwise exponential of each image in the imlist.
imlist | Imagelist to be modified in place. |
base | Base of the exponential. |
Possible _cpl_error_code_ set in this function:
References cpl_ensure_code, cpl_error_get_code(), CPL_ERROR_NONE, CPL_ERROR_NULL_INPUT, and cpl_image_exponential().
cpl_image * cpl_imagelist_get | ( | cpl_imagelist * | imlist, |
cpl_size | inum | ||
) |
Get an image from a list of images.
imlist | the image list |
inum | the image id (from 0 to number of images-1) |
The returned pointer refers to already allocated data.
Possible _cpl_error_code_ set in this function:
References cpl_ensure, CPL_ERROR_ACCESS_OUT_OF_RANGE, CPL_ERROR_ILLEGAL_INPUT, and CPL_ERROR_NULL_INPUT.
Referenced by cpl_fft_imagelist(), and cpl_imagelist_swap_axis_create().
const cpl_image * cpl_imagelist_get_const | ( | const cpl_imagelist * | imlist, |
cpl_size | inum | ||
) |
Get an image from a list of images.
imlist | the image list |
inum | the image id (from 0 to number of images-1) |
References cpl_ensure, CPL_ERROR_ACCESS_OUT_OF_RANGE, CPL_ERROR_ILLEGAL_INPUT, and CPL_ERROR_NULL_INPUT.
Referenced by cpl_fft_imagelist(), cpl_fit_imagelist_polynomial(), cpl_fit_imagelist_polynomial_window(), cpl_geom_img_offset_combine(), cpl_geom_img_offset_fine(), cpl_geom_img_offset_saa(), cpl_image_new_from_accepted(), cpl_imagelist_cast(), cpl_imagelist_collapse_median_create(), cpl_imagelist_collapse_minmax_create(), cpl_imagelist_collapse_sigclip_create(), cpl_imagelist_dump_structure(), cpl_imagelist_dump_window(), cpl_imagelist_swap_axis_create(), and cpl_test_get_bytes_imagelist().
cpl_size cpl_imagelist_get_size | ( | const cpl_imagelist * | imlist | ) |
Get the number of images in the imagelist.
imlist | the list of image |
Possible _cpl_error_code_ set in this function:
References cpl_ensure, and CPL_ERROR_NULL_INPUT.
Referenced by cpl_fft_imagelist(), cpl_fit_imagelist_polynomial_window(), cpl_geom_img_offset_combine(), cpl_geom_img_offset_fine(), cpl_geom_img_offset_saa(), cpl_image_new_from_accepted(), cpl_imagelist_cast(), cpl_imagelist_collapse_minmax_create(), cpl_imagelist_collapse_sigclip_create(), cpl_imagelist_load_frameset(), cpl_imagelist_swap_axis_create(), and cpl_test_get_bytes_imagelist().
int cpl_imagelist_is_uniform | ( | const cpl_imagelist * | imlist | ) |
Determine if an imagelist contains images of equal size and type.
imlist | The imagelist to check |
The function returns 1 if the list is empty.
Possible _cpl_error_code_ set in this function:
References cpl_ensure, CPL_ERROR_NULL_INPUT, cpl_image_get_size_x(), cpl_image_get_size_y(), and cpl_image_get_type().
Referenced by cpl_fit_imagelist_polynomial_window(), cpl_geom_img_offset_combine(), cpl_geom_img_offset_fine(), cpl_geom_img_offset_saa(), cpl_image_new_from_accepted(), cpl_imagelist_collapse_create(), cpl_imagelist_collapse_median_create(), cpl_imagelist_collapse_minmax_create(), cpl_imagelist_collapse_sigclip_create(), cpl_imagelist_save(), and cpl_imagelist_swap_axis_create().
Load a FITS file extension into a list of images.
filename | The FITS file name |
im_type | Type of the images in the created image list |
xtnum | The extension number (0 for primary HDU) |
This function loads all the images of a specified extension (NAXIS=2 or 3) into an image list.
Type can be CPL_TYPE_DOUBLE, CPL_TYPE_FLOAT, CPL_TYPE_INT or CPL_TYPE_UNSPECIFIED. The loaded images have an empty bad pixel map.
The returned cpl_imagelist must be deallocated using cpl_imagelist_delete()
Possible _cpl_error_code_ set in this function:
cpl_imagelist * cpl_imagelist_load_window | ( | const char * | filename, |
cpl_type | im_type, | ||
cpl_size | xtnum, | ||
cpl_size | llx, | ||
cpl_size | lly, | ||
cpl_size | urx, | ||
cpl_size | ury | ||
) |
Load images windows from a FITS file extension into an image list.
filename | The FITS file name |
im_type | Type of the images in the created image list |
xtnum | The extension number (0 for primary HDU) |
llx | Lower left x position (FITS convention, 1 for leftmost) |
lly | Lower left y position (FITS convention, 1 for lowest) |
urx | Upper right x position (FITS convention) |
ury | Upper right y position (FITS convention) |
This function loads all the image windows of a specified extension in an image list.
Type can be CPL_TYPE_DOUBLE, CPL_TYPE_FLOAT or CPL_TYPE_INT.
Possible _cpl_error_code_ set in this function:
cpl_error_code cpl_imagelist_logarithm | ( | cpl_imagelist * | imlist, |
double | base | ||
) |
Compute the elementwise logarithm of each image in the imlist.
imlist | Imagelist to be modified in place. |
base | Base of the logarithm. |
Possible _cpl_error_code_ set in this function:
References cpl_ensure_code, cpl_error_get_code(), CPL_ERROR_NONE, CPL_ERROR_NULL_INPUT, and cpl_image_logarithm().
cpl_error_code cpl_imagelist_multiply | ( | cpl_imagelist * | in1, |
const cpl_imagelist * | in2 | ||
) |
Multiply two image lists, the first one is replaced by the result.
in1 | first input image list (modified) |
in2 | image list to multiply |
cpl_error_code cpl_imagelist_multiply_image | ( | cpl_imagelist * | imlist, |
const cpl_image * | img | ||
) |
Multiply an image list by an image.
imlist | input image list (modified) |
img | image to multiply |
cpl_error_code cpl_imagelist_multiply_scalar | ( | cpl_imagelist * | imlist, |
double | factor | ||
) |
Elementwise multiplication of the imlist with a scalar.
imlist | Imagelist to be modified in place. |
factor | Number to multiply with |
References cpl_ensure_code, cpl_error_get_code(), CPL_ERROR_NONE, CPL_ERROR_NULL_INPUT, and cpl_image_multiply_scalar().
cpl_imagelist * cpl_imagelist_new | ( | void | ) |
Create an empty imagelist.
The returned cpl_imagelist must be deallocated using cpl_imagelist_delete()
References cpl_calloc().
Referenced by cpl_fit_imagelist_polynomial_window(), cpl_geom_img_offset_combine(), cpl_imagelist_cast(), cpl_imagelist_duplicate(), cpl_imagelist_load_frameset(), and cpl_imagelist_swap_axis_create().
cpl_error_code cpl_imagelist_normalise | ( | cpl_imagelist * | imlist, |
cpl_norm | mode | ||
) |
Normalize each image in the list.
imlist | Imagelist to modify. |
mode | Normalization mode. |
The list may be partly modified if an error occurs.
Possible _cpl_error_code_ set in this function:
References cpl_ensure_code, cpl_error_get_code(), CPL_ERROR_NONE, CPL_ERROR_NULL_INPUT, and cpl_image_normalise().
cpl_error_code cpl_imagelist_power | ( | cpl_imagelist * | imlist, |
double | exponent | ||
) |
Compute the elementwise power of each image in the imlist.
imlist | Imagelist to be modified in place. |
exponent | Scalar exponent |
Possible _cpl_error_code_ set in this function:
References cpl_ensure_code, cpl_error_get_code(), CPL_ERROR_NONE, CPL_ERROR_NULL_INPUT, and cpl_image_power().
cpl_error_code cpl_imagelist_save | ( | const cpl_imagelist * | self, |
const char * | filename, | ||
cpl_type | type, | ||
const cpl_propertylist * | plist, | ||
unsigned | mode | ||
) |
Save an imagelist to disk in FITS format.
self | Imagelist to save |
filename | Name of the FITS file to write |
type | The type used to represent the data in the file |
plist | Property list for the output header or NULL |
mode | The desired output options (combined with bitwise or) |
This function saves an image list to a FITS file. If a property list is provided, it is written to the named file before the pixels are written.
Supported image lists types are CPL_TYPE_DOUBLE, CPL_TYPE_FLOAT, CPL_TYPE_INT.
The type used in the file can be one of: CPL_TYPE_UCHAR (8 bit unsigned), CPL_TYPE_SHORT (16 bit signed), CPL_TYPE_USHORT (16 bit unsigned), CPL_TYPE_INT (32 bit signed), CPL_TYPE_FLOAT (32 bit floating point), or CPL_TYPE_DOUBLE (64 bit floating point). Additionally, the special value CPL_TYPE_UNSPECIFIED is allowed. This value means that the type used for saving is the pixel type of the input image. Using the image pixel type as saving type ensures that the saving incurs no loss of information.
Supported output modes are CPL_IO_CREATE (create a new file), CPL_IO_EXTEND (extend an existing file with a new extension) and CPL_IO_APPEND (append a list of images to the last data unit, which must already contain compatible image(s)).
For the CPL_IO_APPEND mode it is recommended to pass a NULL pointer for the output header, since updating the already existing header incurs significant overhead.
When the data written to disk are of an integer type, the output mode CPL_IO_EXTEND can be combined (via bit-wise or) with an option for tile-compression. This compression of integer data is lossless. The options are: CPL_IO_COMPRESS_GZIP, CPL_IO_COMPRESS_RICE, CPL_IO_COMPRESS_HCOMPRESS, CPL_IO_COMPRESS_PLIO. With compression the type must be CPL_TYPE_UNSPECIFIED or CPL_TYPE_INT.
In extend and append mode, make sure that the file has write permissions. You may have problems if you create a file in your application and append something to it with the umask set to 222. In this case, the file created by your application would not be writable, and the append would fail.
Possible _cpl_error_code_ set in this function:
References cpl_ensure_code, CPL_ERROR_ILLEGAL_INPUT, CPL_ERROR_NONE, CPL_ERROR_NULL_INPUT, and cpl_imagelist_is_uniform().
cpl_error_code cpl_imagelist_set | ( | cpl_imagelist * | self, |
cpl_image * | im, | ||
cpl_size | pos | ||
) |
Insert an image into an imagelist.
self | The imagelist |
im | The image to insert |
pos | The list position (from 0 to number of images) |
It is allowed to specify the position equal to the number of images in the list. This will increment the size of the imagelist.
No action occurs if an image is inserted more than once into the same position. It is allowed to insert the same image into two different positions in a list.
The image is inserted at the position pos in the image list. If the image already there is only present in that one location in the list, then the image is deallocated.
It is not allowed to insert images of different size into a list.
The added image is owned by the imagelist object, which deallocates it when cpl_imagelist_delete is called. Another option is to use cpl_imagelist_unset to recover ownership of the image, in which case the cpl_imagelist object is not longer responsible for deallocating it.
Possible _cpl_error_code_ set in this function:
References cpl_ensure_code, CPL_ERROR_ACCESS_OUT_OF_RANGE, CPL_ERROR_ILLEGAL_INPUT, CPL_ERROR_INCOMPATIBLE_INPUT, CPL_ERROR_NONE, CPL_ERROR_NULL_INPUT, CPL_ERROR_TYPE_MISMATCH, cpl_image_delete(), cpl_image_get_bpm_const(), cpl_image_get_size_x(), cpl_image_get_size_y(), cpl_image_get_type(), cpl_image_unset_bpm(), and cpl_realloc().
Referenced by cpl_fit_imagelist_polynomial_window(), cpl_geom_img_offset_combine(), cpl_imagelist_cast(), cpl_imagelist_duplicate(), and cpl_imagelist_load_frameset().
cpl_error_code cpl_imagelist_subtract | ( | cpl_imagelist * | in1, |
const cpl_imagelist * | in2 | ||
) |
Subtract two image lists, the first one is replaced by the result.
in1 | first input image list (modified) |
in2 | image list to subtract |
cpl_error_code cpl_imagelist_subtract_image | ( | cpl_imagelist * | imlist, |
const cpl_image * | img | ||
) |
Subtract an image from an image list.
imlist | input image list (modified) |
img | image to subtract |
cpl_error_code cpl_imagelist_subtract_scalar | ( | cpl_imagelist * | imlist, |
double | subtrahend | ||
) |
Elementwise subtraction of a scalar from each image in the imlist.
imlist | Imagelist to be modified in place. |
subtrahend | Number to subtract |
References cpl_ensure_code, cpl_error_get_code(), CPL_ERROR_NONE, CPL_ERROR_NULL_INPUT, and cpl_image_subtract_scalar().
cpl_imagelist * cpl_imagelist_swap_axis_create | ( | const cpl_imagelist * | ilist, |
cpl_swap_axis | mode | ||
) |
Swap the axis of an image list.
ilist | The image list to swap |
mode | The swapping mode |
This function is intended for users that want to use the cpl_imagelist object as a cube. Swapping the axis would give them access to the usual functions in the 3 dimensions. This has the cost that it duplicates the memory consumption, which can be a problem for big amounts of data.
Image list can be CPL_TYPE_INT, CPL_TYPE_FLOAT or CPL_TYPE_DOUBLE. The mode can be either CPL_SWAP_AXIS_XZ or CPL_SWAP_AXIS_YZ
Possible _cpl_error_code_ set in this function:
References cpl_ensure, CPL_ERROR_ILLEGAL_INPUT, CPL_ERROR_INVALID_TYPE, CPL_ERROR_NULL_INPUT, cpl_image_get_size_x(), cpl_image_get_size_y(), cpl_image_get_type(), cpl_image_reject_from_mask(), cpl_imagelist_get(), cpl_imagelist_get_const(), cpl_imagelist_get_size(), cpl_imagelist_is_uniform(), cpl_imagelist_new(), cpl_mask_delete(), cpl_mask_get_data(), and cpl_mask_new().
cpl_error_code cpl_imagelist_threshold | ( | cpl_imagelist * | imlist, |
double | lo_cut, | ||
double | hi_cut, | ||
double | assign_lo_cut, | ||
double | assign_hi_cut | ||
) |
Threshold all pixel values to an interval.
imlist | Image list to threshold. |
lo_cut | Lower bound. |
hi_cut | Higher bound. |
assign_lo_cut | Value to assign to pixels below low bound. |
assign_hi_cut | Value to assign to pixels above high bound. |
Threshold the images of the list using cpl_image_threshold() The input image list is modified.
Possible _cpl_error_code_ set in this function:
References cpl_ensure_code, cpl_error_get_code(), CPL_ERROR_INCOMPATIBLE_INPUT, CPL_ERROR_NONE, CPL_ERROR_NULL_INPUT, and cpl_image_threshold().
cpl_image * cpl_imagelist_unset | ( | cpl_imagelist * | self, |
cpl_size | pos | ||
) |
Remove an image from an imagelist.
self | The imagelist |
pos | The list position (from 0 to number of images-1) |
The specified image is not deallocated, it is simply removed from the list. The pointer to the image is returned to let the user decide to deallocate it or not. Eventually, the image will have to be deallocated with cpl_image_delete().
Possible _cpl_error_code_ set in this function:
References cpl_ensure, CPL_ERROR_ACCESS_OUT_OF_RANGE, CPL_ERROR_ILLEGAL_INPUT, and CPL_ERROR_NULL_INPUT.
Referenced by cpl_geom_img_offset_combine(), cpl_imagelist_cast(), and cpl_imagelist_empty().
void cpl_imagelist_unwrap | ( | cpl_imagelist * | self | ) |
Free memory used by a cpl_imagelist object, except the images.
self | The image list or NULL |
NULL
nothing is done and no error is set. References cpl_free().
Referenced by cpl_geom_img_offset_saa(), and cpl_imagelist_delete().