Class JDialogSubsample

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

public class JDialogSubsample extends JDialogScriptableBase implements AlgorithmInterface, ActionDiscovery, ItemListener
Dialog for subsampling a 2D or 3D or 4D image by 2, 4, or 8. With 4D images only the first 3 dimensions are subsampled.
Version:
1.0
Author:
Sir Benjamin Link
See Also:
  • Field Details

    • serialVersionUID

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

      private AlgorithmSubsample algoSub
      DOCUMENT ME!
    • by2Button

      private JRadioButton by2Button
      DOCUMENT ME!
    • by8Button

      private JRadioButton by8Button
      DOCUMENT ME!
    • by4Button

      private JRadioButton by4Button
      DOCUMENT ME!
    • label2OriginalExtentX

      private JLabel label2OriginalExtentX
      Label for displaying the original extent X
    • label2OriginalExtentY

      private JLabel label2OriginalExtentY
      Label for displaying the original extent Y
    • label2OriginalExtentZ

      private JLabel label2OriginalExtentZ
      Label for displaying the original extent Z
    • labelPaddedExtentX

      private JLabel labelPaddedExtentX
      Label for displaying the padded extent X
    • labelPaddedExtentY

      private JLabel labelPaddedExtentY
      Label for displaying the padded extent Y
    • labelPaddedExtentZ

      private JLabel labelPaddedExtentZ
      label for displaying the padded extent Z
    • denom

      private int denom
      DOCUMENT ME!
    • doVOI

      private boolean doVOI
      DOCUMENT ME!
    • image

      private ModelImage image
      DOCUMENT ME!
    • dim

      private int dim
      Number of dimensions in an image e.g 2D, 3D
    • doPad

      private boolean doPad
      The boolean value to determine whether to pad the original image or not.
    • extents

      private int[] extents
      The extents of original image
    • padExtents

      private int[] padExtents
      The extents of padded image
    • newExtents

      private int[] newExtents
      DOCUMENT ME!
    • oXres

      private float oXres
      DOCUMENT ME!
    • oYres

      private float oYres
      DOCUMENT ME!
    • oZres

      private float oZres
      DOCUMENT ME!
    • processIndep

      private boolean processIndep
      DOCUMENT ME!
    • processIndepBox

      private JCheckBox processIndepBox
      DOCUMENT ME!
    • resultImage

      private ModelImage resultImage
      DOCUMENT ME!
    • sigmas

      private float[] sigmas
      DOCUMENT ME!
    • Sx

      private float Sx
      DOCUMENT ME!
    • Sy

      private float Sy
      DOCUMENT ME!
    • Sz

      private float Sz
      DOCUMENT ME!
    • userInterface

      private ViewUserInterface userInterface
      DOCUMENT ME!
    • voiCheckBox

      private JCheckBox voiCheckBox
      DOCUMENT ME!
    • xfrm

      private TransMatrix xfrm
      DOCUMENT ME!
  • Constructor Details

    • JDialogSubsample

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

      public JDialogSubsample(Frame theParentFrame, ModelImage sourceImage)
      Constructor for creating the dialog via a parent frame.
      Parameters:
      theParentFrame - the parent frame
      sourceImage - the source image
  • Method Details

    • actionPerformed

      public void actionPerformed(ActionEvent e)
      Method for catching actions (button/script).
      Specified by:
      actionPerformed in interface ActionListener
      Overrides:
      actionPerformed in class JDialogBase
      Parameters:
      e - the action event
    • algorithmPerformed

      public void algorithmPerformed(AlgorithmBase algo)
      Method for catching end of algorithm events.
      Specified by:
      algorithmPerformed in interface AlgorithmInterface
      Parameters:
      algo - the algorithm that is caught
    • getResultImage

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

      public void itemStateChanged(ItemEvent event)
      Respond to checkbox item events.
      Specified by:
      itemStateChanged in interface ItemListener
      Overrides:
      itemStateChanged in class JDialogBase
      Parameters:
      event - item event
    • setDoVOI

      public void setDoVOI(boolean doVOI)
      Accessor that tells whether VOIs are transformed.
      Parameters:
      doVOI - boolean
    • setProcessIndep

      public void setProcessIndep(boolean processIndep)
      Accessor that sets whether slices are processed independently.
      Parameters:
      processIndep - DOCUMENT ME!
    • setSubsamplingRate

      public boolean setSubsamplingRate(int subSample)
      Accessor that programatically sets the subsampling amount
      Parameters:
      subSample - the subsampling rate, allowable values are 2, 4, and 8
      Returns:
      false when rate is unsupported
    • callAlgorithm

      protected void callAlgorithm()
      Method for calling the Subsample algorithm.
      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.
    • init

      private void init()
      Sets up the dialog window and makes it visible.
    • setVariables

      private boolean setVariables()
      Sets the variables based on the user's dialog input.
      Returns:
      was everything ok (unnecessary because there is no possible illegal user input)
    • isDivisible

      private boolean isDivisible(int dimValue, int scale)
      Check if the extent value is divisible by 2, 4 or 8.
      Parameters:
      dimValue - dimension value
      Returns:
      isPower2 true if dimValue is divisible 2, 4 or 8 false otherwise.
    • makeExtentDivisibleByDenom

      private int makeExtentDivisibleByDenom(int dimValue, int scale)
      Calculate the nearest extent value divisible by 2, 4 or 8
      Parameters:
      dimValue - extent value
      Returns:
      newDimValue extent value divisible by 2, 4 or 8.
    • getActionMetadata

      public ActionMetadata getActionMetadata()
      Return meta-information about this discoverable action for categorization and labeling purposes.
      Specified by:
      getActionMetadata in interface ActionDiscovery
      Returns:
      Metadata for this action.
    • createInputParameters

      public ParameterTable createInputParameters()
      Returns a table listing the input parameters of this algorithm (which should match up with the scripting parameters used in setGUIFromParams()).
      Specified by:
      createInputParameters in interface ActionDiscovery
      Returns:
      A parameter table listing the inputs of this algorithm.
    • createOutputParameters

      public ParameterTable createOutputParameters()
      Returns a table listing the output parameters of this algorithm (usually just labels used to obtain output image names later).
      Specified by:
      createOutputParameters in interface ActionDiscovery
      Returns:
      A parameter table listing the outputs of this algorithm.
    • getOutputImageName

      public String getOutputImageName(String imageParamName)
      Returns the name of an image output by this algorithm, the image returned depends on the parameter label given (which can be used to retrieve the image object from the image registry).
      Specified by:
      getOutputImageName in interface ActionDiscovery
      Parameters:
      imageParamName - The output image parameter label for which to get the image name.
      Returns:
      The image name of the requested output image parameter label.
    • isActionComplete

      public boolean isActionComplete()
      Returns whether the action has successfully completed its execution.
      Specified by:
      isActionComplete in interface ActionDiscovery
      Returns:
      True, if the action is complete. False, if the action failed or is still running.