~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Linux Cross Reference
Tina4/src/file/ani/AIR.h

Version: ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* AIR.h --header file for Automated Image Registration Subroutines AIR 3.00 */
  2 /* Copyright 1995-96 Roger P. Woods, M.D. */
  3 /* Modified 10/26/96 */
  4 
  5 /* This header file utilizes a 4 x 4 matrix rather than the older 4 x 3 format*/
  6 
  7 #include <stdio.h>
  8 #include <stdlib.h>
  9 #include <math.h>
 10 #include <string.h>
 11 
 12 /* The following information is site specific */
 13 
 14 #define PLATF 1                 /* Used to properly define machine dependent constants*/
 15                                 /* Currently supported:                                 */
 16                                 /* 1 IEEE big-endian (Motorola 68000's, Sun 3, SPARC)   */
 17                                 /* 2 IEEE little-endian (doesn't work for DEC alpha) */
 18                                 /* 3 Platform independent solution for C compilers with float.h header file */
 19                                 /* (DEC alpha includes float.h, so use 3 for alphas) */
 20 
 21 #define VERBOSITY 1             /*0 turns off nonessential screen printing*/
 22 
 23 #define PIX_SIZE_ERR .0001      /* Voxel sizes that differ by less than this value are assumed identical */
 24 
 25 #define PIXEL_MAX_SIZE 10       /* warning issued if voxel size exceeds this*/
 26 #define PIXEL_MIN_SIZE .1       /* warning issued if voxel size less than this*/
 27 
 28 #define EDITED 5.0              /* warning issued if MRI contains less than this percentage of zero pixel values*/
 29                                 /* suggesting that it has not been edited--value of 0.0 inactivates this feature*/
 30                                 /* This feature is supported only in the AIR 1.0 programs alignpettomri */
 31                                 /* and alignmritopet. The new program alignlinear does not check to see that */
 32                                 /* files have been edited.                                                      */
 33 
 34 #define OLD_ANALYZE 0           /* if 1, warning will be issued whenever*/
 35                                 /* a file is loaded that has voxels sizes of */
 36                                 /* 1.000 x 1.000 x1.000 suggesting that*/
 37                                 /* file was created by a version of ANALYZE     */
 38                                 /* that sometimes fails to preserve voxel sizes         */
 39                                 /* (particularly when a file has been edited*/
 40                                 /* set to 0 (zero) to inactivate*/
 41 
 42 
 43 
 44 #define COMPRESS 1              /* if nonzero, image files (but not headers) can be decompressed*/
 45                                 /* and recompressed using UNIX compress and uncompress commands */
 46                                 /* This should be set to zero if your operating system does not */
 47                                 /* support the uncompress and compress commands.                */
 48                                 /* Note that only files that are compressed when initially      */
 49                                 /* encountered will be recompressed and that not all programs   */
 50                                 /* support this feature.                                        */
 51                                 /* If your system does not support this feature, you may crash  */
 52                                 /* instead of exiting gracefully when you ask for a nonexistant */
 53                                 /* file to be loaded. Set COMPRESS to 0 to prevent this.        */
 54                                 /* Alternatively, you can modify the subroutines                */
 55                                 /* src/decompress.c and src/recompress.c to make system calls   */
 56                                 /* appropriate for your systems architecture.                   */
 57                                 /* Likewise, if you prefer other compression programs, these    */
 58                                 /* subroutines can be modified to call them instead.            */
 59 
 60 #define CLOCK 0                 /* if nonzero, verbose mode in alignlinear will print elapsed
 61                                  * time with each iteration
 62                                  *
 63                                  * this is a nonessential function and causes trouble with some
 64                                  * compilers. If you get a clock() related error when you compile,
 65                                  * set this variable to zero
 66                                  */
 67 
 68 #define OUTBITS 8               /* Options are 8 and 16 */
 69                                 /* Controls internal representation of data */
 70                                 /* Controls bits/pixel of output data*/
 71                                 /* Data with a different number of bits/pixel can be input*/
 72                                 /* but will be converted to this number of bits/pixel*/
 73                                 /* using bit shifting to increase the number*/
 74                                 /* and using bit shifting, possibly combined with rescaling*/
 75                                 /* to decrease the number of bits/pixel.*/
 76                                 /* (Whether or not to rescale is dictated by the header*/
 77                                 /* global maximum                                       */
 78 
 79 
 80 #define REP16 3                 /* This variable is only relevant when OUTBITS==16      */
 81                                 /* However, its value must always be defined            */
 82                                 /* If 1, 16 bit data will be written to disk as         */
 83                                 /*      unsigned short ints (NOT ANALYZE compatible)    */
 84                                 /*      header minimum will be 0, maximum 65535         */
 85                                 /* If 2, 16 bit data will be written to disk as         */
 86                                 /*      short ints w/o using negative values            */
 87                                 /*      this effectively reduces storage to 15 bits     */
 88                                 /*      and reduction is done via bit shifting          */
 89                                 /*      header minimum will be 0, maximum 32767         */
 90                                 /* If 3, 16 bit data will be written to disk as         */
 91                                 /*      short ints using negative values                */
 92                                 /*      an actual value of zero will be mapped to       */
 93                                 /*      -32768 in short int representation              */
 94                                 /*      header minimum will be -32767                   */
 95                                 /*      header maximum will be 32767                    */
 96 
 97 #if(OUTBITS==8)
 98 
 99 #define THRESHOLD1 10           /* These are the 8 bit thresholds (see below) */
