Class JDialogCorrectSpacing

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

public class JDialogCorrectSpacing extends JDialogScriptableBase implements AlgorithmInterface
Algorithm to adjust image volume for cases when the slice spacing is not equal to the slice thickness. When spacing > thickness: repeat images from original image set insert blank images (so that in the final image volume, all images will have the same slice thickness and the image volume will be to proper scale. When spacing < thickness: set thickness = spacing. Only works for DICOM or XML files, since they include the sliceSpacing field.
See Also:
  • Field Details

    • serialVersionUID

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

      private AlgorithmCorrectSpacing correctSpaceAlgo
      DOCUMENT ME!
    • extents

      private int[] extents
      DOCUMENT ME!
    • fileInfoBuffer

      private FileInfoBase fileInfoBuffer
      DOCUMENT ME!
    • image

      private ModelImage image
      DOCUMENT ME!
    • numIm

      private int numIm
      DOCUMENT ME!
    • numRepIm

      private int numRepIm
      DOCUMENT ME!
    • numBlank

      private int numBlank
      DOCUMENT ME!
    • newNumIm

      private int newNumIm
      DOCUMENT ME!
    • resultImage

      private ModelImage resultImage
      DOCUMENT ME!
    • thick

      private float thick
      DOCUMENT ME!
    • space

      private float space
      DOCUMENT ME!
    • gap

      private float gap
      DOCUMENT ME!
    • newThick

      private float newThick
      DOCUMENT ME!
    • zStart

      private float zStart
      DOCUMENT ME!
    • newZStart

      private float newZStart
      DOCUMENT ME!
    • titles

      private String[] titles
      DOCUMENT ME!
  • Constructor Details

    • JDialogCorrectSpacing

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

      public JDialogCorrectSpacing(JFrame parent, ModelImage image)
      Constructor that creates new dialog for Correct Spacing. No dialog will be displayed.
      Parameters:
      parent - Parent frame of this dialog.
      image - Active image in parent frame.
  • Method Details

    • algorithmPerformed

      public void algorithmPerformed(AlgorithmBase algorithm)
      This method is required if the AlgorithmInterface is implemented.
      Specified by:
      algorithmPerformed in interface AlgorithmInterface
      Parameters:
      algorithm - Algorithm that caused the event.
    • callAlgorithm

      public void callAlgorithm()
      Call algorithm to copy appropriate images from original, and double where necessary.
      Specified by:
      callAlgorithm in class JDialogScriptableBase
    • getResultImage

      public ModelImage getResultImage()
      Accessor that returns the image.
      Returns:
      The result image
    • 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.
    • correctSpaceLTthick

      private void correctSpaceLTthick(ModelImage im, float newThickVal)
      This method corrects spacing for cases where the space is less than the thickness.
      Parameters:
      im - DOCUMENT ME!
      newThickVal - DOCUMENT ME!
    • generateNewImages

      private void generateNewImages()
      Generates new images. Calculates the new total number of images (newNumIm) and then generates new images with that dimension. Calls callAgorithm, passing it the resultImage.
    • getNewInfo

      private void getNewInfo()
      Calculates the new slice thickness (newThick), number of times to repeat each original image (numRepIm), the number of blanks to insert between the image duplicates (numBlank), and the new z coordinate origin for the image volume (newZStart).