]> Creatis software - FrontAlgorithms.git/commitdiff
Multiple thresholds region grow segmentation almost added.
authorLeonardo Florez-Valencia <florez-l@javeriana.edu.co>
Mon, 2 Feb 2015 23:15:24 +0000 (18:15 -0500)
committerLeonardo Florez-Valencia <florez-l@javeriana.edu.co>
Mon, 2 Feb 2015 23:15:24 +0000 (18:15 -0500)
lib/CMakeLists.txt
lib/fpa/Base/RegionGrow.h
lib/fpa/Base/RegionGrowWithMultipleCriteria.h [new file with mode: 0644]
lib/fpa/Base/RegionGrowWithMultipleCriteria.hxx [new file with mode: 0644]
lib/fpa/Image/Functors/ImageFunction.h [new file with mode: 0644]
lib/fpa/Image/Functors/RegionGrowAllBelongsFunction.h
lib/fpa/Image/Functors/RegionGrowThresholdFunction.h
lib/fpa/Image/RegionGrowWithMultipleCriteria.h [new file with mode: 0644]
lib/fpa/Image/RegionGrowWithMultipleThresholds.h
lib/fpa/Image/RegionGrowWithMultipleThresholds.hxx

index f1821ee5037a242c0d372fc136b5e15056a02fb8..ebff1036a33df818926f78fe467a1572bf2af885 100644 (file)
@@ -61,7 +61,7 @@ TARGET_LINK_LIBRARIES(
   ${LIB_NAME}
   ${${LIB_NAME}_LINK_LIBRARIES}
   ${ITK_LIBRARIES}
-  ${VTK_LIBRARIES}
+  vtkInteractionWidgets
   )
 
 ## eof - $RCSfile$
index e52fb6203c0e256624d8a010819ddc154b323cb7..f7f15625415ae6ef3772b71748e113782e6423fe 100644 (file)
@@ -77,12 +77,10 @@ namespace fpa
       typedef typename TTraits::TFrontId  _TFrontId;
       typedef typename TTraits::TNode     _TNode;
       typedef typename TTraits::TNodes    _TNodes;
-
-    private:
-      typedef std::queue< _TNode > _TQueue;
+      typedef std::queue< _TNode >        _TQueue;
 
     public:
-      itkTypeMacro( RegionGrow, Base );
+      itkTypeMacro( RegionGrow, Algorithm );
 
     protected:
       RegionGrow( );
@@ -102,7 +100,7 @@ namespace fpa
       RegionGrow( const Self& );     // Not impl.
       void operator=( const Self& ); // Not impl.
 
-    private:
+    protected:
       _TQueue m_Queue;
     };
 
