IsoSurface Rendering of an AR Representation

rlaramee
Class ASCIIcubeParser

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

public class ASCIIcubeParser
extends java.lang.Object

This class has the sole responsibility of parsing ASCII cubes

start date: Mon 24 Apr 00

Version:
1.0
Author:
Robert S Laramee
See Also:


Field Summary
private  boolean breakOut
           
private  boolean debug
           
private  byte parseLevel
           
 
Constructor Summary
ASCIIcubeParser(byte level)
          constructor
 
Method Summary
 boolean getBreakOut()
           
 byte getParseLevel()
           
static void main(java.lang.String[] args)
          The main method can be used for testing
private  int parseCoordinates(java.io.StreamTokenizer stream, Cube cube)
          This method parses the block number in the X,Y,Z directions It also tells the cube to set its vertices coordinate values
 Cube parseCube(java.io.StreamTokenizer stream)
          This method parses a whole file of ASCII cubes
 Cube parseData(java.io.StreamTokenizer stream)
          A block in the ASCII file looks like this
private  int parseDataVTK(java.io.StreamTokenizer stream, Cube cube)
          This method parses the 8 interpolated data values.
private  double parseDouble(java.io.StreamTokenizer stream)
          This method parses an ASCII text floating point number.
private  int parseError(java.io.StreamTokenizer stream, Cube cube)
          This method parses the error measure number
private  float parseFloat(java.io.StreamTokenizer stream)
          This method parses an ASCII text floating point number
private  int parseIndex(java.io.StreamTokenizer stream, Cube cube)
          Deprecated. no longer used
 void parseInputFile(FileHandler fileHandler, int dimension)
          This method parses a whole file of ASCII cubes
private  int parseLevel(java.io.StreamTokenizer stream, Cube cube)
          Deprecated. no longer used, replaced with Cube.setLevel()
private  int parseMax(java.io.StreamTokenizer stream, Cube cube)
          Deprecated. -no longer used
private  int parseMin(java.io.StreamTokenizer stream, Cube cube)
          Deprecated. -no longer used
private  int parseNumber(java.io.StreamTokenizer stream, Cube cube)
          Deprecated. no longer used
 boolean setBreakOut(boolean trueOrFalse)
           
 boolean setParseLevel(byte newLevel)
           
private  boolean validRange(double value, double min, double max)
           
private  boolean validRange(double value, int min, int max)
           
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

debug

private boolean debug

parseLevel

private byte parseLevel

breakOut

private boolean breakOut
Constructor Detail

ASCIIcubeParser

public ASCIIcubeParser(byte level)
constructor
Parameters:
level - the level of the cubes we are saving
Method Detail

getParseLevel

public byte getParseLevel()
Returns:
the level of cubes we are parsing

setParseLevel

public boolean setParseLevel(byte newLevel)
Parameters:
newLevel - the level of cubes we are parsing
Returns:
TRUE if the set() was successful

getBreakOut

public boolean getBreakOut()
Returns:
breakOut a boolean variable used to break out of a loop

setBreakOut

public boolean setBreakOut(boolean trueOrFalse)
Parameters:
trueOrFalse - set the breakOut variable to either true or false.

parseInputFile

public void parseInputFile(FileHandler fileHandler,
                           int dimension)
                    throws java.io.IOException
This method parses a whole file of ASCII cubes
Parameters:
dimension - the length of each x,y,z dimension
Throws:
java.io.IOException -  

parseCube

public Cube parseCube(java.io.StreamTokenizer stream)
This method parses a whole file of ASCII cubes
Parameters:
stream - a StreamTokenizer object

parseData

public Cube parseData(java.io.StreamTokenizer stream)
A block in the ASCII file looks like this
 # ---------------------------
 0.725 0.725 0.725 0.725 0.725 0.725 0.725 0.725 # interpolated data
 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001 # error 
 1 3 4             # block number in x,y,z directions
 
Parameters:
stream - a handle to the input stream
Returns:
cube a new parsed cube

parseNumber