100 #define THRESHOLD2 10
101 
102 #elif(OUTBITS==16)
103 
104 #define THRESHOLD1 7000         /* These are the 16 bit thresholds (see below) */
105 #define THRESHOLD2 7000
106 
107 #endif
108                                 /* THRESHOLD1 and THRESHOLD2 are the default thresholds
109                                  * that AIR will offer when you register images.
110                                  *
111                                  * You probably want to use the same value for THRESHOLD1 and THRESHOLD2.
112                                  *
113                                  * You can always override the defaults, but it's nice to compile
114                                  * in some reasonable values if you can.
115                                  *
116                                  * Ideally, you should look at some typical data, and pick a default
117                                  * value that will generally separate brain from non-brain structures.
118                                  *
119                                  * In other words, pick a threshold such that values outside the structure
120                                  * of interest have pixel values below that threshold.
121                                  *
122                                  * An 8 bit value of 55 is good for PET data, but you'll probably 
123                                  * want something closer to 10 for 8 bit MRI data
124                                  *
125                                  * For 16 bit data, it's hard to guess what value will be reasonable
126                                  * since the full 16 bit range is often not utilized. A value around
127                                  * 7000 is reasonable for PET data which is often effectively 15 positive bits.
128                                  * For MRI data, as little as 12 bits is commonly used, in which case a
129                                  * reasonable default threshold is probably in the 100-200 range. On the other
130                                  * hand, if all 16 bits are effectively utilized, values in the 1000-2000 range
131                                  * may be more appropriate.
132                                  *
133                                  * Best bet--look at some data before choosing a default and caution users
134                                  * not to rely on the default values unless your site is very consistent
135                                  * about data formats and image intensities.
136                                  */
137 
138 
139 /* The remaining information should not generally require modification */
140 
141 #if(OUTBITS==8)
142 
143 typedef unsigned char my_pixels;
144 #define MAX_POSS_VALUE 255
145 
146 #elif(OUTBITS==16)
147 
148 typedef unsigned short int my_pixels;
149 #define MAX_POSS_VALUE 65535    /* This is true regardless of the value of REP16 above*/
150                                 /* 16-bit data is always represented internally is*/
151                                 /* unsigned short ints, even when it is written to*/
152                                 /* output files in other formats*/
153 
154 #endif
155 
156 
157 #define HDR_SUFF ".hdr"         /* This suffix will be used in trying to open an image header*/
158 #define IMG_SUFF ".img"         /* This suffix will be used in trying to open an image file*/
159 
160 #define LOGFILE "\0"            /* Use "\0" if .img files don't have corresponding .log files*/
161 #define NORM_SUFF ".nrm"        /* Use "\0" if .log files containing ASCII weighting factors are not available*/
162 
163 
164 /* These are the internal structs*/
165 /* The external struct (for image headers as stored on disk)*/
166 /* is stored separately in HEADER.h */
167 
168 struct key_info{
169         int bits;
170         int x_dim;
171         int y_dim;
172         int z_dim;
173         double x_size;
174         double y_size;
175         double z_size;
176 };
177 
178 struct air16{
179         double                  e[4][4];
180         char                    s_file[128];
181         struct key_info         s;
182         char                    r_file[128];
183         struct key_info         r;
184         char                    comment[128];
185         unsigned long int       s_hash;
186         unsigned long int       r_hash;
187         unsigned short          s_volume;       /* Not used in this version of AIR */
188         unsigned short          r_volume;       /* Not used in this version of AIR */
189         char                    reserved[116];
190 };
191 
192 struct oldair{                                  /*Allows AIR 2.0 to read AIR 1.0 .air files*/
193         double                  e[4][3];
194         char                    s_file[128];
195         struct key_info         s;
196         char                    r_file[128];
197         struct key_info         r;
198         char                    comment[128];
199         unsigned long int       s_hash;
200         unsigned long int       r_hash;
201         unsigned short          s_volume;       /* Not used in this version of AIR */
202         unsigned short          r_volume;       /* Not used in this version of AIR */
203         char                    reserved[116];
204 };
205 
206 #define VOXELS 450
207 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.