CR2RE Pipeline Reference Manual 1.6.8
cr2res_bpm.h
1/*
2 * This file is part of the CR2RES Pipeline
3 * Copyright (C) 2002,2003 European Southern Observatory
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02111-1307 USA
18 */
19
20#ifndef CR2RES_BPM_H
21#define CR2RES_BPM_H
22
23/*-----------------------------------------------------------------------------
24 Includes
25 -----------------------------------------------------------------------------*/
26
27#include <cpl.h>
28#include "hdrl.h"
29
30/*-----------------------------------------------------------------------------
31 Define
32 -----------------------------------------------------------------------------*/
33
34typedef enum {
35 CR2RES_BPM_UNSPECIFIED,
36 CR2RES_BPM_GLOBAL_STATS,
37 CR2RES_BPM_LOCAL_STATS,
38 CR2RES_BPM_RUNNING_FILTER
39} cr2res_bpm_method ;
40
41typedef enum _cr2res_bpm_type_ {
42 CR2RES_BPM_DARK = 1 << 0,
43 CR2RES_BPM_FLAT = 1 << 1,
44 CR2RES_BPM_DETLIN = 1 << 2,
45 CR2RES_BPM_OUTOFORDER = 1 << 3,
46 CR2RES_BPM_EDGEPIX = 1 << 4
47} cr2res_bpm_type ;
48#define CR2RES_BPM_ALL CR2RES_BPM_DARK | \
49 CR2RES_BPM_FLAT | \
50 CR2RES_BPM_DETLIN | \
51 CR2RES_BPM_OUTOFORDER | \
52 CR2RES_BPM_EDGEPIX
53
54#define CR2RES_NB_BPM_TYPES 5
55#define CR2RES_NB_BPM_EDGEPIX 4 // same for all detector edges
56#define CR2RES_NB_BPM_VIGN_BOTTOM 40 // vignetted lower area
57
58extern cr2res_bpm_type bpm_types[CR2RES_NB_BPM_TYPES];
59
60/*-----------------------------------------------------------------------------
61 Prototypes
62 -----------------------------------------------------------------------------*/
63
64cpl_mask * cr2res_bpm_compute(
65 cpl_image * in,
66 cr2res_bpm_method method,
67 double kappa,
68 double lines_ratio,
69 int clean_flag) ;
70
72 cpl_image * bpm,
73 cr2res_bpm_type type) ;
74
75cpl_image * cr2res_bpm_from_mask(
76 cpl_mask * mask,
77 cr2res_bpm_type type) ;
78
80 cpl_image * in,
81 const char * bpm,
82 int chip,
83 int correct) ;
84
86 const cpl_image * bpm_ima,
87 cr2res_bpm_type bpm_type) ;
88
90 cpl_image * bpm_ima,
91 cpl_mask * bpm,
92 int bpm_code) ;
93
94int cr2res_bpm_find_bad_pixels(cpl_image * img, double sigma, int size);
95
96cpl_image * cr2res_bpm_mask_edgepix(cpl_image * bpm);
97
98#endif
int cr2res_bpm_add_mask(cpl_image *bpm_ima, cpl_mask *bpm, int bpm_code)
Add a mask to a BPM image with a dedicated code
Definition: cr2res_bpm.c:287
cpl_image * cr2res_bpm_from_mask(cpl_mask *mask, cr2res_bpm_type type)
Create a BPM from a mask.
Definition: cr2res_bpm.c:175
int cr2res_bpm_set_and_correct_image(cpl_image *in, const char *bpm, int chip, int correct)
Set the BPM and optionally apply the correction to an image.
Definition: cr2res_bpm.c:199
cpl_mask * cr2res_bpm_compute(cpl_image *in, cr2res_bpm_method method, double kappa, double lines_ratio, int clean_flag)
The BPM computation with min/max threshold.
Definition: cr2res_bpm.c:78
int cr2res_bpm_count(cpl_image *bpm, cr2res_bpm_type type)
Count BPM of a given type.
Definition: cr2res_bpm.c:148
cpl_mask * cr2res_bpm_extract_mask(const cpl_image *bpm_ima, cr2res_bpm_type bpm_type)
Extract a mask from a BPM image.
Definition: cr2res_bpm.c:247