Class JDialogMSFuzzyCMeans

All Implemented Interfaces:
AlgorithmInterface, ScriptableActionInterface, DialogDefaultsInterface, ActionListener, FocusListener, ItemListener, WindowListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible, ListSelectionListener, RootPaneContainer, WindowConstants

public class JDialogMSFuzzyCMeans extends JDialogScriptableBase implements AlgorithmInterface, ListSelectionListener
Dialog to get user input, then call the algorithm.
See Also:
  • Field Details

    • serialVersionUID

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

      DOCUMENT ME!
    • centroids

      private float[] centroids
      DOCUMENT ME!
    • changeRemoveIndex

      private boolean changeRemoveIndex
      DOCUMENT ME!
    • chooserButton

      private JButton chooserButton
      DOCUMENT ME!
    • colorPanel

      private JPanelColorChannels colorPanel
      DOCUMENT ME!
    • cropBackground

      private boolean cropBackground
      DOCUMENT ME!
    • cropCheckbox

      private JCheckBox cropCheckbox
      DOCUMENT ME!
    • destExtents

      private int[] destExtents
      DOCUMENT ME!
    • endTol

      private float endTol
      DOCUMENT ME!
    • fuzzyOnly

      private JRadioButton fuzzyOnly
      DOCUMENT ME!
    • hardFuzzyBoth

      private JRadioButton hardFuzzyBoth
      DOCUMENT ME!
    • hardOnly

      private JRadioButton hardOnly
      DOCUMENT ME!
    • imageList

      private JList imageList
      DOCUMENT ME!
    • imagePanel

      private JPanel imagePanel
      DOCUMENT ME!
    • imageVOIGroup

      private ButtonGroup imageVOIGroup
      DOCUMENT ME!
    • imageVOIPanel

      private JPanel imageVOIPanel
      DOCUMENT ME!
    • labelEndTol

      private JLabel labelEndTol
      DOCUMENT ME!
    • labelExpo

      private JLabel labelExpo
      DOCUMENT ME!
    • labelMaxIter

      private JLabel labelMaxIter
      DOCUMENT ME!
    • labelNClasses

      private JLabel labelNClasses
      DOCUMENT ME!
    • maxIter

      private int maxIter
      DOCUMENT ME!
    • model

      private DefaultListModel model
      DOCUMENT ME!
    • nClasses

      private int nClasses
      DOCUMENT ME!
    • nPyramid

      private int nPyramid
      DOCUMENT ME!
    • oneJacobiIter

      private int oneJacobiIter
      DOCUMENT ME!
    • oneSmooth

      private float oneSmooth
      DOCUMENT ME!
    • outputGainField

      private boolean outputGainField
      private JCheckBox calcGainFieldCheckbox;.
    • paramPanel

      private JPanel paramPanel
      DOCUMENT ME!
    • presentNumber

      private int presentNumber
      DOCUMENT ME!
    • q

      private float q
      DOCUMENT ME!
    • regionFlag

      private boolean regionFlag
      DOCUMENT ME!
    • removeButton

      private JButton removeButton
      DOCUMENT ME!
    • removeIndex

      private int removeIndex
      DOCUMENT ME!
    • resultImage

      private ModelImage[] resultImage
      DOCUMENT ME!
    • resultNumber

      private int resultNumber
      DOCUMENT ME!
    • segmentation

      private int segmentation
      DOCUMENT ME!
    • segmentationGroup

      private ButtonGroup segmentationGroup
      DOCUMENT ME!
    • segmentationPanel

      private JPanel segmentationPanel
      DOCUMENT ME!
    • srcImage

      private ModelImage[] srcImage
      DOCUMENT ME!
    • srcNumber

      private int srcNumber
      DOCUMENT ME!
    • tempImage

      private ModelImage[] tempImage
      DOCUMENT ME!
    • textEndTol

      private JTextField textEndTol
      DOCUMENT ME!
    • textExpo

      private JTextField textExpo
      DOCUMENT ME!
    • textMaxIter

      private JTextField textMaxIter
      DOCUMENT ME!
    • textNClasses

      private JTextField textNClasses
      DOCUMENT ME!
    • threshold

      private float[] threshold
      DOCUMENT ME!
    • twoJacobiIter

      private int twoJacobiIter
      DOCUMENT ME!
    • twoSmooth

      private float twoSmooth
      DOCUMENT ME!
    • userInterface

      private ViewUserInterface userInterface
      DOCUMENT ME!
    • VOIRegions

      private JRadioButton VOIRegions
      DOCUMENT ME!
    • wholeImage

      private JRadioButton wholeImage
      DOCUMENT ME!
  • Constructor Details

    • JDialogMSFuzzyCMeans

      public JDialogMSFuzzyCMeans()
      Empty constructor needed for dynamic instantiation (used during scripting).
    • JDialogMSFuzzyCMeans

      public JDialogMSFuzzyCMeans(Frame theParentFrame, ModelImage im)
      Creates a new JDialogMSFuzzyCMeans object.
      Parameters:
      theParentFrame - parent frame
      im - source image
  • Method Details

    • actionPerformed

      public void actionPerformed(ActionEvent event)
      Closes dialog box when the OK button is pressed and calls the algorithm.
      Specified by:
      actionPerformed in interface ActionListener
      Overrides:
      actionPerformed in class JDialogBase
      Parameters:
      event - Event that triggers function.
    • algorithmPerformed

      public void algorithmPerformed(AlgorithmBase algorithm)
      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:
      algorithmPerformed in interface AlgorithmInterface
      Parameters:
      algorithm - Algorithm that caused the event.
    • getResultImage

      public ModelImage[] getResultImage()
      Accessor that returns the image.
      Returns:
      The result image.
    • setCentroids

      public void setCentroids(float[] centroids)
      Accessor that sets the centroids.
      Parameters:
      centroids - Value to set centroids to.
    • setCrop

      public void setCrop(boolean flag)
      Accessor that sets the crop background flag.
      Parameters:
      flag - true indicates crop the background, false otherwise.
    • setEndTol

      public void setEndTol(float scale)
      Accessor that sets the end tol.
      Parameters:
      scale - Value to set end tol to.
    • setMaxIter

      public void setMaxIter(int max)
      Accessor that sets the max iterations.
      Parameters:
      max - The max iterations
    • setNClasses

      public void setNClasses(int classes)
      Accessor that sets the number of classes.
      Parameters:
      classes - The number of classes.
    • setQ

      public void setQ(float scale)
      Accessor that sets the q variable.
      Parameters:
      scale - Value to set q variable to.
    • setRegionFlag

      public void setRegionFlag(boolean flag)
      Accessor that sets the region flag.
      Parameters:
      flag - true indicates the whole image is blurred, false indicates a region.
    • setSegmentationType

      public void setSegmentationType(int type)
      Accessor that sets the segmentation type (BOTH_FUZZY_HARD, FUZZY, or HARD).
      Parameters:
      type - The segmentation type.
    • setSourceImage

      public void setSourceImage(ModelImage[] images)
      Accessor that sets the array of source images.
      Parameters:
      images - new source images.
    • setThreshold

      public void setThreshold(float[] threshold)
      Accessor that sets the threshold.
      Parameters:
      threshold - Value to set threshold to.
    • valueChanged

      public void valueChanged(ListSelectionEvent evt)
      Sets the remove index based on the selected index in the list.
      Specified by:
      valueChanged in interface ListSelectionListener
      Parameters:
      evt - Event that caused this method to fire.
    • callAlgorithm

      protected void callAlgorithm()
      Once all the necessary variables are set, call the Fuzzy C Means algorithm based on what type of image this is and whether or not there is a separate destination image.
      Specified by:
      callAlgorithm in class JDialogScriptableBase
    • doPostAlgorithmActions

      protected void doPostAlgorithmActions()
      Store the result image in the script runner's image table now that the action execution is finished.
      Overrides:
      doPostAlgorithmActions in class JDialogScriptableBase
    • setGUIFromParams

      protected void setGUIFromParams()
      Set the dialog GUI using the script parameters while running this algorithm as part of a script.
      Specified by:
      setGUIFromParams in class JDialogScriptableBase
    • storeParamsFromGUI

      protected void storeParamsFromGUI() throws ParserException
      Record the parameters just used to run this algorithm in a script.
      Specified by:
      storeParamsFromGUI in class JDialogScriptableBase
      Throws:
      ParserException - If there is a problem creating/recording the new parameters.
    • checkImage

      private boolean checkImage(ModelImage testImage)
      Checks the color and dimensionality of the new image vs. the original source image. All new images should have the same color modality as the source and be of the same dimensions.
      Parameters:
      testImage - DOCUMENT ME!
      Returns:
      Flag indicating if the image checks out.
    • getCentroidsThreshold

      private boolean getCentroidsThreshold()
      Gets the minimum and maximum of each image and initializes the centroids dialog appropriately.
      Returns:
      Flag indicating a successful get.
    • getFileFilter

      private FileFilter getFileFilter(JFileChooser chooser, int index)
      A private helper function to get the current used FileFilter from JFileChooser.
      Parameters:
      chooser - DOCUMENT ME!
      index - the index of the choosable file filters.
      Returns:
      the current used file filter.
    • init

      private void init()
      Sets up the GUI (panels, buttons, etc) and displays it on the screen.
    • open

      private ModelImage open()
      Open an image based on the suffix of the file.
      Returns:
      The image.
    • setVariables

      private boolean setVariables()
      Use the GUI results to set up the variables needed to run the algorithm.
      Returns:
      true if parameters set successfully, false otherwise.