]> Creatis software - FrontAlgorithms.git/blobdiff - lib/fpa/Base/RegionGrowWithMultipleCriteria.h
Multiple thresholds region grow segmentation almost added.
[FrontAlgorithms.git] / lib / fpa / Base / RegionGrowWithMultipleCriteria.h
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$