Class JDialogAAMplusSVM
- java.lang.Object
-
- java.awt.Component
-
- java.awt.Container
-
- java.awt.Window
-
- java.awt.Dialog
-
- javax.swing.JDialog
-
- gov.nih.mipav.view.dialogs.JDialogBase
-
- gov.nih.mipav.view.renderer.WildMagic.ProstateFramework.JDialogAAMplusSVM
-
- All Implemented Interfaces:
AlgorithmInterface
,DialogDefaultsInterface
,java.awt.event.ActionListener
,java.awt.event.FocusListener
,java.awt.event.ItemListener
,java.awt.event.WindowListener
,java.awt.image.ImageObserver
,java.awt.MenuContainer
,java.io.Serializable
,java.util.EventListener
,javax.accessibility.Accessible
,javax.swing.RootPaneContainer
,javax.swing.WindowConstants
public class JDialogAAMplusSVM extends JDialogBase implements AlgorithmInterface
This class is the combined Atlas based AAM and SVM model to automatically segment the MRI prostate. Atlas based AAM model initializes the coarser level VOI contour, then atlas based SVM model refines the prostate boundary. With the new image ( target image ), the AAM model try different pose configurations ( scale, translation, rotation, etc ) to find the closest VOI contour. This contour is the initialization contour to the SVM model. The SVM model generate the non-prostate regions and prostate boundary binary mask images. By copying the initial contour to non-prostate and prostate boundary images, and Coherence Enhanced Diffusion (CED) image, a dynamic narrow band tracing algorithm stretches the initial contour toward the correct prostate boundary based on a voting mechanism from the three images.- Author:
- Ruida Cheng
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) class
JDialogAAMplusSVM.ImageAttribute
Image attribute for AAM model.(package private) class
JDialogAAMplusSVM.ImageModel
Image model of AAM.(package private) class
JDialogAAMplusSVM.ImageModelSVM
Image SVM model.(package private) class
JDialogAAMplusSVM.ModelString
Model string struct.(package private) class
JDialogAAMplusSVM.Range
Segmentation processing range(package private) class
JDialogAAMplusSVM.ShapeFactor
Shape factor struct.(package private) class
JDialogAAMplusSVM.SliceSetString
AAM model slice struct.-
Nested classes/interfaces inherited from class gov.nih.mipav.view.dialogs.JDialogBase
JDialogBase.CancelAction, JDialogBase.HelpAction, JDialogBase.OKAction
-
Nested classes/interfaces inherited from class javax.swing.JDialog
javax.swing.JDialog.AccessibleJDialog
-
Nested classes/interfaces inherited from class java.awt.Dialog
java.awt.Dialog.AccessibleAWTDialog, java.awt.Dialog.ModalExclusionType, java.awt.Dialog.ModalityType
-
Nested classes/interfaces inherited from class java.awt.Window
java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
-
-
Field Summary
Fields Modifier and Type Field Description private static int
Axial
axis oritentation.private int
axis
private javax.swing.JComboBox
axisList
axis panel.private int
boxXmax
private int
boxXmin
private int
boxYmax
cropped image boundary info.private int
boxYmin
cropped image boundary info.private javax.swing.JButton
buttonImageTarget
private javax.swing.JButton
buttonModel
private javax.swing.JPanel
buttonPanel
private javax.swing.JButton
buttonSVMModel
private static boolean[]
checkList
VOI properties check list.private static int
Coronal
private ModelImage
cropTargetImage
private int
endSlice
private java.util.Vector<java.lang.String>
endSliceImageNames
Ending slice check references for apex and base.private java.util.Vector<ModelImage>
endSliceImages
private java.util.Vector<JDialogAAMplusSVM.Range>
endSliceRange
private java.util.Vector<java.lang.String>
endSliceRangeNames
private Features[]
featureArray
private FeaturesSVM[]
featureArraySVM
private static java.lang.String
featureDirName
private ModelImage
finalImage
private java.util.Hashtable<java.lang.Integer,java.util.Vector<ModelImage>>
groupCropImages
private java.util.Hashtable<java.lang.Integer,java.util.Vector<ModelImage>>
groupRefImages
private java.util.Hashtable<java.lang.Integer,java.util.Vector<JDialogAAMplusSVM.ModelString>>
groupTable
private javax.swing.JPanel
imageSelectionPanel
image panel.private javax.swing.JLabel
labelAxis
private javax.swing.JLabel
labelImageTarget
Target image directory.private javax.swing.JLabel
labelModel
key image directory.private javax.swing.JLabel
labelSVMModel
private javax.swing.JPanel
mainPanel
private java.util.Hashtable<java.lang.Integer,java.lang.Integer>
markedVOI
VOI vector to fix the wrong segmentation contour after AAM segmentation.private C_AAMMODEL
model
AAM model reference.private javax.swing.JFileChooser
modelChooser
key images variables.private java.lang.String
modelDirectory
private java.util.Hashtable<java.lang.Integer,java.util.Hashtable<java.lang.Integer,JDialogAAMplusSVM.ImageModel>>
models
SVM model.private java.util.Hashtable<java.lang.Integer,java.util.Hashtable<java.lang.Integer,JDialogAAMplusSVM.ImageModelSVM>>
modelsSVM
SVM model vector.private java.util.Hashtable<java.lang.String,java.util.Hashtable<java.lang.String,JDialogAAMplusSVM.ImageAttribute>>
modelStructure
SVM model vector.private static int
Saggital
private ModelImage
sampleImage
private static long
serialVersionUID
private java.util.Vector<JDialogAAMplusSVM.ShapeFactor>
shapeDescriptor
shape descriptor vector of VOI contours after AAM segmentation.private java.util.Hashtable<java.lang.Integer,java.util.Hashtable<java.lang.String,JDialogAAMplusSVM.ImageAttribute>>
sortModelStructure
SVM model vector after sorted by name.private int
startSlice
Current segmentation processing slice range, which is between silce 3 and 20.private java.util.Vector<java.util.Vector<java.lang.Float>>
statData
statistic data corresponding to marked VOI vector.private static java.lang.String[]
statsToCalculate
MIPAV VOI properties parameters.private javax.swing.JFileChooser
svmModelChooser
SVM model panel.private java.lang.String
svmModelDirectory
private java.lang.String
svmModelName
private ModelImage
targetImage
target image references.private javax.swing.JFileChooser
targetImageChooser
target image variables.private java.lang.String
targetImageDirectory
private java.lang.String
targetImageName
private javax.swing.JTextField
textFieldImageTarget
private javax.swing.JTextField
textFieldModel
private javax.swing.JTextField
textFieldSVMModel
private ViewUserInterface
UI
The main user interface.private VOI
voiNewFinal
private VOIVector
voiVectorNewFinal
private int[]
xBounds
private int[]
yBounds
private int[]
zBounds
-
Fields inherited from class gov.nih.mipav.view.dialogs.JDialogBase
applyButton, bar, cancelButton, cancelFlag, closeButton, HELP, helpButton, mainDialogPanel, NEW, OKButton, parentFrame, progressBar, REPLACE, runInSeparateThread, runningScriptFlag, runQuiet, serif12, serif12B, voiManager
-
Fields inherited from class javax.swing.JDialog
accessibleContext, rootPane, rootPaneCheckingEnabled
-
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
-
-
Constructor Summary
Constructors Constructor Description JDialogAAMplusSVM(java.awt.Frame theParentFrame)
Constructor
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
AAMinitialization()
Atlas based AAM segmentation.void
actionPerformed(java.awt.event.ActionEvent event)
actionPerformed handler.void
algorithmPerformed(AlgorithmBase algorithm)
Called after an algorithm this listener is registered to exits (maybe successfully, maybe not).static double
atof(java.lang.String s)
static int
atoi(java.lang.String s)
void
boundaryFinding(ModelImage nonProstateImage, ModelImage boundaryImage, ModelImage targetImageSlice, int sliceNumber)
Dynamic narrow band tracing algorithm.void
checkEndSlices()
From the target 2D slice, compare it with end slices based atlas.void
computeShapeDescriptor()
Compute VOI shape descriptors.void
createTargetDialog()
First time, the dialog is invoked, the init() method is called to create the GUI.void
cropImage()
Crop image for SVM classification.ModelImage
cropTargetImage()
Crop target image for SVM classification.void
disposeLocal()
void
doSegmentation()
Driver to do automatic prostate segmentation.void
evaluateShapeDescriptor()
Evaluate the AAM segmented VOIs with MIPAV VOI properties.private static void
exit_input_error(int line_num)
private static void
exit_input_error(int line_num, java.lang.Throwable cause)
private void
findBestImageNMI(int targetImageSliceNumber, int[] bestImageNumber, int[] bestSliceNumber)
NMI searching between target image and AAM atlas.void
fixErrorVOI()
Fix the error VOIs from the Marked VOI vector.private java.util.Vector<java.util.Vector<java.lang.String>>
getStatsData(java.util.Vector<VOIStatisticalProperties> statsList, VOIVector VOIs, ModelImage img)
Generate the VOI statistics data.void
init()
GUI panel initialization.void
markErrorOne()
Mark the error segmented VOIs.ModelImage
maskDisplay(int[] mask, int sliceNumber)
Display binary mask images.void
mergedClassifier()
After apply the AAM segmentation.static void
pause()
Pauses the display until the user hits enter.private void
processDir(java.io.File dir, java.util.Vector<JDialogAAMplusSVM.ModelString> modelNameVector)
Processing the AAM dir with AAM model string and pivot sample image name.private void
processingData(java.lang.String modelDir)
Process AAM model directory.private void
processingEndSliceData(java.lang.String endSliceModelDir)
Process the ending slice atlas directory.private void
readEndingSlice()
Read the end slices and update the segmentation processing range.private void
readEndingSlicesDir()
Read the ending slice index to guide the segmentation towards apex and base.void
readImagesAndVOIs()
Read target imageprivate void
readKeyImageDir()
Read AAM model atlas.private void
readModels()
Read SVM model atlas.private void
readSampleImages()
Read the AAM model.private void
readSVMModelDir()
Read SVM model atlas.private void
readTargetImage()
Read target image.void
readTargetImageFeature()
We pre-processing target image with coherence enhance diffusion (CED) filter, then extract SVM features from it and save it to the corresponding target image directory.void
smoothVOI30(ModelImage maskImage, ModelImage resultImage)
Smooth VOI with 30 points.private void
svmSortModelStructure()
sort SVM model with names.private void
svmTraverseDir(java.io.File dir)
Processing SVM model atlas.void
transformVOIAAM()
BSpline to smooth the final segmented VOIs.private void
traverse(java.io.File dir)
Recursively read AAM dir, and update the AAM model structure.void
updateResultImage(int sliceNumber, ModelImage targetImageSlice)
After the target image with final segmented VOI.void
updateTargetImage(int sliceNumber, ModelImage targetImageSlice)
Copy the 2D slice segmented VOI to target image silce.-
Methods inherited from class gov.nih.mipav.view.dialogs.JDialogBase
buildApplyButton, buildButtons, buildCancelButton, buildCancelButton, buildCloseButton, buildHelpButton, buildImageComboBox, buildOKButton, buildOKButton, buildOKCancelButtons, buildTitledBorder, buildTitledBorder, createLabel, createProgressBar, createProgressBar, createTextField, focusGained, focusLost, getDialogName, isCancelled, isQuietRunning, isRunInSeparateThread, isScriptRunning, itemStateChanged, loadDefaults, loadDefaults, makeImageName, makeString, openNewFrame, saveDefaults, saveDefaults, setLeftHandSystem, setQuietRunning, setScriptRunning, setSeparateThread, setVisible, setVisible, setVisibleMenuBar, setVisibleStandard, setVOIManager, setWCSystem, testParameter, testParameterMin, updateFFTFileInfo, updateFileInfo, updateFileInfoOtherModality, updateFileInfoStatic, updateFileInfoStatic, updateFileTypeInfo, updateFileTypeInfo, windowActivated, windowClosed, windowClosing, windowDeactivated, windowDeiconified, windowIconified, windowOpened
-
Methods inherited from class javax.swing.JDialog
addImpl, createRootPane, dialogInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
-
Methods inherited from class java.awt.Dialog
addNotify, getModalityType, getTitle, hide, isModal, isResizable, isUndecorated, setBackground, setModal, setModalityType, setOpacity, setResizable, setShape, setTitle, setUndecorated, show, toBack
-
Methods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeNotify, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImage, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, toFront
-
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
-
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setMixingCutoutShape, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
featureArray
private Features[] featureArray
-
featureArraySVM
private FeaturesSVM[] featureArraySVM
-
UI
private ViewUserInterface UI
The main user interface.
-
model
private C_AAMMODEL model
AAM model reference.
-
labelModel
private javax.swing.JLabel labelModel
key image directory.
-
textFieldModel
private javax.swing.JTextField textFieldModel
-
buttonModel
private javax.swing.JButton buttonModel
-
labelImageTarget
private javax.swing.JLabel labelImageTarget
Target image directory.
-
textFieldImageTarget
private javax.swing.JTextField textFieldImageTarget
-
buttonImageTarget
private javax.swing.JButton buttonImageTarget
-
imageSelectionPanel
private javax.swing.JPanel imageSelectionPanel
image panel.
-
buttonPanel
private javax.swing.JPanel buttonPanel
-
modelChooser
private javax.swing.JFileChooser modelChooser
key images variables.
-
modelDirectory
private java.lang.String modelDirectory
-
targetImageChooser
private javax.swing.JFileChooser targetImageChooser
target image variables.
-
targetImageName
private java.lang.String targetImageName
-
targetImageDirectory
private java.lang.String targetImageDirectory
-
targetImage
private ModelImage targetImage
target image references.
-
cropTargetImage
private ModelImage cropTargetImage
-
boxYmin
private int boxYmin
cropped image boundary info.
-
boxYmax
private int boxYmax
cropped image boundary info.
-
boxXmin
private int boxXmin
-
boxXmax
private int boxXmax
-
xBounds
private int[] xBounds
-
yBounds
private int[] yBounds
-
zBounds
private int[] zBounds
-
axisList
private javax.swing.JComboBox axisList
axis panel.
-
labelAxis
private javax.swing.JLabel labelAxis
-
Axial
private static int Axial
axis oritentation.
-
Saggital
private static int Saggital
-
Coronal
private static int Coronal
-
axis
private int axis
-
sampleImage
private ModelImage sampleImage
-
groupTable
private java.util.Hashtable<java.lang.Integer,java.util.Vector<JDialogAAMplusSVM.ModelString>> groupTable
-
groupRefImages
private java.util.Hashtable<java.lang.Integer,java.util.Vector<ModelImage>> groupRefImages
-
groupCropImages
private java.util.Hashtable<java.lang.Integer,java.util.Vector<ModelImage>> groupCropImages
-
svmModelChooser
private javax.swing.JFileChooser svmModelChooser
SVM model panel.
-
svmModelName
private java.lang.String svmModelName
-
svmModelDirectory
private java.lang.String svmModelDirectory
-
labelSVMModel
private javax.swing.JLabel labelSVMModel
-
textFieldSVMModel
private javax.swing.JTextField textFieldSVMModel
-
buttonSVMModel
private javax.swing.JButton buttonSVMModel
-
modelStructure
private java.util.Hashtable<java.lang.String,java.util.Hashtable<java.lang.String,JDialogAAMplusSVM.ImageAttribute>> modelStructure
SVM model vector.
-
sortModelStructure
private java.util.Hashtable<java.lang.Integer,java.util.Hashtable<java.lang.String,JDialogAAMplusSVM.ImageAttribute>> sortModelStructure
SVM model vector after sorted by name.
-
models
private java.util.Hashtable<java.lang.Integer,java.util.Hashtable<java.lang.Integer,JDialogAAMplusSVM.ImageModel>> models
SVM model.
-
modelsSVM
private java.util.Hashtable<java.lang.Integer,java.util.Hashtable<java.lang.Integer,JDialogAAMplusSVM.ImageModelSVM>> modelsSVM
SVM model vector.
-
finalImage
private ModelImage finalImage
-
voiVectorNewFinal
private VOIVector voiVectorNewFinal
-
voiNewFinal
private VOI voiNewFinal
-
markedVOI
private java.util.Hashtable<java.lang.Integer,java.lang.Integer> markedVOI
VOI vector to fix the wrong segmentation contour after AAM segmentation.
-
shapeDescriptor
private java.util.Vector<JDialogAAMplusSVM.ShapeFactor> shapeDescriptor
shape descriptor vector of VOI contours after AAM segmentation.
-
statData
private java.util.Vector<java.util.Vector<java.lang.Float>> statData
statistic data corresponding to marked VOI vector.
-
statsToCalculate
private static final java.lang.String[] statsToCalculate
MIPAV VOI properties parameters.
-
mainPanel
private javax.swing.JPanel mainPanel
-
featureDirName
private static final java.lang.String featureDirName
- See Also:
- Constant Field Values
-
startSlice
private int startSlice
Current segmentation processing slice range, which is between silce 3 and 20. This constraint is imposed by the SVM training model. Due to the manual drawing the non-prostate regions for SVM training, the human guided training process is time consuming. Currently, we only train the SVM models from slice 3 to slice 20. Later, if we have time, we will apply to more slices.
-
endSlice
private int endSlice
-
checkList
private static final boolean[] checkList
VOI properties check list.
-
endSliceImageNames
private java.util.Vector<java.lang.String> endSliceImageNames
Ending slice check references for apex and base.
-
endSliceRangeNames
private java.util.Vector<java.lang.String> endSliceRangeNames
-
endSliceImages
private java.util.Vector<ModelImage> endSliceImages
-
endSliceRange
private java.util.Vector<JDialogAAMplusSVM.Range> endSliceRange
-
-
Method Detail
-
algorithmPerformed
public void algorithmPerformed(AlgorithmBase algorithm)
Description copied from interface:AlgorithmInterface
Called after an algorithm this listener is registered to exits (maybe successfully, maybe not). If the algorithm is run in a separate thread, this call will be made within that thread. If not, this call will be made from that same, shared thread.- Specified by:
algorithmPerformed
in interfaceAlgorithmInterface
- Parameters:
algorithm
- the algorithm which has just completed
-
actionPerformed
public void actionPerformed(java.awt.event.ActionEvent event)
actionPerformed handler.- Specified by:
actionPerformed
in interfacejava.awt.event.ActionListener
- Overrides:
actionPerformed
in classJDialogBase
-
init
public void init()
GUI panel initialization.
-
createTargetDialog
public void createTargetDialog()
First time, the dialog is invoked, the init() method is called to create the GUI. Afterward, when the dialog is invoked again, this method is called, which save the Atlas AAM model and SVM model loading process.
-
doSegmentation
public void doSegmentation()
Driver to do automatic prostate segmentation.
-
checkEndSlices
public void checkEndSlices()
From the target 2D slice, compare it with end slices based atlas. Find the closed 2D slice image, and invoke the corresponding start and ending VOI index. This step is important, which eliminates the segmentation error toward apex and base to certain extents. There are still changes that apex and base ending index miss interpolated, resulting in the wrong segmentation. We need to improve this later.
-
evaluateShapeDescriptor
public void evaluateShapeDescriptor()
Evaluate the AAM segmented VOIs with MIPAV VOI properties.
-
getStatsData
private java.util.Vector<java.util.Vector<java.lang.String>> getStatsData(java.util.Vector<VOIStatisticalProperties> statsList, VOIVector VOIs, ModelImage img)
Generate the VOI statistics data.- Parameters:
statsList
-VOIs
-img
-- Returns:
-
computeShapeDescriptor
public void computeShapeDescriptor()
Compute VOI shape descriptors.
-
markErrorOne
public void markErrorOne()
Mark the error segmented VOIs.
-
transformVOIAAM
public void transformVOIAAM()
BSpline to smooth the final segmented VOIs.
-
fixErrorVOI
public void fixErrorVOI()
Fix the error VOIs from the Marked VOI vector.
-
AAMinitialization
public void AAMinitialization()
Atlas based AAM segmentation.
-
cropImage
public void cropImage()
Crop image for SVM classification.
-
readTargetImageFeature
public void readTargetImageFeature()
We pre-processing target image with coherence enhance diffusion (CED) filter, then extract SVM features from it and save it to the corresponding target image directory. Before apply the automatic segmentation, this method load the pre-processing CED SVM features by default. If we do CED filter and SVM feature extraction in the segmentation process, it will take much, much longer time to process the segmentation.
-
readModels
private void readModels()
Read SVM model atlas.
-
exit_input_error
private static void exit_input_error(int line_num, java.lang.Throwable cause)
-
exit_input_error
private static void exit_input_error(int line_num)
-
atof
public static double atof(java.lang.String s)
-
atoi
public static int atoi(java.lang.String s) throws java.lang.NumberFormatException
- Parameters:
s
- the string to parse for the integer value- Throws:
java.lang.IllegalArgumentException
- if s is emptyjava.lang.NumberFormatException
- seeInteger.parseInt(String)
-
mergedClassifier
public void mergedClassifier()
After apply the AAM segmentation. We copy the resulting contour to SVM generated non-prostate binary mask image, prostate boundary image, and corresponding CED image. This method uses atlas SVM model to generate the binary maske image, and call a dynamic narrow band tracking algorithm to refine the final prostate boundary.
-
boundaryFinding
public void boundaryFinding(ModelImage nonProstateImage, ModelImage boundaryImage, ModelImage targetImageSlice, int sliceNumber)
Dynamic narrow band tracing algorithm. Based on the target CED image, non-prostate binary mask image and prostate boundary mask image, the algorithm stretches the AAM initialization contour, and generate the final prostate contour.- Parameters:
nonProstateImage
- non-prostate binary mask imageboundaryImage
- prostate boundary mask image.targetImageSlice
- target CED imagesliceNumber
- current processing slice number.
-
smoothVOI30
public void smoothVOI30(ModelImage maskImage, ModelImage resultImage)
Smooth VOI with 30 points.- Parameters:
maskImage
- mask image with VOIresultImage
- resulting image to hold the smoothed VOI.
-
maskDisplay
public ModelImage maskDisplay(int[] mask, int sliceNumber)
Display binary mask images. Debugging purpose.- Parameters:
mask
-sliceNumber
-- Returns:
-
findBestImageNMI
private void findBestImageNMI(int targetImageSliceNumber, int[] bestImageNumber, int[] bestSliceNumber)
NMI searching between target image and AAM atlas.- Parameters:
targetImageSliceNumber
- target 2D slice numberbestImageNumber
- best matched image numberbestSliceNumber
- best matched slice number.
-
cropTargetImage
public ModelImage cropTargetImage()
Crop target image for SVM classification.- Returns:
-
updateResultImage
public void updateResultImage(int sliceNumber, ModelImage targetImageSlice)
After the target image with final segmented VOI.- Parameters:
sliceNumber
-targetImageSlice
-
-
updateTargetImage
public void updateTargetImage(int sliceNumber, ModelImage targetImageSlice)
Copy the 2D slice segmented VOI to target image silce.- Parameters:
sliceNumber
- corresponding slice numbertargetImageSlice
- target slice number.
-
pause
public static void pause()
Pauses the display until the user hits enter.
-
readImagesAndVOIs
public void readImagesAndVOIs()
Read target image
-
readSVMModelDir
private void readSVMModelDir()
Read SVM model atlas.
-
svmTraverseDir
private void svmTraverseDir(java.io.File dir)
Processing SVM model atlas.- Parameters:
dir
-
-
svmSortModelStructure
private void svmSortModelStructure()
sort SVM model with names.
-
readTargetImage
private void readTargetImage()
Read target image.
-
readEndingSlicesDir
private void readEndingSlicesDir()
Read the ending slice index to guide the segmentation towards apex and base.
-
processingEndSliceData
private void processingEndSliceData(java.lang.String endSliceModelDir)
Process the ending slice atlas directory.- Parameters:
endSliceModelDir
- atlas directory.
-
readKeyImageDir
private void readKeyImageDir()
Read AAM model atlas.
-
readEndingSlice
private void readEndingSlice()
Read the end slices and update the segmentation processing range.
-
readSampleImages
private void readSampleImages()
Read the AAM model.
-
processingData
private void processingData(java.lang.String modelDir)
Process AAM model directory.- Parameters:
modelDir
-
-
traverse
private void traverse(java.io.File dir)
Recursively read AAM dir, and update the AAM model structure.- Parameters:
dir
-
-
processDir
private void processDir(java.io.File dir, java.util.Vector<JDialogAAMplusSVM.ModelString> modelNameVector)
Processing the AAM dir with AAM model string and pivot sample image name.- Parameters:
dir
-modelNameVector
-
-
disposeLocal
public void disposeLocal()
-
-