Class JDialogProstateSegmentationRegBSpline3D
- 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.JDialogProstateSegmentationRegBSpline3D
-
- 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 JDialogProstateSegmentationRegBSpline3D extends JDialogBase implements AlgorithmInterface
Semi-automatic MR Prostate segmentation - Registration and Fuzzy-C guided segmentation model. The algorithm uses B-Spline registration and Fuzzy-C to guide the MR prostate segmentation. Basic steps: 1) User open the axial, sagittal, coronal images in the MIPAV frame. 2) User manually outline the three contours on separate slices for each axial, sagittal, and coronal images to define the middle, the apex and the base of the prostate. 3) User click the OK button to let a fully automatic registration guided algorithm to segment the prostate of all the three images.- Author:
- Ruida Cheng
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) class
JDialogProstateSegmentationRegBSpline3D.Edge
(package private) class
JDialogProstateSegmentationRegBSpline3D.PolarPoint
-
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
Axial image typeprivate static int
Coronal
Coronal image type(package private) int
endVOIAxial
private int
endVOICoronal
(package private) int
endVOISagittal
private ModelImage
imageAxial
private ModelImage
imageCoronal
private ModelImage
imageSagittal
private javax.swing.JLabel
labelAxis
private javax.swing.JLabel
labelCoronal
private javax.swing.JLabel
labelEndVOIAxial
private javax.swing.JLabel
labelEndVOICoronal
private javax.swing.JLabel
labelEndVOISagittal
private javax.swing.JLabel
labelMidVOIAxial
private javax.swing.JLabel
labelMidVOICoronal
private javax.swing.JLabel
labelMidVOISagittal
private javax.swing.JLabel
labelSagittal
private javax.swing.JLabel
labelStartVOIAxial
private javax.swing.JLabel
labelStartVOICoronal
private javax.swing.JLabel
labelStartVOISagittal
(package private) int
midVOIAxial
private int
midVOICoronal
(package private) int
midVOISagittal
private javax.swing.JRadioButton
radioBSpline
private javax.swing.JRadioButton
radioOAR
private static int
Sagittal
Sagittal image type(package private) int
startVOIAxial
private int
startVOICoronal
(package private) int
startVOISagittal
private javax.swing.JTextField
textFieldEndVOIAxial
private javax.swing.JTextField
textFieldEndVOICoronal
private javax.swing.JTextField
textFieldEndVOISagittal
private javax.swing.JTextField
textFieldMidVOIAxial
private javax.swing.JTextField
textFieldMidVOICoronal
private javax.swing.JTextField
textFieldMidVOISagittal
private javax.swing.JTextField
textFieldStartVOIAxial
private javax.swing.JTextField
textFieldStartVOICoronal
private javax.swing.JTextField
textFieldStartVOISagittal
private int
tracingSliceNumber
number of slices to trace, start from the apex and base VOIsprivate ViewUserInterface
UI
global user interface to get the three active images.private boolean
useBSpline
Flag to indicate to use B-Spline registration or OAR registration-
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 JDialogProstateSegmentationRegBSpline3D(java.awt.Frame theParentFrame)
GUI interface for semi-automatic MR prostate segmentation.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
actionPerformed(java.awt.event.ActionEvent event)
Just handle GUI button clicks event.void
adjustVOIs(ModelImage image)
When user draws the 3 VOIs out of order, adjust the VOIs in ascending ordervoid
algorithmPerformed(AlgorithmBase algorithm)
This method is required if the AlgorithmPerformed interface is implemented.void
autoConfigVOIsNumbers()
After user manually draw the three VOIs on each axial, sagittal, coronal image, the drawn VOIs slices number is auto configured to appear in the dialog GUI interface.private ModelImage
calculateCoherenceEnhancingDiffusion(ModelImage cropImage)
Apply the coherence enhancing diffusion filter to the croppred MR image.void
calculateVOIsVolume()
Compute the VOIs binary mask based volumes.void
callAlgorithm(ModelImage image, int midVOI, int startVOI, int endVOI, int axis)
Single thread based segmentation, which takes up to 40 minutes.void
configVOIsNumbers(ModelImage image, int[] slices)
Configure the mid, apex and base VOIs, sort them in order.void
convertVOIToDicomSpace(VOIVector src, java.util.Vector<WildMagic.LibFoundation.Mathematics.Vector3f> target, ModelImage image, int startSlice, int endSlice)
Conver the VOIs from image space to Dicom spacevoid
createImagePointTable(JDialogProstateSegmentationRegBSpline3D.Edge imageTable, ModelImage resultImage)
Convert each image pixel to polar coordinate system, saved them in a table.private java.lang.Runnable
createTask(ModelImage image, int midVOI, int startVOI, int endVOI, int axis)
Parallel processing the automatic segmentation algorithm to all the three images concurrently.private void
createVOIPointTable(JDialogProstateSegmentationRegBSpline3D.Edge voiTable, ModelImage resultImage)
Create the VOI table in polar coodinate system.ModelImage
cropROI(ModelImage image, int[] xBounds, int[] yBounds, int[] zBounds, int[] boundingBox, int midVOI)
Crop MR image with specified X, Y, Z bounds Use the mid slice as the initial guidance to find the bounds.void
doFuzzyCmean(ModelImage coherenceEnhancingDiffusionImage, java.util.Vector<java.util.Vector<ModelImage>> imageStackFuzzyC)
Generate the Fuzzy-C means classes from the CED imagevoid
doRegistrationEnd(ModelImage image, ModelImage coherenceEnhancingDiffusionImage, java.util.Vector<java.util.Vector<ModelImage>> imageStackFuzzyC, int endVOI, int[] boundingBox, int axis)
Near the base, base contour starts as the initial estimate, and repeat the same process toward the end slices.void
doRegistrationMid(ModelImage image, ModelImage coherenceEnhancingDiffusionImage, java.util.Vector<java.util.Vector<ModelImage>> imageStackFuzzyC, int midVOI, int startVOI, int endVOI, int[] boundingBox, int axis)
The proposed model uses 2D registration to register 2D slices from the middle slice to the adjacent slice.void
doRegistrationStart(ModelImage image, ModelImage coherenceEnhancingDiffusionImage, java.util.Vector<java.util.Vector<ModelImage>> imageStackFuzzyC, int startVOI, int[] boundingBox, int axis)
Near the apex, apex contour starts as the initial estimate, and repeat the same process toward the end slices.void
drawNarrowBand(JDialogProstateSegmentationRegBSpline3D.Edge narrowBandTable, ModelImage resultImage)
Draw the narrow band region.void
fillholes(ModelImage maskImage)
Fill holes inside the binary mask image.void
findNarrowBand(JDialogProstateSegmentationRegBSpline3D.Edge voiTable, JDialogProstateSegmentationRegBSpline3D.Edge imageTable, JDialogProstateSegmentationRegBSpline3D.Edge narrowBandTable)
Find the narrow band regions around VOI contours.void
findRegion(JDialogProstateSegmentationRegBSpline3D.Edge imageTable, float theta1, float theta2, java.util.Vector<JDialogProstateSegmentationRegBSpline3D.PolarPoint> voiPointsInRange, JDialogProstateSegmentationRegBSpline3D.Edge narrowBandTable)
Looking for the narrow band region.void
findVOIpointsInRange(JDialogProstateSegmentationRegBSpline3D.Edge imageTable, java.util.Vector<JDialogProstateSegmentationRegBSpline3D.PolarPoint> voiPointsInRange, int min, int max, JDialogProstateSegmentationRegBSpline3D.Edge voiTable)
Tracing generated VOI tables, convert it from image coordinate to Polar coordinate.private float[]
getCentroids(ModelImage srcImage, AlgorithmFuzzyCMeans fcmAlgo, float[] centroids)
Gets the minimum and maximum of each image and initializes the centroids dialog appropriately.void
IDobjects(ModelImage maskImage)
Eliminate the small binary mask components.void
init()
Create the dialog interface.boolean
inRange(JDialogProstateSegmentationRegBSpline3D.Edge narrowBandTable, int x, int y)
Check whether the given x, y pixel fall withing the narrow band region.boolean
isInsideVOI(int pos, ModelImage img)
check if given pixl location is inside VOI or not.private boolean
isVOIsCloseEnough(int currentSlice, ModelImage resultImage, ModelImage refImage)
Check the registration accuracy.void
maskToVOI(ModelImage maskImage, ModelImage testImage)
Convert mask image to VOIvoid
maskVOIFill(ModelImage maskImage)
Fill pixels inside VOI.void
morphologyPostProcessing(ModelImage maskImage, ModelImage resultImage, ModelImage testImage)
Apply the morphology filter the generate binary mask image from Fuzz-C segmentation.void
particleSystem(ModelImage maskImage)
Particle system analysis.static void
pause()
Pauses the display until the user hits enter.void
printVolume(ModelImage srcImage, VOIVector voiVector, int viewOrientation)
Print out the three VOIs volume in system console out.void
removeContourFromOtherOrientation()
User central gland contours projection to remove the extra interpolated VOIs contours at the apex and base.void
removeVOIsInDicomSpace(int zSlice, float zDicom, ModelImage image, java.util.Vector<WildMagic.LibFoundation.Mathematics.Vector3f> firstVOI, java.util.Vector<WildMagic.LibFoundation.Mathematics.Vector3f> secondVOI, int viewOrientation)
Remove the extra VOIs contours in Dicom space.void
segmentFromFuzzyC(java.util.Vector<java.util.Vector<ModelImage>> imageStackFuzzyC, int currentSlice, ModelImage resultImage, ModelImage refImage, ModelImage testImage, int axis)
Apply the Fuzzy-C means segmentation to CED image stack.void
smoothVOI120(ModelImage maskImage, ModelImage resultImage)
Convert the mask image to VOI with 120 points.void
smoothVOI50(ModelImage maskImage, ModelImage resultImage)
Convert the mask image to VOI with 50 pointsvoid
sortCEDImageVOIs(ModelImage coherenceEnhancingDiffusionImage, int midVOI, int startVOI, int endVOI)
Sort the CED image VOIsvoid
sortImageVOIs(ModelImage image)
Sorting image VOIvoid
sortImageVOIsInit(ModelImage image, int midVOI, int startVOI, int endVOI)
Sort the original MR image's specified VOIsvoid
threshold(ModelImage maskImage)
Convert the mask image specified theshold values.void
transformVOI(ModelImage image, ModelImage resultImage, int[] boundingBox, int currentSlice)
Transform the the resulting VOI from cropped image to oringal MR image.java.lang.Runnable
trimVOIsInSingleImage(ModelImage image, int startVOI, int endVOI, java.util.Vector<WildMagic.LibFoundation.Mathematics.Vector3f> firstVOI, java.util.Vector<WildMagic.LibFoundation.Mathematics.Vector3f> secondVOI, int viewOrientation)
In Dicom space, central contours projections to eliminate the extra contours at the apex and base.-
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
-
UI
private ViewUserInterface UI
global user interface to get the three active images.
-
tracingSliceNumber
private int tracingSliceNumber
number of slices to trace, start from the apex and base VOIs
-
Axial
private static int Axial
Axial image type
-
Sagittal
private static int Sagittal
Sagittal image type
-
Coronal
private static int Coronal
Coronal image type
-
labelAxis
private javax.swing.JLabel labelAxis
-
labelStartVOIAxial
private javax.swing.JLabel labelStartVOIAxial
-
textFieldStartVOIAxial
private javax.swing.JTextField textFieldStartVOIAxial
-
labelEndVOIAxial
private javax.swing.JLabel labelEndVOIAxial
-
textFieldEndVOIAxial
private javax.swing.JTextField textFieldEndVOIAxial
-
labelMidVOIAxial
private javax.swing.JLabel labelMidVOIAxial
-
textFieldMidVOIAxial
private javax.swing.JTextField textFieldMidVOIAxial
-
startVOIAxial
int startVOIAxial
-
endVOIAxial
int endVOIAxial
-
midVOIAxial
int midVOIAxial
-
labelSagittal
private javax.swing.JLabel labelSagittal
-
labelStartVOISagittal
private javax.swing.JLabel labelStartVOISagittal
-
textFieldStartVOISagittal
private javax.swing.JTextField textFieldStartVOISagittal
-
labelEndVOISagittal
private javax.swing.JLabel labelEndVOISagittal
-
textFieldEndVOISagittal
private javax.swing.JTextField textFieldEndVOISagittal
-
labelMidVOISagittal
private javax.swing.JLabel labelMidVOISagittal
-
textFieldMidVOISagittal
private javax.swing.JTextField textFieldMidVOISagittal
-
startVOISagittal
int startVOISagittal
-
endVOISagittal
int endVOISagittal
-
midVOISagittal
int midVOISagittal
-
labelCoronal
private javax.swing.JLabel labelCoronal
-
labelStartVOICoronal
private javax.swing.JLabel labelStartVOICoronal
-
textFieldStartVOICoronal
private javax.swing.JTextField textFieldStartVOICoronal
-
labelEndVOICoronal
private javax.swing.JLabel labelEndVOICoronal
-
textFieldEndVOICoronal
private javax.swing.JTextField textFieldEndVOICoronal
-
labelMidVOICoronal
private javax.swing.JLabel labelMidVOICoronal
-
textFieldMidVOICoronal
private javax.swing.JTextField textFieldMidVOICoronal
-
radioBSpline
private javax.swing.JRadioButton radioBSpline
-
radioOAR
private javax.swing.JRadioButton radioOAR
-
startVOICoronal
private int startVOICoronal
-
endVOICoronal
private int endVOICoronal
-
midVOICoronal
private int midVOICoronal
-
imageAxial
private ModelImage imageAxial
-
imageSagittal
private ModelImage imageSagittal
-
imageCoronal
private ModelImage imageCoronal
-
useBSpline
private boolean useBSpline
Flag to indicate to use B-Spline registration or OAR registration
-
-
Method Detail
-
autoConfigVOIsNumbers
public void autoConfigVOIsNumbers()
After user manually draw the three VOIs on each axial, sagittal, coronal image, the drawn VOIs slices number is auto configured to appear in the dialog GUI interface.
-
configVOIsNumbers
public void configVOIsNumbers(ModelImage image, int[] slices)
Configure the mid, apex and base VOIs, sort them in order.- Parameters:
image
- oringial MRI imageslices
- Slice array to store the mid, apex and base VOIs slice number.
-
actionPerformed
public void actionPerformed(java.awt.event.ActionEvent event)
Just handle GUI button clicks event.- Specified by:
actionPerformed
in interfacejava.awt.event.ActionListener
- Overrides:
actionPerformed
in classJDialogBase
-
calculateVOIsVolume
public void calculateVOIsVolume()
Compute the VOIs binary mask based volumes.
-
printVolume
public void printVolume(ModelImage srcImage, VOIVector voiVector, int viewOrientation)
Print out the three VOIs volume in system console out.- Parameters:
srcImage
- original MRI imagevoiVector
- segmented resulting VOIs contoursviewOrientation
- view axis orientation: axial, or sagittal or coronal.
-
removeContourFromOtherOrientation
public void removeContourFromOtherOrientation()
User central gland contours projection to remove the extra interpolated VOIs contours at the apex and base. Parallel processing the algorithm with axial, sagittal and coronal images concurrently.
-
trimVOIsInSingleImage
public java.lang.Runnable trimVOIsInSingleImage(ModelImage image, int startVOI, int endVOI, java.util.Vector<WildMagic.LibFoundation.Mathematics.Vector3f> firstVOI, java.util.Vector<WildMagic.LibFoundation.Mathematics.Vector3f> secondVOI, int viewOrientation)
In Dicom space, central contours projections to eliminate the extra contours at the apex and base. For example, axial image, project the sagittal, coronal VOIs onto the axial image Dicom space. The central gland part sagittal, coronal VOIs contours is projected on the axial image slices as points based contours. If there is no points on the corresponding axial image slice, however it has contour, the contour is eliminated.- Parameters:
image
- original MRI image. i.e. axial imagestartVOI
- apex VOI slice numberendVOI
- base VOI slice numberfirstVOI
- sagittal image VOIs in Dicom spacesecondVOI
- coronal image VOIs in Dicom space.viewOrientation
- image axis orientation- Returns:
-
removeVOIsInDicomSpace
public void removeVOIsInDicomSpace(int zSlice, float zDicom, ModelImage image, java.util.Vector<WildMagic.LibFoundation.Mathematics.Vector3f> firstVOI, java.util.Vector<WildMagic.LibFoundation.Mathematics.Vector3f> secondVOI, int viewOrientation)
Remove the extra VOIs contours in Dicom space.- Parameters:
zSlice
- axial z slice numberzDicom
- z slice number corresponding Dicom valueimage
- original MRI imagefirstVOI
- sagittal VOIsecondVOI
- coronal VOIviewOrientation
- view axis
-
convertVOIToDicomSpace
public void convertVOIToDicomSpace(VOIVector src, java.util.Vector<WildMagic.LibFoundation.Mathematics.Vector3f> target, ModelImage image, int startSlice, int endSlice)
Conver the VOIs from image space to Dicom space- Parameters:
src
- source VOIstarget
- converted target VOIsimage
- original MRI imagestartSlice
- starting sliceendSlice
- ending slice
-
createTask
private java.lang.Runnable createTask(ModelImage image, int midVOI, int startVOI, int endVOI, int axis)
Parallel processing the automatic segmentation algorithm to all the three images concurrently.- Parameters:
image
- original MRI imagemidVOI
- mid slice VOIstartVOI
- apex slice VOIendVOI
- base slice VOIaxis
- view axis- Returns:
-
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.
-
pause
public static void pause()
Pauses the display until the user hits enter.
-
calculateCoherenceEnhancingDiffusion
private ModelImage calculateCoherenceEnhancingDiffusion(ModelImage cropImage)
Apply the coherence enhancing diffusion filter to the croppred MR image.- Parameters:
cropImage
- cropped image- Returns:
- the coherence enhancing diffusion image.
-
isVOIsCloseEnough
private boolean isVOIsCloseEnough(int currentSlice, ModelImage resultImage, ModelImage refImage)
Check the registration accuracy. Check to see if the registration runs into errors. Check criterion include VOI area, VOI center, etc. If area and center difference exceed specified threshold, registration runs into error.- Parameters:
currentSlice
- current image sliceresultImage
- result image after registrationrefImage
- registration reference slice- Returns:
- true registration wrong, false, registration wrong.
-
segmentFromFuzzyC
public void segmentFromFuzzyC(java.util.Vector<java.util.Vector<ModelImage>> imageStackFuzzyC, int currentSlice, ModelImage resultImage, ModelImage refImage, ModelImage testImage, int axis)
Apply the Fuzzy-C means segmentation to CED image stack.- Parameters:
imageStackFuzzyC
- Fuzzy-C segmentation result stack packed from each image slice. It contains 5 fuzzy-C member function classes.currentSlice
- current slice numberresultImage
- result imagerefImage
- reference imagetestImage
- test imageaxis
- axis orientation.
-
createVOIPointTable
private void createVOIPointTable(JDialogProstateSegmentationRegBSpline3D.Edge voiTable, ModelImage resultImage)
Create the VOI table in polar coodinate system. It will be used in the narrow band finding.- Parameters:
voiTable
- result VOI points table.resultImage
- result image after registration.
-
createImagePointTable
public void createImagePointTable(JDialogProstateSegmentationRegBSpline3D.Edge imageTable, ModelImage resultImage)
Convert each image pixel to polar coordinate system, saved them in a table.- Parameters:
imageTable
- image table.resultImage
- result image after registration.
-
findNarrowBand
public void findNarrowBand(JDialogProstateSegmentationRegBSpline3D.Edge voiTable, JDialogProstateSegmentationRegBSpline3D.Edge imageTable, JDialogProstateSegmentationRegBSpline3D.Edge narrowBandTable)
Find the narrow band regions around VOI contours.- Parameters:
voiTable
- VOI tableimageTable
- image tablenarrowBandTable
- narrow band region table.
-
drawNarrowBand
public void drawNarrowBand(JDialogProstateSegmentationRegBSpline3D.Edge narrowBandTable, ModelImage resultImage)
Draw the narrow band region. It is used for testing purpose.- Parameters:
narrowBandTable
- narrow band region table.resultImage
- result image after registration.
-
findRegion
public void findRegion(JDialogProstateSegmentationRegBSpline3D.Edge imageTable, float theta1, float theta2, java.util.Vector<JDialogProstateSegmentationRegBSpline3D.PolarPoint> voiPointsInRange, JDialogProstateSegmentationRegBSpline3D.Edge narrowBandTable)
Looking for the narrow band region.- Parameters:
imageTable
- image tabletheta1
- upper limittheta2
- lower limitvoiPointsInRange
- Vois point tablenarrowBandTable
- narrow band table.
-
inRange
public boolean inRange(JDialogProstateSegmentationRegBSpline3D.Edge narrowBandTable, int x, int y)
Check whether the given x, y pixel fall withing the narrow band region.- Parameters:
narrowBandTable
- narrow band tablex
- pixel x coordinatey
- pixel y coordinate- Returns:
- in the range or not.
-
findVOIpointsInRange
public void findVOIpointsInRange(JDialogProstateSegmentationRegBSpline3D.Edge imageTable, java.util.Vector<JDialogProstateSegmentationRegBSpline3D.PolarPoint> voiPointsInRange, int min, int max, JDialogProstateSegmentationRegBSpline3D.Edge voiTable)
Tracing generated VOI tables, convert it from image coordinate to Polar coordinate.- Parameters:
imageTable
- image tablevoiPointsInRange
- VOI table in polar coordinatemin
- narrow band lower limitmax
- narrow band upper limitvoiTable
- voi table in image coordinate
-
morphologyPostProcessing
public void morphologyPostProcessing(ModelImage maskImage, ModelImage resultImage, ModelImage testImage)
Apply the morphology filter the generate binary mask image from Fuzz-C segmentation.- Parameters:
maskImage
- generated binary mask imageresultImage
- resulting imagetestImage
- intermediate image.
-
maskVOIFill
public void maskVOIFill(ModelImage maskImage)
Fill pixels inside VOI. Currently not being used. For testing purpose.- Parameters:
maskImage
-
-
smoothVOI50
public void smoothVOI50(ModelImage maskImage, ModelImage resultImage)
Convert the mask image to VOI with 50 points- Parameters:
maskImage
- binary mask imageresultImage
- result image
-
smoothVOI120
public void smoothVOI120(ModelImage maskImage, ModelImage resultImage)
Convert the mask image to VOI with 120 points.- Parameters:
maskImage
- binary mask imageresultImage
- result image
-
maskToVOI
public void maskToVOI(ModelImage maskImage, ModelImage testImage)
Convert mask image to VOI- Parameters:
maskImage
- binary mask imagetestImage
- intermediate image.
-
IDobjects
public void IDobjects(ModelImage maskImage)
Eliminate the small binary mask components. Pixel numbers threshold based elimination.- Parameters:
maskImage
-
-
particleSystem
public void particleSystem(ModelImage maskImage)
Particle system analysis.- Parameters:
maskImage
- binary mask image
-
fillholes
public void fillholes(ModelImage maskImage)
Fill holes inside the binary mask image.- Parameters:
maskImage
- binary mask image.
-
threshold
public void threshold(ModelImage maskImage)
Convert the mask image specified theshold values.- Parameters:
maskImage
- binary mask image
-
isInsideVOI
public boolean isInsideVOI(int pos, ModelImage img)
check if given pixl location is inside VOI or not.- Parameters:
pos
- pixl locationimg
- given image- Returns:
-
transformVOI
public void transformVOI(ModelImage image, ModelImage resultImage, int[] boundingBox, int currentSlice)
Transform the the resulting VOI from cropped image to oringal MR image.- Parameters:
image
- original MR imageresultImage
- resulting image after segmentationboundingBox
- cropped image bounding boxcurrentSlice
- current image slice
-
callAlgorithm
public void callAlgorithm(ModelImage image, int midVOI, int startVOI, int endVOI, int axis)
Single thread based segmentation, which takes up to 40 minutes. The currrent concurrent based segmentaion takes from 7 minutes to 10 minutes. The function is not called.- Parameters:
image
-midVOI
-startVOI
-endVOI
-axis
-
-
sortImageVOIs
public void sortImageVOIs(ModelImage image)
Sorting image VOI- Parameters:
image
- original MR image
-
sortImageVOIsInit
public void sortImageVOIsInit(ModelImage image, int midVOI, int startVOI, int endVOI)
Sort the original MR image's specified VOIs- Parameters:
image
- original MR imagemidVOI
- mid slice VOIstartVOI
- apex slice VOIendVOI
- base slice VOI
-
sortCEDImageVOIs
public void sortCEDImageVOIs(ModelImage coherenceEnhancingDiffusionImage, int midVOI, int startVOI, int endVOI)
Sort the CED image VOIs- Parameters:
coherenceEnhancingDiffusionImage
- CED imagemidVOI
- mid slice VOIstartVOI
- apex slice VOIendVOI
- base slice VOI
-
doFuzzyCmean
public void doFuzzyCmean(ModelImage coherenceEnhancingDiffusionImage, java.util.Vector<java.util.Vector<ModelImage>> imageStackFuzzyC)
Generate the Fuzzy-C means classes from the CED image- Parameters:
coherenceEnhancingDiffusionImage
- CED imageimageStackFuzzyC
- Fuzzy-C means classes image stack.
-
getCentroids
private float[] getCentroids(ModelImage srcImage, AlgorithmFuzzyCMeans fcmAlgo, float[] centroids)
Gets the minimum and maximum of each image and initializes the centroids dialog appropriately.- Returns:
- Flag indicating a successful get.
-
doRegistrationMid
public void doRegistrationMid(ModelImage image, ModelImage coherenceEnhancingDiffusionImage, java.util.Vector<java.util.Vector<ModelImage>> imageStackFuzzyC, int midVOI, int startVOI, int endVOI, int[] boundingBox, int axis)
The proposed model uses 2D registration to register 2D slices from the middle slice to the adjacent slice. It then generates a new VOI, and takes the VOI as the new initial estimate for the next slice in the series. This process is then iteratively propagated in both forward and backward directions.- Parameters:
image
- original MR imagecoherenceEnhancingDiffusionImage
- coherence enhance diffusion filterimageStackFuzzyC
- Fuzzy-C segmentation stackmidVOI
- mid slice VOIstartVOI
- apex slice VOIendVOI
- base slice VOIboundingBox
- Cropped image bounding boxaxis
- axis orientation
-
doRegistrationStart
public void doRegistrationStart(ModelImage image, ModelImage coherenceEnhancingDiffusionImage, java.util.Vector<java.util.Vector<ModelImage>> imageStackFuzzyC, int startVOI, int[] boundingBox, int axis)
Near the apex, apex contour starts as the initial estimate, and repeat the same process toward the end slices.- Parameters:
image
- original MR imagecoherenceEnhancingDiffusionImage
- coherence enhance diffusion filterimageStackFuzzyC
- Fuzzy-C segmentation stackstartVOI
- apex starting slice VOI numberboundingBox
- Cropped image bounding boxaxis
- axis orientation
-
doRegistrationEnd
public void doRegistrationEnd(ModelImage image, ModelImage coherenceEnhancingDiffusionImage, java.util.Vector<java.util.Vector<ModelImage>> imageStackFuzzyC, int endVOI, int[] boundingBox, int axis)
Near the base, base contour starts as the initial estimate, and repeat the same process toward the end slices.- Parameters:
image
- original MR imagecoherenceEnhancingDiffusionImage
- coherence enhance diffusion filterimageStackFuzzyC
- Fuzzy-C segmentation stackstartVOI
- apex starting slice VOI numberboundingBox
- Cropped image bounding boxaxis
- axis orientation
-
adjustVOIs
public void adjustVOIs(ModelImage image)
When user draws the 3 VOIs out of order, adjust the VOIs in ascending order- Parameters:
image
- source image, axial, sagittal or coronal
-
cropROI
public ModelImage cropROI(ModelImage image, int[] xBounds, int[] yBounds, int[] zBounds, int[] boundingBox, int midVOI)
Crop MR image with specified X, Y, Z bounds Use the mid slice as the initial guidance to find the bounds.- Parameters:
image
- Original MR imagexBounds
- X boundsyBounds
- Y boundszBounds
- Z boundsboundingBox
- Cropped region rounding boxmidVOI
- mid slice VOI- Returns:
-
init
public void init()
Create the dialog interface.
-
-