Functions | |
cpl_image * | cpl_image_new (int nx, int ny, cpl_type type) |
Allocate an image structure and pixel buffer for a image. | |
cpl_image * | cpl_image_wrap_double (int nx, int ny, const double *pixels) |
Create a double image using an existing pixel buffer. | |
cpl_image * | cpl_image_wrap_float (int nx, int ny, const float *pixels) |
Create a float image using an existing pixel buffer. | |
cpl_image * | cpl_image_wrap_int (int nx, int ny, const int *pixels) |
Create an integer image using an existing pixel buffer. | |
cpl_image * | cpl_image_load (const char *filename, cpl_type im_type, int pnum, int xtnum) |
Load an image from a FITS file. | |
cpl_image * | cpl_image_new_from_mask (const cpl_mask *mask) |
Create an int image from a mask. | |
cpl_type | cpl_image_get_type (const cpl_image *img) |
Get the image type. | |
int | cpl_image_get_size_x (const cpl_image *img) |
Get the image x size. | |
int | cpl_image_get_size_y (const cpl_image *img) |
Get the image y size. | |
double | cpl_image_get (const cpl_image *image, int xpos, int ypos, int *pis_rejected) |
Get the value of a pixel at a given position. | |
cpl_error_code | cpl_image_set (cpl_image *image, int xpos, int ypos, double value) |
Set the pixel at the given position to the given value. | |
void * | cpl_image_get_data (const cpl_image *img) |
Gets the pixel data. | |
double * | cpl_image_get_data_double (const cpl_image *img) |
Get the data as a double array. | |
float * | cpl_image_get_data_float (const cpl_image *img) |
Get the data as a float array. | |
int * | cpl_image_get_data_int (const cpl_image *img) |
Get the data as a integer array. | |
void | cpl_image_delete (cpl_image *d) |
Free memory associated to an cpl_image object. | |
void * | cpl_image_unwrap (cpl_image *d) |
Free memory associated to an cpl_image object, but the pixel buffer. | |
cpl_image * | cpl_image_duplicate (const cpl_image *src) |
Copy an image. | |
cpl_image * | cpl_image_cast (const cpl_image *im, cpl_type type) |
convert a cpl_image to a given type | |
cpl_error_code | cpl_image_fill_rejected (cpl_image *im, double a) |
Set the bad pixels in an image to a fixed value. | |
cpl_error_code | cpl_image_save (const cpl_image *to_save, const char *filename, cpl_type_bpp bpp, const cpl_propertylist *pl, unsigned mode) |
Save an image to a FITS file. | |
void | cpl_image_delete_imaginary (cpl_image *image) |
Cast a complex image to real by freeing its imaginary part. |
Functions are provided here to load and save images from and to FITS files, to generate empty images or to deallocated an image.
#include "cpl_image_io.h"
|
convert a cpl_image to a given type
Possible _cpl_error_code_ set in this function:
|
|
Free memory associated to an cpl_image object.
|
|
Cast a complex image to real by freeing its imaginary part.
|
|
Copy an image.
Images can be CPL_TYPE_FLOAT, CPL_TYPE_INT, CPL_TYPE_DOUBLE or CPL_TYPE_COMPLEX. Possible _cpl_error_code_ set in this function:
|
|
Set the bad pixels in an image to a fixed value.
Possible _cpl_error_code_ set in this function:
|
|
Get the value of a pixel at a given position.
In case of an error, the _cpl_error_code_ code is set. Images can be CPL_TYPE_FLOAT, CPL_TYPE_INT or CPL_TYPE_DOUBLE. Possible _cpl_error_code_ set in this function:
|
|
Gets the pixel data.
Possible _cpl_error_code_ set in this function:
|
|
Get the data as a double array.
The pixels are stored in a one dimensional array. The pixel value PIXVAL at position (i, j) in the image - (0, 0) is the lower left pixel, i gives the column position from left to right, j gives the row position from bottom to top - is given by : PIXVAL = array[i + j*nx] ; where nx is the x size of the image and array is the data array returned by this function. array can be used to access or modify the pixel value in the image. Possible _cpl_error_code_ set in this function:
|
|
Get the data as a float array.
|
|
Get the data as a integer array.
|
|
Get the image x size.
|
|
Get the image y size.
|
|
Get the image type.
|
|
Load an image from a FITS file.
The returned image has to be deallocated with cpl_image_delete(). The passed type for the output image can be : CPL_TYPE_FLOAT, CPL_TYPE_DOUBLE or CPL_TYPE_INT. This type is there to specify the type of the cpl_image that will be created by the function. It is totally independant from the way the data are stored in the FITS file. A FITS image containg float pixels can be loaded as a cpl_image of type double. In this case, the user would specify CPL_TYPE_DOUBLE as im_type. 'xtnum' specifies from which extension the image should be loaded. This could be 0 for the main data section (files without extension), or any number between 1 and N, where N is the number of extensions present in the file. The requested plane number runs from 0 to nplanes-1, where nplanes is the number of planes present in the requested data section. Examples: // Load as a float image the only image in FITS file (a.fits) without ext. // and NAXIS=2. cpl_image * im = cpl_image_load("a.fits", CPL_TYPE_FLOAT, 0, 0); // Load as a double image the first plane in a FITS cube (a.fits) without // extension, NAXIS=3 and NAXIS3=128 cpl_image * im = cpl_image_load("a.fits", CPL_TYPE_DOUBLE, 0, 0); // Load as an integer image the third plane in a FITS cube (a.fits) without // extension, NAXIS=3 and NAXIS3=128 cpl_image * im = cpl_image_load("a.fits", CPL_TYPE_INT, 2, 0); // Load as a double image the first plane from extension 5 cpl_image * im = cpl_image_load("a.fits", CPL_TYPE_DOUBLE, 0, 5); // Load as a double image the third plane in extension 5 cpl_image * im = cpl_image_load("a.fits", CPL_TYPE_DOUBLE, 2, 5); Possible _cpl_error_code_ set in this function:
|
|
Allocate an image structure and pixel buffer for a image.
Supported pixel types are CPL_TYPE_INT, CPL_TYPE_FLOAT and CPL_TYPE_DOUBLE. The returned cpl_image must be deallocated using cpl_image_delete(). Possible _cpl_error_code_ set in this function:
|
|
Create an int image from a mask.
Possible _cpl_error_code_ set in this function:
|
|
Save an image to a FITS file.
The requested pixel depth (bpp) follows the FITS convention. Possible values are CPL_BPP_8_UNSIGNED (8), CPL_BPP_16_SIGNED (16), CPL_BPP_32_SIGNED (32), CPL_BPP_IEEE_FLOAT (-32), CPL_BPP_IEEE_DOUBLE (-64) or CPL_BPP_DEFAULT. Supported image types are CPL_TYPE_DOUBLE, CPL_TYPE_FLOAT, CPL_TYPE_INT. Supported output modes are CPL_IO_DEFAULT (create a new file) and CPL_IO_EXTEND (append to an existing file) If you are in append mode, make sure that the file has writing 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:
|
|
Set the pixel at the given position to the given value.
If the pixel is flagged as rejected, this flag is removed. Possible _cpl_error_code_ set in this function:
|
|
Free memory associated to an cpl_image object, but the pixel buffer.
|
|
Create a double image using an existing pixel buffer.
The allocated image must be deallocated with cpl_image_unwrap(). Possible _cpl_error_code_ set in this function:
|
|
Create a float image using an existing pixel buffer.
|
|
Create an integer image using an existing pixel buffer.
|