Class LsePdeFilter

  • Direct Known Subclasses:
    LsePdeFilter2, LsePdeFilter3

    public abstract class LsePdeFilter
    extends java.lang.Object
    The abstract base class for finite-difference-based solvers for partial differential equations. This system exists to support level-set evolution for image segmentation.
    Version:
    0.1 November 7, 2006
    Author:
    David Eberly
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected int m_eScaleType
      The type of image scaling used during filter construction.
      protected float m_fBorderValue
      When set to Float.MAX_VALUE, Neumann conditions are in use (zero-valued derivatives on the image border).
      protected float m_fMin
      The minimum image value.
      protected float m_fOffset
      The offset used in scaling the image data.
      protected float m_fScale
      The scale factor used in scaling the image data.
      protected float m_fTimeStep
      The time step for the PDE solver.
      protected int m_iQuantity
      The number of image elements.
      static int NONE
      Scale type: no scaling.
      static int PRESERVE_ZERO
      Scale type: max > -min: d' = d/max in [min/max,1] max
      static int SYMMETRIC
      Scale type: d' = -1 + 2*(d-min)/(max-min) in [-1,1]
      static int UNIT
      Scale type: d' = (d-min)/(max-min) in [0,1]
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected LsePdeFilter​(int iQuantity, float[] afData, float fBorderValue, int eScaleType)
      Creates a new PDE filter object.
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      float getBorderValue()
      Get the image border value.
      int getQuantity()
      Get the number of image elements.
      int getScaleType()
      Get the type of image scaling.
      float getTimeStep()
      Get the time step for the PDE solver.
      protected abstract void onPostUpdate()
      An abstract function that allows derived classes to implement any desired behavior after the PDE solver applies its update function.
      protected abstract void onPreUpdate()
      An abstract function that allows derived classes to implement any desired behavior before the PDE solver applies its update function.
      protected abstract void onUpdate()
      An abstract function for the update function of the PDE solver.
      void setTimeStep​(float fTimeStep)
      Set the time step for the PDE solver.
      void update()
      The entry point to updating the PDE solver.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • UNIT

        public static final int UNIT
        Scale type: d' = (d-min)/(max-min) in [0,1]
        See Also:
        Constant Field Values
      • SYMMETRIC

        public static final int SYMMETRIC
        Scale type: d' = -1 + 2*(d-min)/(max-min) in [-1,1]
        See Also:
        Constant Field Values
      • PRESERVE_ZERO

        public static final int PRESERVE_ZERO
        Scale type: max > -min: d' = d/max in [min/max,1] max
        See Also:
        Constant Field Values
        • m_iQuantity

          protected int m_iQuantity
          The number of image elements.
        • m_fBorderValue

          protected float m_fBorderValue
          When set to Float.MAX_VALUE, Neumann conditions are in use (zero-valued derivatives on the image border). Dirichlet conditions are used, otherwise (image is constant on the border).
        • m_eScaleType

          protected int m_eScaleType
          The type of image scaling used during filter construction.
        • m_fMin

          protected float m_fMin
          The minimum image value.
        • m_fOffset

          protected float m_fOffset
          The offset used in scaling the image data.
        • m_fScale

          protected float m_fScale
          The scale factor used in scaling the image data.
        • m_fTimeStep

          protected float m_fTimeStep
          The time step for the PDE solver. The stability of an algorithm depends on the magnitude of the time step but the magnitude itself depends on the algorithm.
        • Constructor Detail

          • LsePdeFilter

            protected LsePdeFilter​(int iQuantity,
                                   float[] afData,
                                   float fBorderValue,
                                   int eScaleType)
            Creates a new PDE filter object.
            Parameters:
            iQuantity - The number of image elements.
            afData - The image elements, stored in lexicographical order.
            fBorderValue - Specifies how to handle the image value. When set to Float.MAX_VALUE, Neumann conditions are in use, in which case zero-valued derivatives are assumed on the image border. Otherwise, Dirichlet conditions are used, in which case the image is assumed to be constant on the border with value specified by fBorderValue.
            eScaleType - The type of scaling to apply to the input image. The choices are NONE, UNIT, SYMMETRIC, or PRESERVE_ZERO.
        • Method Detail

          • getQuantity

            public final int getQuantity()
            Get the number of image elements.
            Returns:
            The number of image elements.
          • getBorderValue

            public final float getBorderValue()
            Get the image border value.
            Returns:
            The image border value.
          • getScaleType

            public final int getScaleType()
            Get the type of image scaling.
            Returns:
            The type of image scaling.
          • setTimeStep

            public final void setTimeStep​(float fTimeStep)
            Set the time step for the PDE solver.
            Parameters:
            fTimeStep - The time step for the PDE solver. It must be a positive number. Its maximum-allowed size depends on the specific algorithm.
          • getTimeStep

            public final float getTimeStep()
            Get the time step for the PDE solver.
            Returns:
            The time step for the PDE solver.
          • update

            public void update()
            The entry point to updating the PDE solver. This function calls OnPreUpdate, OnUpdate, and OnPostUpdate, in that order.
          • onPreUpdate

            protected abstract void onPreUpdate()
            An abstract function that allows derived classes to implement any desired behavior before the PDE solver applies its update function. The derived classes for 2D and 3D implement this to recompute the boundary values when Neumann conditions are used. If derived classes built on top of the 2D or 3D classes implement this also, they must call the base-class OnPreUpdate first.
          • onUpdate

            protected abstract void onUpdate()
            An abstract function for the update function of the PDE solver. The derived classes for 2D and 3D implement this to iterate over the image elements, updating an element only if it is not masked out.
          • onPostUpdate

            protected abstract void onPostUpdate()
            An abstract function that allows derived classes to implement any desired behavior after the PDE solver applies its update function. The derived classes for 2D and 3D implement this to swap the buffers for the next pass. If derived classes built on top of the 2D or 3D classes implement this also, they must call the base-class OnPostUpdate last.