High-Level Data Reduction Library: Bad Pixel Mask via edge detection

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

Loading...
Searching...
No Matches
Data Structures | Functions
Bad Pixel Mask via edge detection
Bad Pixel Detection

Algorithm to detect bad-pixels and cosmic-rays hits on a single image like e.g. science frames. More...

Collaboration diagram for Bad Pixel Mask via edge detection:

## Data Structures
struct | hdrl_lacosmic_parameter

## Functions
hdrl_parameter * | hdrl_lacosmic_parameter_create (double sigma_lim, double f_lim, int max_iter)
| Creates LaCosmic parameters object.
cpl_error_code | hdrl_lacosmic_parameter_verify (const hdrl_parameter *param)
| Verify basic correctness of the LaCosmic parameters.
cpl_boolean | hdrl_lacosmic_parameter_check (const hdrl_parameter *self)
| Check that the parameter is an LaCosmic parameter.
double | hdrl_lacosmic_parameter_get_sigma_lim (const hdrl_parameter *p)
| Access the sigma_lim in the LaCosmic parameter.
double | hdrl_lacosmic_parameter_get_f_lim (const hdrl_parameter *p)
| Access the f_lim in the LaCosmic parameter.
int | hdrl_lacosmic_parameter_get_max_iter (const hdrl_parameter *p)
| Access the max_iter in the LaCosmic parameter.
cpl_parameterlist * | hdrl_lacosmic_parameter_create_parlist (const char *base_context, const char *prefix, const hdrl_parameter *defaults)
| Create parameter list for the LaCosmic computation.
hdrl_parameter * | hdrl_lacosmic_parameter_parse_parlist (const cpl_parameterlist *parlist, const char *prefix)
| Parse parameterlist to create input parameters for the LaCosmic.
cpl_mask * | hdrl_lacosmic_edgedetect (const hdrl_image *ima_in, const hdrl_parameter *params)
| Detect bad-pixels / cosmic-rays on a single image.

## Detailed Description

Algorithm to detect bad-pixels and cosmic-rays hits on a single image like e.g. science frames.

This routine determines bad-pixels on a single image via edge detection following the algorithm (LA-Cosmic) describe in van Dokkum, PASP,113,2001,p1420-27. The HDRL implementation does not use use error model as described in the paper but the error image passed to the function. Moreover we do several iterations and replace the detected bad pixels in each iteration by the information of the surrounding pixels.

The calculation is performed by calling the top-level function hdrl_lacosmic_edgedetect() and the parameters passed to this function can be created by calling hdrl_lacosmic_parameter_create().

## Function Documentation

## ◆ hdrl_lacosmic_edgedetect()

cpl_mask * hdrl_lacosmic_edgedetect | ( | const hdrl_image * | ima_in,
|  | const hdrl_parameter * | params
| ) |  |

Detect bad-pixels / cosmic-rays on a single image.

Parameters

  ima_in | The input image
  params | LaCosmic computation parameters

Returns
  Mask where all detected bad-pixels/cosmics-rays are marked as bad or NULL on error

This routine determines bad-pixels on a single image via edge detection following the algorithm (LA-Cosmic) describe in van Dokkum, PASP,113,2001,p1420-27. It was originally developed to detect cosmic ray hits but can also be used in the more general context of detecting bad pixels. The HDRL implementation does not use use error model as described in the paper but the error image passed to the function. Moreover we do several iterations with max_iter defining an upper limit for the number of iterations, i.e. the iteration stops if no new bad pixels are found or max_iter is reached. In each iteration we replace the detected cosmic ray hits by the median of the surroundings 5x5 pixels taking into account the pixel quality information. The input parameter sigma_lim and f_lim refer to and as described in the paper mentioned above. The hdrl parameter passed to this routine is created by hdrl_lacosmic_parameter_create().

Note
  Be aware that the implementation only detects positive bad pixels / cosmic ray hits, i.e. no "holes" in the image are detected, but in such a case the pixels surrounding the whole are marked as bad. Holes in the image can be introduced, if e.g. one subtracts a not cosmic-ray-cleaned image from another image.

## ◆ hdrl_lacosmic_parameter_check()

cpl_boolean hdrl_lacosmic_parameter_check | ( | const hdrl_parameter * | self | ) |

Check that the parameter is an LaCosmic parameter.

Parameters

  self | The parameter to check

Returns
  True or False

## ◆ hdrl_lacosmic_parameter_create()

hdrl_parameter * hdrl_lacosmic_parameter_create | ( | double | sigma_lim,
|  | double | f_lim,
|  | int | max_iter
| ) |  |

Creates LaCosmic parameters object.

Parameters

  sigma_lim | Limiting sigma for detection on the sampling image
  f_lim | Limiting f factor for detection on the modified Laplacian image.
  max_iter | Maximum number of iterations

Returns
  The LaCosmic parameters object. It needs to be deallocated with hdrl_parameter_delete()

See also
  hdrl_lacosmic_edgedetect()

Note
  For the algorithm see the paper of van Dokkum, PASP,113,2001,p1420-27.

## ◆ hdrl_lacosmic_parameter_create_parlist()

cpl_parameterlist * hdrl_lacosmic_parameter_create_parlist | ( | const char * | base_context,
|  | const char * | prefix,
|  | const hdrl_parameter * | defaults
| ) |  |

Create parameter list for the LaCosmic computation.

Parameters

  base_context | base context of parameter (e.g. recipe name)
  prefix | prefix of parameter, may be empty string
  defaults | default values

Returns
  parameterlist controlling the LaCosmic algorithm

base_context.prefix.sigma_lim base_context.prefix.f_lim base_context.prefix.max_iter The CLI aliases omit the base_context.

## ◆ hdrl_lacosmic_parameter_get_f_lim()

double hdrl_lacosmic_parameter_get_f_lim | ( | const hdrl_parameter * | p | ) |

Access the f_lim in the LaCosmic parameter.

Parameters

  p | The LaCosmic parameter

Returns
  The f_lim value

## ◆ hdrl_lacosmic_parameter_get_max_iter()

int hdrl_lacosmic_parameter_get_max_iter | ( | const hdrl_parameter * | p | ) |

Access the max_iter in the LaCosmic parameter.

Parameters

  p | The LaCosmic parameter

Returns
  The max_iter value

## ◆ hdrl_lacosmic_parameter_get_sigma_lim()

double hdrl_lacosmic_parameter_get_sigma_lim | ( | const hdrl_parameter * | p | ) |

Access the sigma_lim in the LaCosmic parameter.

Parameters

  p | The LaCosmic parameter

Returns
  The sigma_lim value

## ◆ hdrl_lacosmic_parameter_parse_parlist()

hdrl_parameter * hdrl_lacosmic_parameter_parse_parlist | ( | const cpl_parameterlist * | parlist,
|  | const char * | prefix
| ) |  |

Parse parameterlist to create input parameters for the LaCosmic.

Parameters

  parlist | parameter list to parse
  prefix | prefix of parameter name

Returns
  Input parameters for the LaCosmic Computation

Reads a parameterlist in order to create LaCosmic parameters. Expects a parameterlist containing:

- prefix.sigma_lim
- prefix.f_lim
- prefix.max_iter

## ◆ hdrl_lacosmic_parameter_verify()

cpl_error_code hdrl_lacosmic_parameter_verify | ( | const hdrl_parameter * | param | ) |

Verify basic correctness of the LaCosmic parameters.

Parameters

  param | LaCosmic parameters

Returns
  CPL_ERROR_NONE if everything is ok, an error code otherwise