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