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,ActionListener,FocusListener,ItemListener,WindowListener,ImageObserver,MenuContainer,Serializable,EventListener,Accessible,RootPaneContainer,WindowConstants
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:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) classImage attribute for AAM model.(package private) classImage model of AAM.(package private) classImage SVM model.(package private) classModel string struct.(package private) classSegmentation processing range(package private) classShape factor struct.(package private) classAAM model slice struct.Nested classes/interfaces inherited from class gov.nih.mipav.view.dialogs.JDialogBase
JDialogBase.CancelAction, JDialogBase.HelpAction, JDialogBase.OKActionNested classes/interfaces inherited from class javax.swing.JDialog
JDialog.AccessibleJDialogNested classes/interfaces inherited from class java.awt.Dialog
Dialog.AccessibleAWTDialog, Dialog.ModalExclusionType, Dialog.ModalityTypeNested classes/interfaces inherited from class java.awt.Window
Window.AccessibleAWTWindow, Window.TypeNested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainerNested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static intaxis oritentation.private intprivate JComboBoxaxis panel.private intprivate intprivate intcropped image boundary info.private intcropped image boundary info.private JButtonprivate JButtonprivate JPanelprivate JButtonprivate static final boolean[]VOI properties check list.private static intprivate ModelImageprivate intEnding slice check references for apex and base.private Vector<ModelImage> private Vector<JDialogAAMplusSVM.Range> private Features[]private FeaturesSVM[]private static final Stringprivate ModelImageprivate Hashtable<Integer, Vector<ModelImage>> private Hashtable<Integer, Vector<ModelImage>> private Hashtable<Integer, Vector<JDialogAAMplusSVM.ModelString>> private JPanelimage panel.private JLabelprivate JLabelTarget image directory.private JLabelkey image directory.private JLabelprivate JPanelVOI vector to fix the wrong segmentation contour after AAM segmentation.private C_AAMMODELAAM model reference.private JFileChooserkey images variables.private StringSVM model.SVM model vector.SVM model vector.private static intprivate ModelImageprivate static final longprivate Vector<JDialogAAMplusSVM.ShapeFactor> shape descriptor vector of VOI contours after AAM segmentation.SVM model vector after sorted by name.private intCurrent segmentation processing slice range, which is between silce 3 and 20.statistic data corresponding to marked VOI vector.private static final String[]MIPAV VOI properties parameters.private JFileChooserSVM model panel.private Stringprivate Stringprivate ModelImagetarget image references.private JFileChoosertarget image variables.private Stringprivate Stringprivate JTextFieldprivate JTextFieldprivate JTextFieldprivate ViewUserInterfaceThe main user interface.private VOIprivate VOIVectorprivate int[]private int[]private int[]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, voiManagerFields inherited from class javax.swing.JDialog
accessibleContext, rootPane, rootPaneCheckingEnabledFields inherited from class java.awt.Dialog
DEFAULT_MODALITY_TYPEFields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTFields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTHFields inherited from interface javax.swing.WindowConstants
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, EXIT_ON_CLOSE, HIDE_ON_CLOSE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAtlas based AAM segmentation.voidactionPerformed(ActionEvent event) actionPerformed handler.voidalgorithmPerformed(AlgorithmBase algorithm) Called after an algorithm this listener is registered to exits (maybe successfully, maybe not).static doublestatic intvoidboundaryFinding(ModelImage nonProstateImage, ModelImage boundaryImage, ModelImage targetImageSlice, int sliceNumber) Dynamic narrow band tracing algorithm.voidFrom the target 2D slice, compare it with end slices based atlas.voidCompute VOI shape descriptors.voidFirst time, the dialog is invoked, the init() method is called to create the GUI.voidCrop image for SVM classification.Crop target image for SVM classification.voidvoidDriver to do automatic prostate segmentation.voidEvaluate the AAM segmented VOIs with MIPAV VOI properties.private static voidexit_input_error(int line_num) private static voidexit_input_error(int line_num, Throwable cause) private voidfindBestImageNMI(int targetImageSliceNumber, int[] bestImageNumber, int[] bestSliceNumber) NMI searching between target image and AAM atlas.voidFix the error VOIs from the Marked VOI vector.getStatsData(Vector<VOIStatisticalProperties> statsList, VOIVector VOIs, ModelImage img) Generate the VOI statistics data.voidinit()GUI panel initialization.voidMark the error segmented VOIs.maskDisplay(int[] mask, int sliceNumber) Display binary mask images.voidAfter apply the AAM segmentation.static voidpause()Pauses the display until the user hits enter.private voidprocessDir(File dir, Vector<JDialogAAMplusSVM.ModelString> modelNameVector) Processing the AAM dir with AAM model string and pivot sample image name.private voidprocessingData(String modelDir) Process AAM model directory.private voidprocessingEndSliceData(String endSliceModelDir) Process the ending slice atlas directory.private voidRead the end slices and update the segmentation processing range.private voidRead the ending slice index to guide the segmentation towards apex and base.voidRead target imageprivate voidRead AAM model atlas.private voidRead SVM model atlas.private voidRead the AAM model.private voidRead SVM model atlas.private voidRead target image.voidWe 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.voidsmoothVOI30(ModelImage maskImage, ModelImage resultImage) Smooth VOI with 30 points.private voidsort SVM model with names.private voidsvmTraverseDir(File dir) Processing SVM model atlas.voidBSpline to smooth the final segmented VOIs.private voidRecursively read AAM dir, and update the AAM model structure.voidupdateResultImage(int sliceNumber, ModelImage targetImageSlice) After the target image with final segmented VOI.voidupdateTargetImage(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, windowOpenedMethods 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, updateMethods inherited from class java.awt.Dialog
addNotify, getModalityType, getTitle, hide, isModal, isResizable, isUndecorated, setBackground, setModal, setModalityType, setOpacity, setResizable, setShape, setTitle, setUndecorated, show, toBackMethods 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, toFrontMethods 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, validateTreeMethods 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 Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
featureArray
-
featureArraySVM
-
UI
The main user interface. -
model
AAM model reference. -
labelModel
key image directory. -
textFieldModel
-
buttonModel
-
labelImageTarget
Target image directory. -
textFieldImageTarget
-
buttonImageTarget
-
imageSelectionPanel
image panel. -
buttonPanel
-
modelChooser
key images variables. -
modelDirectory
-
targetImageChooser
target image variables. -
targetImageName
-
targetImageDirectory
-
targetImage
target image references. -
cropTargetImage
-
boxYmin
private int boxYmincropped image boundary info. -
boxYmax
private int boxYmaxcropped image boundary info. -
boxXmin
private int boxXmin -
boxXmax
private int boxXmax -
xBounds
private int[] xBounds -
yBounds
private int[] yBounds -
zBounds
private int[] zBounds -
axisList
axis panel. -
labelAxis
-
Axial
private static int Axialaxis oritentation. -
Saggital
private static int Saggital -
Coronal
private static int Coronal -
axis
private int axis -
sampleImage
-
groupTable
-
groupRefImages
-
groupCropImages
-
svmModelChooser
SVM model panel. -
svmModelName
-
svmModelDirectory
-
labelSVMModel
-
textFieldSVMModel
-
buttonSVMModel
-
modelStructure
SVM model vector. -
sortModelStructure
SVM model vector after sorted by name. -
models
SVM model. -
modelsSVM
SVM model vector. -
finalImage
-
voiVectorNewFinal
-
voiNewFinal
-
markedVOI
VOI vector to fix the wrong segmentation contour after AAM segmentation. -
shapeDescriptor
shape descriptor vector of VOI contours after AAM segmentation. -
statData
statistic data corresponding to marked VOI vector. -
statsToCalculate
MIPAV VOI properties parameters. -
mainPanel
-
featureDirName
- See Also:
-
startSlice
private int startSliceCurrent 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[] checkListVOI properties check list. -
endSliceImageNames
Ending slice check references for apex and base. -
endSliceRangeNames
-
endSliceImages
-
endSliceRange
-
-
Constructor Details
-
JDialogAAMplusSVM
Constructor- Parameters:
theParentFrame- parent frame reference.
-
-
Method Details
-
algorithmPerformed
Description copied from interface:AlgorithmInterfaceCalled 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:
algorithmPerformedin interfaceAlgorithmInterface- Parameters:
algorithm- the algorithm which has just completed
-
actionPerformed
actionPerformed handler.- Specified by:
actionPerformedin interfaceActionListener- Overrides:
actionPerformedin 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 Vector<Vector<String>> getStatsData(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
-
exit_input_error
private static void exit_input_error(int line_num) -
atof
-
atoi
- Parameters:
s- the string to parse for the integer value- Throws:
IllegalArgumentException- if s is emptyNumberFormatException- 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
Smooth VOI with 30 points.- Parameters:
maskImage- mask image with VOIresultImage- resulting image to hold the smoothed VOI.
-
maskDisplay
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
Crop target image for SVM classification.- Returns:
-
updateResultImage
After the target image with final segmented VOI.- Parameters:
sliceNumber-targetImageSlice-
-
updateTargetImage
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
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
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
Process AAM model directory.- Parameters:
modelDir-
-
traverse
Recursively read AAM dir, and update the AAM model structure.- Parameters:
dir-
-
processDir
Processing the AAM dir with AAM model string and pivot sample image name.- Parameters:
dir-modelNameVector-
-
disposeLocal
public void disposeLocal()
-