Appendix C : Communication Files


This appendix explains all the communication files used within 3DVIEWNIX 1.1 for inter-process commnication. They are arranged in alphabetical order. Also explained are the files in the FILES directory.

C.1 3DVIEWNIX 1.1 Communication Files

C.1.1 BG_STATUS.COM
This ASCII file stores background process related information. The information contained in this file is organized as : The related functions are VAddBackgroundProcessInformation and VRemoveBackgroundProcessInformation.

C.1.2 COLOR.COM
This file is an ASCII file. It stores the following information : This file can be modified by different processes within 3DVIEWNIX. The sofware overlays are implemented by changing the colormap entries in this file. The user can also store the reserved colors in this file by using the COLORMAP program within 3DVIEWNIX. The related functions are VLoadColormap, VSaveColormap, VCreateWindows and VCreateColormap.

C.1.3 COLORMAP.COM
This file contains the colormap ID of the 3dviewnix process. All the other processes inherit this colormap ID when they install their own colormap. This file is created before the windows are created in 3DVIEWNIX by calling VCreateWindows. This is also an ASCII file. The related functions are VCreateWindows and VCreateColormap.

C.1.4 FONT.COM
This is an ASCII file which is created by the user to prompt 3DVIEWNIX to select the fonts. The fonts for the windows are specified in the following order : If the font chosen is not available in the server or is not suitable for 3DVIEWNIX, then this file is ignored. The related funtion is VOpenServer.

C.1.5 GLOBAL.COM
This is an ASCII file which contains information about the file(s) that is (was) selected by the user. The file contains the filenames selected by the user. The filenames are followed by the number of elements (dimensionality for scene data only). If it is a scene data, then the minimum, maximum and increment index of the slices is also written. For example the GLOBAL.COM file would appear as follows, if a file (BRAIN.IM0) was three-dimensional scene data :
		BRAIN.IM0 1
		0 19 1
This indicates that there are 20 slices in BRAIN.IM0 with the first slice beign numbered 0 and last being 19, and the increment is 1. A four-dimensional file would be represented as :
		
		BRAIN2.IM0 2
		0 19 1
 		0 7 1
There are 20 slices and 8 time instances in this case for a total of 160 slices.
There are other items of information related to structure data that are stored in the GLOBAL.COM file. For Shell0 (SH0) files the number of elements would be -1. Similarly for the binary shell0 (BS0) it would be -2; for the shell1 (SH1) it would be -3; and for the binary shell1 (BS1) it would be -4. Here the number of elements is used to let plan (PLN) files identify the type of structure data. A typical GLOBAL.COM file would look like :
  		BRAIN2.IM0 2
                0 19 1
                0 7 1
		SKULL.SH0 -1
		CHILD.BS0 -2 
		BRAIN.SH1 -3
		SKULL2.BS1 -4
The related functions are VReadGlobalcomFile and VWriteGlobalcomFile.

C.1.6 MENU.COM
This file is a binary file and contains information related to horizontal and vertical menus. The horizontal and vertical menu information have the following structure types :
	typedef struct {
       		short on;            /*whether menu is on (1/0)*/
       		short item_selected; /*the upper left coordinate*/ 
       		short cmd_wd;	     /*the menu height*/
	} HorizontalMenuInfo;	     /*menu width*/
 
	typedef struct {
       		short up;	     /*whether menu is on (1/0)*/
       		short x, y;          /*the upper left coordinate*/
       		short height;        /*the menu height*/
       		short width;	     /*menu width*/
	} VerticalMenuInfo;
This file stores information in the following format : MENU.COM is created by the program "cr_menu_tree" and later modified by VDisplayMenu and VSelectMenuItem. It is used by VRemoveMenus and VRedisplayMenus. The program "cr_menu_tree" determines the location and size of each menu on the basis of the screen size and font. It must therefore be run at the start of each session of an application, or when the screen or font could change.

C.1.7 TREEINFO.COM
This file is also binary, and contains the command tree information created by the program cr_menu_tree which uses the file MENU_TREE (which is an ASCII file). The command tree information has the following structure type :
	typedef struct {
       		char cmd[30];          /*the name of the command*/
       		char function[30];     /*the name of the function*/
       		char process[30];      /*the name of the process*/
       		char filetype[100];    /*the types of files used*/
       		short father;          /*the father pointer of node*/
       		short sibling;         /*the next sibling pointer*/
       		short son;	       /*the son pointer of node*/
       		short x, y;	       /*the upper left coordinate*/
       		short terminal_leaf_node; /*terminal node (1/0)*/
	} TreeInfo;
