#define FALSE 0 #define TRUE !FALSE #define BITS_PER_WORD 16 #define BITS_PER_BYTE 8 #define BYTES_PER_BLK ((unsigned long)0xffffffff) #define rint(x) floor(0.5+(x)) #define SINGLE_FILE 0 #define MULTIPLE_FILES 1 #define MSG_WIDTH 120 #define NUM_OF_RESERVED_COLORCELLS 12 #define MAX_SUBWINS 20 #define MAX_SCALES 15 #define FILES_PATH "FILES" #define PROCESS_PATH "PROCESS/BIN" #define MAX_HORIZONTAL_MENUS 6 #define Default 0 #define MAX_BUTT_CHARS 10 #define MAX_BUTT_MSG_LINES 3 #define MAX_PANEL_CHARS 12 #define MAX_HELP_CHARS 10 #define COPYRIGHT_MSG "3DVIEWNIX 1.1, Copyright (c) 1993, Medical Image Processing Group, UPenn"
#define MAX_DEFAULT_FILES 20 #define MAX_DEFAULT_CHAR 20
#define MAX_DATA_TYPES 3 #define IMAGE0 0 #define IMAGE1 1 #define MOVIE0 200 #define SHELL0 120 #define SHELL1 121 #define CURVE0 100 #define SURFACE0 110 #define SURFACE1 111
#define MAX_FILE_TYPES 13 #define IM0 1 #define CIM 2 #define MV0 4 #define BIM 8 #define CBI 16 #define SH0 32 #define BS0 64 #define CV0 128 #define S03 256 #define S04 512 #define SH1 1024 #define BS1 2048 #define S13 4096
#define DEWEY_CURSOR 160 #define DEFAULT_CURSOR XC_top_left_arrow
#define IMAGE_WINDOW 0 #define BUTTON_WINDOW 1 #define DIALOG_WINDOW 2 #define ALL_WINDOWS 3 #define LEFT_BUTTON 1 #define MIDDLE_BUTTON 2 #define RIGHT_BUTTON 3 #define NO_BUTTON 4
#define INHERIT 1000 #define DEFAULT 1001 #define GRAYSCALE 1002 #define PSEUDOCOLOR 1003 #define DIRECTCOLOR 1004
#ifdef NDEBUG #define LIB_EXIT SIGKILL #else #ifdef SIGBUS #define LIB_EXIT SIGBUS #else #define LIB_EXIT SIGKILL #endif #endif
typedef struct { unsigned long pixel; /*pixel value*/ unsigned short red,green,blue; /*RGB values*/ } ViewnixColor; typedef struct { char filename[30]; /*input filename*/ short num_of_elem; /*the no. of elem. in min/max arrays(sd-2)*/ short *min; /*the min no. of n-1 scenes for each n*/ short *max; /*the max no. of n-1 scenes for each n*/ short *incr; } FileInfo; typedef struct { short num_of_ifiles; /*no. of file selected from INPUT command*/ FileInfo *ifiles; /*array fo files selected from INPUT command*/ } GlobalInfo; typedef struct { short on; /*horizontal menu on(1)/off(0)*/ short item_selected; /*horizontal menu selected*/ short cmd_wd; /*the width of horizontal command*/ } HorizontalMenuInfo; typedef struct { short up; /*vertical menu on(1)/off(0)*/ short x,y; /*top-left cood of vertical menu*/ short width; /*the width of the vertical menu*/ short height; /*the height of the vertical menu*/ } VerticalMenuInfo; typedef struct { char cmd[30]; /*the current command selected*/ char function[30]; /*the current function selected*/ char process[30]; /*the current process being executed*/ char filetype[100]; /*the types of files to be read*/ short father; /*the father fo the current process*/ short sibling; /*the first sibling of the current process*/ short son; /*the first child of the current process*/ short x,y; /*the top-left cood of the current command*/ short terminal_leaf_node;/*terminal node(1) or not(0)*/ } TreeInfo; typedef char Char30[30]; typedef struct { short group; /*the group number*/ Char30 cmd; /*the name of command*/ short type; /*0 - button type; 1 - switch type.*/ short num_of_switches; /*the number of switches per command*/ Char30 *switches; /*the names of the switches*/ short switch_item_displayed; /*the switch item to be displayed*/ } PanelCmdInfo; typedef struct { Char30 machine_name; /*machine on which tape is mounted*/ Char30 tape_drive_name; /*name of tape drive*/ Char30 mt_option; /*option to be used with mt command*/ Char30 tape_size; /*kind of drive (1/4,1/2inch,8mm)*/ } TapePathName; typedef struct { short x,y; /*the top-left coordinate of Click button*/ short width; /*the width of the Click button*/ short height; /*the height of the Click button*/ } MarginClickInfo; typedef struct { short top_x,top_y; /*the top-left cood of top Click button*/ short top_width; /*the width of the top Click button*/ short top_height; /*the height of the top Click button*/ short bottom_x,bottom_y;/*the top-left cood of botton Click button*/ short bottom_width; /*the width of the bottom Click button*/ short bottom_height; /*the height of the bottom Click button*/ } ScrollbarClickInfo; typedef struct _text { Window win; /*window in which item resides*/ GC *gc; int x,y; /*location of upper-left corner of item*/ int w; /*width of the total item area in fonts*/ int h; /*height of the total item area in PIXELS*/ short label_width; /*width of label in pixels*/ short label_height; /*height of label*/ short label_ascent; /*ascent dimension of font*/ short label_x; /*position of the label*/ short label_y; int thick; /*thickness of the frame of the item*/ int width; /*current width of item in pixels*/ int fw,fh; /*size of font*/ char label[150]; /*label of the text item*/ char value[200]; /*value of the text item*/ int pos; /*pos indicates the index of the first VALUE*/ int state; /*indicates if text item is OFF(0) or ON(1)*/ int mode; /*text item is DISABLED(0) or ENABLED (1)*/ int (*func)(); /*notify procedure*/ struct _text *next; /*next text item*/ XFontStruct *font_struct; /*Font used on the window*/ } TEXT; typedef struct _button { Window win; /*window in which item resides*/ short type; /*type of button(0=button, 1=toggle, etc..)*/ short x,y; /*location of upper-left corner of item*/ short w; /*width of the item area in fonts*/ short h; /*height of the item area in fonts*/ short label_width; /*width of label in pixels*/ short label_height; /*height of label*/ short label_ascent; /*ascent dimension of font*/ short label_x; /*position of the label*/ short label_y; short thick; /*thickness of frame*/ short width; /*width of item in pixels*/ short height; /*height of item in pixels*/ int fw,fh; /*size of font*/ char label[150]; /*label of the button item*/ short state; /*indicates if button item is OFF(0) / ON(1)*/ short mode; /*0=RELEASED, 1=PRESSED*/ int (*func)(); /*notify procedure*/ struct _button *next; /*next button item*/ } BUTTON;
typedef struct { char recognition_code[80]; /*recognition code*/ char study_date[15]; /*study date (the format is yyyy.mm.dd)*/ char study_time[15]; /*study time (the format is hh:mm:ss)*/ short data_type; /*data set type : Scan data: IMAGE0, IMAGE1. Structure data: CURVE0, SURFACE0, SURFACE1, SHELL. Display data: MOVIE0.*/ char modality[10]; /*modality (CT, NM, MR, DS, DR, US, OT)*/ char institution[80]; /*institution ID*/ char physician[80]; /*referring physician*/ char department[80]; /*institutional department*/ char radiologist[80]; /*radiologist*/ char model[80]; /*manufacturer's model*/ char filename[80]; /*name of the file containing this message*/ char filename1[80]; /*name of the file that created this file*/ char *description; /*description of data in file*/ char *comment; /*scratch pad to store user-specified info*/ char patient_name[80]; /*patient name*/ char patient_id[80]; /*patient ID*/ float slice_thickness; /*slice thickness*/ float kvp[2]; /*KVP*/ float repetition_time; /*repetition time*/ float echo_time; /*echo time*/ char *imaged_nucleus; /*imaged nucleus*/ float gantry_tilt; /*gantry tilt*/ char study[10]; /*study number*/ char series[10]; /*series number*/ short gray_descriptor[3]; /*lookup table description - gray (number of entries in the table(net)\starting pixel value(spv)\num of bits for entries)*/ short red_descriptor[3]; /*lookup table description - red (as for gray)*/ short green_descriptor[3]; /*lookup table description - green (as for gray)*/ short blue_descriptor[3]; /*lookup table description - blue (as for gray)*/ unsigned short *gray_lookup_data; /*lookup data - gray (mapped value1\mapped value2\...\ mapped value net; pixel values to be mapped are assumed to be spv, spv+1,...,spv+net-1; each mapped value is stored in 16 bits)*/ unsigned short *red_lookup_data; /*lookup data - red (as for gray)*/ unsigned short *green_lookup_data; /*lookup data - green (as for gray)*/ unsigned short *blue_lookup_data; /*lookup data - blue (as for gray)*/ /*the following structure items are one bit for each item and indicate whether the corresponding item stated above is valid(1) or invalid(0).*/ unsigned recognition_code_valid: 1; unsigned study_date_valid: 1; unsigned study_time_valid: 1; unsigned data_type_valid: 1; unsigned modality_valid: 1; unsigned institution_valid: 1; unsigned physician_valid: 1; unsigned department_valid: 1; unsigned radiologist_valid: 1; unsigned model_valid: 1; unsigned filename_valid: 1; unsigned filename1_valid: 1; unsigned description_valid: 1; unsigned comment_valid: 1; unsigned patient_name_valid: 1; unsigned patient_id_valid: 1; unsigned slice_thickness_valid: 1; unsigned kvp_valid: 1; unsigned repetition_time_valid: 1; unsigned echo_time_valid: 1; unsigned imaged_nucleus_valid: 1; unsigned gantry_tilt_valid: 1; unsigned study_valid: 1; unsigned series_valid: 1; unsigned gray_descriptor_valid: 1; unsigned red_descriptor_valid: 1; unsigned green_descriptor_valid: 1; unsigned blue_descriptor_valid: 1; unsigned gray_lookup_data_valid: 1; unsigned red_lookup_data_valid: 1; unsigned green_lookup_data_valid: 1; unsigned blue_lookup_data_valid: 1; } GeneralInfo; typedef struct { short dimension; /*scene dimension (sd)*/ float *domain; /*location and orientation of the scene domain with respect to a fixed imaging device coordinate system : specified by sd+1 vector X0,...,Xsd. X0: coordinates of the origin of the scene coordinate system, X1,...,Xsd: unit vectors along each of its sd principal directions.*/ Char30 *axis_label; /*label associated with each axis*/ short *measurement_unit;/*unit measurement in the sd direction. 0 - kilometer;1 - meter;2 - cm;3 - mm; 4 - micron;5 - sec;6 - msec;7 - microsec.*/ short num_of_density_values; /*number of density values associated with each cell*/ short *density_measurement_unit; /*Unit of measurement of density val: 0 - No unit;1 - Hounsfield Units; 2 - Relaxation Times;3 - Proton Density.*/ float *smallest_density_value; /*smallest density value (when density is vector valued, the smallest of each component in the scene*/ float *largest_density_value; /*largest density value (when density is vector valued, the largest of each component in the scene*/ short num_of_integers; /*density storage scheme: number of integers in the density vector(ni). (the rest nd-ni are assumed to be floating point number*/ short *signed_bits; /*density storage scheme: each component is signed or unsigned: sous1\...\sousni, where each sousi indicates if the ith component of the density vector is signed(1) or unsigned(0)*/ short num_of_bits; /*density storage scheme: total number of bits required for the density vector(nbi)*/ short *bit_fields; /*density storage scheme:lbit1\rbit1\...\ lbitnd\rbitnd\. Within the bit field of nbi bits for the density vector, the bits are numbered 0,1,...,nbi-1 from left to right and the bit field for each component is specified by a left-bit (lbit) and a right- bit(rbit). For every component, thus, lbit <= rbit. The lbit, rbit pair for a floating point number indicates if the number is of single or double percision. The density vector itself is stored as integer1\ interger2\...\integerni\fp1\...\fp(nd-ni)\ within the nbi bits bit field and the order of the bit fields is preserved in the file storing the message.*/ short dimension_in_alignment; /*Alignment dimension (ads): null for IMAGE1 type. For IAMGE0 type, this element stores the dimenality of the subscene which is stored in an integer number of unit of multiple bytes. ads=0 means no alignment.*/ short bytes_in_alignment; /*Number of bytes in a unit used for alignment. NULL for IMAGE1 type. nbys=0 means no alignment.*/ short xysize[2]; /*size of each slice: null(i.e. LENGTH=0) for IMAGE1 type; for IMAGE0 type this element stores number of columns\number of rows\ in the slice*/ short *num_of_subscenes;/*sampling scheme(number of sunscenes): null (i.e. LENGTH=0) for IMAGE1 type. For IMAGE0 type, this element stores, for each n, 2rbit, it means that component of TSE associated with this field is not stored.*/ short num_of_integers_in_NTSE; /*storage scheme for non-terminal structure elements : number of integers in NTSE (nint). (The rest ncnt-nint components are floating point numbers).*/ short *signed_bits_in_NTSE; /*storage scheme for non-terminal structure elements : whether each component of NTSE is signed or unsigned : sous1\sous2\ ...\sousnint\, when each sousi indicates whether the ith component of NTSE is signed(1) or unsigned(0).*/ short num_of_bits_in_NTSE; /*storage scheme for non-terminal structure elements : total number of bits required for NTSE(nbint).*/ short *bit_fields_in_NTSE; /*storage scheme for non-terminal structure elements : lbit1\rbit1\...\lbitnct \rbitncnt\. Description is similar to that for gr:0029, el:8090. If lbit > rbit, it means that component of TSE associated with this field is not stored.*/ short *num_of_samples; /*sampling schemefor the structure: this element stores, for each n, 2