Class AlgorithmInsertSlice

java.lang.Object
java.lang.Thread
gov.nih.mipav.model.algorithms.AlgorithmBase
gov.nih.mipav.model.algorithms.utilities.AlgorithmInsertSlice
All Implemented Interfaces:
ActionListener, WindowListener, Runnable, EventListener

public class AlgorithmInsertSlice extends AlgorithmBase
Algorithm to insert a slice. Operates with sliceType either AVERAGE or BLANK or ORGIINAL. If AVERAGE, the inserted slice is set equal to the mean of the 2 surrounding slices unless it is an new start or end. A new start or end simply preserves the usual slice spacing. In BLANK mode a slice with all pixels zero is inserted. In original a 2D image of the same dimensions is inserted. Must insert black and white with black and white and color with color.
  • Field Details

    • WEIGHTED_AVERAGE

      public static final int WEIGHTED_AVERAGE
      Weighted average slice type.
      See Also:
    • AVERAGE

      public static final int AVERAGE
      Average slice type - the inserted slice is set equal to the mean of the 2 surrounding slices.
      See Also:
    • BLANK

      public static final int BLANK
      Blank slice type - the inserted slice is blank.
      See Also:
    • ORIGINAL

      public static final int ORIGINAL
      Original slice type - a 2D image is inserted.
      See Also:
    • ADJACENT_DOWN

      public static final int ADJACENT_DOWN
      Copy adjacent slice.
      See Also:
    • ADJACENT_UP

      public static final int ADJACENT_UP
      Copy adjacent slice.
      See Also:
    • insertedImage

      private ModelImage insertedImage
      Image inserted for slice type == ORIGINAL.
    • insertSlice

      private int insertSlice
      Number of slice before which another slice is inserted.
    • oldZdim

      private int oldZdim
      Original Z dimension of the image.
    • sliceArea

      private int sliceArea
      Area of a slice (Xdim * Ydim).
    • sliceType

      private int sliceType
      Insert an AVERAGE or BLANK image slice.
    • weightPrevious

      private float weightPrevious
      For weighted averaging.
    • Xdim

      private int Xdim
      X dimension of the image.
    • Ydim

      private int Ydim
      Y dimension of the image.
  • Constructor Details

    • AlgorithmInsertSlice

      public AlgorithmInsertSlice(ModelImage srcImage, ModelImage destImage, int insertSlice, int sliceType, ModelImage insertedImage)
      Import source and destination images into the class.
      Parameters:
      srcImage - source image (image to clip from)
      destImage - destination image (image to paste to)
      insertSlice - number of slice before which another slice is inserted
      sliceType - AVERAGE or BLANK or ORIGINAL
      insertedImage - image inserted for sliceType == ORIGINAL
  • Method Details

    • finalize

      public void finalize()
      Prepares this class for destruction.
      Overrides:
      finalize in class AlgorithmBase
    • runAlgorithm

      public void runAlgorithm()
      Runs algorithm.
      Specified by:
      runAlgorithm in class AlgorithmBase
    • setWeightPrevious

      public void setWeightPrevious(float wp)
      DOCUMENT ME!
      Parameters:
      wp - DOCUMENT ME!