Class SurfaceMask
java.lang.Object
gov.nih.mipav.view.renderer.J3D.surfaceview.SurfaceMask
SurfaceMask. 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:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate floatThe plane coordinate x,y dimensions:private floatThe plane coordinate x,y dimensions:private floatThe plane coordinate x,y dimensions:private floatThe plane coordinate x,y dimensions:private floatThe plane coordinate x,y dimensions:private floatThe plane coordinate x,y dimensions:private intProduct of the image dimensions.private intDimensions of imageA.private intDimensions of imageA.private intDimensions of imageA.private ModelLUTModelLUT for getModelImageColor w/LUT changes:private ModelRGBModelRGB for getModelImageColor w/RGB LUT changes:private BitSetVolume-Filled TriangleMesh mask.private intModelImage image array dimensions:private intModelImage image array dimensions:private intModelImage image array dimensions: -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate 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 final 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.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.voidvoid
-
Field Details
-
mVolumeMask
Volume-Filled TriangleMesh mask. -
m_iXBound
private int m_iXBoundDimensions of imageA. -
m_iYBound
private int m_iYBoundDimensions of imageA. -
m_iZBound
private int m_iZBoundDimensions of imageA. -
m_iQuantity
private int m_iQuantityProduct of the image dimensions. -
m_fX0
private float m_fX0The plane coordinate x,y dimensions: -
m_fY0
private float m_fY0The plane coordinate x,y dimensions: -
m_fZ0
private float m_fZ0The plane coordinate x,y dimensions: -
m_fX1
private float m_fX1The plane coordinate x,y dimensions: -
m_fY1
private float m_fY1The plane coordinate x,y dimensions: -
m_fZ1
private float m_fZ1The plane coordinate x,y dimensions: -
xDim
private int xDimModelImage image array dimensions: -
yDim
private int yDimModelImage image array dimensions: -
zDim
private int zDimModelImage image array dimensions: -
m_kLUT
ModelLUT for getModelImageColor w/LUT changes: -
m_kRGBT
ModelRGB for getModelImageColor w/RGB LUT changes:
-
-
Constructor Details
-
SurfaceMask
SurfaceMask()Default Constructor:
-
-
Method Details
-
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 parameterbUseImageMask- create the per-vertex color from the imageA ModleImage, with the ModelImage maskfOpacity- Mask opacitysurColor- default Mask colorbCreateVertexColor- create the per-vertex color from the imageA ModleImage,
-
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
-
setLUT
-
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
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
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
-