obj_stats.h

00001 /*---------------------------------------------------------------------------
00002                                     E.S.O.
00003  ----------------------------------------------------------------------------
00004    File name    :   obj_stats.h
00005    Author       :   Thomas Rogon
00006    Created on   :   17 May 1999
00007    Language     :   ANSI C
00008                     Part of ECLIPSE library
00009    Description  :   Extended statistics on detected objects by
00010                     connected components, involving data from 
00011                     grey image also.
00012     Notice      :   C-style indexing in image arrays used (add
00013                     FITS_OFS_X, FITS_OFS_Y - see simple.h - 
00014                     to obtain FITS style coordinates).
00015 
00016  *--------------------------------------------------------------------------*/
00017 /*
00018 
00019     $Id: obj_stats.h,v 1.1 2003/09/03 12:50:47 amodigli Exp $
00020     $Author: amodigli $
00021     $Date: 2003/09/03 12:50:47 $
00022     $Revision: 1.1 $
00023 
00024 */
00025 
00026 
00027 /*---------------------------------------------------------------------------
00028                                                                 Includes
00029  ---------------------------------------------------------------------------*/
00030 #ifndef _OBJECT_STATS_H_
00031 #define _OBJECT_STATS_H_
00032 
00033 #include "local_types.h"
00034 #include "cnct_comp.h"
00035 #include "image_stats.h"
00036 
00037 
00038 /*---------------------------------------------------------------------------
00039                                                                 New types
00040  ---------------------------------------------------------------------------*/
00041 typedef struct _OBJ_STATS_T_ {
00042 /* Maximal pixel value & coordinates */
00043     pixel_position  Max;    
00044 /* Minimal pixel value & coordinates */
00045     pixel_position  Min;    
00046 /* Full width at half maximum */
00047     double          fwhm_x ;    
00048     double          fwhm_y ;    
00049 /* First order pixel value statistics */
00050     double          mean;   
00051     double          stdev;      
00052 /* Weighted gravity center, affected by fine positioining */
00053     double          wgcx;       
00054     double          wgcy;       
00055 /* std. dev. (error) on gravity center, not re-evaluated by fine positioining*/
00056     double          ewgcx;      
00057     double          ewgcy;  
00058 /* photometry results */
00059     double          background;
00060     double          flux;
00061 } obj_stats_t ;
00062 
00063 
00064 typedef struct _FWHM_PARAM_T_{
00065     boolean         thres_flag; /* 0=calculate, 1= user specified*/
00066     pixelvalue      thres_value; /* user specified ... */
00067 } fwhm_param_t;
00068 
00069 
00070 typedef struct _PHOT_PARAM_T_{
00071     boolean         compute_phot;/* compute photometry at all ? */
00072     boolean         compute_bg; /* compute bg ? (if not assume 0.0)*/
00073     double          radius;     /* innermost */
00074     double          rad_int;
00075     double          rad_ext ;   /* outermost */
00076     int             method;     /* median or mean, see get_background_flux()*/
00077 } phot_param_t;
00078 
00079 
00080 /*----------------------------------------------------------------------------
00081  * Function :   find__objects()
00082  * In       :   an image, a sigma rejection threshold (floa), and
00083  *              intermediate printing flags.
00084  *              To have the function return a list of pixel positions,
00085  *              set print_flags to 0. n_objects is then not updated and
00086  *              NULL is returned.
00087  *              Other flags are described above.
00088  * Out      :   a list of pixel positions, and a number of pixels
00089  *              or a list of positions in requested format on stdout.
00090  * Job      :   find out the peaks in an astronomical image
00091  * Notice   :   This function is an alternative to find_bright_objects 
00092  *                  (see detpeak.h) using a non-recursive connected
00093  *                  components routine (see cnct_comp.h) instead of the
00094  *                  recursive flood fill  
00095  *--------------------------------------------------------------------------*/
00096 int get_obj_stats( OneImage  *g, label_image_t *l,
00097                     obj_stats_t *os, cc_stats_t *cs);
00098 
00099 /*---------------------------------------------------------------------------
00100  * Function :   output_obj_featurestable()
00101  * In       :   FILE name string, array of object stats,
00102  *              number of objects reported by labelize_binary
00103  * Out      :   0 if OK, -1 if not OK 
00104  * Notice   :   File name==NULL implies stdout
00105  *--------------------------------------------------------------------------*/
00106 int output_obj_featurestable( char *fn, obj_stats_t *os, unsigned long numobj) ;
00107 
00108 /*---------------------------------------------------------------------------
00109  * Function :  print_obj_featurestable()
00110  * In       :  FILE pointer, array of object stats
00111  * Out      :  0 if OK, -1 if not OK 
00112  * Job      :  prints object stats (see obj_stats_t)
00113  *--------------------------------------------------------------------------*/
00114 int print_obj_featurestable( obj_stats_t *os, unsigned long numentries, 
00115                                         FILE *f);
00116 /*---------------------------------------------------------------------------
00117  * Function :   new_obj_stats_table()
00118  * In       :   number of objects found by labelize_binary+2 (i.e. 
00119  *              including BLACk & WHITE)
00120  * Out      :   Pointer to newly allocated structure 
00121  * Job      :   Allocates and initializes space for a new obj_stats_t table
00122  *              to clear (or invalid where appropriate) values
00123  * Notice   :   The allocated obj_stats_t table will have
00124  *              numobj elements as required by get_obj_stats
00125  *--------------------------------------------------------------------------*/
00126 obj_stats_t *new_obj_stats_table( size_t numobj) ;
00127 
00128 /*---------------------------------------------------------------------------
00129  * Function :   get_obj_fwhm()
00130  * In       :   1 gray image, 1 label image
00131  *              1 fwhm parameter block
00132  *              1 computed cc_stats_t with valid max/min positions
00133  *              1 allocated obj_stats_t table to fill in with fwhm values
00134  * Out      :   0 if OK -1 if not
00135  * Job      :   computes the Full Width at Half Maximum for all objects in the
00136  *              label image.
00137  * Notice   :   if the fwhm cannot be computed correctly it is assigned 
00138  *              an error value (-1.0)
00139  *              In verbose mode, warnings are issued if the 4 points
00140  *              defined by the fwhm in fact belong to other objects
00141  *              This can be an indication of close proximity of the
00142  *              objects perhaps due to sub-optimal binarization
00143  *              threshold or morphology on the binary image
00144  *--------------------------------------------------------------------------*/
00145 int get_obj_fwhm( OneImage      *image_in,  label_image_t *l,
00146                   fwhm_param_t  *fwhm_p,    cc_stats_t *cs,
00147                   obj_stats_t   *os);
00148 
00149 /*---------------------------------------------------------------------------
00150  * Function :   get_median_fwhm()
00151  * In       :   
00152  *              1 label image
00153  *              1 allocated obj_stats_t table with fwhm values
00154  * Out      :   0 if OK -1 if not
00155  * Job      :   computes the median of the Full Width at Half Maximum 
00156  *              
00157  * Notice   :   invalid fwhm values (-1.0) are excluded from the 
00158  *              median computation.
00159  *--------------------------------------------------------------------------*/
00160 int get_median_fwhm( label_image_t *l, obj_stats_t *os,
00161         double *med_x, double *med_y, double *med_a);
00162 
00163 
00164 /*----------------------------------------------------------------------------
00165  * Function :   compute_phot()
00166  * In       :   grey image, computed cc stats, 
00167  *              number of objects (including BLACk and WHITE)
00168  *              an array of object stats to fill in
00169  *              a filled out photometry parameter block phot_param_t
00170  * Out      :   0 if OK -1 if not
00171  * Job      :   Photometric measurement routine
00172  * Notice   :   if the background computes to a negative value
00173  *              0 is used as background for the flux computation
00174  *--------------------------------------------------------------------------*/
00175 int compute_phot(OneImage *in, cc_stats_t *cs, int numobj, 
00176                 obj_stats_t *os, phot_param_t *phot_param);
00177 #endif

Generated on Wed Oct 26 13:08:53 2005 for SINFONI Pipeline Reference Manual by doxygen1.2.13.1 written by Dimitri van Heesch, © 1997-2001