Class JDialogMaximumIntensityProjection

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

public class JDialogMaximumIntensityProjection extends JDialogScriptableBase implements ActionDiscovery, AlgorithmInterface, ChangeListener, KeyListener, ViewImageUpdateInterface
Dialog to call Maximum Intensity Projection. It should be noted that algorithms are executed in own thread. The Maximum Intensity Projection algorithm computes the maximum or the minimum intensity along each projection of a 3D image. The user can specify theshold values in image intensity for the calculation, as well as which projection to compute along (X, Y, or Z), the start and end slice used in the calculation, the size of a sliding 'window' in number of slices to use in the calculation, and whether to calculate the minimum, maximum or both projections. When the sliding window size is not equal to the number of slices used in the calculation the output is a 3D image, where each slice of the output image is computed using the number of slices in the sliding window. When the sliding window size is equal to the number of slices used in the calculation the output image is a 2D image.
Author:
joshim2
See Also:
  • Field Details

    • serialVersionUID

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

      private static final String PREVIEW
      See Also:
    • PREV_ON

      private static final String PREV_ON
      See Also:
    • PREV_OFF

      private static final String PREV_OFF
      See Also:
    • image

      private ModelImage image
      Source Image.
    • minInput

      private JTextField[] minInput
      JTextfield for minimum value of threshold.
    • maxInput

      private JTextField[] maxInput
      JTextfield for maximum value of threshold.
    • startInput

      private JTextField[] startInput
      JTextfield for start slice of the computation.
    • stopInput

      private JTextField[] stopInput
      JTextfield for end slice of the computation.
    • minIntensity

      private float[] minIntensity
      Minimum intensity threshold.
    • maxIntensity

      private float[] maxIntensity
      Maximum intensity threshold.
    • minInputR

      private JTextField[] minInputR
      JTextfield for minimum Red value of threshold.
    • maxInputR

      private JTextField[] maxInputR
      JTextfield for maximum Red value of threshold.
    • minInputG

      private JTextField[] minInputG
      JTextfield for minimum Green value of threshold.
    • maxInputG

      private JTextField[] maxInputG
      JTextfield for maximum Green value of threshold.
    • minInputB

      private JTextField[] minInputB
      JTextfield for minimum Blue value of threshold.
    • maxInputB

      private JTextField[] maxInputB
      JTextfield for maximum Blue value of threshold.
    • minIntensityR

      private float[] minIntensityR
      Minimum Red intensity threshold.
    • maxIntensityR

      private float[] maxIntensityR
      Maximum Red intensity threshold.
    • minIntensityG

      private float[] minIntensityG
      Minimum Green intensity threshold.
    • maxIntensityG

      private float[] maxIntensityG
      Maximum Green intensity threshold.
    • minIntensityB

      private float[] minIntensityB
      Minimum Blue intensity threshold.
    • maxIntensityB

      private float[] maxIntensityB
      Maximum Blue intensity threshold.
    • maximumCheck

      private JCheckBox[] maximumCheck
      CheckBox turns on/off calculating the maximum projection.
    • minimumCheck

      private JCheckBox[] minimumCheck
      CheckBox turns on/off calculating the minimum projection.
    • windowLabel

      private JLabel[] windowLabel
      Label displays the number of slices in the sliding window.
    • windowSlider

      private ViewJSlider[] windowSlider
      Slider enables user to change the size of the sliding window.
    • maximum

      private boolean[] maximum
      When true, calculate the maximum (X,Y,Z) slices.
    • minimum

      private boolean[] minimum
      When true, calculate the minimum (X,Y,Z) slices.
    • startSlice

      private int[] startSlice
      Value of the start slice for the calculation (X,Y,Z).
    • endSlice

      private int[] endSlice
      Value of the end slice for the calculation (X,Y,Z).
    • window

      private int[] window
      Value of the window size for the calculation (X,Y,Z).
    • projection

      private boolean[] projection
      When true output the X,Y,Z projections.
    • nDims

      private int nDims
      Image dimension, must be 3.
    • extents

      private int[] extents
      Image extents.
    • minSlicePreview

      private ModelImage minSlicePreview
      Single slice preview images
    • maxSlicePreview

      private ModelImage maxSlicePreview
      Single slice preview images
    • tabbedPane

      private JTabbedPane tabbedPane
      The tabbed pane that holds each dimension
    • minSliceWindow

      private ViewJFrameImage minSliceWindow
      Windows containing preview images
    • maxSliceWindow

      private ViewJFrameImage maxSliceWindow
      Windows containing preview images
    • cachedTab

      private int cachedTab
      Cached value of selected tab
    • slice

      private int slice
      Current slice of image
    • doPreview

      private boolean doPreview
      Whether preview mode is turned on.
    • dim

      private int dim
      Used for construction of the preview.
    • sliceSize

      private int sliceSize
      Used for construction of the preview.
    • index

      private int index
      Used for construction of the preview.
    • sliceLoc

      private int sliceLoc
      Used for construction of the preview.
    • cFactor

      private int cFactor
      Used for construction of the preview.
  • Constructor Details

    • JDialogMaximumIntensityProjection

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

      public JDialogMaximumIntensityProjection(Frame theParentFrame, ModelImage im)
      Sets the appropriate variables.
      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
    • getPreviewExtents

      private int[] getPreviewExtents()
    • getPreviewImageType

      private int getPreviewImageType()
    • initMinPreview

      private void initMinPreview()
    • initMaxPreview

      private void initMaxPreview()
    • populatePreview

      private void populatePreview()
      Previews the currently active slice would loosely go with either min or max sliding window. Current slice is this.slice
    • getCurrentVal

      private double getCurrentVal(double[] buffer)
      Parameters:
      buffer - image buffer
      Returns:
      map of location in image buffer to resulting location in MIP.
    • 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 complete, so that the dialog can display the result image and/or clean up.
      Specified by:
      algorithmPerformed in interface AlgorithmInterface
      Parameters:
      algorithm - Algorithm that caused the event.
    • callAlgorithm

      public void callAlgorithm()
      Calls the algorithm.
      Specified by:
      callAlgorithm in class JDialogScriptableBase
    • determineNull

      protected JTextField determineNull(JTextField min, JTextField max)
      When one of the text inputs has been left blank, trying to convert them to ints results in throwing a null pointer exception. This method determines which one of the JTextFields threw the null pointer Exception.
      Parameters:
      min - one of the JTextFields the threw the null exception.
      max - one of the JTextFields the threw the null exception.
      Returns:
      either min or max.
    • setMin

      public void setMin(int i, float x)
      Sets the minimum value for X, Y, or Z processing.
      Parameters:
      i - index (X, Y, or Z)
      x - Value to set minimum value to.
    • setMax

      public void setMax(int i, float x)
      Sets the maximum value for X, Y, or Z processing.
      Parameters:
      i - index (X, Y, or Z)
      x - Value to set maximum value to.
    • setMinR

      public void setMinR(int i, float minR)
      Sets the minimum Red value for X, Y, or Z processing.
      Parameters:
      i - index (X, Y, or Z)
      minR - Value to set minimum Red value to.
    • setMaxR

      public void setMaxR(int i, float maxR)
      Sets the maximum Red value for X, Y, or Z processing.
      Parameters:
      i - index (X, Y, or Z)
      maxR - Value to set maximum Red value to.
    • setMinG

      public void setMinG(int i, float minG)
      Sets the minimum Green value for X, Y, or Z processing.
      Parameters:
      i - index (X, Y, or Z)
      minG - Value to set minimum Green value to.
    • setMaxG

      public void setMaxG(int i, float maxG)
      Sets the maximum Green value for X, Y, or Z processing.
      Parameters:
      i - index (X, Y, or Z)
      maxG - Value to set maximum Green value to.
    • setMinB

      public void setMinB(int i, float minB)
      Sets the minimum Blue value for X, Y, or Z processing.
      Parameters:
      i - index (X, Y, or Z)
      minB - Value to set minimum Blue value to.
    • setMaxB

      public void setMaxB(int i, float maxB)
      Sets the maximumBlue value for X, Y, or Z processing.
      Parameters:
      i - index (X, Y, or Z)
      maxB - Value to set maximum Blue value to.
    • setStartSlice

      public void setStartSlice(int i, int start)
      Sets the start slice for X, Y, or Z processing.
      Parameters:
      i - index (X, Y, or Z)
      start - value.
    • setEndSlice

      public void setEndSlice(int i, int end)
      Sets the end slice for X, Y, or Z processing.
      Parameters:
      i - index (X, Y, or Z)
      end - value.
    • setWindow

      public void setWindow(int i, int size)
      Sets the window size for X, Y, or Z processing.
      Parameters:
      i - index (X, Y, or Z)
      size - , new window size.
    • setComputeMax

      public void setComputeMax(int i, boolean compute)
      Turns computing the maximum projection on for X, Y, or Z processing.
      Parameters:
      i - index representing (X,Y,Z) projection.
      compute - when true the computation is turned on.
    • setComputeMin

      public void setComputeMin(int i, boolean compute)
      Turns computing the minimum projection on for X, Y, or Z processing.
      Parameters:
      i - index representing (X,Y,Z) projection.
      compute - when true the computation is turned on.
    • 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.
    • initData

      private void initData()
      Allocates local memory.
    • init

      private void init()
      Initializes the GUI components and places them in dialog.
    • 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.
    • stateChanged

      public void stateChanged(ChangeEvent e)
      Specified by:
      stateChanged in interface ChangeListener
    • destroyPreview

      private void destroyPreview()
    • keyTyped

      public void keyTyped(KeyEvent e)
      Specified by:
      keyTyped in interface KeyListener
    • keyPressed

      public void keyPressed(KeyEvent e)
      Specified by:
      keyPressed in interface KeyListener
    • keyReleased

      public void keyReleased(KeyEvent e)
      Specified by:
      keyReleased in interface KeyListener
    • focusLost

      public void focusLost(FocusEvent e)
      Description copied from class: JDialogBase
      Unchanged.
      Specified by:
      focusLost in interface FocusListener
      Overrides:
      focusLost in class JDialogBase
      Parameters:
      e - FocusEvent
    • getActionMetadata

      public ActionMetadata getActionMetadata()
      Description copied from interface: ActionDiscovery
      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()
      Description copied from interface: ActionDiscovery
      Returns a table listing the input parameters of this algorithm (which should match up with the scripting parameters used in
      invalid reference
      #setGUIFromParams()
      ).
      Specified by:
      createInputParameters in interface ActionDiscovery
      Returns:
      A parameter table listing the inputs of this algorithm.
    • createOutputParameters

      public ParameterTable createOutputParameters()
      Description copied from interface: ActionDiscovery
      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)
      Description copied from interface: ActionDiscovery
      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()
      Description copied from interface: ActionDiscovery
      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.
    • setSlice

      public void setSlice(int slice)
      Description copied from interface: ViewImageUpdateInterface
      setSlice.
      Specified by:
      setSlice in interface ViewImageUpdateInterface
      Parameters:
      slice - Current slice
    • setTimeSlice

      public void setTimeSlice(int tSlice)
      Description copied from interface: ViewImageUpdateInterface
      setTimeSlice.
      Specified by:
      setTimeSlice in interface ViewImageUpdateInterface
      Parameters:
      tSlice - Current time volume
    • updateImageExtents

      public boolean updateImageExtents()
      Description copied from interface: ViewImageUpdateInterface
      This methods calls the componentImage's REPAINT method to redraw the screen. The extents on this image have changed, so the extents need to be read in again and menus, panes and slide bars adjusted accordingly.
      Specified by:
      updateImageExtents in interface ViewImageUpdateInterface
      Returns:
      boolean confirming successful update
    • updateImages

      public boolean updateImages()
      Description copied from interface: ViewImageUpdateInterface
      This methods calls the componentImage's REPAINT method to redraw the screen. Without LUT changes or image changes
      Specified by:
      updateImages in interface ViewImageUpdateInterface
      Returns:
      boolean confirming successful update
    • updateImages

      public boolean updateImages(boolean flag)
      Description copied from interface: ViewImageUpdateInterface
      This methods calls the componentImage's update method to redraw the screen. Without LUT changes.
      Specified by:
      updateImages in interface ViewImageUpdateInterface
      Parameters:
      flag - forces show to re import image and calc. java image
      Returns:
      boolean confirming successful update
    • updateImages

      public boolean updateImages(ModelLUT LUTa, ModelLUT LUTb, boolean flag, int interpMode)
      Description copied from interface: ViewImageUpdateInterface
      This methods calls the componentImage's update method to redraw the screen.
      Specified by:
      updateImages in interface ViewImageUpdateInterface
      Parameters:
      LUTa - LUT used to update imageA
      LUTb - LUT used to update imageB
      flag - forces show to re import image and calc. java image
      interpMode - image interpolation method (Nearest or Smooth)
      Returns:
      boolean confirming a successful update