Package WildMagic.LibImagics.Extraction
Class ExtractSurfaceCubes
- java.lang.Object
-
- WildMagic.LibImagics.Extraction.ExtractSurfaceCubes
-
- All Implemented Interfaces:
java.io.Serializable
public class ExtractSurfaceCubes extends java.lang.Object implements java.io.Serializable
A level surface extractor that is based on decomposing voxels into cubes, assuming a linear interpolation on the cubes, and extracting triangular level sets for those cubes. The resulting level surface is a triangle mesh.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
ExtractSurfaceCubes.Triangle
The triangle just stores vertex indices and is unconcerned about the actual vertex locations.protected class
ExtractSurfaceCubes.VETable
Vertex-edge table to support mesh topology.
-
Field Summary
Fields Modifier and Type Field Description protected static int
EB_XMAX_YMAX
Bit mask identifier.protected static int
EB_XMAX_YMIN
Bit mask identifier.protected static int
EB_XMAX_ZMAX
Bit mask identifier.protected static int
EB_XMAX_ZMIN
Bit mask identifier.protected static int
EB_XMIN_YMAX
Bit mask identifier.protected static int
EB_XMIN_YMIN
Bit mask identifiers.protected static int
EB_XMIN_ZMAX
Bit mask identifier.protected static int
EB_XMIN_ZMIN
Bit mask identifier.protected static int
EB_YMAX_ZMAX
Bit mask identifier.protected static int
EB_YMAX_ZMIN
Bit mask identifier.protected static int
EB_YMIN_ZMAX
Bit mask identifier.protected static int
EB_YMIN_ZMIN
Bit mask identifier.protected static int
EI_XMAX_YMAX
Bit-field identifier.protected static int
EI_XMAX_YMIN
Bit-field identifier.protected static int
EI_XMAX_ZMAX
Bit-field identifier.protected static int
EI_XMAX_ZMIN
Bit-field identifier.protected static int
EI_XMIN_YMAX
Bit-field identifier.protected static int
EI_XMIN_YMIN
Bit-field identifier.protected static int
EI_XMIN_ZMAX
Bit-field identifier.protected static int
EI_XMIN_ZMIN
Bit-field identifier.protected static int
EI_YMAX_ZMAX
Bit-field identifier.protected static int
EI_YMAX_ZMIN
Bit-field identifier.protected static int
EI_YMIN_ZMAX
Bit-field identifier.protected static int
EI_YMIN_ZMIN
Bit-field identifier.protected static int
FI_XMAX
Bit-field identifier.protected static int
FI_XMIN
Bit-field identifier.protected static int
FI_YMAX
Bit-field identifier.protected static int
FI_YMIN
Bit-field identifier.protected static int
FI_ZMAX
Bit-field identifier.protected static int
FI_ZMIN
Bit-field identifier.protected int[]
m_aiData
Dataprotected float
m_fXDelta
deltasprotected float
m_fYDelta
deltasprotected float
m_fZDelta
deltasprotected int
m_iXBound
bounds on each dimension of 3D data set and data itself.protected int
m_iXYBound
boundprotected int
m_iYBound
bounds on each dimension of 3D data set and data itself.protected int
m_iZBound
bounds on each dimension of 3D data set and data itself.protected Vector3f
m_kCentroid
centroidprotected Vector3f
m_kE0
temporary variables to avoid 'new' calls.protected Vector3f
m_kE1
temporary variableprotected Vector3f
m_kGradient
temporary variableprotected Vector3f
m_kN
temporary variableprivate static long
serialVersionUID
-
Constructor Summary
Constructors Constructor Description ExtractSurfaceCubes(int iXBound, int iYBound, int iZBound, int[] aiData)
Create a level surface extractor for a 3D image.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected static int
addVertex(Vector3f kV, java.util.HashMap<Vector3f,java.lang.Integer> kVMap)
Called to add the specified point to the hashmap. void
ExtractContour(float level, java.util.Vector<int[]> kTriTable, java.util.Vector<Vector3f> vertices, java.util.Vector<TriangleKey> triangles)
void
ExtractContour(float level, java.util.Vector<Vector3f> vertices, java.util.Vector<TriangleKey> triangles)
Vector3f
getGradient(Vector3f kP)
Interpolation of the gradient vector of the image.private int
GetVertices(float level, int x, int y, int z, ExtractSurfaceCubes.VETable table)
private void
GetXMaxEdges(int x, int y, int z, int type, ExtractSurfaceCubes.VETable table)
private void
GetXMinEdges(int x, int y, int z, int type, ExtractSurfaceCubes.VETable table)
private void
GetYMaxEdges(int x, int y, int z, int type, ExtractSurfaceCubes.VETable table)
private void
GetYMinEdges(int x, int y, int z, int type, ExtractSurfaceCubes.VETable table)
private void
GetZMaxEdges(int x, int y, int z, int type, ExtractSurfaceCubes.VETable table)
private void
GetZMinEdges(int x, int y, int z, int type, ExtractSurfaceCubes.VETable table)
static void
MakeUnique(java.util.Vector<Vector3f> vertices, java.util.Vector<TriangleKey> triangles, java.util.Vector<Vector3f> newVertices, java.util.Vector<TriangleKey> newTriangles)
void
OrientTriangles(java.util.Vector<Vector3f> vertices, java.util.Vector<TriangleKey> triangles, boolean sameDir)
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
EI_XMIN_YMIN
protected static final int EI_XMIN_YMIN
Bit-field identifier.- See Also:
- Constant Field Values
-
EI_XMIN_YMAX
protected static final int EI_XMIN_YMAX
Bit-field identifier.- See Also:
- Constant Field Values
-
EI_XMAX_YMIN
protected static final int EI_XMAX_YMIN
Bit-field identifier.- See Also:
- Constant Field Values
-
EI_XMAX_YMAX
protected static final int EI_XMAX_YMAX
Bit-field identifier.- See Also:
- Constant Field Values
-
EI_XMIN_ZMIN
protected static final int EI_XMIN_ZMIN
Bit-field identifier.- See Also:
- Constant Field Values
-
EI_XMIN_ZMAX
protected static final int EI_XMIN_ZMAX
Bit-field identifier.- See Also:
- Constant Field Values
-
EI_XMAX_ZMIN
protected static final int EI_XMAX_ZMIN
Bit-field identifier.- See Also:
- Constant Field Values
-
EI_XMAX_ZMAX
protected static final int EI_XMAX_ZMAX
Bit-field identifier.- See Also:
- Constant Field Values
-
EI_YMIN_ZMIN
protected static final int EI_YMIN_ZMIN
Bit-field identifier.- See Also:
- Constant Field Values
-
EI_YMIN_ZMAX
protected static final int EI_YMIN_ZMAX
Bit-field identifier.- See Also:
- Constant Field Values
-
EI_YMAX_ZMIN
protected static final int EI_YMAX_ZMIN
Bit-field identifier.- See Also:
- Constant Field Values
-
EI_YMAX_ZMAX
protected static final int EI_YMAX_ZMAX
Bit-field identifier.- See Also:
- Constant Field Values
-
FI_XMIN
protected static final int FI_XMIN
Bit-field identifier.- See Also:
- Constant Field Values
-
FI_XMAX
protected static final int FI_XMAX
Bit-field identifier.- See Also:
- Constant Field Values
-
FI_YMIN
protected static final int FI_YMIN
Bit-field identifier.- See Also:
- Constant Field Values
-
FI_YMAX
protected static final int FI_YMAX
Bit-field identifier.- See Also:
- Constant Field Values
-
FI_ZMIN
protected static final int FI_ZMIN
Bit-field identifier.- See Also:
- Constant Field Values
-
FI_ZMAX
protected static final int FI_ZMAX
Bit-field identifier.- See Also:
- Constant Field Values
-
EB_XMIN_YMIN
protected static final int EB_XMIN_YMIN
Bit mask identifiers.- See Also:
- Constant Field Values
-
EB_XMIN_YMAX
protected static final int EB_XMIN_YMAX
Bit mask identifier.- See Also:
- Constant Field Values
-
EB_XMAX_YMIN
protected static final int EB_XMAX_YMIN
Bit mask identifier.- See Also:
- Constant Field Values
-
EB_XMAX_YMAX
protected static final int EB_XMAX_YMAX
Bit mask identifier.- See Also:
- Constant Field Values
-
EB_XMIN_ZMIN
protected static final int EB_XMIN_ZMIN
Bit mask identifier.- See Also:
- Constant Field Values
-
EB_XMIN_ZMAX
protected static final int EB_XMIN_ZMAX
Bit mask identifier.- See Also:
- Constant Field Values
-
EB_XMAX_ZMIN
protected static final int EB_XMAX_ZMIN
Bit mask identifier.- See Also:
- Constant Field Values
-
EB_XMAX_ZMAX
protected static final int EB_XMAX_ZMAX
Bit mask identifier.- See Also:
- Constant Field Values
-
EB_YMIN_ZMIN
protected static final int EB_YMIN_ZMIN
Bit mask identifier.- See Also:
- Constant Field Values
-
EB_YMIN_ZMAX
protected static final int EB_YMIN_ZMAX
Bit mask identifier.- See Also:
- Constant Field Values
-
EB_YMAX_ZMIN
protected static final int EB_YMAX_ZMIN
Bit mask identifier.- See Also:
- Constant Field Values
-
EB_YMAX_ZMAX
protected static final int EB_YMAX_ZMAX
Bit mask identifier.- See Also:
- Constant Field Values
-
m_aiData
protected int[] m_aiData
Data
-
m_fXDelta
protected float m_fXDelta
deltas
-
m_fYDelta
protected float m_fYDelta
deltas
-
m_fZDelta
protected float m_fZDelta
deltas
-
m_iXBound
protected int m_iXBound
bounds on each dimension of 3D data set and data itself.
-
m_iYBound
protected int m_iYBound
bounds on each dimension of 3D data set and data itself.
-
m_iZBound
protected int m_iZBound
bounds on each dimension of 3D data set and data itself.
-
m_iXYBound
protected int m_iXYBound
bound
-
m_kCentroid
protected Vector3f m_kCentroid
centroid
-
m_kE0
protected Vector3f m_kE0
temporary variables to avoid 'new' calls.
-
m_kE1
protected Vector3f m_kE1
temporary variable
-
m_kGradient
protected Vector3f m_kGradient
temporary variable
-
m_kN
protected Vector3f m_kN
temporary variable
-
-
Constructor Detail
-
ExtractSurfaceCubes
public ExtractSurfaceCubes(int iXBound, int iYBound, int iZBound, int[] aiData)
Create a level surface extractor for a 3D image. The delta input values are important when the voxels are not cubic. For example, a typical MRI might have z-slice spacing about 5 times that of the x and y spacing. In this case, dx = 1, dy = 1, and dz = 5. The idea is that 1 is a 'voxel unit' and the z-slices are spaced by 5 voxel units.- Parameters:
iXBound
- the number of columns in the 3D imageiYBound
- the number of rows in the 3D imageiZBound
- the number of slices in the 3D imageaiData
- The image data stored in order of slice indices, each slice stored in row-major order. That is, slice z=0 is stored first, slice z=1 is stored next, and so on. In slice z=0, the y=0 row is stored first, the y=1 row is stored next, and so on.
-
-
Method Detail
-
addVertex
protected static int addVertex(Vector3f kV, java.util.HashMap<Vector3f,java.lang.Integer> kVMap)
Called to add the specified point to the hashmap. If the specified point already exists in the hashmap, then it is not added. If it is added, the Integer value of the hashmap is set to the order of insertion index. The Integer value of this point in the hashmap, if added or if already found in the hashmap, is returned. - Parameters:
kV
- Vector3f sample space coordinates of the pointkVMap
- HashMap hashmap with Vector3f key and Integer value for adding the point if not already present- Returns:
- insertion order index for the specified point
-
ExtractContour
public void ExtractContour(float level, java.util.Vector<int[]> kTriTable, java.util.Vector<Vector3f> vertices, java.util.Vector<TriangleKey> triangles)
-
ExtractContour
public void ExtractContour(float level, java.util.Vector<Vector3f> vertices, java.util.Vector<TriangleKey> triangles)
-
getGradient
public Vector3f getGradient(Vector3f kP)
Interpolation of the gradient vector of the image. The voxel containing the input point is determined. A weighted combination of the gradient values at the vertices is used for the interpolated value. This vector is used to determine consistent normals for the triangles in the mesh representing the level surface.- Parameters:
kP
- the sample space coordinates of the point to be interpolated- Returns:
- the gradient at the input point
-
MakeUnique
public static void MakeUnique(java.util.Vector<Vector3f> vertices, java.util.Vector<TriangleKey> triangles, java.util.Vector<Vector3f> newVertices, java.util.Vector<TriangleKey> newTriangles)
-
OrientTriangles
public void OrientTriangles(java.util.Vector<Vector3f> vertices, java.util.Vector<TriangleKey> triangles, boolean sameDir)
-
GetVertices
private int GetVertices(float level, int x, int y, int z, ExtractSurfaceCubes.VETable table)
-
GetXMaxEdges
private void GetXMaxEdges(int x, int y, int z, int type, ExtractSurfaceCubes.VETable table)
-
GetXMinEdges
private void GetXMinEdges(int x, int y, int z, int type, ExtractSurfaceCubes.VETable table)
-
GetYMaxEdges
private void GetYMaxEdges(int x, int y, int z, int type, ExtractSurfaceCubes.VETable table)
-
GetYMinEdges
private void GetYMinEdges(int x, int y, int z, int type, ExtractSurfaceCubes.VETable table)
-
GetZMaxEdges
private void GetZMaxEdges(int x, int y, int z, int type, ExtractSurfaceCubes.VETable table)
-
GetZMinEdges
private void GetZMinEdges(int x, int y, int z, int type, ExtractSurfaceCubes.VETable table)
-
-