Class 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
    • Field Detail

      • 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
      • 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 image
        iYBound - the number of rows in the 3D image
        iZBound - the number of slices in the 3D image
        aiData - 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 point
        kVMap - 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)