00001 00002 /*---------------------------------------------------------------------------- 00003 * E.S.O. 00004 *---------------------------------------------------------------------------- 00005 * File name : cube_arith.c 00006 * Author : Nicolas Devillard 00007 * Created on : Aug 02, 1995 00008 * Hardware : Sun Sparc 20 00009 * Software : ANSI C under Solaris Unix 00010 * Part of ECLIPSE library for Adonis 00011 * Description : cube arithmetic routines 00012 *--------------------------------------------------------------------------*/ 00013 00014 /* 00015 00016 $Id: cube_arith.h,v 1.2 2005/03/13 17:36:17 amodigli Exp $ 00017 $Author: amodigli $ 00018 $Date: 2005/03/13 17:36:17 $ 00019 $Revision: 1.2 $ 00020 00021 */ 00022 00023 #ifndef _CUBE_ARITHMETIC_H_ 00024 #define _CUBE_ARITHMETIC_H_ 00025 00026 00027 /*---------------------------------------------------------------------------- 00028 * Includes 00029 *--------------------------------------------------------------------------*/ 00030 00031 #include <stdio.h> 00032 #include <math.h> 00033 00034 #include "memory.h" 00035 #include "cube_defs.h" 00036 #include "cube_handling.h" 00037 #include "image_arith.h" 00038 00039 00040 /*---------------------------------------------------------------------------- 00041 * Function ANSI C prototypes 00042 *--------------------------------------------------------------------------*/ 00043 00044 /*---------------------------------------------------------------------------- 00045 Function : op_cube() 00046 In : 2 cubes, operation to perform 00047 Out : int 0 if Ok, anything else otherwise (usually -1) 00048 Job : 4 operations between 2 cubes 00049 Notice : The first input cube is modified to contain the 00050 results of the operation. 00051 ---------------------------------------------------------------------------*/ 00052 00053 int 00054 op_cube( 00055 OneCube ** cube1, 00056 OneCube * cube2, 00057 int operation); 00058 00059 00060 /*---------------------------------------------------------------------------- 00061 Function : cst_op_cube() 00062 In : 1 cube, 1 constant, operation to perform 00063 Out : int 0 if Ok, anything else otherwise (usually -1) 00064 Job : 4 operations between a cube and a constant 00065 Notice : possible operations are: 00066 Addition '+' 00067 Subtraction '-' 00068 Multiplication '*' 00069 Division '/' 00070 Logarithm 'l' 00071 Power '^' 00072 Exponentiation 'e' 00073 00074 Warning: THE INPUT CUBE IS MODIFIED! 00075 00076 ---------------------------------------------------------------------------*/ 00077 00078 int 00079 cst_op_cube( 00080 OneCube * cube1, 00081 double constant, 00082 int operation); 00083 00084 00085 00086 00087 /*---------------------------------------------------------------------------- 00088 Function : norm_cube() 00089 In : cube, normalization mode (defined in image_arith.h) 00090 Out : normalized cube 00091 Job : normalize cube 00092 Notice : see image_arith.h for normalization definitions and 00093 normalization types 00094 ---------------------------------------------------------------------------*/ 00095 /* <python> */ 00096 OneCube * 00097 norm_cube( 00098 OneCube * cube1, 00099 int mode 00100 ) ; 00101 /* </python> */ 00102 00103 00104 00105 /*---------------------------------------------------------------------------- 00106 Function : scale_flux_in_cube() 00107 In : OneCube, and an optional double value 00108 Out : a newly allocated cube 00109 Job : scale all image fluxes in the cube to the given double value, 00110 or to the first image flux if no value is provided 00111 Notice : if toFlux is 0.0, the first image flux is used. 00112 ---------------------------------------------------------------------------*/ 00113 00114 /* <python> */ 00115 OneCube * 00116 scale_flux_in_cube( 00117 OneCube * cube1, 00118 double toFlux 00119 ) ; 00120 /* </python> */ 00121 00122 00123 00124 /*---------------------------------------------------------------------------- 00125 Function : thresh_cube() 00126 In : 1 cube, thresholds, values to assign to thresholded pixels 00127 Out : 1 newly allocated thresholded cube 00128 Job : threshold pixel values to an interval 00129 Notice : pixel values under lo_cut are set to assign_lo_cut 00130 pixel values above hi_cut are set to assign_hi_cut 00131 ---------------------------------------------------------------------------*/ 00132 00133 /* <python> */ 00134 OneCube * 00135 thresh_cube( 00136 OneCube * cube1, 00137 pixelvalue lo_cut, 00138 pixelvalue hi_cut, 00139 pixelvalue assign_lo_cut, 00140 pixelvalue assign_hi_cut 00141 ) ; 00142 /* </python> */ 00143 00144 00145 00146 /*---------------------------------------------------------------------------- 00147 Function : cube_sub() 00148 In : two cubes 00149 Out : 0 if Ok, -1 if error, -2 if cannot do it in fast mode 00150 Job : subtract one cube from another 00151 Notice : the first cube is modified: it contains the result of 00152 subtraction. 00153 ---------------------------------------------------------------------------*/ 00154 00155 /* <python> */ 00156 int 00157 cube_sub( 00158 OneCube * c1, 00159 OneCube * c2 00160 ) ; 00161 /* </python> */ 00162 00163 00164 00165 /*---------------------------------------------------------------------------- 00166 Function : cube_add() 00167 In : two cubes 00168 Out : 0 if Ok, -1 if error, -2 if cannot do it in fast mode 00169 Job : add a cube to another 00170 Notice : the first cube is modified: it contains the result of 00171 addition. 00172 ---------------------------------------------------------------------------*/ 00173 00174 /* <python> */ 00175 int 00176 cube_add( 00177 OneCube * c1, 00178 OneCube * c2 00179 ) ; 00180 /* </python> */ 00181 00182 00183 /*---------------------------------------------------------------------------- 00184 Function : cube_mul() 00185 In : two cubes 00186 Out : 0 if Ok, -1 if error, -2 if cannot do it in fast mode 00187 Job : multiply 2 cubes 00188 Notice : the first cube is modified: it contains the result of 00189 multiplication. 00190 ---------------------------------------------------------------------------*/ 00191 00192 /* <python> */ 00193 int 00194 cube_mul( 00195 OneCube * c1, 00196 OneCube * c2 00197 ) ; 00198 /* </python> */ 00199 00200 00201 /*---------------------------------------------------------------------------- 00202 Function : cube_div() 00203 In : two cubes 00204 Out : 0 if Ok, -1 if error, -2 if cannot do it in fast mode 00205 Job : divide 2 cubes 00206 Notice : the first cube is modified: it contains the result of 00207 division. 00208 ---------------------------------------------------------------------------*/ 00209 00210 /* <python> */ 00211 int 00212 cube_div( 00213 OneCube * c1, 00214 OneCube * c2 00215 ) ; 00216 /* </python> */ 00217 00218 /*--------------------------------------------------------------------------- 00219 Function : cube_add_im() 00220 In : 1 allocated cube, 1 allocated image 00221 Out : int 0 if Ok, -1 if error 00222 Job : add an image to all planes in the cube 00223 Notice : the input cube is modified 00224 ---------------------------------------------------------------------------*/ 00225 00226 /* <python> */ 00227 int cube_add_im(OneCube * cu, OneImage * im); 00228 /* </python> */ 00229 00230 /*--------------------------------------------------------------------------- 00231 Function : cube_sub_im() 00232 In : 1 allocated cube, 1 allocated image 00233 Out : int 0 if Ok, -1 if error 00234 Job : subtract an image from all planes in the cube 00235 Notice : the input cube is modified 00236 ---------------------------------------------------------------------------*/ 00237 00238 /* <python> */ 00239 int cube_sub_im(OneCube * cu, OneImage * im); 00240 /* </python> */ 00241 00242 /*--------------------------------------------------------------------------- 00243 Function : cube_mul_im() 00244 In : 1 allocated cube, 1 allocated image 00245 Out : int 0 if Ok, -1 if error 00246 Job : multiply an image by all planes in the cube 00247 Notice : the input cube is modified 00248 ---------------------------------------------------------------------------*/ 00249 00250 /* <python> */ 00251 int cube_mul_im(OneCube * cu, OneImage * im); 00252 /* </python> */ 00253 00254 /*--------------------------------------------------------------------------- 00255 Function : cube_div_im() 00256 In : 1 allocated cube, 1 allocated image 00257 Out : int 0 if Ok, -1 if error 00258 Job : subtract an image from all planes in the cube 00259 Notice : the input cube is modified 00260 ---------------------------------------------------------------------------*/ 00261 00262 /* <python> */ 00263 int cube_div_im(OneCube * cu, OneImage * im); 00264 /* </python> */ 00265 00266 00267 /*---------------------------------------------------------------------------- 00268 Function : time_stdev_on_cube() 00269 In : 1 cube 00270 Out : 1 image 00271 Job : computes the standard deviation of the variation of each 00272 pixel with time. The returned image is an image of std 00273 deviations, it has no physical meaning. 00274 Notice : 00275 ---------------------------------------------------------------------------*/ 00276 00277 /* <python> */ 00278 OneImage * 00279 time_stdev_on_cube( 00280 OneCube * cube1 00281 ); 00282 /* </python> */ 00283 00284 00285 #endif 00286 /*--------------------------------------------------------------------------*/
1.2.13.1 written by Dimitri van Heesch,
© 1997-2001