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.SerializableA 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 classExtractSurfaceCubes.TriangleThe triangle just stores vertex indices and is unconcerned about the actual vertex locations.protected classExtractSurfaceCubes.VETableVertex-edge table to support mesh topology.
-
Field Summary
Fields Modifier and Type Field Description protected static intEB_XMAX_YMAXBit mask identifier.protected static intEB_XMAX_YMINBit mask identifier.protected static intEB_XMAX_ZMAXBit mask identifier.protected static intEB_XMAX_ZMINBit mask identifier.protected static intEB_XMIN_YMAXBit mask identifier.protected static intEB_XMIN_YMINBit mask identifiers.protected static intEB_XMIN_ZMAXBit mask identifier.protected static intEB_XMIN_ZMINBit mask identifier.protected static intEB_YMAX_ZMAXBit mask identifier.protected static intEB_YMAX_ZMINBit mask identifier.protected static intEB_YMIN_ZMAXBit mask identifier.protected static intEB_YMIN_ZMINBit mask identifier.protected static intEI_XMAX_YMAXBit-field identifier.protected static intEI_XMAX_YMINBit-field identifier.protected static intEI_XMAX_ZMAXBit-field identifier.protected static intEI_XMAX_ZMINBit-field identifier.protected static intEI_XMIN_YMAXBit-field identifier.protected static intEI_XMIN_YMINBit-field identifier.protected static intEI_XMIN_ZMAXBit-field identifier.protected static intEI_XMIN_ZMINBit-field identifier.protected static intEI_YMAX_ZMAXBit-field identifier.protected static intEI_YMAX_ZMINBit-field identifier.protected static intEI_YMIN_ZMAXBit-field identifier.protected static intEI_YMIN_ZMINBit-field identifier.protected static intFI_XMAXBit-field identifier.protected static intFI_XMINBit-field identifier.protected static intFI_YMAXBit-field identifier.protected static intFI_YMINBit-field identifier.protected static intFI_ZMAXBit-field identifier.protected static intFI_ZMINBit-field identifier.protected int[]m_aiDataDataprotected floatm_fXDeltadeltasprotected floatm_fYDeltadeltasprotected floatm_fZDeltadeltasprotected intm_iXBoundbounds on each dimension of 3D data set and data itself.protected intm_iXYBoundboundprotected intm_iYBoundbounds on each dimension of 3D data set and data itself.protected intm_iZBoundbounds on each dimension of 3D data set and data itself.protected Vector3fm_kCentroidcentroidprotected Vector3fm_kE0temporary variables to avoid 'new' calls.protected Vector3fm_kE1temporary variableprotected Vector3fm_kGradienttemporary variableprotected Vector3fm_kNtemporary variableprivate static longserialVersionUID
-
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 intaddVertex(Vector3f kV, java.util.HashMap<Vector3f,java.lang.Integer> kVMap)Called to add the specified point to the hashmap. voidExtractContour(float level, java.util.Vector<int[]> kTriTable, java.util.Vector<Vector3f> vertices, java.util.Vector<TriangleKey> triangles)voidExtractContour(float level, java.util.Vector<Vector3f> vertices, java.util.Vector<TriangleKey> triangles)Vector3fgetGradient(Vector3f kP)Interpolation of the gradient vector of the image.private intGetVertices(float level, int x, int y, int z, ExtractSurfaceCubes.VETable table)private voidGetXMaxEdges(int x, int y, int z, int type, ExtractSurfaceCubes.VETable table)private voidGetXMinEdges(int x, int y, int z, int type, ExtractSurfaceCubes.VETable table)private voidGetYMaxEdges(int x, int y, int z, int type, ExtractSurfaceCubes.VETable table)private voidGetYMinEdges(int x, int y, int z, int type, ExtractSurfaceCubes.VETable table)private voidGetZMaxEdges(int x, int y, int z, int type, ExtractSurfaceCubes.VETable table)private voidGetZMinEdges(int x, int y, int z, int type, ExtractSurfaceCubes.VETable table)static voidMakeUnique(java.util.Vector<Vector3f> vertices, java.util.Vector<TriangleKey> triangles, java.util.Vector<Vector3f> newVertices, java.util.Vector<TriangleKey> newTriangles)voidOrientTriangles(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)
-
-