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
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 0x20000000
00080 #define QFLAG_OUTSIDE_DATA_RANGE 0x40000000
00081
00082
00083
00084
00085
00086
00087 double cpl_tools_get_median_double( double *, int ) ;
00088
00089 void xsh_bpmap_set_bad_pixel( cpl_image * bpmap, int ix, int iy,
00090 int flag ) ;
00091 void xsh_bpmap_mask_bad_pixel(cpl_image * bpmap, cpl_mask* mask,
00092 int flag ) ;
00093
00094 cpl_image * xsh_bpmap_collapse_bpmap_create( cpl_imagelist *list ) ;
00095 int xsh_bpmap_count( cpl_image *bpmap, int nx, int ny ) ;
00096 void xsh_bpmap_collapse_median(cpl_image* median, cpl_imagelist *list,
00097 cpl_mask *mask ) ;
00098 void xsh_bpmap_collapse_mean( cpl_image * mean, cpl_imagelist *list,
00099 cpl_mask *mask ) ;
00100 void xsh_set_image_cpl_bpmap( cpl_image * image,
00101 cpl_image *bpmap, int nx, int ny ) ;
00102 void xsh_badpixelmap_or( xsh_pre *self, const xsh_pre *right ) ;
00103 void xsh_bpmap_bitwise_to_flag(cpl_image * bpmap,int flag );
00104 cpl_error_code xsh_badpixelmap_coadd(cpl_frame *self, const cpl_frame *right ) ;
00105
00106
00107 cpl_error_code
00108 xsh_image_clean_badpixel(cpl_frame* in);
00109
00110 cpl_error_code
00111 xsh_image_get_hot_cold_pixs(cpl_frame* frame_image,
00112 xsh_instrument* instrument,
00113 const double ks_low,
00114 const int cold_niter,
00115 const double ks_high,
00116 const int hot_niter,
00117 cpl_frame** cpix_frm,
00118 cpl_frame** hpix_frm);
00119
00120
00121
00122 cpl_frame*
00123 xsh_image_local_cold_pixs(cpl_image* ima,
00124 const double kappa,
00125 const int r,
00126 xsh_instrument* instr);
00127
00128 cpl_frame*
00129 xsh_image_local_hot_pixs(cpl_image* ima,
00130 const double kappa,
00131 const int r,
00132 xsh_instrument* instr);
00133
00134 cpl_error_code
00135 xsh_image_clean_mask_pixs(cpl_image** ima,cpl_image* msk,const int r);
00136 cpl_image* xsh_image_flag_bptype_with_crox(cpl_image* ima);
00137
00138 #endif