Class VOIManagerInterface
- java.lang.Object
-
- gov.nih.mipav.view.renderer.WildMagic.VOI.VOIManagerInterface
-
- All Implemented Interfaces:
VOIListener
,VOIVectorListener
,VOIHandlerInterface
,java.awt.event.ActionListener
,java.awt.event.MouseListener
,java.awt.event.MouseMotionListener
,java.util.EventListener
,javax.swing.event.MouseInputListener
- Direct Known Subclasses:
VOILatticeManagerInterface
public class VOIManagerInterface extends java.lang.Object implements java.awt.event.ActionListener, VOIHandlerInterface, VOIListener, VOIVectorListener
VOIManagerInterface manages all the VOI user-interaction for classes that display the ModelImage. ViewJFrameImage, ViewJFrameTriImage, ViewJFrameRegistration, ViewJFrameRegistrationTool, and the VolumeTriPlanarInterface class for the GPU-based volume renderer. This class further divides the VOI user-interaction into actions that occur within a single canvas and actions that are shared across canvases. All user-interaction that occurs within a single canvas, for example direct user-manipulation of a single VOI contour, adding points, moving points, etc. are managed by the VOIManager class. The ViewJFrameTriImage has three canvases when displaying a single ModelImage. Each canvas is tied to a separate VOIManager class, which handles all the direct user-manipulation of the VOIs it displays. The VOIManagerInterface class contains the three VOIManagers and handles the communication between the VOIManager and the VOI, the ModelImage containing the VOI, and the class displaying the ModelImage.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) class
VOIManagerInterface.OkColorListener
Pick up the selected color and call method to change the color.
-
Field Summary
Fields Modifier and Type Field Description protected ViewJColorChooser
colorChooser
Reference to the color chooser.protected java.awt.Color
currentColor
Restores the VOI color button after QuickLUT.protected JDialogVOIStatistics
imageStatList
Statistics dialog VOI->Statistics generator...protected javax.swing.event.EventListenerList
listenerList
created to handle VOI updates.private WildMagic.LibFoundation.Mathematics.Vector3f[]
m_akBounds
Bounding box for a group of selected VOIs for group-move.private boolean
m_bDefaultImage
private boolean
m_bGPURenderer
Set to true if this VOIManagerInterface is used for the GPU-based Volume Rendererprivate float
m_fOpacity
Opacity for setting the JDialogOpacityControls, used for VOI opacity.private int
m_iActive
The index of the current active VOIManager.private int
m_iMaxUndo
private java.util.Vector<VOIBase>
m_kActiveList
List of active VOIBase for a moving several selected VOIs.protected VOI
m_kCurrentVOIGroup
The current active VOIprotected ModelImage
m_kImageA
Reference to imageAprivate java.lang.Object
m_kImageARedo
Single-level undo/redo for image masks, re-do-imageA:private java.lang.Object
m_kImageAUndo
Single-level undo/redo for image masks, undo-imageA:protected ModelImage
m_kImageB
Reference to imageBprivate java.lang.Object
m_kImageBRedo
Single-level undo/redo for image masks, re-do-imageB:private java.lang.Object
m_kImageBUndo
Single-level undo/redo for image masks, undo-imageB:protected VOIManagerInterfaceListener
m_kParent
Reference to the parent frame.private javax.swing.JToggleButton
m_kPointerButton
The Default pointer button is set from outside this class if the default pointer button is not part of the VOI toolbar, or if the VOI toolbar is not displayed.private java.util.Vector<java.lang.String>
m_kRedoCommands
List of re-do commandsprotected java.util.Vector<VOISaveState>
m_kRedoList
Saved VOI states for re-do.private ModelImage
m_kTempImage
private java.util.Vector<java.lang.String>
m_kUndoCommands
List of undo commandsprotected java.util.Vector<VOISaveState>
m_kUndoList
Saved VOI states for undo.protected JDialogVOIStats
m_kVOIDialog
VOI Properties dialog -- from the popup menu or drop-down menu.private JDialogVOIHausdorffDistance
m_kVOIHausdorffDistanceDialog
private JDialogVOILogicalOperations
m_kVOILogicalOperationsDialog
protected java.util.Vector<VOIManager>
m_kVOIManagers
List of VOIManagers, one per canvas displayed.private javax.swing.JToolBar
m_kVOIToolbar
Reference to the VOI toolbar.protected ViewJPopupVOI
popup
Popup Menu for VOIs (non-point).protected ViewJPopupPt
popupPt
Popup Menu for VOIPoints.private float
presetHue
protected VolumeTriPlanarRenderBase
renderer
protected VOI
saveGroup
Restores the current VOI after QuickLUT.private ViewToolBarBuilder
toolbarBuilder
The toolbar builder that constructs the VOI toolbar -- it stores the VOI color button.protected javax.swing.JMenu
voiMenu
protected ViewMenuBuilder
voiMenuBuilder
private int
voiUID
VOI ID used to set the VOI color button on a call to newVOI()
-
Constructor Summary
Constructors Constructor Description VOIManagerInterface(VOIManagerInterfaceListener kParent, ModelImage kImageA, ModelImage kImageB, int iNViews, boolean bGPU, javax.swing.ButtonGroup kVOIGroup)
Creates a VOIManagerInterface object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
actionPerformed(java.awt.event.ActionEvent event)
void
addedCurve(VOIEvent added)
handles an VOIEvent as a selection change.void
addedVOI(VOIVectorEvent newVOIselection)
handles an VOIEvent as a selection change.private void
addVOI(ModelImage kImage, VOIBase kNew, boolean bQuickLUT, boolean bUpdate, boolean isFinished)
void
addVOI(VOIBase kNew, boolean bQuickLUT, boolean bUpdate, boolean isFinished)
Add a new VOIBase.VOIManager
addVOIManager(ModelImage kImageA, ModelImage kImageB, java.awt.Component kComponent, ScreenCoordinateListener kContext, int iOrientation)
void
addVOIUpdateListener(UpdateVOISelectionListener listener)
Adds a UpdateVOISelectionListener.private void
advanceVOIUID()
Increments the VOI uid for internal tracking, used during both creation and loading of a new VOIvoid
algorithmPerformed()
private void
changeVOIOrder(boolean doContour, int direction)
private boolean
checkForActiveVOIs()
private void
clearList(java.util.Vector<VOISaveState> list, int limit)
void
clearUndoRedo()
void
colorChanged(java.awt.Color c)
private int
copy()
private void
createMask(ModelImage kActive, boolean bInside)
private void
createMask(java.lang.String command)
private int
cut()
private void
deleteActiveVOI()
private void
deleteAllVOI()
void
deleteSelectedVOI(boolean contoursOnly)
Delete the selected VOI.void
deleteVOI(VOIBase kOld, boolean update)
Deletes the input VOIBase from the VOI.private void
deleteVOIActivePt()
void
deleteVOIs()
Delete all VOIs.void
disposeLocal(boolean flag)
Dispose of the implementing class.void
doVOI(java.lang.String kCommand)
Performs the VOI Action Command.private void
evolveBoundary2D(java.lang.String command)
private void
exportSelectedVOIs()
java.lang.String
extractNumber(java.lang.String str)
private void
findCompatibleType(ModelImage kImage, VOIBase kNew, boolean isFinished)
void
fireVOISelectionChange(VOI voi)
Communicates a selection change to all UpdateVOISelectionListeners.void
fireVOISelectionChange(VOI voi, VOIBase curve)
Communicates a selection change to all UpdateVOISelectionListeners.ModelImage
getActiveImage()
Returns the current active image.private int
getActiveVOICount()
float
getBufferFloat(byte[] buffer, int index, boolean bigEndian)
Converts byte data to float data.int
getBufferInt(byte[] buffer, int index, boolean bigEndian)
Converts byte data to int data.short
getBufferShort(byte[] buffer, int index, boolean bigEndian)
Converts byte data to short data.short
getByte(byte[] buffer, int index)
java.awt.Component
getComponentImage()
Returns the Component displaying the current active image.private javax.swing.JFrame
getFrame()
javax.swing.JToggleButton
getPointerButton()
Returns the pointer button, used by VOIManager to determine if the pointer button is active.private int
getSegment(float[] array, float[] seg, int index)
private int
getSlice()
javax.swing.JToolBar
getToolBar()
Returns the VOIToolbar.int
getVOI_ID()
VOIManager
getVOIManager(int i)
Returns the VOIManager at the given position.int
getVOIManagerNum()
Returns the number of VOIManagers controlled by this VOIHandler.protected VOISaveState
getVOIState()
void
graph25VOI_CalcInten(boolean totalIntensity, boolean useThreshold, float threshold)
Generates and displays a 1D graph of the average or total intensity of 2.5 VOI of 2.5D image (3D).private void
graphPointVOI(VOI v, VOIPoint voiPt, int j, boolean useFrameRefTime)
private void
graphVOI()
private void
graphVOICurvature(boolean smooth)
private void
importVOI()
private void
indentationVOIs2D()
protected void
initVOIManagers(int iNViews)
private void
interpolateVOIs()
private boolean
isDrawCommand(java.lang.String kCommand)
boolean
isNewVoiNeeded(int voiType)
private void
levelSet3D()
protected void
loadAllImageJVOIsFrom(java.lang.String voiDir, boolean quietMode, VOIVector resultVector, boolean registerVOIs)
This method loads all ImageJ VOIs to the active image from a given directory.private void
loadAllVOIs(boolean quietMode)
This method loads all VOIs to the active image from the default VOI directory for that image.private void
loadAllVOIsFrom(java.lang.String voiDir, boolean quietMode)
This method loads all VOIs to the active image from a given directory.protected void
loadAllVOIsFrom(java.lang.String voiDir, boolean quietMode, VOIVector resultVector, boolean registerVOIs)
This method loads all VOIs to the active image from a given directory.boolean
make3DVOI(boolean bIntersection, ModelImage kVolume)
Creates a 3D Surface out of the VOIs.private boolean
make3DVOI(boolean bIntersection, ModelImage kSrc, ModelImage kVolume, java.util.BitSet kMask, VOIManager kManager, int iValue)
private void
makeShapeFromArray(float[] array, java.util.Vector<java.util.Vector<java.lang.Integer>> xVector, java.util.Vector<java.util.Vector<java.lang.Integer>> yVector)
private boolean
matches(int iType1, int iType2, boolean isFinished)
void
mouseClicked(java.awt.event.MouseEvent event)
void
mouseDragged(java.awt.event.MouseEvent arg0)
void
mouseEntered(java.awt.event.MouseEvent e)
void
mouseExited(java.awt.event.MouseEvent e)
void
mouseMoved(java.awt.event.MouseEvent arg0)
void
mousePressed(java.awt.event.MouseEvent e)
void
mouseReleased(java.awt.event.MouseEvent e)
void
moveVOI(VOIManager kActive, WildMagic.LibFoundation.Mathematics.Vector3f kDiff, int iPlane, boolean bFirstMove, boolean bUseMouse)
Called from the VOIManager class when multiple contours are selected and moved as a group.void
moveVOI(java.lang.String kCommand, float fScale)
void
newVOI(boolean bPropagate, boolean bSplit)
Initiate a new VOI.void
newVOI(float presetHue)
Initiate a new VOI.private boolean
openOtherOrientationVOI(boolean quietMode)
private boolean
openPaint(boolean quietMode)
private boolean
openVOI(boolean quietMode, boolean doLabels)
This method opens an existing VOI.private void
paintToVOI()
private void
paste()
private void
pasteAll()
private void
pasteFromViewUserInterface()
void
pasteVOI(VOIBase kNew)
Paste the input VOIBase.private void
propagate(int dir)
boolean
propVOI(int direction, boolean active)
Propagates the selected VOI in a given direction.boolean
propVOIAll()
Propagates the selected VOI to all slices.void
quickLUT(VOIBase kLUT)
Called from the VOIManager class when a user has drawn the QuickLUT rectangle.private void
quickLUT(WildMagic.LibFoundation.Mathematics.Vector3f[] akMinMax, ModelImage image, ModelLUT LUT)
method that performs the quick LUT operationprivate void
quickRGB(WildMagic.LibFoundation.Mathematics.Vector3f[] akMinMax, ModelImage image, ModelRGB RGB)
DOCUMENT ME!private void
readCSV(java.lang.String fileName, ModelImage image)
private void
readFreesurferBinaryPatch(java.lang.String fileName, ModelImage image)
private void
readImageJ(java.lang.String pathName, java.lang.String fileName, ModelImage image)
private void
redoImage()
private void
redoVOI()
protected void
redoVOIs()
void
removedCurve(VOIEvent removed)
handles to the VOI being removed from the Vector.void
removedVOI(VOIVectorEvent removed)
handles to the VOI being removed from the Vector.void
removeVOIManager(VOIManager kVOIManager)
void
removeVOIUpdateListener(UpdateVOISelectionListener listener)
Removes the UpdateVOISelectionListener from the list.void
resetLivewire()
Resets the current livewire VOI.private void
saveAllVOIs()
This method saves all VOIs for the active image to the default VOI directory for that image.private void
saveAllVOIsTo(java.lang.String voiDir)
This method saves all VOIs for the active image to a given directory.private void
saveImage(java.lang.String kCommand)
Save the dicom matrix header info.private void
saveLabels(boolean saveAll)
private void
savePaint()
private void
savePaintAs()
This method allows the user to choose how to save the paint bitmap.private void
saveVOI(boolean saveAllContours)
This method saves a selected VOIprivate void
saveVOIAs(boolean saveAllContours)
This method allows the user to choose how to save the VOI.private void
saveVOIIntensities()
Save intensities in VOI to a text file of format x,y,z,intensity on each line if not color or complex.private void
saveVOIIntensitiesTo(java.lang.String voiIntensitiesPath)
Save intensities in VOI to a text file of format x,y,z,intensity on each line if not color or complex.void
saveVOIs(java.lang.String kCommand)
Save the current VOIState to the undo/re-do list.void
selectAllVOIs(boolean bActive)
Selects all VOIs.void
selectedVOI(VOIEvent selection)
handles the VOI being selected. -- a state-change.void
setActive(VOIManager kManager, ModelImage kActiveImage)
Called from the VOIManager.void
setButtonColor(javax.swing.JButton _button, java.awt.Color _color)
Set the color of the button.void
setCenter(WildMagic.LibFoundation.Mathematics.Vector3f center)
Sets the current displayed slice for 3D images.void
setCenter(WildMagic.LibFoundation.Mathematics.Vector3f center, boolean bParent)
Sets the current displayed slice for 3D images.private void
setCurrentColor()
void
setCursor(java.awt.Cursor kCursor)
Called from VOIManager to change the mouse cursor.void
setDefaultCursor()
Called from VOIManager to set the default mouse cursor.void
setEnabled(boolean flag)
Currently not used.private void
setGraphVisible()
void
setOpacity(float fVal)
Called from JDialogOpacityControls.private void
setPAAIGraphVisible()
void
setPointerButton(javax.swing.JToggleButton button)
Called when the Default Pointer Button is not part of the default VOI Toolbar.void
setPresetHue(float presetHue)
Sets the hue that will be used to draw the new VOI.void
setRenderer(VolumeTriPlanarRenderBase renderer)
void
setSelectedVOI(VOI kSelected, boolean bSelectAll, boolean bUnSelectVOI)
Called from the VOIManager when a new VOI is selected by the mouse.void
setVOI_IDs(int ID, int UID)
This function is deprecated.protected void
setVOIState(VOISaveState kVOIState)
void
setVOITools(javax.swing.JMenu voiMenu, ViewMenuBuilder voiMenuBuilder)
void
showColorDialog()
Opens the color dialog for changing the selected VOI color.void
showCurvatureInfo(VOIBase kVOI, int m_iPlane, boolean showGraph, boolean smoothCurvature)
Called from the VOIManager.void
showIntensityInfo(VOIBase kVOI, int m_iPlane, boolean showGraph)
Called from the VOIManager.protected void
showStatisticsCalculator()
Opens a JDialogStatistics to allow computation ofROI statistics.protected void
showVOIProperties()
private void
undoImage()
private void
undoVOI()
protected void
undoVOIs()
void
updateDisplay()
Called from VOIManager.void
updateGraph(VOIBase kVOI, int m_iPlane)
Called from the VOIManager when the VOIBase that is currently being graphed has changed.void
vectorSelected(VOIVectorEvent selection)
handles the VOI being selected.
-
-
-
Field Detail
-
m_kParent
protected VOIManagerInterfaceListener m_kParent
Reference to the parent frame.
-
m_kImageA
protected ModelImage m_kImageA
Reference to imageA
-
m_kImageB
protected ModelImage m_kImageB
Reference to imageB
-
toolbarBuilder
private ViewToolBarBuilder toolbarBuilder
The toolbar builder that constructs the VOI toolbar -- it stores the VOI color button.
-
m_kVOIToolbar
private javax.swing.JToolBar m_kVOIToolbar
Reference to the VOI toolbar.
-
colorChooser
protected ViewJColorChooser colorChooser
Reference to the color chooser.
-
m_kVOIManagers
protected java.util.Vector<VOIManager> m_kVOIManagers
List of VOIManagers, one per canvas displayed.
-
m_iActive
private int m_iActive
The index of the current active VOIManager.
-
voiUID
private int voiUID
VOI ID used to set the VOI color button on a call to newVOI()
-
m_kCurrentVOIGroup
protected VOI m_kCurrentVOIGroup
The current active VOI
-
m_kUndoCommands
private java.util.Vector<java.lang.String> m_kUndoCommands
List of undo commands
-
m_kRedoCommands
private java.util.Vector<java.lang.String> m_kRedoCommands
List of re-do commands
-
m_fOpacity
private float m_fOpacity
Opacity for setting the JDialogOpacityControls, used for VOI opacity.
-
m_bGPURenderer
private boolean m_bGPURenderer
Set to true if this VOIManagerInterface is used for the GPU-based Volume Renderer
-
renderer
protected VolumeTriPlanarRenderBase renderer
-
m_kVOIDialog
protected JDialogVOIStats m_kVOIDialog
VOI Properties dialog -- from the popup menu or drop-down menu.
-
m_kVOILogicalOperationsDialog
private JDialogVOILogicalOperations m_kVOILogicalOperationsDialog
-
m_kVOIHausdorffDistanceDialog
private JDialogVOIHausdorffDistance m_kVOIHausdorffDistanceDialog
-
m_iMaxUndo
private int m_iMaxUndo
-
m_kUndoList
protected java.util.Vector<VOISaveState> m_kUndoList
Saved VOI states for undo.
-
m_kRedoList
protected java.util.Vector<VOISaveState> m_kRedoList
Saved VOI states for re-do.
-
m_kImageAUndo
private java.lang.Object m_kImageAUndo
Single-level undo/redo for image masks, undo-imageA:
-
m_kImageARedo
private java.lang.Object m_kImageARedo
Single-level undo/redo for image masks, re-do-imageA:
-
m_kImageBUndo
private java.lang.Object m_kImageBUndo
Single-level undo/redo for image masks, undo-imageB:
-
m_kImageBRedo
private java.lang.Object m_kImageBRedo
Single-level undo/redo for image masks, re-do-imageB:
-
m_akBounds
private WildMagic.LibFoundation.Mathematics.Vector3f[] m_akBounds
Bounding box for a group of selected VOIs for group-move.
-
listenerList
protected javax.swing.event.EventListenerList listenerList
created to handle VOI updates. Must fireVOIUpdate(...) to get listeners to handle the update. Perhaps better location for the VOIupdate is inViewJCompoenentEditImage
, but this listenerlist will handle listeners of more than one type.
-
popup
protected ViewJPopupVOI popup
Popup Menu for VOIs (non-point).
-
popupPt
protected ViewJPopupPt popupPt
Popup Menu for VOIPoints.
-
currentColor
protected java.awt.Color currentColor
Restores the VOI color button after QuickLUT.
-
saveGroup
protected VOI saveGroup
Restores the current VOI after QuickLUT.
-
m_kActiveList
private java.util.Vector<VOIBase> m_kActiveList
List of active VOIBase for a moving several selected VOIs.
-
m_kPointerButton
private javax.swing.JToggleButton m_kPointerButton
The Default pointer button is set from outside this class if the default pointer button is not part of the VOI toolbar, or if the VOI toolbar is not displayed. The VOIManagers query the default pointer button to determine if VOI interaction is enabled.
-
imageStatList
protected JDialogVOIStatistics imageStatList
Statistics dialog VOI->Statistics generator...
-
presetHue
private float presetHue
-
m_bDefaultImage
private boolean m_bDefaultImage
-
m_kTempImage
private ModelImage m_kTempImage
-
voiMenu
protected javax.swing.JMenu voiMenu
-
voiMenuBuilder
protected ViewMenuBuilder voiMenuBuilder
-
-
Constructor Detail
-
VOIManagerInterface
public VOIManagerInterface(VOIManagerInterfaceListener kParent, ModelImage kImageA, ModelImage kImageB, int iNViews, boolean bGPU, javax.swing.ButtonGroup kVOIGroup)
Creates a VOIManagerInterface object.- Parameters:
kParent
- the parent frame, must be a VOIManagerInterfaceListenerkImageA
- imageAkImageB
- imageBiNViews
- number of views displayed in the parent.bGPU
- set to true if this VOIManagerInterface is part of the GPU-based Volume Renderer.kVOIGroup
- for ViewJFrameImage and ViewJFrameTriImage, so the VOI Toolbar can be part of a larger button group.
-
-
Method Detail
-
actionPerformed
public void actionPerformed(java.awt.event.ActionEvent event)
- Specified by:
actionPerformed
in interfacejava.awt.event.ActionListener
-
addedCurve
public void addedCurve(VOIEvent added)
Description copied from interface:VOIListener
handles an VOIEvent as a selection change.- Specified by:
addedCurve
in interfaceVOIListener
- Parameters:
added
- DOCUMENT ME!
-
addedVOI
public void addedVOI(VOIVectorEvent newVOIselection)
Description copied from interface:VOIVectorListener
handles an VOIEvent as a selection change.- Specified by:
addedVOI
in interfaceVOIVectorListener
- Parameters:
newVOIselection
- DOCUMENT ME!
-
addVOI
public void addVOI(VOIBase kNew, boolean bQuickLUT, boolean bUpdate, boolean isFinished)
Add a new VOIBase. This function should only be called from VOIManager when a new VOIBase is created with the mouse.- Parameters:
kNew
- the new VOIBase to add.bQuickLUT
- true if this is a QuickLUT VOI.bUpdate
- when true call updateDisplay() after the VOIBase is addedisFinished
- true if this VOIBase is complete, used for open contours.
-
addVOIManager
public VOIManager addVOIManager(ModelImage kImageA, ModelImage kImageB, java.awt.Component kComponent, ScreenCoordinateListener kContext, int iOrientation)
-
addVOIUpdateListener
public void addVOIUpdateListener(UpdateVOISelectionListener listener)
Adds a UpdateVOISelectionListener.- Specified by:
addVOIUpdateListener
in interfaceVOIHandlerInterface
- Parameters:
listener
- will receive VOI selection events.
-
algorithmPerformed
public void algorithmPerformed()
-
colorChanged
public void colorChanged(java.awt.Color c)
- Specified by:
colorChanged
in interfaceVOIListener
-
deleteSelectedVOI
public void deleteSelectedVOI(boolean contoursOnly)
Description copied from interface:VOIHandlerInterface
Delete the selected VOI. This function is deprecated, replace with actionPerformed() using CustomUIBuilder.PARAM_VOI_DELETE- Specified by:
deleteSelectedVOI
in interfaceVOIHandlerInterface
- Parameters:
contoursOnly
- when true only delete the selected contours in the VOI, do not delete the VOI.
-
deleteVOI
public void deleteVOI(VOIBase kOld, boolean update)
Deletes the input VOIBase from the VOI. If it is the only VOIBase in the VOI, that VOI is removed from the ModelImage. This function is called from VOIManager.- Parameters:
kOld
- the VOIBase to remove.
-
deleteVOIs
public void deleteVOIs()
Description copied from interface:VOIHandlerInterface
Delete all VOIs.- Specified by:
deleteVOIs
in interfaceVOIHandlerInterface
-
disposeLocal
public void disposeLocal(boolean flag)
Description copied from interface:VOIHandlerInterface
Dispose of the implementing class.- Specified by:
disposeLocal
in interfaceVOIHandlerInterface
- Parameters:
flag
- not used.
-
doVOI
public void doVOI(java.lang.String kCommand)
Performs the VOI Action Command. See CustomUIBuilder. This function should be replaced withe actionPerformed(ActionEvent).- Parameters:
kCommand
- VOI action command.
-
fireVOISelectionChange
public void fireVOISelectionChange(VOI voi)
Description copied from interface:VOIHandlerInterface
Communicates a selection change to all UpdateVOISelectionListeners.- Specified by:
fireVOISelectionChange
in interfaceVOIHandlerInterface
- Parameters:
voi
- the modified VOI.
-
fireVOISelectionChange
public void fireVOISelectionChange(VOI voi, VOIBase curve)
Description copied from interface:VOIHandlerInterface
Communicates a selection change to all UpdateVOISelectionListeners.- Specified by:
fireVOISelectionChange
in interfaceVOIHandlerInterface
- Parameters:
voi
- modified VOI.curve
- modified VOIBase.
-
getActiveImage
public ModelImage getActiveImage()
Description copied from interface:VOIHandlerInterface
Returns the current active image.- Specified by:
getActiveImage
in interfaceVOIHandlerInterface
- Returns:
- current active image.
-
getComponentImage
public java.awt.Component getComponentImage()
Description copied from interface:VOIHandlerInterface
Returns the Component displaying the current active image.- Specified by:
getComponentImage
in interfaceVOIHandlerInterface
- Returns:
- the Component displaying the current active image.
-
getPointerButton
public javax.swing.JToggleButton getPointerButton()
Returns the pointer button, used by VOIManager to determine if the pointer button is active.- Returns:
- current pointer button.
-
getToolBar
public javax.swing.JToolBar getToolBar()
Returns the VOIToolbar.- Returns:
- VOIToolbar.
-
getVOI_ID
public int getVOI_ID()
- Specified by:
getVOI_ID
in interfaceVOIHandlerInterface
- Returns:
- 0.
-
getVOIManager
public VOIManager getVOIManager(int i)
Returns the VOIManager at the given position.- Parameters:
i
- the index of the VOIManager to return.- Returns:
- VOIManager.
-
getVOIManagerNum
public int getVOIManagerNum()
Returns the number of VOIManagers controlled by this VOIHandler.
-
graph25VOI_CalcInten
public void graph25VOI_CalcInten(boolean totalIntensity, boolean useThreshold, float threshold)
Description copied from interface:VOIHandlerInterface
Generates and displays a 1D graph of the average or total intensity of 2.5 VOI of 2.5D image (3D).- Specified by:
graph25VOI_CalcInten
in interfaceVOIHandlerInterface
- Parameters:
totalIntensity
- if true calculates total sum of the intensity else calculates the average pixel intensityuseThreshold
- whether or not to threshold this intensity plotthreshold
- the threshold value to use, if thresholding.
-
isNewVoiNeeded
public boolean isNewVoiNeeded(int voiType)
- Specified by:
isNewVoiNeeded
in interfaceVOIHandlerInterface
- Returns:
- false
-
make3DVOI
public boolean make3DVOI(boolean bIntersection, ModelImage kVolume)
Creates a 3D Surface out of the VOIs.- Parameters:
bIntersection
- when true the intersection of the VOIs is used to create the surface, when false a union of the VOIs is used to create the surface.kVolume
- ModelImage, the union or intersection is written into the input ModelImage.- Returns:
- true if success, false if no voxels are in the union or intersection.
-
mouseClicked
public void mouseClicked(java.awt.event.MouseEvent event)
- Specified by:
mouseClicked
in interfacejava.awt.event.MouseListener
-
mouseDragged
public void mouseDragged(java.awt.event.MouseEvent arg0)
- Specified by:
mouseDragged
in interfacejava.awt.event.MouseMotionListener
-
mouseEntered
public void mouseEntered(java.awt.event.MouseEvent e)
- Specified by:
mouseEntered
in interfacejava.awt.event.MouseListener
-
mouseExited
public void mouseExited(java.awt.event.MouseEvent e)
- Specified by:
mouseExited
in interfacejava.awt.event.MouseListener
-
mouseMoved
public void mouseMoved(java.awt.event.MouseEvent arg0)
- Specified by:
mouseMoved
in interfacejava.awt.event.MouseMotionListener
-
mousePressed
public void mousePressed(java.awt.event.MouseEvent e)
- Specified by:
mousePressed
in interfacejava.awt.event.MouseListener
-
mouseReleased
public void mouseReleased(java.awt.event.MouseEvent e)
- Specified by:
mouseReleased
in interfacejava.awt.event.MouseListener
-
moveVOI
public void moveVOI(java.lang.String kCommand, float fScale)
-
moveVOI
public void moveVOI(VOIManager kActive, WildMagic.LibFoundation.Mathematics.Vector3f kDiff, int iPlane, boolean bFirstMove, boolean bUseMouse)
Called from the VOIManager class when multiple contours are selected and moved as a group. This function calculates the group bounding box and tests the move to ensure the contours are not moved out of the image bounds.- Parameters:
kActive
- VOIManager initiating the call.kDiff
- the move distanceiPlane
- the plane of the VOIManager (equivalent to Axial, Coronal, Sagittal)bFirstMove
- true if this is the first move for the selected group of contours.
-
newVOI
public void newVOI(boolean bPropagate, boolean bSplit)
Initiate a new VOI.- Parameters:
bPropagate
- when true propagate the newVOI command to the VOIManagers.bSplit
- true if this is a new SplitVOI.
-
newVOI
public void newVOI(float presetHue)
Description copied from interface:VOIHandlerInterface
Initiate a new VOI.- Specified by:
newVOI
in interfaceVOIHandlerInterface
- Parameters:
presetHue
- new VOI color
-
pasteVOI
public void pasteVOI(VOIBase kNew)
Paste the input VOIBase.- Parameters:
kNew
- the enw VOIBase to paste.
-
propVOI
public boolean propVOI(int direction, boolean active)
Description copied from interface:VOIHandlerInterface
Propagates the selected VOI in a given direction. This function is deprecated, replace with actionPerformed(ActionEvent) using CustomUIBuilder.PARAM_VOI_PROPAGATE_UP or CustomUIBuilder.PARAM_VOI_PROPAGATE_DOWN- Specified by:
propVOI
in interfaceVOIHandlerInterface
- Parameters:
direction
- Up +1, or Down -1active
- unused.- Returns:
- true if success, false otherwise
-
propVOIAll
public boolean propVOIAll()
Description copied from interface:VOIHandlerInterface
Propagates the selected VOI to all slices. This function is deprecated, replace with actionPerformed(ActionEvent) using CustomUIBuilder.PARAM_VOI_PROPAGATE_ALL.- Specified by:
propVOIAll
in interfaceVOIHandlerInterface
- Returns:
- true if success, false otherwise
-
quickLUT
public void quickLUT(VOIBase kLUT)
Called from the VOIManager class when a user has drawn the QuickLUT rectangle. This function calculates the new LUT and updates the images.- Parameters:
kLUT
- VOIBase defining the QuickLUT rectangle.
-
removedCurve
public void removedCurve(VOIEvent removed)
Description copied from interface:VOIListener
handles to the VOI being removed from the Vector.- Specified by:
removedCurve
in interfaceVOIListener
- Parameters:
removed
- DOCUMENT ME!
-
removedVOI
public void removedVOI(VOIVectorEvent removed)
Description copied from interface:VOIVectorListener
handles to the VOI being removed from the Vector.- Specified by:
removedVOI
in interfaceVOIVectorListener
- Parameters:
removed
- DOCUMENT ME!
-
removeVOIManager
public void removeVOIManager(VOIManager kVOIManager)
-
removeVOIUpdateListener
public void removeVOIUpdateListener(UpdateVOISelectionListener listener)
Description copied from interface:VOIHandlerInterface
Removes the UpdateVOISelectionListener from the list.- Specified by:
removeVOIUpdateListener
in interfaceVOIHandlerInterface
- Parameters:
listener
- the UpdateVOIselectionListener to remove.
-
resetLivewire
public void resetLivewire()
Description copied from interface:VOIHandlerInterface
Resets the current livewire VOI.- Specified by:
resetLivewire
in interfaceVOIHandlerInterface
-
saveVOIs
public void saveVOIs(java.lang.String kCommand)
Save the current VOIState to the undo/re-do list.- Parameters:
kCommand
- the VOI Action Command about to be issued.
-
clearUndoRedo
public void clearUndoRedo()
-
selectAllVOIs
public void selectAllVOIs(boolean bActive)
Description copied from interface:VOIHandlerInterface
Selects all VOIs. This function is deprecated, replace with actionPerformed(ActionEvent) using CustomUIBuilder.PARAM_VOI_SELECT_ALL and CustomUIBuilder.PARAM_VOI_SELECT_NONE- Specified by:
selectAllVOIs
in interfaceVOIHandlerInterface
-
selectedVOI
public void selectedVOI(VOIEvent selection)
Description copied from interface:VOIListener
handles the VOI being selected. -- a state-change.- Specified by:
selectedVOI
in interfaceVOIListener
- Parameters:
selection
- DOCUMENT ME!
-
setActive
public void setActive(VOIManager kManager, ModelImage kActiveImage)
Called from the VOIManager. Sets the current active VOIManager.- Parameters:
kManager
- calling VOIManager.
-
setButtonColor
public void setButtonColor(javax.swing.JButton _button, java.awt.Color _color)
Set the color of the button. Derived classes may also perform other functions.- Parameters:
_button
- button._color
- color.
-
setCenter
public void setCenter(WildMagic.LibFoundation.Mathematics.Vector3f center)
Description copied from interface:VOIHandlerInterface
Sets the current displayed slice for 3D images. The current center is the slice value of the three orthogonal planes displayed in the ViewJFrameTriImage. When this function is called from ViewJFrameImage the X,Y, parameters are ignored and current slice is the Z-value.- Specified by:
setCenter
in interfaceVOIHandlerInterface
- Parameters:
center
- ModelImage file coordinates representation of the slice values of the three orthogonal image planes.
-
setCenter
public void setCenter(WildMagic.LibFoundation.Mathematics.Vector3f center, boolean bParent)
Description copied from interface:VOIHandlerInterface
Sets the current displayed slice for 3D images. The current center is the slice value of the three orthogonal planes displayed in the ViewJFrameTriImage. When this function is called from ViewJFrameImage the X,Y, parameters are ignored and current slice is the Z-value.- Specified by:
setCenter
in interfaceVOIHandlerInterface
- Parameters:
center
- ModelImage file coordinates representation of the slice values of the three orthogonal image planes.bParent
- when true call parent.setCenter()
-
setCursor
public void setCursor(java.awt.Cursor kCursor)
Called from VOIManager to change the mouse cursor.- Parameters:
kCursor
- new Cursor.
-
setDefaultCursor
public void setDefaultCursor()
Called from VOIManager to set the default mouse cursor. This function triggers events in the parent frame.
-
setEnabled
public void setEnabled(boolean flag)
Currently not used.- Parameters:
flag
-
-
setOpacity
public void setOpacity(float fVal)
Called from JDialogOpacityControls. Sets the VOI opacity.- Parameters:
fVal
- VOI opacity.
-
setPointerButton
public void setPointerButton(javax.swing.JToggleButton button)
Called when the Default Pointer Button is not part of the default VOI Toolbar.- Parameters:
button
- default pointer button.
-
setPresetHue
public void setPresetHue(float presetHue)
Description copied from interface:VOIHandlerInterface
Sets the hue that will be used to draw the new VOI.- Specified by:
setPresetHue
in interfaceVOIHandlerInterface
- Parameters:
presetHue
- the hue to be used
-
setRenderer
public void setRenderer(VolumeTriPlanarRenderBase renderer)
-
setSelectedVOI
public void setSelectedVOI(VOI kSelected, boolean bSelectAll, boolean bUnSelectVOI)
Called from the VOIManager when a new VOI is selected by the mouse.- Parameters:
kSelected
- selected VOI.bSelectAll
- when true select all contours in the VOI (usually shift-key is down).bUnSelectVOI
- when true unselect the previously selected VOI (if the control-key is down multiple different VOIs can be selected).
-
setVOI_IDs
public void setVOI_IDs(int ID, int UID)
Description copied from interface:VOIHandlerInterface
This function is deprecated.- Specified by:
setVOI_IDs
in interfaceVOIHandlerInterface
- Parameters:
ID
- not used.UID
- not used.
-
setVOITools
public void setVOITools(javax.swing.JMenu voiMenu, ViewMenuBuilder voiMenuBuilder)
-
showColorDialog
public void showColorDialog()
Description copied from interface:VOIHandlerInterface
Opens the color dialog for changing the selected VOI color.- Specified by:
showColorDialog
in interfaceVOIHandlerInterface
-
showCurvatureInfo
public void showCurvatureInfo(VOIBase kVOI, int m_iPlane, boolean showGraph, boolean smoothCurvature)
Called from the VOIManager. Displays the Curvature Graph for the input VOIBase.- Parameters:
kVOI
- VOIBase to graph.m_iPlane
- the plane on which to show intensity infoshowGraph
-smooth
-
-
showIntensityInfo
public void showIntensityInfo(VOIBase kVOI, int m_iPlane, boolean showGraph)
Called from the VOIManager. Displays the Intensity Graph for the input VOIBase.- Parameters:
kVOI
- VOIBase to graph.m_iPlane
- the plane on which to show intensity info
-
updateDisplay
public void updateDisplay()
Called from VOIManager. Causes the parent frame to redraw the ModelImage and VOIs.
-
updateGraph
public void updateGraph(VOIBase kVOI, int m_iPlane)
Called from the VOIManager when the VOIBase that is currently being graphed has changed.- Parameters:
kVOI
- the modified VOIBase.
-
vectorSelected
public void vectorSelected(VOIVectorEvent selection)
Description copied from interface:VOIVectorListener
handles the VOI being selected.- Specified by:
vectorSelected
in interfaceVOIVectorListener
- Parameters:
selection
- DOCUMENT ME!
-
addVOI
private void addVOI(ModelImage kImage, VOIBase kNew, boolean bQuickLUT, boolean bUpdate, boolean isFinished)
-
advanceVOIUID
private void advanceVOIUID()
Increments the VOI uid for internal tracking, used during both creation and loading of a new VOI
-
changeVOIOrder
private void changeVOIOrder(boolean doContour, int direction)
-
checkForActiveVOIs
private boolean checkForActiveVOIs()
-
clearList
private void clearList(java.util.Vector<VOISaveState> list, int limit)
-
copy
private int copy()
-
createMask
private void createMask(ModelImage kActive, boolean bInside)
-
createMask
private void createMask(java.lang.String command)
-
cut
private int cut()
-
deleteActiveVOI
private void deleteActiveVOI()
-
deleteAllVOI
private void deleteAllVOI()
-
deleteVOIActivePt
private void deleteVOIActivePt()
-
evolveBoundary2D
private void evolveBoundary2D(java.lang.String command)
-
findCompatibleType
private void findCompatibleType(ModelImage kImage, VOIBase kNew, boolean isFinished)
-
getActiveVOICount
private int getActiveVOICount()
-
getFrame
private javax.swing.JFrame getFrame()
-
getSlice
private int getSlice()
-
getVOIState
protected VOISaveState getVOIState()
-
graphVOI
private void graphVOI()
-
graphVOICurvature
private void graphVOICurvature(boolean smooth)
-
indentationVOIs2D
private void indentationVOIs2D()
-
interpolateVOIs
private void interpolateVOIs()
-
isDrawCommand
private boolean isDrawCommand(java.lang.String kCommand)
-
loadAllVOIs
private void loadAllVOIs(boolean quietMode)
This method loads all VOIs to the active image from the default VOI directory for that image.- Parameters:
quietMode
- if true indicates that warnings should not be displayed.
-
loadAllVOIsFrom
private void loadAllVOIsFrom(java.lang.String voiDir, boolean quietMode)
This method loads all VOIs to the active image from a given directory.- Parameters:
voiDir
- the directory to load voi's fromquietMode
- if true indicates that warnings should not be displayed.
-
loadAllVOIsFrom
protected void loadAllVOIsFrom(java.lang.String voiDir, boolean quietMode, VOIVector resultVector, boolean registerVOIs)
This method loads all VOIs to the active image from a given directory.- Parameters:
voiDir
- the directory to load voi's fromquietMode
- if true indicates that warnings should not be displayed.
-
loadAllImageJVOIsFrom
protected void loadAllImageJVOIsFrom(java.lang.String voiDir, boolean quietMode, VOIVector resultVector, boolean registerVOIs)
This method loads all ImageJ VOIs to the active image from a given directory.- Parameters:
voiDir
- the directory to load voi's fromquietMode
- if true indicates that warnings should not be displayed.
-
make3DVOI
private boolean make3DVOI(boolean bIntersection, ModelImage kSrc, ModelImage kVolume, java.util.BitSet kMask, VOIManager kManager, int iValue)
-
matches
private boolean matches(int iType1, int iType2, boolean isFinished)
-
openVOI
private boolean openVOI(boolean quietMode, boolean doLabels)
This method opens an existing VOI.- Parameters:
quietMode
- if true indicates that warnings should not be displayed.doLabels
- DOCUMENT ME!- Returns:
- whether a VOI was successfully opened (ie - the dialog wasn't cancelled)
-
openOtherOrientationVOI
private boolean openOtherOrientationVOI(boolean quietMode)
-
openPaint
private boolean openPaint(boolean quietMode)
-
paintToVOI
private void paintToVOI()
-
paste
private void paste()
-
levelSet3D
private void levelSet3D()
-
pasteAll
private void pasteAll()
-
pasteFromViewUserInterface
private void pasteFromViewUserInterface()
-
propagate
private void propagate(int dir)
-
quickLUT
private void quickLUT(WildMagic.LibFoundation.Mathematics.Vector3f[] akMinMax, ModelImage image, ModelLUT LUT)
method that performs the quick LUT operation- Parameters:
akMinMax
-image
-LUT
-
-
quickRGB
private void quickRGB(WildMagic.LibFoundation.Mathematics.Vector3f[] akMinMax, ModelImage image, ModelRGB RGB)
DOCUMENT ME!- Parameters:
xS
- DOCUMENT ME!wS
- DOCUMENT ME!yS
- DOCUMENT ME!hS
- DOCUMENT ME!imageBuffer
- DOCUMENT ME!image
- DOCUMENT ME!RGB
- DOCUMENT ME!
-
redoImage
private void redoImage()
-
redoVOI
private void redoVOI()
-
redoVOIs
protected void redoVOIs()
-
saveAllVOIs
private void saveAllVOIs()
This method saves all VOIs for the active image to the default VOI directory for that image.
-
saveAllVOIsTo
private void saveAllVOIsTo(java.lang.String voiDir)
This method saves all VOIs for the active image to a given directory.- Parameters:
voiDir
- directory that contains VOIs for this image.
-
saveImage
private void saveImage(java.lang.String kCommand)
Save the dicom matrix header info. The .ply file format can't save the dicom info. We decide to save the dicom info when save the VOI file. So, the dicom info will be read when load the .ply surface into the volume render. This ensures the correct scale of surface. The dicom matrix info is saved in the current image directory with the .dicomMatrix suffix.
-
saveLabels
private void saveLabels(boolean saveAll)
-
saveVOI
private void saveVOI(boolean saveAllContours)
This method saves a selected VOI- Parameters:
saveAllContours
- if true all contours are saved
-
saveVOIAs
private void saveVOIAs(boolean saveAllContours)
This method allows the user to choose how to save the VOI.- Parameters:
saveAllContours
- if true all contours are saved
-
exportSelectedVOIs
private void exportSelectedVOIs()
-
importVOI
private void importVOI()
-
savePaint
private void savePaint()
-
savePaintAs
private void savePaintAs()
This method allows the user to choose how to save the paint bitmap.
-
saveVOIIntensities
private void saveVOIIntensities()
Save intensities in VOI to a text file of format x,y,z,intensity on each line if not color or complex. If color use format x,y,z,a,r,g,b on each line and if complex use format x,y,z,real,imaginary on each line.
-
saveVOIIntensitiesTo
private void saveVOIIntensitiesTo(java.lang.String voiIntensitiesPath)
Save intensities in VOI to a text file of format x,y,z,intensity on each line if not color or complex. If color use format x,y,z,a,r,g,b on each line and if complex use format x,y,z,real,imaginary on each line.
-
setCurrentColor
private void setCurrentColor()
-
setGraphVisible
private void setGraphVisible()
-
setPAAIGraphVisible
private void setPAAIGraphVisible()
-
setVOIState
protected void setVOIState(VOISaveState kVOIState)
-
undoImage
private void undoImage()
-
undoVOI
private void undoVOI()
-
undoVOIs
protected void undoVOIs()
-
showStatisticsCalculator
protected void showStatisticsCalculator()
Opens a JDialogStatistics to allow computation ofROI statistics.
-
showVOIProperties
protected void showVOIProperties()
-
initVOIManagers
protected void initVOIManagers(int iNViews)
-
readImageJ
private void readImageJ(java.lang.String pathName, java.lang.String fileName, ModelImage image)
-
makeShapeFromArray
private void makeShapeFromArray(float[] array, java.util.Vector<java.util.Vector<java.lang.Integer>> xVector, java.util.Vector<java.util.Vector<java.lang.Integer>> yVector)
-
getSegment
private int getSegment(float[] array, float[] seg, int index)
-
extractNumber
public java.lang.String extractNumber(java.lang.String str)
-
getBufferShort
public final short getBufferShort(byte[] buffer, int index, boolean bigEndian)
Converts byte data to short data.- Parameters:
buffer
- Array of byte data.index
- Index into array data.bigEndian
-true
indicates big endian byte order,false
indicates little endian.- Returns:
- Short value extracted from byte array.
-
getByte
public final short getByte(byte[] buffer, int index)
-
getBufferInt
public final int getBufferInt(byte[] buffer, int index, boolean bigEndian)
Converts byte data to int data.- Parameters:
buffer
- Array of byte data.index
- Index into array data.bigEndian
-true
indicates big endian byte order,false
indicates little endian.- Returns:
- Integer value extracted from byte array.
-
getBufferFloat
public final float getBufferFloat(byte[] buffer, int index, boolean bigEndian)
Converts byte data to float data.- Parameters:
buffer
- Array of byte data.index
- Index into array data.bigEndian
-true
indicates big endian byte order,false
indicates little endian.- Returns:
- Float value extracted from byte array.
-
readCSV
private void readCSV(java.lang.String fileName, ModelImage image)
-
readFreesurferBinaryPatch
private void readFreesurferBinaryPatch(java.lang.String fileName, ModelImage image)
-
-