my_cnct_comp.h

00001 /*---------------------------------------------------------------------------
00002    
00003    File name   :    cnct_comp.h
00004    Created on  :    April 28, 1999
00005    Author      :    Thomas Rogon
00006    Description :    Connected components handling.
00007 
00008  ---------------------------------------------------------------------------*/
00009 
00010 /*
00011     $Id: cnct_comp.h,v 1.24 2000/10/11 13:56:58 ndevilla Exp $
00012     $Author: ndevilla $
00013     $Date: 2000/10/11 13:56:58 $
00014     $Revision: 1.24 $
00015 */
00016 
00017 #ifndef _CNCT_COMP_H_
00018 #define _CNCT_COMP_H_
00019 
00020 /*--------------------------------------------------------------------------
00021                                 Includes
00022  ---------------------------------------------------------------------------*/
00023 
00024 #include <stdlib.h>
00025 
00026 #include "image_handling.h"
00027 #include "pixelmaps.h"
00028 
00029 /*--------------------------------------------------------------------------
00030                                 Defines
00031  ---------------------------------------------------------------------------*/
00032 
00033 /* hack to retrieve largest unsigned integer */
00034 /* with the size of label_pix (255 8bit, 65535 16bit, etc.)  */
00035 #define MAX_LABEL      (65535)    
00036 #define MAX_CLASSNUM   (MAX_LABEL -2) 
00037 
00038 /*
00039  * CNCTCMP_WHITE might in fact be 255 on some systems; 
00040  * DO NOT assume it to have any specific 
00041  * value and refrain from doing any arithmetic based upon it 
00042  * (the algorithm avoids labelling with this value)
00043  * Label CNCTCMP_WHITE is for implementational reasons 
00044  * reserved for temporary unlabelled objects between passes
00045  */
00046 
00047 #define CNCTCMP_WHITE           (PIXELMAP_1)   
00048 #define CNCTCMP_BLACK           (PIXELMAP_0)
00049 
00050 
00051 
00052 #define FIRST_LABEL     2 /* Assumed different from WHITE (see cnct_comp.c) */
00053 
00054 /*--------------------------------------------------------------------------
00055                                New types
00056  ---------------------------------------------------------------------------*/
00057 
00058 /*--------------------------------------------------------------------------*/
00068 /*--------------------------------------------------------------------------*/
00069 typedef ushort16 label_pix ;
00070 
00071 
00072 /*--------------------------------------------------------------------------*/
00081 /*--------------------------------------------------------------------------*/
00082 
00083 typedef struct _LABEL_IMAGE_T_ { 
00084     /* width in pixels */   
00085     size_t      lx;
00086     /* height in pixels */  
00087     size_t      ly ;
00088     /* pixel data */
00089     label_pix  *buf ;
00090     /*
00091      * objects of interest without background(black) and unlabeled(white)
00092      * pixels
00093      */
00094     int         nrealobj; 
00095     /* total number of objects */
00096     int         nobjtot;  
00097 } label_image_t ;
00098 
00099 
00100 
00101 /*--------------------------------------------------------------------------*/
00110 /*--------------------------------------------------------------------------*/
00111 
00112 typedef struct _CC_STATS_T_ {
00113     /* The size in pixels */ 
00114    size_t           numpix;
00115     /* gravity center (unweighted, i.e. all pixels contribute equally) */
00116    double       gcx;        
00117    double       gcy;        
00118     /* std. dev. (error) on gravity center */
00119    double       egcx;       
00120    double       egcy;       
00121     /*  Wet surface:  
00122 
00123                   111           W=pixel belonging to object
00124                  2WWW1          1= single contribution to wet surface
00125                 1WW4W1          2= two contributions to wet surface
00126                 1WWWW1          4= four contributions to wet surface
00127                  1111               The wet surface is here 18
00128 
00129         Perimeter:
00130                  11111          W=pixel belonging to object
00131                 11WWW1          1= single contribution to perimeter
00132                 1WW W1
00133                 1WWWW1
00134                 111111          The perimeter is here 18
00135     */
00136    unsigned long int wetsrf;    
00137     /* perimeter:  - not implemented
00138     unsigned long int prmtr;*/
00139     /* bottom pixel of object */    
00140     int     bottom_x ;
00141     int     bottom_y ;
00142     /* Top most pixel of object */  
00143     int     top_x ;
00144     int     top_y ;
00145     /* leftmost pixel of object */  
00146     int     lef_x ;
00147     int     lef_y ;
00148     /* rightmost pixel of object */ 
00149     int     rig_x ;
00150     int     rig_y ;
00151 } cc_stats_t ;
00152 
00153 
00154 
00155 /*--------------------------------------------------------------------------*/
00164 /*--------------------------------------------------------------------------*/
00165 label_image_t *new_label_image(size_t lx, size_t ly);
00166 
00167 /*--------------------------------------------------------------------------*/
00177 /*--------------------------------------------------------------------------*/
00178 void free_label_image( label_image_t *to_destroy);
00179 
00180 /*--------------------------------------------------------------------------*/
00191 /*--------------------------------------------------------------------------*/
00192 label_image_t* load_label_image_from_pixelmap(char * filename);
00193 
00194 /*--------------------------------------------------------------------------*/
00202 /*--------------------------------------------------------------------------*/
00203 label_image_t* load_label_image(char * filename);
00204 
00205 /*--------------------------------------------------------------------------*/
00216 /*--------------------------------------------------------------------------*/
00217 int dump_labelimage( label_image_t *to_dump, char *filename);
00218 
00219 /*--------------------------------------------------------------------------*/
00231 /*--------------------------------------------------------------------------*/
00232 label_image_t * pixelmap_2_label_image(pixel_map *pm);
00233 
00234 /*--------------------------------------------------------------------------*/
00261 /*--------------------------------------------------------------------------*/
00262 cc_stats_t *labelize_binary(label_image_t *label_image);
00263 
00264 /*--------------------------------------------------------------------------*/
00277 /*--------------------------------------------------------------------------*/
00278 int print_ccfeaturestable( 
00279         cc_stats_t      *   cs, 
00280         unsigned long       numentries, 
00281         FILE            *   f, 
00282         char            *   fin_name);
00283 
00284 /*--------------------------------------------------------------------------*/
00297 /*--------------------------------------------------------------------------*/
00298 int output_ccfeaturestable( 
00299         char            *   fn, 
00300         cc_stats_t      *   cs, 
00301         unsigned long       numobj,  
00302         char            *   fin_name);
00303 
00304 /*--------------------------------------------------------------------------*/
00314 /*--------------------------------------------------------------------------*/
00315 int select_objs(label_image_t* l, int *objlist, int nobjs);
00316 
00317 
00318 /*--------------------------------------------------------------------------*/
00336 /*--------------------------------------------------------------------------*/
00337 int get_extreme_obj_coor(
00338         cc_stats_t  *   cs, 
00339         int             nobjs,
00340         int         *   selected_objlist, 
00341         int             nselectedobjs,
00342         int         *   left, 
00343         int         *   right, 
00344         int         *   top, 
00345         int         *   bot);
00346 
00347 /*---------------------------------------------------------------------------*/
00360 /*---------------------------------------------------------------------------*/
00361 int mask_objs(OneImage          *   in,
00362                 OneImage        *   out,
00363                 label_image_t   *   l, 
00364                 int             *   objlist, 
00365                 int                 nobjs,
00366                 pixelvalue          maskval);
00367 
00368 #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