Package gov.nih.mipav.model.algorithms
Class AlgorithmExtractSurface
- java.lang.Object
-
- java.lang.Thread
-
- gov.nih.mipav.model.algorithms.AlgorithmBase
-
- gov.nih.mipav.model.algorithms.AlgorithmExtractSurface
-
- All Implemented Interfaces:
java.awt.event.ActionListener
,java.awt.event.WindowListener
,java.lang.Runnable
,java.util.EventListener
public class AlgorithmExtractSurface extends AlgorithmBase
Extracts a surface using Tetrahedron Extraction. Triangle decimation can be invoked to reduce triangle count. The decimation algorithm produces a continious level of detail (clod) structure that can be used to optimize the the visualization of the surface. The input to this algorithm is typically a mask image where 0 = background and 100 = object (i.e. interior to a VOI). The mask image is then blurred slightly and the level (50) is extracted. A greyscale image may also be input and a surface is extracted given a level. The steps are:- Build mask image of VOI (i.e. all point interior to VOI are set to 100. All points exterior are = 0.
- Blur mask image if not greyscale
- Extract level surface at 50 or user defined level
- Save surface ( ".sur")
- If decimate then decimate surface and save (".sur")
- Version:
- 0.1 June, 2001
- Author:
- Matthew J. McAuliffe, Ph.D., David H. Eberly, Ph.D. wrote all the extraction and decimation code found in the SurfaceExtraction, SurfaceDecimation and associated classes, with a little input from Matt with speed and memory optimizations
- See Also:
ModelSurfaceExtractor
,ModelSurfaceDecimator
-
-
Field Summary
Fields Modifier and Type Field Description private boolean
blurFlag
If true then the input image is blurred slightly.private float
blurSigma
The amount to blur to smooth surface.private boolean
decimateFlag
If true then the extracted surface is decimated into a continuous level of detail surface (clod).private float
level
Indicates level surface to be extracted.static int
LEVEL_MODE
Extract surface based on intensity level.static int
MASK_MODE
Extract surface from mask image.private ModelImage
maskImage
Mask image to extract surface from.private int
mode
Indicates mode - VOI, LEVELSET, or MASK.private float[]
surfaceArea
private java.lang.String
surfaceFileName
Path and name of extracted surface file. ".sur" will be appended if necessary.static int
VOI_MODE
Extract surface from VOI.-
Fields inherited from class gov.nih.mipav.model.algorithms.AlgorithmBase
destFlag, destImage, image25D, mask, maxProgressValue, minProgressValue, multiThreadingEnabled, nthreads, progress, progressModulus, progressStep, runningInSeparateThread, separable, srcImage, threadStopped
-
-
Constructor Summary
Constructors Constructor Description AlgorithmExtractSurface(ModelImage image, float level, int mode, boolean decFlag, boolean blurFlag, float sigma, java.lang.String fileName, float[] surfaceArea)
Creates a new AlgorithmExtractSurface object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description float
ComputeSurfaceArea(WildMagic.LibGraphics.SceneGraph.TriMesh m_kMesh)
Calculate the surface mesh area.private void
extractSurface()
Extracts a surface, in the form of triangles, from an image.void
finalize()
Prepares this class for destruction.private void
init()
DOCUMENT ME!void
runAlgorithm()
Starts the program.-
Methods inherited from class gov.nih.mipav.model.algorithms.AlgorithmBase
actionPerformed, addListener, addProgressChangeListener, calculateImageSize, calculatePrincipleAxis, computeElapsedTime, computeElapsedTime, convertIntoFloat, delinkProgressToAlgorithm, delinkProgressToAlgorithmMulti, displayError, errorCleanUp, fireProgressStateChanged, fireProgressStateChanged, fireProgressStateChanged, fireProgressStateChanged, fireProgressStateChanged, generateProgressValues, getDestImage, getElapsedTime, getMask, getMaxProgressValue, getMinProgressValue, getNumberOfThreads, getProgress, getProgressChangeListener, getProgressChangeListeners, getProgressModulus, getProgressStep, getProgressValues, getSrcImage, isCompleted, isImage25D, isMultiThreadingEnabled, isRunningInSeparateThread, isThreadStopped, linkProgressToAlgorithm, linkProgressToAlgorithm, makeProgress, notifyListeners, removeListener, removeProgressChangeListener, run, setCompleted, setImage25D, setMask, setMaxProgressValue, setMinProgressValue, setMultiThreadingEnabled, setNumberOfThreads, setProgress, setProgressModulus, setProgressStep, setProgressValues, setProgressValues, setRunningInSeparateThread, setSrcImage, setStartTime, setThreadStopped, startMethod, windowActivated, windowClosed, windowClosing, windowDeactivated, windowDeiconified, windowIconified, windowOpened
-
Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, suspend, toString, yield
-
-
-
-
Field Detail
-
VOI_MODE
public static final int VOI_MODE
Extract surface from VOI.- See Also:
- Constant Field Values
-
MASK_MODE
public static final int MASK_MODE
Extract surface from mask image.- See Also:
- Constant Field Values
-
LEVEL_MODE
public static final int LEVEL_MODE
Extract surface based on intensity level.- See Also:
- Constant Field Values
-
blurFlag
private final boolean blurFlag
If true then the input image is blurred slightly.
-
blurSigma
private float blurSigma
The amount to blur to smooth surface.
-
decimateFlag
private final boolean decimateFlag
If true then the extracted surface is decimated into a continuous level of detail surface (clod).
-
level
private final float level
Indicates level surface to be extracted.
-
maskImage
private ModelImage maskImage
Mask image to extract surface from.
-
mode
private final int mode
Indicates mode - VOI, LEVELSET, or MASK.
-
surfaceFileName
private java.lang.String surfaceFileName
Path and name of extracted surface file. ".sur" will be appended if necessary.
-
surfaceArea
private float[] surfaceArea
-
-
Constructor Detail
-
AlgorithmExtractSurface
public AlgorithmExtractSurface(ModelImage image, float level, int mode, boolean decFlag, boolean blurFlag, float sigma, java.lang.String fileName, float[] surfaceArea)
Creates a new AlgorithmExtractSurface object.- Parameters:
image
- mask image or grayscale where a level surface is to be extractedlevel
- indicates level surface to be extracedmode
- Indicates mode - VOI, LEVELSET, or MASK.decFlag
- indicates whether or not the decimation into a CLOD should take place.blurFlag
- if true then the input image is blurred slightlysigma
- the amount to blur the imagefileName
- path and name of extracted surface file. ".sur" will be appended if necessary.surfaceArea
- If not null the computed surface area will be returned
-
-
Method Detail
-
finalize
public void finalize()
Prepares this class for destruction.- Overrides:
finalize
in classAlgorithmBase
-
runAlgorithm
public void runAlgorithm()
Starts the program.- Specified by:
runAlgorithm
in classAlgorithmBase
-
extractSurface
private void extractSurface()
Extracts a surface, in the form of triangles, from an image.
-
init
private void init()
DOCUMENT ME!
-
ComputeSurfaceArea
public float ComputeSurfaceArea(WildMagic.LibGraphics.SceneGraph.TriMesh m_kMesh)
Calculate the surface mesh area. Each surface mesh is composed of triangles. Calculate the surface area from the summation of the each triangle area. Based on the Area by Stokes' Theorem. Area(S) = 1/2 * Normal dot ( Sum from i = 0 to n-1 of ( V1 cross V2) ) ==> Area(S) = 1/2 * ( Sum from i = 0 to n-1 of ( Normal dot ( V1 cross V2) ) )- Returns:
- float
-
-