IsoSurface Rendering of an AR Representation

rlaramee
Class ASCIItoASCIIcubeFilter

java.lang.Object
  |
  +--rlaramee.ASCIItoASCIIcubeFilter

public class ASCIItoASCIIcubeFilter
extends java.lang.Object

Description Reads ASCII cubes and writes ASCII cubes that have made it through the filter. The filter will change often. This program was written because concatenating binary files written with the ObjectOutputStream didn't work. Problems encountered:

  1. The ASCIItoBinarySortedCube class became too big, resulting in 3 new classes: ASCIItoASCIIcubeFilter, ASCIIcubeParser, and FileHandler
  2. Using the ObjectOutputStream for 8 unique file writes forced 8 unique file reads
  3. Cube.ASCIIprint() was a problem too because of
    1. the Phil's cube to VTK's cube mapping and
    2. the decimal format
  4. scripts had to be written to automate the process e.g.
    % source ASCIItoASCIIsortLevelscript

    start date Mon 24 Apr 00

    Version:
    2.0
    Author:
    Robert S Laramee
    See Also:
    ASCIItoASCIIsortCube.java

    Field Summary
    private  ASCIIcubeParser asciiCubeParser
               
    private  boolean debug
               
    private  FileHandler fileHandler
               
    private  byte filterLevel
               
    private  byte outputOctant
               
     
    Constructor Summary
    ASCIItoASCIIcubeFilter(byte level, byte outputOctant)
               
     
    Method Summary
    private  ASCIIcubeParser getASCIIcubeParser()
               
    private  FileHandler getFileHandler()
               
    private  byte getFilterLevel()
               
    private  byte getOutputOctant()
               
    static void main(java.lang.String[] args)
              The main() method is what starts the ASCIItoASCIIcubeFilter
    private  boolean partitionCube(Cube cube, java.text.DecimalFormat decimalFormat)
              Sometimes, java will output decimal numbers like this:
     boolean run(java.lang.String inputFileName, int dimensionLength)
              This method will print out the cubes that make it through the filter.
    private  boolean setASCIIcubeParser(ASCIIcubeParser acp)
               
    private  boolean setFileHandler(FileHandler newFileHandler)
               
    private  boolean setFilterLevel(byte newLevel)
               
    private  boolean setOutputOctant(byte newOutputOctant)
               
    private  int whichOctant(Cube cube)
              This method decides which octant the cube belongs to The decision(s) are based on the VTK representation of the cube.
     
    Methods inherited from class java.lang.Object
    , clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
     

    Field Detail

    fileHandler

    private FileHandler fileHandler

    asciiCubeParser

    private ASCIIcubeParser asciiCubeParser

    debug

    private boolean debug

    filterLevel

    private byte filterLevel

    outputOctant

    private byte outputOctant
    Constructor Detail

    ASCIItoASCIIcubeFilter

    public ASCIItoASCIIcubeFilter(byte level,
                                  byte outputOctant)
    Parameters:
    level - the level of the cubes we are saving
    outputOctant - this filter will output this octant of cubes
    Method Detail

    getFilterLevel

    private byte getFilterLevel()

    setFilterLevel

    private boolean setFilterLevel(byte newLevel)
    Parameters:
    newLevel - the level of cubes being filtered

    getOutputOctant

    private byte getOutputOctant()
    Returns:
    outputOctant If we are outputting individual octants, the octant of cubes being output

    setOutputOctant

    private boolean setOutputOctant(byte newOutputOctant)
    Parameters:
    newOutputOctant - If we are outputting individual octants, the level of cubes being output

    getFileHandler

    private FileHandler getFileHandler()
    Returns:
    fileHandler this object's fileHandler

    setFileHandler

    private boolean setFileHandler(FileHandler newFileHandler)
    Parameters:
    newFileHandler - this object's fileHandler
    Returns:
    TRUE if the FileHandler was set successfully

    getASCIIcubeParser

    private ASCIIcubeParser getASCIIcubeParser()
    Returns:
    asciiCubeParser this object's ASCIIcubeParser

    setASCIIcubeParser

    private boolean setASCIIcubeParser(ASCIIcubeParser acp)
    Parameters:
    acp - this object's ASCIIcubeParser object
    Returns:
    TRUE if the FileHandler was set successfully

    run

    public boolean run(java.lang.String inputFileName,
                       int dimensionLength)
    This method will print out the cubes that make it through the filter. The ASCII output may then be redirected to a file.

    Parameters:
    inputFileName - the name of the input file to read
    dimensionLength - the number of cubes along each x,y,z dimension
    Returns:
    TRUE on success

    partitionCube

    private boolean partitionCube(Cube cube,
                                  java.text.DecimalFormat decimalFormat)
    Sometimes, java will output decimal numbers like this:
     5.94E-4 
     
    instead of
     0.000594
     
    The ASCIIcubeParser does not handle this, so we have to format the numbers for cube.ASCIIprint()

    Parameters:
    cube - the cube to do our processing on
    decimalFormat - the object which formats our numbers
    Returns:
    TRUE if the cube was processed successfully

    whichOctant

    private int whichOctant(Cube cube)
    This method decides which octant the cube belongs to The decision(s) are based on the VTK representation of the cube. This method is used to split up headLevel0cubes.ascii into 8 binary cube files -1 for each octant.

    Parameters:
    cube - the current cube
    Returns:
    octant the octant in which the cube belongs

    main

    public static void main(java.lang.String[] args)
    The main() method is what starts the ASCIItoASCIIcubeFilter

    Parameters:
    inputFile - an input file name
    level - the level of the cubes in the input file
    octant - cubes in this octant pass through the filter

    IsoSurface Rendering of an AR Representation