00001
00002 /*----------------------------------------------------------------------------
00003 E.S.O.
00004 -----------------------------------------------------------------------------
00005 File name : local_types.h
00006 Author : Nicolas Devillard
00007 Created on : Nov 27, 1995
00008 Hardware : Sun Sparc 20
00009 Software : ANSI C under Solaris Unix
00010 Part of ECLIPSE library for Adonis
00011 Description : all shared local types for eclipse
00012 ---------------------------------------------------------------------------*/
00013
00014 /*---------------------------------------------------------------------------
00015 PUBLIC NOTICE AS REQUIRED BY LAW: Any use of this product, in any
00016 manner whatsoever, will increase the amount of disorder in the
00017 universe. Although no liability is implied herein, the consumer is
00018 warned that this process will ultimately lead to the heat death of the
00019 universe.
00020 ---------------------------------------------------------------------------*/
00021
00022 /*
00023
00024 $Id: local_types.h,v 1.2 2004/06/23 09:53:27 amodigli Exp $
00025 $Author: amodigli $
00026 $Date: 2004/06/23 09:53:27 $
00027 $Revision: 1.2 $
00028
00029 */
00030
00031 #ifndef _ECLIPSE_TYPES_H_
00032 #define _ECLIPSE_TYPES_H_
00033
00034
00035 /*----------------------------------------------------------------------------
00036 Includes
00037 *--------------------------------------------------------------------------*/
00038
00039 #include <sys/types.h>
00040 #include <limits.h>
00041 #include <stdlib.h>
00042 #include <stdio.h>
00043 #include <string.h>
00044
00045 #include "cube_defs.h"
00046 #include "mmap_i.h"
00047 #include "reg_alloc.h"
00048
00049 /*----------------------------------------------------------------------------
00050 Defines
00051 *--------------------------------------------------------------------------*/
00052
00053 /*
00054 * this makes use of "inline" invisible to compilers that do not support it
00055 */
00056
00057 #ifndef inline
00058 #define inline
00059 #endif
00060
00061
00062 #ifdef TRUE
00063 #undef TRUE
00064 #endif
00065 #ifdef FALSE
00066 #undef FALSE
00067 #endif
00068
00069 /*
00070 * These defines are used only by the fseek() function. For portability
00071 * reasons, the SEEK_SET, SEEK_CUR, and SEEK_END values may not be
00072 * defined. They are here in this case.
00073 */
00074
00075 #ifndef SEEK_SET
00076 #define SEEK_SET 0
00077 #endif
00078
00079 #ifndef SEEK_CUR
00080 #define SEEK_CUR 1
00081 #endif
00082
00083 #ifndef SEEK_END
00084 #define SEEK_END 2
00085 #endif
00086
00087
00088
00089 /*----------------------------------------------------------------------------
00090 New types
00091 ---------------------------------------------------------------------------*/
00092
00093
00094 /*
00095 * These types are defined for portability issues
00096 * On DEC-Alpha stations, long is 64 bits, but int is 32
00097 * We have to redefine all int values accordingly to ensure
00098 * portability!
00099 */
00100
00101 #ifdef _DEC_ALPHA
00102 typedef unsigned int ulong32 ;
00103 typedef int long32 ;
00104 #else
00105 typedef unsigned long ulong32 ;
00106 typedef long long32 ;
00107 #endif
00108
00109 typedef unsigned short ushort16 ;
00110 typedef short short16 ;
00111
00112 typedef unsigned char uchar8 ;
00113 typedef char char8 ;
00114
00115 typedef unsigned char BYTE ;
00116
00117 /* defined in limits.h, redefined here for portability */
00118
00119 #define LONG32_MIN (long32)(-2147483647-1)
00120 #define LONG32_MAX (long32)(2147483647)
00121 #define ULONG32_MAX (ulong32)(4294967295)
00122
00123 #define SHRT16_MIN (short16)(-32768)
00124 #define SHRT16_MAX (short16)(32767)
00125 #define USHRT16_MAX (ushort16)(65535)
00126
00127 typedef struct _DOUBLE_COMPLEX_ {
00128 double x, y ;
00129 } dcomplex ;
00130
00131
00132 /*--------------------------------------------------------------------------*/
00133 /* Boolean type */
00134 typedef enum _BOOLEAN_
00135 {
00136 FALSE = 0,
00137 TRUE = 1
00138 } boolean ;
00139
00140
00141 /*--------------------------------------------------------------------------*/
00142 /* pixelvalue is the internal Pixel representation */
00143
00144 #ifdef DOUBLEPIX
00145 typedef double pixelvalue ;
00146 #else
00147 typedef float pixelvalue ;
00148 #endif
00149
00150
00151 /*--------------------------------------------------------------------------*/
00152 /* The following structure stores pixel positions in an image */
00153
00154 typedef struct _PIXEL_POSITION_
00155 {
00156 double x ;
00157 double y ;
00158 pixelvalue i ; /* optional field */
00159 } pixel_position ;
00160
00161 /*--------------------------------------------------------------------------*/
00162 /* The following structure is a forward linked-list storing pixels */
00163
00164 typedef struct _PIXEL_LIST_
00165 {
00166 pixel_position pos ;
00167 pixelvalue val ;
00168 struct _PIXEL_LIST_ *next ;
00169 } pixel_list ;
00170
00171 #define NullPixelList (pixel_list*)NULL
00172
00173 /*--------------------------------------------------------------------------*/
00174 /* This is the internal Image Structure */
00175 /* <python> */
00176 typedef struct _ONE_IMAGE_
00177 {
00178 int lx, ly ;
00179 pixelvalue * data ;
00180 ulong32 nbpix ;
00181 reg_alloc_entry reg ;
00182 } OneImage ;
00183 /* </python> */
00184
00185 /* This simplifies the notations */
00186 #define NullImage (OneImage*)NULL
00187
00188 /*--------------------------------------------------------------------------*/
00189 /* This is a statistics structure for images. */
00190 /* <python> */
00191 typedef struct _IMAGE_STATS_
00192 {
00193 pixelvalue min_pix ;
00194 pixelvalue max_pix ;
00195 pixelvalue avg_pix ;
00196 double stdev ;
00197 double energy ;
00198 double flux ;
00199 double absflux ;
00200
00201 int min_x, min_y ;
00202 int max_x, max_y ;
00203 } image_stats ;
00204 /* </python> */
00205
00206 /*--------------------------------------------------------------------------*/
00207 /* This holds the minimum information needed in order to deal with cubes */
00208 /* It is returned by GetCubeInformation() */
00209
00210 typedef struct _CUBE_INFO_
00211 {
00212 int lx ;
00213 int ly ;
00214 int n_im ;
00215 int ptype ;
00216 ulong32 headersize ;
00217 double b_scale ;
00218 double b_zero ;
00219 boolean timeflag ;
00220 } cube_info ;
00221
00222
00223 /*--------------------------------------------------------------------------*/
00224 /* This is the DeadPixel structure used to identify dead pixels in a cube */
00225 /* <python> */
00226 typedef struct _PIXEL_MAP_
00227 {
00228 int lx, ly ;
00229 ulong32 nbpix ;
00230 ulong32 ngoodpix ;
00231 float *data ;
00232 } pixel_map ;
00233 /* </python> */
00234
00235 /* This simplifies the notations */
00236 #define NullMap (pixel_map*)NULL
00237
00238
00239
00240 /*--------------------------------------------------------------------------*/
00241 /* This is the internal cube structure */
00242 /* <python> */
00243 typedef struct _ONE_CUBE_
00244 {
00245 /* Number of images in the cube */
00246 int np ;
00247 /* Pointers to image zones */
00248 OneImage ** plane ;
00249 /* Image size for this cube */
00250 int lx, ly ;
00251 /* Total number of pixels in cube */
00252 size_t nbpix ;
00253 /* Associated comments */
00254 char * history ;
00255 /* Number of associated comments */
00256 int n_comments ;
00257 /* Associated file name */
00258 char * filename ;
00259 /* Original Pixel type (=depth) */
00260 int orig_ptype ;
00261 pixelvalue * data;
00262 OneImage * planes;
00263 int type;
00264
00265 } OneCube ;
00266 /* </python> */
00267
00268 /* This simplifies the notations */
00269 #define NullCube (OneCube*)NULL
00270
00271 /*--------------------------------------------------------------------------*/
00272
00273 typedef struct _OFFSET_MEASURE_
00274 {
00275 double dx ;
00276 double dy ;
00277 double dist ;
00278 } offset_measure ;
00279
00280
00281 /*
00282 * dpoint: useful to store point coordinates in double precision
00283 */
00284
00285 typedef struct _DPOINT_ {
00286 double x ;
00287 double y ;
00288 } dpoint ;
00289
00290
00291 /*
00292 * Rectangle: defined by 2 intervals [xmin,xmax] and [ymin,ymax]
00293 */
00294 typedef struct _RECTANGLE_ {
00295 double xmin ;
00296 double xmax ;
00297 double ymin ;
00298 double ymax ;
00299 } rectangle ;
00300
00301 /* used by spectral arcs; other uses anticipated */
00302 typedef enum ORIENTATION_T{
00303 VERTICAL,
00304 HORIZONTAL
00305 } orientation_t;
00306
00307 /* A struct to store 2 arrays of doubles */
00308 typedef struct _double2_ {
00309 double * x ;
00310 double * y ;
00311 int n ;
00312 } double2 ;
00313
00314 /* A struct to store 3 arrays of doubles */
00315 typedef struct _double3_ {
00316 double * x ;
00317 double * y ;
00318 double * z ;
00319 int n ;
00320 } double3 ;
00321
00322
00323
00324
00325 #endif
1.2.13.1 written by Dimitri van Heesch,
© 1997-2001