private int parseNumber(java.io.StreamTokenizer stream,
                        Cube cube)
Deprecated. no longer used

This method parses the block number
Parameters:
stream - a handle to the input stream
cube - a pointer to the current cube being read
Returns:
[0|-1] on [success|failure]

parseLevel

private int parseLevel(java.io.StreamTokenizer stream,
                       Cube cube)
Deprecated. no longer used, replaced with Cube.setLevel()

This method parses the level number
Parameters:
stream - a handle to the input stream
cube - a pointer to the current cube being read
Returns:
[0|-1] on [success|failure]

parseError

private int parseError(java.io.StreamTokenizer stream,
                       Cube cube)
                throws java.io.IOException
This method parses the error measure number
Parameters:
stream - a handle to the input stream
cube - a pointer to the current cube being read
Returns:
[0|-1] on [success|failure]
Throws:
java.io.IOException -  

parseDataVTK

private int parseDataVTK(java.io.StreamTokenizer stream,
                         Cube cube)
                  throws java.io.IOException
This method parses the 8 interpolated data values.
             P3_____________P2   This is the cube representation
             /|            /|    for Bob's cube's.  It is the
            / |           / |    same as the VTK's.
   y     P7____________P6/  |    
   ^      |   |         |   |    
   |      |   |         |   |    
   |      |   |         |   |
   |--->  | P0|_________|___|P1
  /    x  |  /          |  /
 /        | /           | /
z         |_____________|/
         P4             P5
 
Parameters:
stream - a handle to the input stream
cube - a pointer to the current cube being read
Returns:
[0|-1] on [success|failure]
Throws:
java.io.IOException -  

parseIndex

private int parseIndex(java.io.StreamTokenizer stream,
                       Cube cube)
Deprecated. no longer used

This method parses the 0th child index number
Parameters:
stream - a handle to the input stream
cube - a pointer to the current cube being read
Returns:
[0|-1] on [success|failure]

parseCoordinates

private int parseCoordinates(java.io.StreamTokenizer stream,
                             Cube cube)
                      throws java.io.IOException
This method parses the block number in the X,Y,Z directions It also tells the cube to set its vertices coordinate values
Parameters:
stream - a handle to the input stream
cube - a pointer to the current cube being read
Returns:
[0|-1] on [success|failure]
Throws:
java.io.IOException -  

parseMin

private int parseMin(java.io.StreamTokenizer stream,
                     Cube cube)
              throws java.io.IOException
Deprecated. -no longer used

This method parses the minimum number
Parameters:
stream - a handle to the input stream
cube - a pointer to the current cube being read
Returns:
[0|-1] on [success|failure]
Throws:
java.io.IOException -  

parseMax

private int parseMax(java.io.StreamTokenizer stream,
                     Cube cube)
              throws java.io.IOException
Deprecated. -no longer used

This method parses the maximum number
Parameters:
stream - a handle to the input stream
cube - a pointer to the current cube being read
Returns:
[0|-1] on [success|failure]
Throws:
java.io.IOException -  

validRange

private boolean validRange(double value,
                           int min,
                           int max)
Parameters:
value - the value to validate
min - the minimum allowable value
max - the maximum allowable value
Returns:
true if the value is in the proper range

validRange

private boolean validRange(double value,
                           double min,
                           double max)
Parameters:
value - the value to validate
min - the minimum allowable value
max - the maximum allowable value
Returns:
true if the value is in the proper range

parseDouble

private double parseDouble(java.io.StreamTokenizer stream)
                    throws java.io.IOException
This method parses an ASCII text floating point number.
Parameters:
stream - a handle to the input stream
Returns:
double the floating point number parsed
Throws:
java.io.IOException -  

parseFloat

private float parseFloat(java.io.StreamTokenizer stream)
                  throws java.io.IOException
This method parses an ASCII text floating point number
Parameters:
stream - a handle to the input stream
Returns:
float the floating point number parsed
Throws:
java.io.IOException -  

main

public static void main(java.lang.String[] args)
The main method can be used for testing

IsoSurface Rendering of an AR Representation