Main Page   Modules   Alphabetical List   Compound List   Compound Members  

Bad pixels map handling functions


Functions

cpl_image * cpl_image_bpm_from_image (const cpl_image *in, int *pbadpix, int *pfirstgood)
 Create a binary image from an image bad pixels map. More...

cpl_image * cpl_image_bpm_from_image_subw (const cpl_image *in, const int llx, const int lly, const int urx, const int ury, int *pbadpix, int *pfirstgood)
 Create a binary image from an image BPM subwindow. More...

int cpl_image_bpm_is_badpix (const cpl_image *im, const int x, const int y)
 Test if a pixel is good or bad. More...

int cpl_image_bpm_count (const cpl_image *im)
 Count the number of bad pixels declared in an image. More...

cpl_error_code cpl_image_bpm_set_badpix (cpl_image *im, const int x, const int y)
 Set a pixel as bad in an image. More...

cpl_error_code cpl_image_bpm_reset_badpix (cpl_image *im, const int x, const int y)
 Set a pixel as good in an image. More...

cpl_error_code cpl_image_bpm_reset (cpl_image *im)
 Set all pixels in the image as good. More...

cpl_error_code cpl_image_bpm_set_from_ascii (cpl_image *im, const char *file)
 Set the bad pixels in an image as defined in an ASCII file. More...


Detailed Description

This module provides functions to handle bad pixels maps stored in images.

The provided functions allow the user to set or reset the bad pixels in an image, or to get various informations on those bad pixels.

Synopsis:
   #include "cpl_image_bpm.h"

Function Documentation

int cpl_image_bpm_count const cpl_image *    im
 

Count the number of bad pixels declared in an image.

Parameters:
im  the input image
Returns:
the number of bad pixels or -1 if the input image is NULL
Possible _cpl_error_code_ set in this function:
  • CPL_ERROR_NULL_INPUT

cpl_image* cpl_image_bpm_from_image const cpl_image *    in,
int *    pbadpix,
int *    pfirstgood
 

Create a binary image from an image bad pixels map.

Parameters:
in  input image
pbadpix  on return, pointer to number of set (bad) pixels in result, unless pbadpix == NULL
pfirstgood  on return, pointer to first index with unset (good) pixel or -1, unless pfirstgood == NULL
Returns:
a newly allocated binary image or NULL on error
If there are no good pixels, NULL is returned and *pfirstgood = -1. The set (bad) pixels are marked with CPL_BINARY_1, the rest with CPL_BINARY_0 The returned object must be deallocated with cpl_image_delete().

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT
  • CPL_ERROR_ILLEGAL_INPUT

cpl_image* cpl_image_bpm_from_image_subw const cpl_image *    in,
const int    llx,
const int    lly,
const int    urx,
const int    ury,
int *    pbadpix,
int *    pfirstgood
 

Create a binary image from an image BPM subwindow.

Parameters:
in  input image
llx  lower left x coord.
lly  lower left y coord
urx  upper right x coord
ury  upper right y coord
pbadpix  on return, pointer to number of set (bad) pixels in result, unless pbadpix == NULL
pfirstgood  on return, pointer to first index with unset (good) pixel or -1, unless pfirstgood == NULL
Returns:
a newly allocated binary image or NULL on error
llx, lly, urx, ury are image region coordinates in FITS convention. If there are no good pixels, NULL is returned and *pfirstgood = -1. The set (bad) pixels are marked with CPL_BINARY_1, the rest with CPL_BINARY_0 The size of the allocated dense matrix is (urx-llx+1) * (ury-lly+1). The returned object must be deallocated with cpl_image_delete().

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT
  • CPL_ERROR_ILLEGAL_INPUT

int cpl_image_bpm_is_badpix const cpl_image *    im,
const int    x,
const int    y
 

Test if a pixel is good or bad.

Parameters:
im  the input image
x  the x pixel position in the image (first pixel is 1)
y  the y pixel position in the image (first pixel is 1)
Returns:
1 if the pixel is bad, 0 if the pixel is good, -1 in error case.
Possible _cpl_error_code_ set in this function:
  • CPL_ERROR_NULL_INPUT
  • CPL_ERROR_ILLEGAL_INPUT

cpl_error_code cpl_image_bpm_reset cpl_image *    im
 

Set all pixels in the image as good.

Parameters:
im  the input image
Returns:
the _cpl_error_code_ or CPL_ERROR_NONE
Possible _cpl_error_code_ set in this function:
  • CPL_ERROR_NULL_INPUT

cpl_error_code cpl_image_bpm_reset_badpix cpl_image *    im,
const int    x,
const int    y
 

Set a pixel as good in an image.

Parameters:
im  the input image
x  the x pixel position in the image (first pixel is 1)
y  the y pixel position in the image (first pixel is 1)
Returns:
the _cpl_error_code_ or CPL_ERROR_NONE
Possible _cpl_error_code_ set in this function:
  • CPL_ERROR_NULL_INPUT
  • CPL_ERROR_ILLEGAL_INPUT

cpl_error_code cpl_image_bpm_set_badpix cpl_image *    im,
const int    x,
const int    y
 

Set a pixel as bad in an image.

Parameters:
im  the input image
x  the x pixel position in the image (first pixel is 1)
y  the y pixel position in the image (first pixel is 1)
Returns:
the _cpl_error_code_ or CPL_ERROR_NONE
Possible _cpl_error_code_ set in this function:
  • CPL_ERROR_NULL_INPUT
  • CPL_ERROR_ILLEGAL_INPUT

cpl_error_code cpl_image_bpm_set_from_ascii cpl_image *    im,
const char *    file
 

Set the bad pixels in an image as defined in an ASCII file.

Parameters:
im  the input image
file  the input ASCII file
Returns:
the _cpl_error_code_ or CPL_ERROR_NONE
The ASCII file consists of one line with the (unsigned) number of elements, nz, and nz lines with the space separated FITS coordinates of the elements. Example:
  3
  2 9 
  1 8  
  5 10
  
define 3 bad pixels at positions (2,9), (1,8) and (5,10). The bad pixel map contained in the image is overwritten/lost.

Possible _cpl_error_code_ set in this function:

  • CPL_ERROR_NULL_INPUT
  • CPL_ERROR_ILLEGAL_INPUT
  • CPL_ERROR_FILE_NOT_FOUND
  • CPL_ERROR_BAD_FILE_FORMAT
  • CPL_ERROR_FILE_IO


Generated on Mon May 24 14:58:05 2004 for Common Pipeline Library Reference Manual by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002