The related functions are VDisplayMenu, VSelectMenuItem, VRemoveMenus, and VRedisplayMenus.

C.1.8 WINS_ID.COM
This is an ASCII file, that contains the window ID of all the windows created under 3dviewnix. The first line of this file contains information which is stored in the following order : The second line of this file contains the number of subwindows under the image window. If the number of subwindows is zero, then there is no third line. Otherwise, each line contains one subwindow information including subwindows ID, x and y location, width and height in pixels. The related functions are VCreateWindows, VCreateImageSubwindow, VCreateThreedImageSubwindow and VDestroyImageSubwindow.

C.1.9 3DVIEWNIX.ERR
This is an ASCII file that stores all the error message encountered while running 3dviewnix. Typically an entry in this file would look like :
 
	Process Name   : input
        Function Name  : main
        Error Occurred : Mon Oct  4 17:01:13 1993
        Error Message  : Invalid value in the file header for Type 1D
The above entries are obvious. The "Process Name" refers to the process where the error occured. The "Function Name" refers to the function within the process where the error occured. The "Error Occurred" entry writes the date and time this error was encountered. The "Error Message" entry indicated the kind of error that was noticed. All these entries are written to the 3DVIEWNIX.ERR file using VDecodeError function.

C.2 Files in FILES directory

C.2.2 ACRNEMA_V1.1.STD
This is an ASCII file that contains the ACRNEMA standard protocol as is implemented in 3DVIEWNIX 1.1. The files that are created within 3DVIEWNIX 1.1 are made compatiple with ACRNEMA_V1.1.STD. If the files are not compatible, they cannot be used within 3DVIEWNIX 1.1. A typical entry in ACRNEMA_V1.1.STD looks like:
GROUP ELEMENT LENGTH     VALUE   VR VM TYPE DEFAULT 3DVIEWNIX-CODE DESCRIPTION
----- ------- ------     -----   -- -- ---- ------- -------------- -----------
COMMAND INFORMATION GROUP
-------------------------
0000  0000    0004 0000  ____    BD S  1    ____    0,0             Group len
0000  0001    0004 0000  ____    BD S  1    ____    0,0             Mess. len
0000  0010    ____ ____  ____    AT S  1    ____    0,0             Recog code
(ver. no.) The above gives a part of the protocol for the COMMAND INFORMATION GROUP in the GeneralInfo data structure of 3DVIEWNIX.HDR file. The ACRNEMA protocol is storred as a quadruple . The GROUP#, ELEMENT#, and LENGTH are hexadecimal, while VALUE is decimal. For the sake of implementation, we have separated ACRNEMA_V1.1.STD file into three separate files each containing protocol for description of SCENE data, STRUCTURE data and DISPLAY data. The three files SCENE_V1.1.SPC, STRUCTURE_V1.1.SPC and DISPLAY_V1.1.SPC are created by the "create_spc" program, that reads the ACRNEMA_V1.1.STD file.

C.2.3 SCENE_V1.1.SPC
This is an ASCII file that contains only SCENE related information besides some general information. A typical entry in this file would look like :
	0008    0010    1       0
where each entry is a quadruple. The GENERAL information includes IDENTIFICATION INFORMATION GROUP (0008), GENERAL INFORMATION GROUP (0009), PATIENT INFORMATION GROUP (0010), ACQUISITION INFORMATION GROUP (0018), RELATIONSHIP INFORMATION GROUP (0020), and IMAGE PRESENTATION INFORMATION GROUP (0028). The SCENE data starts at 0029 with the SCENE-RELATED INFORMATION GROUP.

C.2.4 STRUCTURE_V1.1.SPC
This is also an ASCII file like SCENE_V1.1.SPC file. It is identical to SCENE_V1.1.SPC file except it contains STRUCTURE-RELATED INFORMATION GROUP (002B) instead of the SCENE-RELATED INFORMATION GROUP (0029).

C.2.5 DISPLAY_V1.1.SPC
This is also an ASCII file like SCENE_V1.1.SPC file. It is identical to SCENE_V1.1.SPC file except it contains DISPLAY-RELATED INFORMATION GROUP (002D) instead of the SCENE-RELATED INFORMATION GROUP (0029).

