Package mgui.geometry.mesh
Class MeshEngine
java.lang.Object
mgui.geometry.mesh.MeshEngine
- All Implemented Interfaces:
AttributeObject
,NamedObject
,Engine
public class MeshEngine extends java.lang.Object implements Engine
Engine for performing mesh-based algorithms.
TODO: Specify algorithms as method names using reflection..?
- Since:
- 1.0
- Version:
- 1.0
- Author:
- Andrew Reid
-
Field Summary
Fields Modifier and Type Field Description static int
OPT_VOLUME_EXPD
static int
OPT_VOLUME_MEAN
-
Constructor Summary
Constructors Constructor Description MeshEngine()
-
Method Summary
Modifier and Type Method Description boolean
callMethod(java.lang.String operation, java.lang.String method, java.util.ArrayList<?> params, ProgressUpdater progress)
Calls the specified operation/method pair.boolean
callMethod(java.lang.String operation, java.lang.String method, ProgressUpdater progress)
Calls the specified operation/method pair.boolean
computeMeanCurvature(Mesh3DInt mesh3d, ProgressUpdater progress)
Computes the vertex-wise mean curvature of this mesh and stores it in the "target_column" specified it the "Mean Curvature" attributes.void
decimate(Mesh3D mesh, java.lang.String method)
void
DecimateByDistance(Mesh3D mesh, Mesh3D newmesh)
Calls the function DecimateByDistance in the MeshFunctions function class, using parameters specified in the AttributeList "Decimate By Distance"void
decimateSchroeder(Mesh3D mesh)
void
doRoiOperation(Mesh3DInt mesh_int, java.lang.String method, InterfaceProgressBar progress_bar)
Runs the ROI operation specified bymethod
.Attribute<?>
getAttribute(java.lang.String attrName)
Returns a specific attribute for this object.AttributeList
getAttributes()
Returns the list of current attributes for this object.AttributeList
getAttributes(java.lang.String key)
AttributeList
getAttributes(java.lang.String operation, java.lang.String method)
Returns the attributes list corresponding to theoperation
andmethod
.java.lang.Object
getAttributeValue(java.lang.String name)
Gets the value of attributename
, ornull
if it does not exist.void
getMeshParts(Mesh3DInt mesh_int, ShapeSet3DInt shape_set)
Creates new mesh objects as a set of non-contiguous meshes frommesh_int
, and adds these toshape_set
.void
getMeshParts(Mesh3DInt mesh_int, ShapeSet3DInt shape_set, boolean copy_data, ProgressUpdater progress)
Creates new mesh objects as a set of non-contiguous meshes frommesh_int
, and adds these toshape_set
.java.util.ArrayList<java.lang.String>
getMethods(java.lang.String operation)
Returns a list of methods implementing a particularoperation
.java.lang.String
getName()
Gets the name for this object.java.util.ArrayList<java.lang.String>
getOperations()
Returns a list of the operations available for thisEngine
.void
getSubMesh(Mesh3DInt mesh, Mesh3DInt newmesh, boolean retain, boolean copydata)
void
getSubMesh(Mesh3DInt mesh, Mesh3DInt newmesh, java.util.ArrayList<MguiNumber> mask, int value, boolean retain, boolean copydata)
void
inflateMesh(Mesh3DInt mesh, java.lang.String method, ProgressUpdater progress)
void
inflateTRP(Mesh3DInt mesh, ProgressUpdater progress)
Volume3DInt
mapMeshToVolume(Mesh3DInt mesh, Volume3DInt volume, java.lang.String method, InterfaceProgressBar progress_bar)
Volume3DInt
mapMeshToVolumeGaussian(Mesh3DInt mesh_int, Volume3DInt volume, InterfaceProgressBar progress_bar)
java.util.ArrayList<MguiNumber>
mapVolumeToMesh(Mesh3D mesh, Volume3DInt volume, java.lang.String method)
java.util.ArrayList<MguiNumber>
mapVolumeToMesh(Mesh3D mesh, Volume3DInt volume, java.lang.String method, InterfaceProgressBar progress_bar)
void
selectBoundaryNodes(Mesh3DInt mesh_int)
void
setAttribute(java.lang.String attrName, java.lang.Object newValue)
Sets a value for a specific attribute.void
setAttributes(AttributeList thisList)
Sets the list of attributes for this object.void
setName(java.lang.String name)
Sets the name for this object.void
SmoothEM(Mesh3DInt mesh)
void
SmoothLR(Mesh3D mesh)
void
smoothVertexValuesIsotropicGaussian(Mesh3DInt mesh_int, ProgressUpdater progress)
Uses the current parameters for "Smooth vertex values - Isotropic Gaussian" to smooth vertex values with a Gaussian kernel, isotropic in the plane of the surface mesh.void
splitRoiWithPlane(Mesh3DInt mesh_int, InterfaceProgressBar progress_bar)
Splits the ROI defined byroi_value
into two parts, on either side of the plane defined by the section set and section number.void
SubdivideButterflyScheme(Mesh3DInt mesh)
Calls the function SubdivideButterflyScheme in the MeshSubdivision function class, using parameters specified in the AttributeList "Butterfly Scheme".void
subdivideRois(Mesh3DInt mesh_int, InterfaceProgressBar progress_bar)
Subdivide the set of ROIs inmesh_int
, by iteratively splitting the largest ROI in half along its narrowest section.boolean
transformMesh(Mesh3D mesh, java.lang.String method, InterfaceProgressBar progress_bar)
boolean
translateMesh(Mesh3D mesh)
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Field Details
-
OPT_VOLUME_MEAN
public static final int OPT_VOLUME_MEAN- See Also:
- Constant Field Values
-
OPT_VOLUME_EXPD
public static final int OPT_VOLUME_EXPD- See Also:
- Constant Field Values
-
-
Constructor Details
-
MeshEngine
public MeshEngine()
-
-
Method Details
-
getAttributes
-
getAttributeValue
public java.lang.Object getAttributeValue(java.lang.String name)Description copied from interface:AttributeObject
Gets the value of attributename
, ornull
if it does not exist.- Specified by:
getAttributeValue
in interfaceAttributeObject
- Parameters:
name
- Name of the attribute- Returns:
- the value of attribute
name
, ornull
if it does not exist
-
getAttributes
Description copied from interface:Engine
Returns the attributes list corresponding to theoperation
andmethod
.- Specified by:
getAttributes
in interfaceEngine
- Returns:
- The corresponding attributes, or
null
if no such combination ofoperation
/method
exists.
-
getOperations
public java.util.ArrayList<java.lang.String> getOperations()Description copied from interface:Engine
Returns a list of the operations available for thisEngine
. Operations signify a general operation, which can be implemented through any number of "methods".- Specified by:
getOperations
in interfaceEngine
- Returns:
-
getMethods
public java.util.ArrayList<java.lang.String> getMethods(java.lang.String operation)Description copied from interface:Engine
Returns a list of methods implementing a particularoperation
.- Specified by:
getMethods
in interfaceEngine
- Returns:
-
callMethod
public boolean callMethod(java.lang.String operation, java.lang.String method, ProgressUpdater progress)Description copied from interface:Engine
Calls the specified operation/method pair. Returnstrue
if the operation was successful.- Specified by:
callMethod
in interfaceEngine
- Parameters:
operation
- Operation to perform.method
- Method with which to perform operation. Can benull
if this operation has no sub-methodsprogress
- Optional progress updater (can benull
)- Returns:
-
callMethod
public boolean callMethod(java.lang.String operation, java.lang.String method, java.util.ArrayList<?> params, ProgressUpdater progress)Description copied from interface:Engine
Calls the specified operation/method pair. Returnstrue
if the operation was successful.- Specified by:
callMethod
in interfaceEngine
- Parameters:
operation
- Operation to perform.method
- Method with which to perform operation. Can benull
if this operation has no sub-methodsparams
- A list of additional parameters (not in the attributes) for this methodprogress
- Optional progress updater (can benull
)- Returns:
-
doRoiOperation
public void doRoiOperation(Mesh3DInt mesh_int, java.lang.String method, InterfaceProgressBar progress_bar) throws MeshFunctionExceptionRuns the ROI operation specified bymethod
.- Parameters:
mesh_int
-method
-progress_bar
-- Throws:
MeshFunctionException
-
splitRoiWithPlane
public void splitRoiWithPlane(Mesh3DInt mesh_int, InterfaceProgressBar progress_bar) throws MeshFunctionExceptionSplits the ROI defined byroi_value
into two parts, on either side of the plane defined by the section set and section number.- Parameters:
mesh_int
-progress_bar
-- Throws:
MeshFunctionException
-
subdivideRois
public void subdivideRois(Mesh3DInt mesh_int, InterfaceProgressBar progress_bar) throws MeshFunctionExceptionSubdivide the set of ROIs inmesh_int
, by iteratively splitting the largest ROI in half along its narrowest section.- Parameters:
mesh_int
-progress_bar
-- Throws:
MeshFunctionException
-
SubdivideButterflyScheme
Calls the function SubdivideButterflyScheme in the MeshSubdivision function class, using parameters specified in the AttributeList "Butterfly Scheme".- Parameters:
mesh
- Mesh to subdividenewmesh
- Object to store subdivided mesh
-
decimate
-
computeMeanCurvature
Computes the vertex-wise mean curvature of this mesh and stores it in the "target_column" specified it the "Mean Curvature" attributes. The column will be created if it doesn't exist.- Parameters:
mesh3d
-progress
-- Returns:
-
selectBoundaryNodes
-
transformMesh
public boolean transformMesh(Mesh3D mesh, java.lang.String method, InterfaceProgressBar progress_bar) -
decimateSchroeder
-
DecimateByDistance
Calls the function DecimateByDistance in the MeshFunctions function class, using parameters specified in the AttributeList "Decimate By Distance"- Parameters:
mesh
- Mesh to decimatenewmesh
- Object to store subdivided mesh
-
mapVolumeToMesh
public java.util.ArrayList<MguiNumber> mapVolumeToMesh(Mesh3D mesh, Volume3DInt volume, java.lang.String method) -
mapVolumeToMesh
public java.util.ArrayList<MguiNumber> mapVolumeToMesh(Mesh3D mesh, Volume3DInt volume, java.lang.String method, InterfaceProgressBar progress_bar) -
mapMeshToVolume
public Volume3DInt mapMeshToVolume(Mesh3DInt mesh, Volume3DInt volume, java.lang.String method, InterfaceProgressBar progress_bar) -
mapMeshToVolumeGaussian
public Volume3DInt mapMeshToVolumeGaussian(Mesh3DInt mesh_int, Volume3DInt volume, InterfaceProgressBar progress_bar) -
getMeshParts
Creates new mesh objects as a set of non-contiguous meshes frommesh_int
, and adds these toshape_set
.- Parameters:
mesh
- Mesh from which to obtain partsnew_shape_set
- Shape set in which to store new mesh objects
-
getMeshParts
public void getMeshParts(Mesh3DInt mesh_int, ShapeSet3DInt shape_set, boolean copy_data, ProgressUpdater progress)Creates new mesh objects as a set of non-contiguous meshes frommesh_int
, and adds these toshape_set
.- Parameters:
mesh
- Mesh from which to obtain partsnew_shape_set
- Shape set in which to store new mesh objectsretain
- Whether to retain the original mesh objectcopy_data
- Whether to copy vertex data from the original mesh object
-
getSubMesh
public void getSubMesh(Mesh3DInt mesh, Mesh3DInt newmesh, java.util.ArrayList<MguiNumber> mask, int value, boolean retain, boolean copydata)- Parameters:
mesh
-newmesh
-mask
-value
-retain
-
-
getSubMesh
-
SmoothLR
-
SmoothEM
-
smoothVertexValuesIsotropicGaussian
public void smoothVertexValuesIsotropicGaussian(Mesh3DInt mesh_int, ProgressUpdater progress) throws MeshFunctionExceptionUses the current parameters for "Smooth vertex values - Isotropic Gaussian" to smooth vertex values with a Gaussian kernel, isotropic in the plane of the surface mesh.- Parameters:
mesh
-progress
-- Throws:
MeshFunctionException
-
inflateMesh
-
inflateTRP
-
translateMesh
-
getAttribute
Description copied from interface:AttributeObject
Returns a specific attribute for this object.- Specified by:
getAttribute
in interfaceAttributeObject
- Returns:
-
getAttributes
Description copied from interface:AttributeObject
Returns the list of current attributes for this object.- Specified by:
getAttributes
in interfaceAttributeObject
- Returns:
-
getName
public java.lang.String getName()Description copied from interface:NamedObject
Gets the name for this object.- Specified by:
getName
in interfaceNamedObject
- Returns:
-
setName
public void setName(java.lang.String name)Description copied from interface:NamedObject
Sets the name for this object.- Specified by:
setName
in interfaceNamedObject
-
setAttribute
public void setAttribute(java.lang.String attrName, java.lang.Object newValue)Description copied from interface:AttributeObject
Sets a value for a specific attribute.- Specified by:
setAttribute
in interfaceAttributeObject
-
setAttributes
Description copied from interface:AttributeObject
Sets the list of attributes for this object.- Specified by:
setAttributes
in interfaceAttributeObject
-