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) classJDialogAAMplusSVM.ImageAttributeImage attribute for AAM model.(package private) classJDialogAAMplusSVM.ImageModelImage model of AAM.(package private) classJDialogAAMplusSVM.ImageModelSVMImage SVM model.(package private) classJDialogAAMplusSVM.ModelStringModel string struct.(package private) classJDialogAAMplusSVM.RangeSegmentation processing range(package private) classJDialogAAMplusSVM.ShapeFactorShape factor struct.(package private) classJDialogAAMplusSVM.SliceSetStringAAM 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 intAxialaxis oritentation.private intaxisprivate javax.swing.JComboBoxaxisListaxis panel.private intboxXmaxprivate intboxXminprivate intboxYmaxcropped image boundary info.private intboxYmincropped image boundary info.private javax.swing.JButtonbuttonImageTargetprivate javax.swing.JButtonbuttonModelprivate javax.swing.JPanelbuttonPanelprivate javax.swing.JButtonbuttonSVMModelprivate static boolean[]checkListVOI properties check list.private static intCoronalprivate ModelImagecropTargetImageprivate intendSliceprivate java.util.Vector<java.lang.String>endSliceImageNamesEnding slice check references for apex and base.private java.util.Vector<ModelImage>endSliceImagesprivate java.util.Vector<JDialogAAMplusSVM.Range>endSliceRangeprivate java.util.Vector<java.lang.String>endSliceRangeNamesprivate Features[]featureArrayprivate FeaturesSVM[]featureArraySVMprivate static java.lang.StringfeatureDirNameprivate ModelImagefinalImageprivate java.util.Hashtable<java.lang.Integer,java.util.Vector<ModelImage>>groupCropImagesprivate java.util.Hashtable<java.lang.Integer,java.util.Vector<ModelImage>>groupRefImagesprivate java.util.Hashtable<java.lang.Integer,java.util.Vector<JDialogAAMplusSVM.ModelString>>groupTableprivate javax.swing.JPanelimageSelectionPanelimage panel.private javax.swing.JLabellabelAxisprivate javax.swing.JLabellabelImageTargetTarget image directory.private javax.swing.JLabellabelModelkey image directory.private javax.swing.JLabellabelSVMModelprivate javax.swing.JPanelmainPanelprivate java.util.Hashtable<java.lang.Integer,java.lang.Integer>markedVOIVOI vector to fix the wrong segmentation contour after AAM segmentation.private C_AAMMODELmodelAAM model reference.private javax.swing.JFileChoosermodelChooserkey images variables.private java.lang.StringmodelDirectoryprivate java.util.Hashtable<java.lang.Integer,java.util.Hashtable<java.lang.Integer,JDialogAAMplusSVM.ImageModel>>modelsSVM model.private java.util.Hashtable<java.lang.Integer,java.util.Hashtable<java.lang.Integer,JDialogAAMplusSVM.ImageModelSVM>>modelsSVMSVM model vector.private java.util.Hashtable<java.lang.String,java.util.Hashtable<java.lang.String,JDialogAAMplusSVM.ImageAttribute>>modelStructureSVM model vector.private static intSaggitalprivate ModelImagesampleImageprivate static longserialVersionUIDprivate java.util.Vector<JDialogAAMplusSVM.ShapeFactor>shapeDescriptorshape descriptor vector of VOI contours after AAM segmentation.private java.util.Hashtable<java.lang.Integer,java.util.Hashtable<java.lang.String,JDialogAAMplusSVM.ImageAttribute>>sortModelStructureSVM model vector after sorted by name.private intstartSliceCurrent segmentation processing slice range, which is between silce 3 and 20.private java.util.Vector<java.util.Vector<java.lang.Float>>statDatastatistic data corresponding to marked VOI vector.private static java.lang.String[]statsToCalculateMIPAV VOI properties parameters.private javax.swing.JFileChoosersvmModelChooserSVM model panel.private java.lang.StringsvmModelDirectoryprivate java.lang.StringsvmModelNameprivate ModelImagetargetImagetarget image references.private javax.swing.JFileChoosertargetImageChoosertarget image variables.private java.lang.StringtargetImageDirectoryprivate java.lang.StringtargetImageNameprivate javax.swing.JTextFieldtextFieldImageTargetprivate javax.swing.JTextFieldtextFieldModelprivate javax.swing.JTextFieldtextFieldSVMModelprivate ViewUserInterfaceUIThe main user interface.private VOIvoiNewFinalprivate VOIVectorvoiVectorNewFinalprivate int[]xBoundsprivate int[]yBoundsprivate 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 voidAAMinitialization()Atlas based AAM segmentation.voidactionPerformed(java.awt.event.ActionEvent event)actionPerformed handler.voidalgorithmPerformed(AlgorithmBase algorithm)Called after an algorithm this listener is registered to exits (maybe successfully, maybe not).static doubleatof(java.lang.String s)static intatoi(java.lang.String s)voidboundaryFinding(ModelImage nonProstateImage, ModelImage boundaryImage, ModelImage targetImageSlice, int sliceNumber)Dynamic narrow band tracing algorithm.voidcheckEndSlices()From the target 2D slice, compare it with end slices based atlas.voidcomputeShapeDescriptor()Compute VOI shape descriptors.voidcreateTargetDialog()First time, the dialog is invoked, the init() method is called to create the GUI.voidcropImage()Crop image for SVM classification.ModelImagecropTargetImage()Crop target image for SVM classification.voiddisposeLocal()voiddoSegmentation()Driver to do automatic prostate segmentation.voidevaluateShapeDescriptor()Evaluate the AAM segmented VOIs with MIPAV VOI properties.private static voidexit_input_error(int line_num)private static voidexit_input_error(int line_num, java.lang.Throwable cause)private voidfindBestImageNMI(int targetImageSliceNumber, int[] bestImageNumber, int[] bestSliceNumber)NMI searching between target image and AAM atlas.voidfixErrorVOI()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.voidinit()GUI panel initialization.voidmarkErrorOne()Mark the error segmented VOIs.ModelImagemaskDisplay(int[] mask, int sliceNumber)Display binary mask images.voidmergedClassifier()After apply the AAM segmentation.static voidpause()Pauses the display until the user hits enter.private voidprocessDir(java.io.File dir, java.util.Vector<JDialogAAMplusSVM.ModelString> modelNameVector)Processing the AAM dir with AAM model string and pivot sample image name.private voidprocessingData(java.lang.String modelDir)Process AAM model directory.private voidprocessingEndSliceData(java.lang.String endSliceModelDir)Process the ending slice atlas directory.private voidreadEndingSlice()Read the end slices and update the segmentation processing range.private voidreadEndingSlicesDir()Read the ending slice index to guide the segmentation towards apex and base.voidreadImagesAndVOIs()Read target imageprivate voidreadKeyImageDir()Read AAM model atlas.private voidreadModels()Read SVM model atlas.private voidreadSampleImages()Read the AAM model.private voidreadSVMModelDir()Read SVM model atlas.private voidreadTargetImage()Read target image.voidreadTargetImageFeature()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.voidsmoothVOI30(ModelImage maskImage, ModelImage resultImage)Smooth VOI with 30 points.private voidsvmSortModelStructure()sort SVM model with names.private voidsvmTraverseDir(java.io.File dir)Processing SVM model atlas.voidtransformVOIAAM()BSpline to smooth the final segmented VOIs.private voidtraverse(java.io.File dir)Recursively 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, 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: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
public void actionPerformed(java.awt.event.ActionEvent event)
actionPerformed handler.- Specified by:
actionPerformedin interfacejava.awt.event.ActionListener- 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 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()
-
-