cube2image.h

00001 
00002 /*----------------------------------------------------------------------------
00003  *                                  E.S.O.
00004  *----------------------------------------------------------------------------
00005  * File name    :   cube2image.h
00006  * Author       :   Nicolas Devillard
00007  * Created on   :   Sept 14, 1995
00008  * Hardware     :   Sun Sparc 20
00009  * Software     :   ANSI C under Solaris Unix
00010  *                  Part of ECLIPSE library for Adonis
00011  * Description  :   cube averaging to a single plane
00012  *--------------------------------------------------------------------------*/
00013 
00014 /*
00015 
00016  $Id: cube2image.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 #ifndef _CUBE2IMAGE_H_
00024 #define _CUBE2IMAGE_H_
00025 
00026 
00027 /*----------------------------------------------------------------------------
00028  *                              Includes
00029  *--------------------------------------------------------------------------*/
00030 
00031 #include "memory.h"
00032 #include "filename.h"
00033 #include "idformat.h"
00034 #include "cube_handling.h"
00035 #include "image_arith.h"
00036 #include "extraction.h"
00037 #include "pixel_handling.h"
00038 
00039 /*----------------------------------------------------------------------------
00040  *                              New Types
00041  *--------------------------------------------------------------------------*/
00042 
00043 
00044 typedef enum _AVG_CUT_ {
00045     cut_whole,
00046     cut_cycle,
00047     cut_running
00048 } average_cut ;
00049 
00050 typedef enum _AVG_METHOD_ {
00051     avg_linear,
00052     avg_median,
00053     avg_sum,
00054     avg_filtered
00055 } average_method ;
00056 
00057 
00058 
00059 
00060 /*----------------------------------------------------------------------------
00061  *                      Function ANSI C prototypes
00062  *--------------------------------------------------------------------------*/
00063 
00064 /*---------------------------------------------------------------------------
00065    Function :   average_engine()
00066    In       :   input and output names,
00067                 low and high thresholds for filter average
00068                 cycle_step for cycle average
00069                 halfwidth for running filter
00070    Out      :   int 0 if Ok, -1 otherwise
00071    Job      :   average a cube to a cube or file
00072    Notice   :
00073  ---------------------------------------------------------------------------*/
00074 
00075 int average_engine(
00076     char        *   name_in,
00077     char        *   name_out,
00078     average_cut     acut,
00079     average_method  amethod,
00080     int             cycle_step,
00081     int             run_hw,
00082     double          lo_rej,
00083     double          hi_rej
00084 ) ;
00085 
00086 
00087 
00088 /*----------------------------------------------------------------------------
00089  * Function :   average_cube_to_image()
00090  * In       :   cube
00091  * Out      :   image
00092  * Job      :   the output image is a simple average of the input cube
00093  * Notice   :
00094  *--------------------------------------------------------------------------*/
00095 
00096 OneImage    *
00097 average_cube_to_image(
00098     OneCube *   incube
00099 ) ;
00100 
00101 /*----------------------------------------------------------------------------
00102  * Function :   average_with_rejection()
00103  * In       :   1 cube, rejection percentage for upper and lower values
00104  * Out      :   1 image
00105  * Job      :   average a cube along time, rejecting for each time line
00106  *              the requested percentage of highest and lowest pixel
00107  *              values.
00108  * Notice   :   cannot have lo_reject + hi_reject > 90%
00109  *              rejection thresholds are given in [0..1] (double)
00110  *--------------------------------------------------------------------------*/
00111 /*<python>*/
00112 OneImage *
00113 average_with_rejection(
00114     OneCube *   incube,
00115     double      lo_reject,
00116     double      hi_reject
00117 ) ;
00118 /*</python>*/
00119 
00120 
00121 /*----------------------------------------------------------------------------
00122  * Function :   average_reject_on_time_line()
00123  * In       :   a time line of pixels, two rejection percentages in [0..1]
00124  * Out      :   a single pixel value
00125  * Job      :   average pixels on a line, rejecting the lo_reject
00126  *              percentage of lower pixel values, and hi_reject
00127  *              percentage of higher pixel values
00128  * Notice   :
00129  *--------------------------------------------------------------------------*/
00130 
00131 pixelvalue
00132 average_reject_on_time_line(
00133     OneCube     *   in_cube,
00134     ulong32         pos,
00135     double          lo_rej,
00136     double          hi_rej) ;
00137 
00138 /*----------------------------------------------------------------------------
00139  * Function :   sum_cube_to_image()
00140  * In       :   cube
00141  * Out      :   image
00142  * Job      :   the output image is a sum of all planes in the cube
00143  * Notice   :
00144  *--------------------------------------------------------------------------*/
00145 
00146 OneImage    *
00147 sum_cube_to_image(
00148     OneCube *   incube
00149 ) ;
00150 
00151 
00152 
00153 /*----------------------------------------------------------------------------
00154  * Function :   median_average_cube_to_image()
00155  * In       :   cube
00156  * Out      :   image
00157  * Job      :   average a cube to a median image
00158  * Notice   :   the median value is a weighted average of:
00159  *              the 3 central values for an odd # of planes
00160  *              the 4 central values for an even # of planes
00161  *--------------------------------------------------------------------------*/
00162 
00163 OneImage *
00164 median_average_cube_to_image(OneCube *  to_average) ;
00165 
00166 
00167 /*----------------------------------------------------------------------------
00168  * Function :   cycle_average_cube()
00169  * In       :   cube, cycle length
00170  * Out      :   cube
00171  * Job      :   make a cycle average cube from another cube
00172  * Notice   :
00173  * Example  :   the input cube has 120 planes, the cycle value is 30,
00174  *              the output cube contains 120/30 = 4 planes, each plane
00175  *              being an average of 30 planes of the input cube.
00176  *--------------------------------------------------------------------------*/
00177 
00178 OneCube *
00179 cycle_average_cube(OneCube * incube, int cycle) ;
00180 
00181 
00182 
00183 /*----------------------------------------------------------------------------
00184  * Function :   cycle_sum_cube()
00185  * In       :   cube, cycle length
00186  * Out      :   cube
00187  * Job      :   make a cycle sum cube from another cube
00188  * Notice   :   see above cycle_average_cube() for definition of cycle
00189  *--------------------------------------------------------------------------*/
00190 
00191 OneCube *
00192 cycle_sum_cube(OneCube * incube, int cycle) ;
00193 
00194 
00195 
00196 /*----------------------------------------------------------------------------
00197  * Function :   cycle_median_cube()
00198  * In       :   cube, cycle length
00199  * Out      :   cube
00200  * Job      :   make a median cycle cube from another cube
00201  * Notice   :   see above cycle_average_cube() for a definition of cycle
00202  *--------------------------------------------------------------------------*/
00203 
00204 OneCube *
00205 cycle_median_cube(OneCube * incube, int cycle) ;
00206 
00207 
00208 
00209 /*----------------------------------------------------------------------------
00210  * Function :   extract_median_on_time_line()
00211  * In       :   cube, pixel position
00212  * Out      :   pixel value
00213  * Job      :   computes the median value of a pixel position along time
00214  * Notice   :   position is given as pos = i + j*lx
00215  *              returns (pixelvalue)-1 in case of error
00216  *--------------------------------------------------------------------------*/
00217 
00218 pixelvalue
00219 extract_median_on_time_line(
00220     OneCube     *   in_cube,
00221     ulong32         pos) ;
00222 
00223 
00224 
00225 /*----------------------------------------------------------------------------
00226  * Function :   running_linear_average_cube()
00227  * In       :   cube, half cycle
00228  * Out      :   newly allocated cube
00229  * Job      :   running linear average of a cube to an image
00230  *              each output plane is a linear average of the planes
00231  *              around [-halfcycle, +halfcycle] in the input cube. For
00232  *              the first and last halcycle planes, only existing planes
00233  *              are taken into account.
00234  * Example  :   running average of a cube containing 7 planes, with a
00235  *              halfcycle of 2.
00236  *
00237  *              output plane:       average of input planes:
00238  *              1                   1 2 3
00239  *              2                   1 2 3 4
00240  *              3                   1 2 3 4 5
00241  *              4                     2 3 4 5 6
00242  *              5                       3 4 5 6 7
00243  *              6                         4 5 6 7
00244  *              7                           5 6 7
00245  * Notice   :   Not optimized at all, to cover all the greatest possible
00246  *              number of cases.
00247  *--------------------------------------------------------------------------*/
00248 
00249 OneCube *
00250 running_linear_average_cube
00251 (
00252     OneCube *   incube,
00253     int         half_cycle
00254 ) ;
00255 
00256 
00257 
00258 /*----------------------------------------------------------------------------
00259  * Function :   running_sum_cube()
00260  * In       :   cube filename, half cycle
00261  * Out      :   newly allocated cube
00262  * Job      :   running sum of a cube to an image
00263  *              each output plane is a sum of the planes
00264  *              around [-halfcycle, +halfcycle] in the input cube. For
00265  *              the first and last halcycle planes, only existing planes
00266  *              are taken into account.
00267  * Example  :   running sum of a cube containing 7 planes, with a
00268  *              halfcycle of 2.
00269  *
00270  *              output plane:       average of input planes:
00271  *              1                   1 2 3
00272  *              2                   1 2 3 4
00273  *              3                   1 2 3 4 5
00274  *              4                     2 3 4 5 6
00275  *              5                       3 4 5 6 7
00276  *              6                         4 5 6 7
00277  *              7                           5 6 7
00278  * Notice   :   Not optimized at all, to cover all the greatest possible
00279  *              number of cases.
00280  *--------------------------------------------------------------------------*/
00281 
00282 OneCube *
00283 running_sum_cube
00284 (
00285     OneCube *   incube,
00286     int         half_cycle
00287 ) ;
00288 
00289 
00290 
00291 /*----------------------------------------------------------------------------
00292  * Function :   running_median_average_cube()
00293  * In       :   cube filename, half cycle
00294  * Out      :   newly allocated cube
00295  * Job      :   running median average of a cube to an image
00296  *              each output plane is a median average of the planes
00297  *              around [-halfcycle, +halfcycle] in the input cube. For
00298  *              the first and last halcycle planes, only existing planes
00299  *              are taken into account.
00300  * Example  :   running median average of a cube containing 7 planes, with a
00301  *              halfcycle of 2.
00302  *
00303  *              output plane:       average of input planes:
00304  *              1                   1 2 3
00305  *              2                   1 2 3 4
00306  *              3                   1 2 3 4 5
00307  *              4                     2 3 4 5 6
00308  *              5                       3 4 5 6 7
00309  *              6                         4 5 6 7
00310  *              7                           5 6 7
00311  * Notice   :   Not optimized at all, to cover all the greatest possible
00312  *              number of cases.
00313  *--------------------------------------------------------------------------*/
00314 
00315 OneCube *
00316 running_median_average_cube
00317 (
00318     OneCube *   incube,
00319     int         half_cycle
00320 ) ;
00321 
00322 
00323 #endif
00324 /*--------------------------------------------------------------------------*/
00325 

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