C.2.6 DEFAULT
This ASCII file contains the default 3DVIEWNIX reserved colors (12). It also contains information about the default TAPE_PATH_NAME to be used to access a tape drive. The entries in this file look like :
	62194;51400;48316;
	17733;17733;22873;
	23901;23644;32639;
	0;0;6425;
	49344;49087;58853;
	65535;65535;42919;
	65535;65535;1028;
	65535;0;16448;
	65535;0;16448;
	9509;13107;15934;
	30069;20046;30326;
	65535;28013;0;
	/usr/mipgsun/fm/mipg_images
Each of the first 12 entries are RGB values of the reserved color. The reserved colors are arranged as follows :
 	-----------------------------------------------------   
        Reserved Color (Pixel)        Purpose                   
        -----------------------------------------------------   
		0 (246) -       border and text color           
        -----------------------------------------------------   
                1 (247) -       title,dialog and mouse win     
                                background color                
        -----------------------------------------------------   
                2 (248) -       special color for 3d effect     
       	-----------------------------------------------------   
                3 (249) -       special color for 3d effect     
        -----------------------------------------------------   
                4 (250) -       special color for 3d effect     
       	-----------------------------------------------------  
                5 (251) -       dialog message color            
       	-----------------------------------------------------   
                6 (255) -       text on image without  overlay  
       	-----------------------------------------------------   
                7 (254) -       text on image with overlay      
       	-----------------------------------------------------   
                8 (253) -       image window color when         
                                overlay 1 is on                 
       	-----------------------------------------------------   
                9 (252) -       image window color when         
                                overlay is off                  
       	-----------------------------------------------------   
                10 (245) -      highlight color for menu/panel  
        -----------------------------------------------------   
                11 (244) -      special color used in help      
        -----------------------------------------------------  
If a user does not want to use the DEFAULT reserved colors, (s)he can change it within 3DVIEWNIX by using the MISCELLANEOUS/COLORMAP module.

C.2.7 ERROR_CODES
This is an ASCII files that contains all the possible error messages that occur while executing 3dviewnix library functions. Each of these error code has a number which which are indexed in APPENDIX A. The entries in the ERROR_CODES file look like :
	Fatal error
	No error
	MEMORY ALLOCATION ERROR
	READ ERROR
	WRITE ERROR
	FILE OPEN ERROR
	IMPROPER FILE SEEK
	Invalid window ID
	.....
VDecodeError looks up this file when a user passes the error code, and prints the proper error message to the 3DVIEWNIX.ERR file.

C.2.8 FONTNAME
This ASCII file contains the fonts to be used in the 3DVIEWNIX windows - image window, dialog window, mouse window and title window. When 3DVIEWNIX is started, it looks for a FONT.COM file in the current directory. If it cannot find FONT.COM file it looks for FONTNAME file in the FILES directory to get the appropriate font for all the windows. If FONTNAME file has improper font, or FONTNAME is not available, 3DVIEWNIX uses default fonts from the system.
C.2.9 HELPFILE
This is an ASCII file that contains the contents of the HELP that is available inside 3DVIEWNIX. The HELP is categorized into six topics :
		
	GENERAL
	PORT_DATA
	PREPROCESS
	VISUALIZE
	MANIPULATE
	ANALYZE
	MISC.
Inside each category there are topics. Within topics, there are subtopics. The topics and subtopics are color coded for easy reading. The HELP contents are listed separately in the bottom window of the HELP window. The HELP file looks like :
	#GENERAL#
 
	#Topic 1 INTRODUCTION
 
	3DVIEWNIX is a data-, machine-, and application-independent software
	system developed by the Medical Image Processing Group, Department of
	Radiology, University of Pennsylvania, Philadelphia. ...
	#endtopic#

	#Topiclevel2 1.1 How To Use This Document
 
	Section 2 describes the 3DVIEWNIX installation procedure. Systems
	manager or those who are responsible to install 3DVIEWNIX at your site
	should read that section. ...
	#endtopic#
	#endchapter#
It is easy to add new topics and subtopics to this list. However the the six categories in HELP are fixed. To change this, one will have to change the VDisplayHelp function. An experienced 3DVIEWNIX programmer should be able to do this.

C.2.10 MENU_TREE
This ASCII file contains the entire 3DVIEWNIX MENU structure. The entries in this file are a little complicated and they look like:
	-1 1 15 PORT-DATA  0  horizontal    0       0
