Class JDialogAAMClassificationExt
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.JDialogAAMClassificationExt
- All Implemented Interfaces:
AlgorithmInterface,DialogDefaultsInterface,ActionListener,FocusListener,ItemListener,WindowListener,ImageObserver,MenuContainer,Serializable,EventListener,Accessible,RootPaneContainer,WindowConstants
The class is the driver for the AAM classification. User specifies the AAM
trained Atlas directory and target image. The algorithm performs NMI based
similarity measure between each 2D slice in target image and the 2D slices
atlas, find the closed image, then invoke the corresponding AAM model to do
automatic segmentation on prostate MRI image.
- Author:
- Ruida Cheng
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) class(package private) classPolygon shape info class to do shape comparison after the AAM classification applied to do the segmentation.(package private) classEnding slice start and end indexes.(package private) classshape descriptor class.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 orientation.private intprivate JComboBoxaxis regionprivate intprivate intprivate intCropped image region.private intCropped image region.private JButtonprivate JButtonprivate JPanelprivate static final boolean[]private static intprivate ModelImageprivate intprivate Vector<ModelImage> private Vector<JDialogAAMClassificationExt.Range> private Hashtable<Integer, Vector<ModelImage>> private Hashtable<Integer, Vector<ModelImage>> private JPanelprivate Vector<ModelImage> image vector to hold the actual images.image vector to hold the image names.private JLabelprivate JLabelTarget image directory.private JLabelkey image directory.private JPanelprivate C_AAMMODELAAM model reference.private JFileChooserkey images variables.private Stringprivate static intprivate ModelImageprivate static final longprivate intprivate static final String[]private ModelImageprivate JFileChoosertarget image variables.private Stringprivate Stringprivate Stringprivate JTextFieldprivate JTextFieldprivate ViewUserInterfaceThe main user interface.private int[]Cropped region bounding.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
ConstructorsConstructorDescriptionJDialogAAMClassificationExt(Frame theParentFrame) Constructor. the parent frame -
Method Summary
Modifier and TypeMethodDescriptionvoidactionPerformed(ActionEvent event) actionPerformed handler.voidalgorithmPerformed(AlgorithmBase algorithm) Called after an algorithm this listener is registered to exits (maybe successfully, maybe not).voidFrom the target 2D slice, compare it with end slices based atlas.voidCompute the shape descriptor with roundness, compactness, aspectRatio, and eccentricity.voidFirst time this dialog is called, init() will be called to create the GUI.voidWhen we to NMI based image similarity measure, we crop the prostate 2D slice image first, then apply the measure.Crop the target image 2D slice to focus on central gland.voidvoidFirst time the dialog called, this function is invoked to do segmentation.voidEvaluate the auto segmentation generated VOIs shapes.private voidfindBestImageNMI(int targetImageSliceNumber, int[] bestImageNumber, int[] bestSliceNumber) NMI based 2D slice image similarity measure.voidReplace the irregular shape or wrong shape VOI with adjacent neighbor VOI.getStatsData(Vector<VOIStatisticalProperties> statsList, VOIVector VOIs, ModelImage img) Generate the VOI shape statistics.voidinit()Init() function to create the GUI dialog.voidload image files and voi filesvoidGo through the auto segmented VOIs, filter out the irregular shape or wrong shapes.static voidpause()Pauses the display until the user hits enter.private voidprocessDir(File dir, Vector<JDialogAAMClassificationExt.ModelString> modelNameVector) Process dir, read AAM model and pivot images.private voidprocessDir_80(File dir) private voidprocessingData(String modelDir) Process AAM atlas directory.private voidprocessingEndSliceData(String endSliceModelDir) Process the ending slice atlas directory.voidAfter the first time the dialog is invoked, when user select the AAM segmentation from the menu item, the quick segmentation function is called to do the AAM classification.private voidupdate the ending slices.private voidRead the ending slice index to guide the segmentation towards apex and base.voidreadFile()voidread target image.private voidRead the AAM atlas directory.private voidWhen read the AAM model atlas, read corresponding pivot images from atlas direction.private voidFile chooser to select target image directory.voidDriver to do the auto segmenation with AAM model.voidBSpline smooth the final auto segmentation VOI contours.private voidRecursivly traverse the AAM atlas directory.private voidtraverse_80(File dir) voidupdateTargetImage(int sliceNumber, ModelImage targetImageSlice) After auto segmentation, update the target image with corresponding segmented VOIs.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:
-
UI
The main user interface. -
model
AAM model reference. -
labelModel
key image directory. -
textFieldModel
-
buttonModel
-
labelImageTarget
Target image directory. -
textFieldImageTarget
-
buttonImageTarget
-
imageSelectionPanel
-
buttonPanel
-
modelChooser
key images variables. -
modelDirectory
-
targetImageChooser
target image variables. -
targetImageName
-
targetImageDirectory
-
targetImage
-
cropTargetImage
-
boxYmin
private int boxYminCropped image region. -
boxYmax
private int boxYmaxCropped image region. -
boxXmin
private int boxXmin -
boxXmax
private int boxXmax -
xBounds
private int[] xBoundsCropped region bounding. -
yBounds
private int[] yBounds -
zBounds
private int[] zBounds -
axisList
axis region -
labelAxis
-
Axial
private static int Axialaxis orientation. Will be used later. -
Saggital
private static int Saggital -
Coronal
private static int Coronal -
axis
private int axis -
shapeVector
-
sampleImage
-
groupTable
-
groupRefImages
-
groupCropImages
-
markedVOI
-
shapeDescriptor
-
statData
-
statsToCalculate
-
checkList
private static final boolean[] checkList -
mainPanel
-
startSlice
private int startSlice -
endSlice
private int endSlice -
endSliceImageNames
-
endSliceRangeNames
-
endSliceImages
-
endSliceRange
-
keyImageVector
image vector to hold the image names. -
keyImages
image vector to hold the actual images. -
testImageDir
-
-
Constructor Details
-
JDialogAAMClassificationExt
Constructor. the parent frame- Parameters:
theParentFrame-
-
-
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
-
loadFiles
public void loadFiles()load image files and voi files -
readFile
public void readFile() -
traverse_80
-
processDir_80
-
createTargetDialog
public void createTargetDialog()First time this dialog is called, init() will be called to create the GUI. When user choose the dialog again, we don't need to reload the AAM atlas model again. So, we create this target dialog to allow user to just select the target image for AAM classification. -
init
public void init()Init() function to create the GUI dialog. -
quickSegmentation
public void quickSegmentation()After the first time the dialog is invoked, when user select the AAM segmentation from the menu item, the quick segmentation function is called to do the AAM classification. It omits the AAM atlas model re-loading procedure. -
doSegmentation
public void doSegmentation()First time the dialog called, this function is invoked to do segmentation. -
evaluateShapeDescriptor
public void evaluateShapeDescriptor()Evaluate the auto segmentation generated VOIs shapes. -
getStatsData
private Vector<Vector<String>> getStatsData(Vector<VOIStatisticalProperties> statsList, VOIVector VOIs, ModelImage img) Generate the VOI shape statistics.- Parameters:
statsList- VOI statistic properties carry out by MIPAVVOIs- VOIs contoursimg- image- Returns:
- statistic data vetor.
-
computeShapeDescriptor
public void computeShapeDescriptor()Compute the shape descriptor with roundness, compactness, aspectRatio, and eccentricity. -
markErrorOne
public void markErrorOne()Go through the auto segmented VOIs, filter out the irregular shape or wrong shapes. Mark those shapes with flag 1 to indicating the replacement. -
transformVOI
public void transformVOI()BSpline smooth the final auto segmentation VOI contours. -
fixErrorVOI
public void fixErrorVOI()Replace the irregular shape or wrong shape VOI with adjacent neighbor VOI. -
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. -
segmentationAuto
public void segmentationAuto()Driver to do the auto segmenation with AAM model. -
cropImage
public void cropImage()When we to NMI based image similarity measure, we crop the prostate 2D slice image first, then apply the measure. Two advantages, 1) cropped region focus on the central gland region of prostate, 2) cropped region comparison is much faster that the whole image slice (512x512) based comparison, yelding relative accurate NMI comparison results. -
findBestImageNMI
private void findBestImageNMI(int targetImageSliceNumber, int[] bestImageNumber, int[] bestSliceNumber) NMI based 2D slice image similarity measure. For each target image 2D slice, we use NMI to search the best match image 2D slice. The search range is 3 slices around the current 2D slice index. When find the best slice, we record it, and invoke the corresponding AAM Model to do segmentation.- Parameters:
targetImageSliceNumber- target imagebestImageNumber- best match image numberbestSliceNumber- best match slice number.
-
cropTargetImage
Crop the target image 2D slice to focus on central gland.- Returns:
-
updateTargetImage
After auto segmentation, update the target image with corresponding segmented VOIs.- Parameters:
sliceNumber- slice number.targetImageSlice- 2D target image slice.
-
pause
public static void pause()Pauses the display until the user hits enter. -
readImagesAndVOIs
public void readImagesAndVOIs()read target image. -
readTargetImage
private void readTargetImage()File chooser to select target image directory. -
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 the AAM atlas directory. -
readEndingSlice
private void readEndingSlice()update the ending slices. -
readSampleImages
private void readSampleImages()When read the AAM model atlas, read corresponding pivot images from atlas direction. This pivot 2D image slice will guide the NMI similarity searching. -
processingData
Process AAM atlas directory.- Parameters:
modelDir-
-
traverse
Recursivly traverse the AAM atlas directory.- Parameters:
dir-
-
processDir
Process dir, read AAM model and pivot images.- Parameters:
dir-modelNameVector-
-
disposeLocal
public void disposeLocal()
-