High-Level Data Reduction Library: Bad Pixel Utilities

High-Level Data Reduction Library 1.6.0 High-Level data reduction routines for ESO pipelines

Loading...
Searching...
No Matches
Functions
Bad Pixel Utilities

## Functions
cpl_imagelist * | hdrl_bpm_filter_list (const cpl_imagelist *inlist, cpl_size kernel_nx, cpl_size kernel_ny, cpl_filter_mode filter)
| Wrapper around hdrl_bpm_filter() to filter list of images.
cpl_mask * | hdrl_bpm_filter (const cpl_mask *input_mask, cpl_size kernel_nx, cpl_size kernel_ny, cpl_filter_mode filter)
| Allows the growing and shrinking of bad pixel masks. It can be used to e.g. set pixels to bad if the pixel is surrounded by other bad pixels.
cpl_mask * | hdrl_bpm_to_mask (const cpl_image *bpm, uint64_t selection)
| convert bad pixel information mask to a cpl_mask
cpl_image * | hdrl_mask_to_bpm (const cpl_mask *mask, uint64_t flag)
| convert cpl_mask to bad pixel information mask
cpl_error_code | hdrl_set_masks_on_imagelist (cpl_imagelist *list, cpl_mask **masks)
| apply array of masks to an image list
cpl_error_code | hdrl_join_mask_on_imagelist (cpl_imagelist *list, cpl_mask *new_mask, cpl_mask ***pold_mask)
| join mask with existing masks in an imagelist

## Detailed Description

## Function Documentation

## ◆ hdrl_bpm_filter()

cpl_mask * hdrl_bpm_filter | ( | const cpl_mask * | input_mask,
|  | cpl_size | kernel_nx,
|  | cpl_size | kernel_ny,
|  | cpl_filter_mode | filter
| ) |  |

Allows the growing and shrinking of bad pixel masks. It can be used to e.g. set pixels to bad if the pixel is surrounded by other bad pixels.

Parameters

  input_mask | input mask
  kernel_nx | size in x-direction of the filtering kernel
  kernel_ny | size in y-direction of the filtering kernel
  filter | filter modes as defined in cpl - see below Supported modes: CPL_FILTER_EROSION, CPL_FILTER_DILATION, CPL_FILTER_OPENING, CPL_FILTER_CLOSING

The returned mask must be deallocated using cpl_mask_delete(). The algorithm assumes, that all pixels outside the mask are good, i.e. it enlarges the mask by the kernel size and marks this border as good. It applies on the enlarged mask the operation and extract the original-size mask at the very end.

## ◆ hdrl_bpm_filter_list()

cpl_imagelist * hdrl_bpm_filter_list | ( | const cpl_imagelist * | inlist,
|  | cpl_size | kernel_nx,
|  | cpl_size | kernel_ny,
|  | cpl_filter_mode | filter
| ) |  |

Wrapper around hdrl_bpm_filter() to filter list of images.

Parameters

  inlist | input image list
  kernel_nx | size in x-direction of the filtering kernel
  kernel_ny | size in y-direction of the filtering kernel
  filter | filter modes as defined in cpl

Returns
  The filtered image list

See also
  hdrl_bpm_filter()

## ◆ hdrl_bpm_to_mask()

cpl_mask * hdrl_bpm_to_mask | ( | const cpl_image * | bpm,
|  | uint64_t | selection
| ) |  |

convert bad pixel information mask to a cpl_mask

Parameters

  bpm | integer image containing the bad pixel information
  selection | bit-mask selecting which values to set to bad

Returns
  cpl_mask

Note
  as cpl only supports 32 bit integer images the top 32 bit of the selection mask must be zero

## ◆ hdrl_join_mask_on_imagelist()

cpl_error_code hdrl_join_mask_on_imagelist | ( | cpl_imagelist * | list,
|  | cpl_mask * | new_mask,
|  | cpl_mask *** | pold_mask
| ) |  |

join mask with existing masks in an imagelist

Parameters

  list | imagelist where the new mask should be joined on
  new_mask | new mask joined with the masks in the images
  pold_mask | pointer to array pointer to store a copy of the original masks, array and masks contained in it must be deleted by the user, may be NULL in which case no copy is stored

See also
  hdrl_set_masks_on_imagelist

## ◆ hdrl_mask_to_bpm()

cpl_image * hdrl_mask_to_bpm | ( | const cpl_mask * | mask,
|  | uint64_t | flag
| ) |  |

convert cpl_mask to bad pixel information mask

Parameters

  mask | cpl_mask to be converted
  flag | bit-mask selecting which values to set the bad pixels to

Returns
  integer cpl_image

Note
  as cpl only supports 32 bit integer images the top 32 bit of the selection mask must be zero

## ◆ hdrl_set_masks_on_imagelist()

cpl_error_code hdrl_set_masks_on_imagelist | ( | cpl_imagelist * | list,
|  | cpl_mask ** | masks
| ) |  |

apply array of masks to an image list

Parameters

  list | image list where the masks should be applied
  masks | array of masks, must have same length as the image list

already existing masks will be overwritten can be used to re-apply the original mask array returned by hdrl_join_mask_on_imagelist

Example:

cpl_mask ** orig_masks;
// change mask to get partial statistics from the list
hdrl_join_mask_on_imagelist(list, echelle_mask, &orig_masks);
stats = get_stats_from_echelle_orders();
// restore original mask
hdrl_set_masks_on_imagelist(list, orig_masks);
// free memory
for (i = 0; i < cpl_imagelist_get_size(list); i++) {
cpl_mask_free(orig_masks[i]);
}
cpl_free(orig_masks);
hdrl_join_mask_on_imagelist
cpl_error_code hdrl_join_mask_on_imagelist(cpl_imagelist *list, cpl_mask *new_mask, cpl_mask ***pold_mask)
join mask with existing masks in an imagelist
Definition hdrl_bpm_utils.c:292
hdrl_set_masks_on_imagelist
cpl_error_code hdrl_set_masks_on_imagelist(cpl_imagelist *list, cpl_mask **masks)
apply array of masks to an image list
Definition hdrl_bpm_utils.c:263