edu.uthscsa.ric.visualization
Class SurfaceData

java.lang.Object
  extended by edu.uthscsa.ric.visualization.SurfaceData

public class SurfaceData
extends Object

SurfaceData is a container for surface-related data.


Constructor Summary
SurfaceData(float[] points, float[] normals, int[] triangles, float[] rotation, float[] zoom, float[] zoomScroll, float[] translation, String name, float[] color, boolean asIndices)
          Constructor.
SurfaceData(J3DBuffer points, J3DBuffer normals, int[] triangles, boolean asIndices)
          Constructor.
SurfaceData(J3DBuffer points, J3DBuffer normals, int[] triangles, float[] rotation, boolean asIndices)
          Constructor.
SurfaceData(J3DBuffer points, J3DBuffer normals, int[] triangles, float[] rotation, float[] zoom, float[] zoomScroll, float[] translation, String name, float[] color, boolean asIndices)
          Constructor.
SurfaceData(J3DBuffer points, J3DBuffer normals, int[] triangles, float[] rotation, String name, float[] color, boolean asIndices)
          Constructor.
 
Method Summary
 void convertStripCountsToIndices()
          Converts triangle data as strip counts to point indices.
 float[] getColor()
          Returns a three float array of RGB values representing the surface color.
 String getFormat()
          Returns a string representing the surface file format.
 int[] getImageDims()
          Returns image dimensions.
 String getName()
          Returns the name of this surface.
 double[] getNormal(double[] normal, int offset)
          Gets normal from normal buffer.
 Vector3d getNormal(Vector3d normal, int offset)
          Gets normal from normal buffer.
 float[] getNormalsArray()
          Returns the normals buffer.
 J3DBuffer getNormalsBuffer()
          Returns the normals buffer.
 double getNormalValue(int offset)
          Returns a normal value.
 int getNumPointValues()
          Returns number of stored point values (num points * 3).
 Coordinate getOrigin()
          Returns the image origin.
 double[] getPoint(double[] point, int offset)
          Gets point from point buffer.
 Point3d getPoint(Point3d point, int offset)
          Gets point from point buffer.
 float[] getPointsArray()
          Returns the points buffer.
 J3DBuffer getPointsBuffer()
          Returns the points buffer.
 double getPointValue(int offset)
          Returns a point value.
 float[] getRotationTransform()
          Returns the rotation transform.
 float getScalarMax()
          Returns the value associated with the upper end of the color table.
 float getScalarMin()
          Returns the value associated with the lower end of the color table.
 ShapeData[] getShapeData()
          Returns line and point shape data.
 Vector<SurfaceOverlay> getSurfaceOverlays()
          Returns overlay data associated with this surface.
 float[] getTransform()
          Deprecated. use getRotationTransform()
 float[] getTranslationTransform()
          Returns the translation transform.
 int[] getTriangles()
          Returns the triangle data.
 float[] getVoxelDims()
          Returns voxel dimensions.
 float[] getZoomScrollTransform()
          Returns the zoom scroll transform.
 float[] getZoomTransform()
          Returns the zoom transform.
 boolean isIndices()
          Returns true if the triangle data represents point indices, false if it represents strip counts
 void setFormat(String format)
          Sets the surface file format string.
 void setImageDims(int[] dims)
          Sets image dimensions.
 void setOrigin(Coordinate coor)
          Sets the image origin.
 void setScalarRange(float min, float max)
          Sets the scalar value range associated with the color table.
 void setShapeData(ShapeData[] data)
          Sets line and point shape data.
 void setSurfaceOverlays(Vector<SurfaceOverlay> overlays)
          Sets the surface overlay data used by this surface.
 void setVoxelDims(float[] dims)
          Sets voxel dimensions.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SurfaceData

public SurfaceData(J3DBuffer points,
                   J3DBuffer normals,
                   int[] triangles,
                   boolean asIndices)
Constructor.