diff --git a/lib/fpa/Base/RegionGrowWithMultipleCriteria.h b/lib/fpa/Base/RegionGrowWithMultipleCriteria.h
new file mode 100644 (file)
index 0000000..69fbc8e
--- /dev/null
@@ -0,0 +1,79 @@
+#ifndef __FPA__BASE__REGIONGROWWITHMULTIPLECRITERIA__H__
+#define __FPA__BASE__REGIONGROWWITHMULTIPLECRITERIA__H__
+
+#include <vector>
+#include <itkFunctionBase.h>
+#include <fpa/Base/RegionGrow.h>
+
+namespace fpa
+{
+  namespace Base
+  {
+    /**
+     * Region grow is a front propagation with no costs.
+     */
+    template< class V, class R, class VV, class VC, class B >
+    class RegionGrowWithMultipleCriteria
+      : public RegionGrow< V, R, VV, VC, B >
+    {
+    public:
+      typedef V  TVertex;
+      typedef R  TResult;
+      typedef VV TVertexValue;
+      typedef B  TBaseFilter;
+
+      /// Standard class typdedefs
+      typedef RegionGrowWithMultipleCriteria  Self;
+      typedef RegionGrow< V, R, VV, VC, B >   Superclass;
+      typedef itk::SmartPointer< Self >       Pointer;
+      typedef itk::SmartPointer< const Self > ConstPointer;
+
+      typedef typename Superclass::TTraits  TTraits;
+      typedef typename Superclass::TCost    TCost;
+      typedef itk::FunctionBase< V, TCost > TMembershipFunction;
+      typedef
+      typename TMembershipFunction::Pointer
+      TMembershipFunctionPointer;
+      typedef std::vector< TMembershipFunctionPointer > TFunctions;
+
+    protected:
+      typedef typename Superclass::_TFrontId  _TFrontId;
+      typedef typename Superclass::_TNode     _TNode;
+      typedef typename Superclass::_TNodes    _TNodes;
+      typedef typename Superclass::_TQueue    _TQueue;
+
+    public:
+      itkTypeMacro( RegionGrowWithMultipleCriteria, RegionGrow );
+
+    public:
+      unsigned int GetNumberOfMembershipFunctions( ) const;
+      void ClearMembershipFunctions( );
+      void AddMembershipFunction( TMembershipFunction* function );
+
+    protected:
+      RegionGrowWithMultipleCriteria( );
+      virtual ~RegionGrowWithMultipleCriteria( );
+
+      virtual void _BeforeLoop( );
+      virtual _TNode _QueuePop( );
+      virtual bool _CheckMembership( const _TNode& n ) const;
+
+    private:
+      RegionGrowWithMultipleCriteria( const Self& ); // Not impl.
+      void operator=( const Self& );                 // Not impl.
+
+    protected:
+      mutable _TQueue m_AuxiliaryQueue;
+      TFunctions m_Functions;
+      typename TFunctions::iterator m_ActualFunction;
+    };
+
+  } // ecapseman
+
+} // ecapseman
+
+#include <fpa/Base/RegionGrowWithMultipleCriteria.hxx>
+
+#endif // __FPA__BASE__REGIONGROWWITHMULTIPLECRITERIA__H__
+
+// eof - $RCSfile$
diff --git a/lib/fpa/Base/RegionGrowWithMultipleCriteria.hxx b/lib/fpa/Base/RegionGrowWithMultipleCriteria.hxx
new file mode 100644 (file)
index 0000000..34420b2
--- /dev/null
@@ -0,0 +1,82 @@
+#ifndef __FPA__BASE__REGIONGROWWITHMULTIPLECRITERIA__HXX__
+#define __FPA__BASE__REGIONGROWWITHMULTIPLECRITERIA__HXX__
+
+// -------------------------------------------------------------------------
+template< class V, class R, class VV, class VC, class B >
+unsigned int fpa::Base::RegionGrowWithMultipleCriteria< V, R, VV, VC, B >::
+GetNumberOfMembershipFunctions( ) const
+{
+  return( this->m_Functions.size( ) );
+}
+
+// -------------------------------------------------------------------------
+template< class V, class R, class VV, class VC, class B >
+void fpa::Base::RegionGrowWithMultipleCriteria< V, R, VV, VC, B >::
+ClearMembershipFunctions( )
+{
+  this->m_Functions.clear( );
+  this->Modified( );
+}
+
+// -------------------------------------------------------------------------
+template< class V, class R, class VV, class VC, class B >
+void fpa::Base::RegionGrowWithMultipleCriteria< V, R, VV, VC, B >::
+AddMembershipFunction( TMembershipFunction* function )
+{
+  this->m_Functions.push_back( function );
+  this->Modified( );
+}
+
+// -------------------------------------------------------------------------
+template< class V, class R, class VV, class VC, class B >
+fpa::Base::RegionGrowWithMultipleCriteria< V, R, VV, VC, B >::
+RegionGrowWithMultipleCriteria( )
+  : Superclass( )
+{
+}
+
+// -------------------------------------------------------------------------
+template< class V, class R, class VV, class VC, class B >
+fpa::Base::RegionGrowWithMultipleCriteria< V, R, VV, VC, B >::
+~RegionGrowWithMultipleCriteria( )
+{
+}
+
+// -------------------------------------------------------------------------
+template< class V, class R, class VV, class VC, class B >
+void fpa::Base::RegionGrowWithMultipleCriteria< V, R, VV, VC, B >::
+_BeforeLoop( )
+{
+  this->_BeforeLoop( );
+  this->m_ActualFunction = this->m_Functions.begin( );
+}
+
+// -------------------------------------------------------------------------
+template< class V, class R, class VV, class VC, class B >
+typename fpa::Base::RegionGrowWithMultipleCriteria< V, R, VV, VC, B >::
+_TNode fpa::Base::RegionGrowWithMultipleCriteria< V, R, VV, VC, B >::
+_QueuePop( )
+{
+  _TNode node = this->Superclass::_QueuePop( );
+  if( this->_IsQueueEmpty( ) )
+  {
+    std::cerr << "ERROR!!!!" << std::endl;
+
+  } // fi
+  return( node );
+}
+
+// -------------------------------------------------------------------------
+template< class V, class R, class VV, class VC, class B >
+bool fpa::Base::RegionGrowWithMultipleCriteria< V, R, VV, VC, B >::
+_CheckMembership( const _TNode& n ) const
+{
+  bool ret = ( *( this->m_ActualFunction ) )->Evaluate( n.Vertex );
+  if( !ret )
+    this->m_AuxiliaryQueue.push( n );
+  return( ret );
+}
+
+#endif // __FPA__BASE__REGIONGROWWITHMULTIPLECRITERIA__HXX__
+
+// eof - $RCSfile$
diff --git a/lib/fpa/Image/Functors/ImageFunction.h b/lib/fpa/Image/Functors/ImageFunction.h
new file mode 100644 (file)
index 0000000..a1cc9ec
--- /dev/null
@@ -0,0 +1,62 @@
+#ifndef __FPA__IMAGE__FUNCTORS__IMAGEFUNCTION__H__
+#define __FPA__IMAGE__FUNCTORS__IMAGEFUNCTION__H__
+
+#include <itkFunctionBase.h>
+
+namespace fpa
+{
+  namespace Image
+  {
+    namespace Functors
+    {
+      /**
+       */
+      template< class I, class O >
+      class ImageFunction
+        : public itk::FunctionBase< typename I::IndexType, O >
+      {
+      public:
+        /// Type-related and pointers
+        typedef ImageFunction                                 Self;
+        typedef itk::FunctionBase< typename I::IndexType, O > Superclass;
+        typedef itk::SmartPointer< Self >                     Pointer;
+        typedef itk::SmartPointer< const Self >               ConstPointer;
+
+        typedef I TInputImage;
+        typedef O TOutputValue;
+        typedef typename I::IndexType TIndex;
+
+      public:
+        itkTypeMacro( ImageFunction, itkFunctionBase );
+
+        itkGetConstObjectMacro( InputImage, I );
+        itkSetConstObjectMacro( InputImage, I );
+
+      public:
+        virtual O Evaluate( const TIndex& idx ) const = 0;
+
+      protected:
+        ImageFunction( )
+          : Superclass( )
+          { }
+        virtual ~ImageFunction( )
+          { }
+
+      private:
+        // Purposely not implemented
+        ImageFunction( const Self& );
+        void operator=( const Self& );
+
+      protected:
+        typename I::ConstPointer m_InputImage;
+      };
+
+    } // ecapseman
+
+  } // ecapseman
+
+} // ecapseman
+
+#endif // __FPA__IMAGE__FUNCTORS__IMAGEFUNCTION__H__
+
+// eof - $RCSfile$
index ca520505069b13503ad345013f87cee058f6d780..e352f59817c934bd6528eb21ac8344b0a6ff09b3 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef __FPA__IMAGE__FUNCTORS__REGIONGROWALLBELONGSFUNCTION__H__
 #define __FPA__IMAGE__FUNCTORS__REGIONGROWALLBELONGSFUNCTION__H__
 
