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