Class JDialogLocalNormalization
- All Implemented Interfaces:
AlgorithmInterface,ScriptableActionInterface,DialogDefaultsInterface,ActionListener,FocusListener,ItemListener,WindowListener,ImageObserver,MenuContainer,Serializable,EventListener,Accessible,RootPaneContainer,WindowConstants
Local Normalization equalizes colour levels among pixels removing variations due to lighting, bringing out contrasts in detail.
This dialog presents the X- and Y- gaussian dimensions and the blurring weight from the JDialogUnsharpMask dialog and the cut-off frequency from the JDialogFrequencyFilter dialog. There is also a colour channel selection panel which permits the selection of colours to be processed when the image is in aRGB colour.
Described by Halyo, Rahman and Park:
Local Normalization seperates the image into a local or low-frequency signal, and a suface detail or high-frequency signal. The locally normalized signal is then obtained by normalizing (ie., dividing) the detail signal by the local average.
References:
- Local Normalization. http://bigwww.epfl.ch/demo/normalize/desc.html
- Halyo, Nesim; Rahman, Zia-ur; Park, Stephen. "Information Content in Nonlinear Local Normalization Processing of Digital Images". College of William and Mary. Williamsburg, Virgiana.
- 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 AlgorithmLocalNormalizationDOCUMENT ME!static final intminimum value for blurring, at 1.0.private intDOCUMENT ME!private JTextFieldDOCUMENT ME!private floatuser-selectable variables used in the FFT-blurring operation used as interim variables in starting the algorithm op.private JTextFieldDOCUMENT ME!private JPanelColorChannelsDOCUMENT ME!private intDOCUMENT ME!private JTextFieldDOCUMENT ME!static final floatdefault frequency value for blurring frequency, at 0.2.static final floatminimum frequency value for blurring frequency, at 0.0.private ModelImageDOCUMENT ME!private static final longUse serialVersionUID for interoperability.private ModelImageDOCUMENT ME!private String[]DOCUMENT ME!private float[]user-selectable variables used in the unsharping operation. used as interim variables in starting the algorithm op.static final floatmaximum value for unsharpening variables, at 5.0.static final floatminimum value for unsharpening variables, at 0.5.static final doublemaximum value for unsharpening weighting, at 1.0.static final doubleminimum value for unsharpening weighting, at 0.0.private doubleDOCUMENT ME!private JTextFieldDOCUMENT ME!private JTextFieldDOCUMENT ME!private JTextFieldDOCUMENT ME!private JTextFieldDOCUMENT ME!private ViewUserInterfaceDOCUMENT ME!Fields inherited from class gov.nih.mipav.view.dialogs.JDialogScriptableBase
displayInNewFrame, isComplete, scriptParametersFields 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
ConstructorsConstructorDescriptionEmpty constructor needed for dynamic instantiation (used during scripting).JDialogLocalNormalization(JFrame owner, ModelImage mi) Creates an modal extension of JDialogBase, using the title, "Local Normalization". -
Method Summary
Modifier and TypeMethodDescriptionvoida button has been clicked!voidalgorithmPerformed(AlgorithmBase algorithm) This method is required if the AlgorithmPerformed interface is implemented.private JPanelpart of the algorithm rests on blurring the original image.protected JPanelmakes the panel to allow user selection of colour channels to filter. nothing editable when image not in ARGB or ARGB_USHORT or ARGB_UINTEGER or ARGB_FLOATprivate JPanelcreates the planel which contains the OKAY and Cancel buttons. sets their sizes, colours and listeners.private JPanelpart of the algorithm rests on finding the original image minus an estimation of the local mean.private JPanelpart of the algorithm rests on finding the original image minus an estimation of the local mean.protected voidOnce all the necessary variables are set, call the local normalization algorithm based on what type of image this is and whether or not there is a separate destination image.private booleancheck the variables of the unsharping-mask panel as they are translated from dialog inputs (ie.,JTextFields) to more usable, native types.private doublecheckText(JTextField jtf, double a, double b) verify that the numeric value of the text of the submitted JTextField is between a and b.private floatcheckText(JTextField jtf, float a, float b) verify that the numeric value of the text of the submitted JTextField is between a and b.private booleancheck the variables of the unsharping-mask panel as they are translated from dialog inputs (ie.,JTextFields) to more usable, native types.private JTextFieldcreateEntryField(String presetText) Builds a new JTextField, with the given String, sets its font (to MipavUtil.font12), sets the foreground colour (to Color.black), sets column width to 7, then returns the newly made JTextField.protected voidStore the result image in the script runner's image table now that the action execution is finished.Accessor that returns the image.voidsetBlurringDiameter(int dia) Accessor that sets the blurring diameter value.voidsetBlurringFreq(float freq) Accessor that sets the blurring frequency value.voidAccessor that sets the display loc variable to new, so that a new image is created once the algorithm completes.voidAccessor that sets the display loc variable to replace, so the current image is replaced once the algorithm completes.protected voidSet the dialog GUI using the script parameters while running this algorithm as part of a script.voidsetUnsharp(float[] unsharp) Accessor that sets the unsharp array.voidsetUnsharp(float unsharpX, float unsharpY) Accessor that sets the unsharp array values.voidsetUnsharpWeight(double weight) Accessor that sets the unsharp weight value.private booleanUse the GUI results to set up the variables needed to run the algorithm.protected voidRecord the parameters just used to run this algorithm in a script.Methods inherited from class gov.nih.mipav.view.dialogs.JDialogScriptableBase
getDialogActionString, insertScriptLine, isComplete, scriptRun, setCompleteMethods inherited from class gov.nih.mipav.view.dialogs.JDialogBase
buildApplyButton, buildButtons, buildCancelButton, buildCancelButton, buildCloseButton, buildHelpButton, buildImageComboBox, buildOKButton, buildOKButton, buildOKCancelButtons, buildTitledBorder, buildTitledBorder, createLabel, createProgressBar, createProgressBar, createTextField, focusGained, focusLost, getDialogName, isCancelled, isQuietRunning, isRunInSeparateThread, isScriptRunning, itemStateChanged, loadDefaults, loadDefaults, makeImageName, makeString, openNewFrame, saveDefaults, saveDefaults, setLeftHandSystem, setQuietRunning, setScriptRunning, setSeparateThread, setVisible, setVisible, setVisibleMenuBar, setVisibleStandard, setVOIManager, setWCSystem, testParameter, testParameterMin, updateFFTFileInfo, updateFileInfo, updateFileInfoOtherModality, updateFileInfoStatic, updateFileInfoStatic, updateFileTypeInfo, updateFileTypeInfo, windowActivated, windowClosed, windowClosing, windowDeactivated, windowDeiconified, windowIconified, 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:
-
UNSHARP_MIN
public static final float UNSHARP_MINminimum value for unsharpening variables, at 0.5.- See Also:
-
UNSHARP_MAX
public static final float UNSHARP_MAXmaximum value for unsharpening variables, at 5.0.- See Also:
-
UNSHARP_WEIGHT_MIN
public static final double UNSHARP_WEIGHT_MINminimum value for unsharpening weighting, at 0.0.- See Also:
-
UNSHARP_WEIGHT_MAX
public static final double UNSHARP_WEIGHT_MAXmaximum value for unsharpening weighting, at 1.0.- See Also:
-
FREQ_MIN
public static final float FREQ_MINminimum frequency value for blurring frequency, at 0.0.- See Also:
-
FREQ_DEFAULT
public static final float FREQ_DEFAULTdefault frequency value for blurring frequency, at 0.2.- See Also:
-
BLUR_MIN
public static final int BLUR_MINminimum value for blurring, at 1.0.- See Also:
-
algoLocal
DOCUMENT ME! -
blurringDiameter
private int blurringDiameterDOCUMENT ME! -
blurringDiameterText
DOCUMENT ME! -
blurringFreq
private float blurringFrequser-selectable variables used in the FFT-blurring operation used as interim variables in starting the algorithm op. -
blurringFreqText
DOCUMENT ME! -
colorPanel
DOCUMENT ME! -
displayLoc
private int displayLocDOCUMENT ME! -
errorComponent
DOCUMENT ME! -
resultImage
DOCUMENT ME! -
sourceImage
DOCUMENT ME! -
titles
DOCUMENT ME! -
unsharp
private float[] unsharpuser-selectable variables used in the unsharping operation. used as interim variables in starting the algorithm op. -
unsharpWeight
private double unsharpWeightDOCUMENT ME! -
unsharpWeightText
DOCUMENT ME! -
unsharpXtext
DOCUMENT ME! -
unsharpYtext
DOCUMENT ME! -
unsharpZtext
DOCUMENT ME! -
userInterface
DOCUMENT ME!
-
-
Constructor Details
-
JDialogLocalNormalization
public JDialogLocalNormalization()Empty constructor needed for dynamic instantiation (used during scripting). -
JDialogLocalNormalization
Creates an modal extension of JDialogBase, using the title, "Local Normalization". Creates an options panel; this contains: the inputs for the unsharp masking; the inputs for blurring; and the inputs for choosing which colour channels to process. This last set of options are not selectable on images which are not colour images. It creates the OKAY and CANCEL buttons on a panel, to b be placed at the bottom of the dialog.The panel is then pack()'d and then setVisible(true).
- Parameters:
owner- DOCUMENT ME!mi- DOCUMENT ME!
-
-
Method Details
-
actionPerformed
a button has been clicked! Cancel will dispose of the dialog, OK sets the variables and calls the algorithm; any errors in setting the variables upon OK are written to the debug pane. Help brings up the help text.- Specified by:
actionPerformedin interfaceActionListener- Overrides:
actionPerformedin classJDialogBase- Parameters:
ae- DOCUMENT ME!
-
algorithmPerformed
This method is required if the AlgorithmPerformed interface is implemented. It is called by the algorithms when it has completed or failed to to complete, so that the dialog can be display the result image and/or clean up.- Specified by:
algorithmPerformedin interfaceAlgorithmInterface- Parameters:
algorithm- Algorithm that caused the event.
-
getResultImage
Accessor that returns the image.- Returns:
- The result image.
-
setBlurringDiameter
public void setBlurringDiameter(int dia) Accessor that sets the blurring diameter value.- Parameters:
dia- Value to set the blurring diameter to (should be positive and odd).
-
setBlurringFreq
public void setBlurringFreq(float freq) Accessor that sets the blurring frequency value.- Parameters:
freq- Value to set the blurring frequency to (should be positive).
-
setDisplayLocNew
public void setDisplayLocNew()Accessor that sets the display loc variable to new, so that a new image is created once the algorithm completes. -
setDisplayLocReplace
public void setDisplayLocReplace()Accessor that sets the display loc variable to replace, so the current image is replaced once the algorithm completes. -
setUnsharp
public void setUnsharp(float[] unsharp) Accessor that sets the unsharp array.- Parameters:
unsharp- Value to set the unsharp array to (should be between 0.5 and 5.0).
-
setUnsharp
public void setUnsharp(float unsharpX, float unsharpY) Accessor that sets the unsharp array values.- Parameters:
unsharpX- Values to set the unsharp array values to (should be between 0.5 and 5.0).unsharpY- Values to set the unsharp array values to (should be between 0.5 and 5.0).
-
setUnsharpWeight
public void setUnsharpWeight(double weight) Accessor that sets the unsharp weight value.- Parameters:
weight- Value to set the unsharp weight to (should be between 0.0 and 1.0).
-
buildColourPanel
makes the panel to allow user selection of colour channels to filter. nothing editable when image not in ARGB or ARGB_USHORT or ARGB_UINTEGER or ARGB_FLOAT- Returns:
- the colour panel with adjustable attributes already added
-
callAlgorithm
protected void callAlgorithm()Once all the necessary variables are set, call the local normalization algorithm based on what type of image this is and whether or not there is a separate destination image.- Specified by:
callAlgorithmin classJDialogScriptableBase
-
doPostAlgorithmActions
protected void doPostAlgorithmActions()Store the result image in the script runner's image table now that the action execution is finished.- Overrides:
doPostAlgorithmActionsin classJDialogScriptableBase
-
setGUIFromParams
protected void setGUIFromParams()Set the dialog GUI using the script parameters while running this algorithm as part of a script.- Specified by:
setGUIFromParamsin classJDialogScriptableBase
-
storeParamsFromGUI
Record the parameters just used to run this algorithm in a script.- Specified by:
storeParamsFromGUIin classJDialogScriptableBase- Throws:
ParserException- If there is a problem creating/recording the new parameters.
-
buildBlurringPanel
part of the algorithm rests on blurring the original image.This is the same as using as blurring filter; so, this panel is a modified JDialogFrequencyFilter, permitting only a Gaussian low-pass, so only a top-end frequency input is created.
The panel is returned to the caller.
- Returns:
- The blurring parameter panel.
- See Also:
-
buildOkayCancelPanel
creates the planel which contains the OKAY and Cancel buttons. sets their sizes, colours and listeners.- Returns:
- DOCUMENT ME!
-
buildOptionsPanel
part of the algorithm rests on finding the original image minus an estimation of the local mean. So the input panel to set variables related to finding an unsharp mask image is created here.Part of the algorithm rests on blurring the original image. So the input panel to set the variables related to blurring the image is created here.
A colour image may have any of its three colour channels filtered, so a colour-selection panel is created. A colour panel will be generated even for a monochrome image, the colour panel will be disabled.
- Returns:
- A panel containing all the other algorithm option panels.
-
buildUnsharpPanel
part of the algorithm rests on finding the original image minus an estimation of the local mean.This is the same as using as unsharp-mask filter; so, this panel is a recreation of the inputs made in the JDialogUnsharpMask.
The panel is returned to the caller.
- Returns:
- The unsharp mask parameter panel.
- See Also:
-
checkBlurring
private boolean checkBlurring()check the variables of the unsharping-mask panel as they are translated from dialog inputs (ie.,JTextFields) to more usable, native types.The panel displays the appropriate error when there is an input violation.
- Returns:
truewhen the variables were copied correctly;falsewhen there is an error in an input;
-
checkText
verify that the numeric value of the text of the submitted JTextField is between a and b.- Parameters:
jtf- The text field to check.a- The minimum allowable value for the text field.b- The maximum allowable value for the text field.- Returns:
- The value contained within the text field.
- Throws:
NullPointerException- if jtf is empty.IllegalArgumentException- when the String is either not translatable to a float (ie., whenFloat.parseFloat(jtf.getText())throws a ClassCastException), or when the number is out-of-bounds. Note: a JTextField properly implementingmakeNumericsOnly(JTextField)should always translate into a float in the example above.- See Also:
-
checkText
verify that the numeric value of the text of the submitted JTextField is between a and b.- Parameters:
jtf- The text field to check.a- The minimum allowable value for the text field.b- The maximum allowable value for the text field.- Returns:
- The value contained within the text field.
- Throws:
NullPointerException- if jtf is empty.IllegalArgumentException- when the String is either not translatable to a float (ie., whenFloat.parseFloat(jtf.getText())throws a ClassCastException), or when the number is out-of-bounds. Note: a JTextField properly implementingmakeNumericsOnly(JTextField)should always translate into a float in the example above.- See Also:
-
checkUnsharping
private boolean checkUnsharping()check the variables of the unsharping-mask panel as they are translated from dialog inputs (ie.,JTextFields) to more usable, native types.The panel displays the appropriate error when there is an input violation.
- Returns:
truewhen the variables were copied correctly;falsewhen there is an error in an input;
-
createEntryField
Builds a new JTextField, with the given String, sets its font (to MipavUtil.font12), sets the foreground colour (to Color.black), sets column width to 7, then returns the newly made JTextField.- Parameters:
presetText- the String to have the JTextField display.- Returns:
- a black-text, font12'd, JTextField displaying presetText.
-
setVariables
private boolean setVariables()Use the GUI results to set up the variables needed to run the algorithm.- Returns:
trueif parameters set successfully,falseotherwise.
-