-#include <itkImageFunction.h>
+#include <fpa/Image/Functors/ImageFunction.h>
 
 namespace fpa
 {
@@ -13,45 +13,26 @@ namespace fpa
        */
       template< class I >
       class RegionGrowAllBelongsFunction
-        : public itk::ImageFunction< I, bool >
+        : public fpa::Image::Functors::ImageFunction< I, bool >
       {
       public:
         /// Type-related and pointers
-        typedef RegionGrowAllBelongsFunction    Self;
-        typedef itk::ImageFunction< I, bool >   Superclass;
-        typedef itk::SmartPointer< Self >       Pointer;
-        typedef itk::SmartPointer< const Self > ConstPointer;
+        typedef RegionGrowAllBelongsFunction                   Self;
+        typedef fpa::Image::Functors::ImageFunction< I, bool > Superclass;
+        typedef itk::SmartPointer< Self >                      Pointer;
+        typedef itk::SmartPointer< const Self >                ConstPointer;
 
         // Superclass' types
-        typedef typename Superclass::InputImageType      InputImageType;
-        typedef typename Superclass::InputPixelType      InputPixelType;
-        typedef typename Superclass::OutputType          OutputType;
-        typedef typename Superclass::CoordRepType        CoordRepType;
-        typedef typename Superclass::IndexType           IndexType;
-        typedef typename Superclass::IndexValueType      IndexValueType;
-        typedef typename Superclass::ContinuousIndexType ContinuousIndexType;
-        typedef typename Superclass::PointType           PointType;
+        typedef typename Superclass::TInputImage  TInputImage;
+        typedef typename Superclass::TOutputValue TOutputValue;
+        typedef typename Superclass::TIndex       TIndex;
 
       public:
         itkNewMacro( Self );
         itkTypeMacro( RegionGrowAllBelongsFunction, itkImageFunction );
 
       public:
-        virtual OutputType Evaluate( const PointType& point ) const
-          {
-            IndexType index;
-            this->ConvertPointToNearestIndex( point, index );
-            return( this->EvaluateAtIndex( index ) );
-          }
-        virtual OutputType EvaluateAtContinuousIndex(
-          const ContinuousIndexType& cindex
-          ) const
-          {
-            IndexType index;
-            this->ConvertContinuousIndexToNearestIndex( cindex, index );
-            return( this->EvaluateAtIndex( index ) );
-          }
-        virtual OutputType EvaluateAtIndex( const IndexType& index ) const
+        virtual TOutputValue Evaluate( const TIndex& idx ) const
           { return( true ); }
 
       protected:
index 00a813f682a1694b756ca5d0d7238052a6d5df27..44cccc274e083f7408c976569bcfc80ff7a735b3 100644 (file)
@@ -24,14 +24,10 @@ namespace fpa
         typedef itk::SmartPointer< const Self >   ConstPointer;
 
         // Superclass' types
-        typedef typename Superclass::InputImageType      InputImageType;
-        typedef typename Superclass::InputPixelType      InputPixelType;
-        typedef typename Superclass::OutputType          OutputType;
-        typedef typename Superclass::CoordRepType        CoordRepType;
-        typedef typename Superclass::IndexType           IndexType;
-        typedef typename Superclass::IndexValueType      IndexValueType;
-        typedef typename Superclass::ContinuousIndexType ContinuousIndexType;
-        typedef typename Superclass::PointType           PointType;
+        typedef typename Superclass::TInputImage  TInputImage;
+        typedef typename Superclass::TOutputValue TOutputValue;
+        typedef typename Superclass::TIndex       TIndex;
+        typedef typename I::PixelType             TPixel;
 
       public:
         itkNewMacro( Self );
@@ -40,27 +36,29 @@ namespace fpa
           RegionGrowAllBelongsFunction
           );
 
-        itkGetConstMacro( LowerThreshold, InputPixelType );
-        itkGetConstMacro( UpperThreshold, InputPixelType );
+        itkGetConstMacro( LowerThreshold, TPixel );
+        itkGetConstMacro( UpperThreshold, TPixel );
 
-        itkSetMacro( LowerThreshold, InputPixelType );
-        itkSetMacro( UpperThreshold, InputPixelType );
+        itkSetMacro( LowerThreshold, TPixel );
+        itkSetMacro( UpperThreshold, TPixel );
 
       public:
-        virtual OutputType EvaluateAtIndex( const IndexType& index ) const
+        virtual TOutputValue Evaluate( const TIndex& idx ) const
           {
             const I* img = this->GetInputImage( );
             if( img != NULL )
             {
-              if( this->IsInsideBuffer( index ) )
-              {
-                InputPixelType v = img->GetPixel( index );
-                return(
-                  this->m_LowerThreshold <= v &&
-                  v <= this->m_UpperThreshold
-                  );
-
-              } // fi
+              /* TODO
+                 if( this->IsInsideBuffer( idx ) )
+                 {
+              */
+              TPixel v = img->GetPixel( idx );
+              return(
+                this->m_LowerThreshold <= v &&
+                v <= this->m_UpperThreshold
+                );
+
+              // TODO: } // fi
 
             } // fi
             return( false );
@@ -69,8 +67,8 @@ namespace fpa
       protected:
         RegionGrowThresholdFunction( )
           : Superclass( ),
-            m_LowerThreshold( std::numeric_limits< InputPixelType >::min( ) ),
-            m_UpperThreshold( std::numeric_limits< InputPixelType >::max( ) )
+            m_LowerThreshold( std::numeric_limits< TPixel >::min( ) ),
+            m_UpperThreshold( std::numeric_limits< TPixel >::max( ) )
           { }
         virtual ~RegionGrowThresholdFunction( )
           { }
@@ -81,8 +79,8 @@ namespace fpa
         void operator=( const Self& );
 
       protected:
-        InputPixelType m_LowerThreshold;
-        InputPixelType m_UpperThreshold;
+        TPixel m_LowerThreshold;
+        TPixel m_UpperThreshold;
       };
 
     } // ecapseman
