00001 /*@Start***********************************************************/ 00002 /****************************************************************/ 00003 /* This header file includes other header files!!! */ 00004 /****************************************************************/ 00005 /* GEMSBG Include File 00006 * Copyright (C) 1987, 1988, 1989 The General Electric Company 00007 * Include File Name: PixelData.h 00008 \author WR Edens, JL Agle, MJ Benson 00009 * $Source: /cvsroot/Insight/Insight/Code/IO/itkPixelData.h,v $ 00010 * $Revision: 1.3 $ $Date: 2004/01/08 00:39:07 $ 00011 */ 00012 /*@Synopsis Description of the PixelData header 00013 */ 00014 /*@Description 00015 * Description of header for files containing deep pixel medical images 00016 * The structures of this file are designed with 32 bit word 00017 * word alignment in mind. This is done to facilitate the easy 00018 * access to the data within a 'SPARC' based processor as is found 00019 * in the Genesis IP and Frame Buffer. Additions and changes should 00020 * reflect this design requirement on the structures of this file. 00021 * An PixelData file contains only the information needed to handle the 00022 * physical pixels of an image without concern for worldly relationships 00023 * to what they represent. There is a header, a couple of optional 00024 * control tables, and values of data that are representations of the 00025 * real pixel values of the image to be set into display hardware. The 00026 * Data Base Header stuff is a block of data that PixelData does NOT 00027 * interpet, but keeps for the data base. (This should only be filled 00028 * in on the Optical Disk). 00029 * These data values might need to be manipulated to get the real 00030 * pixel values via uncompression and/or unpacking depending on the 00031 * value of 'img_compress'. If the file has both methods applied 00032 * (img_compress == IC_COMPACK), the uncompression must be performed 00033 * before unpacking. 00034 * The header contains 'byte displacement' and 'byte length' entries 00035 * to access the different control tables or data. A control 00036 * table does not exist if its 'byte length' is zero. If the 00037 * table exists, there is a structure that defines the secondary table. 00038 * There is also an unfilled area between the last control table and 00039 * Start of data. This area is there to block align the beginning of 00040 * the data. This will allow for much better read and write performance 00041 * when going to block oriented devices (the norm for our application). 00042 * The size of this area will vary depending on which control tables 00043 * are defined and their sizes and the sector size of the storage 00044 * device. It is important to note that this gap size can change 00045 * when moving from one physical device to another if they have different 00046 * sector sizes. 00047 * One can find a description of the structure of each of the optional 00048 * parts in the header file associated with that optional area. 00049 * If the file is found to be IC_COMPRESSED or IC_COMPACK, the method is... 00050 * The compression algorithm stores in the file a differential 00051 * intensity value from the immediately preceeding pixel. The value 00052 * stored as a 7 bit 2's compliment number (8th msbit zero) byte if the 00053 * difference is -64 to +63. If the difference is -8192 to +8191, the 00054 * first byte stored is the most significant byte of the 2's compliment 00055 * value with the top two bits set to '10'. If the difference exceeds 00056 * 13 bit magnitude, the first byte stored is '11xxxxxx' with the next 00057 * two bytes containing the actual real pixel value. 00058 * If the file is found to be IC_COMP2 or IC_CPK2, the method is ... 00059 * The compression algorithm stores in the file a differential 00060 * intensity value from the immediately preceeding pixel. The value 00061 * of the first byte being 128 (-128) indicates that the next two bytes 00062 * are the actual real pixel value. Otherwise, the value of the first 00063 * byte will be an 8 bit 2's compliment number between -127 to +127 to 00064 * be added the value of the previous pixel. THESE ARE NOT CURRENTLY 00065 * SUPPORTED IN GENESIS. 00066 * The checksum method of the file as of this date (19-Jan-88) is: 00067 * The number stored in 'img_checksum' is the 16 bit (u_short) sum 00068 * of all the pixel data of the image adding in the overflows during 00069 * the summation. This is refered to as 'end-around-carry' summation 00070 * so that the value of zero really (absolutely) means that there is 00071 * no checksum computed for this image. Note that the checksum is 00072 * computed on the real original pixel data values of the image and 00073 * not on the 'compressed' or 'compack'd data values in the file. 00074 * This implies that the checksum of a rectangular version of a packed 00075 * file may well be different from the packed version; since the 00076 * background values get added in for the rectangular version and not 00077 * for the packed version. 00078 * NOTES on the image header: 00079 * img_magic = a long integer value to indicate an 'imagefile' 00080 * img_hdr_length = length of all headers in bytes - points to pixels start 00081 * as a byte displacement to the 'pixel data area' 00082 * img_width = x-axis pixel count (256, 320, 512, 1024) 00083 * img_height = y-axis pixel count 00084 * img_depth = number of bits in an uncompressed pixel (1, 8, 16) 00085 * NOTE: NOT magnitude resolution (CT is 16, not 12) 00086 * img_compress = form of compression and packing applied to file (IC_*) 00087 * img_dwindow = default 'window' width (stored image value range) 00088 * img_dlevel = default 'level' value (stored image value magnitude) 00089 * img_bgshade = default background shade for non-pixels during unpack 00090 * img_ovrflow = pixel value to substitute when overflow occurs in GIP 00091 * img_undflow = pixel value to substitue when underflow occurs in GIP 00092 * img_top_offset = number of lines without entries in 'line_length' table 00093 * at the top of the image. 00094 * img_bot_offset = number of lines without entries in 'line_length' table 00095 * at the bottom of the image. 00096 * img_version = the version of the header structure - initial = 0 00097 * this word is not processed by the IPlib! Therefore 00098 * all changes to this header must be handled by 00099 * extension and not by alteration of the 3.1 version 00100 * of the PixHdr structure called version 0! 00101 * img_checksum = the 16 bit end-around-carry sum of true image pixels 00102 * (a value of zero indicates that the checksum is not 00103 * defined for this file.) 00104 * img_p_id; a byte displacement to unique image identifier 00105 * img_l_id; a byte length of unique image identifier 00106 * img_p_unpack = a byte displacement to the 'unpack control table' 00107 * img_l_unpack = byte length of the 'unpack control table' 00108 * img_p_compress = a byte displacement to the 'compression control table' 00109 * img_l_compress = byte length of the 'compression control table' 00110 * img_p_histo = a byte displacement to the 'histogram control data' 00111 * img_l_histo = byte length of the 'histogram control data' 00112 * img_p_text = a byte displacement to 'text plane data' 00113 * img_l_text = byte length of 'text plane data' 00114 * img_p_graphics = a byte displacement to 'graphics plane data' 00115 * img_l_graphics = byte length of 'graphics plane data' 00116 * img_p_dbHdr = a byte displacement to 'data base header data' 00117 * img_l_dbHdr = byte length of 'data base header data' 00118 * img_levelOffset= offset to be added to Pixel Values to get correct 00119 * presentation value 00120 * img_p_user= byte displacement to user defined data 00121 * img_l_user= byte length of user defined data 00122 * Here is a picture to help visualize the structure of the header. 00123 * --------------------------------- 00124 * | Magic Number | 00125 * --------------------------------- 00126 * --| Header Length | 00127 * | --------------------------------- 00128 * | | lots of header stuff | 00129 * | ~ ~ 00130 * | ~ ~ 00131 * | --------------------------------- 00132 * | | Version | Checksum | 00133 * | --------------------------------- 00134 * -|--| ID Pointer | 00135 * | | --------------------------------- 00136 * | | | ID length | 00137 * | | --------------------------------- 00138 * -|-|--| Unpack Table Pointer | 00139 * | | | --------------------------------- 00140 * | | | | Unpack Table length | 00141 * | | | --------------------------------- 00142 * -|-|-|--| Compression Seed Table Ptr | 00143 * | | | | --------------------------------- 00144 * | | | | | Compression Seed Table length| 00145 * | | | | --------------------------------- 00146 * -|-|-|-|--| Histogram Table Pointer | 00147 * | | | | | --------------------------------- 00148 * | | | | | | Histogram Table length | 00149 * | | | | | --------------------------------- 00150 * -|-|-|-|-| -- Text Plane data Pointer | 00151 * | | | | | | --------------------------------- 00152 * | | | | | | | Text Plane data Length | 00153 * | | | | | | --------------------------------- 00154 * -|-|-|-|-|-| -- Graphics Plane data Pointer | 00155 * | | | | | | | --------------------------------- 00156 * | | | | | | | | Graphics Plane data Length | 00157 * | | | | | | | --------------------------------- 00158 * -|-|-|-|-|-|-| -- Data Base Header Pointer | 00159 * | | | | | | | | --------------------------------- 00160 * | | | | | | | | | Data Base Header Length | 00161 * | | | | | | | | --------------------------------- 00162 * | | | | | | | | | level Offset | 00163 * | | | | | | | | --------------------------------- 00164 * -|-|-|-|-|-|-|-| -- User Defined Data Pointer | 00165 * | | | | | | | | | --------------------------------- 00166 * | | | | | | | | | | User Defined Data Length | 00167 * | | | | | | | | | --------------------------------- 00168 * | | | | | | | | | | some Spares | 00169 * | | | | | | | | | ~ ~ 00170 * | | | | | | | | | ~ ~ 00171 * | | | | | | | | | ---------------------------------\ 00172 * | | | | | | | |-|->~ ID stuff ~ \ 00173 * | | | | | | | | ~ See PDtext.h for details ~ / ID length 00174 * | | | | | | | | ---------------------------------/\ 00175 * | | | | | | |---|->~ Unpack Table ~ \ Unpack Table 00176 * | | | | | | | ~ Described below ~ / length 00177 * | | | | | | | ---------------------------------\/ 00178 * | | | | | |-----|->~ Compression Seed Table ~ \ Compression Seed 00179 * | | | | | | ~ See PDcomp.h for details ~ / Table len 00180 * | | | | | | ---------------------------------/\ 00181 * | | | | |-------|->~ Histogram Table ~ \ Histogram Table 00182 * | | | | | ~ See PDhisto.h for details ~ / length 00183 * | | | | | ---------------------------------\/ 00184 * | | | |---------|->~ Text Plane data ~ \ Text Plane data 00185 * | | | | ~ See PD?????.h for details ~ / length 00186 * | | | | ---------------------------------/\ 00187 * | | |-----------|->~ Graphics Plane data ~ \ Graphics Plane 00188 * | | | ~ See PD?????.h for details ~ / data length 00189 * | | | ---------------------------------\/ 00190 * | |-------------|->~ Data Base Header ~ \ Data Base Header 00191 * | | ~ See PD?????.h for details ~ / length 00192 * | | ---------------------------------/\ 00193 * |---------------|->~ User Defined Data ~ \ User Defined Data 00194 * | ~ See PD????.h for details ~ / length 00195 * | --------------------------------- / 00196 * | ~ Block Alignment Gap ~ 00197 * | ~ ~ 00198 * | --------------------------------- 00199 * |->~ Pixel Data ~ 00200 * ~ ~ 00201 * --------------------------------- 00202 * If any of the Tables is of zero length, the pointer to that table 00203 * and the pointer to the next table would both point to the same place. 00204 * The order above is what one will typically find, but one must follow 00205 * the pointers and use the lengths to find the tables. There is no 00206 * requirement that they be in this order. 00207 */ 00208 /*@End*********************************************************/ 00209 /* only do this once in any given compilation.*/ 00210 #ifndef PIXELDATA_INCLUDE 00211 #define PIXELDATA_INCLUDE 00212 namespace itk { // keep this stuff from polluting ITK client program namespaces 00213 /* Add other declaration type for pixel header - Dominic H. Nguyen */ 00214 typedef struct dcmp_t 00215 { 00216 int nextHtEntry; 00217 int nextPixel; 00218 int base; 00219 } 00220 dcmp_t; 00221 00222 struct unpack 00223 { 00224 short up_left; /* pixels to the left of the image */ 00225 short up_image; /* " within the image */ 00226 }; 00227 00228 typedef unsigned char PIXEL; 00229 00230 #define DC_NOOP 101 00231 #define DC_NO_NEED_TO_DC DC_NOOP 00232 #define DC_NO_MORE_PIXEL 102 00233 #define DC_SUCCESS 0 00234 #define DC_DONE 1 00235 #define DC_FAILURE -1 00236 #define DC_UNRECOGNIZE_CODE -101 00237 #define DC_NO_UNPACK_TABLE -102 00238 #define DC_NEED_INPUT -201 00239 #define DC_NEED_OUTPUT -202 00240 /* end - Dominic H. Nguyen */ 00241 typedef struct pixhdr 00242 { 00243 int img_magic; /* magic number */ 00244 int img_hdr_length; /* length of total header in bytes and 00245 a byte displacement to the 'pixel data area' */ 00246 int img_width; /* width (pixels) of image */ 00247 int img_height; /* height (pixels) of image */ 00248 int img_depth; /* depth (1, 8, 16, or 24 bits) of pixel */ 00249 int img_compress; /* type of compression; see IC_* below */ 00250 int img_dwindow; /* default window setting */ 00251 int img_dlevel; /* default level setting */ 00252 int img_bgshade; /* background shade to use for non-image */ 00253 int img_ovrflow; /* overflow value */ 00254 int img_undflow; /* underflow value */ 00255 int img_top_offset; /* number of blank lines at image top */ 00256 int img_bot_offset; /* number of blank lines at image bottom */ 00257 short img_version; /* version of the header structure */ 00258 /* and a word to maintain 32 bit alignment */ 00259 unsigned short img_checksum; /* 16 bit end_around_carry sum of pixels */ 00260 int img_p_id; /* a byte disp to unique image identifier */ 00261 int img_l_id; /* byte length of unique image identifier */ 00262 int img_p_unpack; /* a byte disp to 'unpack control' */ 00263 int img_l_unpack; /* byte length of 'unpack control' */ 00264 int img_p_compress; /* a byte disp to 'compression control' */ 00265 int img_l_compress; /* byte length of 'compression control' */ 00266 int img_p_histo; /* a byte disp to 'histogram control' */ 00267 int img_l_histo; /* byte length of 'histogram control' */ 00268 int img_p_text; /* a byte disp to 'text plane data' */ 00269 int img_l_text; /* byte length of 'text plane data' */ 00270 int img_p_graphics; /* a byte disp to 'graphics plane data' */ 00271 int img_l_graphics; /* byte length of 'graphics plane data' */ 00272 int img_p_dbHdr; /* a byte disp to 'data base header data' */ 00273 int img_l_dbHdr; /* byte length of 'data base header data' */ 00274 int img_levelOffset; /* value to add to stored Pixel Data values */ 00275 /* to get the correct presentation value */ 00276 int img_p_user; /* byte displacement to user defined data */ 00277 int img_l_user; /* byte length of user defined data */ 00278 int img_p_suite; /* byte displacement to suite header data */ 00279 int img_l_suite; /* byte length of suite defined data */ 00280 int img_p_exam; /* byte displacement to exam header data */ 00281 int img_l_exam; /* byte length of exam defined data */ 00282 int img_p_series; /* byte displacement to series header data */ 00283 int img_l_series; /* byte length of series defined data */ 00284 int img_p_image; /* byte displacement to image header data */ 00285 int img_l_image; /* byte length of image defined data */ 00286 } 00287 PixHdr; 00288 00289 #define IMG_MAGIC 0x494d4746 /* this number assigned by GEMS */ 00290 #define IMG_HDR_VERSION 3 /* this number raised by GEMS when their 00291 version of the PixHdr structure is changed 00292 or when the format of the unpack table is 00293 changed. These two are tied together 00294 because they are both used by the IP library 00295 calls. Changes to either of these structure 00296 formats could cause IP library problems. 00297 ANY CHANGE TO PixHdr OR PixUpk SHOULD CAUSE 00298 IMG_HDR_VERSION TO CHANGE!! */ 00299 /* GEMS compress rule to set into 'img_compress' */ 00300 /* end of header portion */ 00301 /* ========== 'unpack control' structures pointed to by 'img_p_unpack' 00302 * This table does not have a version number independent of the 00303 * PixHdr portion of the header since the IP library expects both 00304 * of them to be of a certain format. We have more freedom with the 00305 * other structures, since no non-Genesis code has expectations of 00306 * the format. 00307 * What is actually stored with the data set is: 00308 * PixUpk up[(img_l_unpack/sizeof(PixUpk))]; 00309 * This typically will not exceed 1024 entries. 00310 * If one were to malloc this space a useful thing to have around 00311 * might be: PixUpk *up_ptr; 00312 * but we use it as an exercise for the user to understand how this 00313 * pointer may be of help. 00314 * The 'unpack control' of the file is a new format table that 00315 * is compatible with the 'Genesis' hardware requirements. 00316 * This table exists in the file if the file is of 'img_compress' 00317 * type IC_PACKED, IC_COMPACK, or IC_CPK2. 00318 * The number of entry pairs in the table is 'img_height'. 00319 * Each pair of (short) entries in the 'line_length' table indicates 00320 * the number of pixels at the beginning of the image line to be filled 00321 * with the background shade value, and the actual count of pixel values 00322 * from the pixel data to be put into the image line. The image line is 00323 * to be filled out with the background shade value to the limit of 00324 * 'img_width'. 00325 * Consider the following few examples. Assume that the width of 00326 * the PixelData is 10 pixels and that an 'x' is a background value 00327 * and 'y' is an image value. 00328 * xxxxxxxxxx up_left = 10 up_image = 0 (atypical case, 00329 * causes a blank line) 00330 * xxxyyyyxxx up_left = 3 up_image = 4 00331 * xxyyyyyxxx up_left = 2 up_image = 5 00332 * xxxyyyyyyx up_left = 3 up_image = 6 00333 * yyyyyyyyyy up_left = 0 up_image = 10 00334 */ 00335 typedef struct 00336 { 00337 short up_left; /* pixels to the left of the image */ 00338 short up_image; /* pixels within the image line */ 00339 } 00340 PixUpk; 00341 00342 /* The data area of the file is pixel data stored sequentially 00343 * starting in the Upper Left Hand Corner (ULHC) of the image filling 00344 * the x_axis 'img_width' for each line and continuing down the y_axis 00345 * for 'img_height' lines. 00346 */ 00347 #endif /* PIXELDATA_INCLUDE */ 00348 /*@Start***********************************************************/ 00349 /* GEMSBG Include File 00350 * Copyright (C) 1988 GE Medical Systems 00351 * Include File Name: phonebook 00352 \author David Carleton 00353 * $Source: /cvsroot/Insight/Insight/Code/IO/itkPixelData.h,v $ 00354 * $Revision: 1.3 $ $Date: 2004/01/08 00:39:07 $ 00355 */ 00356 /*@Synopsis Contains defaults and strings for the Phone Book feature. 00357 */ 00358 /*@Description 00359 The defaults and strings necessary for the Phone Book feature. 00360 */ 00361 /*@End*********************************************************/ 00362 /* only do this once in any given compilation.*/ 00363 #ifndef PB_INCL 00364 #define PB_INCL 00365 00366 #ifndef lint 00367 /* 00368 static char pb_sccsid[] = "@(#)phonebook.h 1.6 7/11/90 16:55:37 Copyright 1988 GEMSBG"; 00369 */ 00370 #endif 00371 00372 /*============================================================================*/ 00373 /* Defines for Phone Book. */ 00374 /*============================================================================*/ 00375 /* Bit fields for request flags */ 00376 /* Request flag is a long int */ 00377 #define MAGDISK 0x00000001 /* Media type in bits 0-15 */ 00378 #define OPTDISK 0x00000002 00379 00380 #define RPMAN 0x00010000 /* Service type in bits 16-31 */ 00381 #define DBSER 0x00020000 00382 00383 /* Structure to contain a single phone book entry */ 00384 struct PBInfo 00385 { 00386 int diskType; 00387 char dispID; 00388 char dbserv[20]; 00389 char rpman[20]; 00390 }; 00391 00392 typedef struct PBInfo BookEntry_t; 00393 00394 /* Set names for service processes */ 00395 /* Mag DB Servers */ 00396 #define DB0 "dbserver" 00397 #define DB1 "dbserver1" 00398 #define DB2 "dbserver2" 00399 #define DB3 "dbserver3" 00400 #define DB4 "dbserver4" 00401 00402 /* Optical DB Servers */ 00403 #define ODB0 "odbrpm0" 00404 #define ODB1 "odbrpm1" 00405 #define ODB2 "odbrpm2" 00406 #define ODB3 "odbrpm3" 00407 #define ODB4 "odbrpm4" 00408 00409 /* Mag RPM */ 00410 #define RPM0 "mrpm" 00411 #define RPM1 "mrpm1" 00412 #define RPM2 "mrpm2" 00413 #define RPM3 "mrpm3" 00414 #define RPM4 "mrpm4" 00415 00416 /* Optical Mag RPM */ 00417 #define ORPM0 "odbrpm0" 00418 #define ORPM1 "odbrpm1" 00419 #define ORPM2 "odbrpm2" 00420 #define ORPM3 "odbrpm3" 00421 #define ORPM4 "odbrpm4" 00422 00423 #ifdef OMIT_THIS_CODE 00424 static char *mag_rpm[5] = { 00425 RPM0, 00426 RPM1, 00427 RPM2, 00428 RPM3, 00429 RPM4, 00430 }; 00431 00432 static char *opt_rpm[5] = { 00433 ORPM0, 00434 ORPM1, 00435 ORPM2, 00436 ORPM3, 00437 ORPM4, 00438 }; 00439 00440 static char *mag_dbs[5] = { 00441 DB0, 00442 DB1, 00443 DB2, 00444 DB3, 00445 DB4, 00446 }; 00447 00448 static char *opt_dbs[5] = { 00449 ODB0, 00450 ODB1, 00451 ODB2, 00452 ODB3, 00453 ODB4, 00454 }; 00455 #endif 00456 00457 #define DBSERVICE "theDBServer" 00458 #define RPMSERVICE "theRpm" 00459 #define PBVERSION 1 00460 #define PBVERSIONSTR "1" 00461 00462 /* FIX ME -- GET THESE FROM A CONFIG FILE */ 00463 #define MAXMAG 1 00464 #define MAXOPT 2 00465 00466 #define MAG_DB 0 00467 #define OPT_DB 1 00468 } 00469 #endif /* PB_INCL */