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) classVOIManagerInterface.OkColorListenerPick up the selected color and call method to change the color.
-
Field Summary
Fields Modifier and Type Field Description protected ViewJColorChoosercolorChooserReference to the color chooser.protected java.awt.ColorcurrentColorRestores the VOI color button after QuickLUT.protected JDialogVOIStatisticsimageStatListStatistics dialog VOI->Statistics generator...protected javax.swing.event.EventListenerListlistenerListcreated to handle VOI updates.private WildMagic.LibFoundation.Mathematics.Vector3f[]m_akBoundsBounding box for a group of selected VOIs for group-move.private booleanm_bDefaultImageprivate booleanm_bGPURendererSet to true if this VOIManagerInterface is used for the GPU-based Volume Rendererprivate floatm_fOpacityOpacity for setting the JDialogOpacityControls, used for VOI opacity.private intm_iActiveThe index of the current active VOIManager.private intm_iMaxUndoprivate java.util.Vector<VOIBase>m_kActiveListList of active VOIBase for a moving several selected VOIs.protected VOIm_kCurrentVOIGroupThe current active VOIprotected ModelImagem_kImageAReference to imageAprivate java.lang.Objectm_kImageARedoSingle-level undo/redo for image masks, re-do-imageA:private java.lang.Objectm_kImageAUndoSingle-level undo/redo for image masks, undo-imageA:protected ModelImagem_kImageBReference to imageBprivate java.lang.Objectm_kImageBRedoSingle-level undo/redo for image masks, re-do-imageB:private java.lang.Objectm_kImageBUndoSingle-level undo/redo for image masks, undo-imageB:protected VOIManagerInterfaceListenerm_kParentReference to the parent frame.private javax.swing.JToggleButtonm_kPointerButtonThe 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_kRedoCommandsList of re-do commandsprotected java.util.Vector<VOISaveState>m_kRedoListSaved VOI states for re-do.private ModelImagem_kTempImageprivate java.util.Vector<java.lang.String>m_kUndoCommandsList of undo commandsprotected java.util.Vector<VOISaveState>m_kUndoListSaved VOI states for undo.protected JDialogVOIStatsm_kVOIDialogVOI Properties dialog -- from the popup menu or drop-down menu.private JDialogVOIHausdorffDistancem_kVOIHausdorffDistanceDialogprivate JDialogVOILogicalOperationsm_kVOILogicalOperationsDialogprotected java.util.Vector<VOIManager>m_kVOIManagersList of VOIManagers, one per canvas displayed.private javax.swing.JToolBarm_kVOIToolbarReference to the VOI toolbar.protected ViewJPopupVOIpopupPopup Menu for VOIs (non-point).protected ViewJPopupPtpopupPtPopup Menu for VOIPoints.private floatpresetHueprotected VolumeTriPlanarRenderBaserendererprotected VOIsaveGroupRestores the current VOI after QuickLUT.private ViewToolBarBuildertoolbarBuilderThe toolbar builder that constructs the VOI toolbar -- it stores the VOI color button.protected javax.swing.JMenuvoiMenuprotected ViewMenuBuildervoiMenuBuilderprivate intvoiUIDVOI 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 voidactionPerformed(java.awt.event.ActionEvent event)voidaddedCurve(VOIEvent added)handles an VOIEvent as a selection change.voidaddedVOI(VOIVectorEvent newVOIselection)handles an VOIEvent as a selection change.private voidaddVOI(ModelImage kImage, VOIBase kNew, boolean bQuickLUT, boolean bUpdate, boolean isFinished)voidaddVOI(VOIBase kNew, boolean bQuickLUT, boolean bUpdate, boolean isFinished)Add a new VOIBase.VOIManageraddVOIManager(ModelImage kImageA, ModelImage kImageB, java.awt.Component kComponent, ScreenCoordinateListener kContext, int iOrientation)voidaddVOIUpdateListener(UpdateVOISelectionListener listener)Adds a UpdateVOISelectionListener.private voidadvanceVOIUID()Increments the VOI uid for internal tracking, used during both creation and loading of a new VOIvoidalgorithmPerformed()private voidchangeVOIOrder(boolean doContour, int direction)private booleancheckForActiveVOIs()private voidclearList(java.util.Vector<VOISaveState> list, int limit)voidclearUndoRedo()voidcolorChanged(java.awt.Color c)private intcopy()private voidcreateMask(ModelImage kActive, boolean bInside)private voidcreateMask(java.lang.String command)private intcut()private voiddeleteActiveVOI()private voiddeleteAllVOI()voiddeleteSelectedVOI(boolean contoursOnly)Delete the selected VOI.voiddeleteVOI(VOIBase kOld, boolean update)Deletes the input VOIBase from the VOI.private voiddeleteVOIActivePt()voiddeleteVOIs()Delete all VOIs.voiddisposeLocal(boolean flag)Dispose of the implementing class.voiddoVOI(java.lang.String kCommand)Performs the VOI Action Command.private voidevolveBoundary2D(java.lang.String command)private voidexportSelectedVOIs()java.lang.StringextractNumber(java.lang.String str)private voidfindCompatibleType(ModelImage kImage, VOIBase kNew, boolean isFinished)voidfireVOISelectionChange(VOI voi)Communicates a selection change to all UpdateVOISelectionListeners.voidfireVOISelectionChange(VOI voi, VOIBase curve)Communicates a selection change to all UpdateVOISelectionListeners.ModelImagegetActiveImage()Returns the current active image.private intgetActiveVOICount()floatgetBufferFloat(byte[] buffer, int index, boolean bigEndian)Converts byte data to float data.intgetBufferInt(byte[] buffer, int index, boolean bigEndian)Converts byte data to int data.shortgetBufferShort(byte[] buffer, int index, boolean bigEndian)Converts byte data to short data.shortgetByte(byte[] buffer, int index)java.awt.ComponentgetComponentImage()Returns the Component displaying the current active image.private javax.swing.JFramegetFrame()javax.swing.JToggleButtongetPointerButton()Returns the pointer button, used by VOIManager to determine if the pointer button is active.private intgetSegment(float[] array, float[] seg, int index)private intgetSlice()javax.swing.JToolBargetToolBar()Returns the VOIToolbar.intgetVOI_ID()VOIManagergetVOIManager(int i)Returns the VOIManager at the given position.intgetVOIManagerNum()Returns the number of VOIManagers controlled by this VOIHandler.protected VOISaveStategetVOIState()voidgraph25VOI_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 voidgraphPointVOI(VOI v, VOIPoint voiPt, int j, boolean useFrameRefTime)private voidgraphVOI()private voidgraphVOICurvature(boolean smooth)private voidimportVOI()private voidindentationVOIs2D()protected voidinitVOIManagers(int iNViews)private voidinterpolateVOIs()private booleanisDrawCommand(java.lang.String kCommand)booleanisNewVoiNeeded(int voiType)private voidlevelSet3D()protected voidloadAllImageJVOIsFrom(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 voidloadAllVOIs(boolean quietMode)This method loads all VOIs to the active image from the default VOI directory for that image.private voidloadAllVOIsFrom(java.lang.String voiDir, boolean quietMode)This method loads all VOIs to the active image from a given directory.protected voidloadAllVOIsFrom(java.lang.String voiDir, boolean quietMode, VOIVector resultVector, boolean registerVOIs)This method loads all VOIs to the active image from a given directory.booleanmake3DVOI(boolean bIntersection, ModelImage kVolume)Creates a 3D Surface out of the VOIs.private booleanmake3DVOI(boolean bIntersection, ModelImage kSrc, ModelImage kVolume, java.util.BitSet kMask, VOIManager kManager, int iValue)private voidmakeShapeFromArray(float[] array, java.util.Vector<java.util.Vector<java.lang.Integer>> xVector, java.util.Vector<java.util.Vector<java.lang.Integer>> yVector)private booleanmatches(int iType1, int iType2, boolean isFinished)voidmouseClicked(java.awt.event.MouseEvent event)voidmouseDragged(java.awt.event.MouseEvent arg0)voidmouseEntered(java.awt.event.MouseEvent e)voidmouseExited(java.awt.event.MouseEvent e)voidmouseMoved(java.awt.event.MouseEvent arg0)voidmousePressed(java.awt.event.MouseEvent e)voidmouseReleased(java.awt.event.MouseEvent e)voidmoveVOI(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.voidmoveVOI(java.lang.String kCommand, float fScale)voidnewVOI(boolean bPropagate, boolean bSplit)Initiate a new VOI.voidnewVOI(float presetHue)Initiate a new VOI.private booleanopenOtherOrientationVOI(boolean quietMode)private booleanopenPaint(boolean quietMode)private booleanopenVOI(boolean quietMode, boolean doLabels)This method opens an existing VOI.private voidpaintToVOI()private voidpaste()private voidpasteAll()private voidpasteFromViewUserInterface()voidpasteVOI(VOIBase kNew)Paste the input VOIBase.private voidpropagate(int dir)booleanpropVOI(int direction, boolean active)Propagates the selected VOI in a given direction.booleanpropVOIAll()Propagates the selected VOI to all slices.voidquickLUT(VOIBase kLUT)Called from the VOIManager class when a user has drawn the QuickLUT rectangle.private voidquickLUT(WildMagic.LibFoundation.Mathematics.Vector3f[] akMinMax, ModelImage image, ModelLUT LUT)method that performs the quick LUT operationprivate voidquickRGB(WildMagic.LibFoundation.Mathematics.Vector3f[] akMinMax, ModelImage image, ModelRGB RGB)DOCUMENT ME!private voidreadCSV(java.lang.String fileName, ModelImage image)private voidreadFreesurferBinaryPatch(java.lang.String fileName, ModelImage image)private voidreadImageJ(java.lang.String pathName, java.lang.String fileName, ModelImage image)private voidredoImage()private voidredoVOI()protected voidredoVOIs()voidremovedCurve(VOIEvent removed)handles to the VOI being removed from the Vector.voidremovedVOI(VOIVectorEvent removed)handles to the VOI being removed from the Vector.voidremoveVOIManager(VOIManager kVOIManager)voidremoveVOIUpdateListener(UpdateVOISelectionListener listener)Removes the UpdateVOISelectionListener from the list.voidresetLivewire()Resets the current livewire VOI.private voidsaveAllVOIs()This method saves all VOIs for the active image to the default VOI directory for that image.private voidsaveAllVOIsTo(java.lang.String voiDir)This method saves all VOIs for the active image to a given directory.private voidsaveImage(java.lang.String kCommand)Save the dicom matrix header info.private voidsaveLabels(boolean saveAll)private voidsavePaint()private voidsavePaintAs()This method allows the user to choose how to save the paint bitmap.private voidsaveVOI(boolean saveAllContours)This method saves a selected VOIprivate voidsaveVOIAs(boolean saveAllContours)This method allows the user to choose how to save the VOI.private voidsaveVOIIntensities()Save intensities in VOI to a text file of format x,y,z,intensity on each line if not color or complex.private voidsaveVOIIntensitiesTo(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.voidsaveVOIs(java.lang.String kCommand)Save the current VOIState to the undo/re-do list.voidselectAllVOIs(boolean bActive)Selects all VOIs.voidselectedVOI(VOIEvent selection)handles the VOI being selected. -- a state-change.voidsetActive(VOIManager kManager, ModelImage kActiveImage)Called from the VOIManager.voidsetButtonColor(javax.swing.JButton _button, java.awt.Color _color)Set the color of the button.voidsetCenter(WildMagic.LibFoundation.Mathematics.Vector3f center)Sets the current displayed slice for 3D images.voidsetCenter(WildMagic.LibFoundation.Mathematics.Vector3f center, boolean bParent)Sets the current displayed slice for 3D images.private voidsetCurrentColor()voidsetCursor(java.awt.Cursor kCursor)Called from VOIManager to change the mouse cursor.voidsetDefaultCursor()Called from VOIManager to set the default mouse cursor.voidsetEnabled(boolean flag)Currently not used.private voidsetGraphVisible()voidsetOpacity(float fVal)Called from JDialogOpacityControls.private voidsetPAAIGraphVisible()voidsetPointerButton(javax.swing.JToggleButton button)Called when the Default Pointer Button is not part of the default VOI Toolbar.voidsetPresetHue(float presetHue)Sets the hue that will be used to draw the new VOI.voidsetRenderer(VolumeTriPlanarRenderBase renderer)voidsetSelectedVOI(VOI kSelected, boolean bSelectAll, boolean bUnSelectVOI)Called from the VOIManager when a new VOI is selected by the mouse.voidsetVOI_IDs(int ID, int UID)This function is deprecated.protected voidsetVOIState(VOISaveState kVOIState)voidsetVOITools(javax.swing.JMenu voiMenu, ViewMenuBuilder voiMenuBuilder)voidshowColorDialog()Opens the color dialog for changing the selected VOI color.voidshowCurvatureInfo(VOIBase kVOI, int m_iPlane, boolean showGraph, boolean smoothCurvature)Called from the VOIManager.voidshowIntensityInfo(VOIBase kVOI, int m_iPlane, boolean showGraph)Called from the VOIManager.protected voidshowStatisticsCalculator()Opens a JDialogStatistics to allow computation ofROI statistics.protected voidshowVOIProperties()private voidundoImage()private voidundoVOI()protected voidundoVOIs()voidupdateDisplay()Called from VOIManager.voidupdateGraph(VOIBase kVOI, int m_iPlane)Called from the VOIManager when the VOIBase that is currently being graphed has changed.voidvectorSelected(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:
actionPerformedin interfacejava.awt.event.ActionListener
-
addedCurve
public void addedCurve(VOIEvent added)
Description copied from interface:VOIListenerhandles an VOIEvent as a selection change.- Specified by:
addedCurvein interfaceVOIListener- Parameters:
added- DOCUMENT ME!
-
addedVOI
public void addedVOI(VOIVectorEvent newVOIselection)
Description copied from interface:VOIVectorListenerhandles an VOIEvent as a selection change.- Specified by:
addedVOIin 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:
addVOIUpdateListenerin interfaceVOIHandlerInterface- Parameters:
listener- will receive VOI selection events.
-
algorithmPerformed
public void algorithmPerformed()
-
colorChanged
public void colorChanged(java.awt.Color c)
- Specified by:
colorChangedin interfaceVOIListener
-
deleteSelectedVOI
public void deleteSelectedVOI(boolean contoursOnly)
Description copied from interface:VOIHandlerInterfaceDelete the selected VOI. This function is deprecated, replace with actionPerformed() using CustomUIBuilder.PARAM_VOI_DELETE- Specified by:
deleteSelectedVOIin 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:VOIHandlerInterfaceDelete all VOIs.- Specified by:
deleteVOIsin interfaceVOIHandlerInterface
-
disposeLocal
public void disposeLocal(boolean flag)
Description copied from interface:VOIHandlerInterfaceDispose of the implementing class.- Specified by:
disposeLocalin 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:VOIHandlerInterfaceCommunicates a selection change to all UpdateVOISelectionListeners.- Specified by:
fireVOISelectionChangein interfaceVOIHandlerInterface- Parameters:
voi- the modified VOI.
-
fireVOISelectionChange
public void fireVOISelectionChange(VOI voi, VOIBase curve)
Description copied from interface:VOIHandlerInterfaceCommunicates a selection change to all UpdateVOISelectionListeners.- Specified by:
fireVOISelectionChangein interfaceVOIHandlerInterface- Parameters:
voi- modified VOI.curve- modified VOIBase.
-
getActiveImage
public ModelImage getActiveImage()
Description copied from interface:VOIHandlerInterfaceReturns the current active image.- Specified by:
getActiveImagein interfaceVOIHandlerInterface- Returns:
- current active image.
-
getComponentImage
public java.awt.Component getComponentImage()
Description copied from interface:VOIHandlerInterfaceReturns the Component displaying the current active image.- Specified by:
getComponentImagein 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_IDin 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:VOIHandlerInterfaceGenerates and displays a 1D graph of the average or total intensity of 2.5 VOI of 2.5D image (3D).- Specified by:
graph25VOI_CalcIntenin 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:
isNewVoiNeededin 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:
mouseClickedin interfacejava.awt.event.MouseListener
-
mouseDragged
public void mouseDragged(java.awt.event.MouseEvent arg0)
- Specified by:
mouseDraggedin interfacejava.awt.event.MouseMotionListener
-
mouseEntered
public void mouseEntered(java.awt.event.MouseEvent e)
- Specified by:
mouseEnteredin interfacejava.awt.event.MouseListener
-
mouseExited
public void mouseExited(java.awt.event.MouseEvent e)
- Specified by:
mouseExitedin interfacejava.awt.event.MouseListener
-
mouseMoved
public void mouseMoved(java.awt.event.MouseEvent arg0)
- Specified by:
mouseMovedin interfacejava.awt.event.MouseMotionListener
-
mousePressed
public void mousePressed(java.awt.event.MouseEvent e)
- Specified by:
mousePressedin interfacejava.awt.event.MouseListener
-
mouseReleased
public void mouseReleased(java.awt.event.MouseEvent e)
- Specified by:
mouseReleasedin 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:VOIHandlerInterfaceInitiate a new VOI.- Specified by:
newVOIin 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:VOIHandlerInterfacePropagates 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:
propVOIin interfaceVOIHandlerInterface- Parameters:
direction- Up +1, or Down -1active- unused.- Returns:
- true if success, false otherwise
-
propVOIAll
public boolean propVOIAll()
Description copied from interface:VOIHandlerInterfacePropagates the selected VOI to all slices. This function is deprecated, replace with actionPerformed(ActionEvent) using CustomUIBuilder.PARAM_VOI_PROPAGATE_ALL.- Specified by:
propVOIAllin 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:VOIListenerhandles to the VOI being removed from the Vector.- Specified by:
removedCurvein interfaceVOIListener- Parameters:
removed- DOCUMENT ME!
-
removedVOI
public void removedVOI(VOIVectorEvent removed)
Description copied from interface:VOIVectorListenerhandles to the VOI being removed from the Vector.- Specified by:
removedVOIin interfaceVOIVectorListener- Parameters:
removed- DOCUMENT ME!
-
removeVOIManager
public void removeVOIManager(VOIManager kVOIManager)
-
removeVOIUpdateListener
public void removeVOIUpdateListener(UpdateVOISelectionListener listener)
Description copied from interface:VOIHandlerInterfaceRemoves the UpdateVOISelectionListener from the list.- Specified by:
removeVOIUpdateListenerin interfaceVOIHandlerInterface- Parameters:
listener- the UpdateVOIselectionListener to remove.
-
resetLivewire
public void resetLivewire()
Description copied from interface:VOIHandlerInterfaceResets the current livewire VOI.- Specified by:
resetLivewirein 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:VOIHandlerInterfaceSelects all VOIs. This function is deprecated, replace with actionPerformed(ActionEvent) using CustomUIBuilder.PARAM_VOI_SELECT_ALL and CustomUIBuilder.PARAM_VOI_SELECT_NONE- Specified by:
selectAllVOIsin interfaceVOIHandlerInterface
-
selectedVOI
public void selectedVOI(VOIEvent selection)
Description copied from interface:VOIListenerhandles the VOI being selected. -- a state-change.- Specified by:
selectedVOIin 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:VOIHandlerInterfaceSets 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:
setCenterin 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:VOIHandlerInterfaceSets 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:
setCenterin 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:VOIHandlerInterfaceSets the hue that will be used to draw the new VOI.- Specified by:
setPresetHuein 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:VOIHandlerInterfaceThis function is deprecated.- Specified by:
setVOI_IDsin 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:VOIHandlerInterfaceOpens the color dialog for changing the selected VOI color.- Specified by:
showColorDialogin 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:VOIVectorListenerhandles the VOI being selected.- Specified by:
vectorSelectedin 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-trueindicates big endian byte order,falseindicates 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-trueindicates big endian byte order,falseindicates 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-trueindicates big endian byte order,falseindicates 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)
-
-