FUN(2)

NAME
FUN File Format - The FUN file format for use in the VolVis system

DESCRIPTION
The FUN file format can be used to specify an arbitrary analytical function for input into the VolVis system. This function will be voxelized according to the parameters provided, and will be treated within the system just as any SLC file - no record will be kept of the analytical function once scan conversion is complete. The template for a FUN file is as follows:

             X_RESOLUTION_VOXELS_(INTEGER):
             Y_RESOLUTION_VOXELS_(INTEGER):
             Z_RESOLUTION_VOXELS_(INTEGER):

 UNIT_TYPE_(MILLIMETER,METER,INCH,MILE...):
     X_RESOLUTION_OF_A_VOXEL_UNITS_(FLOAT):
     Y_RESOLUTION_OF_A_VOXEL_UNITS_(FLOAT):
     Z_RESOLUTION_OF_A_VOXEL_UNITS_(FLOAT):

                   X_MINIMUM_VALUE_(FLOAT):
                   X_MAXIMUM_VALUE_(FLOAT):
                   Y_MINIMUM_VALUE_(FLOAT):
                   Y_MAXIMUM_VALUE_(FLOAT):
                   Z_MINIMUM_VALUE_(FLOAT):
                   Z_MAXIMUM_VALUE_(FLOAT):

               FUNCTION_VALUE_OF_0_(FLOAT):
             FUNCTION_VALUE_OF_255_(FLOAT):
   FUNCTION_VALUE_FOR_SEGMENTATION_(FLOAT):
       INVERT_FUNCTION_VALUES_(TRUE,FALSE):

 ( The Function Goes HERE - Remove This Line ) The first three entries describe the size of the final data in voxels - which is the actual number of "samples" of the function which will be taken. The next parameter describes the unit type of the data. The next three parameters describe the size of one voxel in units along the three major axes. This can be used to scale the data independently in all three directions without having to correspondingly scale the number of sample points. The next six values represent the range of the samples along the three axes. For example, there will be X_RESOLUTION_VOXELS number of samples along the X axis, evenly spaced, starting at X_MINIMUM_VALUE and ending at X_MAXIMUM_VALUE. Taking a "sample" is equivalent to simply evaluating the function at this location. This value is then mapped to a value between 0 and 255 according to the next four parameters. The first parameter indicates the value which will be mapped to 0. The next parameter indicates the value which will be mapped to 255. The third parameter indicates the initial value at which the isosurface is located. This value should be between the values of the previous two parameters. It can be modified at run-time through the user interface of the VolVis system. The last parameter indicates whether these values should be inverted for the purpose of finding an isosurface. The outermost values in the volume should have the lowest values - if they do not, this value should be set to TRUE, so that the values will be inverted (0 will become 255, 1 will become 254, ..., 255 will become 0) before being stored in a volume. The function itself is written in a grammar which contains the following symbols:
 CONST c - the constant c
 X - X
 Y - Y
 Z - Z
 ADD - addition
 SUB - subtraction
 MUL - multiplication
 DIV - division
 POWER - exponent
 SIN - sine
 COS - cosine
 TAN - tangent These are the current set of symbols for version 1.0. The grammar will be extended in future releases of the system. Expressions can be built using a prefix notation. If you have some function in the form of f(x,y,z) = 0, then just build the prefix expression for f(x,y,z) and place that as the last line of the FUN file. For example, if f(x,y,z) is X + 2Y - Z**2, then the expression would be:
 SUB ADD X MUL CONST 2.0 Y POWER Z CONST 2.0 An example FUN description of a sphere, voxelized into a 60x60x60 voxel volume, with each voxel being 2x2x2 inches is given below. The surface of the sphere actually only ranges between -1.0 and 1.0 in x, y, and z, but -1.2 to 1.2 was used in order to provide enough information outside the surface to obtain an accurate normal. Since the equation for a sphere evaluates to 0 at the center, and increases in value going outward, we want to invert the values, so that the 0 will be outside the sphere, going toward higher values on the inside.

             X_RESOLUTION_VOXELS_(INTEGER): 60
             Y_RESOLUTION_VOXELS_(INTEGER): 60
             Z_RESOLUTION_VOXELS_(INTEGER): 60

 UNIT_TYPE_(MILLIMETER,METER,INCH,MILE...): INCH
     X_RESOLUTION_OF_A_VOXEL_UNITS_(FLOAT): 2.0
     Y_RESOLUTION_OF_A_VOXEL_UNITS_(FLOAT): 2.0
     Z_RESOLUTION_OF_A_VOXEL_UNITS_(FLOAT): 2.0

                   X_MINIMUM_VALUE_(FLOAT): -1.2
                   X_MAXIMUM_VALUE_(FLOAT): 1.2
                   Y_MINIMUM_VALUE_(FLOAT): -1.2
                   Y_MAXIMUM_VALUE_(FLOAT): 1.2
                   Z_MINIMUM_VALUE_(FLOAT): -1.2
                   Z_MAXIMUM_VALUE_(FLOAT): 1.2

               FUNCTION_VALUE_OF_0_(FLOAT): -0.5
             FUNCTION_VALUE_OF_255_(FLOAT): 0.5
   FUNCTION_VALUE_FOR_SEGMENTATION_(FLOAT): 0.0
       INVERT_FUNCTION_VALUES_(TRUE,FALSE): TRUE

 SUB ADD ADD POWER X CONST 2.0 POWER Y CONST 2.0 POWER Z CONST 2.0 CONST 1.0

SEE ALSO
IMG, SLC, TXT, C_read_FUN_file

AUTHOR
    Lisa Sobierajski