diff --git a/lib/fpa/Image/RegionGrowWithMultipleCriteria.h b/lib/fpa/Image/RegionGrowWithMultipleCriteria.h
new file mode 100644 (file)
index 0000000..2b06837
--- /dev/null
@@ -0,0 +1,65 @@
+#ifndef __FPA__IMAGE__REGIONGROWWITHMULTIPLECRITERIA__H__
+#define __FPA__IMAGE__REGIONGROWWITHMULTIPLECRITERIA__H__
+
+#include <itkImageToImageFilter.h>
+#include <itkIndex.h>
+#include <fpa/Base/RegionGrowWithMultipleCriteria.h>
+#include <fpa/Image/Algorithm.h>
+#include <fpa/Image/Functors/ImageFunction.h>
+
+namespace fpa
+{
+  namespace Image
+  {
+    /**
+     * @param I Input image type
+     */
+    template< class I >
+    class RegionGrowWithMultipleCriteria
+      : public Algorithm< I, fpa::Base::RegionGrowWithMultipleCriteria< typename I::IndexType, typename I::PixelType, typename I::PixelType, itk::Functor::IndexLexicographicCompare< I::ImageDimension >, itk::ImageToImageFilter< I, I > > >
+    {
+    public:
+      // Standard class typdedefs
+      typedef typename I::IndexType TVertex;
+      typedef typename I::PixelType TResult;
+      typedef typename I::PixelType TVertexValue;
+      typedef itk::ImageToImageFilter< I, I > TBaseFilter;
+      typedef fpa::Base::RegionGrowWithMultipleCriteria< TVertex, TResult, TVertexValue, itk::Functor::IndexLexicographicCompare< I::ImageDimension >, TBaseFilter > TBaseAlgorithm;
+
+      typedef RegionGrowWithMultipleCriteria  Self;
+      typedef Algorithm< I, TBaseAlgorithm >  Superclass;
+      typedef itk::SmartPointer< Self >       Pointer;
+      typedef itk::SmartPointer< const Self > ConstPointer;
+
+      typedef
+      fpa::Image::Functors::ImageFunction< I, bool >
+      TMembershipFunction;
+      typedef typename Superclass::TFunctions TFunctions;
+
+    public:
+      itkNewMacro( Self );
+      itkTypeMacro(
+        RegionGrowWithMultipleCriteria,
+        fpaBaseRegionGrowWithMultipleCriteria
+        );
+
+    protected:
+      RegionGrowWithMultipleCriteria( )
+        : Superclass( )
+        { }
+      virtual ~RegionGrowWithMultipleCriteria( )
+        { }
+
+    private:
+      // Purposely not implemented
+      RegionGrowWithMultipleCriteria( const Self& );
+      void operator=( const Self& );
+    };
+
+  } // ecapseman
+
+} // ecapseman
+
+#endif // __FPA__IMAGE__REGIONGROWWITHMULTIPLECRITERIA__H__
+
+// eof - $RCSfile$
index 3efd87a7313547b97e2413205e73fd47ee42a213..41fba37baae72af994d8b7881600a8e30f0f504c 100644 (file)
@@ -2,7 +2,7 @@
 #define __FPA__IMAGE__REGIONGROWWITHMULTIPLETHRESHOLDS__H__
 
 #include <map>
