Class JPanelSigmas

All Implemented Interfaces:
FocusListener, ItemListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible

public class JPanelSigmas extends JPanel implements FocusListener, ItemListener
A panel containing fields which allow the user to input sigmas in three dimensions (of, for example, a gaussian kernel). Also optionally normalizes the third dimension based on the image resolution.
Author:
mccreedy
See Also:
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      Use serialVersionUID for interoperability.
      See Also:
    • correctionFactorCheckbox

      private JCheckBox correctionFactorCheckbox
      gui
    • correctionFactorLabel

      private JLabel correctionFactorLabel
      label
    • labelGaussX

      private JLabel labelGaussX
    • labelGaussY

      private JLabel labelGaussY
    • labelGaussZ

      private JLabel labelGaussZ
      label
    • srcImage

      private ModelImage srcImage
      the input image which will be processed
    • textGaussX

      private JTextField textGaussX
      gui, sigma value
    • textGaussY

      private JTextField textGaussY
      gui, sigma value
    • textGaussZ

      private JTextField textGaussZ
      gui, sigma value
  • Constructor Details

    • JPanelSigmas

      public JPanelSigmas(ModelImage img)
      Construct the sigma panel.
      Parameters:
      img - the input image which will be processed
  • Method Details

    • enable3DComponents

      public void enable3DComponents(boolean enable3D)
      Enables or disables the components in this panel which are 3D-related.
      Parameters:
      enable3D - whether to enable the 3D components
    • enableResolutionCorrection

      public void enableResolutionCorrection(boolean enableCorrection)
      Enables or disables z-dimension sigma resolution correction.
      Parameters:
      enableCorrection - whether to enable the correction
    • enableLabelGaussX

      public void enableLabelGaussX(boolean enable)
    • enableLabelGaussY

      public void enableLabelGaussY(boolean enable)
    • enableTextGaussX

      public void enableTextGaussX(boolean enable)
    • enableTextGaussY

      public void enableTextGaussY(boolean enable)
    • focusGained

      public void focusGained(FocusEvent event)
      Do nothing.
      Specified by:
      focusGained in interface FocusListener
      Parameters:
      event - focus gained event
    • focusLost

      public void focusLost(FocusEvent event)
      When the user clicks the mouse out of a text field, resets the neccessary variables.
      Specified by:
      focusLost in interface FocusListener
      Parameters:
      event - focus lost event
    • getNormalizedSigmas

      public float[] getNormalizedSigmas()
      Returns the sigmas to use in the algorithm, with the z-dim normalized if the user has requested it.
      Returns:
      a 2 sigma array if the image is 2D, 3 sigmas if the input image is 3D (with the 3rd dim optionally normalized)
    • getUnnormalized3DSigmas

      public float[] getUnnormalized3DSigmas()
      Returns the un-normalized sigmas in three dimensions (even if the input image is 2D). This is used to record the values in the text fields when saving dialog defaults and during script recording.
      Returns:
      a 3 element array of un-normalized floating-point sigmas
    • isResolutionCorrectionEnabled

      public boolean isResolutionCorrectionEnabled()
      Returns whether the z-dimension sigma should be corrected based on the image resolution.
      Returns:
      true if the z-dimension sigma should be corrected
    • itemStateChanged

      public void itemStateChanged(ItemEvent event)
      Changes resolution normalization label based on whether or not the resolution normalization check box is checked.
      Specified by:
      itemStateChanged in interface ItemListener
      Parameters:
      event - checkbox item change event
    • setSigmaX

      public void setSigmaX(float sigma)
      Changes the sigma value in the x direction.
      Parameters:
      sigma - the new sigma
    • setSigmaY

      public void setSigmaY(float sigma)
      Changes the sigma value in the y direction.
      Parameters:
      sigma - the new sigma
    • setSigmaZ

      public void setSigmaZ(float sigma)
      Changes the un-normalized sigma value in the z direction.
      Parameters:
      sigma - the new sigma
    • testSigmaValues

      public boolean testSigmaValues()
      Tests the un-normalized sigma values against pre-determined okay values.
      Returns:
      true if all the sigmas are in a good range, false otherwise
    • getCorrectionFactor

      private float getCorrectionFactor()
      Returns the amount of correction which should be applied to the z-direction sigma (assuming that correction is requested).
      Returns:
      the amount to multiply the z-sigma by to correct for resolution differences
    • getCorrectionFactorString

      private String getCorrectionFactorString()
      Returns a string indicating the z-direction sigma after applying the resolution correction factor.
      Returns:
      resolution corrected z-sigma string
    • setBorderName

      public void setBorderName(String borderName)
      Set the name of the titled border
      Parameters:
      borderName -
    • initGUI

      private void initGUI()
      Initialize the panel's GUI.
    • updateResolutionCorrection

      private void updateResolutionCorrection()
      Updates the resolution-corrected z-direction sigma label.