Parameters:
points - points buffer (J3DBuffer contains a java.nio.FloatBuffer)
normals - normals buffer (J3DBuffer contains a java.nio.FloatBuffer)
triangles - triangles array
asIndices - true if the triangle array contains point indices describing triangles, false if it contains strip counts

SurfaceData

public SurfaceData(J3DBuffer points,
                   J3DBuffer normals,
                   int[] triangles,
                   float[] rotation,
                   boolean asIndices)
Constructor.

Parameters:
points - points buffer (J3DBuffer contains a java.nio.FloatBuffer)
normals - normals buffer (J3DBuffer contains a java.nio.FloatBuffer)
triangles - triangles array
rotation - a 4x4 rotation transform
asIndices - true if the triangle array contains point indices describing triangles, false if it contains strip counts

SurfaceData

public SurfaceData(J3DBuffer points,
                   J3DBuffer normals,
                   int[] triangles,
                   float[] rotation,
                   String name,
                   float[] color,
                   boolean asIndices)
Constructor.

Parameters:
points - points buffer (J3DBuffer contains a java.nio.FloatBuffer)
normals - normals buffer (J3DBuffer contains a java.nio.FloatBuffer)
triangles - triangles array
rotation - a 4x4 rotation transform
name - the surface name
color - a three float array containing RGB values
asIndices - true if the triangle array contains point indices describing triangles, false if it contains strip counts

SurfaceData

public SurfaceData(J3DBuffer points,
                   J3DBuffer normals,
                   int[] triangles,
                   float[] rotation,
                   float[] zoom,
                   float[] zoomScroll,
                   float[] translation,
                   String name,
                   float[] color,
                   boolean asIndices)
Constructor.

Parameters:
points - points buffer (J3DBuffer contains a java.nio.FloatBuffer)
normals - normals buffer (J3DBuffer contains a java.nio.FloatBuffer)
triangles - triangles array
rotation - a 4x4 rotation transform
zoom - a 4x4 zoom transform (z translation)
zoomScroll - a 4x4 zoom scroll transform (z translation)
translation - a 4x4 translation transform (x and y translation)
name - the surface name
color - a three float array containing RGB values
asIndices - true if the triangle array contains point indices describing triangles, false if it contains strip counts

SurfaceData

public SurfaceData(float[] points,
                   float[] normals,
                   int[] triangles,
                   float[] rotation,
                   float[] zoom,
                   float[] zoomScroll,
                   float[] translation,
                   String name,
                   float[] color,
                   boolean asIndices)
Constructor.

Parameters:
points - points array (used in Java3D v1.3)
normals - normals array (used in Java3D v1.3)
triangles - triangles array
rotation - a 4x4 rotation transform
zoom - a 4x4 zoom transform (z translation)
zoomScroll - a 4x4 zoom scroll transform (z translation)
translation - a 4x4 translation transform (x and y translation)
name - the surface name
color - a three float array containing RGB values
asIndices - true if the triangle array contains point indices describing triangles, false if it contains strip counts
Method Detail

getPoint

public Point3d getPoint(Point3d point,
                        int offset)
Gets point from point buffer.

Parameters:
point - a Point3d point
offset -
Returns:
a Point3d point

getPoint

public double[] getPoint(double[] point,
                         int offset)
Gets point from point buffer.

Parameters:
point - a double array of length 3
offset -
Returns:
a double array of length 3

getPointValue

public double getPointValue(int offset)
Returns a point value.

Parameters:
offset -
Returns:
a point value

getNormal

public Vector3d getNormal(Vector3d normal,
                          int offset)
Gets normal from normal buffer.

Parameters:
normal - a Vector3d normal
offset -
Returns:
a Vector3d normal

getNormal

public double[] getNormal(double[] normal,
                          int offset)
Gets normal from normal buffer.

Parameters:
normal - a double array of length 3
offset -
Returns:
a normal array of length 3

getNormalValue

public double getNormalValue(int offset)
Returns a normal value.

Parameters:
offset -
Returns:
a normal value

