Package gov.nih.mipav.view.dialogs
Class JDialogMultiPaint
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.dialogs.JDialogMultiPaint
- All Implemented Interfaces:
DialogDefaultsInterface,ActionListener,FocusListener,ItemListener,KeyListener,MouseListener,WindowListener,ImageObserver,MenuContainer,Serializable,EventListener,Accessible,RootPaneContainer,WindowConstants
.
Dialog box for the advanced paint power tools: morphology operations, object delete, etc. Bring up this dialog from the normal power paint dialog.
- Version:
- May 2005
- Author:
- Pierre-Louis Bazin
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class gov.nih.mipav.view.dialogs.JDialogBase
JDialogBase.CancelAction, JDialogBase.HelpAction, JDialogBase.OKActionNested classes/interfaces inherited from class javax.swing.JDialog
JDialog.AccessibleJDialogNested classes/interfaces inherited from class java.awt.Dialog
Dialog.AccessibleAWTDialog, Dialog.ModalExclusionType, Dialog.ModalityTypeNested classes/interfaces inherited from class java.awt.Window
Window.AccessibleAWTWindow, Window.TypeNested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainerNested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate intDOCUMENT ME!private JPanelDOCUMENT ME!private JToggleButtonDOCUMENT ME!this is the array list of texts for the mask number buttons.private JDialogChangeMaskNumberRef to JDialogChangeMaskNumberprivate JToggleButtonprivate JPanelDOCUMENT ME!private JButtonButton that allows user to collapse masks/paint to single valueprivate Color[]array of colors to use for the labels.private floatsaved opacity parameter when hiding the paintprivate JToggleButtondisplay masks toggle button.private JToggleButtonDOCUMENT ME!private JToggleButtonDOCUMENT ME!private JCheckBoxDOCUMENT ME!private JButtonbutton VOI export.private ModelImagesource image.private intThe size, in voxels, of the mask.private JButtonbutton VOI import.private JProgressBarDOCUMENT ME!DOCUMENT ME!private booleanprivate booleanprivate booleanprivate String[]labels for the painted objects.private JTextField[]DOCUMENT ME!private JPanelDOCUMENT ME!private JPanelDOCUMENT ME!private BorderedButton[]DOCUMENT ME!private JPanelDOCUMENT ME!private JFileChooserDOCUMENT ME!private JButtonDOCUMENT ME!private JButtonDOCUMENT ME!private JButtonlock all masks checkbox *private JPanellock panelprivate static ModelLUTDOCUMENT ME!private JPaneldialog elements.private BorderedButton[]DOCUMENT ME!private JPanelDOCUMENT ME!private intnumber of paint masks initially.private intnumber of paint masks initially.private intThis represents the button the user selects to..initally at 1private JLabelDOCUMENT ME!private JPanelDOCUMENT ME!private JTextFieldresize x value.private JTextFieldresize y value.private JPanelDOCUMENT ME!private JCheckBox[]DOCUMENT ME!private boolean[]check whether the mask can be affected by new paint or not.private ButtonGroupbutton group for radio buttonsprivate JButtonresize button.private JPanelDOCUMENT ME!private MultiPaintAutoSaveDOCUMENT ME!private JRadioButtonradio buttons for commmiting masks as 3d or 4d if image is 4dprivate JRadioButtonradio buttons for commmiting masks as 3d or 4d if image is 4dprivate JFileChooserDOCUMENT ME!private JButtonsave labels button.private JButtonsave mask button.private booleanthis boolean is needed for commiting masks for a 4d imageprivate TimerDOCUMENT ME!private JScrollPaneThis is the scroll pane for the label list panelprivate intid for the selected paint mask.private static final longUse serialVersionUID for interoperability.private ThreadGroupprivate intDOCUMENT ME!private JButtonunlock all masks checkbox *private ViewUserInterfaceprivate int destExtents[];.Fields inherited from class gov.nih.mipav.view.dialogs.JDialogBase
applyButton, bar, cancelButton, cancelFlag, closeButton, HELP, helpButton, mainDialogPanel, NEW, OKButton, parentFrame, progressBar, REPLACE, runInSeparateThread, runningScriptFlag, runQuiet, serif12, serif12B, voiManagerFields inherited from class javax.swing.JDialog
accessibleContext, rootPane, rootPaneCheckingEnabledFields inherited from class java.awt.Dialog
DEFAULT_MODALITY_TYPEFields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTFields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTHFields inherited from interface javax.swing.WindowConstants
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, EXIT_ON_CLOSE, HIDE_ON_CLOSE -
Constructor Summary
ConstructorsConstructorDescriptionUsed primarily for the script to store variables and run the algorithm.JDialogMultiPaint(Frame theParentFrame, ModelImage im) Creates dialog for plugin. -
Method Summary
Modifier and TypeMethodDescriptionvoidactionPerformed(ActionEvent event) Processes the events from this dialog's buttons.voidaddIntensityLock(int intensity) Adds an Integer object to the intensityLockVector.private final voidprivate voidInstantiates and shows the "Load label file" dialog, which is used to load a text file containing the names of the colored labels.private voidInstantiates and shows the "Save label file" dialog, which is used to save a text file containing the names of the colored labels.private voidcommitPaintToMask(int num) Converts the paint to a mask.intProcedure that counts the number of labels in the mask image.private voidSets buttons to deselected, then calls refreshImagePaint to reset paint as mask.final intgetMaskTreeSet(ModelImage imgB) Determines the intensities of image B.....populates the treeset and returns it.voidDOCUMENT ME!private voidinit()Initializes the GUI (panels, buttons, etc) and displays it on the screen.private voidinitBlankPaint(int num) Initializes a new blank paint mask to the color indexed by the parameter 'num'voidHandle the key pressed event.voidHandle the key released event.voidHandle the key typed event.private voidHandles the action event generated by the "Load label file" dialog.private voidlockAll()locks all masksvoidDOCUMENT ME!voidDOCUMENT ME!voidDOCUMENT ME!voidDOCUMENT ME!voidDOCUMENT ME!private voidnewLabelList(int Nbx, int Nby) Purpose: unknown.voidreadLabelsFromFile(String filename) Reads the 'labels' file from disk.private voidRefreshes the displayed paint mask.private voidrefreshImagePaint(ModelImage img, BitSet obj) Refreshes the displayed paint mask.private voidReinstantiates the labels for redisplay.voidremoveIntensityLock(int intensity) Removes an intensity value from the intensityLockVector.private voidresetLabelList(int Nbx, int Nby) Used to reset the button labels to their default setting.private voidHandles the action event generated by the "Save label file" dialog.private voidselectedMaskToPaint(int num) Converts the selected mask to paint.private voidswitchPaintAndMask(int from, int to, int colorNum) Converts paint to a mask, then mask to paint.private voidunlocks all masksvoidwindowClosing(WindowEvent event) windowclosing...override of WindowListener interface.private voidwriteLabelsToFile(String filename) Writes the 'labels' file to disk.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, windowDeactivated, windowDeiconified, windowIconified, windowOpenedMethods inherited from class javax.swing.JDialog
addImpl, createRootPane, dialogInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, updateMethods inherited from class java.awt.Dialog
addNotify, getModalityType, getTitle, hide, isModal, isResizable, isUndecorated, setBackground, setModal, setModalityType, setOpacity, setResizable, setShape, setTitle, setUndecorated, show, toBackMethods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeNotify, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImage, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, toFrontMethods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTreeMethods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setMixingCutoutShape, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
Field Details
-
serialVersionUID
private static final long serialVersionUIDUse serialVersionUID for interoperability.- See Also:
-
lutB
DOCUMENT ME! -
alphaBlend
private int alphaBlendDOCUMENT ME! -
triPlanarAlphaBlend
private int triPlanarAlphaBlendDOCUMENT ME! -
bottomPanel
DOCUMENT ME! -
closePanel
DOCUMENT ME! -
buttonShortkeys
DOCUMENT ME! -
buttonTextArrayList
this is the array list of texts for the mask number buttons. -
changeMaskNumberDialog
Ref to JDialogChangeMaskNumber.* -
collapseButton
Button that allows user to collapse masks/paint to single value.* -
saveAs3DMaskRadio
radio buttons for commmiting masks as 3d or 4d if image is 4d -
saveAs4DMaskRadio
radio buttons for commmiting masks as 3d or 4d if image is 4d -
radioGroup
button group for radio buttons -
saveMasksAs4D
private boolean saveMasksAs4Dthis boolean is needed for commiting masks for a 4d image -
color
array of colors to use for the labels. -
currentOpacity
private float currentOpacitysaved opacity parameter when hiding the paint -
displayMasksButton
display masks toggle button. -
displayModeButton
DOCUMENT ME! -
displayPaintButton
DOCUMENT ME! -
editBox
DOCUMENT ME! -
exportVoiButton
button VOI export. -
image
source image. -
imgBSize
private int imgBSizeThe size, in voxels, of the mask. -
importVoiButton
button VOI import. -
indeterminateProgressBar
DOCUMENT ME! -
intensityLockVector
DOCUMENT ME! -
label
labels for the painted objects. -
labelField
DOCUMENT ME! -
listButton
DOCUMENT ME! -
listPanel
DOCUMENT ME! -
loadDialog
DOCUMENT ME! -
loadLabelsButton
DOCUMENT ME! -
loadMaskButton
DOCUMENT ME! -
checkAutosave
-
save
DOCUMENT ME! -
saver
DOCUMENT ME! -
mainPanel
dialog elements. -
multiButton
DOCUMENT ME! -
multiPanel
DOCUMENT ME! -
nbx
private int nbxnumber of paint masks initially. -
nby
private int nbynumber of paint masks initially. -
newSelection
private int newSelectionThis represents the button the user selects to..initally at 1.* -
numberLabel
DOCUMENT ME! -
numberPanel
DOCUMENT ME! -
numberXField
resize x value. -
numberYField
resize y value. -
optionPanel
DOCUMENT ME! -
preserveBox
DOCUMENT ME! -
preserved
private boolean[] preservedcheck whether the mask can be affected by new paint or not. -
resizeButton
resize button. -
saveDialog
DOCUMENT ME! -
saveLabelsButton
save labels button. -
saveMaskButton
save mask button. -
scrollPane
This is the scroll pane for the label list panel.* -
selected
private int selectedid for the selected paint mask. -
userInterface
private int destExtents[];. -
leftPanel
DOCUMENT ME! -
rightPanel
DOCUMENT ME! -
leftRightPanel
DOCUMENT ME! -
lockAllButton
lock all masks checkbox * -
unlockAllButton
unlock all masks checkbox * -
lockPanel
lock panel -
isVisibleMask
private boolean isVisibleMask -
isVisiblePaint
private boolean isVisiblePaint -
isCompactDisplay
private boolean isCompactDisplay -
threads
-
-
Constructor Details
-
JDialogMultiPaint
Used primarily for the script to store variables and run the algorithm. No actual dialog will appear but the set up info and result image will be stored here.- Parameters:
im- Source image.
-
JDialogMultiPaint
Creates dialog for plugin.- Parameters:
theParentFrame- Parent frame.im- Source image.
-
-
Method Details
-
actionPerformed
Processes the events from this dialog's buttons.- Specified by:
actionPerformedin interfaceActionListener- Overrides:
actionPerformedin classJDialogBase- Parameters:
event- Event that triggers the action.
-
addIntensityLock
public void addIntensityLock(int intensity) Adds an Integer object to the intensityLockVector. The Integer object represents an intensity value which is locked - that is, cannot be overwritten by a "Paint to mask" operation.- Parameters:
intensity- the intensity value to lock
-
countMaskLabels
public int countMaskLabels()Procedure that counts the number of labels in the mask image.- Returns:
- DOCUMENT ME!
-
getActiveMask
public final int getActiveMask() -
imageBInit
public void imageBInit()DOCUMENT ME! -
keyPressed
Handle the key pressed event.- Specified by:
keyPressedin interfaceKeyListener- Parameters:
e- DOCUMENT ME!
-
keyReleased
Handle the key released event.- Specified by:
keyReleasedin interfaceKeyListener- Parameters:
e- DOCUMENT ME!
-
keyTyped
Handle the key typed event.- Specified by:
keyTypedin interfaceKeyListener- Parameters:
e- DOCUMENT ME!
-
mouseClicked
DOCUMENT ME!- Specified by:
mouseClickedin interfaceMouseListener- Parameters:
e- DOCUMENT ME!
-
mouseEntered
DOCUMENT ME!- Specified by:
mouseEnteredin interfaceMouseListener- Parameters:
e- DOCUMENT ME!
-
mouseExited
DOCUMENT ME!- Specified by:
mouseExitedin interfaceMouseListener- Parameters:
e- DOCUMENT ME!
-
mousePressed
DOCUMENT ME!- Specified by:
mousePressedin interfaceMouseListener- Parameters:
e- DOCUMENT ME!
-
mouseReleased
DOCUMENT ME!- Specified by:
mouseReleasedin interfaceMouseListener- Parameters:
e- DOCUMENT ME!
-
readLabelsFromFile
Reads the 'labels' file from disk.- Parameters:
filename- DOCUMENT ME!
-
removeIntensityLock
public void removeIntensityLock(int intensity) Removes an intensity value from the intensityLockVector.- Parameters:
intensity- the intensity value to remove
-
windowClosing
windowclosing...override of WindowListener interface.- Specified by:
windowClosingin interfaceWindowListener- Overrides:
windowClosingin classJDialogBase- Parameters:
event- DOCUMENT ME!
-
buildLoadDialog
private void buildLoadDialog()Instantiates and shows the "Load label file" dialog, which is used to load a text file containing the names of the colored labels. -
buildSaveDialog
private void buildSaveDialog()Instantiates and shows the "Save label file" dialog, which is used to save a text file containing the names of the colored labels. -
commitPaintToMask
private void commitPaintToMask(int num) Converts the paint to a mask. Creates a new mask image if one does not already exist.- Parameters:
num- the index into the color array, which indicates the color of the paint
-
deselectMask
private void deselectMask()Sets buttons to deselected, then calls refreshImagePaint to reset paint as mask. -
getMaskTreeSet
Determines the intensities of image B.....populates the treeset and returns it.- Parameters:
imgB- DOCUMENT ME!- Returns:
- DOCUMENT ME!
-
init
private void init()Initializes the GUI (panels, buttons, etc) and displays it on the screen. -
lockAll
private void lockAll()locks all masks -
unlockAll
private void unlockAll()unlocks all masks -
initBlankPaint
private void initBlankPaint(int num) Initializes a new blank paint mask to the color indexed by the parameter 'num'- Parameters:
num- the index into the color array
-
loadFileActionPerformed
Handles the action event generated by the "Load label file" dialog. Calls readLabelsFromFile(String) to read the label file selected by the user.- Parameters:
evt- the ActionEvent generated by this dialog
-
newLabelList
private void newLabelList(int Nbx, int Nby) Purpose: unknown.- Parameters:
Nbx- number of labels in the x-directionNby- number of labels in the y-direction
-
refreshImagePaint
Refreshes the displayed paint mask.- Parameters:
img- DOCUMENT ME!obj- DOCUMENT ME!
-
refreshImagePaint
Refreshes the displayed paint mask.- Parameters:
img- DOCUMENT ME!
-
refreshLabelDisplay
private void refreshLabelDisplay()Reinstantiates the labels for redisplay. Purpose: unknown -
resetLabelList
private void resetLabelList(int Nbx, int Nby) Used to reset the button labels to their default setting. Currently not used.- Parameters:
Nbx- number of labels in the x-directionNby- number of labels in the y-direction
-
saveFileActionPerformed
Handles the action event generated by the "Save label file" dialog. Calls readLabelsFromFile(String) to save the labels to the file selected by the user.- Parameters:
evt- the ActionEvent generated by this dialog
-
selectedMaskToPaint
private void selectedMaskToPaint(int num) Converts the selected mask to paint.- Parameters:
num- the index into the color array, which indicates the color of the paint
-
switchPaintAndMask
private void switchPaintAndMask(int from, int to, int colorNum) Converts paint to a mask, then mask to paint. Reason: unknown.- Parameters:
from- DOCUMENT ME!to- DOCUMENT ME!
-
writeLabelsToFile
Writes the 'labels' file to disk.- Parameters:
filename- DOCUMENT ME!
-
autosaveMask
private final void autosaveMask()
-