Package WildMagic.LibImagics.Extraction
Class ExtractSurfaceTetra
- java.lang.Object
-
- WildMagic.LibImagics.Extraction.ExtractSurfaceTetra
-
- All Implemented Interfaces:
java.io.Serializable
public class ExtractSurfaceTetra extends java.lang.Object implements java.io.Serializable
A level surface extractor that is based on decomposing voxels into tetrahedra, assuming a linear interpolation on the tetrahedra, and extracting triangular level sets for those tetrahedra. The resulting level surface is a triangle mesh. A detailed discussion of the algorithm is found in Level Set Extraction- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
ExtractSurfaceTetra.Triangle
A rational representation of a level set triangle.protected class
ExtractSurfaceTetra.Vertex
A rational representation of a level set vertex.
-
Field Summary
Fields Modifier and Type Field Description protected int[]
m_aiData
dataprotected int
m_iNextIndex
for unique indexing of vertices.protected int
m_iXBound
bounds on each dimension of 3D data set and data itself.protected int
m_iXYProduct
??protected int
m_iXYZProduct
??protected 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
temporary variables to eliminate 'new' calls for Vector3f.protected Vector3f
m_kE0
temporary variables to eliminate 'new' calls for Vector3fprotected Vector3f
m_kE1
temporary variables to eliminate 'new' calls for Vector3fprotected Vector3f
m_kGradient
temporary variables to eliminate 'new' calls for Vector3fprotected Vector3f
m_kN
temporary variables to eliminate 'new' calls for Vector3fprotected java.util.HashSet<ExtractSurfaceTetra.Triangle>
m_kTSet
set ofprotected Vector3f
m_kV0
temporary variables to eliminate 'new' calls for Vector3f.protected Vector3f
m_kV1
temporary variables to eliminate 'new' calls for Vector3f.protected Vector3f
m_kV2
temporary variables to eliminate 'new' calls for Vector3f.protected java.util.HashMap<ExtractSurfaceTetra.Vertex,java.lang.Integer>
m_kVMap
temporary storage for use in extraction.private static long
serialVersionUID
-
Constructor Summary
Constructors Constructor Description ExtractSurfaceTetra(int iXBound, int iYBound, int iZBound, int[] aiData)
Create a level surface extractor for a 3D image.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addTriangle(int iXN0, int iXD0, int iYN0, int iYD0, int iZN0, int iZD0, int iXN1, int iXD1, int iYN1, int iYD1, int iZN1, int iZD1, int iXN2, int iXD2, int iYN2, int iYD2, int iZN2, int iZD2)
Add a level set triangle that was found in processTetrahedron.protected int
addVertex(int iXN, int iXD, int iYN, int iYD, int iZN, int iZD)
Add a level set vertex that was found in processTetrahedron.void
ExtractContour(int iLevel, java.util.HashMap<ExtractSurfaceTetra.Vertex,java.lang.Integer> kVMap, java.util.HashSet<ExtractSurfaceTetra.Triangle> kTSet)
Construct a level surface from the 3D image managed by the extractor.void
ExtractContour(int iLevel, java.util.Vector<int[]> kTriTable, java.util.HashMap<ExtractSurfaceTetra.Vertex,java.lang.Integer> kVMap, java.util.HashSet<ExtractSurfaceTetra.Triangle> kTSet)
Construct a level surface from the 3D image managed by the extractor.float
getFunction(Vector3f kP)
Interpolation of the image.Vector3f
getGradient(Vector3f kP)
Interpolation of the gradient vector of the image.protected void
processTetrahedron(float iLevel, int iX0, int iY0, int iZ0, int iF0, int iX1, int iY1, int iZ1, int iF1, int iX2, int iY2, int iZ2, int iF2, int iX3, int iY3, int iZ3, int iF3)
Find the triangles that are the level set for a linear function defined on a single tetrahedron.
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
m_aiData
protected int[] m_aiData
data
-
m_iNextIndex
protected int m_iNextIndex
for unique indexing of vertices.
-
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_iXYProduct
protected int m_iXYProduct
??
-
m_iXYZProduct
protected int m_iXYZProduct
??
-
m_kE0
protected Vector3f m_kE0
temporary variables to eliminate 'new' calls for Vector3f
-
m_kE1
protected Vector3f m_kE1
temporary variables to eliminate 'new' calls for Vector3f
-
m_kN
protected Vector3f m_kN
temporary variables to eliminate 'new' calls for Vector3f
-
m_kGradient
protected Vector3f m_kGradient
temporary variables to eliminate 'new' calls for Vector3f
-
m_kTSet
protected java.util.HashSet<ExtractSurfaceTetra.Triangle> m_kTSet
set of
-
m_kV0
protected Vector3f m_kV0
temporary variables to eliminate 'new' calls for Vector3f.
-
m_kV1
protected Vector3f m_kV1
temporary variables to eliminate 'new' calls for Vector3f.
-
m_kV2
protected Vector3f m_kV2
temporary variables to eliminate 'new' calls for Vector3f.
-
m_kCentroid
protected Vector3f m_kCentroid
temporary variables to eliminate 'new' calls for Vector3f.
-
m_kVMap
protected java.util.HashMap<ExtractSurfaceTetra.Vertex,java.lang.Integer> m_kVMap
temporary storage for use in extraction.
-
-
Constructor Detail
-
ExtractSurfaceTetra
public ExtractSurfaceTetra(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.fXDelta
- the relative voxel x-size (in voxel units)fYDelta
- the relative voxel y-size (in voxel units)fZDelta
- the relative voxel z-size (in voxel units)direction
- array of direction factors == 1 or -1.startLocation
- array of startLocationdicomMatrix
- DOCUMENT ME!
-
-
Method Detail
-
ExtractContour
public void ExtractContour(int iLevel, java.util.HashMap<ExtractSurfaceTetra.Vertex,java.lang.Integer> kVMap, java.util.HashSet<ExtractSurfaceTetra.Triangle> kTSet)
Construct a level surface from the 3D image managed by the extractor.
-
ExtractContour
public void ExtractContour(int iLevel, java.util.Vector<int[]> kTriTable, java.util.HashMap<ExtractSurfaceTetra.Vertex,java.lang.Integer> kVMap, java.util.HashSet<ExtractSurfaceTetra.Triangle> kTSet)
Construct a level surface from the 3D image managed by the extractor.
-
getFunction
public float getFunction(Vector3f kP)
Interpolation of the image. The voxel containing the input point is determined. Within that voxel, the correct tetrahedron containing the point is determined. A barycentric combination of the function values at the vertices of the tetrahedron is used for the interpolated value. The barycentric coordinates are those of the input point relative to the vertices of the tetrahedron.- Parameters:
kP
- - (x,y,z) the point to be interpolated- Returns:
- the interpolated function value
-
getGradient
public Vector3f getGradient(Vector3f kP)
Interpolation of the gradient vector of the image. The voxel containing the input point is determined. Within that voxel, the correct tetrahedron containing the point is determined. A barycentric combination of the gradient values at the vertices of the tetrahedron is used for the interpolated value. The barycentric coordinates are those of the input point relative to the vertices of the tetrahedron.
This vector is used to determine consistent normals for the triangles in the mesh representing the level surface. This is faster than using ModelSurfaceTopology.getConsistentComponents(), but may fail on some pathological cases. These cases are rare in 3D images from real applications.- Parameters:
kP
- the point to be interpolated- Returns:
- the gradient at the input point
-
addTriangle
protected void addTriangle(int iXN0, int iXD0, int iYN0, int iYD0, int iZN0, int iZD0, int iXN1, int iXD1, int iYN1, int iYD1, int iZN1, int iZD1, int iXN2, int iXD2, int iYN2, int iYD2, int iZN2, int iZD2)
Add a level set triangle that was found in processTetrahedron.- Parameters:
iXN0
- a vertex in rational formiXD0
- a vertex in rational formiYN0
- a vertex in rational formiYD0
- DOCUMENT ME!iZN0
- DOCUMENT ME!iZD0
- DOCUMENT ME!iXN1
- DOCUMENT ME!iXD1
- DOCUMENT ME!iYN1
- DOCUMENT ME!iYD1
- DOCUMENT ME!iZN1
- DOCUMENT ME!iZD1
- DOCUMENT ME!iXN2
- DOCUMENT ME!iXD2
- DOCUMENT ME!iYN2
- DOCUMENT ME!iYD2
- DOCUMENT ME!iZN2
- DOCUMENT ME!iZD2
- DOCUMENT ME!
-
addVertex
protected int addVertex(int iXN, int iXD, int iYN, int iYD, int iZN, int iZD)
Add a level set vertex that was found in processTetrahedron.- Parameters:
iXN
- the vertex in rational formiXD
- DOCUMENT ME!iYN
- DOCUMENT ME!iYD
- DOCUMENT ME!iZN
- DOCUMENT ME!iZD
- DOCUMENT ME!- Returns:
- the index of that added vertex, used in addTriangle
-
processTetrahedron
protected void processTetrahedron(float iLevel, int iX0, int iY0, int iZ0, int iF0, int iX1, int iY1, int iZ1, int iF1, int iX2, int iY2, int iZ2, int iF2, int iX3, int iY3, int iZ3, int iF3)
Find the triangles that are the level set for a linear function defined on a single tetrahedron.- Parameters:
iLevel
- the desired level valueiX0
- a tetrahedron vertex and function valueiY0
- a tetrahedron vertex and function valueiZ0
- a tetrahedron vertex and function valueiF0
- a tetrahedron vertex and function valueiX1
- DOCUMENT ME!iY1
- DOCUMENT ME!iZ1
- DOCUMENT ME!iF1
- DOCUMENT ME!iX2
- DOCUMENT ME!iY2
- DOCUMENT ME!iZ2
- DOCUMENT ME!iF2
- DOCUMENT ME!iX3
- DOCUMENT ME!iY3
- DOCUMENT ME!iZ3
- DOCUMENT ME!iF3
- DOCUMENT ME!
-
-