-#include <fpa/Image/RegionGrow.h>
+#include <fpa/Image/RegionGrowWithMultipleCriteria.h>
 
 namespace fpa
 {
@@ -13,18 +13,20 @@ namespace fpa
      */
     template< class I >
     class RegionGrowWithMultipleThresholds
-      : public RegionGrow< I >
+      : public RegionGrowWithMultipleCriteria< I >
     {
     public:
-      typedef RegionGrowWithMultipleThresholds Self;
-      typedef RegionGrow< I >                  Superclass;
-      typedef itk::SmartPointer< Self >        Pointer;
-      typedef itk::SmartPointer< const Self >  ConstPointer;
+      typedef RegionGrowWithMultipleThresholds    Self;
+      typedef RegionGrowWithMultipleCriteria< I > Superclass;
+      typedef itk::SmartPointer< Self >           Pointer;
+      typedef itk::SmartPointer< const Self >     ConstPointer;
 
       typedef typename I::PixelType TPixel;
 
-      typedef std::map< TPixel, unsigned long > THistogram;
-      typedef typename Superclass::TBaseAlgorithm TBaseAlgorithm;
+      typedef std::map< TPixel, unsigned long >        THistogram;
+      typedef typename Superclass::TBaseAlgorithm      TBaseAlgorithm;
+      typedef typename Superclass::TMembershipFunction TMembershipFunction;
+      typedef typename Superclass::TFunctions          TFunctions;
 
     protected:
       typedef typename TBaseAlgorithm::_TNode _TNode;
@@ -49,6 +51,7 @@ namespace fpa
       virtual ~RegionGrowWithMultipleThresholds( );
 
       virtual bool _UpdateResult( _TNode& n );
+      virtual void _BeforeLoop( );
       virtual void _AfterLoop( );
 
     private:
index def89d95dc4dfac6c1d6de976b04b48ce31d81e6..51e474b958b9f41e8caf9c4e3a91dc5990a27a67 100644 (file)
@@ -1,6 +1,7 @@
 #ifndef __FPA__IMAGE__REGIONGROWWITHMULTIPLETHRESHOLDS__HXX__
 #define __FPA__IMAGE__REGIONGROWWITHMULTIPLETHRESHOLDS__HXX__
 
+#include <limits>
 #include <fpa/Image/Functors/RegionGrowThresholdFunction.h>
 
 // -------------------------------------------------------------------------
@@ -8,22 +9,35 @@ template< class I >
 void fpa::Image::RegionGrowWithMultipleThresholds< I >::
 AddThreshold( const TPixel& v )
 {
-  this->m_Histogram[ v ] = 0;
+  typedef
+    fpa::Image::Functors::RegionGrowThresholdFunction< I >
+    TFunction;
+  typename TFunction::Pointer function = TFunction::New( );
+
+  if( this->GetNumberOfMembershipFunctions( ) > 0 )
+  {
+  }
+  else
+    function->SetLowerThreshold( std::numeric_limits< TPixel >::min( ) );
+  std::cout
+    << typeid( TPixel ).name( ) << " "
+    << function->GetLowerThreshold( )
+    << std::endl;
+  function->SetUpperThreshold( v );
+  this->AddMembershipFunction( function );
 
   /* TODO
-     typedef
-     fpa::Image::Functors::RegionGrowThresholdFunction< I >
-     TFunction;
+     this->m_Histogram[ v ] = 0;
+
      TFunction* function =
      dynamic_cast< TFunction* >( this->GetMembershipFunction( ) );
      if( function != NULL )
      {
      function->SetLowerThreshold( this->m_Histogram.begin( )->first );
-     function->SetUpperThreshold( this->m_Histogram.rbegin( )->first );
 
      } // fi
+     this->Modified( );
   */
-  this->Modified( );
 }
 
 // -------------------------------------------------------------------------
@@ -43,11 +57,13 @@ RegionGrowWithMultipleThresholds( )
   : Superclass( ),
     m_DerivativeThreshold( double( 3 ) )
 {
-  typedef
-    fpa::Image::Functors::RegionGrowThresholdFunction< I >
-    TFunction;
-  typename TFunction::Pointer function = TFunction::New( );
-  this->SetMembershipFunction( function );
+  /* TODO
+     typedef
+     fpa::Image::Functors::RegionGrowThresholdFunction< I >
+     TFunction;
+     typename TFunction::Pointer function = TFunction::New( );
+     this->SetMembershipFunction( function );
+  */
 }
 
 // -------------------------------------------------------------------------
@@ -64,28 +80,50 @@ _UpdateResult( _TNode& n )
 {
   bool ret = this->Superclass::_UpdateResult( n );
 
-  if( ret )
-  {
-    TPixel v = TPixel( this->_Cost( n.Vertex, n.Vertex ) );
+  /* TODO
+     if( ret )
+     {
+     TPixel v = TPixel( this->_Cost( n.Vertex, n.Vertex ) );
 
-    typename THistogram::reverse_iterator hIt = this->m_Histogram.rbegin( );
-    while( hIt != this->m_Histogram.rend( ) )
-    {
-      if( v <= hIt->first )
-      {
-        hIt->second += 1;
-        hIt++;
-      }
-      else
-        hIt = this->m_Histogram.rend( );
-
-    } // elihw
-    this->GetOutput( )->SetPixel( n.Vertex, v );
-
-  } // fi
+     typename THistogram::reverse_iterator hIt = this->m_Histogram.rbegin( );
+     while( hIt != this->m_Histogram.rend( ) )
+     {
+     if( v <= hIt->first )
+     {
+     hIt->second += 1;
+     hIt++;
+     }
+     else
+     hIt = this->m_Histogram.rend( );
+
+     } // elihw
+     this->GetOutput( )->SetPixel( n.Vertex, v );
+
+     } // fi
+  */
   return( ret );
 }
 
+// -------------------------------------------------------------------------
+template< class I >
+void fpa::Image::RegionGrowWithMultipleThresholds< I >::
+_BeforeLoop( )
+{
+  std::cout << "**1" << std::endl;
+  const I* img = this->GetInput( );
+  std::cout << "**2" << std::endl;
+  typename TFunctions::iterator fIt = this->m_Functions.begin( );
+  for( ; fIt != this->m_Functions.end( ); ++fIt )
+  {
+    TMembershipFunction* f =
+      dynamic_cast< TMembershipFunction* >( fIt->GetPointer( ) );
+    if( f != NULL )
+      f->SetInputImage( this->GetInput( ) );
+
+  } // rof
+  this->Superclass::_BeforeLoop( );
+}
+
 // -------------------------------------------------------------------------
 template< class I >
 void fpa::Image::RegionGrowWithMultipleThresholds< I >::