IsoSurface Rendering of an AR Representation

rlaramee
Class ASCIIfloatReader

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

public class ASCIIfloatReader
extends java.lang.Object

Description: The ASCIIfloatReader reads the input file. The input file stores uniform or adaptive resolution data representing 3D volume data.
Handy numbers:
64 x 64 x 64 = 262,144

start date Tue 27 April 1999

Version:
1.0
Author:
Robert S Laramee
See Also:
MarchingCubesReader.java

Field Summary
private  float[][] data
           
private  boolean debug
           
private  java.io.FileInputStream input
           
private  java.io.StreamTokenizer stream
           
private  int xrows
           
private  int ycolumns
           
private  int zlayers
           
 
Constructor Summary
ASCIIfloatReader(int rows, int columns, int layers)
          constructor
 
Method Summary
private  int closeFile()
          This closes the input file.
 boolean openFile(java.lang.String filename)
          This function opens the file specified by filename
private  double parseDouble(java.io.StreamTokenizer stream)
          This method parses an ASCII text floating point number.
 void parseFile()
          This method parses the data file.
private  float parseFloat(java.io.StreamTokenizer stream)
          This method parses an ASCII text floating point number
 float[][] run(java.lang.String filename)
          The run() function starts the ASCIIFloatReader.
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

input

private java.io.FileInputStream input

stream

private java.io.StreamTokenizer stream

data

private float[][] data

xrows

private int xrows

ycolumns

private int ycolumns

zlayers

private int zlayers

debug

private boolean debug
Constructor Detail

ASCIIfloatReader

public ASCIIfloatReader(int rows,
                        int columns,
                        int layers)
constructor
Parameters:
rows - the number of rows in the volume data
columns - the number of columns in the volume data
layers - the number of layers in the volume data
Method Detail

run

public float[][] run(java.lang.String filename)
The run() function starts the ASCIIFloatReader. The main idea is to:
   1  open the file
   2  parse the file
   3  FOR each float in the ASCII file
         add it to the data set
 
Parameters:
filename - the name of the file to open
Returns:
true if it works

openFile

public boolean openFile(java.lang.String filename)
This function opens the file specified by filename
Parameters:
filename - the name of file to open

parseFile

public void parseFile()
               throws java.io.IOException
This method parses the data file.
Throws:
java.io.IOException -  

closeFile

private int closeFile()
This closes the input file. return [0|-1] on [success|failure]

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 -  

parseDouble

private double parseDouble(java.io.StreamTokenizer stream)
                    throws java.io.IOException
This method parses an ASCII text floating point number. Although a floating point number in C requires a Java double for storage
Parameters:
stream - a handle to the input stream
Returns:
double the double number parsed
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 - maximum allowable value
Returns:
true if the value is in the proper range

IsoSurface Rendering of an AR Representation