00001 00002 /*---------------------------------------------------------------------------- 00003 E.S.O. 00004 ----------------------------------------------------------------------------- 00005 File name : image_stats.h 00006 Author : Nicolas Devillard 00007 Created on : Aug 22, 1995 00008 Hardware : Sun Sparc 20 00009 Software : ANSI C under Solaris Unix 00010 Part of ECLIPSE library for Adonis 00011 Description : statistics computation for images 00012 ---------------------------------------------------------------------------*/ 00013 00014 /* 00015 00016 $Id: image_stats.h,v 1.1 2003/09/03 12:50:47 amodigli Exp $ 00017 $Author: amodigli $ 00018 $Date: 2003/09/03 12:50:47 $ 00019 $Revision: 1.1 $ 00020 00021 */ 00022 00023 00024 #ifndef _IMAGE_STATS_H_ 00025 #define _IMAGE_STATS_H_ 00026 00027 00028 00029 /*---------------------------------------------------------------------------- 00030 Includes 00031 ---------------------------------------------------------------------------*/ 00032 00033 #include <stdio.h> 00034 #include <math.h> 00035 00036 #include "memory.h" 00037 #include "image_handling.h" 00038 #include "image_arith.h" 00039 #include "dead_pixels.h" 00040 #include "pixel_handling.h" 00041 #include "median.h" 00042 00043 00044 /*---------------------------------------------------------------------------- 00045 Function ANSI C prototypes 00046 ---------------------------------------------------------------------------*/ 00047 00048 00049 /*--------------------------------------------------------------------------- 00050 Function : get_image_stats() 00051 In : 1 image 00052 Out : image_stats * 00053 Job : computes various statistics of an image 00054 Notice : 00055 ---------------------------------------------------------------------------*/ 00056 00057 image_stats * 00058 get_image_stats(OneImage *image_in) ; 00059 00060 00061 /*--------------------------------------------------------------------------- 00062 Function : get_image_stats_using_pixmap() 00063 In : 1 image, 1 pixel_map 00064 Out : image_stats * 00065 Job : computes various statistics about an image, taking into 00066 account a pixel_map, i.e. only using valid pixels. 00067 Notice : 00068 ---------------------------------------------------------------------------*/ 00069 00070 image_stats * 00071 get_image_stats_using_pixmap( 00072 OneImage * image_in, 00073 pixel_map * badpixmap) ; 00074 00075 00076 /*---------------------------------------------------------------------------- 00077 Function : get_image_stats_on_vig() 00078 In : 1 image + rectangle coordinates 00079 Out : image_stats 00080 Job : compute image stats in a rectangle 00081 Notice : the rectangle is given by 2 points: 00082 lower left corner and upper right corner, 00083 coordinates use the FITS convention (ll corner is 1,1) 00084 ---------------------------------------------------------------------------*/ 00085 /*<python>*/ 00086 image_stats * 00087 get_image_stats_on_vig( 00088 OneImage * image_in, 00089 int llx, 00090 int lly, 00091 int urx, 00092 int ury 00093 ) ; 00094 /*</python>*/ 00095 00096 /*--------------------------------------------------------------------------- 00097 Function : get_mean_pixelvalue_image_on_vig() 00098 In : 1 image, rectangle coordinates 00099 Out : pixelvalue 00100 Job : compute the mean value of an image region 00101 Notice : 00102 ---------------------------------------------------------------------------*/ 00103 00104 pixelvalue 00105 get_mean_pixelvalue_image_on_vig( 00106 OneImage *image_in, 00107 int llx, 00108 int lly, 00109 int urx, 00110 int ury) ; 00111 00112 /*--------------------------------------------------------------------------- 00113 Function : get_mean_pixelvalue_image() 00114 In : 1 image 00115 Out : pixelvalue 00116 Job : compute the mean value of an image 00117 Notice : 00118 ---------------------------------------------------------------------------*/ 00119 00120 pixelvalue 00121 get_mean_pixelvalue_image(OneImage * image_in) ; 00122 00123 00124 /*--------------------------------------------------------------------------- 00125 Function : get_min_pixelvalue_image() 00126 In : 1 image 00127 Out : pixelvalue 00128 Job : find minimum pixel value in an image 00129 Notice : 00130 ---------------------------------------------------------------------------*/ 00131 00132 pixelvalue 00133 get_min_pixelvalue_image(OneImage * image_in) ; 00134 00135 00136 00137 /*--------------------------------------------------------------------------- 00138 Function : get_max_pixelvalue_image() 00139 In : OneImage 00140 Out : pixelvalue 00141 Job : Gets maximum pixel value in an image 00142 Notice : 00143 ---------------------------------------------------------------------------*/ 00144 pixelvalue 00145 get_max_pixelvalue_image(OneImage * in) ; 00146 00147 00148 /*--------------------------------------------------------------------------- 00149 Function : get_median_pixelvalue_image() 00150 In : OneImage 00151 Out : 1 pixelvalue 00152 Job : gets the median pixel value in an image 00153 Notice : 00154 ---------------------------------------------------------------------------*/ 00155 00156 pixelvalue 00157 get_median_pixelvalue_image(OneImage * in) ; 00158 00159 00160 /*--------------------------------------------------------------------------- 00161 Function : get_median_pixelvalue_image_on_vig() 00162 In : OneImage, rectangle coordinates 00163 Out : 1 pixelvalue 00164 Job : gets the median pixel value in an image vignet 00165 Notice : Coordinates use the FITS convention 00166 ---------------------------------------------------------------------------*/ 00167 pixelvalue 00168 get_median_pixelvalue_image_on_vig( 00169 OneImage * in, 00170 int llx, 00171 int lly, 00172 int urx, 00173 int ury) ; 00174 00175 00176 /*--------------------------------------------------------------------------- 00177 Function : get_kth_smallest_pixelvalue_image() 00178 In : OneImage 00179 Out : 1 pixelvalue 00180 Job : gets the kth smallest pixel value in an image 00181 Notice : the '1 smallest value' is the min 00182 ---------------------------------------------------------------------------*/ 00183 00184 pixelvalue 00185 get_kth_smallest_pixelvalue_image(OneImage * in, int k); 00186 00187 00188 /*--------------------------------------------------------------------------- 00189 Function : get_sum_pixels() 00190 In : 1 image 00191 Out : double 00192 Job : compute the sum of all pixelvalues in an image 00193 Notice : 00194 ---------------------------------------------------------------------------*/ 00195 00196 double 00197 get_sum_pixels(OneImage * image_in) ; 00198 00199 00200 /*--------------------------------------------------------------------------- 00201 Function : get_sum_pixels_on_vig() 00202 In : 1 image + rectangle coordinates 00203 Out : double 00204 Job : compute the sum of all pixelvalues in an rectangle 00205 Notice : the rectangle is given by two points: lower left and 00206 upper right corners. Coordinates use the FITS convention 00207 ---------------------------------------------------------------------------*/ 00208 00209 double 00210 get_sum_pixels_on_vig( 00211 OneImage * inimage, 00212 int llx, 00213 int lly, 00214 int urx, 00215 int ury) ; 00216 00217 /*-------------------------------------------------------------------------- 00218 Function : get_stdev_on_image() 00219 In : 1 image 00220 Out : double 00221 Job : compute standard deviation on image 00222 Notice : 00223 ---------------------------------------------------------------------------*/ 00224 00225 double 00226 get_stdev_on_image(OneImage * image_in) ; 00227 00228 00229 00230 /*--------------------------------------------------------------------------- 00231 Function : compute_image_energy() 00232 In : 1 image 00233 Out : 1 (big) double number 00234 Job : compute the energy in an image, i.e. Sum (pix^2) 00235 Notice : leads to huge numbers 00236 for an image of size 2^n x 2^n with p bits per pixel, 00237 the sum of all square pixels is a number with 00238 2n+2p bits 00239 e.g. an square image 1024x1024, 16 bits per pixel: 00240 n=10, p=16, the energy is a number with 20+32 = 52 bits 00241 ---------------------------------------------------------------------------*/ 00242 00243 double 00244 compute_image_energy(OneImage * image_in) ; 00245 00246 00247 00248 /*--------------------------------------------------------------------------- 00249 Function : compute_radius_energy() 00250 In : 1 image, center, radius 00251 Out : double 00252 Job : compute the energy within a circle 00253 Notice : center in (-1, -1) means center of the image 00254 ---------------------------------------------------------------------------*/ 00255 00256 double 00257 compute_radius_energy( 00258 OneImage *image_in, 00259 int cx, 00260 int cy, 00261 int radius) ; 00262 00263 00264 00265 /*--------------------------------------------------------------------------- 00266 Function : find_noise_level_around_peak() 00267 In : 1D array of pixelvalues, array size, peak position 00268 Out : value of background noise level in array around peak 00269 Job : finds out background noise level in a 1d array around peak 00270 Notice : 00271 ---------------------------------------------------------------------------*/ 00272 00273 pixelvalue 00274 find_noise_level_around_peak( 00275 pixelvalue * array, 00276 int array_size, 00277 int max_pos) ; 00278 00279 00280 00281 /*--------------------------------------------------------------------------- 00282 Function : get_fullwidth_on_y_linear() 00283 In : pixelvalue array, array size, peak position, requested 00284 height. 00285 Out : double 00286 Job : compute Full Width at Y with linear method 00287 Notice : 00288 ---------------------------------------------------------------------------*/ 00289 00290 double 00291 get_fullwidth_on_y_linear( 00292 pixelvalue * array, 00293 int array_size, 00294 int max_pos, 00295 double Y) ; 00296 00297 00298 00299 /*--------------------------------------------------------------------------- 00300 Function : get_fwhm_on_image() 00301 In : 1 image 00302 threshold flag, threshold value 00303 x,y position of expected peak 00304 half size of zone containing peak 00305 Out : pointer to 2 double: FWHM_x, FWHM_y 00306 Job : computes the Full Width at Half Maximum in an image in 00307 x and y direction, given a peak position 00308 Notice : 00309 ---------------------------------------------------------------------------*/ 00310 00311 double * 00312 get_fwhm_on_image( 00313 OneImage * image_in, 00314 boolean thres_flag, 00315 pixelvalue thres_value, 00316 int x_expect, 00317 int y_expect, 00318 int half_size) ; 00319 00320 00321 /*--------------------------------------------------------------------------- 00322 Function : get_radius_on_image() 00323 In : 1 image 00324 x,y position of expected peak 00325 half size of zone containing peak 00326 plate scale in arc second per pixel 00327 TotalRadius (100% Energy radius) in arc seconds 00328 percentage of energy for which the radius is wanted 00329 Out : double radius 00330 Job : computes the radius which corresponds to a percentage 00331 of the encircled energy 00332 Notice : returns -1 if something goes wrong 00333 ---------------------------------------------------------------------------*/ 00334 00335 double 00336 get_radius_on_image( 00337 OneImage * image_in, 00338 int x_expect, 00339 int y_expect, 00340 int half_size, 00341 double Plate_Scale, 00342 double TotalRadius, 00343 int percent 00344 ) ; 00345 00346 00347 /*--------------------------------------------------------------------------- 00348 Function : get_bary_of_image() 00349 In : pointer to one image 00350 Out : pixel_position 00351 Job : finds the barycenter of an image (only takes into account 00352 pixels that are above a threshold defined as: 00353 min + ( max - min ) / 2 00354 Notice : 00355 ---------------------------------------------------------------------------*/ 00356 00357 00358 pixel_position get_bary_of_image(OneImage * image_in) ; 00359 00360 00361 /*-------------------------------------------------------------------------- 00362 Function : image_median_stat() 00363 In : OneImage , 00364 Out : median_value of pixels in image, 00365 sigma (using median_value as mean estimate) 00366 Job : computes first and second order image statistics using 00367 median value; 00368 Notice : useful for kappa/sigma rejection 00369 -------------------------------------------------------------------------*/ 00370 double image_median_stat(OneImage *in, double *sigma); 00371 00372 #endif
1.2.13.1 written by Dimitri van Heesch,
© 1997-2001