The first column in this entry represents parent of the current entry. The second column represents the son (daughter) and the third column represents the sibling of the current entry. In the case above this entry has no parent (-1), it has a son at the next line and the 15th entry down the file is the sibling. The next column is the name of the MENU command as it appears in the window. In this case it is "PORT-DATA". The next column represents the process associated with the command. In this case there is no process associated with the command. The next command indicates whether the next level of menu is going to be horizontal or vertical (terminal) menu. The next column represents the files that should be loaded when the INPUT module comes up. In this case there are no files that are associated with this comand. The last column of this entry indicates whether this comand is a terminal node (-1) or a non terminal node (0). The progams "cr_menu_tree" reads the MENU_TREE file and writes it in a binary file called MENU.COM file.
MENU_TREE file is a complicated file to edit if one needs to add new items to the menu. Instead one can edit the SIMPLE_MENU file (explained below) and add new menu items or remove exisiting ones. There is a program called "create_menu" that converts SIMPLE_MENU file to the MENU_TREE file format.

C.2.11 SIMPLE_MENU
This ASCII file looks very similar to MENU_TREE file but is much easier to read and edit. Typiccaly the entries in this file would look like:
	0     PORT-DATA       	0                       horizontal      0
         1    In                0                       horizontal      0
          2   FromAcrnema       from_disk               0               0
          2   FromTape          0                       vertical        0
           3  GE8800            dummy_proc              0               0
           3  GE9800            dummy_proc              0               0
           3  SIGNA             dummy_proc              0               0
           3  PennPET           dummy_proc              0               0
          2   EasyHeader        EasyHeader              0               0
          2   CreateFileHeader  create_fileheader       0               0
          2   ModifyFileHeader  modify_fileheader       0               IM0/BIM/MV0/BS0/BS1/SH0
          2   Retrieve          retrieve                0               0
         1    Out               0                       vertical        0
          2   BackUp            backup                  0               0
         1    ChangeDefaultTape change_tape             0               0
The above entries show a systematic separation of levels in the menu. As shown above all entries starting with 1 are sons (duaghters) of entry starting with 0. Similarly all entries starting with 2 are sons (daughters) of entries starting with 1 and so on.
Suppose we wanted to add a new entry say Elsinct in level3 and have a process called elsinct that reads Elsinct data format, in order to add it to the menu one would have to edit the SIMPLE_MENU file as :
	0     PORT-DATA         0                       horizontal      0
		......
          2   FromTape          0                       vertical        0
	   3  Elsinct		elsinct			0		0
           3  GE8800            dummy_proc              0               0
           3  GE9800            dummy_proc              0               0
		......
         1    ChangeDefaultTape change_tape             0               0
What the above addition means is that there will be another entry in the vertical menu under "FromTape" that will include Elsinct as the first entry. The "elsinct" program has no children and it will read any kind of file.
Similarly if one needs to add a whole new menu item, one can do so as follows :
	
	0     ANIMATION         0                       horizontal      0
         1    Still_pictures    0                       horizontal      0
          2   GIF       	gif               	0               0
          2   SunRaster         sunraster               0        	0
          2   PostScript        0                       vertical        0
           3  GrayScale         grayscale_postscript    0               0
           3  Color             color_postscript        0               0
          2   TIFF        	tiff              	0               0
          2   Khoros  		0       		vertical        0
           3  Viff         	viff_khoros    		0               0
           3  XV         	xv_khoros    		0               0
         1    Movie             0                       vertical        0
          2   Continuous        continuous              0               0
          2   DisContinuous     discontinuous           0               0
After editing the SIMPLE_MENU file, please run the "create_menu" program to create the MENU_TREE file in the FILES directory.

C.2.12 TAPE_PATH_NAME
This is an ASCII file that stores the names of the devices from where data can be brought into 3DVIEWNIX. These tape path names also are used to write to the devices. A typical TAPE_PATH_NAME file would look like:
	mipgsun /dev/nrst1 f 1/2inch
	chromos2 /dev/nrst0 f 1/4inch
	imager2 /dev/nrst0 f 1/4inch
	3dv1 /dev/nrtape8mm t 8mm
	3dv1 /dev/nrtape t 1/4inch
The format of TAPE_PATH_NAME file is :
	machine_name1 device1 mt_option tape_size
	machine_name2 device2 mt_option tape_size
	.....
where machine_name indicates the name of the machine the tape drive is mounted on; device indicates the name of the tape drive which does not rewind the tape automatically (i.e., /dev/nrst1); mt_option indicates the option to be used by the "mt" command to specify the tape device; tape_size indicates what kind of tape device (e.g., 1/4inch, 1/2inch, 8mm) it is.
TAPE_PATH_NAME contains the list of hosts and the device names on these machines that are accessible to the 3DVIEWNIX users. This requires that all users have the following :