getPointsBuffer

public J3DBuffer getPointsBuffer()
Returns the points buffer.

Returns:
the points buffer

getNormalsBuffer

public J3DBuffer getNormalsBuffer()
Returns the normals buffer.

Returns:
the normals buffer

getPointsArray

public float[] getPointsArray()
Returns the points buffer.

Returns:
the points buffer

getNormalsArray

public float[] getNormalsArray()
Returns the normals buffer.

Returns:
the normals buffer

getNumPointValues

public int getNumPointValues()
Returns number of stored point values (num points * 3).

Returns:
number of stored point values

getTriangles

public int[] getTriangles()
Returns the triangle data.

Returns:
the triangle data (may be point indices or strip counts)

getTransform

public float[] getTransform()
Deprecated. use getRotationTransform()

Returns the rotation transform.

Returns:
the rotation transform

getRotationTransform

public float[] getRotationTransform()
Returns the rotation transform.

Returns:
the rotation transform

getZoomTransform

public float[] getZoomTransform()
Returns the zoom transform.

Returns:
the zoom transform

getZoomScrollTransform

public float[] getZoomScrollTransform()
Returns the zoom scroll transform.

Returns:
the zoom scroll transform

getTranslationTransform

public float[] getTranslationTransform()
Returns the translation transform.

Returns:
the translation transform

isIndices

public boolean isIndices()
Returns true if the triangle data represents point indices, false if it represents strip counts

Returns:
true if the triangle data represents point indices

getName

public String getName()
Returns the name of this surface.

Returns:
the name

getColor

public float[] getColor()
Returns a three float array of RGB values representing the surface color.

Returns:
a three float array of RGB values

getSurfaceOverlays

public Vector<SurfaceOverlay> getSurfaceOverlays()
Returns overlay data associated with this surface.

Returns:
a vector containing surface overlay data

setSurfaceOverlays

public void setSurfaceOverlays(Vector<SurfaceOverlay> overlays)
Sets the surface overlay data used by this surface.

Parameters:
overlays - a vector containing surface overlay data

setScalarRange

public void setScalarRange(float min,
                           float max)
Sets the scalar value range associated with the color table.

Parameters:
min - the value associated with the lower end of the color table
max - the value associated with the upper end of the color table

getScalarMin

public float getScalarMin()
Returns the value associated with the lower end of the color table.

Returns:
the scalar min

getScalarMax

public float getScalarMax()
Returns the value associated with the upper end of the color table.

Returns:
the scalar max

getShapeData

public ShapeData[] getShapeData()
Returns line and point shape data.

Returns:
line and point shape data

setShapeData

public void setShapeData(ShapeData[] data)
Sets line and point shape data.

Parameters:
data - an array of line and point shape data

convertStripCountsToIndices

public void convertStripCountsToIndices()
Converts triangle data as strip counts to point indices. For example, a strip count of 5 will be converted into the following three triangles: (0, 1, 2), (2, 1, 3), (2, 3, 4). Note, the order is relevant. If isIndices() is true, this method does nothing, otherwise isIndices() will return true after this method has been called.


setVoxelDims

public void setVoxelDims(float[] dims)
Sets voxel dimensions.

Parameters:
dims - voxel dimensions

getVoxelDims

public float[] getVoxelDims()
Returns voxel dimensions.

Returns:
voxel dimensions

setImageDims

public void setImageDims(int[] dims)
Sets image dimensions.

Parameters:
dims - image dimensions

getImageDims

public int[] getImageDims()
Returns image dimensions.

Returns:
image dimensions

setOrigin

public void setOrigin(Coordinate coor)
Sets the image origin.

Parameters:
coor - image origin

getOrigin

public Coordinate getOrigin()
Returns the image origin.

Returns:
the image origin

getFormat

public String getFormat()
Returns a string representing the surface file format.

Returns:
a string representing the surface file format

setFormat

public void setFormat(String format)
Sets the surface file format string.

Parameters:
format - file format