Class JDialogProstateExtractCEFeature
- 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.JDialogProstateExtractCEFeature
-
- 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 JDialogProstateExtractCEFeature extends JDialogBase implements AlgorithmInterface
After the 3D images convert to 2D slices ( 512x512 ), this class picks the 2D slices, extracts the Coherence Enhanced diffusion based features, and saves those features with linear SVM readable file formats. User specifies the 2D slices saved directory as input, and the same directory as the output. The class automatically apply the following steps, 1) picks those slices, cropped region according to central prostate gland. 2) apply Coherence Enhanced filter to each cropped slice. 3) Save the Hurst index and Haralick features of each 2D slice to corresponding directory. Those saved CE features will be used to create linear SVM models. Also, for test cases, this class functions as the pre-processing steps to save CE features before automatic segmentation.- Author:
- Ruida Cheng
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
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
private int
axis
private javax.swing.JComboBox
axisList
axis region.private int
boxXmax
private int
boxXmin
private int
boxYmax
cropped image boundary.private int
boxYmin
cropped image boundary.private javax.swing.JButton
buttonKeyImage
private javax.swing.JButton
buttonSaveImage
private boolean
coherenceEnhancingDiffusionFilter
Coherence Enhancing Diffusion filter.private static int
Coronal
private AlgorithmAddMargins
cropAlgo
crop image algorithmprivate java.util.Vector<ModelImage>
cropKeyImages
cropped key image, crop from 512x512 to central prostate gland region.private java.util.Vector<java.util.Vector<ModelImage>>
cropKeyImagesCE
cropped CE image vector.static java.lang.String
featureDirName
private boolean
gaborFilter
gabor filter.private boolean
gaussianFilter
gussian filter.private boolean
gmFilter
gradient magnitude filter.private int
haralickFeatureNumber
Haralick feature numbers.private boolean
haralickFilter
haralick filter.private boolean
hurstFilter
Hurst index.private boolean
IHN3CorrectionFilter
Inhomogeneity N3 correction.private boolean
imageIntensityFilter
image intensity.private javax.swing.JPanel
imageSelectionPanel
2D slices image selection panel.private boolean
invertFilter
Haralick invert filter.private javax.swing.JFileChooser
keyImageChooser
2D slice images file chooser.private java.lang.String
keyImageDirectory
2D slices image directory.private java.util.Vector<ModelImage>
keyImages
key images vector.private java.util.Vector<java.lang.String>
keyImageVector
key images names vector.private java.util.Vector<VOI[]>
keyImageVOIs
key image VOIs vector.private java.util.Vector<java.lang.String>
keyImageVOIVector
key image VOI names vector.private javax.swing.JLabel
labelAxis
private javax.swing.JLabel
labelKeyImage
2D Slices key image directory.private javax.swing.JLabel
labelSaveImage
Save features directory.private boolean
meanFilter
Haralick mean filter.private boolean
medianFilter
Haralick median filter.private boolean
modeFilter
Haralick mode filter.static java.lang.String
modelDirName
private int
numberFeatures
number features being saved.private javax.swing.JRadioButton
radioButtonSVMBinary
SVM option button.private javax.swing.JRadioButton
radioButtonSVMMulticlass
private boolean
regisotropicDiffusionFilter
Anisotropic Diffusion filter.private static int
Saggital
private javax.swing.JFileChooser
saveImageChooser
Saved features directory.private java.lang.String
saveImageDirectory
private static long
serialVersionUID
private boolean
svmTrainingBinary
flag to indicate is SVM training with binary class or multi-class.private javax.swing.JTextField
textFieldKeyImage
private javax.swing.JTextField
textFieldSaveImage
private AlgorithmProstateFeaturesSaveAutoTrain
textureAlgo
Algorithm to save Hurst index and Haralick features.private ViewUserInterface
UI
The main user interface.private int
waveletFeatureNumber
wavelet feature number.private boolean
waveletFilter
Wavelet filter.private int[]
xBounds
x dimension boundsprivate int[]
yBounds
y dimension boundprivate int[]
zBounds
z dimension bound-
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 JDialogProstateExtractCEFeature(java.awt.Frame theParentFrame)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
actionPerformed(java.awt.event.ActionEvent event)
Action performed handler for this dialog.void
algorithmPerformed(AlgorithmBase algorithm)
This method is required if the AlgorithmPerformed interface is implemented.void
buildKeyImagePanel()
Build the panel.private void
calculateCoherenceEnhancingDiffusion()
From the cropped images, apply Coherence Enhanced Diffusion filter to each 2D slices.private void
calculateNumberFeatures()
Calculate number of features being saved.void
callAlgorithm()
Driver to do automatic feature extraction.void
cropKeyImages()
Crop the central prostate gland region from the 512x512 slices.void
disposeLocal()
dispose memory.void
extractFeatures()
Extract CE features.void
init()
Dialog GUI initialization.void
printImages()
debuger for file names read.private void
processDir(java.io.File dir)
Process directory, save the image names and voi names.void
readFiles()
read 2D slices directory.private void
readKeyImageDir()
Read 2D slices.private void
recordSaveImageDir()
Record the save 2D slice features directory.Features[]
saveFeatureSpaceValue(ModelImage resultImage, ModelImage classificationImage, ModelImage keyImage, ModelImage srcImage, int sliceNumber)
Save CE features to user specified directory.private void
traverse(java.io.File dir)
Traverse the 2D slices directory.-
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
-
UI
private ViewUserInterface UI
The main user interface.
-
radioButtonSVMBinary
private javax.swing.JRadioButton radioButtonSVMBinary
SVM option button.
-
radioButtonSVMMulticlass
private javax.swing.JRadioButton radioButtonSVMMulticlass
-
svmTrainingBinary
private boolean svmTrainingBinary
flag to indicate is SVM training with binary class or multi-class.
-
boxYmin
private int boxYmin
cropped image boundary.
-
boxYmax
private int boxYmax
cropped image boundary.
-
boxXmin
private int boxXmin
-
boxXmax
private int boxXmax
-
xBounds
private int[] xBounds
x dimension bounds
-
yBounds
private int[] yBounds
y dimension bound
-
zBounds
private int[] zBounds
z dimension bound
-
cropAlgo
private AlgorithmAddMargins cropAlgo
crop image algorithm
-
textureAlgo
private AlgorithmProstateFeaturesSaveAutoTrain textureAlgo
Algorithm to save Hurst index and Haralick features.
-
imageIntensityFilter
private boolean imageIntensityFilter
image intensity.
-
coherenceEnhancingDiffusionFilter
private boolean coherenceEnhancingDiffusionFilter
Coherence Enhancing Diffusion filter.
-
regisotropicDiffusionFilter
private boolean regisotropicDiffusionFilter
Anisotropic Diffusion filter.
-
IHN3CorrectionFilter
private boolean IHN3CorrectionFilter
Inhomogeneity N3 correction.
-
modeFilter
private boolean modeFilter
Haralick mode filter.
-
meanFilter
private boolean meanFilter
Haralick mean filter.
-
medianFilter
private boolean medianFilter
Haralick median filter.
-
invertFilter
private boolean invertFilter
Haralick invert filter.
-
haralickFilter
private boolean haralickFilter
haralick filter.
-
gaborFilter
private boolean gaborFilter
gabor filter.
-
hurstFilter
private boolean hurstFilter
Hurst index.
-
waveletFilter
private boolean waveletFilter
Wavelet filter.
-
gaussianFilter
private boolean gaussianFilter
gussian filter.
-
gmFilter
private boolean gmFilter
gradient magnitude filter.
-
numberFeatures
private int numberFeatures
number features being saved.
-
haralickFeatureNumber
private int haralickFeatureNumber
Haralick feature numbers.
-
labelKeyImage
private javax.swing.JLabel labelKeyImage
2D Slices key image directory.
-
textFieldKeyImage
private javax.swing.JTextField textFieldKeyImage
-
buttonKeyImage
private javax.swing.JButton buttonKeyImage
-
imageSelectionPanel
private javax.swing.JPanel imageSelectionPanel
2D slices image selection panel.
-
keyImageChooser
private javax.swing.JFileChooser keyImageChooser
2D slice images file chooser.
-
keyImageDirectory
private java.lang.String keyImageDirectory
2D slices image directory.
-
axisList
private javax.swing.JComboBox axisList
axis region.
-
labelAxis
private javax.swing.JLabel labelAxis
-
Axial
private static int Axial
-
Saggital
private static int Saggital
-
Coronal
private static int Coronal
-
axis
private int axis
-
waveletFeatureNumber
private int waveletFeatureNumber
wavelet feature number.
-
keyImageVector
private java.util.Vector<java.lang.String> keyImageVector
key images names vector.
-
keyImages
private java.util.Vector<ModelImage> keyImages
key images vector.
-
keyImageVOIVector
private java.util.Vector<java.lang.String> keyImageVOIVector
key image VOI names vector.
-
keyImageVOIs
private java.util.Vector<VOI[]> keyImageVOIs
key image VOIs vector.
-
cropKeyImages
private java.util.Vector<ModelImage> cropKeyImages
cropped key image, crop from 512x512 to central prostate gland region.
-
cropKeyImagesCE
private java.util.Vector<java.util.Vector<ModelImage>> cropKeyImagesCE
cropped CE image vector.
-
modelDirName
public static final java.lang.String modelDirName
- See Also:
- Constant Field Values
-
featureDirName
public static final java.lang.String featureDirName
- See Also:
- Constant Field Values
-
labelSaveImage
private javax.swing.JLabel labelSaveImage
Save features directory.
-
textFieldSaveImage
private javax.swing.JTextField textFieldSaveImage
-
buttonSaveImage
private javax.swing.JButton buttonSaveImage
-
saveImageChooser
private javax.swing.JFileChooser saveImageChooser
Saved features directory.
-
saveImageDirectory
private java.lang.String saveImageDirectory
-
-
Method Detail
-
disposeLocal
public void disposeLocal()
dispose memory.
-
calculateNumberFeatures
private void calculateNumberFeatures()
Calculate number of features being saved. Currently, only Hurst index and Haralick features being used.
-
actionPerformed
public void actionPerformed(java.awt.event.ActionEvent event)
Action performed handler for this dialog.- Specified by:
actionPerformed
in interfacejava.awt.event.ActionListener
- Overrides:
actionPerformed
in classJDialogBase
-
recordSaveImageDir
private void recordSaveImageDir()
Record the save 2D slice features directory.
-
readKeyImageDir
private void readKeyImageDir()
Read 2D slices.
-
printImages
public void printImages()
debuger for file names read.
-
traverse
private void traverse(java.io.File dir)
Traverse the 2D slices directory.- Parameters:
dir
-
-
processDir
private void processDir(java.io.File dir)
Process directory, save the image names and voi names.- Parameters:
dir
-
-
algorithmPerformed
public void algorithmPerformed(AlgorithmBase algorithm)
This method is required if the AlgorithmPerformed interface is implemented. It is called by the algorithms when it has completed or failed to to complete, so that the dialog can be display the result image and/or clean up.- Specified by:
algorithmPerformed
in interfaceAlgorithmInterface
- Parameters:
algorithm
- Algorithm that caused the event.
-
callAlgorithm
public void callAlgorithm()
Driver to do automatic feature extraction.
-
calculateCoherenceEnhancingDiffusion
private void calculateCoherenceEnhancingDiffusion()
From the cropped images, apply Coherence Enhanced Diffusion filter to each 2D slices.
-
cropKeyImages
public void cropKeyImages()
Crop the central prostate gland region from the 512x512 slices.
-
readFiles
public void readFiles()
read 2D slices directory.
-
extractFeatures
public void extractFeatures()
Extract CE features.
-
saveFeatureSpaceValue
public Features[] saveFeatureSpaceValue(ModelImage resultImage, ModelImage classificationImage, ModelImage keyImage, ModelImage srcImage, int sliceNumber)
Save CE features to user specified directory.- Parameters:
resultImage
- result image from feature extraction algorithm.classificationImage
- corresponding class +1 or -1.keyImage
- cropped key imagesrcImage
- corresponding src imagesliceNumber
- slice number- Returns:
- Feature vectors for the 2D slices.
-
init
public void init()
Dialog GUI initialization.
-
buildKeyImagePanel
public void buildKeyImagePanel()
Build the panel.
-
-