Class SurfaceMask
- java.lang.Object
-
- gov.nih.mipav.view.renderer.J3D.surfaceview.SurfaceMask
-
public class SurfaceMask extends java.lang.ObjectSurfaceMask. Calculates the surface volume mask (BitSet) for a triangle mesh surface displayed in the SurfaceRender class. Both boundary masks and filled-volume masks are calculated by the maskInsideVoxels() function.The boundary-mask is stored in the ModelStorageBase class and is used to display the triangle mesh intersection with the 2D plane in the PlaneRender class. The volume-mask is stored in the SurfaceAttributes class and is accessed through the SurfaceAttributes.getMask() member function. The volume mask is used in the BurnBaseView.calcTotalVolume() function.
- See Also:
JPanelSurface.java,SurfaceRender.java,SurfaceAttributes.java,ModelStorageBase.java,BurnBaseView.java
-
-
Field Summary
Fields Modifier and Type Field Description private floatm_fX0The plane coordinate x,y dimensions:private floatm_fX1The plane coordinate x,y dimensions:private floatm_fY0The plane coordinate x,y dimensions:private floatm_fY1The plane coordinate x,y dimensions:private floatm_fZ0The plane coordinate x,y dimensions:private floatm_fZ1The plane coordinate x,y dimensions:private intm_iQuantityProduct of the image dimensions.private intm_iXBoundDimensions of imageA.private intm_iYBoundDimensions of imageA.private intm_iZBoundDimensions of imageA.private ModelLUTm_kLUTModelLUT for getModelImageColor w/LUT changes:private ModelRGBm_kRGBTModelRGB for getModelImageColor w/RGB LUT changes:private java.util.BitSetmVolumeMaskVolume-Filled TriangleMesh mask.private intxDimModelImage image array dimensions:private intyDimModelImage image array dimensions:private intzDimModelImage image array dimensions:
-
Constructor Summary
Constructors Constructor Description SurfaceMask()Default Constructor:
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private floatcalcMaxNormColors(ModelImage kImage, javax.vecmath.Color3f kOffset)calculates the color normalization factorsprivate voidfloodFill(int iX, int iY, int iZ)Identify voxels enclosed by the brain surface by using a flood fill.private voidgetColorMapped(int[] RGBIndexBuffer, javax.vecmath.Color3f kOffset, float fNorm, javax.vecmath.Color4f currentColor)Get the color from the RGB lookup table:private intgetIndex(int iX, int iY, int iZ)A convenience function for mapping the 3D voxel position (iX,iY,iZ) to a 1D array index.private floatgetIntersectX(javax.vecmath.Point3f kV0, javax.vecmath.Point3f kV1, javax.vecmath.Point3f kV2, float iY, float iZ)Compute the point of intersection between a line (0,iY,iZ)+t(1,0,0) and the triangle defined by the three input points.private floatgetIntersectY(javax.vecmath.Point3f kV0, javax.vecmath.Point3f kV1, javax.vecmath.Point3f kV2, float iX, float iZ)Compute the point of intersection between a line (iX,0,iZ)+t(0,1,0) and the triangle defined by the three input points.private floatgetIntersectZ(javax.vecmath.Point3f kV0, javax.vecmath.Point3f kV1, javax.vecmath.Point3f kV2, float iX, float iY)Compute the point of intersection between a line (iX,iY,0)+t(0,0,1) and the triangle defined by the three input points.javax.vecmath.Color4fgetModelImageColor(ModelImage imageA, float fTransparency, javax.vecmath.Point3f kModelPoint)Given a triangle vertex point from a ModelTriangleMesh, determines the corresponding ModelImage index point, and recreates the color that would have originally been assigned to the vertex.javax.vecmath.Point3fgetModelImagePoint(javax.vecmath.Point3f kTrianglePoint)Given a triangle vertex point from a ModelTriangleMesh, determines the corresponding ModelImage index point.java.util.BitSetgetVolumeMask()Get the current added surface bit mask.voidmaskInsideVoxels(int index, ModelImage imageA, ModelTriangleMesh[] kMesh, boolean bHasVertexColor, boolean bCreateVertexColors, boolean bUseImageMask, float fOpacity, WildMagic.LibFoundation.Mathematics.ColorRGBA surColor)Mask the mesh surface volume in voxels.voidsetLUT(ModelLUT kLUT)voidsetRGBT(ModelRGB kRGBT)
-
-
-
Field Detail
-
mVolumeMask
private java.util.BitSet mVolumeMask
Volume-Filled TriangleMesh mask.
-
m_iXBound
private int m_iXBound
Dimensions of imageA.
-
m_iYBound
private int m_iYBound
Dimensions of imageA.
-
m_iZBound
private int m_iZBound
Dimensions of imageA.
-
m_iQuantity
private int m_iQuantity
Product of the image dimensions.
-
m_fX0
private float m_fX0
The plane coordinate x,y dimensions:
-
m_fY0
private float m_fY0
The plane coordinate x,y dimensions:
-
m_fZ0
private float m_fZ0
The plane coordinate x,y dimensions:
-
m_fX1
private float m_fX1
The plane coordinate x,y dimensions:
-
m_fY1
private float m_fY1
The plane coordinate x,y dimensions:
-
m_fZ1
private float m_fZ1
The plane coordinate x,y dimensions:
-
xDim
private int xDim
ModelImage image array dimensions:
-
yDim
private int yDim
ModelImage image array dimensions:
-
zDim
private int zDim
ModelImage image array dimensions:
-
m_kLUT
private ModelLUT m_kLUT
ModelLUT for getModelImageColor w/LUT changes:
-
m_kRGBT
private ModelRGB m_kRGBT
ModelRGB for getModelImageColor w/RGB LUT changes:
-
-
Method Detail
-
maskInsideVoxels
public void maskInsideVoxels(int index, ModelImage imageA, ModelTriangleMesh[] kMesh, boolean bHasVertexColor, boolean bCreateVertexColors, boolean bUseImageMask, float fOpacity, WildMagic.LibFoundation.Mathematics.ColorRGBA surColor)Mask the mesh surface volume in voxels.- Parameters:
index- Mask index in the ModelImage imageAimageA- ModelImage for storing the surface-maskkMesh- ModelTriangleMesh[] surfacesbHasVertexColor- use per-vertex color from the ModelTriangleMesh, otherwise use the surColor parameterbCreateVertexColor- create the per-vertex color from the imageA ModleImage,bUseImageMask- create the per-vertex color from the imageA ModleImage, with the ModelImage maskfOpacity- Mask opacitysurColor- default Mask color
-
getModelImagePoint
public javax.vecmath.Point3f getModelImagePoint(javax.vecmath.Point3f kTrianglePoint)
Given a triangle vertex point from a ModelTriangleMesh, determines the corresponding ModelImage index point.- Parameters:
kTrianglePoint- ModelTriangleMesh point in mesh coordinates- Returns:
- ModelImage index point.
-
setRGBT
public void setRGBT(ModelRGB kRGBT)
-
setLUT
public void setLUT(ModelLUT kLUT)
-
getColorMapped
private void getColorMapped(int[] RGBIndexBuffer, javax.vecmath.Color3f kOffset, float fNorm, javax.vecmath.Color4f currentColor)Get the color from the RGB lookup table:- Parameters:
RGBIndexBuffer- the color lookup table index bufferkOffset- the color offsetfNorm- the color normalizationcurrentColor- the current color (changed)
-
calcMaxNormColors
private float calcMaxNormColors(ModelImage kImage, javax.vecmath.Color3f kOffset)
calculates the color normalization factors- Parameters:
kImage- the model image from which the normalization factors are calculatedkOffset- the calculated color offset- Returns:
- the color normalization factor.
-
getModelImageColor
public javax.vecmath.Color4f getModelImageColor(ModelImage imageA, float fTransparency, javax.vecmath.Point3f kModelPoint)
Given a triangle vertex point from a ModelTriangleMesh, determines the corresponding ModelImage index point, and recreates the color that would have originally been assigned to the vertex.- Parameters:
kTrianglePoint- ModelTriangleMesh point in ModelImage coordinates- Returns:
- original color of the triangle point.
-
getVolumeMask
public java.util.BitSet getVolumeMask()
Get the current added surface bit mask.- Returns:
- BitSet surface volume bit set mask.
-
floodFill
private void floodFill(int iX, int iY, int iZ)Identify voxels enclosed by the brain surface by using a flood fill. The flood fill is nonrecursive to avoid overflowing the program stack.- Parameters:
iX- the x-value of the seed point for the filliY- the y-value of the seed point for the filliZ- the z-value of the seed point for the fill
-
getIndex
private final int getIndex(int iX, int iY, int iZ)A convenience function for mapping the 3D voxel position (iX,iY,iZ) to a 1D array index. The images are stored as 1D arrays, so this function is used frequently.- Parameters:
iX- the x-value of the voxel positioniY- the y-value of the voxel positioniZ- the z-value of the voxel position- Returns:
- the 1D array index corresponding to (iX,iY,iZ)
-
getIntersectX
private float getIntersectX(javax.vecmath.Point3f kV0, javax.vecmath.Point3f kV1, javax.vecmath.Point3f kV2, float iY, float iZ)Compute the point of intersection between a line (0,iY,iZ)+t(1,0,0) and the triangle defined by the three input points. All calculations are in voxel coordinates and the x-value of the intersection point is truncated to an integer.- Parameters:
kV0- a 3D vertex of the trianglekV1- a 3D vertex of the trianglekV2- a 3D vertex of the triangleiY- the y-value of the origin of the lineiZ- the z-value of the origin of the line- Returns:
- the x-value of the intersection
-
getIntersectY
private float getIntersectY(javax.vecmath.Point3f kV0, javax.vecmath.Point3f kV1, javax.vecmath.Point3f kV2, float iX, float iZ)Compute the point of intersection between a line (iX,0,iZ)+t(0,1,0) and the triangle defined by the three input points. All calculations are in voxel coordinates and the y-value of the intersection point is truncated to an integer.- Parameters:
kV0- a 3D vertex of the trianglekV1- a 3D vertex of the trianglekV2- a 3D vertex of the triangleiX- the x-value of the origin of the lineiZ- the z-value of the origin of the line- Returns:
- the y-value of the intersection
-
getIntersectZ
private float getIntersectZ(javax.vecmath.Point3f kV0, javax.vecmath.Point3f kV1, javax.vecmath.Point3f kV2, float iX, float iY)Compute the point of intersection between a line (iX,iY,0)+t(0,0,1) and the triangle defined by the three input points. All calculations are in voxel coordinates and the z-value of the intersection point is truncated to an integer.- Parameters:
kV0- a 3D vertex of the trianglekV1- a 3D vertex of the trianglekV2- a 3D vertex of the triangleiX- the x-value of the origin of the lineiY- the y-value of the origin of the line- Returns:
- the z-value of the intersection
-
-