00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef XSH_BADPIXELMAP_H
00029 #define XSH_BADPIXELMAP_H
00030
00031
00032
00033
00034 #include <xsh_cpl_size.h>
00035 #include <xsh_data_instrument.h>
00036 #include <xsh_data_pre.h>
00037 #include <string.h>
00038 #include <cpl.h>
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050 #define QFLAG_GOOD_PIXEL 0
00051 #define QFLAG_TELLURIC_CORRECTED 1
00052 #define QFLAG_TELLURIC_UNCORRECTED 0x2
00053 #define QFLAG_GHOST_STRAY_LIGHT 0x4
00054 #define QFLAG_ELECTRONIC_PICKUP 0x8
00055 #define QFLAG_COSMIC_RAY_REMOVED 0x10
00056
00057
00058 #define XSH_GOOD_PIXEL_LEVEL QFLAG_COSMIC_RAY_REMOVED
00059 #define XSH_BAD_PIXEL XSH_GOOD_PIXEL_LEVEL+1
00060
00061
00062
00063 #define QFLAG_COSMIC_RAY_UNREMOVED 0x20
00064 #define QFLAG_LOW_QE_PIXEL 0x40
00065 #define QFLAG_CALIB_FILE_DEFECT 0x80
00066 #define QFLAG_HOT_PIXEL 0x100
00067 #define QFLAG_DARK_PIXEL 0x200
00068 #define QFLAG_QUESTIONABLE_PIXEL 0x400
00069 #define QFLAG_WELL_SATURATION 0x800
00070 #define QFLAG_ADC_SATURATION 0x1000
00071 #define QFLAG_CAMERA_DEFECT 0x2000
00072 #define QFLAG_OTHER_BAD_PIXEL 0x4000
00073
00074 #define QFLAG_NON_LINEAR_PIXEL 0x8000
00075 #define QFLAG_NON_SPATIAL_UNIFORMITY 0x10000
00076 #define QFLAG_DIVISOR_ZERO 0x20000
00077 #define QFLAG_OUT_OF_NOD 0x40000
00078
00079 #define QFLAG_MISSING_DATA 0x80000
00080 #define QFLAG_SATURATED_DATA 0x100000
00081 #define QFLAG_NEGATIVE_DATA 0x200000
00082 #define QFLAG_INTERPOL_FLUX 0x400000
00083 #define QFLAG_OUTSIDE_DATA_RANGE 0x40000000
00084
00085
00086
00087
00088
00089
00090 double cpl_tools_get_median_double( double *, int ) ;
00091
00092 void xsh_bpmap_set_bad_pixel( cpl_image * bpmap, int ix, int iy,
00093 int flag ) ;
00094 void xsh_bpmap_mask_bad_pixel(cpl_image * bpmap, cpl_mask* mask,
00095 int flag ) ;
00096
00097 cpl_frame*
00098 xsh_badpixelmap_crea_master_from_bpmap(cpl_frame* bpmap, xsh_instrument* inst);
00099
00100 cpl_image * xsh_bpmap_collapse_bpmap_create( cpl_imagelist *list,const int decode_bp ) ;
00101 int xsh_bpmap_count( cpl_image *bpmap, int nx, int ny ) ;
00102 void xsh_bpmap_collapse_median(cpl_image* median, cpl_imagelist *list,
00103 cpl_mask *mask ) ;
00104 void xsh_bpmap_collapse_mean( cpl_image * mean, cpl_imagelist *list,
00105 cpl_mask *mask ) ;
00106 void xsh_set_image_cpl_bpmap( cpl_image * image,
00107 cpl_image *bpmap, const int decode_bp ) ;
00108 void xsh_badpixelmap_or( xsh_pre *self, const xsh_pre *right ) ;
00109 void xsh_bpmap_bitwise_to_flag(cpl_image * bpmap,int flag );
00110 cpl_error_code xsh_badpixelmap_coadd(cpl_frame *self, const cpl_frame *right,const int mode ) ;
00111
00112
00113 cpl_error_code
00114 xsh_image_clean_badpixel(cpl_frame* in);
00115
00116 cpl_error_code
00117 xsh_frame_qual_update(cpl_frame *frame, const cpl_frame *bpmap,xsh_instrument* instrument );
00118
00119 cpl_error_code
00120 xsh_image_get_hot_cold_pixs(cpl_frame* frame_image,
00121 xsh_instrument* instrument,
00122 const double ks_low,
00123 const int cold_niter,
00124 const double ks_high,
00125 const int hot_niter,
00126 cpl_frame** cpix_frm,
00127 cpl_frame** hpix_frm);
00128
00129
00130
00131 cpl_frame*
00132 xsh_image_local_cold_pixs(cpl_image* ima,
00133 const double kappa,
00134 const int r,
00135 xsh_instrument* instr);
00136
00137 cpl_frame*
00138 xsh_image_local_hot_pixs(cpl_image* ima,
00139 const double kappa,
00140 const int r,
00141 xsh_instrument* instr);
00142 void
00143 xsh_image_flag_bp(cpl_image * image,cpl_image * mask, xsh_instrument* inst);
00144
00145 cpl_error_code
00146 xsh_image_clean_mask_pixs(cpl_image** ima,cpl_image* msk,const int r);
00147 cpl_image* xsh_image_flag_bptype_with_crox(cpl_image* ima);
00148 cpl_error_code
00149 xsh_badpixelmap_flag_saturated_pixels(xsh_pre* pre,xsh_instrument* instr,const double cor_val, int flag, int* nsat);
00150 cpl_error_code
00151 xsh_badpixelmap_fill_bp_pattern_holes(cpl_frame* frm);
00152 cpl_error_code
00153 xsh_badpixelmap_image_coadd(cpl_image **self, const cpl_image *right,const int mode );
00154 cpl_frame* xsh_badpixelmap_extract(cpl_frame* frame, int xmin, int ymin,
00155 int xmax, int ymax);
00156 cpl_error_code
00157 xsh_badpixelmap_count_range_pixels(xsh_pre* pre,
00158 const double thresh_min,
00159 const double thresh_max,
00160 const double cor_val,
00161 int* nrange,
00162 double* frange);
00163 #endif