]> Creatis software - FrontAlgorithms.git/commitdiff
...
authorLeonardo Flórez-Valencia <leonardo.florez@gmail.com>
Thu, 17 Aug 2017 02:32:28 +0000 (21:32 -0500)
committerLeonardo Flórez-Valencia <leonardo.florez@gmail.com>
Thu, 17 Aug 2017 02:32:28 +0000 (21:32 -0500)
145 files changed:
CMakeLists.txt
cmake/fpaConfig.cmake.in
lib/CMakeLists.txt
lib/fpa/Base/Algorithm.hxx [deleted file]
lib/fpa/Base/Dijkstra.h [deleted file]
lib/fpa/Base/Dijkstra.hxx [deleted file]
lib/fpa/Base/DijkstraBase.h [deleted file]
lib/fpa/Base/DijkstraBase.hxx [deleted file]
lib/fpa/Base/Functors/Dijkstra/Function.h [deleted file]
lib/fpa/Base/Functors/RegionGrow/BinaryThreshold.h [deleted file]
lib/fpa/Base/Functors/RegionGrow/Tautology.h [deleted file]
lib/fpa/Base/MarksInterface.hxx [deleted file]
lib/fpa/Base/RegionGrow.h [deleted file]
lib/fpa/Base/RegionGrow.hxx [deleted file]
lib/fpa/Base/SeedsInterface.h [deleted file]
lib/fpa/Base/SeedsInterface.hxx [deleted file]
lib/fpa/Base/SingleSeedInterface.h [deleted file]
lib/fpa/Base/SingleSeedInterface.hxx [deleted file]
lib/fpa/CMakeLists.txt
lib/fpa/Common/Image/PolyLineParametricPathReader.h [new file with mode: 0644]
lib/fpa/Common/Image/PolyLineParametricPathReader.hxx [new file with mode: 0644]
lib/fpa/Common/Image/PolyLineParametricPathWriter.h [new file with mode: 0644]
lib/fpa/Common/Image/PolyLineParametricPathWriter.hxx [new file with mode: 0644]
lib/fpa/Common/Image/SkeletonReader.h [new file with mode: 0644]
lib/fpa/Common/Image/SkeletonReader.hxx [moved from lib/fpa/Image/SkeletonReader.hxx with 88% similarity]
lib/fpa/Common/Image/SkeletonWriter.h [new file with mode: 0644]
lib/fpa/Common/Image/SkeletonWriter.hxx [moved from lib/fpa/Image/SkeletonWriter.hxx with 89% similarity]
lib/fpa/Common/IncrementalMeanAndVariance.cxx [new file with mode: 0644]
lib/fpa/Common/IncrementalMeanAndVariance.h [new file with mode: 0644]
lib/fpa/Common/PeakDetector.cxx [new file with mode: 0644]
lib/fpa/Common/PeakDetector.h [new file with mode: 0644]
lib/fpa/Config.h.in
lib/fpa/DataStructures/Graph.h [moved from lib/fpa/Base/Graph.h with 96% similarity]
lib/fpa/DataStructures/Graph.hxx [moved from lib/fpa/Base/Graph.hxx with 86% similarity]
lib/fpa/DataStructures/Image/MinimumSpanningTree.h [new file with mode: 0644]
lib/fpa/DataStructures/Image/MinimumSpanningTree.hxx [moved from lib/fpa/Image/MinimumSpanningTree.hxx with 74% similarity]
lib/fpa/DataStructures/Image/PolyLineParametricPath.h [new file with mode: 0644]
lib/fpa/DataStructures/Image/PolyLineParametricPath.hxx [moved from lib/fpa/Image/PolyLineParametricPath.hxx with 80% similarity]
lib/fpa/DataStructures/Image/Skeleton.h [new file with mode: 0644]
lib/fpa/DataStructures/Image/Skeleton.hxx [moved from lib/fpa/Image/Skeleton.hxx with 76% similarity]
lib/fpa/DataStructures/MinimumSpanningTree.h [moved from lib/fpa/Base/MinimumSpanningTree.h with 88% similarity]
lib/fpa/DataStructures/MinimumSpanningTree.hxx [moved from lib/fpa/Base/MinimumSpanningTree.hxx with 85% similarity]
lib/fpa/Filters/Algorithm.h [moved from lib/fpa/Base/Algorithm.h with 55% similarity]
lib/fpa/Filters/Algorithm.hxx [new file with mode: 0644]
lib/fpa/Filters/Dijkstra.h [new file with mode: 0644]
lib/fpa/Filters/Dijkstra.hxx [new file with mode: 0644]
lib/fpa/Filters/DijkstraBase.h [new file with mode: 0644]
lib/fpa/Filters/DijkstraBase.hxx [new file with mode: 0644]
lib/fpa/Filters/Event.h [moved from lib/fpa/Base/Event.h with 87% similarity]
lib/fpa/Filters/Event.hxx [moved from lib/fpa/Base/Event.hxx with 75% similarity]
lib/fpa/Filters/Image/Algorithm.h [new file with mode: 0644]
lib/fpa/Filters/Image/Algorithm.hxx [new file with mode: 0644]
lib/fpa/Filters/Image/DefaultTraits.h [new file with mode: 0644]
lib/fpa/Filters/Image/Dijkstra.h [new file with mode: 0644]
lib/fpa/Filters/Image/Dijkstra.hxx [new file with mode: 0644]
lib/fpa/Filters/Image/ExtractAxis.h [new file with mode: 0644]
lib/fpa/Filters/Image/ExtractAxis.hxx [moved from lib/fpa/Image/ExtractAxisFilter.hxx with 73% similarity]
lib/fpa/Filters/Image/LabelsSeedInterface.h [new file with mode: 0644]
lib/fpa/Filters/Image/Mori.h [new file with mode: 0644]
lib/fpa/Filters/Image/RandomWalker.h [new file with mode: 0644]
lib/fpa/Filters/Image/RandomWalker.hxx [new file with mode: 0644]
lib/fpa/Filters/Image/RegionGrow.h [new file with mode: 0644]
lib/fpa/Filters/Image/Skeleton.h [new file with mode: 0644]
lib/fpa/Filters/Image/Skeleton.hxx [moved from lib/fpa/Image/SkeletonFilter.hxx with 85% similarity]
lib/fpa/Filters/MarksInterface.h [moved from lib/fpa/Base/MarksInterface.h with 56% similarity]
lib/fpa/Filters/MarksInterface.hxx [new file with mode: 0644]
lib/fpa/Filters/MarksWithCollisionsInterface.h [moved from lib/fpa/Base/MarksInterfaceWithCollisions.h with 57% similarity]
lib/fpa/Filters/MarksWithCollisionsInterface.hxx [moved from lib/fpa/Base/MarksInterfaceWithCollisions.hxx with 76% similarity]
lib/fpa/Filters/Mori.h [moved from lib/fpa/Base/Mori.h with 63% similarity]
lib/fpa/Filters/Mori.hxx [moved from lib/fpa/Base/Mori.hxx with 64% similarity]
lib/fpa/Filters/RegionGrow.h [new file with mode: 0644]
lib/fpa/Filters/RegionGrow.hxx [new file with mode: 0644]
lib/fpa/Filters/SeedsInterface.h [new file with mode: 0644]
lib/fpa/Filters/SeedsInterface.hxx [new file with mode: 0644]
lib/fpa/Filters/SingleSeedInterface.h [new file with mode: 0644]
lib/fpa/Filters/SingleSeedInterface.hxx [new file with mode: 0644]
lib/fpa/Functors/BaseVertexFunction.h [new file with mode: 0644]
lib/fpa/Functors/Dijkstra/Image/Gaussian.h [new file with mode: 0644]
lib/fpa/Functors/Dijkstra/Image/Identity.h [new file with mode: 0644]
lib/fpa/Functors/Dijkstra/Invert.h [new file with mode: 0644]
lib/fpa/Functors/RegionGrow/BinaryThreshold.h [new file with mode: 0644]
lib/fpa/Functors/RegionGrow/BinaryThreshold.hxx [new file with mode: 0644]
lib/fpa/Functors/RegionGrow/Tautology.h [new file with mode: 0644]
lib/fpa/Image/Algorithm.h [deleted file]
lib/fpa/Image/Algorithm.hxx [deleted file]
lib/fpa/Image/DefaultTraits.h [deleted file]
lib/fpa/Image/Dijkstra.h [deleted file]
lib/fpa/Image/Dijkstra.hxx [deleted file]
lib/fpa/Image/ExtractAxisFilter.h [deleted file]
lib/fpa/Image/Functors/Dijkstra/Function.h [deleted file]
lib/fpa/Image/Functors/Dijkstra/Gaussian.h [deleted file]
lib/fpa/Image/Functors/Dijkstra/Identity.h [deleted file]
lib/fpa/Image/Functors/Dijkstra/Invert.h [deleted file]
lib/fpa/Image/LabelledSeedsInterface.h [deleted file]
lib/fpa/Image/LabelledSeedsInterface.hxx [deleted file]
lib/fpa/Image/MinimumSpanningTree.h [deleted file]
lib/fpa/Image/Mori.h [deleted file]
lib/fpa/Image/Mori.hxx [deleted file]
lib/fpa/Image/PathsToImageFilter.h [deleted file]
lib/fpa/Image/PathsToImageFilter.hxx [deleted file]
lib/fpa/Image/PolyLineParametricPath.h [deleted file]
lib/fpa/Image/PolyLineParametricPathToPolyDataFilter.h [deleted file]
lib/fpa/Image/RandomWalker.h [deleted file]
lib/fpa/Image/RandomWalker.hxx [deleted file]
lib/fpa/Image/RegionGrow.h [deleted file]
lib/fpa/Image/Skeleton.h [deleted file]
lib/fpa/Image/SkeletonFilter.h [deleted file]
lib/fpa/Image/SkeletonReader.h [deleted file]
lib/fpa/Image/SkeletonToPolyDataFilter.h [deleted file]
lib/fpa/Image/SkeletonWriter.h [deleted file]
lib/fpa/Image/VisualDebugger.h [deleted file]
lib/fpa/Image/VisualDebugger.hxx [deleted file]
lib/fpa/Image/VisualDebugger2D.h [deleted file]
lib/fpa/Image/VisualDebugger2D.hxx [deleted file]
lib/fpa/VTK/Image/PolyLineParametricPathToPolyDataFilter.h [new file with mode: 0644]
lib/fpa/VTK/Image/PolyLineParametricPathToPolyDataFilter.hxx [moved from lib/fpa/Image/PolyLineParametricPathToPolyDataFilter.hxx with 61% similarity]
lib/fpa/VTK/Image/SkeletonToPolyDataFilter.h [new file with mode: 0644]
lib/fpa/VTK/Image/SkeletonToPolyDataFilter.hxx [moved from lib/fpa/Image/SkeletonToPolyDataFilter.hxx with 79% similarity]
lib/fpa/Version.cxx.in
tests/CMakeLists.txt
tests/image/BaseFunctions.h [deleted file]
tests/image/CMakeLists.txt
tests/image/Dijkstra/CMakeLists.txt [new file with mode: 0644]
tests/image/Dijkstra/ExtractAxis.cxx [new file with mode: 0644]
tests/image/Dijkstra/Gaussian.cxx [new file with mode: 0644]
tests/image/Dijkstra/Identity.cxx [new file with mode: 0644]
tests/image/Dijkstra/Invert.cxx [new file with mode: 0644]
tests/image/Dijkstra/Skeleton.cxx [new file with mode: 0644]
tests/image/Dijkstra_Gaussian.cxx [deleted file]
tests/image/Dijkstra_Identity.cxx [deleted file]
tests/image/MoriSegmentation.cxx [deleted file]
tests/image/RandomWalker.cxx [deleted file]
tests/image/RandomWalker/CMakeLists.txt [new file with mode: 0644]
tests/image/RandomWalker/Gaussian.cxx [new file with mode: 0644]
tests/image/RegionGrow/BinaryThreshold.cxx [new file with mode: 0644]
tests/image/RegionGrow/CMakeLists.txt [new file with mode: 0644]
tests/image/RegionGrow/Mori.cxx [new file with mode: 0644]
tests/image/RegionGrow/Tautology.cxx [new file with mode: 0644]
tests/image/RegionGrow_BinaryThreshold.cxx [deleted file]
tests/image/RegionGrow_Tautology.cxx [deleted file]
tests/image/SkeletonFilter.cxx [deleted file]
tests/image/SkeletonToPolyData.cxx [deleted file]
tests/image/VTK/CMakeLists.txt [new file with mode: 0644]
tests/image/VTK/PolyLineParametricPathToPolyData.cxx [new file with mode: 0644]
tests/image/VTK/SkeletonToPolyData.cxx [new file with mode: 0644]

index b098f7a5cebd7f702b6c0392b2edf4a34320e390..13e90cb84bbb22c4c45c5a428b01d489699dd424 100644 (file)
@@ -1,3 +1,8 @@
+## =========================================================================
+## @author Leonardo Florez Valencia
+## @email florez-l@javeriana.edu.co
+## =========================================================================
+
 cmake_minimum_required(VERSION 3.0)
 
 ## ========================
@@ -91,7 +96,12 @@ mark_as_advanced(
 ## == Find needed packages and dependencies ==
 ## ===========================================
 
-find_package(ivq CONFIG REQUIRED)
+find_package(ITK CONFIG REQUIRED)
+include(${ITK_USE_FILE})
+if(ITKVtkGlue_LOADED)
+  find_package(VTK CONFIG REQUIRED)
+  include(${VTK_USE_FILE})
+endif(ITKVtkGlue_LOADED)
 
 ## =========================
 ## == Installation values ==
@@ -109,7 +119,7 @@ set(namespace "${PROJECT_NAME}::")
 ## == Build different parts ==
 ## ===========================
 
-subdirs(appli lib tests)
+subdirs(lib tests)
 
 ## ===============================
 ## == Global installation rules ==
index f019632dcbd8844ddee0093c1d48dcb60f7684cf..67047bb73c6ac2436bc2e4ff2e4f4e11f21856d3 100644 (file)
@@ -1,3 +1,8 @@
+## =========================================================================
+## @author Leonardo Florez Valencia
+## @email florez-l@javeriana.edu.co
+## =========================================================================
+
 @PACKAGE_INIT@
 
 include("${CMAKE_CURRENT_LIST_DIR}/@targets_export_name@.cmake")
@@ -7,6 +12,13 @@ check_required_components("@PROJECT_NAME@")
 ## == Find needed packages and dependencies ==
 ## ===========================================
 
-find_package(ivq CONFIG REQUIRED)
+set(ITK_DIR @ITK_DIR@)
+find_package(ITK CONFIG REQUIRED)
+include(${ITK_USE_FILE})
+if(ITKVtkGlue_LOADED)
+  set(VTK_DIR @VTK_DIR@)
+  find_package(VTK CONFIG REQUIRED)
+  include(${VTK_USE_FILE})
+endif(ITKVtkGlue_LOADED)
 
 ## eof - $RCSfile$
index f4c0955ff0028349564cd1c88ae1f5ca49eb7aaf..d7d1948d81c3c2669ed0d6c1d308c166f36760b7 100644 (file)
@@ -1,3 +1,7 @@
+## =========================================================================
+## @author Leonardo Florez Valencia
+## @email florez-l@javeriana.edu.co
+## =========================================================================
 
 include_directories(
   ${CMAKE_CURRENT_SOURCE_DIR}
diff --git a/lib/fpa/Base/Algorithm.hxx b/lib/fpa/Base/Algorithm.hxx
deleted file mode 100644 (file)
index 888dc38..0000000
+++ /dev/null
@@ -1,170 +0,0 @@
-// =========================================================================
-// @author Leonardo Florez Valencia
-// @email florez-l@javeriana.edu.co
-// =========================================================================
-
-#ifndef __fpa__Base__Algorithm__hxx__
-#define __fpa__Base__Algorithm__hxx__
-
-// -------------------------------------------------------------------------
-template< class _TFilter, class _TMarks, class _TSeeds >
-void fpa::Base::Algorithm< _TFilter, _TMarks, _TSeeds >::
-InvokeEvent( const itk::EventObject& e )
-{
-  TEvent a;
-  if( a.CheckEvent( &e ) )
-  {
-    if( this->m_VisualDebug )
-      this->Superclass::InvokeEvent( e );
-  }
-  else
-    this->Superclass::InvokeEvent( e );
-}
-
-// -------------------------------------------------------------------------
-template< class _TFilter, class _TMarks, class _TSeeds >
-void fpa::Base::Algorithm< _TFilter, _TMarks, _TSeeds >::
-InvokeEvent( const itk::EventObject& e ) const
-{
-  TEvent a;
-  if( a.CheckEvent( &e ) )
-  {
-    if( this->m_VisualDebug )
-      this->Superclass::InvokeEvent( e );
-  }
-  else
-    this->Superclass::InvokeEvent( e );
-}
-
-// -------------------------------------------------------------------------
-template< class _TFilter, class _TMarks, class _TSeeds >
-fpa::Base::Algorithm< _TFilter, _TMarks, _TSeeds >::
-Algorithm( )
-  : _TFilter( ),
-    _TMarks( this ),
-    _TSeeds( this ),
-    m_VisualDebug( false )
-{
-}
-
-// -------------------------------------------------------------------------
-template< class _TFilter, class _TMarks, class _TSeeds >
-fpa::Base::Algorithm< _TFilter, _TMarks, _TSeeds >::
-~Algorithm( )
-{
-}
-
-// -------------------------------------------------------------------------
-template< class _TFilter, class _TMarks, class _TSeeds >
-void fpa::Base::Algorithm< _TFilter, _TMarks, _TSeeds >::
-GenerateData( )
-{
-  this->InvokeEvent( itk::StartEvent( ) );
-
-  // Init objects
-  this->_BeforeGenerateData( );
-  this->_ConfigureOutput( this->m_InitValue );
-  this->_InitMarks( this->GetSeeds( ).size( ) );
-  TNodes seeds = this->_UnifySeeds( );
-  this->_PrepareSeeds( seeds );
-
-  // Init queue
-  this->_QueueInit( );
-  typename TNodes::const_iterator sIt = seeds.begin( );
-  for( ; sIt != seeds.end( ); ++sIt )
-  {
-    this->_QueuePush( *sIt );
-    this->InvokeEvent( TEvent( sIt->Vertex, sIt->FrontId, true ) );
-
-  } // rof
-
-  // Main loop
-  while( this->_QueueSize( ) > 0 )
-  {
-    // Get next candidate
-    TNode node = this->_QueuePop( );
-    this->InvokeEvent( TEvent( node.Vertex, node.FrontId, false ) );
-    if( !( this->_IsMarked( node.Vertex ) ) )
-    {
-      // Update output value and mark vertex
-      this->_UpdateOutputValue( node );
-      this->_Mark( node.Vertex, node.FrontId );
-
-      // The actual node was effectively marked?
-      if( node.FrontId > 0 )
-      {
-        // Add neighborhood
-        TNeighborhood neighbors = this->_GetNeighbors( node.Vertex );
-        typename TNeighborhood::const_iterator nIt = neighbors.begin( );
-        bool coll = false;
-        while( nIt != neighbors.end( ) && !coll )
-        {
-          if( this->_IsMarked( *nIt ) )
-          {
-            // Invoke stop at collisions
-            if( this->_Collisions( node.Vertex, *nIt ) )
-            {
-              this->_QueueClear( );
-              coll = true;
-
-            } // fi
-          }
-          else
-          {
-            TNode nnode;
-            nnode.Vertex = *nIt;
-            nnode.Parent = node.Vertex;
-            nnode.FrontId = node.FrontId;
-            this->_ComputeOutputValue( nnode );
-            this->_QueuePush( nnode );
-            this->InvokeEvent( TEvent( nnode.Vertex, nnode.FrontId, true ) );
-
-          } // fi
-          ++nIt;
-
-        } // elihw
-
-      } // fi
-
-    } // fi
-    this->_FinishOneLoop( );
-
-  } // elihw
-
-  // Finish
-  this->_AfterGenerateData( );
-  this->InvokeEvent( itk::EndEvent( ) );
-}
-
-// -------------------------------------------------------------------------
-template< class _TFilter, class _TMarks, class _TSeeds >
-void fpa::Base::Algorithm< _TFilter, _TMarks, _TSeeds >::
-_BeforeGenerateData( )
-{
-}
-
-// -------------------------------------------------------------------------
-template< class _TFilter, class _TMarks, class _TSeeds >
-void fpa::Base::Algorithm< _TFilter, _TMarks, _TSeeds >::
-_AfterGenerateData( )
-{
-}
-
-// -------------------------------------------------------------------------
-template< class _TFilter, class _TMarks, class _TSeeds >
-void fpa::Base::Algorithm< _TFilter, _TMarks, _TSeeds >::
-_FinishOneLoop( )
-{
-}
-
-// -------------------------------------------------------------------------
-template< class _TFilter, class _TMarks, class _TSeeds >
-void fpa::Base::Algorithm< _TFilter, _TMarks, _TSeeds >::
-_QueueInit( )
-{
-  this->_QueueClear( );
-}
-
-#endif // __fpa__Base__Algorithm__hxx__
-
-// eof - $RCSfile$
diff --git a/lib/fpa/Base/Dijkstra.h b/lib/fpa/Base/Dijkstra.h
deleted file mode 100644 (file)
index 508b368..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-// =========================================================================
-// @author Leonardo Florez Valencia
-// @email florez-l@javeriana.edu.co
-// =========================================================================
-
-#ifndef __fpa__Base__Dijkstra__h__
-#define __fpa__Base__Dijkstra__h__
-
-#include <fpa/Base/DijkstraBase.h>
-
-namespace fpa
-{
-  namespace Base
-  {
-    /**
-     */
-    template< class _TAlgorithm, class _TMST >
-    class Dijkstra
-      : public fpa::Base::DijkstraBase< _TAlgorithm >
-    {
-    public:
-      typedef Dijkstra                               Self;
-      typedef fpa::Base::DijkstraBase< _TAlgorithm > Superclass;
-      typedef itk::SmartPointer< Self >              Pointer;
-      typedef itk::SmartPointer< const Self >        ConstPointer;
-
-      typedef _TMST TMST;
-
-      typedef typename Superclass::TTraits      TTraits;
-      typedef typename Superclass::TNode        TNode;
-      typedef typename Superclass::TNodes       TNodes;
-      typedef typename Superclass::TInputValue  TInputValue;
-      typedef typename Superclass::TOutputValue TOutputValue;
-      typedef typename Superclass::TFrontId     TFrontId;
-      typedef typename Superclass::TVertex      TVertex;
-      typedef typename Superclass::TSeeds       TSeeds;
-
-      typedef typename Superclass::TQueue          TQueue;
-      typedef typename Superclass::TQueueOrder     TQueueOrder;
-      typedef typename Superclass::TWeightFunction TWeightFunction;
-
-    public:
-      TMST* GetMinimumSpanningTree( );
-      const TMST* GetMinimumSpanningTree( ) const;
-
-    protected:
-      Dijkstra( );
-      virtual ~Dijkstra( );
-
-      virtual void _AfterGenerateData( ) override;
-      virtual void _UpdateOutputValue( TNode& n ) override;
-
-    private:
-      // Purposely not implemented.
-      Dijkstra( const Self& other );
-      Self& operator=( const Self& other );
-
-    protected:
-      unsigned int m_MSTIdx;
-    };
-
-  } // ecapseman
-
-} // ecapseman
-
-#ifndef ITK_MANUAL_INSTANTIATION
-#  include <fpa/Base/Dijkstra.hxx>
-#endif // ITK_MANUAL_INSTANTIATION
-
-#endif // __fpa__Base__Dijkstra__h__
-
-// eof - $RCSfile$
diff --git a/lib/fpa/Base/Dijkstra.hxx b/lib/fpa/Base/Dijkstra.hxx
deleted file mode 100644 (file)
index 9de7912..0000000
+++ /dev/null
@@ -1,85 +0,0 @@
-// =========================================================================
-// @author Leonardo Florez Valencia
-// @email florez-l@javeriana.edu.co
-// =========================================================================
-
-#ifndef __fpa__Base__Dijkstra__hxx__
-#define __fpa__Base__Dijkstra__hxx__
-
-// -------------------------------------------------------------------------
-template< class _TAlgorithm, class _TMST >
-typename fpa::Base::Dijkstra< _TAlgorithm, _TMST >::
-TMST* fpa::Base::Dijkstra< _TAlgorithm, _TMST >::
-GetMinimumSpanningTree( )
-{
-  return(
-    dynamic_cast< TMST* >(
-      this->itk::ProcessObject::GetOutput( this->m_MSTIdx )
-      )
-    );
-}
-
-// -------------------------------------------------------------------------
-template< class _TAlgorithm, class _TMST >
-const typename fpa::Base::Dijkstra< _TAlgorithm, _TMST >::
-TMST* fpa::Base::Dijkstra< _TAlgorithm, _TMST >::
-GetMinimumSpanningTree( ) const
-{
-  return(
-    dynamic_cast< const TMST* >(
-      this->itk::ProcessObject::GetOutput( this->m_MSTIdx )
-      )
-    );
-}
-
-// -------------------------------------------------------------------------
-template< class _TAlgorithm, class _TMST >
-fpa::Base::Dijkstra< _TAlgorithm, _TMST >::
-Dijkstra( )
-  : Superclass( )
-{
-  this->m_MSTIdx = this->GetNumberOfRequiredOutputs( );
-  this->itk::ProcessObject::SetNumberOfRequiredOutputs( this->m_MSTIdx + 1 );
-  this->SetNthOutput( this->m_MSTIdx, TMST::New( ) );
-}
-
-// -------------------------------------------------------------------------
-template< class _TAlgorithm, class _TMST >
-fpa::Base::Dijkstra< _TAlgorithm, _TMST >::
-~Dijkstra( )
-{
-}
-
-// -------------------------------------------------------------------------
-template< class _TAlgorithm, class _TMST >
-void fpa::Base::Dijkstra< _TAlgorithm, _TMST >::
-_AfterGenerateData( )
-{
-  this->Superclass::_AfterGenerateData( );
-
-  TMST* mst = this->GetMinimumSpanningTree( );
-  mst->ClearSeeds( );
-  mst->SetCollisions( this->m_Collisions );
-
-  const TSeeds& seeds = this->GetSeeds( );
-  typename TSeeds::const_iterator sIt = seeds.begin( );
-  for( ; sIt != seeds.end( ); ++sIt )
-  {
-    if( sIt->IsUnified )
-      mst->AddSeed( sIt->Vertex );
-
-  } // rof
-}
-
-// -------------------------------------------------------------------------
-template< class _TAlgorithm, class _TMST >
-void fpa::Base::Dijkstra< _TAlgorithm, _TMST >::
-_UpdateOutputValue( TNode& n )
-{
-  this->Superclass::_UpdateOutputValue( n );
-  this->GetMinimumSpanningTree( )->SetParent( n.Vertex, n.Parent );
-}
-
-#endif // __fpa__Base__Dijkstra__hxx__
-
-// eof - $RCSfile$
diff --git a/lib/fpa/Base/DijkstraBase.h b/lib/fpa/Base/DijkstraBase.h
deleted file mode 100644 (file)
index b5f214f..0000000
+++ /dev/null
@@ -1,97 +0,0 @@
-// =========================================================================
-// @author Leonardo Florez Valencia
-// @email florez-l@javeriana.edu.co
-// =========================================================================
-
-#ifndef __fpa__Base__DijkstraBase__h__
-#define __fpa__Base__DijkstraBase__h__
-
-#include <vector>
-#include <itkConceptChecking.h>
-#include <fpa/Config.h>
-#include <fpa/Base/Functors/Dijkstra/Function.h>
-
-namespace fpa
-{
-  namespace Base
-  {
-    /**
-     */
-    template< class _TAlgorithm >
-    class DijkstraBase
-      : public _TAlgorithm
-    {
-    public:
-      typedef DijkstraBase                    Self;
-      typedef _TAlgorithm                     Superclass;
-      typedef itk::SmartPointer< Self >       Pointer;
-      typedef itk::SmartPointer< const Self > ConstPointer;
-
-      typedef typename _TAlgorithm::TTraits TTraits;
-      fpa_Base_TraitTypes( typename TTraits );
-
-      /* TODO
-         typedef typename _TAlgorithm::TNode        TNode;
-         typedef typename _TAlgorithm::TNodes       TNodes;
-         typedef typename _TAlgorithm::TInputValue  TInputValue;
-         typedef typename _TAlgorithm::TOutputValue TOutputValue;
-         typedef typename _TAlgorithm::TVertex      TVertex;
-      */
-
-      typedef std::vector< TNode > TQueue;
-      struct TQueueOrder
-      {
-        bool operator()( const TNode& a, const TNode& b ) const
-          {
-            return( b.Value < a.Value );
-          }
-      };
-      typedef fpa::Base::Functors::Dijkstra::Function< TVertex, TOutputValue > TWeightFunction;
-
-    public:
-      itkConceptMacro(
-        Check_TOutputValue,
-        ( itk::Concept::IsFloatingPoint< TOutputValue > )
-        );
-
-    public:
-      itkGetObjectMacro( WeightFunction, TWeightFunction );
-      itkSetObjectMacro( WeightFunction, TWeightFunction );
-
-    public:
-      virtual itk::ModifiedTimeType GetMTime( ) const override;
-
-    protected:
-      DijkstraBase( );
-      virtual ~DijkstraBase( );
-
-      virtual void _ComputeOutputValue( TNode& n ) override;
-      virtual void _QueueClear( ) override;
-      virtual TNode _QueuePop( ) override;
-      virtual void _QueuePush( const TNode& node ) override;
-      virtual unsigned long _QueueSize( ) const override;
-      virtual void _PrepareSeeds( TNodes& nodes ) override;
-
-    private:
-      // Purposely not implemented.
-      DijkstraBase( const Self& other );
-      Self& operator=( const Self& other );
-
-    protected:
-      typename TWeightFunction::Pointer m_WeightFunction;
-
-      TQueue      m_Queue;
-      TQueueOrder m_QueueOrder;
-    };
-
-  } // ecapseman
-
-} // ecapseman
-
-#ifndef ITK_MANUAL_INSTANTIATION
-#  include <fpa/Base/DijkstraBase.hxx>
-#endif // ITK_MANUAL_INSTANTIATION
-
-#endif // __fpa__Base__DijkstraBase__h__
-
-// eof - $RCSfile$
diff --git a/lib/fpa/Base/DijkstraBase.hxx b/lib/fpa/Base/DijkstraBase.hxx
deleted file mode 100644 (file)
index d04ecf5..0000000
+++ /dev/null
@@ -1,111 +0,0 @@
-// =========================================================================
-// @author Leonardo Florez Valencia
-// @email florez-l@javeriana.edu.co
-// =========================================================================
-
-#ifndef __fpa__Base__DijkstraBase__hxx__
-#define __fpa__Base__DijkstraBase__hxx__
-
-#include <algorithm>
-#include <limits>
-
-// -------------------------------------------------------------------------
-template< class _TAlgorithm >
-itk::ModifiedTimeType fpa::Base::DijkstraBase< _TAlgorithm >::
-GetMTime( ) const
-{
-  itk::ModifiedTimeType t = this->Superclass::GetMTime( );
-  if( this->m_WeightFunction.IsNotNull( ) )
-  {
-    itk::ModifiedTimeType q = this->m_WeightFunction->GetMTime( );
-    t = ( q < t )? q: t;
-
-  } // fi
-  return( t );
-}
-
-// -------------------------------------------------------------------------
-template< class _TAlgorithm >
-fpa::Base::DijkstraBase< _TAlgorithm >::
-DijkstraBase( )
-  : Superclass( )
-{
-  this->SetInitValue( std::numeric_limits< TOutputValue >::max( ) );
-}
-
-// -------------------------------------------------------------------------
-template< class _TAlgorithm >
-fpa::Base::DijkstraBase< _TAlgorithm >::
-~DijkstraBase( )
-{
-}
-
-// -------------------------------------------------------------------------
-template< class _TAlgorithm >
-void fpa::Base::DijkstraBase< _TAlgorithm >::
-_ComputeOutputValue( TNode& n )
-{
-  TOutputValue c = this->m_WeightFunction->Evaluate( n.Vertex, n.Parent );
-  n.Value = c + this->_GetOutputValue( n.Parent );
-}
-
-// -------------------------------------------------------------------------
-template< class _TAlgorithm >
-void fpa::Base::DijkstraBase< _TAlgorithm >::
-_QueueClear( )
-{
-  this->m_Queue.clear( );
-}
-
-// -------------------------------------------------------------------------
-template< class _TAlgorithm >
-typename fpa::Base::DijkstraBase< _TAlgorithm >::
-TNode fpa::Base::DijkstraBase< _TAlgorithm >::
-_QueuePop( )
-{
-  std::pop_heap(
-    this->m_Queue.begin( ), this->m_Queue.end( ), this->m_QueueOrder
-    );
-  TNode n = this->m_Queue.back( );
-  this->m_Queue.pop_back( );
-  return( n );
-}
-
-// -------------------------------------------------------------------------
-template< class _TAlgorithm >
-void fpa::Base::DijkstraBase< _TAlgorithm >::
-_QueuePush( const TNode& node )
-{
-  bool push_needed =  ( node.Parent == node.Vertex );
-  push_needed     |= !( node.Value < this->_GetOutputValue( node.Parent ) );
-  if( push_needed )
-  {
-    this->m_Queue.push_back( node );
-    std::push_heap(
-      this->m_Queue.begin( ), this->m_Queue.end( ), this->m_QueueOrder
-      );
-
-  } // fi
-}
-
-// -------------------------------------------------------------------------
-template< class _TAlgorithm >
-unsigned long fpa::Base::DijkstraBase< _TAlgorithm >::
-_QueueSize( ) const
-{
-  return( this->m_Queue.size( ) );
-}
-
-// -------------------------------------------------------------------------
-template< class _TAlgorithm >
-void fpa::Base::DijkstraBase< _TAlgorithm >::
-_PrepareSeeds( TNodes& nodes )
-{
-  typename TNodes::iterator nIt = nodes.begin( );
-  for( ; nIt != nodes.end( ); ++nIt )
-    nIt->Value = TOutputValue( 0 );
-}
-
-#endif // __fpa__Base__DijkstraBase__hxx__
-
-// eof - $RCSfile$
diff --git a/lib/fpa/Base/Functors/Dijkstra/Function.h b/lib/fpa/Base/Functors/Dijkstra/Function.h
deleted file mode 100644 (file)
index 013cb99..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-// =========================================================================
-// @author Leonardo Florez Valencia
-// @email florez-l@javeriana.edu.co
-// =========================================================================
-
-#ifndef __fpa__Base__Functors__Dijkstra__Function__h__
-#define __fpa__Base__Functors__Dijkstra__Function__h__
-
-#include <itkObject.h>
-
-namespace fpa
-{
-  namespace Base
-  {
-    namespace Functors
-    {
-      namespace Dijkstra
-      {
-        /**
-         */
-        template< class _TVertex, class _TOutputValue >
-        class Function
-          : public itk::Object
-        {
-        public:
-          typedef Function                        Self;
-          typedef itk::Object                     Superclass;
-          typedef itk::SmartPointer< Self >       Pointer;
-          typedef itk::SmartPointer< const Self > ConstPointer;
-
-        public:
-          itkTypeMacro( fpa::Base::Functors::Dijkstra::Function, itk::Object );
-
-        public:
-          virtual _TOutputValue Evaluate(
-            const _TVertex& v, const _TVertex& p
-            ) const = 0;
-
-        protected:
-          Function( )
-            : Superclass( )
-            {
-            }
-          virtual ~Function( )
-            {
-            }
-
-        private:
-          // Purposely not implemented
-          Function( const Self& other );
-          Self& operator=( const Self& other );
-        };
-
-      } // ecapseman
-
-    } // ecapseman
-
-  } // ecapseman
-
-} // ecapseman
-
-#endif // __fpa__Base__Functors__Dijkstra__Function__h__
-
-// eof - $RCSfile$
diff --git a/lib/fpa/Base/Functors/RegionGrow/BinaryThreshold.h b/lib/fpa/Base/Functors/RegionGrow/BinaryThreshold.h
deleted file mode 100644 (file)
index 0ac4618..0000000
+++ /dev/null
@@ -1,95 +0,0 @@
-// =========================================================================
-// @author Leonardo Florez Valencia
-// @email florez-l@javeriana.edu.co
-// =========================================================================
-
-#ifndef __fpa__Base__Functors__RegionGrow__BinaryThreshold__h__
-#define __fpa__Base__Functors__RegionGrow__BinaryThreshold__h__
-
-#include <limits>
-#include <itkFunctionBase.h>
-
-namespace fpa
-{
-  namespace Base
-  {
-    namespace Functors
-    {
-      namespace RegionGrow
-      {
-        /**
-         */
-        template< class _TValue >
-        class BinaryThreshold
-          : public itk::FunctionBase< _TValue, bool >
-        {
-        public:
-          typedef BinaryThreshold                    Self;
-          typedef itk::FunctionBase< _TValue, bool > Superclass;
-          typedef itk::SmartPointer< Self >          Pointer;
-          typedef itk::SmartPointer< const Self >    ConstPointer;
-
-        public:
-          itkNewMacro( Self );
-          itkTypeMacro(
-            fpa::Base::Functors::RegionGrow::BinaryThreshold,
-            itk::FunctionBase
-            );
-
-          itkBooleanMacro( Strict );
-
-          itkGetConstMacro( Lower, _TValue );
-          itkGetConstMacro( Upper, _TValue );
-          itkGetConstMacro( Strict, bool );
-
-          itkSetMacro( Lower, _TValue );
-          itkSetMacro( Upper, _TValue );
-          itkSetMacro( Strict, bool );
-
-        public:
-          virtual bool Evaluate( const _TValue& input ) const override
-            {
-              if( this->m_Strict )
-                return( this->m_Lower < input && input < this->m_Upper );
-              else
-                return( this->m_Lower <= input && input <= this->m_Upper );
-            }
-
-        protected:
-          BinaryThreshold( )
-            : Superclass( ),
-              m_Strict( true )
-            {
-              this->m_Upper = std::numeric_limits< _TValue >::max( );
-              if( std::numeric_limits< _TValue >::is_integer )
-                this->m_Lower = std::numeric_limits< _TValue >::min( );
-              else
-                this->m_Lower = -this->m_Upper;
-            }
-
-          virtual ~BinaryThreshold( )
-            {
-            }
-
-        private:
-          // Purposely not implemented
-          BinaryThreshold( const Self& other );
-          Self& operator=( const Self& other );
-
-        protected:
-          _TValue m_Lower;
-          _TValue m_Upper;
-          bool m_Strict;
-        };
-
-      } // ecapseman
-
-    } // ecapseman
-
-  } // ecapseman
-
-} // ecapseman
-
-#endif // __fpa__Base__Functors__RegionGrow__BinaryThreshold__h__
-
-// eof - $RCSfile$
diff --git a/lib/fpa/Base/Functors/RegionGrow/Tautology.h b/lib/fpa/Base/Functors/RegionGrow/Tautology.h
deleted file mode 100644 (file)
index a024b59..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-// =========================================================================
-// @author Leonardo Florez Valencia
-// @email florez-l@javeriana.edu.co
-// =========================================================================
-
-#ifndef __fpa__Base__Functors__RegionGrow__Tautology__h__
-#define __fpa__Base__Functors__RegionGrow__Tautology__h__
-
-#include <itkFunctionBase.h>
-
-namespace fpa
-{
-  namespace Base
-  {
-    namespace Functors
-    {
-      namespace RegionGrow
-      {
-        /**
-         */
-        template< class _TValue >
-        class Tautology
-          : public itk::FunctionBase< _TValue, bool >
-        {
-        public:
-          typedef Tautology                          Self;
-          typedef itk::FunctionBase< _TValue, bool > Superclass;
-          typedef itk::SmartPointer< Self >          Pointer;
-          typedef itk::SmartPointer< const Self >    ConstPointer;
-
-        public:
-          itkNewMacro( Self );
-          itkTypeMacro(
-            fpa::Base::Functors::RegionGrow::Tautology,
-            itk::FunctionBase
-            );
-
-        public:
-          virtual bool Evaluate( const _TValue& input ) const override
-            {
-              return( true );
-            }
-
-        protected:
-          Tautology( )
-            : Superclass( )
-            {
-            }
-          virtual ~Tautology( )
-            {
-            }
-
-        private:
-          // Purposely not implemented
-          Tautology( const Self& other );
-          Self& operator=( const Self& other );
-        };
-
-      } // ecapseman
-
-    } // ecapseman
-
-  } // ecapseman
-
-} // ecapseman
-
-#endif // __fpa__Base__Functors__RegionGrow__Tautology__h__
-
-// eof - $RCSfile$
diff --git a/lib/fpa/Base/MarksInterface.hxx b/lib/fpa/Base/MarksInterface.hxx
deleted file mode 100644 (file)
index 08ad426..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-// =========================================================================
-// @author Leonardo Florez Valencia
-// @email florez-l@javeriana.edu.co
-// =========================================================================
-
-#ifndef __fpa__Base__MarksInterface__hxx__
-#define __fpa__Base__MarksInterface__hxx__
-
-// -------------------------------------------------------------------------
-template< class _TTraits >
-fpa::Base::MarksInterface< _TTraits >::
-MarksInterface( itk::ProcessObject* filter )
-  : m_NumberOfSeeds( 0 ),
-    m_Filter( filter )
-{
-}
-
-// -------------------------------------------------------------------------
-template< class _TTraits >
-fpa::Base::MarksInterface< _TTraits >::
-~MarksInterface( )
-{
-}
-
-// -------------------------------------------------------------------------
-template< class _TTraits >
-void fpa::Base::MarksInterface< _TTraits >::
-_InitMarks( unsigned long nSeeds )
-{
-  this->m_NumberOfSeeds = nSeeds;
-}
-
-// -------------------------------------------------------------------------
-template< class _TTraits >
-bool fpa::Base::MarksInterface< _TTraits >::
-_Collisions( const TVertex& a, const TVertex& b )
-{
-  return( false );
-}
-
-#endif // __fpa__Base__MarksInterface__hxx__
-
-// eof - $RCSfile$
diff --git a/lib/fpa/Base/RegionGrow.h b/lib/fpa/Base/RegionGrow.h
deleted file mode 100644 (file)
index 7147944..0000000
+++ /dev/null
@@ -1,103 +0,0 @@
-// =========================================================================
-// @author Leonardo Florez Valencia
-// @email florez-l@javeriana.edu.co
-// =========================================================================
-
-#ifndef __fpa__Base__RegionGrow__h__
-#define __fpa__Base__RegionGrow__h__
-
-#include <deque>
-#include <fpa/Config.h>
-#include <itkConceptChecking.h>
-#include <itkFunctionBase.h>
-
-namespace fpa
-{
-  namespace Base
-  {
-    /**
-     */
-    template< class _TAlgorithm >
-    class RegionGrow
-      : public _TAlgorithm
-    {
-    public:
-      typedef RegionGrow                      Self;
-      typedef _TAlgorithm                     Superclass;
-      typedef itk::SmartPointer< Self >       Pointer;
-      typedef itk::SmartPointer< const Self > ConstPointer;
-
-      typedef typename _TAlgorithm::TTraits TTraits;
-      fpa_Base_TraitTypes( typename TTraits );
-      /* TODO
-         typedef typename _TAlgorithm::TNode        TNode;
-         typedef typename _TAlgorithm::TNodes       TNodes;
-         typedef typename _TAlgorithm::TInputValue  TInputValue;
-         typedef typename _TAlgorithm::TOutputValue TOutputValue;
-         typedef typename _TAlgorithm::TFrontId     TFrontId;
-         typedef typename _TAlgorithm::TVertex      TVertex;
-      */
-
-      typedef std::deque< TNode >                    TQueue;
-      typedef itk::FunctionBase< TInputValue, bool > TValuePredicate;
-      typedef itk::FunctionBase< TVertex, bool >     TVertexPredicate;
-
-    private:
-      itkConceptMacro(
-        Check_TOutputValue,
-        ( itk::Concept::IsUnsignedInteger< TOutputValue > )
-        );
-
-    public:
-
-      itkGetObjectMacro( ValuePredicate, TValuePredicate );
-      itkGetObjectMacro( VertexPredicate, TVertexPredicate );
-
-      itkGetConstMacro( InsideValue, TOutputValue );
-      itkSetMacro( InsideValue, TOutputValue );
-
-    public:
-      virtual itk::ModifiedTimeType GetMTime( ) const override;
-      virtual TOutputValue GetOutsideValue( ) const;
-      virtual void SetOutsideValue( const TOutputValue& v );
-
-      void SetPredicate( TValuePredicate* p );
-      void SetPredicate( TVertexPredicate* p );
-
-    protected:
-      RegionGrow( );
-      virtual ~RegionGrow( );
-
-      virtual void _ComputeOutputValue( TNode& n ) override;
-      virtual void _UpdateOutputValue( TNode& n ) override;
-      virtual void _QueueClear( ) override;
-      virtual TNode _QueuePop( ) override;
-      virtual void _QueuePush( const TNode& node ) override;
-      virtual unsigned long _QueueSize( ) const override;
-      virtual void _PrepareSeeds( TNodes& nodes ) override;
-
-    private:
-      // Purposely not implemented.
-      RegionGrow( const Self& other );
-      Self& operator=( const Self& other );
-
-    protected:
-      typename TValuePredicate::Pointer  m_ValuePredicate;
-      typename TVertexPredicate::Pointer m_VertexPredicate;
-
-      TOutputValue m_InsideValue;
-
-      TQueue m_Queue;
-    };
-
-  } // ecapseman
-
-} // ecapseman
-
-#ifndef ITK_MANUAL_INSTANTIATION
-#  include <fpa/Base/RegionGrow.hxx>
-#endif // ITK_MANUAL_INSTANTIATION
-
-#endif // __fpa__Base__RegionGrow__h__
-
-// eof - $RCSfile$
diff --git a/lib/fpa/Base/RegionGrow.hxx b/lib/fpa/Base/RegionGrow.hxx
deleted file mode 100644 (file)
index bf0a862..0000000
+++ /dev/null
@@ -1,167 +0,0 @@
-// =========================================================================
-// @author Leonardo Florez Valencia
-// @email florez-l@javeriana.edu.co
-// =========================================================================
-
-#ifndef __fpa__Base__RegionGrow__hxx__
-#define __fpa__Base__RegionGrow__hxx__
-
-// -------------------------------------------------------------------------
-template< class _TAlgorithm >
-itk::ModifiedTimeType fpa::Base::RegionGrow< _TAlgorithm >::
-GetMTime( ) const
-{
-  itk::ModifiedTimeType t = this->Superclass::GetMTime( );
-  if( this->m_ValuePredicate.IsNotNull( ) )
-  {
-    itk::ModifiedTimeType q = this->m_ValuePredicate->GetMTime( );
-    t = ( q < t )? q: t;
-
-  } // fi
-  if( this->m_VertexPredicate.IsNotNull( ) )
-  {
-    itk::ModifiedTimeType q = this->m_VertexPredicate->GetMTime( );
-    t = ( q < t )? q: t;
-
-  } // fi
-
-  return( t );
-}
-
-// -------------------------------------------------------------------------
-template< class _TAlgorithm >
-typename fpa::Base::RegionGrow< _TAlgorithm >::
-TOutputValue fpa::Base::RegionGrow< _TAlgorithm >::
-GetOutsideValue( ) const
-{
-  return( this->GetInitValue( ) );
-}
-
-// -------------------------------------------------------------------------
-template< class _TAlgorithm >
-void fpa::Base::RegionGrow< _TAlgorithm >::
-SetOutsideValue( const TOutputValue& v )
-{
-  this->SetInitValue( v );
-}
-
-// -------------------------------------------------------------------------
-template< class _TAlgorithm >
-void fpa::Base::RegionGrow< _TAlgorithm >::
-SetPredicate( TValuePredicate* p )
-{
-  if( this->m_ValuePredicate.GetPointer( ) != p )
-  {
-    this->m_ValuePredicate = p;
-    this->Modified( );
-
-  } // fi
-}
-
-// -------------------------------------------------------------------------
-template< class _TAlgorithm >
-void fpa::Base::RegionGrow< _TAlgorithm >::
-SetPredicate( TVertexPredicate* p )
-{
-  if( this->m_VertexPredicate.GetPointer( ) != p )
-  {
-    this->m_VertexPredicate = p;
-    this->Modified( );
-
-  } // fi
-}
-
-// -------------------------------------------------------------------------
-template< class _TAlgorithm >
-fpa::Base::RegionGrow< _TAlgorithm >::
-RegionGrow( )
-  : Superclass( ),
-    m_InsideValue( TOutputValue( 1 ) )
-{
-  this->SetInitValue( TOutputValue( 0 ) );
-}
-
-// -------------------------------------------------------------------------
-template< class _TAlgorithm >
-fpa::Base::RegionGrow< _TAlgorithm >::
-~RegionGrow( )
-{
-}
-
-// -------------------------------------------------------------------------
-template< class _TAlgorithm >
-void fpa::Base::RegionGrow< _TAlgorithm >::
-_ComputeOutputValue( TNode& n )
-{
-  // Do nothing!!!
-}
-
-// -------------------------------------------------------------------------
-template< class _TAlgorithm >
-void fpa::Base::RegionGrow< _TAlgorithm >::
-_UpdateOutputValue( TNode& n )
-{
-  TInputValue value = this->_GetInputValue( n.Vertex );
-  bool inside = false;
-  if( this->m_ValuePredicate.IsNotNull( ) )
-    inside = this->m_ValuePredicate->Evaluate( value );
-  if( this->m_VertexPredicate.IsNotNull( ) )
-    inside &= this->m_VertexPredicate->Evaluate( n.Vertex );
-  if( !inside )
-  {
-    n.Value = this->m_InitValue;
-    n.FrontId = 0;
-  }
-  else
-    n.Value = this->m_InsideValue;
-  this->Superclass::_UpdateOutputValue( n );
-}
-
-// -------------------------------------------------------------------------
-template< class _TAlgorithm >
-void fpa::Base::RegionGrow< _TAlgorithm >::
-_QueueClear( )
-{
-  this->m_Queue.clear( );
-}
-
-// -------------------------------------------------------------------------
-template< class _TAlgorithm >
-typename fpa::Base::RegionGrow< _TAlgorithm >::
-TNode fpa::Base::RegionGrow< _TAlgorithm >::
-_QueuePop( )
-{
-  TNode n = this->m_Queue.front( );
-  this->m_Queue.pop_front( );
-  return( n );
-}
-
-// -------------------------------------------------------------------------
-template< class _TAlgorithm >
-void fpa::Base::RegionGrow< _TAlgorithm >::
-_QueuePush( const TNode& node )
-{
-  this->m_Queue.push_back( node );
-}
-
-// -------------------------------------------------------------------------
-template< class _TAlgorithm >
-unsigned long fpa::Base::RegionGrow< _TAlgorithm >::
-_QueueSize( ) const
-{
-  return( this->m_Queue.size( ) );
-}
-
-// -------------------------------------------------------------------------
-template< class _TAlgorithm >
-void fpa::Base::RegionGrow< _TAlgorithm >::
-_PrepareSeeds( TNodes& nodes )
-{
-  typename TNodes::iterator nIt = nodes.begin( );
-  for( ; nIt != nodes.end( ); ++nIt )
-    nIt->Value = this->m_InitValue;
-}
-
-#endif // __fpa__Base__RegionGrow__hxx__
-
-// eof - $RCSfile$
diff --git a/lib/fpa/Base/SeedsInterface.h b/lib/fpa/Base/SeedsInterface.h
deleted file mode 100644 (file)
index d556f3a..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-// =========================================================================
-// @author Leonardo Florez Valencia
-// @email florez-l@javeriana.edu.co
-// =========================================================================
-
-#ifndef __fpa__Base__SeedsInterface__h__
-#define __fpa__Base__SeedsInterface__h__
-
-#include <fpa/Config.h>
-#include <itkConceptChecking.h>
-#include <itkProcessObject.h>
-
-namespace fpa
-{
-  namespace Base
-  {
-    /**
-     */
-    template< class _TTraits >
-    class SeedsInterface
-    {
-    public:
-      typedef SeedsInterface Self;
-      typedef _TTraits       TTraits;
-      fpa_Base_TraitTypes( typename TTraits );
-
-    private:
-      itkConceptMacro(
-        Check_TFrontId,
-        ( itk::Concept::IsUnsignedInteger< TFrontId > )
-        );
-
-    public:
-      TSeeds& GetSeeds( );
-      const TSeeds& GetSeeds( ) const;
-
-      virtual void AddSeed( const TVertex& seed );
-      virtual void AddSeed( const TPoint& seed );
-      virtual void ClearSeeds( );
-
-    protected:
-      SeedsInterface( itk::ProcessObject* filter );
-      virtual ~SeedsInterface( );
-
-      virtual TNodes _UnifySeeds( ) = 0;
-      virtual void _PrepareSeeds( TNodes& nodes ) = 0;
-
-    protected:
-      TSeeds m_Seeds;
-      itk::ProcessObject* m_Filter;
-    };
-
-  } // ecapseman
-
-} // ecapseman
-
-#ifndef ITK_MANUAL_INSTANTIATION
-#  include <fpa/Base/SeedsInterface.hxx>
-#endif // ITK_MANUAL_INSTANTIATION
-
-#endif // __fpa__Base__SeedsInterface__h__
-
-// eof - $RCSfile$
diff --git a/lib/fpa/Base/SeedsInterface.hxx b/lib/fpa/Base/SeedsInterface.hxx
deleted file mode 100644 (file)
index 77b1600..0000000
+++ /dev/null
@@ -1,85 +0,0 @@
-// =========================================================================
-// @author Leonardo Florez Valencia
-// @email florez-l@javeriana.edu.co
-// =========================================================================
-
-#ifndef __fpa__Base__SeedsInterface__hxx__
-#define __fpa__Base__SeedsInterface__hxx__
-
-// -------------------------------------------------------------------------
-template< class _TTraits >
-typename fpa::Base::SeedsInterface< _TTraits >::
-TSeeds& fpa::Base::SeedsInterface< _TTraits >::
-GetSeeds( )
-{
-  return( this->m_Seeds );
-}
-
-// -------------------------------------------------------------------------
-template< class _TTraits >
-const typename fpa::Base::SeedsInterface< _TTraits >::
-TSeeds& fpa::Base::SeedsInterface< _TTraits >::
-GetSeeds( ) const
-{
-  return( this->m_Seeds );
-}
-
-// -------------------------------------------------------------------------
-template< class _TTraits >
-void fpa::Base::SeedsInterface< _TTraits >::
-AddSeed( const TVertex& seed )
-{
-  TSeed s;
-  s.Vertex = seed;
-  s.IsPoint = false;
-  this->m_Seeds.push_back( s );
-  if( this->m_Filter != NULL )
-    this->m_Filter->Modified( );
-}
-
-// -------------------------------------------------------------------------
-template< class _TTraits >
-void fpa::Base::SeedsInterface< _TTraits >::
-AddSeed( const TPoint& seed )
-{
-  TSeed s;
-  s.Point = seed;
-  s.IsPoint = true;
-  this->m_Seeds.push_back( s );
-  if( this->m_Filter != NULL )
-    this->m_Filter->Modified( );
-}
-
-// -------------------------------------------------------------------------
-template< class _TTraits >
-void fpa::Base::SeedsInterface< _TTraits >::
-ClearSeeds( )
-{
-  if( this->m_Seeds.size( ) > 0 )
-  {
-    this->m_Seeds.clear( );
-    if( this->m_Filter != NULL )
-      this->m_Filter->Modified( );
-
-  } // fi
-}
-
-// -------------------------------------------------------------------------
-template< class _TTraits >
-fpa::Base::SeedsInterface< _TTraits >::
-SeedsInterface( itk::ProcessObject* filter )
-  : m_Filter( filter )
-{
-}
-
-// -------------------------------------------------------------------------
-template< class _TTraits >
-fpa::Base::SeedsInterface< _TTraits >::
-~SeedsInterface( )
-{
-  this->m_Seeds.clear( );
-}
-
-#endif // __fpa__Base__SeedsInterface__hxx__
-
-// eof - $RCSfile$
diff --git a/lib/fpa/Base/SingleSeedInterface.h b/lib/fpa/Base/SingleSeedInterface.h
deleted file mode 100644 (file)
index 0295032..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-// =========================================================================
-// @author Leonardo Florez Valencia
-// @email florez-l@javeriana.edu.co
-// =========================================================================
-
-#ifndef __fpa__Base__SingleSeedInterface__h__
-#define __fpa__Base__SingleSeedInterface__h__
-
-#include <fpa/Config.h>
-#include <itkConceptChecking.h>
-#include <itkProcessObject.h>
-
-namespace fpa
-{
-  namespace Base
-  {
-    /**
-     */
-    template< class _TTraits >
-    class SingleSeedInterface
-    {
-    public:
-      typedef SingleSeedInterface Self;
-      typedef _TTraits            TTraits;
-      fpa_Base_TraitTypes( typename TTraits );
-
-    private:
-      itkConceptMacro(
-        Check_TFrontId,
-        ( itk::Concept::IsUnsignedInteger< TFrontId > )
-        );
-
-    public:
-      TSeeds& GetSeeds( );
-      const TSeeds& GetSeeds( ) const;
-
-      virtual void SetSeed( const TVertex& seed );
-      virtual void SetSeed( const TPoint& seed );
-
-    protected:
-      SingleSeedInterface( itk::ProcessObject* filter );
-      virtual ~SingleSeedInterface( );
-
-      virtual TNodes _UnifySeeds( ) = 0;
-      virtual void _PrepareSeeds( TNodes& nodes ) = 0;
-
-    protected:
-      TSeeds m_Seeds;
-      itk::ProcessObject* m_Filter;
-    };
-
-  } // ecapseman
-
-} // ecapseman
-
-#ifndef ITK_MANUAL_INSTANTIATION
-#  include <fpa/Base/SingleSeedInterface.hxx>
-#endif // ITK_MANUAL_INSTANTIATION
-
-#endif // __fpa__Base__SingleSeedInterface__h__
-
-// eof - $RCSfile$
diff --git a/lib/fpa/Base/SingleSeedInterface.hxx b/lib/fpa/Base/SingleSeedInterface.hxx
deleted file mode 100644 (file)
index 63cc629..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-// =========================================================================
-// @author Leonardo Florez Valencia
-// @email florez-l@javeriana.edu.co
-// =========================================================================
-
-#ifndef __fpa__Base__SingleSeedInterface__hxx__
-#define __fpa__Base__SingleSeedInterface__hxx__
-
-// -------------------------------------------------------------------------
-template< class _TTraits >
-typename fpa::Base::SingleSeedInterface< _TTraits >::
-TSeeds& fpa::Base::SingleSeedInterface< _TTraits >::
-GetSeeds( )
-{
-  return( this->m_Seeds );
-}
-
-// -------------------------------------------------------------------------
-template< class _TTraits >
-const typename fpa::Base::SingleSeedInterface< _TTraits >::
-TSeeds& fpa::Base::SingleSeedInterface< _TTraits >::
-GetSeeds( ) const
-{
-  return( this->m_Seeds );
-}
-
-// -------------------------------------------------------------------------
-template< class _TTraits >
-void fpa::Base::SingleSeedInterface< _TTraits >::
-SetSeed( const TVertex& seed )
-{
-  TSeed s;
-  s.Vertex = seed;
-  s.IsPoint = false;
-  this->m_Seeds[ 0 ] = s;
-  if( this->m_Filter != NULL )
-    this->m_Filter->Modified( );
-}
-
-// -------------------------------------------------------------------------
-template< class _TTraits >
-void fpa::Base::SingleSeedInterface< _TTraits >::
-SetSeed( const TPoint& seed )
-{
-  TSeed s;
-  s.Point = seed;
-  s.IsPoint = true;
-  this->m_Seeds[ 0 ] = s;
-  if( this->m_Filter != NULL )
-    this->m_Filter->Modified( );
-}
-
-// -------------------------------------------------------------------------
-template< class _TTraits >
-fpa::Base::SingleSeedInterface< _TTraits >::
-SingleSeedInterface( itk::ProcessObject* filter )
-  : m_Filter( filter )
-{
-  this->m_Seeds = TSeeds( 1 );
-}
-
-// -------------------------------------------------------------------------
-template< class _TTraits >
-fpa::Base::SingleSeedInterface< _TTraits >::
-~SingleSeedInterface( )
-{
-  this->m_Seeds.clear( );
-}
-
-#endif // __fpa__Base__SingleSeedInterface__hxx__
-
-// eof - $RCSfile$
index e57fdbd16eb0ad742b9de293a0baeefcf44326c0..bb03dddedd255efc89d27061c411d7a853db9bd2 100644 (file)
@@ -1,38 +1,38 @@
-
-## =====================
-## == Get source code ==
-## =====================
+## =========================================================================
+## @author Leonardo Florez Valencia
+## @email florez-l@javeriana.edu.co
+## =========================================================================
 
 configure_file(Version.cxx.in "${CMAKE_CURRENT_BINARY_DIR}/Version.cxx" @ONLY)
 configure_file(Config.h.in "${CMAKE_CURRENT_BINARY_DIR}/Config.h" @ONLY)
-file(GLOB_RECURSE _base_src "${CMAKE_CURRENT_SOURCE_DIR}/Base/*.cxx")
-file(GLOB_RECURSE _base_hdr "${CMAKE_CURRENT_SOURCE_DIR}/Base/*.h")
-file(GLOB_RECURSE _base_hrc "${CMAKE_CURRENT_SOURCE_DIR}/Base/*.hxx")
-file(GLOB_RECURSE _image_src "${CMAKE_CURRENT_SOURCE_DIR}/Image/*.cxx")
-file(GLOB_RECURSE _image_hdr "${CMAKE_CURRENT_SOURCE_DIR}/Image/*.h")
-file(GLOB_RECURSE _image_hrc "${CMAKE_CURRENT_SOURCE_DIR}/Image/*.hxx")
-
-file(GLOB_RECURSE _generic_src "${CMAKE_CURRENT_SOURCE_DIR}/Generic/*.cxx")
-file(GLOB_RECURSE _generic_hdr "${CMAKE_CURRENT_SOURCE_DIR}/Generic/*.h")
-file(GLOB_RECURSE _generic_hrc "${CMAKE_CURRENT_SOURCE_DIR}/Generic/*.hxx")
-
-
-set(_src
-  ${_base_src} ${_image_src} ${_generic_src}
-  "${CMAKE_CURRENT_BINARY_DIR}/Version.cxx"
-  )
-set(
-  _hdr
-  ${_base_hdr} ${_image_hdr} ${_generic_hdr}
-  "${CMAKE_CURRENT_BINARY_DIR}/Config.h"
-  )
-set(_hrc ${_base_hrc} ${_image_hrc} ${_generic_hrc})
+file(GLOB_RECURSE _common_src "${CMAKE_CURRENT_SOURCE_DIR}/Common/*.cxx")
+file(GLOB_RECURSE _filters_src "${CMAKE_CURRENT_SOURCE_DIR}/Filters/*.cxx")
+file(GLOB_RECURSE _functors_src "${CMAKE_CURRENT_SOURCE_DIR}/Functors/*.cxx")
+file(GLOB_RECURSE _common_hdr "${CMAKE_CURRENT_SOURCE_DIR}/Common/*.h")
+file(GLOB_RECURSE _filters_hdr "${CMAKE_CURRENT_SOURCE_DIR}/Filters/*.h")
+file(GLOB_RECURSE _functors_hdr "${CMAKE_CURRENT_SOURCE_DIR}/Functors/*.h")
+file(GLOB_RECURSE _common_hrc "${CMAKE_CURRENT_SOURCE_DIR}/Common/*.hxx")
+file(GLOB_RECURSE _filters_hrc "${CMAKE_CURRENT_SOURCE_DIR}/Filters/*.hxx")
+file(GLOB_RECURSE _functors_hrc "${CMAKE_CURRENT_SOURCE_DIR}/Functors/*.hxx")
+if(VTK_FOUND)
+  file(GLOB_RECURSE _vtk_src "${CMAKE_CURRENT_SOURCE_DIR}/VTK/*.cxx")
+  file(GLOB_RECURSE _vtk_hdr "${CMAKE_CURRENT_SOURCE_DIR}/VTK/*.h")
+  file(GLOB_RECURSE _vtk_hrc "${CMAKE_CURRENT_SOURCE_DIR}/VTK/*.hxx")
+endif(VTK_FOUND)
 
 ## =====================
 ## == Compile library ==
 ## =====================
 
-add_library(fpa SHARED ${_src} ${_hdr} ${_hrc})
+add_library(
+  fpa SHARED
+  "${CMAKE_CURRENT_BINARY_DIR}/Version.cxx"
+  "${CMAKE_CURRENT_BINARY_DIR}/Config.h"
+  ${_common_src}
+  ${_filters_src}
+  ${_functors_src}
+  ${_vtk_src}
+  )
 generate_export_header(fpa)
 set_property(TARGET fpa PROPERTY VERSION ${prj_VERSION})
 set_property(TARGET fpa PROPERTY SOVERSION ${prj_SHORT_VERSION})
@@ -42,7 +42,7 @@ set_property(
 set_property(
   TARGET fpa APPEND PROPERTY COMPATIBLE_INTERFACE_STRING ${prj_MAJ_VERSION}
   )
-target_link_libraries(fpa PUBLIC ${VTK_LIBRARIES} ${ITK_LIBRARIES})
+target_link_libraries(fpa PUBLIC ${ITK_LIBRARIES})
 
 ## ========================
 ## == Installation rules ==
diff --git a/lib/fpa/Common/Image/PolyLineParametricPathReader.h b/lib/fpa/Common/Image/PolyLineParametricPathReader.h
new file mode 100644 (file)
index 0000000..fe3678b
--- /dev/null
@@ -0,0 +1,85 @@
+// =========================================================================
+// @author Leonardo Florez Valencia
+// @email florez-l@javeriana.edu.co
+// =========================================================================
+#ifndef __fpa__Common__Image__PolyLineParametricPathReader__h__
+#define __fpa__Common__Image__PolyLineParametricPathReader__h__
+
+#include <itkProcessObject.h>
+
+namespace fpa
+{
+  namespace Common
+  {
+    namespace Image
+    {
+      /**
+       */
+      template< class _TPath >
+      class PolyLineParametricPathReader
+        : public itk::ProcessObject
+      {
+      public:
+        // Basic types
+        typedef PolyLineParametricPathReader    Self;
+        typedef itk::ProcessObject              Superclass;
+        typedef itk::SmartPointer< Self >       Pointer;
+        typedef itk::SmartPointer< const Self > ConstPointer;
+
+        typedef _TPath TPath;
+
+      public:
+        itkNewMacro( Self );
+        itkTypeMacro( PolyLineParametricPathReader, itk::ProcessObject );
+
+        itkGetConstMacro( FileName, std::string );
+        itkSetMacro( FileName, std::string );
+
+      public:
+        TPath* GetOutput( );
+        TPath* GetOutput( unsigned int i );
+
+        virtual void GraftOutput( itk::DataObject* out );
+        virtual void GraftOutput(
+          const typename Superclass::DataObjectIdentifierType& key,
+          itk::DataObject* out
+          );
+        virtual void GraftNthOutput( unsigned int i, itk::DataObject* out );
+        virtual itk::DataObject::Pointer MakeOutput(
+          itk::ProcessObject::DataObjectPointerArraySizeType i
+          ) override;
+
+        virtual void Update( ) override
+          { this->GenerateData( ); }
+
+      protected:
+        PolyLineParametricPathReader( );
+        virtual ~PolyLineParametricPathReader( );
+
+        virtual void GenerateData( ) override;
+
+        // Do nothing
+        virtual void GenerateOutputInformation( ) override
+          { }
+
+      private:
+        // Purposely not implemented
+        PolyLineParametricPathReader( const Self& );
+        void operator=( const Self& );
+
+      protected:
+        std::string m_FileName;
+      };
+
+    } // ecapseman
+
+  } // ecapseman
+
+} // ecapseman
+
+#ifndef ITK_MANUAL_INSTANTIATION
+#  include <fpa/Common/Image/PolyLineParametricPathReader.hxx>
+#endif // ITK_MANUAL_INSTANTIATION
+#endif // __fpa__Common__Image__PolyLineParametricPathReader__h__
+
+// eof - $RCSfile$
diff --git a/lib/fpa/Common/Image/PolyLineParametricPathReader.hxx b/lib/fpa/Common/Image/PolyLineParametricPathReader.hxx
new file mode 100644 (file)
index 0000000..b931ea1
--- /dev/null
@@ -0,0 +1,173 @@
+// =========================================================================
+// @author Leonardo Florez Valencia
+// @email florez-l@javeriana.edu.co
+// =========================================================================
+#ifndef __fpa__Common__Image__PolyLineParametricPathReader__hxx__
+#define __fpa__Common__Image__PolyLineParametricPathReader__hxx__
+
+// -------------------------------------------------------------------------
+template< class _TPath >
+_TPath* fpa::Common::Image::PolyLineParametricPathReader< _TPath >::
+GetOutput( )
+{
+  return(
+    itkDynamicCastInDebugMode< TPath* >( this->GetPrimaryOutput( ) )
+    );
+}
+
+// -------------------------------------------------------------------------
+template< class _TPath >
+_TPath* fpa::Common::Image::PolyLineParametricPathReader< _TPath >::
+GetOutput( unsigned int i )
+{
+  return(
+    itkDynamicCastInDebugMode< TPath* >(
+      this->itk::ProcessObject::GetOutput( i )
+      )
+    );
+}
+
+// -------------------------------------------------------------------------
+template< class _TPath >
+void fpa::Common::Image::PolyLineParametricPathReader< _TPath >::
+GraftOutput( itk::DataObject* out )
+{
+  this->GraftNthOutput( 0, out );
+}
+
+// -------------------------------------------------------------------------
+template< class _TPath >
+void fpa::Common::Image::PolyLineParametricPathReader< _TPath >::
+GraftOutput(
+  const typename Superclass::DataObjectIdentifierType& key,
+  itk::DataObject* out
+  )
+{
+  if( out == NULL )
+  {
+    itkExceptionMacro(
+      << "Requested to graft output that is a NULL pointer"
+      );
+
+  } // fi
+  itk::DataObject* output = this->itk::ProcessObject::GetOutput( key );
+  output->Graft( out );
+}
+
+// -------------------------------------------------------------------------
+template< class _TPath >
+void fpa::Common::Image::PolyLineParametricPathReader< _TPath >::
+GraftNthOutput( unsigned int i, itk::DataObject* out )
+{
+  if( i >= this->GetNumberOfIndexedOutputs( ) )
+  {
+    itkExceptionMacro(
+      << "Requested to graft output " << i
+      << " but this filter only has "
+      << this->GetNumberOfIndexedOutputs( )
+      << " indexed Outputs."
+      );
+
+  } // fi
+  this->GraftOutput( this->MakeNameFromOutputIndex( i ), out );
+}
+
+// -------------------------------------------------------------------------
+template< class _TPath >
+itk::DataObject::Pointer
+fpa::Common::Image::PolyLineParametricPathReader< _TPath >::
+MakeOutput( itk::ProcessObject::DataObjectPointerArraySizeType i )
+{
+  return( TPath::New( ).GetPointer( ) );
+}
+
+// -------------------------------------------------------------------------
+template< class _TPath >
+fpa::Common::Image::PolyLineParametricPathReader< _TPath >::
+PolyLineParametricPathReader( )
+  : Superclass( )
+{
+  typename TPath::Pointer out =
+    static_cast< TPath* >( this->MakeOutput( 0 ).GetPointer( ) );
+  this->itk::ProcessObject::SetNumberOfRequiredInputs( 0 );
+  this->itk::ProcessObject::SetNumberOfRequiredOutputs( 1 );
+  this->itk::ProcessObject::SetNthOutput( 0, out.GetPointer( ) );
+}
+
+// -------------------------------------------------------------------------
+template< class _TPath >
+fpa::Common::Image::PolyLineParametricPathReader< _TPath >::
+~PolyLineParametricPathReader( )
+{
+}
+
+// -------------------------------------------------------------------------
+template< class _TPath >
+void fpa::Common::Image::PolyLineParametricPathReader< _TPath >::
+GenerateData( )
+{
+  std::string buffer;
+  std::ifstream file_stream( this->m_FileName.c_str( ) );
+  if( !file_stream )
+  {
+    itkExceptionMacro(
+      << "Error reading skeleton from \"" << this->m_FileName << "\""
+      );
+    return;
+
+  } // fi
+  file_stream.seekg( 0, std::ios::end );
+  buffer.reserve( ( unsigned int )( file_stream.tellg( ) ) );
+  file_stream.seekg( 0, std::ios::beg );
+  buffer.assign(
+    ( std::istreambuf_iterator< char >( file_stream ) ),
+    std::istreambuf_iterator< char >( )
+    );
+  file_stream.close( );
+
+  std::istringstream in( buffer );
+  unsigned int dim;
+  in >> dim;
+  if( dim != TPath::Dimension )
+  {
+    itkExceptionMacro(
+      << "Mismatched path dimension: " << dim
+      << " != " << TPath::Dimension
+      );
+    return;
+
+  } // fi
+
+  // Read spatial parameters
+  typename TPath::TSpacing spa;
+  typename TPath::TDirection dir;
+  typename TPath::TPoint ori;
+  for( unsigned int d = 0; d < dim; ++d )
+    in >> spa[ d ];
+  for( unsigned int d = 0; d < dim; ++d )
+    for( unsigned int e = 0; e < dim; ++e )
+      in >> dir[ d ][ e ];
+  for( unsigned int d = 0; d < dim; ++d )
+    in >> ori[ d ];
+
+  // Read path
+  TPath* path = this->GetOutput( );
+  path->SetSpacing( spa );
+  path->SetOrigin( ori );
+  path->SetDirection( dir );
+
+  unsigned long pathSize;
+  in >> pathSize;
+  for( unsigned long id = 0; id < pathSize; ++id )
+  {
+    typename TPath::TIndex idx;
+    for( unsigned int d = 0; d < dim; ++d )
+      in >> idx[ d ];
+    path->AddVertex( idx );
+
+  } // rof
+}
+
+#endif // __fpa__Common__Image__PolyLineParametricPathReader__hxx__
+
+// eof - $RCSfile$
diff --git a/lib/fpa/Common/Image/PolyLineParametricPathWriter.h b/lib/fpa/Common/Image/PolyLineParametricPathWriter.h
new file mode 100644 (file)
index 0000000..f8ba177
--- /dev/null
@@ -0,0 +1,69 @@
+// =========================================================================
+// @author Leonardo Florez Valencia
+// @email florez-l@javeriana.edu.co
+// =========================================================================
+#ifndef __fpa__Common__Image__PolyLineParametricPathWriter__h__
+#define __fpa__Common__Image__PolyLineParametricPathWriter__h__
+
+#include <itkProcessObject.h>
+
+namespace fpa
+{
+  namespace Common
+  {
+    namespace Image
+    {
+      /**
+       */
+      template< class _TPath >
+      class PolyLineParametricPathWriter
+        : public itk::ProcessObject
+      {
+      public:
+        // Basic types
+        typedef PolyLineParametricPathWriter    Self;
+        typedef itk::ProcessObject              Superclass;
+        typedef itk::SmartPointer< Self >       Pointer;
+        typedef itk::SmartPointer< const Self > ConstPointer;
+
+        typedef _TPath TPath;
+
+      public:
+        itkNewMacro( Self );
+        itkTypeMacro( PolyLineParametricPathWriter, itk::ProcessObject );
+
+        itkGetConstMacro( FileName, std::string );
+        itkSetMacro( FileName, std::string );
+
+      public:
+        const TPath* GetInput( ) const;
+        void SetInput( const TPath* path );
+        virtual void Update( ) override;
+
+      protected:
+        PolyLineParametricPathWriter( );
+        virtual ~PolyLineParametricPathWriter( );
+
+        virtual void GenerateData( ) override;
+
+      private:
+        // Purposely not implemented
+        PolyLineParametricPathWriter( const Self& );
+        void operator=( const Self& );
+
+      protected:
+        std::string m_FileName;
+      };
+
+    } // ecapseman
+
+  } // ecapseman
+
+} // ecapseman
+
+#ifndef ITK_MANUAL_INSTANTIATION
+#  include <fpa/Common/Image/PolyLineParametricPathWriter.hxx>
+#endif // ITK_MANUAL_INSTANTIATION
+#endif // __fpa__Common__Image__PolyLineParametricPathWriter__h__
+
+// eof - $RCSfile$
diff --git a/lib/fpa/Common/Image/PolyLineParametricPathWriter.hxx b/lib/fpa/Common/Image/PolyLineParametricPathWriter.hxx
new file mode 100644 (file)
index 0000000..94b6a04
--- /dev/null
@@ -0,0 +1,111 @@
+// =========================================================================
+// @author Leonardo Florez Valencia
+// @email florez-l@javeriana.edu.co
+// =========================================================================
+#ifndef __fpa__Common__Image__PolyLineParametricPathWriter__hxx__
+#define __fpa__Common__Image__PolyLineParametricPathWriter__hxx__
+
+#include <fstream>
+
+// -------------------------------------------------------------------------
+template< class _TPath >
+const _TPath* fpa::Common::Image::PolyLineParametricPathWriter< _TPath >::
+GetInput( ) const
+{
+  return(
+    dynamic_cast< const TPath* >(
+      this->itk::ProcessObject::GetInput( 0 )
+      )
+    );
+}
+
+// -------------------------------------------------------------------------
+template< class _TPath >
+void fpa::Common::Image::PolyLineParametricPathWriter< _TPath >::
+SetInput( const _TPath* path )
+{
+  this->itk::ProcessObject::SetNthInput( 0, const_cast< TPath* >( path ) );
+}
+
+// -------------------------------------------------------------------------
+template< class _TPath >
+void fpa::Common::Image::PolyLineParametricPathWriter< _TPath >::
+Update( )
+{
+  TPath* input = const_cast< TPath* >( this->GetInput( ) );
+  if( input != NULL )
+  {
+    input->UpdateOutputInformation( );
+    input->UpdateOutputData( );
+    this->GenerateData( );
+    this->ReleaseInputs( );
+
+  } // fi
+}
+
+// -------------------------------------------------------------------------
+template< class _TPath >
+fpa::Common::Image::PolyLineParametricPathWriter< _TPath >::
+PolyLineParametricPathWriter( )
+  : Superclass( ),
+    m_FileName( "" )
+{
+  this->SetNumberOfRequiredInputs( 1 );
+}
+
+// -------------------------------------------------------------------------
+template< class _TPath >
+fpa::Common::Image::PolyLineParametricPathWriter< _TPath >::
+~PolyLineParametricPathWriter( )
+{
+}
+
+// -------------------------------------------------------------------------
+template< class _TPath >
+void fpa::Common::Image::PolyLineParametricPathWriter< _TPath >::
+GenerateData( )
+{
+  const TPath* path = this->GetInput( );
+
+  // Write base information
+  std::stringstream out1, out2;
+  out1 << TPath::Dimension << std::endl;
+  typename TPath::TSpacing spa = path->GetSpacing( );
+  for( unsigned int d = 0; d < TPath::Dimension; ++d )
+    out1 << spa[ d ] << " ";
+  out1 << std::endl;
+  typename TPath::TDirection dir = path->GetDirection( );
+  for( unsigned int d = 0; d < TPath::Dimension; ++d )
+    for( unsigned int e = 0; e < TPath::Dimension; ++e )
+      out1 << dir[ d ][ e ] << " ";
+  out1 << std::endl;
+  typename TPath::TPoint ori = path->GetOrigin( );
+  for( unsigned int d = 0; d < TPath::Dimension; ++d )
+    out1 << ori[ d ] << " ";
+  out1 << std::endl;
+
+  // Write path
+  unsigned int size = path->GetSize( );
+  out2 << size << std::endl;
+  for( unsigned int i = 0; i < path->GetSize( ); ++i )
+  {
+    typename TPath::TIndex v = path->GetVertex( i );
+    for( unsigned int d = 0; d < TPath::Dimension; ++d )
+      out2 << v[ d ] << " ";
+
+  } // rof
+
+  // Real write
+  std::ofstream file_stream( this->m_FileName.c_str( ), std::ofstream::binary );
+  if( !file_stream )
+    itkExceptionMacro(
+      << "Unable to write skeleton to \""
+      << this->m_FileName
+      << "\""
+      );
+  file_stream.write( out1.str( ).c_str( ), out1.str( ).size( ) );
+}
+
+#endif // __fpa__Common__Image__PolyLineParametricPathWriter__hxx__
+
+// eof - $RCSfile$
diff --git a/lib/fpa/Common/Image/SkeletonReader.h b/lib/fpa/Common/Image/SkeletonReader.h
new file mode 100644 (file)
index 0000000..cc64aae
--- /dev/null
@@ -0,0 +1,85 @@
+// =========================================================================
+// @author Leonardo Florez Valencia
+// @email florez-l@javeriana.edu.co
+// =========================================================================
+#ifndef __fpa__Common__Image__SkeletonReader__h__
+#define __fpa__Common__Image__SkeletonReader__h__
+
+#include <itkProcessObject.h>
+
+namespace fpa
+{
+  namespace Common
+  {
+    namespace Image
+    {
+      /**
+       */
+      template< class _TSkeleton >
+      class SkeletonReader
+        : public itk::ProcessObject
+      {
+      public:
+        // Basic types
+        typedef SkeletonReader                  Self;
+        typedef itk::ProcessObject              Superclass;
+        typedef itk::SmartPointer< Self >       Pointer;
+        typedef itk::SmartPointer< const Self > ConstPointer;
+
+        typedef _TSkeleton TSkeleton;
+
+      public:
+        itkNewMacro( Self );
+        itkTypeMacro( SkeletonReader, itk::ProcessObject );
+
+        itkGetConstMacro( FileName, std::string );
+        itkSetMacro( FileName, std::string );
+
+      public:
+        TSkeleton* GetOutput( );
+        TSkeleton* GetOutput( unsigned int i );
+
+        virtual void GraftOutput( itk::DataObject* out );
+        virtual void GraftOutput(
+          const typename Superclass::DataObjectIdentifierType& key,
+          itk::DataObject* out
+          );
+        virtual void GraftNthOutput( unsigned int i, itk::DataObject* out );
+        virtual itk::DataObject::Pointer MakeOutput(
+          itk::ProcessObject::DataObjectPointerArraySizeType i
+          ) override;
+
+        virtual void Update( ) override
+          { this->GenerateData( ); }
+
+      protected:
+        SkeletonReader( );
+        virtual ~SkeletonReader( );
+
+        virtual void GenerateData( ) override;
+
+        // Do nothing
+        virtual void GenerateOutputInformation( ) override
+          { }
+
+      private:
+        // Purposely not implemented
+        SkeletonReader( const Self& );
+        void operator=( const Self& );
+
+      protected:
+        std::string m_FileName;
+      };
+
+    } // ecapseman
+
+  } // ecapseman
+
+} // ecapseman
+
+#ifndef ITK_MANUAL_INSTANTIATION
+#  include <fpa/Common/Image/SkeletonReader.hxx>
+#endif // ITK_MANUAL_INSTANTIATION
+#endif // __fpa__Common__Image__SkeletonReader__h__
+
+// eof - $RCSfile$
similarity index 88%
rename from lib/fpa/Image/SkeletonReader.hxx
rename to lib/fpa/Common/Image/SkeletonReader.hxx
index 95e93fb217a4517e91babbbebaadf84287b5c4f8..ee886c573f79fc0420eb45bb3a14b1502ee985b1 100644 (file)
@@ -2,13 +2,12 @@
 // @author Leonardo Florez Valencia
 // @email florez-l@javeriana.edu.co
 // =========================================================================
-
-#ifndef __fpa__Image__SkeletonReader__hxx__
-#define __fpa__Image__SkeletonReader__hxx__
+#ifndef __fpa__Common__Image__SkeletonReader__hxx__
+#define __fpa__Common__Image__SkeletonReader__hxx__
 
 // -------------------------------------------------------------------------
 template< class _TSkeleton >
-_TSkeleton* fpa::Image::SkeletonReader< _TSkeleton >::
+_TSkeleton* fpa::Common::Image::SkeletonReader< _TSkeleton >::
 GetOutput( )
 {
   return(
@@ -18,7 +17,7 @@ GetOutput( )
 
 // -------------------------------------------------------------------------
 template< class _TSkeleton >
-_TSkeleton* fpa::Image::SkeletonReader< _TSkeleton >::
+_TSkeleton* fpa::Common::Image::SkeletonReader< _TSkeleton >::
 GetOutput( unsigned int i )
 {
   return(
@@ -30,7 +29,7 @@ GetOutput( unsigned int i )
 
 // -------------------------------------------------------------------------
 template< class _TSkeleton >
-void fpa::Image::SkeletonReader< _TSkeleton >::
+void fpa::Common::Image::SkeletonReader< _TSkeleton >::
 GraftOutput( itk::DataObject* out )
 {
   this->GraftNthOutput( 0, out );
@@ -38,7 +37,7 @@ GraftOutput( itk::DataObject* out )
 
 // -------------------------------------------------------------------------
 template< class _TSkeleton >
-void fpa::Image::SkeletonReader< _TSkeleton >::
+void fpa::Common::Image::SkeletonReader< _TSkeleton >::
 GraftOutput(
   const typename Superclass::DataObjectIdentifierType& key,
   itk::DataObject* out
@@ -57,7 +56,7 @@ GraftOutput(
 
 // -------------------------------------------------------------------------
 template< class _TSkeleton >
-void fpa::Image::SkeletonReader< _TSkeleton >::
+void fpa::Common::Image::SkeletonReader< _TSkeleton >::
 GraftNthOutput( unsigned int i, itk::DataObject* out )
 {
   if( i >= this->GetNumberOfIndexedOutputs( ) )
@@ -76,7 +75,7 @@ GraftNthOutput( unsigned int i, itk::DataObject* out )
 // -------------------------------------------------------------------------
 template< class _TSkeleton >
 itk::DataObject::Pointer
-fpa::Image::SkeletonReader< _TSkeleton >::
+fpa::Common::Image::SkeletonReader< _TSkeleton >::
 MakeOutput( itk::ProcessObject::DataObjectPointerArraySizeType i )
 {
   return( TSkeleton::New( ).GetPointer( ) );
@@ -84,7 +83,7 @@ MakeOutput( itk::ProcessObject::DataObjectPointerArraySizeType i )
 
 // -------------------------------------------------------------------------
 template< class _TSkeleton >
-fpa::Image::SkeletonReader< _TSkeleton >::
+fpa::Common::Image::SkeletonReader< _TSkeleton >::
 SkeletonReader( )
   : Superclass( )
 {
@@ -97,14 +96,14 @@ SkeletonReader( )
 
 // -------------------------------------------------------------------------
 template< class _TSkeleton >
-fpa::Image::SkeletonReader< _TSkeleton >::
+fpa::Common::Image::SkeletonReader< _TSkeleton >::
 ~SkeletonReader( )
 {
 }
 
 // -------------------------------------------------------------------------
 template< class _TSkeleton >
-void fpa::Image::SkeletonReader< _TSkeleton >::
+void fpa::Common::Image::SkeletonReader< _TSkeleton >::
 GenerateData( )
 {
   typedef typename TSkeleton::TPath   _TPath;
@@ -204,6 +203,6 @@ GenerateData( )
   } // rof
 }
 
-#endif // __fpa__Image__SkeletonReader__hxx__
+#endif // __fpa__Common__Image__SkeletonReader__hxx__
 
 // eof - $RCSfile$
diff --git a/lib/fpa/Common/Image/SkeletonWriter.h b/lib/fpa/Common/Image/SkeletonWriter.h
new file mode 100644 (file)
index 0000000..6348daf
--- /dev/null
@@ -0,0 +1,74 @@
+// =========================================================================
+// @author Leonardo Florez Valencia
+// @email florez-l@javeriana.edu.co
+// =========================================================================
+#ifndef __fpa__Common__Image__SkeletonWriter__h__
+#define __fpa__Common__Image__SkeletonWriter__h__
+
+#include <itkProcessObject.h>
+
+namespace fpa
+{
+  namespace Common
+  {
+    namespace Image
+    {
+      /**
+       */
+      template< class _TSkeleton >
+      class SkeletonWriter
+        : public itk::ProcessObject
+      {
+      public:
+        // Basic types
+        typedef SkeletonWriter                  Self;
+        typedef itk::ProcessObject              Superclass;
+        typedef itk::SmartPointer< Self >       Pointer;
+        typedef itk::SmartPointer< const Self > ConstPointer;
+
+        typedef _TSkeleton TSkeleton;
+        typedef typename TSkeleton::TEdges     TEdges;
+        typedef typename TSkeleton::TMatrix    TMatrix;
+        typedef typename TSkeleton::TMatrixRow TMatrixRow;
+        typedef typename TSkeleton::TPath      TPath;
+        typedef typename TSkeleton::TVertex    TVertex;
+
+      public:
+        itkNewMacro( Self );
+        itkTypeMacro( SkeletonWriter, itk::ProcessObject );
+
+        itkGetConstMacro( FileName, std::string );
+        itkSetMacro( FileName, std::string );
+
+      public:
+        const TSkeleton* GetInput( ) const;
+        void SetInput( const TSkeleton* skeleton );
+        virtual void Update( ) override;
+
+      protected:
+        SkeletonWriter( );
+        virtual ~SkeletonWriter( );
+
+        virtual void GenerateData( ) override;
+
+      private:
+        // Purposely not implemented
+        SkeletonWriter( const Self& );
+        void operator=( const Self& );
+
+      protected:
+        std::string m_FileName;
+      };
+
+    } // ecapseman
+
+  } // ecapseman
+
+} // ecapseman
+
+#ifndef ITK_MANUAL_INSTANTIATION
+#  include <fpa/Common/Image/SkeletonWriter.hxx>
+#endif // ITK_MANUAL_INSTANTIATION
+#endif // __fpa__Common__Image__SkeletonWriter__h__
+
+// eof - $RCSfile$
similarity index 89%
rename from lib/fpa/Image/SkeletonWriter.hxx
rename to lib/fpa/Common/Image/SkeletonWriter.hxx
index c277dac1979d6e7fd3e174d4e4f72d98c7b9a494..4f392ed3018601c9bdc84457e26f2180c5d4aa9c 100644 (file)
@@ -2,15 +2,14 @@
 // @author Leonardo Florez Valencia
 // @email florez-l@javeriana.edu.co
 // =========================================================================
-
-#ifndef __fpa__Image__SkeletonWriter__hxx__
-#define __fpa__Image__SkeletonWriter__hxx__
+#ifndef __fpa__Common__Image__SkeletonWriter__hxx__
+#define __fpa__Common__Image__SkeletonWriter__hxx__
 
 #include <fstream>
 
 // -------------------------------------------------------------------------
 template< class _TSkeleton >
-const _TSkeleton* fpa::Image::SkeletonWriter< _TSkeleton >::
+const _TSkeleton* fpa::Common::Image::SkeletonWriter< _TSkeleton >::
 GetInput( ) const
 {
   return(
@@ -22,7 +21,7 @@ GetInput( ) const
 
 // -------------------------------------------------------------------------
 template< class _TSkeleton >
-void fpa::Image::SkeletonWriter< _TSkeleton >::
+void fpa::Common::Image::SkeletonWriter< _TSkeleton >::
 SetInput( const _TSkeleton* skeleton )
 {
   this->itk::ProcessObject::SetNthInput(
@@ -32,7 +31,7 @@ SetInput( const _TSkeleton* skeleton )
 
 // -------------------------------------------------------------------------
 template< class _TSkeleton >
-void fpa::Image::SkeletonWriter< _TSkeleton >::
+void fpa::Common::Image::SkeletonWriter< _TSkeleton >::
 Update( )
 {
   TSkeleton* input = const_cast< TSkeleton* >( this->GetInput( ) );
@@ -48,7 +47,7 @@ Update( )
 
 // -------------------------------------------------------------------------
 template< class _TSkeleton >
-fpa::Image::SkeletonWriter< _TSkeleton >::
+fpa::Common::Image::SkeletonWriter< _TSkeleton >::
 SkeletonWriter( )
   : Superclass( ),
     m_FileName( "" )
@@ -58,14 +57,14 @@ SkeletonWriter( )
 
 // -------------------------------------------------------------------------
 template< class _TSkeleton >
-fpa::Image::SkeletonWriter< _TSkeleton >::
+fpa::Common::Image::SkeletonWriter< _TSkeleton >::
 ~SkeletonWriter( )
 {
 }
 
 // -------------------------------------------------------------------------
 template< class _TSkeleton >
-void fpa::Image::SkeletonWriter< _TSkeleton >::
+void fpa::Common::Image::SkeletonWriter< _TSkeleton >::
 GenerateData( )
 {
   const TSkeleton* sk = this->GetInput( );
@@ -157,6 +156,6 @@ GenerateData( )
   file_stream.write( out1.str( ).c_str( ), out1.str( ).size( ) );
 }
 
-#endif // __fpa__Image__SkeletonWriter__hxx__
+#endif // __fpa__Common__Image__SkeletonWriter__hxx__
 
 // eof - $RCSfile$
diff --git a/lib/fpa/Common/IncrementalMeanAndVariance.cxx b/lib/fpa/Common/IncrementalMeanAndVariance.cxx
new file mode 100644 (file)
index 0000000..ea88f03
--- /dev/null
@@ -0,0 +1,74 @@
+// =========================================================================
+// @author Leonardo Florez Valencia
+// @email florez-l@javeriana.edu.co
+// =========================================================================
+#include <fpa/Common/IncrementalMeanAndVariance.h>
+#include <cmath>
+
+// -------------------------------------------------------------------------
+fpa::Common::IncrementalMeanAndVariance::
+IncrementalMeanAndVariance( )
+{
+  this->Clear( );
+}
+
+// -------------------------------------------------------------------------
+fpa::Common::IncrementalMeanAndVariance::
+~IncrementalMeanAndVariance( )
+{
+}
+
+// -------------------------------------------------------------------------
+double fpa::Common::IncrementalMeanAndVariance::
+GetMean( ) const
+{
+  return( this->m_M );
+}
+
+// -------------------------------------------------------------------------
+double fpa::Common::IncrementalMeanAndVariance::
+GetVariance( ) const
+{
+  return( this->m_V );
+}
+
+// -------------------------------------------------------------------------
+double fpa::Common::IncrementalMeanAndVariance::
+GetDeviation( ) const
+{
+  return( std::sqrt( this->m_V ) );
+}
+
+// -------------------------------------------------------------------------
+unsigned long fpa::Common::IncrementalMeanAndVariance::
+GetNumberOfSamples( ) const
+{
+  return( ( unsigned long )( this->m_N ) );
+}
+
+// -------------------------------------------------------------------------
+void fpa::Common::IncrementalMeanAndVariance::
+Clear( )
+{
+  this->m_M = double( 0 );
+  this->m_V = double( 0 );
+  this->m_N = double( 0 );
+}
+
+// -------------------------------------------------------------------------
+void fpa::Common::IncrementalMeanAndVariance::
+AddValue( double v )
+{
+  this->m_N += double( 1 );
+  double d = v - this->m_M;
+  if( this->m_N > double( 1 ) )
+  {
+    double o = ( this->m_N - double( 2 ) ) / ( this->m_N - double( 1 ) );
+    this->m_V = ( o * this->m_V ) + ( ( d * d ) / this->m_N );
+  }
+  else
+    this->m_V = double( 0 );
+  this->m_M += d / this->m_N;
+}
+
+// eof - $RCSfile$
diff --git a/lib/fpa/Common/IncrementalMeanAndVariance.h b/lib/fpa/Common/IncrementalMeanAndVariance.h
new file mode 100644 (file)
index 0000000..83383c3
--- /dev/null
@@ -0,0 +1,44 @@
+// =========================================================================
+// @author Leonardo Florez Valencia
+// @email florez-l@javeriana.edu.co
+// =========================================================================
+#ifndef __fpa__Common__IncrementalMeanAndVariance__h__
+#define __fpa__Common__IncrementalMeanAndVariance__h__
+
+#include <fpa/fpa_export.h>
+
+namespace fpa
+{
+  namespace Common
+  {
+    /**
+     */
+    class FPA_EXPORT IncrementalMeanAndVariance
+    {
+    public:
+      typedef IncrementalMeanAndVariance Self;
+
+    public:
+      IncrementalMeanAndVariance( );
+      virtual ~IncrementalMeanAndVariance( );
+
+      double GetMean( ) const;
+      double GetVariance( ) const;
+      double GetDeviation( ) const;
+      unsigned long GetNumberOfSamples( ) const;
+
+      void Clear( );
+      void AddValue( double v );
+
+    protected:
+      double m_M;
+      double m_V;
+      double m_N;
+    };
+
+  } // ecapseman
+
+} // ecapseman
+
+#endif // __fpa__Common__IncrementalMeanAndVariance__h__
+// eof - $RCSfile$
diff --git a/lib/fpa/Common/PeakDetector.cxx b/lib/fpa/Common/PeakDetector.cxx
new file mode 100644 (file)
index 0000000..0a53e1e
--- /dev/null
@@ -0,0 +1,187 @@
+// =========================================================================
+// @author Leonardo Florez Valencia
+// @email florez-l@javeriana.edu.co
+// =========================================================================
+#include <fpa/Common/PeakDetector.h>
+#include <cmath>
+
+// -------------------------------------------------------------------------
+fpa::Common::PeakDetector::
+PeakDetector( )
+  : m_K( 3 ),
+    m_T( 3.5 ),
+    m_I( 0.5 )
+{
+}
+
+// -------------------------------------------------------------------------
+fpa::Common::PeakDetector::
+~PeakDetector( )
+{
+}
+
+// -------------------------------------------------------------------------
+unsigned long fpa::Common::PeakDetector::
+GetKernelSize( ) const
+{
+  return( this->m_K );
+}
+
+// -------------------------------------------------------------------------
+double fpa::Common::PeakDetector::
+GetThreshold( ) const
+{
+  return( this->m_T );
+}
+
+// -------------------------------------------------------------------------
+double fpa::Common::PeakDetector::
+GetInfluence( ) const
+{
+  return( this->m_I );
+}
+
+// -------------------------------------------------------------------------
+void fpa::Common::PeakDetector::
+SetKernelSize( unsigned long k )
+{
+  this->m_K = k;
+  this->Clear( );
+}
+
+// -------------------------------------------------------------------------
+void fpa::Common::PeakDetector::
+SetThreshold( double t )
+{
+  this->m_T = t;
+  this->Clear( );
+}
+
+// -------------------------------------------------------------------------
+void fpa::Common::PeakDetector::
+SetInfluence( double i )
+{
+  this->m_I = i;
+  this->Clear( );
+}
+
+// -------------------------------------------------------------------------
+void fpa::Common::PeakDetector::
+Clear( )
+{
+  this->m_X.clear( );
+  this->m_Y.clear( );
+  this->m_YF.clear( );
+  this->m_Avg.clear( );
+  this->m_STD.clear( );
+  this->m_Peaks.clear( );
+  this->m_MeanAndVar.Clear( );
+}
+
+// -------------------------------------------------------------------------
+const std::vector< double >& fpa::Common::PeakDetector::
+GetXValues( ) const
+{
+  return( this->m_X );
+}
+
+// -------------------------------------------------------------------------
+const std::vector< double >& fpa::Common::PeakDetector::
+GetYValues( ) const
+{
+  return( this->m_Y );
+}
+
+// -------------------------------------------------------------------------
+const std::vector< double >& fpa::Common::PeakDetector::
+GetFilteredYValues( ) const
+{
+  return( this->m_YF );
+}
+
+// -------------------------------------------------------------------------
+const std::vector< double >& fpa::Common::PeakDetector::
+GetAverages( ) const
+{
+  return( this->m_Avg );
+}
+
+// -------------------------------------------------------------------------
+const std::vector< double >& fpa::Common::PeakDetector::
+GetDeviations( ) const
+{
+  return( this->m_STD );
+}
+
+// -------------------------------------------------------------------------
+const std::vector< fpa::Common::PeakDetector::TPeak >& fpa::Common::
+PeakDetector::GetPeaks( ) const
+{
+  return( this->m_Peaks );
+}
+
+// -------------------------------------------------------------------------
+unsigned long fpa::Common::PeakDetector::
+GetNumberOfSamples( ) const
+{
+  return( this->m_X.size( ) );
+}
+
+// -------------------------------------------------------------------------
+fpa::Common::PeakDetector::
+TPeak fpa::Common::PeakDetector::
+AddValue( double x, double y )
+{
+  this->m_X.push_back( x );
+  this->m_Y.push_back( y );
+
+  if( this->m_YF.size( ) < this->m_K )
+  {
+    this->m_YF.push_back( y );
+    this->m_Avg.push_back( double( 0 ) );
+    this->m_STD.push_back( double( 0 ) );
+    this->m_Peaks.push_back( Self::NoPeak );
+
+    this->m_MeanAndVar.AddValue( y );
+    if( this->m_YF.size( ) == this->m_K )
+    {
+      this->m_Avg.push_back( this->m_MeanAndVar.GetMean( ) );
+      this->m_STD.push_back( this->m_MeanAndVar.GetDeviation( ) );
+
+    } // fi
+  }
+  else
+  {
+    unsigned long i = this->m_X.size( ) - 1;
+    if(
+      ( std::fabs( y - this->m_Avg[ i - 1 ] ) ) >
+      ( this->m_T * this->m_STD[ i - 1 ] )
+      )
+    {
+      this->m_Peaks.push_back(
+        ( y > this->m_Avg[ i - 1 ] )? Self::PosPeak: Self::NegPeak
+        );
+      this->m_YF.push_back(
+        ( this->m_I * y ) +
+        ( ( double( 1 ) - this->m_I ) * this->m_YF[ i - 1 ] )
+        );
+    }
+    else
+    {
+      this->m_Peaks.push_back( Self::NoPeak );
+      this->m_YF.push_back( y );
+
+    } // fi
+
+    this->m_MeanAndVar.Clear( );
+    unsigned long k = 0;
+    for( unsigned long j = i - this->m_K; j <= i; ++j, ++k )
+      this->m_MeanAndVar.AddValue( this->m_YF[ j ] );
+    this->m_Avg.push_back( this->m_MeanAndVar.GetMean( ) );
+    this->m_STD.push_back( this->m_MeanAndVar.GetDeviation( ) );
+
+  } // fi
+  return( this->m_Peaks.back( ) );
+}
+
+// eof - $RCSfile$
diff --git a/lib/fpa/Common/PeakDetector.h b/lib/fpa/Common/PeakDetector.h
new file mode 100644 (file)
index 0000000..8796cc3
--- /dev/null
@@ -0,0 +1,75 @@
+// =========================================================================
+// @author Leonardo Florez Valencia
+// @email florez-l@javeriana.edu.co
+// =========================================================================
+#ifndef __fpa__Common__PeakDetector__h__
+#define __fpa__Common__PeakDetector__h__
+
+#include <vector>
+#include <fpa/fpa_export.h>
+#include <fpa/Common/IncrementalMeanAndVariance.h>
+
+namespace fpa
+{
+  namespace Common
+  {
+    /**
+     */
+    /**
+     * https://stackoverflow.com/questions/22583391/peak-signal-detection-in-realtime-timeseries-data
+     */
+    class FPA_EXPORT PeakDetector
+    {
+    public:
+      typedef PeakDetector Self;
+
+      enum TPeak
+      {
+        NoPeak = 0,
+        PosPeak,
+        NegPeak
+      };
+
+    public:
+      PeakDetector( );
+      virtual ~PeakDetector( );
+
+      unsigned long GetKernelSize( ) const;
+      double GetThreshold( ) const;
+      double GetInfluence( ) const;
+
+      void SetKernelSize( unsigned long k );
+      void SetThreshold( double t );
+      void SetInfluence( double i );
+
+      const std::vector< double >& GetXValues( ) const;
+      const std::vector< double >& GetYValues( ) const;
+      const std::vector< double >& GetFilteredYValues( ) const;
+      const std::vector< double >& GetAverages( ) const;
+      const std::vector< double >& GetDeviations( ) const;
+      const std::vector< TPeak >& GetPeaks( ) const;
+
+      void Clear( );
+      unsigned long GetNumberOfSamples( ) const;
+      TPeak AddValue( double x, double y );
+
+    protected:
+      unsigned long m_K;
+      double m_T;
+      double m_I;
+
+      std::vector< double > m_X;
+      std::vector< double > m_Y;
+      std::vector< double > m_YF;
+      std::vector< double > m_Avg;
+      std::vector< double > m_STD;
+      std::vector< TPeak >  m_Peaks;
+      fpa::Common::IncrementalMeanAndVariance m_MeanAndVar;
+    };
+
+  } // ecapseman
+
+} // ecapseman
+
+#endif // __fpa__Common__PeakDetector__h__
+// eof - $RCSfile$
index aa7042b3675a32e0bd1fa30be62869cfff331b77..4ecc222653750b7405ee77a7096b025379457fcb 100644 (file)
@@ -2,10 +2,11 @@
 // @author Leonardo Florez Valencia
 // @email florez-l@javeriana.edu.co
 // =========================================================================
-
 #ifndef __fpa__Config__h__
 #define __fpa__Config__h__
 
+#include <itkMacro.h>
+
 #define VTK_FOUND @VTK_FOUND@
 #if VTK_FOUND == 1
 #  define USE_VTK
 #  undef USE_VTK
 #endif
 
-#define ivq_FOUND @ivq_FOUND@
-#if ivq_FOUND == 1
-#  define USE_ivq
-#else
-#  undef USE_ivq
-#endif
+// -------------------------------------------------------------------------
+#define fpaTraitsMacro( __p__, __t__ )                                  \
+  typedef __p__ __t__::TFilter         TFilter;                         \
+  typedef __p__ __t__::TMarksInterface TMarksInterface;                 \
+  typedef __p__ __t__::TSeedsInterface TSeedsInterface;                 \
+  typedef __p__ __t__::TInternalTraits::TInputValue   TInputValue;      \
+  typedef __p__ __t__::TInternalTraits::TMark         TMark;            \
+  typedef __p__ __t__::TInternalTraits::TNeighborhood TNeighborhood;    \
+  typedef __p__ __t__::TInternalTraits::TNode         TNode;            \
+  typedef __p__ __t__::TInternalTraits::TNodes        TNodes;           \
+  typedef __p__ __t__::TInternalTraits::TOutputValue  TOutputValue;     \
+  typedef __p__ __t__::TInternalTraits::TPoint        TPoint;           \
+  typedef __p__ __t__::TInternalTraits::TSeed         TSeed;            \
+  typedef __p__ __t__::TInternalTraits::TSeeds        TSeeds;           \
+  typedef __p__ __t__::TInternalTraits::TVertex       TVertex;          \
+  itkStaticConstMacro(                                                  \
+    Dimension, unsigned int, __t__::TInternalTraits::Dimension          \
+    )
 
 // -------------------------------------------------------------------------
-#define fpa_Base_TraitTypes( _traits_ )              \
-  typedef _traits_::TEvent        TEvent;            \
-  typedef _traits_::TFrontId      TFrontId;          \
-  typedef _traits_::TInputValue   TInputValue;       \
-  typedef _traits_::TNeighborhood TNeighborhood;     \
-  typedef _traits_::TNode         TNode;             \
-  typedef _traits_::TNodes        TNodes;            \
-  typedef _traits_::TOutputValue  TOutputValue;      \
-  typedef _traits_::TPoint        TPoint;            \
-  typedef _traits_::TSeed         TSeed;             \
-  typedef _traits_::TSeeds        TSeeds;            \
-  typedef _traits_::TVertex       TVertex
+#define fpaInternalTraitsMacro( __p__, __t__ )                          \
+  typedef __p__ __t__::TInputValue   TInputValue;                       \
+  typedef __p__ __t__::TMark         TMark;                             \
+  typedef __p__ __t__::TNeighborhood TNeighborhood;                     \
+  typedef __p__ __t__::TNode         TNode;                             \
+  typedef __p__ __t__::TNodes        TNodes;                            \
+  typedef __p__ __t__::TOutputValue  TOutputValue;                      \
+  typedef __p__ __t__::TPoint        TPoint;                            \
+  typedef __p__ __t__::TSeed         TSeed;                             \
+  typedef __p__ __t__::TSeeds        TSeeds;                            \
+  typedef __p__ __t__::TVertex       TVertex;                           \
+  itkStaticConstMacro( Dimension, unsigned int, __t__::Dimension )
 
-#endif // __fpa__Config__h__
+// -------------------------------------------------------------------------
+#define fpaFilterInputMacro( __n__, __t__ )                             \
+  __t__* Get##__n__( )                                                  \
+  {                                                                     \
+    return(                                                             \
+      dynamic_cast< __t__* >(                                           \
+        this->itk::ProcessObject::GetInput(                             \
+          this->m_##__n__##Idx                                          \
+          ) ) );                                                        \
+  }                                                                     \
+  const __t__* Get##__n__( ) const                                      \
+  {                                                                     \
+    return(                                                             \
+      dynamic_cast< const __t__* >(                                     \
+        this->itk::ProcessObject::GetInput(                             \
+          this->m_##__n__##Idx                                          \
+          ) ) );                                                        \
+  }                                                                     \
+  void Set##__n__( __t__* i )                                           \
+  {                                                                     \
+    this->itk::ProcessObject::SetNthInput( this->m_##__n__##Idx, i );   \
+  }
 
+// -------------------------------------------------------------------------
+#define fpaFilterInputConfigureMacro( __n__, __t__ )            \
+  this->m_##__n__##Idx = this->GetNumberOfRequiredInputs( );    \
+  this->itk::ProcessObject::SetNumberOfRequiredInputs(          \
+    this->m_##__n__##Idx + 1                                    \
+    )
+
+// -------------------------------------------------------------------------
+#define fpaFilterOutputMacro( __n__, __t__ )    \
+  __t__* Get##__n__( )                          \
+  {                                             \
+    return(                                     \
+      dynamic_cast< __t__* >(                   \
+        this->itk::ProcessObject::GetOutput(    \
+          this->m_##__n__##Idx                  \
+          ) ) );                                \
+  }                                             \
+  const __t__* Get##__n__( ) const              \
+  {                                             \
+    return(                                     \
+      dynamic_cast< const __t__* >(             \
+        this->itk::ProcessObject::GetOutput(    \
+          this->m_##__n__##Idx                  \
+          ) ) );                                \
+  }
+
+// -------------------------------------------------------------------------
+#define fpaFilterOutputConfigureMacro( __n__, __t__ )           \
+  this->m_##__n__##Idx = this->GetNumberOfRequiredOutputs( );   \
+  this->itk::ProcessObject::SetNumberOfRequiredOutputs(         \
+    this->m_##__n__##Idx + 1                                    \
+    );                                                          \
+  this->SetNthOutput( this->m_##__n__##Idx, __t__::New( ) )
+
+#endif // __fpa__Config__h__
 // eof - $RCSfile$
similarity index 96%
rename from lib/fpa/Base/Graph.h
rename to lib/fpa/DataStructures/Graph.h
index 41b2fb9973ee537734474e66c3d5beef8f97ed65..79d118bf4a065d1ed7a59c39700799ad297d5f74 100644 (file)
@@ -3,8 +3,8 @@
 // @email florez-l@javeriana.edu.co
 // =========================================================================
 
-#ifndef __fpa__Base__Graph__h__
-#define __fpa__Base__Graph__h__
+#ifndef __fpa__DataStructures__Graph__h__
+#define __fpa__DataStructures__Graph__h__
 
 #include <map>
 #include <set>
@@ -14,7 +14,7 @@
 
 namespace fpa
 {
-  namespace Base
+  namespace DataStructures
   {
     /** \brief A generic graph with templated index types.
      *
@@ -162,9 +162,8 @@ namespace fpa
 } // ecapseman
 
 #ifndef ITK_MANUAL_INSTANTIATION
-#  include <fpa/Base/Graph.hxx>
+#  include <fpa/DataStructures/Graph.hxx>
 #endif // ITK_MANUAL_INSTANTIATION
-
-#endif // __fpa__Base__Graph__h__
+#endif // __fpa__DataStructures__Graph__h__
 
 // eof - $RCSfile$
similarity index 86%
rename from lib/fpa/Base/Graph.hxx
rename to lib/fpa/DataStructures/Graph.hxx
index 03f85a802d3622e3128aa7230711af4429e3d4bf..4d348d5421d02c266cdf8513eef1f33ff8311f65 100644 (file)
@@ -2,13 +2,12 @@
 // @author Leonardo Florez Valencia
 // @email florez-l@javeriana.edu.co
 // =========================================================================
-
-#ifndef __fpa__Base__Graph__hxx__
-#define __fpa__Base__Graph__hxx__
+#ifndef __fpa__DataStructures__Graph__hxx__
+#define __fpa__DataStructures__Graph__hxx__
 
 // -------------------------------------------------------------------------
 template< class _TVertex, class _TCost, class _TIndex, class _TIndexCompare >
-void fpa::Base::Graph< _TVertex, _TCost, _TIndex, _TIndexCompare >::
+void fpa::DataStructures::Graph< _TVertex, _TCost, _TIndex, _TIndexCompare >::
 Clear( )
 {
   this->m_Vertices.clear( );
@@ -17,7 +16,7 @@ Clear( )
 
 // -------------------------------------------------------------------------
 template< class _TVertex, class _TCost, class _TIndex, class _TIndexCompare >
-bool fpa::Base::Graph< _TVertex, _TCost, _TIndex, _TIndexCompare >::
+bool fpa::DataStructures::Graph< _TVertex, _TCost, _TIndex, _TIndexCompare >::
 RenameVertex( const TIndex& old_index, const TIndex& new_index )
 {
   typename TVertices::iterator old_v = this->m_Vertices.find( old_index );
@@ -77,7 +76,7 @@ RenameVertex( const TIndex& old_index, const TIndex& new_index )
 
 // -------------------------------------------------------------------------
 template< class _TVertex, class _TCost, class _TIndex, class _TIndexCompare >
-void fpa::Base::Graph< _TVertex, _TCost, _TIndex, _TIndexCompare >::
+void fpa::DataStructures::Graph< _TVertex, _TCost, _TIndex, _TIndexCompare >::
 RemoveVertex( const TIndex& index )
 {
   typename TVertices::iterator i = this->m_Vertices.find( index );
@@ -116,9 +115,9 @@ RemoveVertex( const TIndex& index )
 // -------------------------------------------------------------------------
 template< class _TVertex, class _TCost, class _TIndex, class _TIndexCompare >
 typename
-fpa::Base::Graph< _TVertex, _TCost, _TIndex, _TIndexCompare >::
+fpa::DataStructures::Graph< _TVertex, _TCost, _TIndex, _TIndexCompare >::
 TEdges&
-fpa::Base::Graph< _TVertex, _TCost, _TIndex, _TIndexCompare >::
+fpa::DataStructures::Graph< _TVertex, _TCost, _TIndex, _TIndexCompare >::
 GetEdges( const TIndex& orig, const TIndex& dest )
 {
   static TEdges null_edges;
@@ -145,9 +144,9 @@ GetEdges( const TIndex& orig, const TIndex& dest )
 // -------------------------------------------------------------------------
 template< class _TVertex, class _TCost, class _TIndex, class _TIndexCompare >
 const typename 
-fpa::Base::Graph< _TVertex, _TCost, _TIndex, _TIndexCompare >::
+fpa::DataStructures::Graph< _TVertex, _TCost, _TIndex, _TIndexCompare >::
 TEdges&
-fpa::Base::Graph< _TVertex, _TCost, _TIndex, _TIndexCompare >::
+fpa::DataStructures::Graph< _TVertex, _TCost, _TIndex, _TIndexCompare >::
 GetEdges( const TIndex& orig, const TIndex& dest ) const
 {
   static const TEdges null_edges;
@@ -166,7 +165,7 @@ GetEdges( const TIndex& orig, const TIndex& dest ) const
 
 // -------------------------------------------------------------------------
 template< class _TVertex, class _TCost, class _TIndex, class _TIndexCompare >
-bool fpa::Base::Graph< _TVertex, _TCost, _TIndex, _TIndexCompare >::
+bool fpa::DataStructures::Graph< _TVertex, _TCost, _TIndex, _TIndexCompare >::
 HasEdge( const TIndex& orig, const TIndex& dest ) const
 {
   typename TMatrix::const_iterator mIt = this->m_Matrix.find( orig );
@@ -178,7 +177,7 @@ HasEdge( const TIndex& orig, const TIndex& dest ) const
 
 // -------------------------------------------------------------------------
 template< class _TVertex, class _TCost, class _TIndex, class _TIndexCompare >
-void fpa::Base::Graph< _TVertex, _TCost, _TIndex, _TIndexCompare >::
+void fpa::DataStructures::Graph< _TVertex, _TCost, _TIndex, _TIndexCompare >::
 RemoveEdge( const TIndex& orig, const TIndex& dest, const TCost& cost )
 {
   typename TMatrix::iterator m = this->m_Matrix.find( orig );
@@ -215,7 +214,7 @@ RemoveEdge( const TIndex& orig, const TIndex& dest, const TCost& cost )
 
 // -------------------------------------------------------------------------
 template< class _TVertex, class _TCost, class _TIndex, class _TIndexCompare >
-void fpa::Base::Graph< _TVertex, _TCost, _TIndex, _TIndexCompare >::
+void fpa::DataStructures::Graph< _TVertex, _TCost, _TIndex, _TIndexCompare >::
 RemoveEdges( const TIndex& orig, const TIndex& dest )
 {
   typename TMatrix::iterator m = this->m_Matrix.find( orig );
@@ -237,7 +236,7 @@ RemoveEdges( const TIndex& orig, const TIndex& dest )
 // -------------------------------------------------------------------------
 template< class _TVertex, class _TCost, class _TIndex, class _TIndexCompare >
 std::set< _TIndex, _TIndexCompare >
-fpa::Base::Graph< _TVertex, _TCost, _TIndex, _TIndexCompare >::
+fpa::DataStructures::Graph< _TVertex, _TCost, _TIndex, _TIndexCompare >::
 GetSinks( ) const
 {
   std::set< _TIndex, _TIndexCompare > sinks;
@@ -254,7 +253,7 @@ GetSinks( ) const
 
 // -------------------------------------------------------------------------
 template< class _TVertex, class _TCost, class _TIndex, class _TIndexCompare >
-fpa::Base::Graph< _TVertex, _TCost, _TIndex, _TIndexCompare >::
+fpa::DataStructures::Graph< _TVertex, _TCost, _TIndex, _TIndexCompare >::
 Graph( )
   : Superclass( )
 {
@@ -262,11 +261,10 @@ Graph( )
 
 // -------------------------------------------------------------------------
 template< class _TVertex, class _TCost, class _TIndex, class _TIndexCompare >
-fpa::Base::Graph< _TVertex, _TCost, _TIndex, _TIndexCompare >::
+fpa::DataStructures::Graph< _TVertex, _TCost, _TIndex, _TIndexCompare >::
 ~Graph( )
 {
 }
 
-#endif // __fpa__Base__Graph__hxx__
-
+#endif // __fpa__DataStructures__Graph__hxx__
 // eof - $RCSfile$
diff --git a/lib/fpa/DataStructures/Image/MinimumSpanningTree.h b/lib/fpa/DataStructures/Image/MinimumSpanningTree.h
new file mode 100644 (file)
index 0000000..0c5a050
--- /dev/null
@@ -0,0 +1,80 @@
+// =========================================================================
+// @author Leonardo Florez Valencia
+// @email florez-l@javeriana.edu.co
+// =========================================================================
+#ifndef __fpa__DataStructures__Image__MinimumSpanningTree__h__
+#define __fpa__DataStructures__Image__MinimumSpanningTree__h__
+
+#include <fpa/DataStructures/MinimumSpanningTree.h>
+#include <itkImage.h>
+#include <fpa/DataStructures/Image/PolyLineParametricPath.h>
+
+namespace fpa
+{
+  namespace DataStructures
+  {
+    namespace Image
+    {
+      /**
+       */
+      template< unsigned int _VDim >
+      class MinimumSpanningTree
+        : public fpa::DataStructures::MinimumSpanningTree< itk::Index< _VDim >, itk::Image< itk::Offset< _VDim >, _VDim > >
+      {
+      public:
+        typedef itk::Index< _VDim > TVertex;
+        typedef itk::Image< itk::Offset< _VDim >, _VDim > TDataStructuresImage;
+
+        typedef MinimumSpanningTree             Self;
+        typedef itk::SmartPointer< Self >       Pointer;
+        typedef itk::SmartPointer< const Self > ConstPointer;
+        typedef fpa::DataStructures::MinimumSpanningTree< TVertex, TDataStructuresImage > Superclass;
+
+        typedef typename Superclass::TCollision     TCollision;
+        typedef typename Superclass::TCollisionsRow TCollisionsRow;
+        typedef typename Superclass::TCollisions    TCollisions;
+        typedef typename Superclass::TVertices      TVertices;
+
+        typedef fpa::DataStructures::Image::PolyLineParametricPath< _VDim > TPolyLineParametricPath;
+
+      public:
+        itkNewMacro( Self );
+        itkTypeMacro(
+          fpa::DataStructures::Image::MinimumSpanningTree,
+          fpa::DataStructures::MinimumSpanningTree
+          );
+
+      public:
+        virtual TVertex GetParent( const TVertex& v ) const override;
+        virtual void SetParent( const TVertex& v, const TVertex& p ) override;
+
+        void GetPolyLineParametricPath(
+          typename TPolyLineParametricPath::Pointer& path,
+          const TVertex& a
+          ) const;
+        void GetPolyLineParametricPath(
+          typename TPolyLineParametricPath::Pointer& path,
+          const TVertex& a, const TVertex& b
+          ) const;
+
+      protected:
+        MinimumSpanningTree( );
+        virtual ~MinimumSpanningTree( );
+
+      private:
+        MinimumSpanningTree( const Self& other );
+        Self& operator=( const Self& other );
+      };
+
+    } // ecapseman
+
+  } // ecapseman
+
+} // ecapseman
+
+#ifndef ITK_MANUAL_INSTANTIATION
+#  include <fpa/DataStructures/Image/MinimumSpanningTree.hxx>
+#endif // ITK_MANUAL_INSTANTIATION
+#endif // __fpa__DataStructures__Image__MinimumSpanningTree__h__
+
+// eof - $RCSfile$
similarity index 74%
rename from lib/fpa/Image/MinimumSpanningTree.hxx
rename to lib/fpa/DataStructures/Image/MinimumSpanningTree.hxx
index 9bd70838ae2066f8a214fbb645eedaeb2edb4dfa..3cba74caef3af8ea0c5b847c7245d9cd9fee2c85 100644 (file)
@@ -2,14 +2,13 @@
 // @author Leonardo Florez Valencia
 // @email florez-l@javeriana.edu.co
 // =========================================================================
-
-#ifndef __fpa__Image__MinimumSpanningTree__hxx__
-#define __fpa__Image__MinimumSpanningTree__hxx__
+#ifndef __fpa__DataStructures__Image__MinimumSpanningTree__hxx__
+#define __fpa__DataStructures__Image__MinimumSpanningTree__hxx__
 
 // -------------------------------------------------------------------------
 template< unsigned int _VDim >
-typename fpa::Image::MinimumSpanningTree< _VDim >::
-TVertex fpa::Image::MinimumSpanningTree< _VDim >::
+typename fpa::DataStructures::Image::MinimumSpanningTree< _VDim >::
+TVertex fpa::DataStructures::Image::MinimumSpanningTree< _VDim >::
 GetParent( const TVertex& v ) const
 {
   return( v + this->GetPixel( v ) );
@@ -17,7 +16,7 @@ GetParent( const TVertex& v ) const
 
 // -------------------------------------------------------------------------
 template< unsigned int _VDim >
-void fpa::Image::MinimumSpanningTree< _VDim >::
+void fpa::DataStructures::Image::MinimumSpanningTree< _VDim >::
 SetParent( const TVertex& v, const TVertex& p )
 {
   this->SetPixel( v, p - v );
@@ -25,7 +24,7 @@ SetParent( const TVertex& v, const TVertex& p )
 
 // -------------------------------------------------------------------------
 template< unsigned int _VDim >
-void fpa::Image::MinimumSpanningTree< _VDim >::
+void fpa::DataStructures::Image::MinimumSpanningTree< _VDim >::
 GetPolyLineParametricPath(
   typename TPolyLineParametricPath::Pointer& path,
   const TVertex& a
@@ -42,7 +41,7 @@ GetPolyLineParametricPath(
 
 // -------------------------------------------------------------------------
 template< unsigned int _VDim >
-void fpa::Image::MinimumSpanningTree< _VDim >::
+void fpa::DataStructures::Image::MinimumSpanningTree< _VDim >::
 GetPolyLineParametricPath(
   typename TPolyLineParametricPath::Pointer& path,
   const TVertex& a, const TVertex& b
@@ -59,7 +58,7 @@ GetPolyLineParametricPath(
 
 // -------------------------------------------------------------------------
 template< unsigned int _VDim >
-fpa::Image::MinimumSpanningTree< _VDim >::
+fpa::DataStructures::Image::MinimumSpanningTree< _VDim >::
 MinimumSpanningTree( )
   : Superclass( )
 {
@@ -67,11 +66,10 @@ MinimumSpanningTree( )
 
 // -------------------------------------------------------------------------
 template< unsigned int _VDim >
-fpa::Image::MinimumSpanningTree< _VDim >::
+fpa::DataStructures::Image::MinimumSpanningTree< _VDim >::
 ~MinimumSpanningTree( )
 {
 }
 
-#endif // __fpa__Image__MinimumSpanningTree__hxx__
-
+#endif // __fpa__DataStructures__Image__MinimumSpanningTree__hxx__
 // eof - $RCSfile$
diff --git a/lib/fpa/DataStructures/Image/PolyLineParametricPath.h b/lib/fpa/DataStructures/Image/PolyLineParametricPath.h
new file mode 100644 (file)
index 0000000..c069e7a
--- /dev/null
@@ -0,0 +1,104 @@
+// =========================================================================
+// @author Leonardo Florez Valencia
+// @email florez-l@javeriana.edu.co
+// =========================================================================
+#ifndef __fpa__DataStructures__Image__PolyLineParametricPath__h__
+#define __fpa__DataStructures__Image__PolyLineParametricPath__h__
+
+#include <itkPolyLineParametricPath.h>
+#include <itkImageBase.h>
+
+namespace fpa
+{
+  namespace DataStructures
+  {
+    namespace Image
+    {
+      /**
+       */
+      template< unsigned int _VDim >
+      class PolyLineParametricPath
+        : public itk::PolyLineParametricPath< _VDim >
+      {
+      public:
+        typedef PolyLineParametricPath               Self;
+        typedef itk::PolyLineParametricPath< _VDim > Superclass;
+        typedef itk::SmartPointer< Self >            Pointer;
+        typedef itk::SmartPointer< const Self >      ConstPointer;
+
+        itkStaticConstMacro( Dimension, unsigned int, _VDim );
+
+        typedef itk::ImageBase< _VDim >                  TImageBase;
+        typedef typename TImageBase::SpacingType         TSpacing;
+        typedef typename TImageBase::PointType           TPoint;
+        typedef typename TImageBase::DirectionType       TDirection;
+        typedef typename Superclass::ContinuousIndexType TContinuousIndex;
+        typedef typename TContinuousIndex::IndexType     TIndex;
+
+      public:
+        itkNewMacro( Self );
+        itkTypeMacro( PolyLineParametricPath, itk::PolyLineParametricPath );
+
+        itkGetConstReferenceMacro( Spacing, TSpacing );
+        itkGetConstReferenceMacro( Origin, TPoint );
+        itkGetConstReferenceMacro( Direction, TDirection );
+        itkGetConstReferenceMacro( InverseDirection, TDirection );
+
+        itkSetMacro( Origin, TPoint );
+
+      public:
+        unsigned long GetSize( ) const;
+        TContinuousIndex GetContinuousVertex( unsigned long i ) const;
+        TIndex GetVertex( unsigned long i ) const;
+        TPoint GetPoint( unsigned long i ) const;
+
+        virtual void SetSpacing( const TSpacing& spac );
+        virtual void SetSpacing( const double spac[ _VDim ] );
+        virtual void SetSpacing( const float spac[ _VDim ] );
+        virtual void SetOrigin( const double ori[ _VDim ] );
+        virtual void SetOrigin( const float ori[ _VDim ] );
+        virtual void SetDirection( const TDirection& dir );
+
+        template< class _TRefImage >
+        inline void SetReferenceImage( const _TRefImage* image )
+          {
+            this->SetSpacing( image->GetSpacing( ) );
+            this->SetOrigin( image->GetOrigin( ) );
+            this->SetDirection( image->GetDirection( ) );
+          }
+
+        virtual void Graft( itk::DataObject* o );
+
+      protected:
+        PolyLineParametricPath( );
+        virtual ~PolyLineParametricPath( );
+
+        virtual void _ComputeIndexToPhysicalPointMatrices( );
+
+      private:
+        // Purposely not implemented
+        PolyLineParametricPath( const Self& other );
+        Self& operator=( const Self& other );
+
+      protected:
+        TSpacing   m_Spacing;
+        TPoint     m_Origin;
+        TDirection m_Direction;
+        TDirection m_InverseDirection;
+        TDirection m_IndexToPhysicalPoint;
+        TDirection m_PhysicalPointToIndex;
+      };
+
+    } // ecapseman
+
+  } // ecapseman
+
+} // ecapseman
+
+#ifndef ITK_MANUAL_INSTANTIATION
+#  include <fpa/DataStructures/Image/PolyLineParametricPath.hxx>
+#endif // ITK_MANUAL_INSTANTIATION
+
+#endif // __fpa__DataStructures__Image__PolyLineParametricPath__h__
+
+// eof - $RCSfile$
similarity index 80%
rename from lib/fpa/Image/PolyLineParametricPath.hxx
rename to lib/fpa/DataStructures/Image/PolyLineParametricPath.hxx
index 3093a997c60a8fc8fe7873c9416b4e39dd51d95c..c24e85346bc7ea786f3a3568483d61bcce8d8bca 100644 (file)
@@ -3,15 +3,15 @@
 // @email florez-l@javeriana.edu.co
 // =========================================================================
 
-#ifndef __fpa__Image__PolyLineParametricPath__hxx__
-#define __fpa__Image__PolyLineParametricPath__hxx__
+#ifndef __fpa__DataStructures__Image__PolyLineParametricPath__hxx__
+#define __fpa__DataStructures__Image__PolyLineParametricPath__hxx__
 
 #include <itkMath.h>
 #include <itkNumericTraits.h>
 
 // -------------------------------------------------------------------------
 template< unsigned int _VDim >
-unsigned long fpa::Image::PolyLineParametricPath< _VDim >::
+unsigned long fpa::DataStructures::Image::PolyLineParametricPath< _VDim >::
 GetSize( ) const
 {
   return( this->GetVertexList( )->Size( ) );
@@ -19,9 +19,9 @@ GetSize( ) const
 
 // -------------------------------------------------------------------------
 template< unsigned int _VDim >
-typename fpa::Image::PolyLineParametricPath< _VDim >::
+typename fpa::DataStructures::Image::PolyLineParametricPath< _VDim >::
 TContinuousIndex
-fpa::Image::PolyLineParametricPath< _VDim >::
+fpa::DataStructures::Image::PolyLineParametricPath< _VDim >::
 GetContinuousVertex( unsigned long i ) const
 {
   return( this->GetVertexList( )->GetElement( i ) );
@@ -29,8 +29,8 @@ GetContinuousVertex( unsigned long i ) const
 
 // -------------------------------------------------------------------------
 template< unsigned int _VDim >
-typename fpa::Image::PolyLineParametricPath< _VDim >::
-TIndex fpa::Image::PolyLineParametricPath< _VDim >::
+typename fpa::DataStructures::Image::PolyLineParametricPath< _VDim >::
+TIndex fpa::DataStructures::Image::PolyLineParametricPath< _VDim >::
 GetVertex( unsigned long i ) const
 {
   TContinuousIndex cidx = this->GetContinuousVertex( i );
@@ -42,8 +42,8 @@ GetVertex( unsigned long i ) const
 
 // -------------------------------------------------------------------------
 template< unsigned int _VDim >
-typename fpa::Image::PolyLineParametricPath< _VDim >::
-TPoint fpa::Image::PolyLineParametricPath< _VDim >::
+typename fpa::DataStructures::Image::PolyLineParametricPath< _VDim >::
+TPoint fpa::DataStructures::Image::PolyLineParametricPath< _VDim >::
 GetPoint( unsigned long i ) const
 {
   typedef typename TPoint::CoordRepType _TCoordRep;
@@ -62,7 +62,7 @@ GetPoint( unsigned long i ) const
 
 // -------------------------------------------------------------------------
 template< unsigned int _VDim >
-void fpa::Image::PolyLineParametricPath< _VDim >::
+void fpa::DataStructures::Image::PolyLineParametricPath< _VDim >::
 SetSpacing( const TSpacing& spac )
 {
   if( this->m_Spacing != spac )
@@ -76,7 +76,7 @@ SetSpacing( const TSpacing& spac )
 
 // -------------------------------------------------------------------------
 template< unsigned int _VDim >
-void fpa::Image::PolyLineParametricPath< _VDim >::
+void fpa::DataStructures::Image::PolyLineParametricPath< _VDim >::
 SetSpacing( const double spac[ _VDim ] )
 {
   this->SetSpacing( TSpacing( spac ) );
@@ -84,7 +84,7 @@ SetSpacing( const double spac[ _VDim ] )
 
 // -------------------------------------------------------------------------
 template< unsigned int _VDim >
-void fpa::Image::PolyLineParametricPath< _VDim >::
+void fpa::DataStructures::Image::PolyLineParametricPath< _VDim >::
 SetSpacing( const float spac[ _VDim ] )
 {
   TSpacing s;
@@ -95,7 +95,7 @@ SetSpacing( const float spac[ _VDim ] )
 
 // -------------------------------------------------------------------------
 template< unsigned int _VDim >
-void fpa::Image::PolyLineParametricPath< _VDim >::
+void fpa::DataStructures::Image::PolyLineParametricPath< _VDim >::
 SetOrigin( const double ori[ _VDim ] )
 {
   this->SetOrigin( TPoint( ori ) );
@@ -103,7 +103,7 @@ SetOrigin( const double ori[ _VDim ] )
 
 // -------------------------------------------------------------------------
 template< unsigned int _VDim >
-void fpa::Image::PolyLineParametricPath< _VDim >::
+void fpa::DataStructures::Image::PolyLineParametricPath< _VDim >::
 SetOrigin( const float ori[ _VDim ] )
 {
   this->SetOrigin( TPoint( ori ) );
@@ -111,7 +111,7 @@ SetOrigin( const float ori[ _VDim ] )
 
 // -------------------------------------------------------------------------
 template< unsigned int _VDim >
-void fpa::Image::PolyLineParametricPath< _VDim >::
+void fpa::DataStructures::Image::PolyLineParametricPath< _VDim >::
 SetDirection( const TDirection& dir )
 {
   bool modified = false;
@@ -143,7 +143,7 @@ SetDirection( const TDirection& dir )
 
 // -------------------------------------------------------------------------
 template< unsigned int _VDim >
-void fpa::Image::PolyLineParametricPath< _VDim >::
+void fpa::DataStructures::Image::PolyLineParametricPath< _VDim >::
 Graft( itk::DataObject* o )
 {
   this->Superclass::Graft( o );
@@ -166,7 +166,7 @@ Graft( itk::DataObject* o )
 
 // -------------------------------------------------------------------------
 template< unsigned int _VDim >
-fpa::Image::PolyLineParametricPath< _VDim >::
+fpa::DataStructures::Image::PolyLineParametricPath< _VDim >::
 PolyLineParametricPath( )
   : Superclass( )
 {
@@ -180,14 +180,14 @@ PolyLineParametricPath( )
 
 // -------------------------------------------------------------------------
 template< unsigned int _VDim >
-fpa::Image::PolyLineParametricPath< _VDim >::
+fpa::DataStructures::Image::PolyLineParametricPath< _VDim >::
 ~PolyLineParametricPath( )
 {
 }
 
 // -------------------------------------------------------------------------
 template< unsigned int _VDim >
-void fpa::Image::PolyLineParametricPath< _VDim >::
+void fpa::DataStructures::Image::PolyLineParametricPath< _VDim >::
 _ComputeIndexToPhysicalPointMatrices( )
 {
   TDirection scale;
@@ -212,6 +212,5 @@ _ComputeIndexToPhysicalPointMatrices( )
   this->Modified( );
 }
 
-#endif // __fpa__Image__PolyLineParametricPath__hxx__
-
+#endif // __fpa__DataStructures__Image__PolyLineParametricPath__hxx__
 // eof - $RCSfile$
diff --git a/lib/fpa/DataStructures/Image/Skeleton.h b/lib/fpa/DataStructures/Image/Skeleton.h
new file mode 100644 (file)
index 0000000..6fbb33d
--- /dev/null
@@ -0,0 +1,70 @@
+// =========================================================================
+// @author Leonardo Florez Valencia
+// @email florez-l@javeriana.edu.co
+// =========================================================================
+
+#ifndef __fpa__DataStructures__Image__Skeleton__h__
+#define __fpa__DataStructures__Image__Skeleton__h__
+
+#include <vector>
+#include <fpa/DataStructures/Graph.h>
+#include <fpa/DataStructures/Image/PolyLineParametricPath.h>
+
+namespace fpa
+{
+  namespace DataStructures
+  {
+    namespace Image
+    {
+      /**
+       */
+      template< unsigned int _VDim >
+      class Skeleton
+        : public fpa::DataStructures::Graph< typename fpa::DataStructures::Image::PolyLineParametricPath< _VDim >::TIndex, typename fpa::DataStructures::Image::PolyLineParametricPath< _VDim >::Pointer, typename fpa::DataStructures::Image::PolyLineParametricPath< _VDim >::TIndex, typename fpa::DataStructures::Image::PolyLineParametricPath< _VDim >::TIndex::LexicographicCompare >
+      {
+      public:
+        typedef fpa::DataStructures::Image::PolyLineParametricPath< _VDim > TPath;
+        typedef typename TPath::TIndex                TIndex;
+        typedef typename TIndex::LexicographicCompare TIndexCompare;
+        typedef typename TPath::Pointer               TPathPointer;
+
+        itkStaticConstMacro( Dimension, unsigned int, _VDim );
+
+        typedef fpa::DataStructures::Graph< TIndex, TPathPointer, TIndex, TIndexCompare > Superclass;
+        typedef Skeleton                        Self;
+        typedef itk::SmartPointer< Self >       Pointer;
+        typedef itk::SmartPointer< const Self > ConstPointer;
+
+      public:
+        itkNewMacro( Self );
+        itkTypeMacro( Skeleton, fpa::Image::Graph );
+
+      public:
+        void AddBranch( TPath* path );
+        const TPath* GetBranch( const TIndex& a, const TIndex& b ) const;
+
+        std::vector< TIndex > GetEndPoints( ) const;
+        std::vector< TIndex > GetBifurcations( ) const;
+
+      protected:
+        Skeleton( );
+        virtual ~Skeleton( );
+
+      private:
+        // Purposely not implemented
+        Skeleton( const Self& other );
+        Self& operator=( const Self& other );
+      };
+
+    } // ecapseman
+
+  } // ecapseman
+
+} // ecapseman
+
+#ifndef ITK_MANUAL_INSTANTIATION
+#  include <fpa/DataStructures/Image/Skeleton.hxx>
+#endif // ITK_MANUAL_INSTANTIATION
+#endif // __fpa__DataStructures__Image__Skeleton__h__
+
+// eof - $RCSfile$
similarity index 76%
rename from lib/fpa/Image/Skeleton.hxx
rename to lib/fpa/DataStructures/Image/Skeleton.hxx
index 57a418441cd9505fb0cf45bf1752eb80cda27040..c3316da357501a55042f9f922557b39f177aaeea 100644 (file)
@@ -2,13 +2,12 @@
 // @author Leonardo Florez Valencia
 // @email florez-l@javeriana.edu.co
 // =========================================================================
-
-#ifndef __fpa__Image__Skeleton__hxx__
-#define __fpa__Image__Skeleton__hxx__
+#ifndef __fpa__DataStructures__Image__Skeleton__hxx__
+#define __fpa__DataStructures__Image__Skeleton__hxx__
 
 // -------------------------------------------------------------------------
 template< unsigned int _VDim >
-void fpa::Image::Skeleton< _VDim >::
+void fpa::DataStructures::Image::Skeleton< _VDim >::
 AddBranch( TPath* path )
 {
   // Check inputs
@@ -32,8 +31,8 @@ AddBranch( TPath* path )
 
 // -------------------------------------------------------------------------
 template< unsigned int _VDim >
-const typename fpa::Image::Skeleton< _VDim >::
-TPath* fpa::Image::Skeleton< _VDim >::
+const typename fpa::DataStructures::Image::Skeleton< _VDim >::
+TPath* fpa::DataStructures::Image::Skeleton< _VDim >::
 GetBranch( const TIndex& a, const TIndex& b ) const
 {
   static const TPath* null_path = NULL;
@@ -45,8 +44,8 @@ GetBranch( const TIndex& a, const TIndex& b ) const
 
 // -------------------------------------------------------------------------
 template< unsigned int _VDim >
-std::vector< typename fpa::Image::Skeleton< _VDim >::TIndex >
-fpa::Image::Skeleton< _VDim >::
+std::vector< typename fpa::DataStructures::Image::Skeleton< _VDim >::TIndex >
+fpa::DataStructures::Image::Skeleton< _VDim >::
 GetEndPoints( ) const
 {
   std::vector< TIndex > res;
@@ -63,8 +62,8 @@ GetEndPoints( ) const
 
 // -------------------------------------------------------------------------
 template< unsigned int _VDim >
-std::vector< typename fpa::Image::Skeleton< _VDim >::TIndex >
-fpa::Image::Skeleton< _VDim >::
+std::vector< typename fpa::DataStructures::Image::Skeleton< _VDim >::TIndex >
+fpa::DataStructures::Image::Skeleton< _VDim >::
 GetBifurcations( ) const
 {
   std::vector< TIndex > res;
@@ -81,7 +80,7 @@ GetBifurcations( ) const
 
 // -------------------------------------------------------------------------
 template< unsigned int _VDim >
-fpa::Image::Skeleton< _VDim >::
+fpa::DataStructures::Image::Skeleton< _VDim >::
 Skeleton( )
   : Superclass( )
 {
@@ -89,11 +88,11 @@ Skeleton( )
 
 // -------------------------------------------------------------------------
 template< unsigned int _VDim >
-fpa::Image::Skeleton< _VDim >::
+fpa::DataStructures::Image::Skeleton< _VDim >::
 ~Skeleton( )
 {
 }
 
-#endif // __fpa__Image__Skeleton__hxx__
+#endif // __fpa__DataStructures__Image__Skeleton__hxx__
 
 // eof - $RCSfile$
similarity index 88%
rename from lib/fpa/Base/MinimumSpanningTree.h
rename to lib/fpa/DataStructures/MinimumSpanningTree.h
index 35cb6e4c0488616d700ab6c49547f93e146910a6..475ecdd061d1a2a2043535306f3058faa8daac44 100644 (file)
@@ -2,15 +2,14 @@
 // @author Leonardo Florez Valencia
 // @email florez-l@javeriana.edu.co
 // =========================================================================
-
-#ifndef __fpa__Base__MinimumSpanningTree__h__
-#define __fpa__Base__MinimumSpanningTree__h__
+#ifndef __fpa__DataStructures__MinimumSpanningTree__h__
+#define __fpa__DataStructures__MinimumSpanningTree__h__
 
 #include <vector>
 
 namespace fpa
 {
-  namespace Base
+  namespace DataStructures
   {
     /**
      */
@@ -69,9 +68,8 @@ namespace fpa
 } // ecapseman
 
 #ifndef ITK_MANUAL_INSTANTIATION
-#  include <fpa/Base/MinimumSpanningTree.hxx>
+#  include <fpa/DataStructures/MinimumSpanningTree.hxx>
 #endif // ITK_MANUAL_INSTANTIATION
-
-#endif // __fpa__Base__MinimumSpanningTree__h__
+#endif // __fpa__DataStructures__MinimumSpanningTree__h__
 
 // eof - $RCSfile$
similarity index 85%
rename from lib/fpa/Base/MinimumSpanningTree.hxx
rename to lib/fpa/DataStructures/MinimumSpanningTree.hxx
index d04cd361cd087a70db9368c07aa9330c2a12b1f7..5eecf290918cb143354f003ad85b999f85408d4f 100644 (file)
@@ -2,14 +2,13 @@
 // @author Leonardo Florez Valencia
 // @email florez-l@javeriana.edu.co
 // =========================================================================
-
-#ifndef __fpa__Base__MinimumSpanningTree__hxx__
-#define __fpa__Base__MinimumSpanningTree__hxx__
+#ifndef __fpa__DataStructures__MinimumSpanningTree__hxx__
+#define __fpa__DataStructures__MinimumSpanningTree__hxx__
 
 // -------------------------------------------------------------------------
 template< class _TVertex, class _Superclass >
-const typename fpa::Base::MinimumSpanningTree< _TVertex, _Superclass >::
-TCollisions& fpa::Base::MinimumSpanningTree< _TVertex, _Superclass >::
+const typename fpa::DataStructures::MinimumSpanningTree< _TVertex, _Superclass >::
+TCollisions& fpa::DataStructures::MinimumSpanningTree< _TVertex, _Superclass >::
 GetCollisions( ) const
 {
   return( this->m_Collisions );
@@ -17,7 +16,7 @@ GetCollisions( ) const
 
 // -------------------------------------------------------------------------
 template< class _TVertex, class _Superclass >
-void fpa::Base::MinimumSpanningTree< _TVertex, _Superclass >::
+void fpa::DataStructures::MinimumSpanningTree< _TVertex, _Superclass >::
 SetCollisions( const TCollisions& collisions )
 {
   static const unsigned long _inf =
@@ -82,7 +81,7 @@ SetCollisions( const TCollisions& collisions )
 
 // -------------------------------------------------------------------------
 template< class _TVertex, class _Superclass >
-void fpa::Base::MinimumSpanningTree< _TVertex, _Superclass >::
+void fpa::DataStructures::MinimumSpanningTree< _TVertex, _Superclass >::
 ClearSeeds( )
 {
   this->m_Seeds.clear( );
@@ -91,7 +90,7 @@ ClearSeeds( )
 
 // -------------------------------------------------------------------------
 template< class _TVertex, class _Superclass >
-void fpa::Base::MinimumSpanningTree< _TVertex, _Superclass >::
+void fpa::DataStructures::MinimumSpanningTree< _TVertex, _Superclass >::
 AddSeed( const _TVertex& seed )
 {
   this->m_Seeds.push_back( seed );
@@ -100,8 +99,8 @@ AddSeed( const _TVertex& seed )
 
 // -------------------------------------------------------------------------
 template< class _TVertex, class _Superclass >
-typename fpa::Base::MinimumSpanningTree< _TVertex, _Superclass >::
-TVertices fpa::Base::MinimumSpanningTree< _TVertex, _Superclass >::
+typename fpa::DataStructures::MinimumSpanningTree< _TVertex, _Superclass >::
+TVertices fpa::DataStructures::MinimumSpanningTree< _TVertex, _Superclass >::
 GetPath( const _TVertex& a ) const
 {
   TVertices vertices;
@@ -120,8 +119,8 @@ GetPath( const _TVertex& a ) const
 
 // -------------------------------------------------------------------------
 template< class _TVertex, class _Superclass >
-typename fpa::Base::MinimumSpanningTree< _TVertex, _Superclass >::
-TVertices fpa::Base::MinimumSpanningTree< _TVertex, _Superclass >::
+typename fpa::DataStructures::MinimumSpanningTree< _TVertex, _Superclass >::
+TVertices fpa::DataStructures::MinimumSpanningTree< _TVertex, _Superclass >::
 GetPath( const _TVertex& a, const _TVertex& b ) const
 {
   static const unsigned long _inf =
@@ -219,7 +218,7 @@ GetPath( const _TVertex& a, const _TVertex& b ) const
 
 // -------------------------------------------------------------------------
 template< class _TVertex, class _Superclass >
-fpa::Base::MinimumSpanningTree< _TVertex, _Superclass >::
+fpa::DataStructures::MinimumSpanningTree< _TVertex, _Superclass >::
 MinimumSpanningTree( )
   : Superclass( )
 {
@@ -227,11 +226,10 @@ MinimumSpanningTree( )
 
 // -------------------------------------------------------------------------
 template< class _TVertex, class _Superclass >
-fpa::Base::MinimumSpanningTree< _TVertex, _Superclass >::
+fpa::DataStructures::MinimumSpanningTree< _TVertex, _Superclass >::
 ~MinimumSpanningTree( )
 {
 }
 
-#endif // __fpa__Base__MinimumSpanningTree__hxx__
-
+#endif // __fpa__DataStructures__MinimumSpanningTree__hxx__
 // eof - $RCSfile$
similarity index 55%
rename from lib/fpa/Base/Algorithm.h
rename to lib/fpa/Filters/Algorithm.h
index 051d61b346b6ded0ca6fc192473059c826a9b23e..f0a6cfba26d579a942cbc697da92fc32f78236d0 100644 (file)
@@ -2,43 +2,45 @@
 // @author Leonardo Florez Valencia
 // @email florez-l@javeriana.edu.co
 // =========================================================================
+#ifndef __fpa__Filters__Algorithm__h__
+#define __fpa__Filters__Algorithm__h__
 
-#ifndef __fpa__Base__Algorithm__h__
-#define __fpa__Base__Algorithm__h__
-
-#include <fpa/Config.h>
+#include <set>
 #include <itkConceptChecking.h>
-#include <itkObject.h>
+#include <fpa/Config.h>
+#include <fpa/Filters/Event.h>
 
 namespace fpa
 {
-  namespace Base
+  namespace Filters
   {
     /**
      */
-    template< class _TFilter, class _TMarks, class _TSeeds >
+    template< class _TTraits >
     class Algorithm
-      : public _TFilter, public _TMarks, public _TSeeds
+      : public _TTraits::TFilter,
+        public _TTraits::TMarksInterface,
+        public _TTraits::TSeedsInterface
     {
     public:
-      typedef _TMarks                         TMarksInterface;
-      typedef _TSeeds                         TSeedsInterface;
-      typedef _TFilter                        Superclass;
+      typedef _TTraits TTraits;
+      fpaTraitsMacro( typename, TTraits );
+
+      typedef TFilter                         Superclass;
       typedef Algorithm                       Self;
       typedef itk::SmartPointer< Self >       Pointer;
       typedef itk::SmartPointer< const Self > ConstPointer;
 
-      typedef typename _TMarks::TTraits TTraits;
-      fpa_Base_TraitTypes( typename TTraits );
+      typedef fpa::Filters::Event< TVertex > TEvent;
 
-    private:
+    protected:
       itkConceptMacro(
-        Marks_and_Seeds_SameTraits,
-        ( itk::Concept::SameType< typename _TSeeds::TTraits, TTraits > )
+        Check_Marks,
+        ( itk::Concept::IsUnsignedInteger< TMark > )
         );
 
     public:
-      itkTypeMacro( fpa::Base::Algorithm, _TFilter );
+      itkTypeMacro( fpa::Filters::Image::Algorithm, TFilter );
 
       itkBooleanMacro( VisualDebug );
       itkGetConstMacro( VisualDebug, bool );
@@ -48,6 +50,7 @@ namespace fpa
       itkSetMacro( InitValue, TOutputValue );
 
     public:
+      virtual itk::ModifiedTimeType GetMTime( ) const override;
       virtual void InvokeEvent( const itk::EventObject& e );
       virtual void InvokeEvent( const itk::EventObject& e ) const;
 
@@ -56,32 +59,48 @@ namespace fpa
       virtual ~Algorithm( );
 
       virtual void GenerateData( ) override;
+
+      // Object association
+      void _Associate( itk::Object* o );
+      void _Deassociate( itk::Object* o );
+      void _DeassociateAll( );
+
+      // Preparation and termination
       virtual void _BeforeGenerateData( );
       virtual void _AfterGenerateData( );
-      virtual void _FinishOneLoop( );
+      virtual void _Reinitialize( );
 
-      virtual void _QueueInit( );
+      // Memory allocation
+      virtual void _ConfigureOutputs( ) = 0;
 
-      virtual void _ConfigureOutput( const TOutputValue& v ) = 0;
-      virtual TNeighborhood _GetNeighbors( const TVertex& v ) const = 0;
+      // Value assignation/recuperation
+      virtual const itk::DataObject* _GetReferenceInput( ) const;
       virtual TInputValue _GetInputValue( const TVertex& v ) const = 0;
+      virtual TInputValue _GetInputValue( const TNode& n ) const;
       virtual TOutputValue _GetOutputValue( const TVertex& v ) const = 0;
-
-      virtual void _ComputeOutputValue( TNode& n ) = 0;
+      virtual TOutputValue _GetOutputValue( const TNode& n ) const;
+      virtual TNeighborhood _GetNeighbors( const TVertex& v ) const = 0;
       virtual void _UpdateOutputValue( TNode& n ) = 0;
+
+      // Queue management
       virtual void _QueueClear( ) = 0;
-      virtual void _QueuePush( const TNode& node ) = 0;
-      virtual unsigned long _QueueSize( ) const = 0;
       virtual TNode _QueuePop( ) = 0;
+      virtual void _QueuePush( const TNode& n ) = 0;
+      virtual unsigned long _QueueSize( ) const = 0;
+
+      // Value update according to the particular algorithm
+      virtual void _ComputeOutputValue( TNode& n ) = 0;
 
     private:
-      // Purposely not implemented
+      // Purposely not implemented.
       Algorithm( const Self& other );
       Self& operator=( const Self& other );
 
     protected:
       bool m_VisualDebug;
       TOutputValue m_InitValue;
+
+      std::set< itk::Object* > m_AssociatedObjects;
     };
 
   } // ecapseman
@@ -89,9 +108,8 @@ namespace fpa
 } // ecapseman
 
 #ifndef ITK_MANUAL_INSTANTIATION
-#  include <fpa/Base/Algorithm.hxx>
+#  include <fpa/Filters/Algorithm.hxx>
 #endif // ITK_MANUAL_INSTANTIATION
 
-#endif // __fpa__Base__Algorithm__h__
-
+#endif // __fpa__Filters__Algorithm__h__
 // eof - $RCSfile$
diff --git a/lib/fpa/Filters/Algorithm.hxx b/lib/fpa/Filters/Algorithm.hxx
new file mode 100644 (file)
index 0000000..1d03a72
--- /dev/null
@@ -0,0 +1,250 @@
+// =========================================================================
+// @author Leonardo Florez Valencia
+// @email florez-l@javeriana.edu.co
+// =========================================================================
+#ifndef __fpa__Filters__Algorithm__hxx__
+#define __fpa__Filters__Algorithm__hxx__
+
+#include <itkDataObject.h>
+#include <fpa/Functors/BaseVertexFunction.h>
+
+// -------------------------------------------------------------------------
+template< class _TTraits >
+itk::ModifiedTimeType fpa::Filters::Algorithm< _TTraits >::
+GetMTime( ) const
+{
+  itk::ModifiedTimeType q = this->Superclass::GetMTime( );
+  itk::ModifiedTimeType t;
+  for( itk::Object* o: this->m_AssociatedObjects )
+  {
+    if( o != NULL )
+    {
+      t = o->GetMTime( );
+      q = ( q < t )? q: t;
+
+    } // fi
+
+  } // rof
+  return( q );
+}
+
+// -------------------------------------------------------------------------
+template< class _TTraits >
+void fpa::Filters::Algorithm< _TTraits >::
+InvokeEvent( const itk::EventObject& e )
+{
+  TEvent a;
+  if( a.CheckEvent( &e ) )
+  {
+    if( this->m_VisualDebug )
+      this->Superclass::InvokeEvent( e );
+  }
+  else
+    this->Superclass::InvokeEvent( e );
+}
+
+// -------------------------------------------------------------------------
+template< class _TTraits >
+void fpa::Filters::Algorithm< _TTraits >::
+InvokeEvent( const itk::EventObject& e ) const
+{
+  TEvent a;
+  if( a.CheckEvent( &e ) )
+  {
+    if( this->m_VisualDebug )
+      this->Superclass::InvokeEvent( e );
+  }
+  else
+    this->Superclass::InvokeEvent( e );
+}
+
+// -------------------------------------------------------------------------
+template< class _TTraits >
+fpa::Filters::Algorithm< _TTraits >::
+Algorithm( )
+  : Superclass( ),
+    TMarksInterface( this ),
+    TSeedsInterface( this ),
+    m_VisualDebug( false ),
+    m_InitValue( TOutputValue( 0 ) )
+{
+}
+
+// -------------------------------------------------------------------------
+template< class _TTraits >
+fpa::Filters::Algorithm< _TTraits >::
+~Algorithm( )
+{
+}
+
+// -------------------------------------------------------------------------
+template< class _TTraits >
+void fpa::Filters::Algorithm< _TTraits >::
+GenerateData( )
+{
+  // Init algorithm
+  this->InvokeEvent( itk::StartEvent( ) );
+  this->_BeforeGenerateData( );
+  this->_ConfigureOutputs( );
+  this->_PrepareSeeds( this->_GetReferenceInput( ) );
+  this->_InitCollisions( this->GetSeeds( ).size( ) );
+
+  // Init queue
+  for( TNode seed: this->GetSeeds( ) )
+  {
+    seed.Value = this->m_InitValue;
+    this->_QueuePush( seed );
+    this->InvokeEvent( TEvent( seed.Vertex, seed.FrontId, true ) );
+
+  } // rof
+
+  // Main loop
+  while( this->_QueueSize( ) > 0 )
+  {
+    // Get next candidate
+    TNode node = this->_QueuePop( );
+    this->InvokeEvent( TEvent( node.Vertex, node.FrontId, false ) );
+
+    if( !( this->_IsMarked( node ) ) )
+    {
+      // Update output value and mark vertex
+      this->_UpdateOutputValue( node );
+      this->_Mark( node );
+
+      // The actual node was effectively marked?
+      if( node.FrontId > 0 )
+      {
+        // Add neighborhood
+        TNeighborhood neighbors = this->_GetNeighbors( node.Vertex );
+        typename TNeighborhood::const_iterator nIt = neighbors.begin( );
+        bool coll = false;
+        while( nIt != neighbors.end( ) && !coll )
+        {
+          if( this->_IsMarked( *nIt ) )
+          {
+            // Invoke stop at collisions
+            if( this->_Collisions( node.Vertex, *nIt ) )
+            {
+              this->_QueueClear( );
+              coll = true;
+
+            } // fi
+          }
+          else
+          {
+            TNode nnode;
+            nnode.Vertex = *nIt;
+            nnode.Parent = node.Vertex;
+            nnode.FrontId = node.FrontId;
+            this->_ComputeOutputValue( nnode );
+            this->_QueuePush( nnode );
+            this->InvokeEvent( TEvent( nnode.Vertex, nnode.FrontId, true ) );
+
+          } // fi
+          ++nIt;
+
+        } // elihw
+
+      } // fi
+
+    } // fi
+    this->_Reinitialize( );
+
+  } // elihw
+
+  // Finish algorithm
+  this->_AfterGenerateData( );
+  this->InvokeEvent( itk::EndEvent( ) );
+}
+
+// -------------------------------------------------------------------------
+template< class _TTraits >
+void fpa::Filters::Algorithm< _TTraits >::
+_Associate( itk::Object* o )
+{
+  if( this->m_AssociatedObjects.insert( o ).second )
+    this->Modified( );
+}
+
+// -------------------------------------------------------------------------
+template< class _TTraits >
+void fpa::Filters::Algorithm< _TTraits >::
+_Deassociate( itk::Object* o )
+{
+  std::set< itk::Object* >::iterator i = this->m_AssociatedObjects.find( o );
+  if( i != this->m_AssociatedObjects.end( ) )
+  {
+    this->m_AssociatedObjects.erase( i );
+    this->Modified( );
+
+  } // fi
+}
+
+// -------------------------------------------------------------------------
+template< class _TTraits >
+void fpa::Filters::Algorithm< _TTraits >::
+_DeassociateAll( )
+{
+  if( this->m_AssociatedObjects.size( ) > 0 )
+    this->Modified( );
+  this->m_AssociatedObjects.clear( );
+}
+
+// -------------------------------------------------------------------------
+template< class _TTraits >
+void fpa::Filters::Algorithm< _TTraits >::
+_BeforeGenerateData( )
+{
+  typedef fpa::Functors::LightBaseVertexFunction< TVertex > _TVertexFunc;
+  const itk::DataObject* input = this->GetInput( );
+  for( itk::Object* o: this->m_AssociatedObjects )
+  {
+    _TVertexFunc* f = dynamic_cast< _TVertexFunc* >( o );
+    if( f != NULL )
+      f->SetDataObject( input );
+
+  } // rof
+}
+
+// -------------------------------------------------------------------------
+template< class _TTraits >
+void fpa::Filters::Algorithm< _TTraits >::
+_AfterGenerateData( )
+{
+}
+
+// -------------------------------------------------------------------------
+template< class _TTraits >
+void fpa::Filters::Algorithm< _TTraits >::
+_Reinitialize( )
+{
+}
+
+// -------------------------------------------------------------------------
+template< class _TTraits >
+const itk::DataObject* fpa::Filters::Algorithm< _TTraits >::
+_GetReferenceInput( ) const
+{
+  return( this->GetInput( ) );
+}
+
+// -------------------------------------------------------------------------
+template< class _TTraits >
+typename fpa::Filters::Algorithm< _TTraits >::
+TInputValue fpa::Filters::Algorithm< _TTraits >::
+_GetInputValue( const TNode& n ) const
+{
+  return( this->_GetInputValue( n.Vertex ) );
+}
+
+// -------------------------------------------------------------------------
+template< class _TTraits >
+typename fpa::Filters::Algorithm< _TTraits >::
+TOutputValue fpa::Filters::Algorithm< _TTraits >::
+_GetOutputValue( const TNode& n ) const
+{
+  return( this->_GetOutputValue( n.Vertex ) );
+}
+
+#endif // __fpa__Filters__Algorithm__hxx__
+// eof - $RCSfile$
diff --git a/lib/fpa/Filters/Dijkstra.h b/lib/fpa/Filters/Dijkstra.h
new file mode 100644 (file)
index 0000000..0a77022
--- /dev/null
@@ -0,0 +1,64 @@
+// =========================================================================
+// @author Leonardo Florez Valencia
+// @email florez-l@javeriana.edu.co
+// =========================================================================
+#ifndef __fpa__Filters__Dijkstra__h__
+#define __fpa__Filters__Dijkstra__h__
+
+#include <fpa/Filters/DijkstraBase.h>
+
+namespace fpa
+{
+  namespace Filters
+  {
+    /**
+     */
+    template< class _TTraits, class _TMST >
+    class Dijkstra
+      : public fpa::Filters::DijkstraBase< _TTraits >
+    {
+    public:
+      typedef _TTraits TTraits;
+      typedef _TMST    TMST;
+      fpaTraitsMacro( typename, TTraits );
+
+      typedef fpa::Filters::DijkstraBase< _TTraits > Superclass;
+      typedef Dijkstra                               Self;
+      typedef itk::SmartPointer< Self >              Pointer;
+      typedef itk::SmartPointer< const Self >        ConstPointer;
+
+      typedef typename Superclass::TScalarWeight TScalarWeight;
+      typedef typename Superclass::TVertexWeight TVertexWeight;
+
+    public:
+      itkTypeMacro( fpa::Filters::Dijkstra, fpa::Filters::DijkstraBase );
+
+      fpaFilterOutputMacro( MinimumSpanningTree, TMST );
+
+
+    protected:
+      Dijkstra( );
+      virtual ~Dijkstra( );
+
+      virtual void _AfterGenerateData( ) override;
+      virtual void _UpdateOutputValue( TNode& n ) override;
+
+    private:
+      // Purposely not implemented.
+      Dijkstra( const Self& other );
+      Self& operator=( const Self& other );
+
+    protected:
+      unsigned int m_MinimumSpanningTreeIdx;
+    };
+
+  } // ecapseman
+
+} // ecapseman
+
+#ifndef ITK_MANUAL_INSTANTIATION
+#  include <fpa/Filters/Dijkstra.hxx>
+#endif // ITK_MANUAL_INSTANTIATION
+
+#endif // __fpa__Filters__Dijkstra__h__
+// eof - $RCSfile$
diff --git a/lib/fpa/Filters/Dijkstra.hxx b/lib/fpa/Filters/Dijkstra.hxx
new file mode 100644 (file)
index 0000000..a27669a
--- /dev/null
@@ -0,0 +1,48 @@
+// =========================================================================
+// @author Leonardo Florez Valencia
+// @email florez-l@javeriana.edu.co
+// =========================================================================
+#ifndef __fpa__Filters__Dijkstra__hxx__
+#define __fpa__Filters__Dijkstra__hxx__
+
+// -------------------------------------------------------------------------
+template< class _TTraits, class _TMST >
+fpa::Filters::Dijkstra< _TTraits, _TMST >::
+Dijkstra( )
+  : Superclass( )
+{
+  fpaFilterOutputConfigureMacro( MinimumSpanningTree, TMST );
+}
+
+// -------------------------------------------------------------------------
+template< class _TTraits, class _TMST >
+fpa::Filters::Dijkstra< _TTraits, _TMST >::
+~Dijkstra( )
+{
+}
+
+// -------------------------------------------------------------------------
+template< class _TTraits, class _TMST >
+void fpa::Filters::Dijkstra< _TTraits, _TMST >::
+_AfterGenerateData( )
+{
+  this->Superclass::_AfterGenerateData( );
+
+  TMST* mst = this->GetMinimumSpanningTree( );
+  mst->ClearSeeds( );
+  mst->SetCollisions( this->m_Collisions );
+  for( TNode n: this->GetSeeds( ) )
+    mst->AddSeed( n.Vertex );
+}
+
+// -------------------------------------------------------------------------
+template< class _TTraits, class _TMST >
+void fpa::Filters::Dijkstra< _TTraits, _TMST >::
+_UpdateOutputValue( TNode& n )
+{
+  this->Superclass::_UpdateOutputValue( n );
+  this->GetMinimumSpanningTree( )->SetParent( n.Vertex, n.Parent );
+}
+
+#endif // __fpa__Filters__Dijkstra__hxx__
+// eof - $RCSfile$
diff --git a/lib/fpa/Filters/DijkstraBase.h b/lib/fpa/Filters/DijkstraBase.h
new file mode 100644 (file)
index 0000000..da844ee
--- /dev/null
@@ -0,0 +1,97 @@
+// =========================================================================
+// @author Leonardo Florez Valencia
+// @email florez-l@javeriana.edu.co
+// =========================================================================
+#ifndef __fpa__Filters__DijkstraBase__h__
+#define __fpa__Filters__DijkstraBase__h__
+
+#include <vector>
+#include <itkConceptChecking.h>
+#include <itkFunctionBase.h>
+#include <fpa/Filters/Algorithm.h>
+#include <fpa/Functors/BaseVertexFunction.h>
+
+namespace fpa
+{
+  namespace Filters
+  {
+    /**
+     */
+    template< class _TTraits >
+    class DijkstraBase
+      : public fpa::Filters::Algorithm< _TTraits >
+    {
+    public:
+      typedef _TTraits TTraits;
+      fpaTraitsMacro( typename, TTraits );
+
+      typedef fpa::Filters::Algorithm< TTraits > Superclass;
+      typedef DijkstraBase                       Self;
+      typedef itk::SmartPointer< Self >          Pointer;
+      typedef itk::SmartPointer< const Self >    ConstPointer;
+
+      typedef std::vector< TNode > TQueue;
+      struct TQueueOrder
+      {
+        bool operator()( const TNode& a, const TNode& b ) const
+          {
+            return( b.Value < a.Value );
+          }
+      };
+
+      typedef itk::FunctionBase< TOutputValue, TOutputValue > TScalarWeight;
+      typedef fpa::Functors::BaseVertexFunction< TVertex, TOutputValue > TVertexWeight;
+
+    protected:
+      itkConceptMacro(
+        Check_TOutputValue,
+        ( itk::Concept::IsFloatingPoint< TOutputValue > )
+        );
+
+    public:
+      itkTypeMacro( fpa::Filters::DijkstraBase, fpa::Filters::Algorithm );
+
+      itkGetConstObjectMacro( ScalarWeight, TScalarWeight );
+      itkGetObjectMacro( ScalarWeight, TScalarWeight );
+
+      itkGetConstObjectMacro( VertexWeight, TVertexWeight );
+      itkGetObjectMacro( VertexWeight, TVertexWeight );
+
+    public:
+      void SetWeightFunction( TScalarWeight* w );
+      void SetWeightFunction( TVertexWeight* w );
+
+    protected:
+      DijkstraBase( );
+      virtual ~DijkstraBase( );
+
+      virtual void _UpdateOutputValue( TNode& n ) override;
+      virtual void _QueueClear( ) override;
+      virtual TNode _QueuePop( ) override;
+      virtual void _QueuePush( const TNode& n ) override;
+      virtual unsigned long _QueueSize( ) const override;
+      virtual void _ComputeOutputValue( TNode& n ) override;
+
+    private:
+      // Purposely not implemented.
+      DijkstraBase( const Self& other );
+      Self& operator=( const Self& other );
+
+    protected:
+      typename TScalarWeight::Pointer m_ScalarWeight;
+      typename TVertexWeight::Pointer m_VertexWeight;
+
+      TQueue       m_Queue;
+      TQueueOrder m_QueueOrder;
+    };
+
+  } // ecapseman
+
+} // ecapseman
+
+#ifndef ITK_MANUAL_INSTANTIATION
+#  include <fpa/Filters/DijkstraBase.hxx>
+#endif // ITK_MANUAL_INSTANTIATION
+
+#endif // __fpa__Filters__DijkstraBase__h__
+// eof - $RCSfile$
diff --git a/lib/fpa/Filters/DijkstraBase.hxx b/lib/fpa/Filters/DijkstraBase.hxx
new file mode 100644 (file)
index 0000000..ae6c6ad
--- /dev/null
@@ -0,0 +1,129 @@
+// =========================================================================
+// @author Leonardo Florez Valencia
+// @email florez-l@javeriana.edu.co
+// =========================================================================
+#ifndef __fpa__Filters__DijkstraBase__hxx__
+#define __fpa__Filters__DijkstraBase__hxx__
+
+#include <algorithm>
+#include <limits>
+
+// -------------------------------------------------------------------------
+template< class _TTraits >
+void fpa::Filters::DijkstraBase< _TTraits >::
+SetWeightFunction( TScalarWeight* w )
+{
+  if( this->m_ScalarWeight.GetPointer( ) != w )
+  {
+    this->_Deassociate( this->m_ScalarWeight );
+    this->m_ScalarWeight = w;
+    this->_Associate( this->m_ScalarWeight );
+    this->Modified( );
+
+  } // fi
+}
+
+// -------------------------------------------------------------------------
+template< class _TTraits >
+void fpa::Filters::DijkstraBase< _TTraits >::
+SetWeightFunction( TVertexWeight* w )
+{
+  if( this->m_VertexWeight.GetPointer( ) != w )
+  {
+    this->_Deassociate( this->m_VertexWeight );
+    this->m_VertexWeight = w;
+    this->_Associate( this->m_VertexWeight );
+    this->Modified( );
+
+  } // fi
+}
+
+// -------------------------------------------------------------------------
+template< class _TTraits >
+fpa::Filters::DijkstraBase< _TTraits >::
+DijkstraBase( )
+  : Superclass( )
+{
+  this->SetInitValue( TOutputValue( 0 ) );
+}
+
+// -------------------------------------------------------------------------
+template< class _TTraits >
+fpa::Filters::DijkstraBase< _TTraits >::
+~DijkstraBase( )
+{
+}
+
+// -------------------------------------------------------------------------
+template< class _TTraits >
+void fpa::Filters::DijkstraBase< _TTraits >::
+_UpdateOutputValue( TNode& n )
+{
+  // Do nothing
+}
+
+// -------------------------------------------------------------------------
+template< class _TTraits >
+void fpa::Filters::DijkstraBase< _TTraits >::
+_QueueClear( )
+{
+  this->m_Queue.clear( );
+}
+
+// -------------------------------------------------------------------------
+template< class _TTraits >
+typename fpa::Filters::DijkstraBase< _TTraits >::
+TNode fpa::Filters::DijkstraBase< _TTraits >::
+_QueuePop( )
+{
+  std::pop_heap(
+    this->m_Queue.begin( ), this->m_Queue.end( ), this->m_QueueOrder
+    );
+  TNode n = this->m_Queue.back( );
+  this->m_Queue.pop_back( );
+  return( n );
+}
+
+// -------------------------------------------------------------------------
+template< class _TTraits >
+void fpa::Filters::DijkstraBase< _TTraits >::
+_QueuePush( const TNode& n )
+{
+  bool push_needed =  ( n.Parent == n.Vertex );
+  push_needed     |= !( n.Value < this->_GetOutputValue( n.Parent ) );
+  if( push_needed )
+  {
+    this->m_Queue.push_back( n );
+    std::push_heap(
+      this->m_Queue.begin( ), this->m_Queue.end( ), this->m_QueueOrder
+      );
+
+  } // fi
+}
+
+// -------------------------------------------------------------------------
+template< class _TTraits >
+unsigned long fpa::Filters::DijkstraBase< _TTraits >::
+_QueueSize( ) const
+{
+  return( this->m_Queue.size( ) );
+}
+
+// -------------------------------------------------------------------------
+template< class _TTraits >
+void fpa::Filters::DijkstraBase< _TTraits >::
+_ComputeOutputValue( TNode& n )
+{
+  if( this->m_VertexWeight.IsNotNull( ) )
+  {
+    TOutputValue c = this->m_VertexWeight->Evaluate( n.Vertex, n.Parent );
+    if( this->m_ScalarWeight.IsNotNull( ) )
+      c = this->m_ScalarWeight->Evaluate( c );
+    n.Value = c + this->_GetOutputValue( n.Parent );
+  }
+  else
+    n.Value = TOutputValue( -1 );
+}
+
+#endif // __fpa__Filters__DijkstraBase__hxx__
+// eof - $RCSfile$
similarity index 87%
rename from lib/fpa/Base/Event.h
rename to lib/fpa/Filters/Event.h
index dc4910dfc66c265fc776bfddfbee9d1994a955b0..ee81d7c8c0074aeefccc92ef431741e62d5d6ec0 100644 (file)
@@ -2,15 +2,14 @@
 // @author Leonardo Florez Valencia
 // @email florez-l@javeriana.edu.co
 // =========================================================================
-
-#ifndef __fpa__Base__Event__h__
-#define __fpa__Base__Event__h__
+#ifndef __fpa__Filters__Event__h__
+#define __fpa__Filters__Event__h__
 
 #include <itkEventObject.h>
 
 namespace fpa
 {
-  namespace Base
+  namespace Filters
   {
     /**
      */
@@ -46,9 +45,8 @@ namespace fpa
 } // ecapseman
 
 #ifndef ITK_MANUAL_INSTANTIATION
-#  include <fpa/Base/Event.hxx>
+#  include <fpa/Filters/Event.hxx>
 #endif // ITK_MANUAL_INSTANTIATION
-
-#endif // __fpa__Base__Event__h__
+#endif // __fpa__Filters__Event__h__
 
 // eof - $RCSfile$
similarity index 75%
rename from lib/fpa/Base/Event.hxx
rename to lib/fpa/Filters/Event.hxx
index 309bc814406fb6dda60be2a227be4c6f9772fbad..105c60313388cbf530c04f2f813c1cf211935399 100644 (file)
@@ -2,13 +2,12 @@
 // @author Leonardo Florez Valencia
 // @email florez-l@javeriana.edu.co
 // =========================================================================
-
-#ifndef __fpa__Base__Event__hxx__
-#define __fpa__Base__Event__hxx__
+#ifndef __fpa__Filters__Event__hxx__
+#define __fpa__Filters__Event__hxx__
 
 // -------------------------------------------------------------------------
 template< class _TVertex >
-fpa::Base::Event< _TVertex >::
+fpa::Filters::Event< _TVertex >::
 Event( )
   : Superclass( )
 {
@@ -16,7 +15,7 @@ Event( )
 
 // -------------------------------------------------------------------------
 template< class _TVertex >
-fpa::Base::Event< _TVertex >::
+fpa::Filters::Event< _TVertex >::
 Event( const TVertex& v, unsigned long fid, bool intoq )
   : Superclass( ),
     Vertex( v ),
@@ -27,22 +26,22 @@ Event( const TVertex& v, unsigned long fid, bool intoq )
 
 // -------------------------------------------------------------------------
 template< class _TVertex >
-fpa::Base::Event< _TVertex >::
+fpa::Filters::Event< _TVertex >::
 ~Event( )
 {
 }
 
 // -------------------------------------------------------------------------
 template< class _TVertex >
-const char* fpa::Base::Event< _TVertex >::
+const char* fpa::Filters::Event< _TVertex >::
 GetEventName( ) const
 {
-  return( "fpa::Base::Event< _TVertex >" );
+  return( "fpa::Filters::Event< _TVertex >" );
 }
 
 // -------------------------------------------------------------------------
 template< class _TVertex >
-bool fpa::Base::Event< _TVertex >::
+bool fpa::Filters::Event< _TVertex >::
 CheckEvent( const itk::EventObject* e ) const
 {
   return( dynamic_cast< const Self* >( e ) != NULL );
@@ -50,12 +49,11 @@ CheckEvent( const itk::EventObject* e ) const
 
 // -------------------------------------------------------------------------
 template< class _TVertex >
-itk::EventObject* fpa::Base::Event< _TVertex >::
+itk::EventObject* fpa::Filters::Event< _TVertex >::
 MakeObject( ) const
 {
   return( new Self );
 }
 
-#endif // __fpa__Base__Event__hxx__
-
+#endif // __fpa__Filters__Event__hxx__
 // eof - $RCSfile$
diff --git a/lib/fpa/Filters/Image/Algorithm.h b/lib/fpa/Filters/Image/Algorithm.h
new file mode 100644 (file)
index 0000000..ce20e7a
--- /dev/null
@@ -0,0 +1,77 @@
+// =========================================================================
+// @author Leonardo Florez Valencia
+// @email florez-l@javeriana.edu.co
+// =========================================================================
+#ifndef __fpa__Filters__Image__Algorithm__h__
+#define __fpa__Filters__Image__Algorithm__h__
+
+#include <itkImage.h>
+
+namespace fpa
+{
+  namespace Filters
+  {
+    namespace Image
+    {
+      /**
+       */
+      template< class _TBaseAlgorithm >
+      class Algorithm
+        : public _TBaseAlgorithm
+      {
+      public:
+        typedef _TBaseAlgorithm TBaseAlgorithm;
+        typedef typename TBaseAlgorithm::TTraits TTraits;
+        fpaTraitsMacro( typename, TTraits );
+
+        typedef TBaseAlgorithm                  Superclass;
+        typedef Algorithm                       Self;
+        typedef itk::SmartPointer< Self >       Pointer;
+        typedef itk::SmartPointer< const Self > ConstPointer;
+
+        typedef typename TTraits::TInputImage  TInputImage;
+        typedef typename TTraits::TOutputImage TOutputImage;
+        typedef itk::Image< TMark, Self::Dimension > TMarksImage;
+
+      public:
+        itkTypeMacro( fpa::Filters::Image::Algorithm, TBaseAlgorithm );
+
+        itkGetConstMacro( NeighborhoodOrder, unsigned int );
+        itkSetMacro( NeighborhoodOrder, unsigned int );
+
+        fpaFilterOutputMacro( Marks, TMarksImage );
+
+      protected:
+        Algorithm( );
+        virtual ~Algorithm( );
+
+        virtual void _ConfigureOutputs( ) override;
+        virtual TInputValue _GetInputValue( const TVertex& v ) const override;
+        virtual TOutputValue _GetOutputValue( const TVertex& v ) const override;
+        virtual TNeighborhood _GetNeighbors( const TVertex& v ) const override;
+        virtual void _UpdateOutputValue( TNode& n ) override;
+        virtual unsigned long _GetMark( const TVertex& v ) const override;
+        virtual bool _IsMarked( const TVertex& v ) const override;
+        virtual void _Mark( const TVertex& v, unsigned long m ) override;
+
+      private:
+        // Purposely not implemented.
+        Algorithm( const Self& other );
+        Self& operator=( const Self& other );
+
+      protected:
+        unsigned int m_MarksIdx;
+        unsigned int m_NeighborhoodOrder;
+      };
+
+    } // ecapseman
+
+  } // ecapseman
+
+} // ecapseman
+
+#ifndef ITK_MANUAL_INSTANTIATION
+#  include <fpa/Filters/Image/Algorithm.hxx>
+#endif // ITK_MANUAL_INSTANTIATION
+#endif // __fpa__Filters__Image__Algorithm__h__
+// eof - $RCSfile$
diff --git a/lib/fpa/Filters/Image/Algorithm.hxx b/lib/fpa/Filters/Image/Algorithm.hxx
new file mode 100644 (file)
index 0000000..5095992
--- /dev/null
@@ -0,0 +1,137 @@
+// =========================================================================
+// @author Leonardo Florez Valencia
+// @email florez-l@javeriana.edu.co
+// =========================================================================
+#ifndef __fpa__Filters__Image__Algorithm__hxx__
+#define __fpa__Filters__Image__Algorithm__hxx__
+
+// -------------------------------------------------------------------------
+template< class _TBaseAlgorithm >
+fpa::Filters::Image::Algorithm< _TBaseAlgorithm >::
+Algorithm( )
+  : Superclass( ),
+    m_NeighborhoodOrder( 1 )
+{
+  fpaFilterOutputConfigureMacro( Marks, TMarksImage );
+}
+
+// -------------------------------------------------------------------------
+template< class _TBaseAlgorithm >
+fpa::Filters::Image::Algorithm< _TBaseAlgorithm >::
+~Algorithm( )
+{
+}
+
+// -------------------------------------------------------------------------
+template< class _TBaseAlgorithm >
+void fpa::Filters::Image::Algorithm< _TBaseAlgorithm >::
+_ConfigureOutputs( )
+{
+  const TInputImage* in = this->GetInput( );
+
+  TOutputImage* out = this->GetOutput( );
+  out->SetLargestPossibleRegion( in->GetLargestPossibleRegion( ) );
+  out->SetRequestedRegion( in->GetRequestedRegion( ) );
+  out->SetBufferedRegion( in->GetBufferedRegion( ) );
+  out->SetSpacing( in->GetSpacing( ) );
+  out->SetOrigin( in->GetOrigin( ) );
+  out->SetDirection( in->GetDirection( ) );
+  out->Allocate( );
+  out->FillBuffer( this->GetInitValue( ) );
+
+  TMarksImage* marks = this->GetMarks( );
+  marks->SetLargestPossibleRegion( in->GetLargestPossibleRegion( ) );
+  marks->SetRequestedRegion( in->GetRequestedRegion( ) );
+  marks->SetBufferedRegion( in->GetBufferedRegion( ) );
+  marks->SetSpacing( in->GetSpacing( ) );
+  marks->SetOrigin( in->GetOrigin( ) );
+  marks->SetDirection( in->GetDirection( ) );
+  marks->Allocate( );
+  marks->FillBuffer( TMark( 0 ) );
+}
+
+// -------------------------------------------------------------------------
+template< class _TBaseAlgorithm >
+typename fpa::Filters::Image::Algorithm< _TBaseAlgorithm >::
+TInputValue fpa::Filters::Image::Algorithm< _TBaseAlgorithm >::
+_GetInputValue( const TVertex& v ) const
+{
+  return( this->GetInput( )->GetPixel( v ) );
+}
+
+// -------------------------------------------------------------------------
+template< class _TBaseAlgorithm >
+typename fpa::Filters::Image::Algorithm< _TBaseAlgorithm >::
+TOutputValue fpa::Filters::Image::Algorithm< _TBaseAlgorithm >::
+_GetOutputValue( const TVertex& v ) const
+{
+  return( this->GetOutput( )->GetPixel( v ) );
+}
+
+// -------------------------------------------------------------------------
+template< class _TBaseAlgorithm >
+typename fpa::Filters::Image::Algorithm< _TBaseAlgorithm >::
+TNeighborhood fpa::Filters::Image::Algorithm< _TBaseAlgorithm >::
+_GetNeighbors( const TVertex& v ) const
+{
+  typename TInputImage::RegionType region =
+    this->GetInput( )->GetRequestedRegion( );
+  TNeighborhood neighborhood;
+  if( this->m_NeighborhoodOrder == 1 )
+  {
+    for( unsigned int d = 0; d < Self::Dimension; ++d )
+    {
+      for( int s = -1; s <= 1; s += 2 )
+      {
+        TVertex n = v;
+        n[ d ] += s;
+        if( region.IsInside( n ) )
+          neighborhood.push_back( n );
+
+      } // rof
+
+    } // rof
+  }
+  else if( this->m_NeighborhoodOrder == 2 )
+  {
+    // TODO
+
+  } // fi
+  return( neighborhood );
+}
+
+// -------------------------------------------------------------------------
+template< class _TBaseAlgorithm >
+void fpa::Filters::Image::Algorithm< _TBaseAlgorithm >::
+_UpdateOutputValue( TNode& n )
+{
+  this->Superclass::_UpdateOutputValue( n );
+  this->GetOutput( )->SetPixel( n.Vertex, n.Value );
+}
+
+// -------------------------------------------------------------------------
+template< class _TBaseAlgorithm >
+unsigned long fpa::Filters::Image::Algorithm< _TBaseAlgorithm >::
+_GetMark( const TVertex& v ) const
+{
+  return( ( unsigned long )( this->GetMarks( )->GetPixel( v ) ) );
+}
+
+// -------------------------------------------------------------------------
+template< class _TBaseAlgorithm >
+bool fpa::Filters::Image::Algorithm< _TBaseAlgorithm >::
+_IsMarked( const TVertex& v ) const
+{
+  return( this->GetMarks( )->GetPixel( v ) != TMark( 0 ) );
+}
+
+// -------------------------------------------------------------------------
+template< class _TBaseAlgorithm >
+void fpa::Filters::Image::Algorithm< _TBaseAlgorithm >::
+_Mark( const TVertex& v, unsigned long m )
+{
+  this->GetMarks( )->SetPixel( v, TMark( m ) );
+}
+
+#endif // __fpa__Filters__Image__Algorithm__hxx__
+// eof - $RCSfile$
diff --git a/lib/fpa/Filters/Image/DefaultTraits.h b/lib/fpa/Filters/Image/DefaultTraits.h
new file mode 100644 (file)
index 0000000..a095704
--- /dev/null
@@ -0,0 +1,94 @@
+// =========================================================================
+// @author Leonardo Florez Valencia
+// @email florez-l@javeriana.edu.co
+// =========================================================================
+#ifndef __fpa__Filters__Image__DefaultTraits__h__
+#define __fpa__Filters__Image__DefaultTraits__h__
+
+#include <set>
+#include <vector>
+#include <itkConceptChecking.h>
+#include <itkImageToImageFilter.h>
+#include <fpa/Filters/MarksWithCollisionsInterface.h>
+#include <fpa/Filters/SeedsInterface.h>
+
+namespace fpa
+{
+  namespace Filters
+  {
+    namespace Image
+    {
+      /**
+       */
+      template< class _TInputImage, class _TOutputImage, class _TMark >
+      class DefaultTraits
+      {
+      public:
+        typedef _TInputImage  TInputImage;
+        typedef _TOutputImage TOutputImage;
+
+        class TInternalTraits
+        {
+        public:
+          typedef _TMark TMark;
+          typedef typename TInputImage::IndexType        TVertex;
+          typedef typename TInputImage::PixelType        TInputValue;
+          typedef typename TInputImage::PointType        TPoint;
+          typedef typename TOutputImage::PixelType       TOutputValue;
+          typedef typename TVertex::LexicographicCompare TVertexCompare;
+          itkStaticConstMacro(
+            Dimension, unsigned int, _TInputImage::ImageDimension
+            );
+
+          typedef std::vector< TVertex > TNeighborhood;
+          struct TSeed
+          {
+            TVertex Vertex;
+            TPoint  Point;
+            bool    IsPoint;
+            TMark   FrontId;
+            TSeed( const TMark& fid = 0 )
+              : FrontId( fid )
+              { }
+          };
+          typedef std::vector< TSeed > TSeeds;
+
+          struct TNode
+          {
+            TVertex Vertex;
+            TVertex Parent;
+            TMark   FrontId;
+
+            // Hack to hide the fact that nodes need to be (re-)initialized
+            mutable TOutputValue Value;
+          };
+          struct TNodeCompare
+          {
+            bool operator()( const TNode& a, const TNode& b ) const
+              {
+                static TVertexCompare c;
+                return( c( a.Vertex, b.Vertex ) );
+              }
+          };
+          typedef std::set< TNode, TNodeCompare > TNodes;
+        };
+
+        typedef itk::ImageToImageFilter< TInputImage, TOutputImage > TFilter;
+        typedef fpa::Filters::MarksWithCollisionsInterface< TInternalTraits >  TMarksInterface;
+        typedef fpa::Filters::SeedsInterface< TInternalTraits > TSeedsInterface;
+
+      protected:
+        itkConceptMacro(
+          Check_Dimensions,
+          ( itk::Concept::SameDimension< TInputImage::ImageDimension, TOutputImage::ImageDimension > )
+          );
+      };
+
+    } // ecapseman
+
+  } // ecapseman
+
+} // ecapseman
+
+#endif // __fpa__Filters__Image__DefaultTraits__h__
+// eof - $RCSfile$
diff --git a/lib/fpa/Filters/Image/Dijkstra.h b/lib/fpa/Filters/Image/Dijkstra.h
new file mode 100644 (file)
index 0000000..712d5fa
--- /dev/null
@@ -0,0 +1,66 @@
+// =========================================================================
+// @author Leonardo Florez Valencia
+// @email florez-l@javeriana.edu.co
+// =========================================================================
+#ifndef __fpa__Filters__Image__Dijkstra__h__
+#define __fpa__Filters__Image__Dijkstra__h__
+
+#include <fpa/Filters/Dijkstra.h>
+#include <fpa/Filters/Image/Algorithm.h>
+#include <fpa/Filters/Image/DefaultTraits.h>
+#include <fpa/DataStructures/Image/MinimumSpanningTree.h>
+
+namespace fpa
+{
+  namespace Filters
+  {
+    namespace Image
+    {
+      /**
+       */
+      template< class _TInputImage, class _TOutputImage, class _TMark = unsigned char, class _TTraits = fpa::Filters::Image::DefaultTraits< _TInputImage, _TOutputImage, _TMark >, class _TMST = fpa::DataStructures::Image::MinimumSpanningTree< _TTraits::TInternalTraits::Dimension > >
+      class Dijkstra
+        : public fpa::Filters::Image::Algorithm< fpa::Filters::Dijkstra< _TTraits, _TMST > >
+      {
+      public:
+        typedef _TInputImage  TInputImage;
+        typedef _TOutputImage TOutputImage;
+        typedef _TTraits      TTraits;
+        typedef _TMST         TMST;
+        fpaTraitsMacro( typename, TTraits );
+
+        typedef fpa::Filters::Dijkstra< TTraits, TMST >      TAlgorithm;
+        typedef fpa::Filters::Image::Algorithm< TAlgorithm > Superclass;
+        typedef Dijkstra                                     Self;
+        typedef itk::SmartPointer< Self >                    Pointer;
+        typedef itk::SmartPointer< const Self >              ConstPointer;
+
+      public:
+        itkNewMacro( Self );
+        itkTypeMacro(
+          fpa::Filters::Image::Dijkstra, fpa::Filters::Image::Algorithm
+          );
+
+      protected:
+        Dijkstra( );
+        virtual ~Dijkstra( );
+
+        virtual void _ConfigureOutputs( ) override;
+
+      private:
+        // Purposely not implemented.
+        Dijkstra( const Self& other );
+        Self& operator=( const Self& other );
+      };
+
+    } // ecapseman
+
+  } // ecapseman
+
+} // ecapseman
+
+#ifndef ITK_MANUAL_INSTANTIATION
+#  include <fpa/Filters/Image/Dijkstra.hxx>
+#endif // ITK_MANUAL_INSTANTIATION
+#endif // __fpa__Filters__Image__Dijkstra__h__
+// eof - $RCSfile$
diff --git a/lib/fpa/Filters/Image/Dijkstra.hxx b/lib/fpa/Filters/Image/Dijkstra.hxx
new file mode 100644 (file)
index 0000000..b7a2f86
--- /dev/null
@@ -0,0 +1,51 @@
+// =========================================================================
+// @author Leonardo Florez Valencia
+// @email florez-l@javeriana.edu.co
+// =========================================================================
+#ifndef __fpa__Filters__Image__Dijkstra__hxx__
+#define __fpa__Filters__Image__Dijkstra__hxx__
+
+#include <fpa/Functors/Dijkstra/Image/Identity.h>
+
+// -------------------------------------------------------------------------
+template< class _TInputImage, class _TOutputImage, class _TMark, class _TTraits, class _TMST >
+fpa::Filters::Image::Dijkstra< _TInputImage, _TOutputImage, _TMark, _TTraits, _TMST >::
+Dijkstra( )
+  : Superclass( )
+{
+  typedef fpa::Functors::Dijkstra::Image::Identity< TInputImage, TOutputValue > _TFunc;
+
+  this->SetWeightFunction( _TFunc::New( ) );
+}
+
+// -------------------------------------------------------------------------
+template< class _TInputImage, class _TOutputImage, class _TMark, class _TTraits, class _TMST >
+fpa::Filters::Image::Dijkstra< _TInputImage, _TOutputImage, _TMark, _TTraits, _TMST >::
+~Dijkstra( )
+{
+}
+
+// -------------------------------------------------------------------------
+template< class _TInputImage, class _TOutputImage, class _TMark, class _TTraits, class _TMST >
+void fpa::Filters::Image::Dijkstra< _TInputImage, _TOutputImage, _TMark, _TTraits, _TMST >::
+_ConfigureOutputs( )
+{
+  this->Superclass::_ConfigureOutputs( );
+
+  const TInputImage* in = this->GetInput( );
+  TMST* mst = this->GetMinimumSpanningTree( );
+  mst->SetLargestPossibleRegion( in->GetLargestPossibleRegion( ) );
+  mst->SetRequestedRegion( in->GetRequestedRegion( ) );
+  mst->SetBufferedRegion( in->GetBufferedRegion( ) );
+  mst->SetSpacing( in->GetSpacing( ) );
+  mst->SetOrigin( in->GetOrigin( ) );
+  mst->SetDirection( in->GetDirection( ) );
+  mst->Allocate( );
+
+  typename TVertex::OffsetType o;
+  o.Fill( 0 );
+  mst->FillBuffer( o );
+}
+
+#endif // __fpa__Filters__Image__Dijkstra__hxx__
+// eof - $RCSfile$
diff --git a/lib/fpa/Filters/Image/ExtractAxis.h b/lib/fpa/Filters/Image/ExtractAxis.h
new file mode 100644 (file)
index 0000000..a36991f
--- /dev/null
@@ -0,0 +1,106 @@
+// =========================================================================
+// @author Leonardo Florez Valencia
+// @email florez-l@javeriana.edu.co
+// =========================================================================
+#ifndef __fpa__Filters__Image__ExtractAxis__h__
+#define __fpa__Filters__Image__ExtractAxis__h__
+
+#include <itkProcessObject.h>
+#include <itkImageToImageFilter.h>
+#include <fpa/DataStructures/Image/PolyLineParametricPath.h>
+#include <fpa/Filters/Image/Dijkstra.h>
+
+namespace fpa
+{
+  namespace Filters
+  {
+    namespace Image
+    {
+      /**
+       */
+      template< class _TInputImage, class _TScalar >
+      class ExtractAxis
+        : public itk::ProcessObject
+      {
+      public:
+        typedef ExtractAxis               Self;
+        typedef itk::ProcessObject              Superclass;
+        typedef itk::SmartPointer< Self >       Pointer;
+        typedef itk::SmartPointer< const Self > ConstPointer;
+
+        typedef _TInputImage TInputImage;
+        typedef _TScalar     TScalar;
+        typedef typename TInputImage::IndexType TIndex;
+        typedef typename TInputImage::PointType TPoint;
+
+        itkStaticConstMacro(
+          Dimension,
+          unsigned int,
+          TInputImage::ImageDimension
+          );
+
+        typedef itk::Image< TScalar, Self::Dimension > TScalarImage;
+        typedef itk::ImageToImageFilter< TInputImage, TScalarImage > TCenterness;
+
+        typedef fpa::DataStructures::Image::PolyLineParametricPath< Self::Dimension > TPath;
+        typedef fpa::Filters::Image::Dijkstra< TScalarImage, TScalarImage > TDijkstra;
+
+      public:
+        itkNewMacro( Self );
+        itkTypeMacro( fpa::Image::ExtractAxis, itk::ProcessObject );
+
+        itkGetConstObjectMacro( Centerness, TCenterness );
+        itkGetObjectMacro( Centerness, TCenterness );
+        itkSetObjectMacro( Centerness, TCenterness );
+
+        itkGetConstMacro( StartIndex, TIndex );
+        itkSetMacro( StartIndex, TIndex );
+
+        itkGetConstMacro( EndIndex, TIndex );
+        itkSetMacro( EndIndex, TIndex );
+
+      public:
+        virtual itk::ModifiedTimeType GetMTime( ) const override;
+
+        virtual void AddSeed( const TIndex& seed );
+        virtual void AddSeed( const TPoint& seed );
+        virtual void ClearSeeds( );
+
+        void SetInput( TInputImage* input );
+        TInputImage* GetInput( );
+        const TInputImage* GetInput( ) const;
+
+        TPath* GetOutput( );
+        const TPath* GetOutput( ) const;
+
+      protected:
+        ExtractAxis( );
+        virtual ~ExtractAxis( );
+
+        virtual void GenerateData( ) override;
+
+      private:
+        // Purposely not implemented.
+        ExtractAxis( const Self& other );
+        Self& operator=( const Self& other );
+
+      protected:
+        typename TCenterness::Pointer m_Centerness;
+        typename TDijkstra::Pointer   m_Dijkstra;
+
+        TIndex m_StartIndex;
+        TIndex m_EndIndex;
+      };
+
+    } // ecapseman
+
+  } // ecapseman
+
+} // ecapseman
+
+#ifndef ITK_MANUAL_INSTANTIATION
+#  include <fpa/Filters/Image/ExtractAxis.hxx>
+#endif // ITK_MANUAL_INSTANTIATION
+#endif // __fpa__Filters__Image__ExtractAxis__h__
+
+// eof - $RCSfile$
similarity index 73%
rename from lib/fpa/Image/ExtractAxisFilter.hxx
rename to lib/fpa/Filters/Image/ExtractAxis.hxx
index 9d14fe4ef18ca53e15bb029c38266a0e5980c4eb..203ea20fd8c0b157c744e7cf9d4faa798e255387 100644 (file)
@@ -2,17 +2,16 @@
 // @author Leonardo Florez Valencia
 // @email florez-l@javeriana.edu.co
 // =========================================================================
-
-#ifndef __fpa__Image__ExtractAxisFilter__hxx__
-#define __fpa__Image__ExtractAxisFilter__hxx__
+#ifndef __fpa__Filters__Image__ExtractAxis__hxx__
+#define __fpa__Filters__Image__ExtractAxis__hxx__
 
 #include <itkSignedMaurerDistanceMapImageFilter.h>
-#include <fpa/Image/Functors/Dijkstra/Invert.h>
+#include <fpa/Functors/Dijkstra/Invert.h>
 
 // -------------------------------------------------------------------------
 template< class _TInputImage, class _TScalar >
 itk::ModifiedTimeType
-fpa::Image::ExtractAxisFilter< _TInputImage, _TScalar >::
+fpa::Filters::Image::ExtractAxis< _TInputImage, _TScalar >::
 GetMTime( ) const
 {
   itk::ModifiedTimeType a = this->Superclass::GetMTime( );
@@ -24,7 +23,7 @@ GetMTime( ) const
 
 // -------------------------------------------------------------------------
 template< class _TInputImage, class _TScalar >
-void fpa::Image::ExtractAxisFilter< _TInputImage, _TScalar >::
+void fpa::Filters::Image::ExtractAxis< _TInputImage, _TScalar >::
 AddSeed( const TIndex& seed )
 {
   this->m_Dijkstra->AddSeed( seed );
@@ -32,7 +31,7 @@ AddSeed( const TIndex& seed )
 
 // -------------------------------------------------------------------------
 template< class _TInputImage, class _TScalar >
-void fpa::Image::ExtractAxisFilter< _TInputImage, _TScalar >::
+void fpa::Filters::Image::ExtractAxis< _TInputImage, _TScalar >::
 AddSeed( const TPoint& seed )
 {
   this->m_Dijkstra->AddSeed( seed );
@@ -40,7 +39,7 @@ AddSeed( const TPoint& seed )
 
 // -------------------------------------------------------------------------
 template< class _TInputImage, class _TScalar >
-void fpa::Image::ExtractAxisFilter< _TInputImage, _TScalar >::
+void fpa::Filters::Image::ExtractAxis< _TInputImage, _TScalar >::
 ClearSeeds( )
 {
   this->m_Dijkstra->ClearSeeds( );
@@ -48,7 +47,7 @@ ClearSeeds( )
 
 // -------------------------------------------------------------------------
 template< class _TInputImage, class _TScalar >
-void fpa::Image::ExtractAxisFilter< _TInputImage, _TScalar >::
+void fpa::Filters::Image::ExtractAxis< _TInputImage, _TScalar >::
 SetInput( TInputImage* input )
 {
   this->Superclass::SetNthInput( 0, input );
@@ -56,8 +55,8 @@ SetInput( TInputImage* input )
 
 // -------------------------------------------------------------------------
 template< class _TInputImage, class _TScalar >
-typename fpa::Image::ExtractAxisFilter< _TInputImage, _TScalar >::
-TInputImage* fpa::Image::ExtractAxisFilter< _TInputImage, _TScalar >::
+typename fpa::Filters::Image::ExtractAxis< _TInputImage, _TScalar >::
+TInputImage* fpa::Filters::Image::ExtractAxis< _TInputImage, _TScalar >::
 GetInput( )
 {
   return( dynamic_cast< TInputImage* >( this->Superclass::GetInput( 0 ) ) );
@@ -65,8 +64,8 @@ GetInput( )
 
 // -------------------------------------------------------------------------
 template< class _TInputImage, class _TScalar >
-const typename fpa::Image::ExtractAxisFilter< _TInputImage, _TScalar >::
-TInputImage* fpa::Image::ExtractAxisFilter< _TInputImage, _TScalar >::
+const typename fpa::Filters::Image::ExtractAxis< _TInputImage, _TScalar >::
+TInputImage* fpa::Filters::Image::ExtractAxis< _TInputImage, _TScalar >::
 GetInput( ) const
 {
   return(
@@ -76,8 +75,8 @@ GetInput( ) const
 
 // -------------------------------------------------------------------------
 template< class _TInputImage, class _TScalar >
-typename fpa::Image::ExtractAxisFilter< _TInputImage, _TScalar >::
-TPath* fpa::Image::ExtractAxisFilter< _TInputImage, _TScalar >::
+typename fpa::Filters::Image::ExtractAxis< _TInputImage, _TScalar >::
+TPath* fpa::Filters::Image::ExtractAxis< _TInputImage, _TScalar >::
 GetOutput( )
 {
   return( dynamic_cast< TPath* >( this->Superclass::GetOutput( 0 ) ) );
@@ -85,8 +84,8 @@ GetOutput( )
 
 // -------------------------------------------------------------------------
 template< class _TInputImage, class _TScalar >
-const typename fpa::Image::ExtractAxisFilter< _TInputImage, _TScalar >::
-TPath* fpa::Image::ExtractAxisFilter< _TInputImage, _TScalar >::
+const typename fpa::Filters::Image::ExtractAxis< _TInputImage, _TScalar >::
+TPath* fpa::Filters::Image::ExtractAxis< _TInputImage, _TScalar >::
 GetOutput( ) const
 {
   return( dynamic_cast< const TPath* >( this->Superclass::GetOutput( 0 ) ) );
@@ -94,8 +93,8 @@ GetOutput( ) const
 
 // -------------------------------------------------------------------------
 template< class _TInputImage, class _TScalar >
-fpa::Image::ExtractAxisFilter< _TInputImage, _TScalar >::
-ExtractAxisFilter( )
+fpa::Filters::Image::ExtractAxis< _TInputImage, _TScalar >::
+ExtractAxis( )
   : Superclass( )
 {
   // I/O configuration
@@ -104,7 +103,7 @@ ExtractAxisFilter( )
   this->SetNthOutput( 0, TPath::New( ) );
 
   // Prepare weight function
-  typedef fpa::Image::Functors::Dijkstra::Invert< TScalarImage, TScalar > _TWeight;
+  typedef fpa::Functors::Dijkstra::Invert< TScalar > _TWeight;
   typename _TWeight::Pointer weight = _TWeight::New( );
   weight->SetAlpha( 1 );
   weight->SetBeta( 1 );
@@ -125,14 +124,14 @@ ExtractAxisFilter( )
 
 // -------------------------------------------------------------------------
 template< class _TInputImage, class _TScalar >
-fpa::Image::ExtractAxisFilter< _TInputImage, _TScalar >::
-~ExtractAxisFilter( )
+fpa::Filters::Image::ExtractAxis< _TInputImage, _TScalar >::
+~ExtractAxis( )
 {
 }
 
 // -------------------------------------------------------------------------
 template< class _TInputImage, class _TScalar >
-void fpa::Image::ExtractAxisFilter< _TInputImage, _TScalar >::
+void fpa::Filters::Image::ExtractAxis< _TInputImage, _TScalar >::
 GenerateData( )
 {
   // Execute minipipeline
@@ -147,6 +146,5 @@ GenerateData( )
     );
 }
 
-#endif // __fpa__Image__ExtractAxisFilter__hxx__
-
+#endif // __fpa__Filters__Image__ExtractAxis__hxx__
 // eof - $RCSfile$
diff --git a/lib/fpa/Filters/Image/LabelsSeedInterface.h b/lib/fpa/Filters/Image/LabelsSeedInterface.h
new file mode 100644 (file)
index 0000000..04b462a
--- /dev/null
@@ -0,0 +1,54 @@
+// =========================================================================
+// @author Leonardo Florez Valencia
+// @email florez-l@javeriana.edu.co
+// =========================================================================
+#ifndef __fpa__Filters__Image__LabelsSeedInterface__h__
+#define __fpa__Filters__Image__LabelsSeedInterface__h__
+
+namespace fpa
+{
+  namespace Filters
+  {
+    namespace Image
+    {
+      /**
+       */
+      template< class _TTraits >
+      class LabelsSeedInterface
+      {
+      public:
+        typedef LabelsSeedInterface Self;
+        typedef _TTraits            TTraits;
+        fpaInternalTraitsMacro( typename, TTraits );
+
+      public:
+        LabelsSeedInterface( itk::ProcessObject* f )
+          : m_Filter( f )
+          {
+          }
+
+        virtual ~LabelsSeedInterface( )
+          {
+          }
+
+        const TNodes& GetSeeds( ) const
+          {
+            return( this->m_UnifiedSeeds );
+          }
+
+      protected:
+        virtual void _PrepareSeeds( const itk::DataObject* input ) = 0;
+
+      protected:
+        TNodes m_UnifiedSeeds;
+        itk::ProcessObject::Pointer m_Filter;
+      };
+
+    } // ecapseman
+
+  } // ecapseman
+
+} // ecapseman
+
+#endif // __fpa__Filters__Image__LabelsSeedInterface__h__
+// eof - $RCSfile$
diff --git a/lib/fpa/Filters/Image/Mori.h b/lib/fpa/Filters/Image/Mori.h
new file mode 100644 (file)
index 0000000..66a5fa3
--- /dev/null
@@ -0,0 +1,83 @@
+// =========================================================================
+// @author Leonardo Florez Valencia
+// @email florez-l@javeriana.edu.co
+// =========================================================================
+#ifndef __fpa__Filters__Image__Mori__h__
+#define __fpa__Filters__Image__Mori__h__
+
+#include <fpa/Filters/Mori.h>
+#include <fpa/Filters/Image/Algorithm.h>
+#include <fpa/Filters/Image/DefaultTraits.h>
+#include <fpa/Filters/MarksInterface.h>
+#include <fpa/Filters/SingleSeedInterface.h>
+
+namespace fpa
+{
+  namespace Filters
+  {
+    namespace Image
+    {
+      /**
+       */
+      template< class _TInputImage, class _TOutputImage >
+      class MoriTraits
+        : public fpa::Filters::Image::DefaultTraits< _TInputImage, _TOutputImage, unsigned long >
+      {
+      public:
+        typedef _TInputImage  TInputImage;
+        typedef _TOutputImage TOutputImage;
+        typedef fpa::Filters::Image::DefaultTraits< TInputImage, TOutputImage, unsigned long > Superclass;
+
+        typedef typename Superclass::TInternalTraits TInternalTraits;
+        typedef typename Superclass::TFilter TFilter;
+        typedef fpa::Filters::MarksInterface< TInternalTraits >  TMarksInterface;
+        typedef fpa::Filters::SingleSeedInterface< TInternalTraits > TSeedsInterface;
+      };
+
+      /**
+       */
+      template< class _TInputImage, class _TOutputImage, class _TTraits = fpa::Filters::Image::MoriTraits< _TInputImage, _TOutputImage > >
+      class Mori
+        : public fpa::Filters::Image::Algorithm< fpa::Filters::Mori< _TTraits > >
+      {
+      public:
+        typedef _TInputImage  TInputImage;
+        typedef _TOutputImage TOutputImage;
+        typedef _TTraits      TTraits;
+        fpaTraitsMacro( typename, TTraits );
+
+        typedef fpa::Filters::Mori< TTraits >                TAlgorithm;
+        typedef fpa::Filters::Image::Algorithm< TAlgorithm > Superclass;
+        typedef Mori                                         Self;
+        typedef itk::SmartPointer< Self >                    Pointer;
+        typedef itk::SmartPointer< const Self >              ConstPointer;
+
+      public:
+        itkNewMacro( Self );
+        itkTypeMacro(
+          fpa::Filters::Image::Mori, fpa::Filters::Image::Algorithm
+          );
+
+      protected:
+        Mori( )
+          : Superclass( )
+          {
+          }
+        virtual ~Mori( )
+          {
+          }
+
+      private:
+        // Purposely not implemented.
+        Mori( const Self& other );
+        Self& operator=( const Self& other );
+      };
+
+    } // ecapseman
+
+  } // ecapseman
+
+} // ecapseman
+
+#endif // __fpa__Filters__Image__Mori__h__
+// eof - $RCSfile$
diff --git a/lib/fpa/Filters/Image/RandomWalker.h b/lib/fpa/Filters/Image/RandomWalker.h
new file mode 100644 (file)
index 0000000..41fba2c
--- /dev/null
@@ -0,0 +1,105 @@
+// =========================================================================
+// @author Leonardo Florez Valencia
+// @email florez-l@javeriana.edu.co
+// =========================================================================
+#ifndef __fpa__Filters__Image__RandomWalker__h__
+#define __fpa__Filters__Image__RandomWalker__h__
+
+#include <itkImage.h>
+#include <fpa/Filters/DijkstraBase.h>
+#include <fpa/Filters/Image/Algorithm.h>
+#include <fpa/Filters/Image/DefaultTraits.h>
+#include <fpa/Filters/MarksInterface.h>
+#include <fpa/Filters/Image/LabelsSeedInterface.h>
+
+namespace fpa
+{
+  namespace Filters
+  {
+    namespace Image
+    {
+      /**
+       */
+      template< class _TInputImage, class _TInputLabels, class _TCostsImage >
+      class RandomWalkerTraits
+        : public fpa::Filters::Image::DefaultTraits< _TInputImage, _TCostsImage, typename _TInputLabels::PixelType >
+      {
+      public:
+        typedef _TInputImage  TInputImage;
+        typedef _TInputLabels TInputLabels;
+        typedef _TCostsImage  TCostsImage;
+        typedef fpa::Filters::Image::DefaultTraits< TInputImage, TCostsImage, typename _TInputLabels::PixelType > Superclass;
+
+        typedef typename Superclass::TInternalTraits TInternalTraits;
+        typedef typename Superclass::TFilter TFilter;
+        typedef fpa::Filters::MarksInterface< TInternalTraits >  TMarksInterface;
+        typedef fpa::Filters::Image::LabelsSeedInterface< TInternalTraits > TSeedsInterface;
+      };
+
+      /**
+       */
+      template< class _TInputImage, class _TInputLabels, class _TCostsImage = itk::Image< float, _TInputImage::ImageDimension >, class _TTraits = fpa::Filters::Image::RandomWalkerTraits< _TInputImage, _TInputLabels, _TCostsImage > >
+      class RandomWalker
+        : public fpa::Filters::Image::Algorithm< fpa::Filters::DijkstraBase< _TTraits > >
+      {
+      public:
+        typedef _TInputImage  TInputImage;
+        typedef _TInputLabels TInputLabels;
+        typedef _TCostsImage  TCostsImage;
+        typedef _TTraits      TTraits;
+        fpaTraitsMacro( typename, TTraits );
+
+        typedef fpa::Filters::DijkstraBase< TTraits >        TAlgorithm;
+        typedef fpa::Filters::Image::Algorithm< TAlgorithm > Superclass;
+        typedef RandomWalker                                 Self;
+        typedef itk::SmartPointer< Self >                    Pointer;
+        typedef itk::SmartPointer< const Self >              ConstPointer;
+
+        typedef typename Superclass::TMarksImage TOutputLabels;
+
+      public:
+        itkNewMacro( Self );
+        itkTypeMacro(
+          fpa::Filters::Image::RandomWalker, fpa::Filters::Image::Algorithm
+          );
+
+        fpaFilterInputMacro( InputLabels, TInputLabels );
+
+      public:
+        TCostsImage* GetOutputCosts( );
+        const TCostsImage* GetOutputCosts( ) const;
+
+        TOutputLabels* GetOutputLabels( );
+        const TOutputLabels* GetOutputLabels( ) const;
+
+        TInputImage* GetInputImage( );
+        const TInputImage* GetInputImage( ) const;
+        void SetInputImage( TInputImage* image );
+
+      protected:
+        RandomWalker( );
+        virtual ~RandomWalker( );
+
+        virtual const itk::DataObject* _GetReferenceInput( ) const override;
+        virtual void _PrepareSeeds( const itk::DataObject* input ) override;
+
+      private:
+        // Purposely not implemented.
+        RandomWalker( const Self& other );
+        Self& operator=( const Self& other );
+
+      protected:
+        unsigned int m_InputLabelsIdx;
+      };
+
+    } // ecapseman
+
+  } // ecapseman
+
+} // ecapseman
+
+#ifndef ITK_MANUAL_INSTANTIATION
+#  include <fpa/Filters/Image/RandomWalker.hxx>
+#endif // ITK_MANUAL_INSTANTIATION
+#endif // __fpa__Filters__Image__RandomWalker__h__
+// eof - $RCSfile$
diff --git a/lib/fpa/Filters/Image/RandomWalker.hxx b/lib/fpa/Filters/Image/RandomWalker.hxx
new file mode 100644 (file)
index 0000000..ef858b5
--- /dev/null
@@ -0,0 +1,166 @@
+// =========================================================================
+// @author Leonardo Florez Valencia
+// @email florez-l@javeriana.edu.co
+// =========================================================================
+#ifndef __fpa__Filters__Image__RandomWalker__hxx__
+#define __fpa__Filters__Image__RandomWalker__hxx__
+
+#include <itkImageRegionConstIteratorWithIndex.h>
+
+// -------------------------------------------------------------------------
+template< class _TInputImage, class _TInputLabels, class _TCostsImage, class _TTraits >
+typename
+fpa::Filters::Image::RandomWalker< _TInputImage, _TInputLabels, _TCostsImage, _TTraits >::
+TCostsImage*
+fpa::Filters::Image::RandomWalker< _TInputImage, _TInputLabels, _TCostsImage, _TTraits >::
+GetOutputCosts( )
+{
+  return( this->GetOutput( ) );
+}
+
+// -------------------------------------------------------------------------
+template< class _TInputImage, class _TInputLabels, class _TCostsImage, class _TTraits >
+const typename
+fpa::Filters::Image::RandomWalker< _TInputImage, _TInputLabels, _TCostsImage, _TTraits >::
+TCostsImage*
+fpa::Filters::Image::RandomWalker< _TInputImage, _TInputLabels, _TCostsImage, _TTraits >::
+GetOutputCosts( ) const
+{
+  return( this->GetOutput( ) );
+}
+
+// -------------------------------------------------------------------------
+template< class _TInputImage, class _TInputLabels, class _TCostsImage, class _TTraits >
+typename
+fpa::Filters::Image::RandomWalker< _TInputImage, _TInputLabels, _TCostsImage, _TTraits >::
+TOutputLabels*
+fpa::Filters::Image::RandomWalker< _TInputImage, _TInputLabels, _TCostsImage, _TTraits >::
+GetOutputLabels( )
+{
+  return( this->GetMarks( ) );
+}
+
+// -------------------------------------------------------------------------
+template< class _TInputImage, class _TInputLabels, class _TCostsImage, class _TTraits >
+const typename
+fpa::Filters::Image::RandomWalker< _TInputImage, _TInputLabels, _TCostsImage, _TTraits >::
+TOutputLabels*
+fpa::Filters::Image::RandomWalker< _TInputImage, _TInputLabels, _TCostsImage, _TTraits >::
+GetOutputLabels( ) const
+{
+  return( this->GetMarks( ) );
+}
+
+// -------------------------------------------------------------------------
+template< class _TInputImage, class _TInputLabels, class _TCostsImage, class _TTraits >
+typename
+fpa::Filters::Image::RandomWalker< _TInputImage, _TInputLabels, _TCostsImage, _TTraits >::
+TInputImage*
+fpa::Filters::Image::RandomWalker< _TInputImage, _TInputLabels, _TCostsImage, _TTraits >::
+GetInputImage( )
+{
+  return( this->GetInput( ) );
+}
+
+// -------------------------------------------------------------------------
+template< class _TInputImage, class _TInputLabels, class _TCostsImage, class _TTraits >
+const typename
+fpa::Filters::Image::RandomWalker< _TInputImage, _TInputLabels, _TCostsImage, _TTraits >::
+TInputImage*
+fpa::Filters::Image::RandomWalker< _TInputImage, _TInputLabels, _TCostsImage, _TTraits >::
+GetInputImage( ) const
+{
+  return( this->GetInput( ) );
+}
+
+// -------------------------------------------------------------------------
+template< class _TInputImage, class _TInputLabels, class _TCostsImage, class _TTraits >
+void
+fpa::Filters::Image::RandomWalker< _TInputImage, _TInputLabels, _TCostsImage, _TTraits >::
+SetInputImage( TInputImage* image )
+{
+  this->SetInput( image );
+}
+
+// -------------------------------------------------------------------------
+template< class _TInputImage, class _TInputLabels, class _TCostsImage, class _TTraits >
+fpa::Filters::Image::RandomWalker< _TInputImage, _TInputLabels, _TCostsImage, _TTraits >::
+RandomWalker( )
+  : Superclass( )
+{
+  fpaFilterInputConfigureMacro( InputLabels, TInputLabels );
+}
+
+// -------------------------------------------------------------------------
+template< class _TInputImage, class _TInputLabels, class _TCostsImage, class _TTraits >
+fpa::Filters::Image::RandomWalker< _TInputImage, _TInputLabels, _TCostsImage, _TTraits >::
+~RandomWalker( )
+{
+}
+
+// -------------------------------------------------------------------------
+template< class _TInputImage, class _TInputLabels, class _TCostsImage, class _TTraits >
+const itk::DataObject*
+fpa::Filters::Image::RandomWalker< _TInputImage, _TInputLabels, _TCostsImage, _TTraits >::
+_GetReferenceInput( ) const
+{
+  return( this->GetInputLabels( ) );
+}
+
+// -------------------------------------------------------------------------
+template< class _TInputImage, class _TInputLabels, class _TCostsImage, class _TTraits >
+void
+fpa::Filters::Image::RandomWalker< _TInputImage, _TInputLabels, _TCostsImage, _TTraits >::
+_PrepareSeeds( const itk::DataObject* input )
+{
+  // Input object is a labelled image?
+  const TInputLabels* labels = dynamic_cast< const TInputLabels* >( input );
+  if( labels != NULL )
+  {
+    this->m_UnifiedSeeds.clear( );
+
+    // Iterate over labels
+    typedef itk::ImageRegionConstIteratorWithIndex< TInputLabels > _TIt;
+    typename TInputLabels::RegionType reg = labels->GetRequestedRegion( );
+    _TIt lIt( labels, reg );
+    for( lIt.GoToBegin( ); !lIt.IsAtEnd( ); ++lIt )
+    {
+      if( lIt.Get( ) > 0 )
+      {
+        bool is_seed = false;
+        for( unsigned int d = 0; d < Self::Dimension; ++d )
+        {
+          for( int s = -1; s <= 1; s += 2 )
+          {
+            TVertex neigh = lIt.GetIndex( );
+            neigh[ d ] += s;
+            if( reg.IsInside( neigh ) )
+              is_seed |= ( labels->GetPixel( neigh ) == 0 );
+
+          } // rof
+
+        } // rof
+
+        // Add pixel as seed or already marked
+        TNode node;
+        node.Vertex = lIt.GetIndex( );
+        node.Parent = lIt.GetIndex( );
+        node.FrontId = lIt.Get( );
+        node.Value = TOutputValue( 0 );
+        if( !is_seed )
+        {
+          this->_Mark( node.Vertex, node.FrontId );
+          this->_UpdateOutputValue( node );
+        }
+        else
+          this->m_UnifiedSeeds.insert( node );
+
+      } // fi
+
+    } // rof
+
+  } // fi
+}
+
+#endif // __fpa__Filters__Image__RandomWalker__hxx__
+// eof - $RCSfile$
diff --git a/lib/fpa/Filters/Image/RegionGrow.h b/lib/fpa/Filters/Image/RegionGrow.h
new file mode 100644 (file)
index 0000000..7004172
--- /dev/null
@@ -0,0 +1,64 @@
+// =========================================================================
+// @author Leonardo Florez Valencia
+// @email florez-l@javeriana.edu.co
+// =========================================================================
+#ifndef __fpa__Filters__Image__RegionGrow__h__
+#define __fpa__Filters__Image__RegionGrow__h__
+
+#include <fpa/Filters/RegionGrow.h>
+#include <fpa/Filters/Image/Algorithm.h>
+#include <fpa/Filters/Image/DefaultTraits.h>
+
+namespace fpa
+{
+  namespace Filters
+  {
+    namespace Image
+    {
+      /**
+       */
+      template< class _TInputImage, class _TOutputImage, class _TMark = unsigned char, class _TTraits = fpa::Filters::Image::DefaultTraits< _TInputImage, _TOutputImage, _TMark > >
+      class RegionGrow
+        : public fpa::Filters::Image::Algorithm< fpa::Filters::RegionGrow< _TTraits > >
+      {
+      public:
+        typedef _TInputImage  TInputImage;
+        typedef _TOutputImage TOutputImage;
+        typedef _TTraits      TTraits;
+        fpaTraitsMacro( typename, TTraits );
+
+        typedef fpa::Filters::RegionGrow< TTraits >          TAlgorithm;
+        typedef fpa::Filters::Image::Algorithm< TAlgorithm > Superclass;
+        typedef RegionGrow                                   Self;
+        typedef itk::SmartPointer< Self >                    Pointer;
+        typedef itk::SmartPointer< const Self >              ConstPointer;
+
+      public:
+        itkNewMacro( Self );
+        itkTypeMacro(
+          fpa::Filters::Image::RegionGrow, fpa::Filters::Image::Algorithm
+          );
+
+      protected:
+        RegionGrow( )
+          : Superclass( )
+          {
+          }
+        virtual ~RegionGrow( )
+          {
+          }
+
+      private:
+        // Purposely not implemented.
+        RegionGrow( const Self& other );
+        Self& operator=( const Self& other );
+      };
+
+    } // ecapseman
+
+  } // ecapseman
+
+} // ecapseman
+
+#endif // __fpa__Filters__Image__RegionGrow__h__
+// eof - $RCSfile$
diff --git a/lib/fpa/Filters/Image/Skeleton.h b/lib/fpa/Filters/Image/Skeleton.h
new file mode 100644 (file)
index 0000000..39fd41a
--- /dev/null
@@ -0,0 +1,153 @@
+// =========================================================================
+// @author Leonardo Florez Valencia
+// @email florez-l@javeriana.edu.co
+// =========================================================================
+#ifndef __fpa__Filters__Image__Skeleton__h__
+#define __fpa__Filters__Image__Skeleton__h__
+
+#include <map>
+#include <itkProcessObject.h>
+#include <itkSignedMaurerDistanceMapImageFilter.h>
+#include <fpa/Filters/Image/Dijkstra.h>
+#include <fpa/DataStructures/Image/Skeleton.h>
+
+namespace fpa
+{
+  namespace Filters
+  {
+    namespace Image
+    {
+      /**
+       */
+      template< class _TInputImage, class _TDistanceMap = itk::SignedMaurerDistanceMapImageFilter< _TInputImage, itk::Image< double, _TInputImage::ImageDimension > > >
+      class Skeleton
+        : public itk::ProcessObject
+      {
+      public:
+        typedef Skeleton                        Self;
+        typedef itk::ProcessObject              Superclass;
+        typedef itk::SmartPointer< Self >       Pointer;
+        typedef itk::SmartPointer< const Self > ConstPointer;
+
+        typedef _TInputImage  TInputImage;
+        typedef _TDistanceMap TDistanceMap;
+        itkStaticConstMacro(
+          Dimension,
+          unsigned int,
+          TInputImage::ImageDimension
+          );
+
+        typedef typename TDistanceMap::OutputImageType TOutputImage;
+        typedef typename TInputImage::IndexType        TIndex;
+        typedef typename TOutputImage::PixelType       TScalar;
+
+        typedef fpa::DataStructures::Image::Skeleton< Self::Dimension > TSkeleton;
+
+      protected:
+        typedef std::multimap< TScalar, TIndex > _TSkeletonQueue;
+
+        /**
+         */
+        class _TDijkstra
+          : public fpa::Filters::Image::Dijkstra< TOutputImage, TOutputImage >
+        {
+        public:
+          typedef fpa::Filters::Image::Dijkstra< TOutputImage, TOutputImage > Superclass;
+          typedef _TDijkstra                      Self;
+          typedef itk::SmartPointer< Self >       Pointer;
+          typedef itk::SmartPointer< const Self > ConstPointer;
+
+          typedef typename Superclass::TNode TNode;
+          typedef typename Superclass::TMST  TMST;
+
+        public:
+          itkNewMacro( Self );
+          itkTypeMacro( _TDijkstra, fpa::Image::Dijkstra );
+
+          itkGetConstReferenceMacro( SkeletonQueue, _TSkeletonQueue );
+
+        protected:
+          _TDijkstra( );
+          virtual ~_TDijkstra( );
+
+          virtual void _BeforeGenerateData( ) override;
+          virtual void _UpdateOutputValue( TNode& n ) override;
+
+        private:
+          // Purposely not implemented
+          _TDijkstra( const Self& other );
+          Self& operator=( const Self& other );
+
+        protected:
+          _TSkeletonQueue m_SkeletonQueue;
+        };
+        typedef typename _TDijkstra::TMST _TMST;
+
+      public:
+        itkNewMacro( Self );
+        itkTypeMacro( fpa::Image::Skeleton, fpa::Image::Dijkstra );
+
+        itkBooleanMacro( SeedFromMaximumDistance );
+        itkGetConstMacro( SeedFromMaximumDistance, bool );
+        itkSetMacro( SeedFromMaximumDistance, bool );
+
+        itkGetConstObjectMacro( DistanceMap, TDistanceMap );
+        itkGetObjectMacro( DistanceMap, TDistanceMap );
+
+        itkGetConstMacro( Seed, TIndex );
+        itkSetMacro( Seed, TIndex );
+
+      public:
+        virtual itk::ModifiedTimeType GetMTime( ) const override;
+
+        void SetInput( TInputImage* input );
+        TInputImage* GetInput( );
+        const TInputImage* GetInput( ) const;
+
+        TSkeleton* GetOutput( );
+        const TSkeleton* GetOutput( ) const;
+
+      protected:
+        Skeleton( );
+        virtual ~Skeleton( );
+
+        virtual void GenerateData( ) override;
+
+        template< class _TMarksPointer >
+        void _MarkSphere(
+          _TMarksPointer& marks,
+          const TOutputImage* dmap,
+          const TIndex& center
+          );
+
+        void _EndPoints(
+          std::vector< TIndex >& end_points,
+          const TOutputImage* dmap,
+          const _TMST* mst,
+          const _TSkeletonQueue& queue
+          );
+
+      private:
+        // Purposely not implemented.
+        Skeleton( const Self& other );
+        Self& operator=( const Self& other );
+
+      protected:
+        typename TDistanceMap::Pointer m_DistanceMap;
+        bool   m_SeedFromMaximumDistance;
+        TIndex m_Seed;
+      };
+
+    } // ecapseman
+
+  } // ecapseman
+
+} // ecapseman
+
+#ifndef ITK_MANUAL_INSTANTIATION
+#  include <fpa/Filters/Image/Skeleton.hxx>
+#endif // ITK_MANUAL_INSTANTIATION
+
+#endif // __fpa__Filters__Image__Skeleton__h__
+
+// eof - $RCSfile$
similarity index 85%
rename from lib/fpa/Image/SkeletonFilter.hxx
rename to lib/fpa/Filters/Image/Skeleton.hxx
index aa02e5976163499fae67d1f13f05aab9f48d40f9..13392a54fdba43a9c4af5dbd7c3ca7c61fc5dcc4 100644 (file)
@@ -2,23 +2,22 @@
 // @author Leonardo Florez Valencia
 // @email florez-l@javeriana.edu.co
 // =========================================================================
-
-#ifndef __fpa__Image__SkeletonFilter__hxx__
-#define __fpa__Image__SkeletonFilter__hxx__
+#ifndef __fpa__Filters__Image__Skeleton__hxx__
+#define __fpa__Filters__Image__Skeleton__hxx__
 
 #include <itkImage.h>
 #include <itkImageRegionIteratorWithIndex.h>
 #include <itkMinimumMaximumImageCalculator.h>
-#include <fpa/Image/Functors/Dijkstra/Invert.h>
+#include <fpa/Functors/Dijkstra/Invert.h>
 
 // -------------------------------------------------------------------------
 template< class _TInputImage, class _TDistanceMap >
-fpa::Image::SkeletonFilter< _TInputImage, _TDistanceMap >::_TDijkstra::
+fpa::Filters::Image::Skeleton< _TInputImage, _TDistanceMap >::_TDijkstra::
 _TDijkstra( )
   : Superclass( )
 {
   // Prepare weight function
-  typedef fpa::Image::Functors::Dijkstra::Invert< TOutputImage, TScalar > _TWeight;
+  typedef fpa::Functors::Dijkstra::Invert< TScalar > _TWeight;
   typename _TWeight::Pointer weight = _TWeight::New( );
   weight->SetAlpha( 1 );
   weight->SetBeta( 1 );
@@ -27,14 +26,14 @@ _TDijkstra( )
 
 // -------------------------------------------------------------------------
 template< class _TInputImage, class _TDistanceMap >
-fpa::Image::SkeletonFilter< _TInputImage, _TDistanceMap >::_TDijkstra::
+fpa::Filters::Image::Skeleton< _TInputImage, _TDistanceMap >::_TDijkstra::
 ~_TDijkstra( )
 {
 }
 
 // -------------------------------------------------------------------------
 template< class _TInputImage, class _TDistanceMap >
-void fpa::Image::SkeletonFilter< _TInputImage, _TDistanceMap >::_TDijkstra::
+void fpa::Filters::Image::Skeleton< _TInputImage, _TDistanceMap >::_TDijkstra::
 _BeforeGenerateData( )
 {
   this->Superclass::_BeforeGenerateData( );
@@ -43,7 +42,7 @@ _BeforeGenerateData( )
 
 // -------------------------------------------------------------------------
 template< class _TInputImage, class _TDistanceMap >
-void fpa::Image::SkeletonFilter< _TInputImage, _TDistanceMap >::_TDijkstra::
+void fpa::Filters::Image::Skeleton< _TInputImage, _TDistanceMap >::_TDijkstra::
 _UpdateOutputValue( TNode& n )
 {
   typedef typename _TSkeletonQueue::value_type _TSkeletonQueueValue;
@@ -63,7 +62,7 @@ _UpdateOutputValue( TNode& n )
 // -------------------------------------------------------------------------
 template< class _TInputImage, class _TDistanceMap >
 itk::ModifiedTimeType
-fpa::Image::SkeletonFilter< _TInputImage, _TDistanceMap >::
+fpa::Filters::Image::Skeleton< _TInputImage, _TDistanceMap >::
 GetMTime( ) const
 {
   itk::ModifiedTimeType t = this->Superclass::GetMTime( );
@@ -73,7 +72,7 @@ GetMTime( ) const
 
 // -------------------------------------------------------------------------
 template< class _TInputImage, class _TDistanceMap >
-void fpa::Image::SkeletonFilter< _TInputImage, _TDistanceMap >::
+void fpa::Filters::Image::Skeleton< _TInputImage, _TDistanceMap >::
 SetInput( TInputImage* input )
 {
   this->Superclass::SetNthInput( 0, input );
@@ -81,8 +80,8 @@ SetInput( TInputImage* input )
 
 // -------------------------------------------------------------------------
 template< class _TInputImage, class _TDistanceMap >
-typename fpa::Image::SkeletonFilter< _TInputImage, _TDistanceMap >::
-TInputImage* fpa::Image::SkeletonFilter< _TInputImage, _TDistanceMap >::
+typename fpa::Filters::Image::Skeleton< _TInputImage, _TDistanceMap >::
+TInputImage* fpa::Filters::Image::Skeleton< _TInputImage, _TDistanceMap >::
 GetInput( )
 {
   return( dynamic_cast< TInputImage* >( this->Superclass::GetInput( 0 ) ) );
@@ -90,8 +89,8 @@ GetInput( )
 
 // -------------------------------------------------------------------------
 template< class _TInputImage, class _TDistanceMap >
-const typename fpa::Image::SkeletonFilter< _TInputImage, _TDistanceMap >::
-TInputImage* fpa::Image::SkeletonFilter< _TInputImage, _TDistanceMap >::
+const typename fpa::Filters::Image::Skeleton< _TInputImage, _TDistanceMap >::
+TInputImage* fpa::Filters::Image::Skeleton< _TInputImage, _TDistanceMap >::
 GetInput( ) const
 {
   return(
@@ -101,8 +100,8 @@ GetInput( ) const
 
 // -------------------------------------------------------------------------
 template< class _TInputImage, class _TDistanceMap >
-typename fpa::Image::SkeletonFilter< _TInputImage, _TDistanceMap >::
-TSkeleton* fpa::Image::SkeletonFilter< _TInputImage, _TDistanceMap >::
+typename fpa::Filters::Image::Skeleton< _TInputImage, _TDistanceMap >::
+TSkeleton* fpa::Filters::Image::Skeleton< _TInputImage, _TDistanceMap >::
 GetOutput( )
 {
   return( dynamic_cast< TSkeleton* >( this->Superclass::GetOutput( 0 ) ) );
@@ -110,8 +109,8 @@ GetOutput( )
 
 // -------------------------------------------------------------------------
 template< class _TInputImage, class _TDistanceMap >
-const typename fpa::Image::SkeletonFilter< _TInputImage, _TDistanceMap >::
-TSkeleton* fpa::Image::SkeletonFilter< _TInputImage, _TDistanceMap >::
+const typename fpa::Filters::Image::Skeleton< _TInputImage, _TDistanceMap >::
+TSkeleton* fpa::Filters::Image::Skeleton< _TInputImage, _TDistanceMap >::
 GetOutput( ) const
 {
   return(
@@ -121,8 +120,8 @@ GetOutput( ) const
 
 // -------------------------------------------------------------------------
 template< class _TInputImage, class _TDistanceMap >
-fpa::Image::SkeletonFilter< _TInputImage, _TDistanceMap >::
-SkeletonFilter( )
+fpa::Filters::Image::Skeleton< _TInputImage, _TDistanceMap >::
+Skeleton( )
   : Superclass( ),
     m_SeedFromMaximumDistance( false )
 {
@@ -135,14 +134,14 @@ SkeletonFilter( )
 
 // -------------------------------------------------------------------------
 template< class _TInputImage, class _TDistanceMap >
-fpa::Image::SkeletonFilter< _TInputImage, _TDistanceMap >::
-~SkeletonFilter( )
+fpa::Filters::Image::Skeleton< _TInputImage, _TDistanceMap >::
+~Skeleton( )
 {
 }
 
 // -------------------------------------------------------------------------
 template< class _TInputImage, class _TDistanceMap >
-void fpa::Image::SkeletonFilter< _TInputImage, _TDistanceMap >::
+void fpa::Filters::Image::Skeleton< _TInputImage, _TDistanceMap >::
 GenerateData( )
 {
   // Update distance map
@@ -252,7 +251,7 @@ GenerateData( )
 // -------------------------------------------------------------------------
 template< class _TInputImage, class _TDistanceMap >
 template< class _TMarksPointer >
-void fpa::Image::SkeletonFilter< _TInputImage, _TDistanceMap >::
+void fpa::Filters::Image::Skeleton< _TInputImage, _TDistanceMap >::
 _MarkSphere(
   _TMarksPointer& marks, const TOutputImage* dmap, const TIndex& center
   )
@@ -300,7 +299,7 @@ _MarkSphere(
 
 // -------------------------------------------------------------------------
 template< class _TInputImage, class _TDistanceMap >
-void fpa::Image::SkeletonFilter< _TInputImage, _TDistanceMap >::
+void fpa::Filters::Image::Skeleton< _TInputImage, _TDistanceMap >::
 _EndPoints(
   std::vector< TIndex >& end_points,
   const TOutputImage* dmap,
@@ -349,6 +348,6 @@ _EndPoints(
   } // rof
 }
 
-#endif // __fpa__Image__SkeletonFilter__hxx__
+#endif // __fpa__Filters__Image__Skeleton__hxx__
 
 // eof - $RCSfile$
similarity index 56%
rename from lib/fpa/Base/MarksInterface.h
rename to lib/fpa/Filters/MarksInterface.h
index b4a84234b0539a4bacd7ce626a1ef66d5c98089b..71fc48a745af0410f6da9442623a76760369cb34 100644 (file)
@@ -2,16 +2,14 @@
 // @author Leonardo Florez Valencia
 // @email florez-l@javeriana.edu.co
 // =========================================================================
+#ifndef __fpa__Filters__MarksInterface__h__
+#define __fpa__Filters__MarksInterface__h__
 
-#ifndef __fpa__Base__MarksInterface__h__
-#define __fpa__Base__MarksInterface__h__
-
-#include <fpa/Config.h>
 #include <itkProcessObject.h>
 
 namespace fpa
 {
-  namespace Base
+  namespace Filters
   {
     /**
      */
@@ -19,24 +17,29 @@ namespace fpa
     class MarksInterface
     {
     public:
-      typedef _TTraits TTraits;
       typedef MarksInterface Self;
-      fpa_Base_TraitTypes( typename TTraits );
+      typedef _TTraits TTraits;
+      fpaInternalTraitsMacro( typename, TTraits );
 
-    protected:
-      MarksInterface( itk::ProcessObject* filter );
+    public:
+      MarksInterface( itk::ProcessObject* f );
       virtual ~MarksInterface( );
 
-      virtual bool _IsMarked( const TVertex& v ) const = 0;
+    protected:
+      virtual void _InitCollisions( unsigned long nSeeds );
+      virtual bool _Collisions( const TVertex& a, const TVertex& b );
+
+      virtual unsigned long _GetMark( const TNode& n ) const;
       virtual unsigned long _GetMark( const TVertex& v ) const = 0;
-      virtual void _Mark( const TVertex& v, unsigned long frontId ) = 0;
 
-      virtual void _InitMarks( unsigned long nSeeds );
-      virtual bool _Collisions( const TVertex& a, const TVertex& b );
+      virtual bool _IsMarked( const TNode& n ) const;
+      virtual bool _IsMarked( const TVertex& v ) const = 0;
+
+      virtual void _Mark( const TNode& n );
+      virtual void _Mark( const TVertex& v, unsigned long m ) = 0;
 
     protected:
-      unsigned int m_NumberOfSeeds;
-      itk::ProcessObject* m_Filter;
+      itk::ProcessObject::Pointer m_Filter;
     };
 
   } // ecapseman
@@ -44,9 +47,8 @@ namespace fpa
 } // ecapseman
 
 #ifndef ITK_MANUAL_INSTANTIATION
-#  include <fpa/Base/MarksInterface.hxx>
+#  include <fpa/Filters/MarksInterface.hxx>
 #endif // ITK_MANUAL_INSTANTIATION
 
-#endif // __fpa__Base__MarksInterface__h__
-
+#endif // __fpa__Filters__MarksInterface__h__
 // eof - $RCSfile$
diff --git a/lib/fpa/Filters/MarksInterface.hxx b/lib/fpa/Filters/MarksInterface.hxx
new file mode 100644 (file)
index 0000000..c6e7d17
--- /dev/null
@@ -0,0 +1,64 @@
+// =========================================================================
+// @author Leonardo Florez Valencia
+// @email florez-l@javeriana.edu.co
+// =========================================================================
+#ifndef __fpa__Filters__MarksInterface__hxx__
+#define __fpa__Filters__MarksInterface__hxx__
+
+// -------------------------------------------------------------------------
+template< class _TTraits >
+fpa::Filters::MarksInterface< _TTraits >::
+MarksInterface( itk::ProcessObject* f )
+  : m_Filter( f )
+{
+}
+
+// -------------------------------------------------------------------------
+template< class _TTraits >
+fpa::Filters::MarksInterface< _TTraits >::
+~MarksInterface( )
+{
+}
+
+// -------------------------------------------------------------------------
+template< class _TTraits >
+void fpa::Filters::MarksInterface< _TTraits >::
+_InitCollisions( unsigned long nSeeds )
+{
+  // Do nothing
+}
+
+// -------------------------------------------------------------------------
+template< class _TTraits >
+bool fpa::Filters::MarksInterface< _TTraits >::
+_Collisions( const TVertex& a, const TVertex& b )
+{
+  return( false );
+}
+
+// -------------------------------------------------------------------------
+template< class _TTraits >
+unsigned long fpa::Filters::MarksInterface< _TTraits >::
+_GetMark( const TNode& n ) const
+{
+  return( this->_GetMark( n.Vertex ) );
+}
+
+// -------------------------------------------------------------------------
+template< class _TTraits >
+bool fpa::Filters::MarksInterface< _TTraits >::
+_IsMarked( const TNode& n ) const
+{
+  return( this->_IsMarked( n.Vertex ) );
+}
+
+// -------------------------------------------------------------------------
+template< class _TTraits >
+void fpa::Filters::MarksInterface< _TTraits >::
+_Mark( const TNode& n )
+{
+  this->_Mark( n.Vertex, ( unsigned long )( n.FrontId ) );
+}
+
+#endif // __fpa__Filters__MarksInterface__hxx__
+// eof - $RCSfile$
similarity index 57%
rename from lib/fpa/Base/MarksInterfaceWithCollisions.h
rename to lib/fpa/Filters/MarksWithCollisionsInterface.h
index 767882a3c171a28258c74a740aa28a7f44ff1bca..18e13636493617d8929416f304ce374bb6616816 100644 (file)
@@ -2,29 +2,28 @@
 // @author Leonardo Florez Valencia
 // @email florez-l@javeriana.edu.co
 // =========================================================================
+#ifndef __fpa__Filters__MarksWithCollisionsInterface__h__
+#define __fpa__Filters__MarksWithCollisionsInterface__h__
 
-#ifndef __fpa__Base__MarksInterfaceWithCollisions__h__
-#define __fpa__Base__MarksInterfaceWithCollisions__h__
-
-#include <fpa/Base/MarksInterface.h>
 #include <utility>
 #include <vector>
+#include <fpa/Filters/MarksInterface.h>
 
 namespace fpa
 {
-  namespace Base
+  namespace Filters
   {
     /**
      */
     template< class _TTraits >
-    class MarksInterfaceWithCollisions
-      : public fpa::Base::MarksInterface< _TTraits >
+    class MarksWithCollisionsInterface
+      : public fpa::Filters::MarksInterface< _TTraits >
     {
     public:
-      typedef _TTraits                             TTraits;
-      typedef MarksInterfaceWithCollisions         Self;
-      typedef fpa::Base::MarksInterface< TTraits > Superclass;
-      fpa_Base_TraitTypes( typename TTraits );
+      typedef MarksWithCollisionsInterface Self;
+      typedef fpa::Filters::MarksInterface< _TTraits > Superclass;
+      typedef _TTraits TTraits;
+      fpaInternalTraitsMacro( typename, TTraits );
 
       // Minigraph to represent collisions
       typedef std::pair< TVertex, bool >    TCollision;
@@ -32,22 +31,23 @@ namespace fpa
       typedef std::vector< TCollisionsRow > TCollisions;
 
     public:
+      MarksWithCollisionsInterface( itk::ProcessObject* f );
+      virtual ~MarksWithCollisionsInterface( );
+
       bool StopAtOneFront( ) const;
       void StopAtOneFrontOn( );
       void StopAtOneFrontOff( );
       void SetStopAtOneFront( bool v );
 
     protected:
-      MarksInterfaceWithCollisions( itk::ProcessObject* filter );
-      virtual ~MarksInterfaceWithCollisions( );
-
-      virtual void _InitMarks( unsigned long nSeeds ) override;
+      virtual void _InitCollisions( unsigned long nSeeds ) override;
       virtual bool _Collisions( const TVertex& a, const TVertex& b ) override;
 
     protected:
       bool         m_StopAtOneFront;
       TCollisions  m_Collisions;
       unsigned int m_NumberOfFronts;
+      unsigned int m_NumberOfSeeds;
     };
 
   } // ecapseman
@@ -55,9 +55,8 @@ namespace fpa
 } // ecapseman
 
 #ifndef ITK_MANUAL_INSTANTIATION
-#  include <fpa/Base/MarksInterfaceWithCollisions.hxx>
+#  include <fpa/Filters/MarksWithCollisionsInterface.hxx>
 #endif // ITK_MANUAL_INSTANTIATION
 
-#endif // __fpa__Base__MarksInterfaceWithCollisions__h__
-
+#endif // __fpa__Filters__MarksWithCollisionsInterface__h__
 // eof - $RCSfile$
similarity index 76%
rename from lib/fpa/Base/MarksInterfaceWithCollisions.hxx
rename to lib/fpa/Filters/MarksWithCollisionsInterface.hxx
index b7fd33f9b9a4e3ac08c3b1ba12419fccf05d5fae..9a9852c34cd2a0b9200ca65158f1228a672390af 100644 (file)
@@ -2,15 +2,32 @@
 // @author Leonardo Florez Valencia
 // @email florez-l@javeriana.edu.co
 // =========================================================================
-
-#ifndef __fpa__Base__MarksInterfaceWithCollisions__hxx__
-#define __fpa__Base__MarksInterfaceWithCollisions__hxx__
+#ifndef __fpa__Filters__MarksWithCollisionsInterface__hxx__
+#define __fpa__Filters__MarksWithCollisionsInterface__hxx__
 
 #include <queue>
 
 // -------------------------------------------------------------------------
 template< class _TTraits >
-bool fpa::Base::MarksInterfaceWithCollisions< _TTraits >::
+fpa::Filters::MarksWithCollisionsInterface< _TTraits >::
+MarksWithCollisionsInterface( itk::ProcessObject* f )
+  : Superclass( f ),
+    m_StopAtOneFront( false ),
+    m_NumberOfFronts( 0 ),
+    m_NumberOfSeeds( 0 )
+{
+}
+
+// -------------------------------------------------------------------------
+template< class _TTraits >
+fpa::Filters::MarksWithCollisionsInterface< _TTraits >::
+~MarksWithCollisionsInterface( )
+{
+}
+
+// -------------------------------------------------------------------------
+template< class _TTraits >
+bool fpa::Filters::MarksWithCollisionsInterface< _TTraits >::
 StopAtOneFront( ) const
 {
   return( this->m_StopAtOneFront );
@@ -18,7 +35,7 @@ StopAtOneFront( ) const
 
 // -------------------------------------------------------------------------
 template< class _TTraits >
-void fpa::Base::MarksInterfaceWithCollisions< _TTraits >::
+void fpa::Filters::MarksWithCollisionsInterface< _TTraits >::
 StopAtOneFrontOn( )
 {
   this->SetStopAtOneFront( true );
@@ -26,7 +43,7 @@ StopAtOneFrontOn( )
 
 // -------------------------------------------------------------------------
 template< class _TTraits >
-void fpa::Base::MarksInterfaceWithCollisions< _TTraits >::
+void fpa::Filters::MarksWithCollisionsInterface< _TTraits >::
 StopAtOneFrontOff( )
 {
   this->SetStopAtOneFront( false );
@@ -34,7 +51,7 @@ StopAtOneFrontOff( )
 
 // -------------------------------------------------------------------------
 template< class _TTraits >
-void fpa::Base::MarksInterfaceWithCollisions< _TTraits >::
+void fpa::Filters::MarksWithCollisionsInterface< _TTraits >::
 SetStopAtOneFront( bool v )
 {
   if( this->m_StopAtOneFront != v )
@@ -48,28 +65,10 @@ SetStopAtOneFront( bool v )
 
 // -------------------------------------------------------------------------
 template< class _TTraits >
-fpa::Base::MarksInterfaceWithCollisions< _TTraits >::
-MarksInterfaceWithCollisions( itk::ProcessObject* filter )
-  : Superclass( filter ),
-    m_StopAtOneFront( false ),
-    m_NumberOfFronts( 0 )
-{
-}
-
-// -------------------------------------------------------------------------
-template< class _TTraits >
-fpa::Base::MarksInterfaceWithCollisions< _TTraits >::
-~MarksInterfaceWithCollisions( )
+void fpa::Filters::MarksWithCollisionsInterface< _TTraits >::
+_InitCollisions( unsigned long nSeeds )
 {
-}
-
-// -------------------------------------------------------------------------
-template< class _TTraits >
-void fpa::Base::MarksInterfaceWithCollisions< _TTraits >::
-_InitMarks( unsigned long nSeeds )
-{
-  this->Superclass::_InitMarks( nSeeds );
-  this->m_NumberOfFronts = nSeeds;
+  this->m_NumberOfFronts = this->m_NumberOfSeeds = nSeeds;
   TCollision coll( TVertex( ), false );
   TCollisionsRow row( this->m_NumberOfFronts, coll );
   this->m_Collisions.clear( );
@@ -78,7 +77,7 @@ _InitMarks( unsigned long nSeeds )
 
 // -------------------------------------------------------------------------
 template< class _TTraits >
-bool fpa::Base::MarksInterfaceWithCollisions< _TTraits >::
+bool fpa::Filters::MarksWithCollisionsInterface< _TTraits >::
 _Collisions( const TVertex& a, const TVertex& b )
 {
   unsigned long ma = this->_GetMark( a );
@@ -128,6 +127,5 @@ _Collisions( const TVertex& a, const TVertex& b )
     );
 }
 
-#endif // __fpa__Base__MarksInterfaceWithCollisions__hxx__
-
+#endif // __fpa__Filters__MarksWithCollisionsInterface__hxx__
 // eof - $RCSfile$
similarity index 63%
rename from lib/fpa/Base/Mori.h
rename to lib/fpa/Filters/Mori.h
index 0cc7a248410458bfe45573458e4cbb3b0e7ec270..0bda0ff6537fd79e16abd02a749ca6589770af44 100644 (file)
@@ -2,51 +2,50 @@
 // @author Leonardo Florez Valencia
 // @email florez-l@javeriana.edu.co
 // =========================================================================
-
-#ifndef __fpa__Base__Mori__h__
-#define __fpa__Base__Mori__h__
+#ifndef __fpa__Filters__Mori__h__
+#define __fpa__Filters__Mori__h__
 
 #include <deque>
 #include <set>
 #include <itkConceptChecking.h>
-#include <itkFunctionBase.h>
-#include <ivq/ITK/PeakDetector.h>
-#include <fpa/Config.h>
-#include <fpa/Base/Functors/RegionGrow/BinaryThreshold.h>
+#include <fpa/Common/PeakDetector.h>
+#include <fpa/Filters/Algorithm.h>
+#include <fpa/Functors/RegionGrow/BinaryThreshold.h>
 
 namespace fpa
 {
-  namespace Base
+  namespace Filters
   {
     /**
      */
-    template< class _TAlgorithm >
+    template< class _TTraits >
     class Mori
-      : public _TAlgorithm
+      : public fpa::Filters::Algorithm< _TTraits >
     {
     public:
-      typedef Mori                            Self;
-      typedef _TAlgorithm                     Superclass;
-      typedef itk::SmartPointer< Self >       Pointer;
-      typedef itk::SmartPointer< const Self > ConstPointer;
-
-      typedef typename _TAlgorithm::TTraits TTraits;
-      fpa_Base_TraitTypes( typename TTraits );
-
-      typedef std::deque< TNode >     TQueue;
-      typedef std::set< TInputValue > TThresholds;
+      typedef _TTraits TTraits;
+      fpaTraitsMacro( typename, TTraits );
 
-      typedef ivq::ITK::PeakDetector TPeakDetector;
-      typedef TPeakDetector::TPeak   TPeak;
+      typedef fpa::Filters::Algorithm< TTraits > Superclass;
+      typedef Mori                               Self;
+      typedef itk::SmartPointer< Self >          Pointer;
+      typedef itk::SmartPointer< const Self >    ConstPointer;
 
-      typedef fpa::Base::Functors::RegionGrow::BinaryThreshold< TInputValue > TPredicate;
+      typedef std::deque< TNode >       TQueue;
+      typedef std::set< TInputValue >   TThresholds;
+      typedef fpa::Common::PeakDetector TPeakDetector;
+      typedef TPeakDetector::TPeak      TPeak;
+      typedef fpa::Functors::RegionGrow::BinaryThreshold< TInputValue > TPredicate;
 
-    public:
+    protected:
       itkConceptMacro(
         Check_TOutputValue,
         ( itk::Concept::IsUnsignedInteger< TOutputValue > )
         );
 
+    public:
+      itkTypeMacro( fpa::Filters::Image::Mori, fpa::Filters::Algorithm );
+
       itkGetConstMacro( InsideValue, TOutputValue );
       itkSetMacro( InsideValue, TOutputValue );
 
@@ -54,24 +53,23 @@ namespace fpa
       itkSetMacro( MinimumThreshold, TInputValue );
 
     public:
-      virtual itk::ModifiedTimeType GetMTime( ) const override;
-
       TOutputValue GetOutsideValue( ) const;
       void SetOutsideValue( const TOutputValue& v );
 
       unsigned long GetSignalKernelSize( ) const;
-      double GetSignalThreshold( ) const;
-      double GetSignalInfluence( ) const;
-
       void SetSignalKernelSize( unsigned long k );
+
+      double GetSignalThreshold( ) const;
       void SetSignalThreshold( double t );
+
+      double GetSignalInfluence( ) const;
       void SetSignalInfluence( double i );
 
       void ClearThresholds( );
       void AddThreshold( const TInputValue& thr );
       void SetThresholds(
-        const TInputValue& init,
-        const TInputValue& end,
+        const TInputValue& lower,
+        const TInputValue& upper,
         const TInputValue& delta
         );
       const TThresholds& GetThresholds( ) const;
@@ -85,15 +83,14 @@ namespace fpa
       Mori( );
       virtual ~Mori( );
 
-      virtual void _BeforeGenerateData( ) override;
-      virtual void _FinishOneLoop( ) override;
-      virtual void _ComputeOutputValue( TNode& n ) override;
+      virtual void _BeforeGenerateData( );
+      virtual void _Reinitialize( );
       virtual void _UpdateOutputValue( TNode& n ) override;
       virtual void _QueueClear( ) override;
       virtual TNode _QueuePop( ) override;
-      virtual void _QueuePush( const TNode& node ) override;
+      virtual void _QueuePush( const TNode& n ) override;
       virtual unsigned long _QueueSize( ) const override;
-      virtual void _PrepareSeeds( TNodes& nodes ) override;
+      virtual void _ComputeOutputValue( TNode& n ) override;
 
     private:
       // Purposely not implemented.
@@ -104,8 +101,8 @@ namespace fpa
       typename TPredicate::Pointer m_Predicate;
 
       TOutputValue m_InsideValue;
-      TInputValue  m_MinimumThreshold;
-      TThresholds  m_Thresholds;
+      TInputValue m_MinimumThreshold;
+      TThresholds m_Thresholds;
       typename TThresholds::const_iterator m_CurrThr;
 
       TQueue       m_Queues[ 2 ];
@@ -120,9 +117,8 @@ namespace fpa
 } // ecapseman
 
 #ifndef ITK_MANUAL_INSTANTIATION
-#  include <fpa/Base/Mori.hxx>
+#  include <fpa/Filters/Mori.hxx>
 #endif // ITK_MANUAL_INSTANTIATION
 
-#endif // __fpa__Base__Mori__h__
-
+#endif // __fpa__Filters__Mori__h__
 // eof - $RCSfile$
similarity index 64%
rename from lib/fpa/Base/Mori.hxx
rename to lib/fpa/Filters/Mori.hxx
index 723e6fa285839562ccff88590825bcb14b47712b..a3969c81e6e3bea3b236754326eea07bc713b297 100644 (file)
@@ -2,82 +2,71 @@
 // @author Leonardo Florez Valencia
 // @email florez-l@javeriana.edu.co
 // =========================================================================
-
-#ifndef __fpa__Base__Mori__hxx__
-#define __fpa__Base__Mori__hxx__
-
-// -------------------------------------------------------------------------
-template< class _TAlgorithm >
-itk::ModifiedTimeType fpa::Base::Mori< _TAlgorithm >::
-GetMTime( ) const
-{
-  itk::ModifiedTimeType t = this->Superclass::GetMTime( );
-  itk::ModifiedTimeType q = this->m_Predicate->GetMTime( );
-  return( ( q < t )? q: t );
-}
+#ifndef __fpa__Filters__Mori__hxx__
+#define __fpa__Filters__Mori__hxx__
 
 // -------------------------------------------------------------------------
-template< class _TAlgorithm >
-typename fpa::Base::Mori< _TAlgorithm >::
-TOutputValue fpa::Base::Mori< _TAlgorithm >::
+template< class _TTraits >
+typename fpa::Filters::Mori< _TTraits >::
+TOutputValue fpa::Filters::Mori< _TTraits >::
 GetOutsideValue( ) const
 {
   return( this->GetInitValue( ) );
 }
 
 // -------------------------------------------------------------------------
-template< class _TAlgorithm >
-void fpa::Base::Mori< _TAlgorithm >::
+template< class _TTraits >
+void fpa::Filters::Mori< _TTraits >::
 SetOutsideValue( const TOutputValue& v )
 {
   this->SetInitValue( v );
 }
 
 // -------------------------------------------------------------------------
-template< class _TAlgorithm >
-unsigned long fpa::Base::Mori< _TAlgorithm >::
+template< class _TTraits >
+unsigned long fpa::Filters::Mori< _TTraits >::
 GetSignalKernelSize( ) const
 {
   return( this->m_PeakDetector.GetKernelSize( ) );
 }
 
 // -------------------------------------------------------------------------
-template< class _TAlgorithm >
-double fpa::Base::Mori< _TAlgorithm >::
-GetSignalThreshold( ) const
+template< class _TTraits >
+void fpa::Filters::Mori< _TTraits >::
+SetSignalKernelSize( unsigned long k )
 {
-  return( this->m_PeakDetector.GetThreshold( ) );
+  this->m_PeakDetector.SetKernelSize( k );
+  this->Modified( );
 }
 
 // -------------------------------------------------------------------------
-template< class _TAlgorithm >
-double fpa::Base::Mori< _TAlgorithm >::
-GetSignalInfluence( ) const
+template< class _TTraits >
+double fpa::Filters::Mori< _TTraits >::
+GetSignalThreshold( ) const
 {
-  return( this->m_PeakDetector.GetInfluence( ) );
+  return( this->m_PeakDetector.GetThreshold( ) );
 }
 
 // -------------------------------------------------------------------------
-template< class _TAlgorithm >
-void fpa::Base::Mori< _TAlgorithm >::
-SetSignalKernelSize( unsigned long k )
+template< class _TTraits >
+void fpa::Filters::Mori< _TTraits >::
+SetSignalThreshold( double t )
 {
-  this->m_PeakDetector.SetKernelSize( k );
+  this->m_PeakDetector.SetThreshold( t );
   this->Modified( );
 }
 
 // -------------------------------------------------------------------------
-template< class _TAlgorithm >
-void fpa::Base::Mori< _TAlgorithm >::
-SetSignalThreshold( double t )
+template< class _TTraits >
+double fpa::Filters::Mori< _TTraits >::
+GetSignalInfluence( ) const
 {
-  this->m_PeakDetector.SetThreshold( t );
-  this->Modified( );
+  return( this->m_PeakDetector.GetInfluence( ) );
 }
 
 // -------------------------------------------------------------------------
-template< class _TAlgorithm >
-void fpa::Base::Mori< _TAlgorithm >::
+template< class _TTraits >
+void fpa::Filters::Mori< _TTraits >::
 SetSignalInfluence( double i )
 {
   this->m_PeakDetector.SetInfluence( i );
@@ -85,8 +74,8 @@ SetSignalInfluence( double i )
 }
 
 // -------------------------------------------------------------------------
-template< class _TAlgorithm >
-void fpa::Base::Mori< _TAlgorithm >::
+template< class _TTraits >
+void fpa::Filters::Mori< _TTraits >::
 ClearThresholds( )
 {
   this->m_Thresholds.clear( );
@@ -94,8 +83,8 @@ ClearThresholds( )
 }
 
 // -------------------------------------------------------------------------
-template< class _TAlgorithm >
-void fpa::Base::Mori< _TAlgorithm >::
+template< class _TTraits >
+void fpa::Filters::Mori< _TTraits >::
 AddThreshold( const TInputValue& thr )
 {
   if( this->m_Thresholds.insert( thr ).second )
@@ -103,39 +92,26 @@ AddThreshold( const TInputValue& thr )
 }
 
 // -------------------------------------------------------------------------
-template< class _TAlgorithm >
-void fpa::Base::Mori< _TAlgorithm >::
-SetThresholds(
-  const TInputValue& init,
-  const TInputValue& end,
-  const TInputValue& delta
-  )
-{
-  for( TInputValue thr = init; thr <= end; thr += delta )
-    this->AddThreshold( thr );
-}
-
-// -------------------------------------------------------------------------
-template< class _TAlgorithm >
-const typename fpa::Base::Mori< _TAlgorithm >::
-TThresholds& fpa::Base::Mori< _TAlgorithm >::
+template< class _TTraits >
+const typename fpa::Filters::Mori< _TTraits >::
+TThresholds& fpa::Filters::Mori< _TTraits >::
 GetThresholds( ) const
 {
   return( this->m_Thresholds );
 }
 
 // -------------------------------------------------------------------------
-template< class _TAlgorithm >
-unsigned long fpa::Base::Mori< _TAlgorithm >::
+template< class _TTraits >
+unsigned long fpa::Filters::Mori< _TTraits >::
 GetNumberOfEvaluatedThresholds( ) const
 {
   return( this->m_PeakDetector.GetNumberOfSamples( ) );
 }
 
 // -------------------------------------------------------------------------
-template< class _TAlgorithm >
-typename fpa::Base::Mori< _TAlgorithm >::
-TInputValue fpa::Base::Mori< _TAlgorithm >::
+template< class _TTraits >
+typename fpa::Filters::Mori< _TTraits >::
+TInputValue fpa::Filters::Mori< _TTraits >::
 GetOptimumThreshold( ) const
 {
   TInputValue thr = TInputValue( 0 );
@@ -146,9 +122,11 @@ GetOptimumThreshold( ) const
 }
 
 // -------------------------------------------------------------------------
-template< class _TAlgorithm >
-void fpa::Base::Mori< _TAlgorithm >::
-GetSignalValues( unsigned long i, double& x, double& y, TPeak& p ) const
+template< class _TTraits >
+void fpa::Filters::Mori< _TTraits >::
+GetSignalValues(
+  unsigned long i, double& x, double& y, TPeak& p
+  ) const
 {
   if( i < this->m_PeakDetector.GetNumberOfSamples( ) )
   {
@@ -160,13 +138,26 @@ GetSignalValues( unsigned long i, double& x, double& y, TPeak& p ) const
 }
 
 // -------------------------------------------------------------------------
-template< class _TAlgorithm >
-fpa::Base::Mori< _TAlgorithm >::
+template< class _TTraits >
+void fpa::Filters::Mori< _TTraits >::
+SetThresholds(
+  const TInputValue& lower,
+  const TInputValue& upper,
+  const TInputValue& delta
+  )
+{
+  for( TInputValue t = lower; t <= upper; t += delta )
+    this->AddThreshold( t );
+}
+
+// -------------------------------------------------------------------------
+template< class _TTraits >
+fpa::Filters::Mori< _TTraits >::
 Mori( )
   : Superclass( ),
-     m_InsideValue( TOutputValue( 1 ) )
+    m_InsideValue( TOutputValue( 1 ) )
 {
-  this->SetInitValue( TOutputValue( 0 ) );
+  this->SetOutsideValue( 0 );
   this->m_Predicate = TPredicate::New( );
   this->m_Predicate->StrictOff( );
   if( std::numeric_limits< TInputValue >::is_integer )
@@ -179,15 +170,15 @@ Mori( )
 }
 
 // -------------------------------------------------------------------------
-template< class _TAlgorithm >
-fpa::Base::Mori< _TAlgorithm >::
+template< class _TTraits >
+fpa::Filters::Mori< _TTraits >::
 ~Mori( )
 {
 }
 
 // -------------------------------------------------------------------------
-template< class _TAlgorithm >
-void fpa::Base::Mori< _TAlgorithm >::
+template< class _TTraits >
+void fpa::Filters::Mori< _TTraits >::
 _BeforeGenerateData( )
 {
   this->Superclass::_BeforeGenerateData( );
@@ -198,9 +189,9 @@ _BeforeGenerateData( )
 
   // Prepare iteration over all thresholds
   this->m_CurrThr = this->m_Thresholds.begin( );
-  this->m_Predicate->SetLower( *( this->m_CurrThr ) );
+  this->m_Predicate->SetLowerThreshold( *( this->m_CurrThr ) );
   this->m_CurrThr++;
-  this->m_Predicate->SetUpper( *( this->m_CurrThr ) );
+  this->m_Predicate->SetUpperThreshold( *( this->m_CurrThr ) );
 
   // Prepare counting signal
   this->m_CurrCount = double( 0 );
@@ -208,9 +199,9 @@ _BeforeGenerateData( )
 }
 
 // -------------------------------------------------------------------------
-template< class _TAlgorithm >
-void fpa::Base::Mori< _TAlgorithm >::
-_FinishOneLoop( )
+template< class _TTraits >
+void fpa::Filters::Mori< _TTraits >::
+_Reinitialize( )
 {
   if( this->m_Queues[ this->m_CurrQueue ].size( ) == 0 )
   {
@@ -223,7 +214,7 @@ _FinishOneLoop( )
     if( this->m_CurrThr != this->m_Thresholds.end( ) )
     {
       // Update predicate and counting value
-      this->m_Predicate->SetUpper( *( this->m_CurrThr ) );
+      this->m_Predicate->SetUpperThreshold( *( this->m_CurrThr ) );
       this->m_CurrCount = double( 0 );
 
       // Peak detected? -> stop!
@@ -240,16 +231,8 @@ _FinishOneLoop( )
 }
 
 // -------------------------------------------------------------------------
-template< class _TAlgorithm >
-void fpa::Base::Mori< _TAlgorithm >::
-_ComputeOutputValue( TNode& n )
-{
-  // Do nothing!!!
-}
-
-// -------------------------------------------------------------------------
-template< class _TAlgorithm >
-void fpa::Base::Mori< _TAlgorithm >::
+template< class _TTraits >
+void fpa::Filters::Mori< _TTraits >::
 _UpdateOutputValue( TNode& n )
 {
   TInputValue value = this->_GetInputValue( n.Vertex );
@@ -267,12 +250,11 @@ _UpdateOutputValue( TNode& n )
     this->m_CurrCount += double( 1 );
 
   } // fi
-  this->Superclass::_UpdateOutputValue( n );
 }
 
 // -------------------------------------------------------------------------
-template< class _TAlgorithm >
-void fpa::Base::Mori< _TAlgorithm >::
+template< class _TTraits >
+void fpa::Filters::Mori< _TTraits >::
 _QueueClear( )
 {
   this->m_Queues[ 0 ].clear( );
@@ -280,9 +262,9 @@ _QueueClear( )
 }
 
 // -------------------------------------------------------------------------
-template< class _TAlgorithm >
-typename fpa::Base::Mori< _TAlgorithm >::
-TNode fpa::Base::Mori< _TAlgorithm >::
+template< class _TTraits >
+typename fpa::Filters::Mori< _TTraits >::
+TNode fpa::Filters::Mori< _TTraits >::
 _QueuePop( )
 {
   TNode n = this->m_Queues[ this->m_CurrQueue ].front( );
@@ -291,31 +273,27 @@ _QueuePop( )
 }
 
 // -------------------------------------------------------------------------
-template< class _TAlgorithm >
-void fpa::Base::Mori< _TAlgorithm >::
-_QueuePush( const TNode& node )
+template< class _TTraits >
+void fpa::Filters::Mori< _TTraits >::
+_QueuePush( const TNode& n )
 {
-  this->m_Queues[ this->m_CurrQueue ].push_back( node );
+  this->m_Queues[ this->m_CurrQueue ].push_back( n );
 }
 
 // -------------------------------------------------------------------------
-template< class _TAlgorithm >
-unsigned long fpa::Base::Mori< _TAlgorithm >::
+template< class _TTraits >
+unsigned long fpa::Filters::Mori< _TTraits >::
 _QueueSize( ) const
 {
   return( this->m_Queues[ this->m_CurrQueue ].size( ) );
 }
-
 // -------------------------------------------------------------------------
-template< class _TAlgorithm >
-void fpa::Base::Mori< _TAlgorithm >::
-_PrepareSeeds( TNodes& nodes )
+template< class _TTraits >
+void fpa::Filters::Mori< _TTraits >::
+_ComputeOutputValue( TNode& n )
 {
-  typename TNodes::iterator nIt = nodes.begin( );
-  for( ; nIt != nodes.end( ); ++nIt )
-    nIt->Value = this->m_InitValue;
+  // Do nothing
 }
 
-#endif // __fpa__Base__Mori__hxx__
-
+#endif // __fpa__Filters__Mori__hxx__
 // eof - $RCSfile$
diff --git a/lib/fpa/Filters/RegionGrow.h b/lib/fpa/Filters/RegionGrow.h
new file mode 100644 (file)
index 0000000..edf77cf
--- /dev/null
@@ -0,0 +1,95 @@
+// =========================================================================
+// @author Leonardo Florez Valencia
+// @email florez-l@javeriana.edu.co
+// =========================================================================
+#ifndef __fpa__Filters__RegionGrow__h__
+#define __fpa__Filters__RegionGrow__h__
+
+#include <deque>
+#include <itkConceptChecking.h>
+#include <itkFunctionBase.h>
+#include <fpa/Filters/Algorithm.h>
+#include <fpa/Functors/BaseVertexFunction.h>
+
+namespace fpa
+{
+  namespace Filters
+  {
+    /**
+     */
+    template< class _TTraits >
+    class RegionGrow
+      : public fpa::Filters::Algorithm< _TTraits >
+    {
+    public:
+      typedef _TTraits TTraits;
+      fpaTraitsMacro( typename, TTraits );
+
+      typedef fpa::Filters::Algorithm< TTraits > Superclass;
+      typedef RegionGrow                         Self;
+      typedef itk::SmartPointer< Self >          Pointer;
+      typedef itk::SmartPointer< const Self >    ConstPointer;
+
+      typedef std::deque< TNode >                    TQueue;
+      typedef itk::FunctionBase< TInputValue, bool > TScalarPredicate;
+      typedef fpa::Functors::BaseVertexFunction< TVertex, bool > TVertexPredicate;
+
+    protected:
+      itkConceptMacro(
+        Check_TOutputValue,
+        ( itk::Concept::IsUnsignedInteger< TOutputValue > )
+        );
+
+    public:
+      itkTypeMacro( fpa::Filters::RegionGrow, fpa::Filters::Algorithm );
+
+      itkGetConstObjectMacro( ScalarPredicate, TScalarPredicate );
+      itkGetObjectMacro( ScalarPredicate, TScalarPredicate );
+
+      itkGetConstObjectMacro( VertexPredicate, TVertexPredicate );
+      itkGetObjectMacro( VertexPredicate, TVertexPredicate );
+
+      itkGetConstMacro( InsideValue, TOutputValue );
+      itkSetMacro( InsideValue, TOutputValue );
+
+    public:
+      void SetPredicate( TScalarPredicate* p );
+      void SetPredicate( TVertexPredicate* p );
+
+      TOutputValue GetOutsideValue( ) const;
+      void SetOutsideValue( const TOutputValue& v );
+
+    protected:
+      RegionGrow( );
+      virtual ~RegionGrow( );
+
+      virtual void _UpdateOutputValue( TNode& n ) override;
+      virtual void _QueueClear( ) override;
+      virtual TNode _QueuePop( ) override;
+      virtual void _QueuePush( const TNode& n ) override;
+      virtual unsigned long _QueueSize( ) const override;
+      virtual void _ComputeOutputValue( TNode& n ) override;
+
+    private:
+      // Purposely not implemented.
+      RegionGrow( const Self& other );
+      Self& operator=( const Self& other );
+
+    protected:
+      typename TScalarPredicate::Pointer m_ScalarPredicate;
+      typename TVertexPredicate::Pointer m_VertexPredicate;
+
+      TOutputValue m_InsideValue;
+      TQueue       m_Queue;
+    };
+
+  } // ecapseman
+
+} // ecapseman
+
+#ifndef ITK_MANUAL_INSTANTIATION
+#  include <fpa/Filters/RegionGrow.hxx>
+#endif // ITK_MANUAL_INSTANTIATION
+
+#endif // __fpa__Filters__RegionGrow__h__
+// eof - $RCSfile$
diff --git a/lib/fpa/Filters/RegionGrow.hxx b/lib/fpa/Filters/RegionGrow.hxx
new file mode 100644 (file)
index 0000000..b7167e6
--- /dev/null
@@ -0,0 +1,136 @@
+// =========================================================================
+// @author Leonardo Florez Valencia
+// @email florez-l@javeriana.edu.co
+// =========================================================================
+#ifndef __fpa__Filters__RegionGrow__hxx__
+#define __fpa__Filters__RegionGrow__hxx__
+
+// -------------------------------------------------------------------------
+template< class _TTraits >
+void fpa::Filters::RegionGrow< _TTraits >::
+SetPredicate( TScalarPredicate* p )
+{
+  if( this->m_ScalarPredicate.GetPointer( ) != p )
+  {
+    this->_Deassociate( this->m_ScalarPredicate );
+    this->m_ScalarPredicate = p;
+    this->_Associate( this->m_ScalarPredicate );
+    this->Modified( );
+
+  } // fi
+}
+
+// -------------------------------------------------------------------------
+template< class _TTraits >
+void fpa::Filters::RegionGrow< _TTraits >::
+SetPredicate( TVertexPredicate* p )
+{
+  if( this->m_VertexPredicate.GetPointer( ) != p )
+  {
+    this->_Deassociate( this->m_VertexPredicate );
+    this->m_VertexPredicate = p;
+    this->_Associate( this->m_VertexPredicate );
+    this->Modified( );
+
+  } // fi
+}
+
+// -------------------------------------------------------------------------
+template< class _TTraits >
+typename fpa::Filters::RegionGrow< _TTraits >::
+TOutputValue fpa::Filters::RegionGrow< _TTraits >::
+GetOutsideValue( ) const
+{
+  return( this->GetInitValue( ) );
+}
+
+// -------------------------------------------------------------------------
+template< class _TTraits >
+void fpa::Filters::RegionGrow< _TTraits >::
+SetOutsideValue( const TOutputValue& v )
+{
+  this->SetInitValue( v );
+}
+
+// -------------------------------------------------------------------------
+template< class _TTraits >
+fpa::Filters::RegionGrow< _TTraits >::
+RegionGrow( )
+  : Superclass( ),
+    m_InsideValue( TOutputValue( 1 ) )
+{
+  this->SetOutsideValue( 0 );
+}
+
+// -------------------------------------------------------------------------
+template< class _TTraits >
+fpa::Filters::RegionGrow< _TTraits >::
+~RegionGrow( )
+{
+}
+
+// -------------------------------------------------------------------------
+template< class _TTraits >
+void fpa::Filters::RegionGrow< _TTraits >::
+_UpdateOutputValue( TNode& n )
+{
+  TInputValue value = this->_GetInputValue( n );
+  bool inside = false;
+  if( this->m_ScalarPredicate.IsNotNull( ) )
+    inside = this->m_ScalarPredicate->Evaluate( value );
+  if( this->m_VertexPredicate.IsNotNull( ) )
+    inside &= this->m_VertexPredicate->Evaluate( n.Vertex, n.Parent );
+  if( !inside )
+  {
+    n.Value = this->GetOutsideValue( );
+    n.FrontId = 0;
+  }
+  else
+    n.Value = this->GetInsideValue( );
+}
+
+// -------------------------------------------------------------------------
+template< class _TTraits >
+void fpa::Filters::RegionGrow< _TTraits >::
+_QueueClear( )
+{
+  this->m_Queue.clear( );
+}
+
+// -------------------------------------------------------------------------
+template< class _TTraits >
+typename fpa::Filters::RegionGrow< _TTraits >::
+TNode fpa::Filters::RegionGrow< _TTraits >::
+_QueuePop( )
+{
+  TNode n = this->m_Queue.front( );
+  this->m_Queue.pop_front( );
+  return( n );
+}
+
+// -------------------------------------------------------------------------
+template< class _TTraits >
+void fpa::Filters::RegionGrow< _TTraits >::
+_QueuePush( const TNode& n )
+{
+  this->m_Queue.push_back( n );
+}
+
+// -------------------------------------------------------------------------
+template< class _TTraits >
+unsigned long fpa::Filters::RegionGrow< _TTraits >::
+_QueueSize( ) const
+{
+  return( this->m_Queue.size( ) );
+}
+
+// -------------------------------------------------------------------------
+template< class _TTraits >
+void fpa::Filters::RegionGrow< _TTraits >::
+_ComputeOutputValue( TNode& n )
+{
+  // Do nothing
+}
+
+#endif // __fpa__Filters__RegionGrow__hxx__
+// eof - $RCSfile$
diff --git a/lib/fpa/Filters/SeedsInterface.h b/lib/fpa/Filters/SeedsInterface.h
new file mode 100644 (file)
index 0000000..ffcaf25
--- /dev/null
@@ -0,0 +1,55 @@
+// =========================================================================
+// @author Leonardo Florez Valencia
+// @email florez-l@javeriana.edu.co
+// =========================================================================
+#ifndef __fpa__Filters__SeedsInterface__h__
+#define __fpa__Filters__SeedsInterface__h__
+
+#include <itkDataObject.h>
+#include <itkProcessObject.h>
+#include <fpa/Config.h>
+
+namespace fpa
+{
+  namespace Filters
+  {
+    /**
+     */
+    template< class _TTraits >
+    class SeedsInterface
+    {
+    public:
+      typedef SeedsInterface Self;
+      typedef _TTraits       TTraits;
+      fpaInternalTraitsMacro( typename, TTraits );
+
+    public:
+      SeedsInterface( itk::ProcessObject* f );
+      virtual ~SeedsInterface( );
+
+      void AddSeed( const TPoint& s );
+      void AddSeed( const TVertex& s );
+      void ClearSeeds( );
+      unsigned long GetNumberOfSeeds( ) const;
+
+      const TNodes& GetSeeds( ) const;
+
+    protected:
+      virtual void _PrepareSeeds( const itk::DataObject* input );
+
+    protected:
+      TSeeds m_InputSeeds;
+      TNodes m_UnifiedSeeds;
+      itk::ProcessObject::Pointer m_Filter;
+    };
+
+  } // ecapseman
+
+} // ecapseman
+
+#ifndef ITK_MANUAL_INSTANTIATION
+#  include <fpa/Filters/SeedsInterface.hxx>
+#endif // ITK_MANUAL_INSTANTIATION
+
+#endif // __fpa__Filters__SeedsInterface__h__
+// eof - $RCSfile$
diff --git a/lib/fpa/Filters/SeedsInterface.hxx b/lib/fpa/Filters/SeedsInterface.hxx
new file mode 100644 (file)
index 0000000..43175b4
--- /dev/null
@@ -0,0 +1,98 @@
+// =========================================================================
+// @author Leonardo Florez Valencia
+// @email florez-l@javeriana.edu.co
+// =========================================================================
+#ifndef __fpa__Filters__SeedsInterface__hxx__
+#define __fpa__Filters__SeedsInterface__hxx__
+
+#include <itkImageBase.h>
+
+// -------------------------------------------------------------------------
+template< class _TTraits >
+fpa::Filters::SeedsInterface< _TTraits >::
+SeedsInterface( itk::ProcessObject* f )
+  : m_Filter( f )
+{
+}
+
+// -------------------------------------------------------------------------
+template< class _TTraits >
+fpa::Filters::SeedsInterface< _TTraits >::
+~SeedsInterface( )
+{
+}
+
+// -------------------------------------------------------------------------
+template< class _TTraits >
+void fpa::Filters::SeedsInterface< _TTraits >::
+AddSeed( const TPoint& s )
+{
+  TSeed seed( this->m_InputSeeds.size( ) + 1 );
+  seed.Point = s;
+  seed.IsPoint = true;
+  this->m_InputSeeds.push_back( seed );
+  if( this->m_Filter.IsNotNull( ) )
+    this->m_Filter->Modified( );
+}
+
+// -------------------------------------------------------------------------
+template< class _TTraits >
+void fpa::Filters::SeedsInterface< _TTraits >::
+AddSeed( const TVertex& s )
+{
+  TSeed seed( this->m_InputSeeds.size( ) + 1 );
+  seed.Vertex = s;
+  seed.IsPoint = false;
+  this->m_InputSeeds.push_back( seed );
+  if( this->m_Filter.IsNotNull( ) )
+    this->m_Filter->Modified( );
+}
+
+// -------------------------------------------------------------------------
+template< class _TTraits >
+void fpa::Filters::SeedsInterface< _TTraits >::
+ClearSeeds( )
+{
+  this->m_InputSeeds.clear( );
+  this->m_UnifiedSeeds.clear( );
+  if( this->m_Filter.IsNotNull( ) )
+    this->m_Filter->Modified( );
+}
+
+// -------------------------------------------------------------------------
+template< class _TTraits >
+const typename fpa::Filters::SeedsInterface< _TTraits >::
+TNodes& fpa::Filters::SeedsInterface< _TTraits >::
+GetSeeds( ) const
+{
+  return( this->m_UnifiedSeeds );
+}
+
+// -------------------------------------------------------------------------
+template< class _TTraits >
+void fpa::Filters::SeedsInterface< _TTraits >::
+_PrepareSeeds( const itk::DataObject* input )
+{
+  // Input object is an image?
+  typedef itk::ImageBase< Self::Dimension > _TImageBase;
+  const _TImageBase* image = dynamic_cast< const _TImageBase* >( input );
+  if( image != NULL )
+  {
+    this->m_UnifiedSeeds.clear( );
+    for( TSeed iSeed: this->m_InputSeeds )
+    {
+      if( iSeed.IsPoint )
+        image->TransformPhysicalPointToIndex( iSeed.Point, iSeed.Vertex );
+      TNode node;
+      node.Vertex = iSeed.Vertex;
+      node.Parent = iSeed.Vertex;
+      node.FrontId = iSeed.FrontId;
+      this->m_UnifiedSeeds.insert( node );
+
+    } // rof
+
+  } // fi
+}
+
+#endif // __fpa__Filters__SeedsInterface__hxx__
+// eof - $RCSfile$
diff --git a/lib/fpa/Filters/SingleSeedInterface.h b/lib/fpa/Filters/SingleSeedInterface.h
new file mode 100644 (file)
index 0000000..1e80117
--- /dev/null
@@ -0,0 +1,53 @@
+// =========================================================================
+// @author Leonardo Florez Valencia
+// @email florez-l@javeriana.edu.co
+// =========================================================================
+#ifndef __fpa__Filters__SingleSeedInterface__h__
+#define __fpa__Filters__SingleSeedInterface__h__
+
+#include <itkDataObject.h>
+#include <itkProcessObject.h>
+#include <fpa/Config.h>
+
+namespace fpa
+{
+  namespace Filters
+  {
+    /**
+     */
+    template< class _TTraits >
+    class SingleSeedInterface
+    {
+    public:
+      typedef SingleSeedInterface Self;
+      typedef _TTraits            TTraits;
+      fpaInternalTraitsMacro( typename, TTraits );
+
+    public:
+      SingleSeedInterface( itk::ProcessObject* f );
+      virtual ~SingleSeedInterface( );
+
+      void SetSeed( const TPoint& s );
+      void SetSeed( const TVertex& s );
+
+      const TNodes& GetSeeds( ) const;
+
+    protected:
+      virtual void _PrepareSeeds( const itk::DataObject* input );
+
+    protected:
+      TSeed  m_InputSeed;
+      TNodes m_UnifiedSeed;
+      itk::ProcessObject::Pointer m_Filter;
+    };
+
+  } // ecapseman
+
+} // ecapseman
+
+#ifndef ITK_MANUAL_INSTANTIATION
+#  include <fpa/Filters/SingleSeedInterface.hxx>
+#endif // ITK_MANUAL_INSTANTIATION
+
+#endif // __fpa__Filters__SingleSeedInterface__h__
+// eof - $RCSfile$
diff --git a/lib/fpa/Filters/SingleSeedInterface.hxx b/lib/fpa/Filters/SingleSeedInterface.hxx
new file mode 100644 (file)
index 0000000..c82b6b4
--- /dev/null
@@ -0,0 +1,78 @@
+// =========================================================================
+// @author Leonardo Florez Valencia
+// @email florez-l@javeriana.edu.co
+// =========================================================================
+#ifndef __fpa__Filters__SingleSeedInterface__hxx__
+#define __fpa__Filters__SingleSeedInterface__hxx__
+
+// -------------------------------------------------------------------------
+template< class _TTraits >
+fpa::Filters::SingleSeedInterface< _TTraits >::
+SingleSeedInterface( itk::ProcessObject* f )
+  : m_Filter( f )
+{
+}
+
+// -------------------------------------------------------------------------
+template< class _TTraits >
+fpa::Filters::SingleSeedInterface< _TTraits >::
+~SingleSeedInterface( )
+{
+}
+
+// -------------------------------------------------------------------------
+template< class _TTraits >
+void fpa::Filters::SingleSeedInterface< _TTraits >::
+SetSeed( const TPoint& s )
+{
+  this->m_InputSeed.Point = s;
+  this->m_InputSeed.IsPoint = true;
+  if( this->m_Filter.IsNotNull( ) )
+    this->m_Filter->Modified( );
+}
+
+// -------------------------------------------------------------------------
+template< class _TTraits >
+void fpa::Filters::SingleSeedInterface< _TTraits >::
+SetSeed( const TVertex& s )
+{
+  this->m_InputSeed.Vertex = s;
+  this->m_InputSeed.IsPoint = false;
+  if( this->m_Filter.IsNotNull( ) )
+    this->m_Filter->Modified( );
+}
+
+// -------------------------------------------------------------------------
+template< class _TTraits >
+const typename fpa::Filters::SingleSeedInterface< _TTraits >::
+TNodes& fpa::Filters::SingleSeedInterface< _TTraits >::
+GetSeeds( ) const
+{
+  return( this->m_UnifiedSeed );
+}
+
+// -------------------------------------------------------------------------
+template< class _TTraits >
+void fpa::Filters::SingleSeedInterface< _TTraits >::
+_PrepareSeeds( const itk::DataObject* input )
+{
+  // Input object is an image?
+  typedef itk::ImageBase< Self::Dimension > _TImageBase;
+  const _TImageBase* image = dynamic_cast< const _TImageBase* >( input );
+  if( image != NULL )
+  {
+    this->m_UnifiedSeed.clear( );
+    TSeed iSeed = this->m_InputSeed;
+    if( iSeed.IsPoint )
+      image->TransformPhysicalPointToIndex( iSeed.Point, iSeed.Vertex );
+    TNode node;
+    node.Vertex = iSeed.Vertex;
+    node.Parent = iSeed.Vertex;
+    node.FrontId = iSeed.FrontId;
+    this->m_UnifiedSeed.insert( node );
+
+  } // fi
+}
+
+#endif // __fpa__Filters__SingleSeedInterface__hxx__
+// eof - $RCSfile$
diff --git a/lib/fpa/Functors/BaseVertexFunction.h b/lib/fpa/Functors/BaseVertexFunction.h
new file mode 100644 (file)
index 0000000..a29fc4d
--- /dev/null
@@ -0,0 +1,110 @@
+// =========================================================================
+// @author Leonardo Florez Valencia
+// @email florez-l@javeriana.edu.co
+// =========================================================================
+#ifndef __fpa__Functors__BaseVertexFunction__h__
+#define __fpa__Functors__BaseVertexFunction__h__
+
+#include <itkDataObject.h>
+#include <itkObject.h>
+
+namespace fpa
+{
+  namespace Functors
+  {
+    /**
+     */
+    template< class _TVertex >
+    class LightBaseVertexFunction
+      : public itk::Object
+    {
+    public:
+      typedef _TVertex TVertex;
+      typedef itk::Object                     Superclass;
+      typedef LightBaseVertexFunction         Self;
+      typedef itk::SmartPointer< Self >       Pointer;
+      typedef itk::SmartPointer< const Self > ConstPointer;
+
+    public:
+      itkTypeMacro( fpa::Functors::LightBaseVertexFunction, itk::Object );
+
+      itkSetConstObjectMacro( DataObject, itk::DataObject );
+
+    public:
+      template< class _TDataObject = itk::DataObject >
+      const _TDataObject* GetDataObject( ) const
+        {
+          return(
+            dynamic_cast< const _TDataObject* >(
+              this->m_DataObject.GetPointer( )
+              )
+            );
+        }
+
+    protected:
+      LightBaseVertexFunction( )
+        : Superclass( ),
+          m_DataObject( NULL )
+        {
+        }
+
+      virtual ~LightBaseVertexFunction( )
+        {
+        }
+
+    private:
+      // Purposely not implemented.
+      LightBaseVertexFunction( const Self& other );
+      Self& operator=( const Self& other );
+
+    protected:
+      itk::DataObject::ConstPointer m_DataObject;
+    };
+
+    /**
+     */
+    template< class _TVertex, class _TValue >
+    class BaseVertexFunction
+      : public LightBaseVertexFunction< _TVertex >
+    {
+    public:
+      typedef _TVertex TVertex;
+      typedef _TValue  TValue;
+      typedef LightBaseVertexFunction< _TVertex > Superclass;
+      typedef BaseVertexFunction                  Self;
+      typedef itk::SmartPointer< Self >           Pointer;
+      typedef itk::SmartPointer< const Self >     ConstPointer;
+
+    public:
+      itkTypeMacro(
+        fpa::Functors::RegionGrow::BaseVertexFunction,
+        fpa::Functors::RegionGrow::LightBaseVertexFunction
+        );
+
+    public:
+      virtual TValue Evaluate(
+        const TVertex& vertex, const TVertex& parent
+        ) const = 0;
+
+    protected:
+      BaseVertexFunction( )
+        : Superclass( )
+        {
+        }
+
+      virtual ~BaseVertexFunction( )
+        {
+        }
+
+    private:
+      // Purposely not implemented.
+      BaseVertexFunction( const Self& other );
+      Self& operator=( const Self& other );
+    };
+
+  } // ecapseman
+
+} // ecapseman
+
+#endif // __fpa__Functors__BaseVertexFunction__h__
+// eof - $RCSfile$
diff --git a/lib/fpa/Functors/Dijkstra/Image/Gaussian.h b/lib/fpa/Functors/Dijkstra/Image/Gaussian.h
new file mode 100644 (file)
index 0000000..6cf78c5
--- /dev/null
@@ -0,0 +1,96 @@
+// =========================================================================
+// @author Leonardo Florez Valencia
+// @email florez-l@javeriana.edu.co
+// =========================================================================
+#ifndef __fpa__Functors__Dijkstra__Image__Gaussian__h__
+#define __fpa__Functors__Dijkstra__Image__Gaussian__h__
+
+#include <cmath>
+#include <fpa/Functors/BaseVertexFunction.h>
+
+namespace fpa
+{
+  namespace Functors
+  {
+    namespace Dijkstra
+    {
+      namespace Image
+      {
+        /**
+         */
+        template< class _TImage, class _TValue >
+        class Gaussian
+          : public fpa::Functors::BaseVertexFunction< typename _TImage::IndexType, _TValue >
+        {
+        public:
+          typedef _TImage TImage;
+          typedef _TValue TValue;
+          typedef typename TImage::IndexType TVertex;
+          typedef fpa::Functors::BaseVertexFunction< TVertex, TValue >  Superclass;
+          typedef Gaussian                        Self;
+          typedef itk::SmartPointer< Self >       Pointer;
+          typedef itk::SmartPointer< const Self > ConstPointer;
+
+        public:
+          itkNewMacro( Self );
+          itkTypeMacro(
+            fpa::Functors::Dijkstra::Image::Gaussian,
+            fpa::Functors::BaseVertexFunction
+            );
+
+        itkGetConstMacro( Alpha, double );
+        itkSetMacro( Alpha, double );
+
+        itkGetConstMacro( Beta, double );
+        itkSetMacro( Beta, double );
+
+        public:
+          virtual TValue Evaluate( const TVertex& v, const TVertex& p ) const override
+            {
+              const TImage* image =
+                dynamic_cast< const TImage* >(
+                  this->m_DataObject.GetPointer( )
+                  );
+              if( image != NULL )
+              {
+                double d = double( image->GetPixel( v ) );
+                d       -= double( image->GetPixel( p ) );
+                d       /= this->m_Beta;
+                d = std::exp( d * d ) - double( 1 );
+                return( TValue( std::pow( d, this->m_Alpha ) ) );
+              }
+              else
+                return( TValue( -1 ) );
+            }
+
+        protected:
+          Gaussian( )
+            : Superclass( ),
+              m_Alpha( double( 1 ) ),
+              m_Beta( double( 1 ) )
+            {
+            }
+          virtual ~Gaussian( )
+            {
+            }
+
+        private:
+          // Purposely not implemented.
+          Gaussian( const Self& other );
+          Self& operator=( const Self& other );
+
+        protected:
+          double m_Alpha;
+          double m_Beta;
+        };
+
+      } // ecapseman
+
+    } // ecapseman
+
+  } // ecapseman
+
+} // ecapseman
+
+#endif // __fpa__Functors__Dijkstra__Gaussian__h__
+// eof - $RCSfile$
diff --git a/lib/fpa/Functors/Dijkstra/Image/Identity.h b/lib/fpa/Functors/Dijkstra/Image/Identity.h
new file mode 100644 (file)
index 0000000..f699486
--- /dev/null
@@ -0,0 +1,77 @@
+// =========================================================================
+// @author Leonardo Florez Valencia
+// @email florez-l@javeriana.edu.co
+// =========================================================================
+#ifndef __fpa__Functors__Dijkstra__Image__Identity__h__
+#define __fpa__Functors__Dijkstra__Image__Identity__h__
+
+#include <fpa/Functors/BaseVertexFunction.h>
+
+namespace fpa
+{
+  namespace Functors
+  {
+    namespace Dijkstra
+    {
+      namespace Image
+      {
+        /**
+         */
+        template< class _TImage, class _TValue >
+        class Identity
+          : public fpa::Functors::BaseVertexFunction< typename _TImage::IndexType, _TValue >
+        {
+        public:
+          typedef _TImage TImage;
+          typedef _TValue TValue;
+          typedef typename TImage::IndexType TVertex;
+          typedef fpa::Functors::BaseVertexFunction< TVertex, TValue >  Superclass;
+          typedef Identity                        Self;
+          typedef itk::SmartPointer< Self >       Pointer;
+          typedef itk::SmartPointer< const Self > ConstPointer;
+
+        public:
+          itkNewMacro( Self );
+          itkTypeMacro(
+            fpa::Functors::Dijkstra::Image::Identity,
+            fpa::Functors::BaseVertexFunction
+            );
+
+        public:
+          virtual TValue Evaluate( const TVertex& v, const TVertex& p ) const override
+            {
+              const TImage* image =
+                dynamic_cast< const TImage* >(
+                  this->m_DataObject.GetPointer( )
+                  );
+              if( image != NULL )
+                return( TValue( image->GetPixel( v ) ) );
+              else
+                return( TValue( -1 ) );
+            }
+
+        protected:
+          Identity( )
+            : Superclass( )
+            {
+            }
+          virtual ~Identity( )
+            {
+            }
+
+        private:
+          // Purposely not implemented.
+          Identity( const Self& other );
+          Self& operator=( const Self& other );
+        };
+
+      } // ecapseman
+
+    } // ecapseman
+
+  } // ecapseman
+
+} // ecapseman
+
+#endif // __fpa__Functors__Dijkstra__Identity__h__
+// eof - $RCSfile$
diff --git a/lib/fpa/Functors/Dijkstra/Invert.h b/lib/fpa/Functors/Dijkstra/Invert.h
new file mode 100644 (file)
index 0000000..af9bbe7
--- /dev/null
@@ -0,0 +1,81 @@
+// =========================================================================
+// @author Leonardo Florez Valencia
+// @email florez-l@javeriana.edu.co
+// =========================================================================
+#ifndef __fpa__Functors__Dijkstra__Invert__h__
+#define __fpa__Functors__Dijkstra__Invert__h__
+
+#include <itkFunctionBase.h>
+
+namespace fpa
+{
+  namespace Functors
+  {
+    namespace Dijkstra
+    {
+      /**
+       */
+      template< class _TValue >
+      class Invert
+        : public itk::FunctionBase< _TValue, _TValue >
+      {
+      public:
+        typedef _TValue TValue;
+        typedef itk::FunctionBase< _TValue, _TValue > Superclass;
+        typedef Invert                                Self;
+        typedef itk::SmartPointer< Self >             Pointer;
+        typedef itk::SmartPointer< const Self >       ConstPointer;
+
+      public:
+        itkNewMacro( Self );
+        itkTypeMacro( fpa::Functors::Dijkstra::Invert, itk::FunctionBase );
+
+        itkGetConstMacro( Alpha, double );
+        itkSetMacro( Alpha, double );
+
+        itkGetConstMacro( Beta, double );
+        itkSetMacro( Beta, double );
+
+      public:
+        virtual TValue Evaluate( const TValue& v ) const override
+          {
+            double a = double( v );
+            double d = this->m_Alpha;
+            d += std::pow( double( a ), this->m_Beta );
+            double x = -1;
+            if( std::fabs( d ) > double( 0 ) )
+              x =
+                double( 1 ) /
+                ( this->m_Alpha + std::pow( double( a ), this->m_Beta ) );
+            return( TValue( x ) );
+          }
+
+      protected:
+        Invert( )
+          : Superclass( ),
+            m_Alpha( double( 1 ) ),
+            m_Beta( double( 1 ) )
+          {
+          }
+        virtual ~Invert( )
+          {
+          }
+
+      private:
+        // Purposely not implemented.
+        Invert( const Self& other );
+        Self& operator=( const Self& other );
+
+      protected:
+        double m_Alpha;
+        double m_Beta;
+      };
+
+    } // ecapseman
+
+  } // ecapseman
+
+} // ecapseman
+
+#endif // __fpa__Functors__Dijkstra__Invert__h__
+// eof - $RCSfile$
diff --git a/lib/fpa/Functors/RegionGrow/BinaryThreshold.h b/lib/fpa/Functors/RegionGrow/BinaryThreshold.h
new file mode 100644 (file)
index 0000000..b0fe54c
--- /dev/null
@@ -0,0 +1,78 @@
+// =========================================================================
+// @author Leonardo Florez Valencia
+// @email florez-l@javeriana.edu.co
+// =========================================================================
+#ifndef __fpa__Functors__RegionGrow__BinaryThreshold__h__
+#define __fpa__Functors__RegionGrow__BinaryThreshold__h__
+
+#include <itkFunctionBase.h>
+
+namespace fpa
+{
+  namespace Functors
+  {
+    namespace RegionGrow
+    {
+      /**
+       */
+      template< class _TValue >
+      class BinaryThreshold
+        : public itk::FunctionBase< _TValue, bool >
+      {
+      public:
+        typedef _TValue TValue;
+        typedef itk::FunctionBase< TValue, bool > Superclass;
+        typedef BinaryThreshold                   Self;
+        typedef itk::SmartPointer< Self >         Pointer;
+        typedef itk::SmartPointer< const Self >   ConstPointer;
+
+      public:
+        itkNewMacro( Self );
+        itkTypeMacro(
+          fpa::Functors::RegionGrow::BinaryThreshold, itk::FunctionBase
+          );
+
+        itkGetConstMacro( LowerThreshold, TValue );
+        itkSetMacro( LowerThreshold, TValue );
+
+        itkGetConstMacro( UpperThreshold, TValue );
+        itkSetMacro( UpperThreshold, TValue );
+
+        itkBooleanMacro( Strict );
+        itkGetConstMacro( Strict, bool );
+        itkSetMacro( Strict, bool );
+
+      public:
+        void ThresholdAbove( const TValue& a );
+        void ThresholdBetween( const TValue& a, const TValue& b );
+        void ThresholdBelow( const TValue& a );
+
+        virtual bool Evaluate( const TValue& v ) const override;
+
+      protected:
+        BinaryThreshold( );
+        virtual ~BinaryThreshold( );
+
+      private:
+        // Purposely not implemented.
+        BinaryThreshold( const Self& other );
+        Self& operator=( const Self& other );
+
+      protected:
+        TValue m_LowerThreshold;
+        TValue m_UpperThreshold;
+        bool m_Strict;
+      };
+
+    } // ecapseman
+
+  } // ecapseman
+
+} // ecapseman
+
+#ifndef ITK_MANUAL_INSTANTIATION
+#  include <fpa/Functors/RegionGrow/BinaryThreshold.hxx>
+#endif // ITK_MANUAL_INSTANTIATION
+
+#endif // __fpa__Functors__RegionGrow__BinaryThreshold__h__
+// eof - $RCSfile$
diff --git a/lib/fpa/Functors/RegionGrow/BinaryThreshold.hxx b/lib/fpa/Functors/RegionGrow/BinaryThreshold.hxx
new file mode 100644 (file)
index 0000000..f7ad48f
--- /dev/null
@@ -0,0 +1,73 @@
+// =========================================================================
+// @author Leonardo Florez Valencia
+// @email florez-l@javeriana.edu.co
+// =========================================================================
+#ifndef __fpa__Functors__RegionGrow__BinaryThreshold__hxx__
+#define __fpa__Functors__RegionGrow__BinaryThreshold__hxx__
+
+#include <limits>
+
+// -------------------------------------------------------------------------
+template< class _TValue >
+void fpa::Functors::RegionGrow::BinaryThreshold< _TValue >::
+ThresholdAbove( const TValue& a )
+{
+  this->SetLowerThreshold( a );
+  this->SetUpperThreshold( std::numeric_limits< _TValue >::max( ) );
+}
+
+// -------------------------------------------------------------------------
+template< class _TValue >
+void fpa::Functors::RegionGrow::BinaryThreshold< _TValue >::
+ThresholdBetween( const TValue& a, const TValue& b )
+{
+  this->SetLowerThreshold( ( a < b )? a: b );
+  this->SetUpperThreshold( ( b < a )? a: b );
+}
+
+// -------------------------------------------------------------------------
+template< class _TValue >
+void fpa::Functors::RegionGrow::BinaryThreshold< _TValue >::
+ThresholdBelow( const TValue& a )
+{
+  if( std::numeric_limits< _TValue >::is_integer )
+    this->SetLowerThreshold( std::numeric_limits< _TValue >::min( ) );
+  else
+    this->SetLowerThreshold( -std::numeric_limits< _TValue >::max( ) );
+  this->SetUpperThreshold( a );
+}
+
+// -------------------------------------------------------------------------
+template< class _TValue >
+bool fpa::Functors::RegionGrow::BinaryThreshold< _TValue >::
+Evaluate( const TValue& v ) const
+{
+  if( this->m_Strict )
+    return( this->m_LowerThreshold < v && v < this->m_UpperThreshold );
+  else
+    return( this->m_LowerThreshold <= v && v <= this->m_UpperThreshold );
+}
+
+// -------------------------------------------------------------------------
+template< class _TValue >
+fpa::Functors::RegionGrow::BinaryThreshold< _TValue >::
+BinaryThreshold( )
+  : Superclass( ),
+    m_Strict( true )
+{
+  this->m_UpperThreshold = std::numeric_limits< _TValue >::max( );
+  if( std::numeric_limits< _TValue >::is_integer )
+    this->m_LowerThreshold = std::numeric_limits< _TValue >::min( );
+  else
+    this->m_LowerThreshold = -this->m_UpperThreshold;
+}
+
+// -------------------------------------------------------------------------
+template< class _TValue >
+fpa::Functors::RegionGrow::BinaryThreshold< _TValue >::
+~BinaryThreshold( )
+{
+}
+
+#endif // __fpa__Functors__RegionGrow__BinaryThreshold__hxx__
+// eof - $RCSfile$
diff --git a/lib/fpa/Functors/RegionGrow/Tautology.h b/lib/fpa/Functors/RegionGrow/Tautology.h
new file mode 100644 (file)
index 0000000..94fc0db
--- /dev/null
@@ -0,0 +1,63 @@
+// =========================================================================
+// @author Leonardo Florez Valencia
+// @email florez-l@javeriana.edu.co
+// =========================================================================
+#ifndef __fpa__Functors__RegionGrow__Tautology__h__
+#define __fpa__Functors__RegionGrow__Tautology__h__
+
+#include <itkFunctionBase.h>
+
+namespace fpa
+{
+  namespace Functors
+  {
+    namespace RegionGrow
+    {
+      /**
+       */
+      template< class _TValue >
+      class Tautology
+        : public itk::FunctionBase< _TValue, bool >
+      {
+      public:
+        typedef _TValue TValue;
+        typedef itk::FunctionBase< TValue, bool > Superclass;
+        typedef Tautology                         Self;
+        typedef itk::SmartPointer< Self >         Pointer;
+        typedef itk::SmartPointer< const Self >   ConstPointer;
+
+      public:
+        itkNewMacro( Self );
+        itkTypeMacro(
+          fpa::Functors::RegionGrow::Tautology, itk::FunctionBase
+          );
+
+      public:
+        virtual bool Evaluate( const TValue& v ) const override
+          {
+            return( true );
+          }
+
+      protected:
+        Tautology( )
+          : Superclass( )
+          {
+          }
+        virtual ~Tautology( )
+          {
+          }
+
+      private:
+        // Purposely not implemented.
+        Tautology( const Self& other );
+        Self& operator=( const Self& other );
+      };
+
+    } // ecapseman
+
+  } // ecapseman
+
+} // ecapseman
+
+#endif // __fpa__Functors__RegionGrow__Tautology__h__
+// eof - $RCSfile$
diff --git a/lib/fpa/Image/Algorithm.h b/lib/fpa/Image/Algorithm.h
deleted file mode 100644 (file)
index 6bed9ad..0000000
+++ /dev/null
@@ -1,125 +0,0 @@
-// =========================================================================
-// @author Leonardo Florez Valencia
-// @email florez-l@javeriana.edu.co
-// =========================================================================
-
-#ifndef __fpa__Image__Algorithm__h__
-#define __fpa__Image__Algorithm__h__
-
-#include <itkImage.h>
-#include <itkImageToImageFilter.h>
-#include <fpa/Base/Algorithm.h>
-
-namespace fpa
-{
-  namespace Image
-  {
-    /**
-     */
-    template< class _TTraits, class _TMarks, class _TSeeds >
-    class Algorithm
-      : public fpa::Base::Algorithm< itk::ImageToImageFilter< typename _TTraits::TInputImage, typename _TTraits::TOutputImage >, _TMarks, _TSeeds >
-    {
-    public:
-      typedef _TTraits TTraits;
-      typedef _TMarks  TMarksInterface;
-      typedef _TSeeds  TSeedsInterface;
-      typedef typename TTraits::TInputImage  TInputImage;
-      typedef typename TTraits::TOutputImage TOutputImage;
-      typedef itk::ImageToImageFilter< TInputImage, TOutputImage > TFilter;
-
-      typedef fpa::Base::Algorithm< TFilter, TMarksInterface, TSeedsInterface > Superclass;
-      typedef Algorithm                       Self;
-      typedef itk::SmartPointer< Self >       Pointer;
-      typedef itk::SmartPointer< const Self > ConstPointer;
-
-      fpa_Base_TraitTypes( typename TTraits );
-
-      /* TODO
-         typedef typename TTraits::TFrontId      TFrontId;
-         typedef typename TTraits::TInputImage   TInputImage;
-         typedef typename TTraits::TInputValue   TInputValue;
-         typedef typename TTraits::TNeighborhood TNeighborhood;
-         typedef typename TTraits::TNode         TNode;
-         typedef typename TTraits::TNodes        TNodes;
-         typedef typename TTraits::TOutputImage  TOutputImage;
-         typedef typename TTraits::TOutputValue  TOutputValue;
-         typedef typename TTraits::TSeeds        TSeeds;
-         typedef typename TTraits::TVertex       TVertex;
-      */
-
-      typedef itk::Image< TFrontId, TTraits::Dimension > TMarks;
-
-      /* TODO
-         typedef _TMarksInterface TMarksInterface;
-         typedef _TSeedsInterface TSeedsInterface;
-
-         typedef typename TSeedsInterface::TTraits TTraits;
-         typedef typename TTraits::TInputImage   TInputImage;
-         typedef typename TTraits::TOutputImage  TOutputImage;
-         typedef typename TTraits::TInputValue   TInputValue;
-         typedef typename TTraits::TOutputValue  TOutputValue;
-         typedef typename TTraits::TFrontId      TFrontId;
-         typedef typename TTraits::TNeighborhood TNeighborhood;
-         typedef typename TTraits::TNode         TNode;
-         typedef typename TTraits::TNodes        TNodes;
-         typedef typename TTraits::TSeeds        TSeeds;
-         typedef typename TTraits::TVertex       TVertex;
-         typedef typename TTraits::TPoint        TPoint;
-
-         typedef itk::ImageToImageFilter< TInputImage, TOutputImage > TFilter;
-         typedef fpa::Base::Algorithm< TFilter, TMarksInterface, TSeedsInterface > Superclass;
-         typedef Algorithm                       Self;
-      */
-
-    private:
-      itkConceptMacro(
-        Marks_SameTraits,
-        ( itk::Concept::SameType< typename _TMarks::TTraits, TTraits > )
-        );
-
-    public:
-      itkTypeMacro( fpa::Image::Algorithm, fpa::Base::Algorithm );
-
-      itkGetConstMacro( NeigborhoodOrder, unsigned int );
-      itkSetMacro( NeigborhoodOrder, unsigned int );
-
-    public:
-      TMarks* GetMarks( );
-      const TMarks* GetMarks( ) const;
-
-    protected:
-      Algorithm( );
-      virtual ~Algorithm( );
-
-      virtual TNodes _UnifySeeds( ) override;
-      virtual void _ConfigureOutput( const TOutputValue& v ) override;
-      virtual TNeighborhood _GetNeighbors( const TVertex& v ) const override;
-      virtual TInputValue _GetInputValue( const TVertex& v ) const override;
-      virtual TOutputValue _GetOutputValue( const TVertex& v ) const override;
-      virtual void _UpdateOutputValue( TNode& n ) override;
-      virtual bool _IsMarked( const TVertex& v ) const override;
-      virtual unsigned long _GetMark( const TVertex& v ) const override;
-      virtual void _Mark( const TVertex& v, unsigned long frontId ) override;
-
-    private:
-      // Purposely not implemented.
-      Algorithm( const Self& other );
-      Self& operator=( const Self& other );
-
-    protected:
-      unsigned long m_MarksIdx;
-      unsigned int  m_NeigborhoodOrder;
-    };
-
-  } // ecapseman
-
-} // ecapseman
-
-#ifndef ITK_MANUAL_INSTANTIATION
-#  include <fpa/Image/Algorithm.hxx>
-#endif // ITK_MANUAL_INSTANTIATION
-
-#endif // __fpa__Image__Algorithm__h__
-
-// eof - $RCSfile$
diff --git a/lib/fpa/Image/Algorithm.hxx b/lib/fpa/Image/Algorithm.hxx
deleted file mode 100644 (file)
index 744aafa..0000000
+++ /dev/null
@@ -1,204 +0,0 @@
-// =========================================================================
-// @author Leonardo Florez Valencia
-// @email florez-l@javeriana.edu.co
-// =========================================================================
-
-#ifndef __fpa__Image__Algorithm__hxx__
-#define __fpa__Image__Algorithm__hxx__
-
-// -------------------------------------------------------------------------
-template< class _TTraits, class _TMarks, class _TSeeds >
-typename fpa::Image::Algorithm< _TTraits, _TMarks, _TSeeds >::TMarks*
-fpa::Image::Algorithm< _TTraits, _TMarks, _TSeeds >::
-GetMarks( )
-{
-  return(
-    dynamic_cast< TMarks* >(
-      this->itk::ProcessObject::GetOutput( this->m_MarksIdx )
-      )
-    );
-}
-
-// -------------------------------------------------------------------------
-template< class _TTraits, class _TMarks, class _TSeeds >
-const typename fpa::Image::Algorithm< _TTraits, _TMarks, _TSeeds >::TMarks*
-fpa::Image::Algorithm< _TTraits, _TMarks, _TSeeds >::
-GetMarks( ) const
-{
-  return(
-    dynamic_cast< const TMarks* >(
-      this->itk::ProcessObject::GetOutput( this->m_MarksIdx )
-      )
-    );
-}
-
-// -------------------------------------------------------------------------
-template< class _TTraits, class _TMarks, class _TSeeds >
-fpa::Image::Algorithm< _TTraits, _TMarks, _TSeeds >::
-Algorithm( )
-  : Superclass( ),
-    m_NeigborhoodOrder( 1 )
-{
-  this->m_MarksIdx = this->GetNumberOfRequiredOutputs( );
-  this->itk::ProcessObject::SetNumberOfRequiredOutputs( this->m_MarksIdx + 1 );
-  this->SetNthOutput( this->m_MarksIdx, TMarks::New( ) );
-}
-
-// -------------------------------------------------------------------------
-template< class _TTraits, class _TMarks, class _TSeeds >
-fpa::Image::Algorithm< _TTraits, _TMarks, _TSeeds >::
-~Algorithm( )
-{
-}
-
-// -------------------------------------------------------------------------
-template< class _TTraits, class _TMarks, class _TSeeds >
-typename fpa::Image::Algorithm< _TTraits, _TMarks, _TSeeds >::TNodes
-fpa::Image::Algorithm< _TTraits, _TMarks, _TSeeds >::
-_UnifySeeds( )
-{
-  const TInputImage* input = this->GetInput( );
-  typename TInputImage::RegionType region = input->GetRequestedRegion( );
-  TSeeds& seeds = this->GetSeeds( );
-  TNodes nodes;
-
-  typename TSeeds::iterator sIt = seeds.begin( );
-  for( ; sIt != seeds.end( ); ++sIt )
-  {
-    TNode node;
-    if( sIt->IsPoint )
-      input->TransformPhysicalPointToIndex( sIt->Point, sIt->Vertex );
-    else
-      input->TransformIndexToPhysicalPoint( sIt->Vertex, sIt->Point );
-    if( region.IsInside( sIt->Vertex ) )
-    {
-      sIt->IsUnified = true;
-      node.Vertex = sIt->Vertex;
-      node.Parent = node.Vertex;
-      if( sIt->FrontId == 0 )
-        node.FrontId = nodes.size( ) + 1;
-      else
-        node.FrontId = sIt->FrontId;
-      nodes.insert( node );
-    }
-    else
-      sIt->IsUnified = false;
-
-  } // rof
-
-  return( nodes );
-}
-
-// -------------------------------------------------------------------------
-template< class _TTraits, class _TMarks, class _TSeeds >
-void fpa::Image::Algorithm< _TTraits, _TMarks, _TSeeds >::
-_ConfigureOutput( const TOutputValue& v )
-{
-  const TInputImage* in = this->GetInput( );
-
-  TOutputImage* out = this->GetOutput( );
-  out->SetLargestPossibleRegion( in->GetLargestPossibleRegion( ) );
-  out->SetRequestedRegion( in->GetRequestedRegion( ) );
-  out->SetBufferedRegion( in->GetBufferedRegion( ) );
-  out->SetSpacing( in->GetSpacing( ) );
-  out->SetOrigin( in->GetOrigin( ) );
-  out->SetDirection( in->GetDirection( ) );
-  out->Allocate( );
-  out->FillBuffer( v );
-
-  TMarks* marks = this->GetMarks( );
-  marks->SetLargestPossibleRegion( in->GetLargestPossibleRegion( ) );
-  marks->SetRequestedRegion( in->GetRequestedRegion( ) );
-  marks->SetBufferedRegion( in->GetBufferedRegion( ) );
-  marks->SetSpacing( in->GetSpacing( ) );
-  marks->SetOrigin( in->GetOrigin( ) );
-  marks->SetDirection( in->GetDirection( ) );
-  marks->Allocate( );
-  marks->FillBuffer( TFrontId( 0 ) );
-}
-
-// -------------------------------------------------------------------------
-template< class _TTraits, class _TMarks, class _TSeeds >
-typename fpa::Image::Algorithm< _TTraits, _TMarks, _TSeeds >::TNeighborhood
-fpa::Image::Algorithm< _TTraits, _TMarks, _TSeeds >::
-_GetNeighbors( const TVertex& v ) const
-{
-  typename TInputImage::RegionType region =
-    this->GetInput( )->GetRequestedRegion( );
-  TNeighborhood neighborhood;
-  if( this->m_NeigborhoodOrder != 1 )
-  {
-    // TODO
-  }
-  else
-  {
-    for( unsigned int d = 0; d < TInputImage::ImageDimension; ++d )
-    {
-      for( int s = -1; s <= 1; s += 2 )
-      {
-        TVertex n = v;
-        n[ d ] += s;
-        if( region.IsInside( n ) )
-          neighborhood.push_back( n );
-
-      } // rof
-
-    } // rof
-
-  } // fi
-  return( neighborhood );
-}
-
-// -------------------------------------------------------------------------
-template< class _TTraits, class _TMarks, class _TSeeds >
-typename fpa::Image::Algorithm< _TTraits, _TMarks, _TSeeds >::TInputValue
-fpa::Image::Algorithm< _TTraits, _TMarks, _TSeeds >::
-_GetInputValue( const TVertex& v ) const
-{
-  return( this->GetInput( )->GetPixel( v ) );
-}
-
-// -------------------------------------------------------------------------
-template< class _TTraits, class _TMarks, class _TSeeds >
-typename fpa::Image::Algorithm< _TTraits, _TMarks, _TSeeds >::TOutputValue
-fpa::Image::Algorithm< _TTraits, _TMarks, _TSeeds >::
-_GetOutputValue( const TVertex& v ) const
-{
-  return( this->GetOutput( )->GetPixel( v ) );
-}
-
-// -------------------------------------------------------------------------
-template< class _TTraits, class _TMarks, class _TSeeds >
-void fpa::Image::Algorithm< _TTraits, _TMarks, _TSeeds >::
-_UpdateOutputValue( TNode& n )
-{
-  this->GetOutput( )->SetPixel( n.Vertex, n.Value );
-}
-
-// -------------------------------------------------------------------------
-template< class _TTraits, class _TMarks, class _TSeeds >
-bool fpa::Image::Algorithm< _TTraits, _TMarks, _TSeeds >::
-_IsMarked( const TVertex& v ) const
-{
-  return( this->GetMarks( )->GetPixel( v ) > 0 );
-}
-
-// -------------------------------------------------------------------------
-template< class _TTraits, class _TMarks, class _TSeeds >
-unsigned long fpa::Image::Algorithm< _TTraits, _TMarks, _TSeeds >::
-_GetMark( const TVertex& v ) const
-{
-  return( ( unsigned long )( this->GetMarks( )->GetPixel( v ) ) );
-}
-
-// -------------------------------------------------------------------------
-template< class _TTraits, class _TMarks, class _TSeeds >
-void fpa::Image::Algorithm< _TTraits, _TMarks, _TSeeds >::
-_Mark( const TVertex& v, unsigned long frontId )
-{
-  this->GetMarks( )->SetPixel( v, TFrontId( frontId ) );
-}
-
-#endif // __fpa__Image__Algorithm__hxx__
-
-// eof - $RCSfile$
diff --git a/lib/fpa/Image/DefaultTraits.h b/lib/fpa/Image/DefaultTraits.h
deleted file mode 100644 (file)
index b56bdec..0000000
+++ /dev/null
@@ -1,92 +0,0 @@
-// =========================================================================
-// @author Leonardo Florez Valencia
-// @email florez-l@javeriana.edu.co
-// =========================================================================
-
-#ifndef __fpa__Image__DefaultTraits__h__
-#define __fpa__Image__DefaultTraits__h__
-
-#include <set>
-#include <vector>
-#include <itkConceptChecking.h>
-#include <fpa/Base/Event.h>
-
-namespace fpa
-{
-  namespace Image
-  {
-    /**
-     */
-    template< class _TInputImage, class _TOutputImage, class _TFrontId >
-    class DefaultTraits
-    {
-    public:
-      typedef DefaultTraits Self;
-      typedef _TInputImage  TInputImage;
-      typedef _TOutputImage TOutputImage;
-      typedef _TFrontId     TFrontId;
-      itkStaticConstMacro( Dimension, unsigned int, TInputImage::ImageDimension );
-
-      typedef typename TInputImage::IndexType        TVertex;
-      typedef typename TInputImage::PixelType        TInputValue;
-      typedef typename TInputImage::PointType        TPoint;
-      typedef typename TOutputImage::PixelType       TOutputValue;
-      typedef typename TVertex::LexicographicCompare TCompare;
-
-      typedef fpa::Base::Event< TVertex > TEvent;
-      typedef std::vector< TVertex >      TNeighborhood;
-
-      struct TSeed
-      {
-        TVertex Vertex;
-        TPoint  Point;
-        bool    IsPoint;
-        bool    IsUnified;
-        TFrontId FrontId;
-        TSeed( )
-          : IsUnified( false ),
-            FrontId( TFrontId( 0 ) )
-          { }
-      };
-      typedef std::vector< TSeed > TSeeds;
-
-      struct TNode
-      {
-        TVertex  Vertex;
-        TVertex  Parent;
-        TFrontId FrontId;
-
-        // Hack to hide the fact that seed values need to be initialized
-        mutable TOutputValue Value;
-      };
-      struct TNodeCompare
-      {
-        bool operator()( const TNode& a, const TNode& b ) const
-          {
-            TCompare cmp;
-            return( cmp( a.Vertex, b.Vertex ) );
-          }
-      };
-      typedef std::set< TNode, TNodeCompare > TNodes;
-
-    private:
-      itkConceptMacro(
-        Check_SameDimension,
-        ( itk::Concept::SameDimension< Self::Dimension, TOutputImage::ImageDimension > )
-        );
-
-    private:
-      // Purposely not implemented.
-      DefaultTraits( );
-      DefaultTraits( const Self& other );
-      virtual ~DefaultTraits( );
-      Self& operator=( const Self& other );
-    };
-
-  } // ecapseman
-
-} // ecapseman
-
-#endif // __fpa__Image__DefaultTraits__h__
-
-// eof - $RCSfile$
diff --git a/lib/fpa/Image/Dijkstra.h b/lib/fpa/Image/Dijkstra.h
deleted file mode 100644 (file)
index 4262f7f..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-// =========================================================================
-// @author Leonardo Florez Valencia
-// @email florez-l@javeriana.edu.co
-// =========================================================================
-
-#ifndef __fpa__Image__Dijkstra__h__
-#define __fpa__Image__Dijkstra__h__
-
-#include <fpa/Base/Dijkstra.h>
-#include <fpa/Base/MarksInterfaceWithCollisions.h>
-#include <fpa/Base/SeedsInterface.h>
-#include <fpa/Image/Algorithm.h>
-#include <fpa/Image/DefaultTraits.h>
-#include <fpa/Image/MinimumSpanningTree.h>
-#include <fpa/Image/Functors/Dijkstra/Function.h>
-
-namespace fpa
-{
-  namespace Image
-  {
-    /**
-     */
-    template< class _TInputImage, class _TOutputImage, class _TFrontId = unsigned char, class _TTraits = fpa::Image::DefaultTraits< _TInputImage, _TOutputImage, _TFrontId > >
-    class Dijkstra
-      : public fpa::Base::Dijkstra< fpa::Image::Algorithm< _TTraits, fpa::Base::MarksInterfaceWithCollisions< _TTraits >, fpa::Base::SeedsInterface< _TTraits > >, fpa::Image::MinimumSpanningTree< _TInputImage::ImageDimension > >
-    {
-    public:
-      typedef _TInputImage  TInputImage;
-      typedef _TOutputImage TOutputImage;
-      typedef _TTraits      TTraits;
-      typedef fpa::Base::MarksInterfaceWithCollisions< TTraits > TMarksInterface;
-      typedef fpa::Base::SeedsInterface< TTraits > TSeedsInterface;
-      typedef fpa::Image::MinimumSpanningTree< _TInputImage::ImageDimension > TMST;
-
-      typedef fpa::Image::Algorithm< TTraits, TMarksInterface, TSeedsInterface > TAlgorithm;
-      typedef fpa::Base::Dijkstra< TAlgorithm, TMST > Superclass;
-      typedef Dijkstra                                Self;
-      typedef itk::SmartPointer< Self >               Pointer;
-      typedef itk::SmartPointer< const Self >         ConstPointer;
-
-      fpa_Base_TraitTypes( typename TTraits );
-
-      typedef fpa::Image::Functors::Dijkstra::Function< TInputImage, TOutputValue > TWeightFunction;
-
-    public:
-      itkNewMacro( Self );
-      itkTypeMacro( fpa::Image::Dijkstra, fpa::Base::Dijkstra );
-
-    protected:
-      Dijkstra( );
-      virtual ~Dijkstra( );
-
-      virtual void _BeforeGenerateData( ) override;
-      virtual void _ConfigureOutput( const TOutputValue& v ) override;
-
-    private:
-      // Purposely not implemented.
-      Dijkstra( const Self& other );
-      Self& operator=( const Self& other );
-    };
-
-  } // ecapseman
-
-} // ecapseman
-
-#ifndef ITK_MANUAL_INSTANTIATION
-#  include <fpa/Image/Dijkstra.hxx>
-#endif // ITK_MANUAL_INSTANTIATION
-
-#endif // __fpa__Image__Dijkstra__h__
-
-// eof - $RCSfile$
diff --git a/lib/fpa/Image/Dijkstra.hxx b/lib/fpa/Image/Dijkstra.hxx
deleted file mode 100644 (file)
index f3c6a72..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-// =========================================================================
-// @author Leonardo Florez Valencia
-// @email florez-l@javeriana.edu.co
-// =========================================================================
-
-#ifndef __fpa__Image__Dijkstra__hxx__
-#define __fpa__Image__Dijkstra__hxx__
-
-// -------------------------------------------------------------------------
-template< class _TInputImage, class _TOutputImage, class _TFrontId, class _TTraits >
-fpa::Image::Dijkstra< _TInputImage, _TOutputImage, _TFrontId, _TTraits >::
-Dijkstra( )
-  : Superclass( )
-{
-}
-
-// -------------------------------------------------------------------------
-template< class _TInputImage, class _TOutputImage, class _TFrontId, class _TTraits >
-fpa::Image::Dijkstra< _TInputImage, _TOutputImage, _TFrontId, _TTraits >::
-~Dijkstra( )
-{
-}
-
-// -------------------------------------------------------------------------
-template< class _TInputImage, class _TOutputImage, class _TFrontId, class _TTraits >
-void fpa::Image::Dijkstra< _TInputImage, _TOutputImage, _TFrontId, _TTraits >::
-_BeforeGenerateData( )
-{
-  this->Superclass::_BeforeGenerateData( );
-  TWeightFunction* wf =
-    dynamic_cast< TWeightFunction* >( this->GetWeightFunction( ) );
-  if( wf != NULL )
-    wf->SetImage( this->GetInput( ) );
-}
-
-// -------------------------------------------------------------------------
-template< class _TInputImage, class _TOutputImage, class _TFrontId, class _TTraits >
-void fpa::Image::Dijkstra< _TInputImage, _TOutputImage, _TFrontId, _TTraits >::
-_ConfigureOutput( const TOutputValue& v )
-{
-  this->Superclass::_ConfigureOutput( v );
-
-  const TInputImage* in = this->GetInput( );
-  TMST* mst = this->GetMinimumSpanningTree( );
-  mst->SetLargestPossibleRegion( in->GetLargestPossibleRegion( ) );
-  mst->SetRequestedRegion( in->GetRequestedRegion( ) );
-  mst->SetBufferedRegion( in->GetBufferedRegion( ) );
-  mst->SetSpacing( in->GetSpacing( ) );
-  mst->SetOrigin( in->GetOrigin( ) );
-  mst->SetDirection( in->GetDirection( ) );
-  mst->Allocate( );
-
-  typename TVertex::OffsetType o;
-  o.Fill( 0 );
-  mst->FillBuffer( o );
-}
-
-#endif // __fpa__Image__Dijkstra__hxx__
-
-// eof - $RCSfile$
diff --git a/lib/fpa/Image/ExtractAxisFilter.h b/lib/fpa/Image/ExtractAxisFilter.h
deleted file mode 100644 (file)
index 5c65916..0000000
+++ /dev/null
@@ -1,105 +0,0 @@
-// =========================================================================
-// @author Leonardo Florez Valencia
-// @email florez-l@javeriana.edu.co
-// =========================================================================
-
-#ifndef __fpa__Image__ExtractAxisFilter__h__
-#define __fpa__Image__ExtractAxisFilter__h__
-
-#include <itkProcessObject.h>
-#include <itkImageToImageFilter.h>
-
-#include <fpa/Image/Dijkstra.h>
-#include <fpa/Image/PolyLineParametricPath.h>
-
-namespace fpa
-{
-  namespace Image
-  {
-    /**
-     */
-    template< class _TInputImage, class _TScalar >
-    class ExtractAxisFilter
-      : public itk::ProcessObject
-    {
-    public:
-      typedef ExtractAxisFilter               Self;
-      typedef itk::ProcessObject              Superclass;
-      typedef itk::SmartPointer< Self >       Pointer;
-      typedef itk::SmartPointer< const Self > ConstPointer;
-
-      typedef _TInputImage TInputImage;
-      typedef _TScalar     TScalar;
-      typedef typename TInputImage::IndexType TIndex;
-      typedef typename TInputImage::PointType TPoint;
-
-      itkStaticConstMacro(
-        Dimension,
-        unsigned int,
-        TInputImage::ImageDimension
-        );
-
-      typedef itk::Image< TScalar, Self::Dimension > TScalarImage;
-      typedef itk::ImageToImageFilter< TInputImage, TScalarImage > TCenterness;
-
-      typedef fpa::Image::PolyLineParametricPath< Self::Dimension > TPath;
-      typedef fpa::Image::Dijkstra< TScalarImage, TScalarImage > TDijkstra;
-
-    public:
-      itkNewMacro( Self );
-      itkTypeMacro( fpa::Image::ExtractAxisFilter, fpa::Image::Dijkstra );
-
-      itkGetConstObjectMacro( Centerness, TCenterness );
-      itkGetObjectMacro( Centerness, TCenterness );
-      itkSetObjectMacro( Centerness, TCenterness );
-
-      itkGetConstMacro( StartIndex, TIndex );
-      itkSetMacro( StartIndex, TIndex );
-
-      itkGetConstMacro( EndIndex, TIndex );
-      itkSetMacro( EndIndex, TIndex );
-
-    public:
-      virtual itk::ModifiedTimeType GetMTime( ) const override;
-
-      virtual void AddSeed( const TIndex& seed );
-      virtual void AddSeed( const TPoint& seed );
-      virtual void ClearSeeds( );
-
-      void SetInput( TInputImage* input );
-      TInputImage* GetInput( );
-      const TInputImage* GetInput( ) const;
-
-      TPath* GetOutput( );
-      const TPath* GetOutput( ) const;
-
-    protected:
-      ExtractAxisFilter( );
-      virtual ~ExtractAxisFilter( );
-
-      virtual void GenerateData( ) override;
-
-    private:
-      // Purposely not implemented.
-      ExtractAxisFilter( const Self& other );
-      Self& operator=( const Self& other );
-
-    protected:
-      typename TCenterness::Pointer m_Centerness;
-      typename TDijkstra::Pointer   m_Dijkstra;
-
-      TIndex m_StartIndex;
-      TIndex m_EndIndex;
-    };
-
-  } // ecapseman
-
-} // ecapseman
-
-#ifndef ITK_MANUAL_INSTANTIATION
-#  include <fpa/Image/ExtractAxisFilter.hxx>
-#endif // ITK_MANUAL_INSTANTIATION
-
-#endif // __fpa__Image__ExtractAxisFilter__h__
-
-// eof - $RCSfile$
diff --git a/lib/fpa/Image/Functors/Dijkstra/Function.h b/lib/fpa/Image/Functors/Dijkstra/Function.h
deleted file mode 100644 (file)
index e9fa0b2..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-// =========================================================================
-// @author Leonardo Florez Valencia
-// @email florez-l@javeriana.edu.co
-// =========================================================================
-
-#ifndef __fpa__Image__Functors__Dijkstra__Function__h__
-#define __fpa__Image__Functors__Dijkstra__Function__h__
-
-#include <fpa/Base/Functors/Dijkstra/Function.h>
-
-namespace fpa
-{
-  namespace Image
-  {
-    namespace Functors
-    {
-      namespace Dijkstra
-      {
-        /**
-         */
-        template< class _TInputImage, class _TOutputValue >
-        class Function
-          : public fpa::Base::Functors::Dijkstra::Function< typename _TInputImage::IndexType, _TOutputValue >
-        {
-        public:
-          typedef typename _TInputImage::IndexType TVertex;
-          typedef Function Self;
-          typedef fpa::Base::Functors::Dijkstra::Function< TVertex, _TOutputValue > Superclass;
-          typedef itk::SmartPointer< Self >       Pointer;
-          typedef itk::SmartPointer< const Self > ConstPointer;
-
-        public:
-          itkTypeMacro(
-            fpa::Image::Functors::Dijkstra::Function,
-            fpa::Base::Functors::Dijkstra::Function
-            );
-
-          itkGetConstObjectMacro( Image, _TInputImage );
-          itkSetConstObjectMacro( Image, _TInputImage );
-
-        protected:
-          Function( )
-            : Superclass( )
-            {
-            }
-          virtual ~Function( )
-            {
-            }
-
-        private:
-          // Purposely not implemented
-          Function( const Self& other );
-          Self& operator=( const Self& other );
-
-        protected:
-          typename _TInputImage::ConstPointer m_Image;
-        };
-
-      } // ecapseman
-
-    } // ecapseman
-
-  } // ecapseman
-
-} // ecapseman
-
-#endif // __fpa__Image__Functors__Dijkstra__Function__h__
-
-// eof - $RCSfile$
diff --git a/lib/fpa/Image/Functors/Dijkstra/Gaussian.h b/lib/fpa/Image/Functors/Dijkstra/Gaussian.h
deleted file mode 100644 (file)
index d06d84d..0000000
+++ /dev/null
@@ -1,91 +0,0 @@
-// =========================================================================
-// @author Leonardo Florez Valencia
-// @email florez-l@javeriana.edu.co
-// =========================================================================
-
-#ifndef __fpa__Image__Functors__Dijkstra__Gaussian__h__
-#define __fpa__Image__Functors__Dijkstra__Gaussian__h__
-
-#include <cmath>
-#include <fpa/Image/Functors/Dijkstra/Function.h>
-
-namespace fpa
-{
-  namespace Image
-  {
-    namespace Functors
-    {
-      namespace Dijkstra
-      {
-        /**
-         * w_{i,j}=\left(\exp\left(\left(\frac{w_{i}-w_{j}}{\beta}\right)^{2}\right)-1\right)^{\alpha}
-         */
-        template< class _TInputImage, class _TOutputValue >
-        class Gaussian
-          : public fpa::Image::Functors::Dijkstra::Function< _TInputImage, _TOutputValue >
-        {
-        public:
-          typedef Gaussian Self;
-          typedef fpa::Image::Functors::Dijkstra::Function< _TInputImage, _TOutputValue > Superclass;
-          typedef itk::SmartPointer< Self >       Pointer;
-          typedef itk::SmartPointer< const Self > ConstPointer;
-
-          typedef typename Superclass::TVertex TVertex;
-
-        public:
-          itkNewMacro( Self );
-          itkTypeMacro(
-            fpa::Image::Functors::Dijkstra::Gaussian,
-            fpa::Image::Functors::Dijkstra::Function
-            );
-
-          itkGetConstMacro( Alpha, double );
-          itkSetMacro( Alpha, double );
-
-          itkGetConstMacro( Beta, double );
-          itkSetMacro( Beta, double );
-
-        public:
-          virtual _TOutputValue Evaluate(
-            const TVertex& v, const TVertex& p
-            ) const override
-            {
-              double d = double( this->m_Image->GetPixel( v ) );
-              d       -= double( this->m_Image->GetPixel( p ) );
-              d       /= this->m_Beta;
-              d = std::exp( d * d ) - double( 1 );
-              return( _TOutputValue( std::pow( d, this->m_Alpha ) ) );
-            }
-
-        protected:
-          Gaussian( )
-            : Superclass( ),
-              m_Alpha( double( 1 ) ),
-              m_Beta( double( 1 ) )
-            {
-            }
-          virtual ~Gaussian( )
-            {
-            }
-
-        private:
-          // Purposely not implemented
-          Gaussian( const Self& other );
-          Self& operator=( const Self& other );
-
-        protected:
-          double m_Alpha;
-          double m_Beta;
-        };
-
-      } // ecapseman
-
-    } // ecapseman
-
-  } // ecapseman
-
-} // ecapseman
-
-#endif // __fpa__Image__Functors__Dijkstra__Gaussian__h__
-
-// eof - $RCSfile$
diff --git a/lib/fpa/Image/Functors/Dijkstra/Identity.h b/lib/fpa/Image/Functors/Dijkstra/Identity.h
deleted file mode 100644 (file)
index 3a0b370..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-// =========================================================================
-// @author Leonardo Florez Valencia
-// @email florez-l@javeriana.edu.co
-// =========================================================================
-
-#ifndef __fpa__Image__Functors__Dijkstra__Identity__h__
-#define __fpa__Image__Functors__Dijkstra__Identity__h__
-
-#include <fpa/Image/Functors/Dijkstra/Function.h>
-
-namespace fpa
-{
-  namespace Image
-  {
-    namespace Functors
-    {
-      namespace Dijkstra
-      {
-        /**
-         */
-        template< class _TInputImage, class _TOutputValue >
-        class Identity
-          : public fpa::Image::Functors::Dijkstra::Function< _TInputImage, _TOutputValue >
-        {
-        public:
-          typedef Identity Self;
-          typedef fpa::Image::Functors::Dijkstra::Function< _TInputImage, _TOutputValue > Superclass;
-          typedef itk::SmartPointer< Self >       Pointer;
-          typedef itk::SmartPointer< const Self > ConstPointer;
-
-          typedef typename Superclass::TVertex TVertex;
-
-        public:
-          itkNewMacro( Self );
-          itkTypeMacro(
-            fpa::Image::Functors::Dijkstra::Identity,
-            fpa::Image::Functors::Dijkstra::Function
-            );
-
-        public:
-          virtual _TOutputValue Evaluate(
-            const TVertex& v, const TVertex& p
-            ) const override
-            {
-              return( _TOutputValue( this->m_Image->GetPixel( v ) ) );
-            }
-
-        protected:
-          Identity( )
-            : Superclass( )
-            {
-            }
-          virtual ~Identity( )
-            {
-            }
-
-        private:
-          // Purposely not implemented
-          Identity( const Self& other );
-          Self& operator=( const Self& other );
-        };
-
-      } // ecapseman
-
-    } // ecapseman
-
-  } // ecapseman
-
-} // ecapseman
-
-#endif // __fpa__Image__Functors__Dijkstra__Identity__h__
-
-// eof - $RCSfile$
diff --git a/lib/fpa/Image/Functors/Dijkstra/Invert.h b/lib/fpa/Image/Functors/Dijkstra/Invert.h
deleted file mode 100644 (file)
index 8341f2e..0000000
+++ /dev/null
@@ -1,94 +0,0 @@
-// =========================================================================
-// @author Leonardo Florez Valencia
-// @email florez-l@javeriana.edu.co
-// =========================================================================
-
-#ifndef __fpa__Image__Functors__Dijkstra__Invert__h__
-#define __fpa__Image__Functors__Dijkstra__Invert__h__
-
-#include <cmath>
-#include <fpa/Image/Functors/Dijkstra/Function.h>
-
-namespace fpa
-{
-  namespace Image
-  {
-    namespace Functors
-    {
-      namespace Dijkstra
-      {
-        /**
-         */
-        template< class _TInputImage, class _TOutputValue >
-        class Invert
-          : public fpa::Image::Functors::Dijkstra::Function< _TInputImage, _TOutputValue >
-        {
-        public:
-          typedef Invert Self;
-          typedef fpa::Image::Functors::Dijkstra::Function< _TInputImage, _TOutputValue > Superclass;
-          typedef itk::SmartPointer< Self >       Pointer;
-          typedef itk::SmartPointer< const Self > ConstPointer;
-
-          typedef typename Superclass::TVertex TVertex;
-
-        public:
-          itkNewMacro( Self );
-          itkTypeMacro(
-            fpa::Image::Functors::Dijkstra::Invert,
-            fpa::Image::Functors::Dijkstra::Function
-            );
-
-          itkGetConstMacro( Alpha, double );
-          itkGetConstMacro( Beta, double );
-
-          itkSetMacro( Alpha, double );
-          itkSetMacro( Beta, double );
-
-        public:
-          virtual _TOutputValue Evaluate(
-            const TVertex& v, const TVertex& p
-            ) const override
-            {
-              double a = double( this->m_Image->GetPixel( v ) );
-              double d = this->m_Alpha;
-              d += std::pow( double( a ), this->m_Beta );
-              double x = -1;
-              if( std::fabs( d ) > double( 0 ) )
-                x =
-                  double( 1 ) /
-                  ( this->m_Alpha + std::pow( double( a ), this->m_Beta ) );
-              return( _TOutputValue( x ) );
-            }
-
-        protected:
-          Invert( )
-            : Superclass( ),
-              m_Alpha( double( 1 ) ),
-              m_Beta( double( 1 ) )
-            {
-            }
-          virtual ~Invert( )
-            {
-            }
-
-        private:
-          // Purposely not implemented
-          Invert( const Self& other );
-          Self& operator=( const Self& other );
-
-        protected:
-          double m_Alpha;
-          double m_Beta;
-        };
-
-      } // ecapseman
-
-    } // ecapseman
-
-  } // ecapseman
-
-} // ecapseman
-
-#endif // __fpa__Image__Functors__Dijkstra__Invert__h__
-
-// eof - $RCSfile$
diff --git a/lib/fpa/Image/LabelledSeedsInterface.h b/lib/fpa/Image/LabelledSeedsInterface.h
deleted file mode 100644 (file)
index 96016c0..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-// =========================================================================
-// @author Leonardo Florez Valencia
-// @email florez-l@javeriana.edu.co
-// =========================================================================
-
-#ifndef __fpa__Image__LabelledSeedsInterface__h__
-#define __fpa__Image__LabelledSeedsInterface__h__
-
-#include <fpa/Base/SeedsInterface.h>
-#include <itkImage.h>
-
-namespace fpa
-{
-  namespace Image
-  {
-    /**
-     */
-    template< class _TTraits >
-    class LabelledSeedsInterface
-      : public fpa::Base::SeedsInterface< _TTraits >
-    {
-    public:
-      typedef _TTraits TTraits;
-      typedef LabelledSeedsInterface               Self;
-      typedef fpa::Base::SeedsInterface< TTraits > Superclass;
-      fpa_Base_TraitTypes( typename TTraits );
-
-      typedef itk::Image< TFrontId, TVertex::Dimension > TLabelImage;
-
-    public:
-      virtual void AddSeed( const TVertex& seed ) override;
-      virtual void AddSeed( const TPoint& seed ) override;
-
-      const TLabelImage* GetLabels( ) const;
-      void SetLabels( const TLabelImage* image );
-
-    protected:
-      LabelledSeedsInterface( itk::ProcessObject* filter );
-      virtual ~LabelledSeedsInterface( );
-
-    protected:
-      typename TLabelImage::ConstPointer m_LabelImage;
-    };
-
-  } // ecapseman
-
-} // ecapseman
-
-#ifndef ITK_MANUAL_INSTANTIATION
-#  include <fpa/Image/LabelledSeedsInterface.hxx>
-#endif // ITK_MANUAL_INSTANTIATION
-
-#endif // __fpa__Image__LabelledSeedsInterface__h__
-
-// eof - $RCSfile$
diff --git a/lib/fpa/Image/LabelledSeedsInterface.hxx b/lib/fpa/Image/LabelledSeedsInterface.hxx
deleted file mode 100644 (file)
index 5b184f1..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-// =========================================================================
-// @author Leonardo Florez Valencia
-// @email florez-l@javeriana.edu.co
-// =========================================================================
-
-#ifndef __fpa__Image__LabelledSeedsInterface__hxx__
-#define __fpa__Image__LabelledSeedsInterface__hxx__
-
-#include <sstream>
-#include <itkExceptionObject.h>
-
-// -------------------------------------------------------------------------
-template< class _TTraits >
-void fpa::Image::LabelledSeedsInterface< _TTraits >::
-AddSeed( const TVertex& seed )
-{
-  std::ostringstream msg;
-  msg << "itk::ERROR: fpa::Image::LabelledSeedsInterface (" << this
-      << "): \"AddSeed( const TVertex& seed )\" is not valid for this class. "
-      << "Use \"SetLabels( TLabelImage* labels )\" instead.";
-  ::itk::ExceptionObject e(
-    __FILE__, __LINE__, msg.str( ).c_str( ), ITK_LOCATION
-    );
-  throw e;
-}
-
-// -------------------------------------------------------------------------
-template< class _TTraits >
-void fpa::Image::LabelledSeedsInterface< _TTraits >::
-AddSeed( const TPoint& seed )
-{
-  std::ostringstream msg;
-  msg << "itk::ERROR: fpa::Image::LabelledSeedsInterface (" << this
-      << "): \"AddSeed( const TPoint& seed )\" is not valid for this class. "
-      << "Use \"SetLabels( TLabelImage* labels )\" instead.";
-  ::itk::ExceptionObject e(
-    __FILE__, __LINE__, msg.str( ).c_str( ), ITK_LOCATION
-    );
-  throw e;
-}
-
-// -------------------------------------------------------------------------
-template< class _TTraits >
-const typename  fpa::Image::LabelledSeedsInterface< _TTraits >::
-TLabelImage* fpa::Image::LabelledSeedsInterface< _TTraits >::
-GetLabels( ) const
-{
-  return( this->m_LabelImage );
-}
-
-// -------------------------------------------------------------------------
-template< class _TTraits >
-void fpa::Image::LabelledSeedsInterface< _TTraits >::
-SetLabels( const TLabelImage* image )
-{
-  this->m_LabelImage = image;
-}
-
-// -------------------------------------------------------------------------
-template< class _TTraits >
-fpa::Image::LabelledSeedsInterface< _TTraits >::
-LabelledSeedsInterface( itk::ProcessObject* filter )
-  : Superclass( filter )
-{
-}
-
-// -------------------------------------------------------------------------
-template< class _TTraits >
-fpa::Image::LabelledSeedsInterface< _TTraits >::
-~LabelledSeedsInterface( )
-{
-}
-
-#endif // __fpa__Image__LabelledSeedsInterface__hxx__
-
-// eof - $RCSfile$
diff --git a/lib/fpa/Image/MinimumSpanningTree.h b/lib/fpa/Image/MinimumSpanningTree.h
deleted file mode 100644 (file)
index 22f7904..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-// =========================================================================
-// @author Leonardo Florez Valencia
-// @email florez-l@javeriana.edu.co
-// =========================================================================
-
-#ifndef __fpa__Image__MinimumSpanningTree__h__
-#define __fpa__Image__MinimumSpanningTree__h__
-
-#include <fpa/Base/MinimumSpanningTree.h>
-#include <itkImage.h>
-#include <fpa/Image/PolyLineParametricPath.h>
-
-namespace fpa
-{
-  namespace Image
-  {
-    /**
-     */
-    template< unsigned int _VDim >
-    class MinimumSpanningTree
-      : public fpa::Base::MinimumSpanningTree< itk::Index< _VDim >, itk::Image< itk::Offset< _VDim >, _VDim > >
-    {
-    public:
-      typedef itk::Index< _VDim > TVertex;
-      typedef itk::Image< itk::Offset< _VDim >, _VDim > TBaseImage;
-
-      typedef MinimumSpanningTree             Self;
-      typedef itk::SmartPointer< Self >       Pointer;
-      typedef itk::SmartPointer< const Self > ConstPointer;
-      typedef fpa::Base::MinimumSpanningTree< TVertex, TBaseImage > Superclass;
-
-      typedef typename Superclass::TCollision     TCollision;
-      typedef typename Superclass::TCollisionsRow TCollisionsRow;
-      typedef typename Superclass::TCollisions    TCollisions;
-      typedef typename Superclass::TVertices      TVertices;
-
-      typedef fpa::Image::PolyLineParametricPath< _VDim > TPolyLineParametricPath;
-
-    public:
-      itkNewMacro( Self );
-      itkTypeMacro(
-        fpa::Image::MinimumSpanningTree,
-        fpa::Base::MinimumSpanningTree
-        );
-
-    public:
-      virtual TVertex GetParent( const TVertex& v ) const override;
-      virtual void SetParent( const TVertex& v, const TVertex& p ) override;
-
-      void GetPolyLineParametricPath(
-        typename TPolyLineParametricPath::Pointer& path,
-        const TVertex& a
-        ) const;
-      void GetPolyLineParametricPath(
-        typename TPolyLineParametricPath::Pointer& path,
-        const TVertex& a, const TVertex& b
-        ) const;
-
-    protected:
-      MinimumSpanningTree( );
-      virtual ~MinimumSpanningTree( );
-
-    private:
-      MinimumSpanningTree( const Self& other );
-      Self& operator=( const Self& other );
-    };
-
-  } // ecapseman
-
-} // ecapseman
-
-#ifndef ITK_MANUAL_INSTANTIATION
-#  include <fpa/Image/MinimumSpanningTree.hxx>
-#endif // ITK_MANUAL_INSTANTIATION
-
-#endif // __fpa__Image__MinimumSpanningTree__h__
-
-// eof - $RCSfile$
diff --git a/lib/fpa/Image/Mori.h b/lib/fpa/Image/Mori.h
deleted file mode 100644 (file)
index b45db50..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-// =========================================================================
-// @author Leonardo Florez Valencia
-// @email florez-l@javeriana.edu.co
-// =========================================================================
-
-#ifndef __fpa__Image__Mori__h__
-#define __fpa__Image__Mori__h__
-
-#include <fpa/Base/Mori.h>
-#include <fpa/Base/MarksInterface.h>
-#include <fpa/Base/SingleSeedInterface.h>
-#include <fpa/Image/Algorithm.h>
-#include <fpa/Image/DefaultTraits.h>
-
-namespace fpa
-{
-  namespace Image
-  {
-    /**
-     */
-    template< class _TInputImage, class _TOutputImage, class _TTraits = fpa::Image::DefaultTraits< _TInputImage, _TOutputImage, typename _TOutputImage::PixelType > >
-    class Mori
-      : public fpa::Base::Mori< fpa::Image::Algorithm< _TTraits, fpa::Base::MarksInterface< _TTraits >, fpa::Base::SingleSeedInterface< _TTraits > > >
-    {
-    public:
-      typedef _TInputImage  TInputImage;
-      typedef _TOutputImage TOutputImage;
-      typedef _TTraits      TTraits;
-      typedef fpa::Base::MarksInterface< _TTraits >      TMarksInterface;
-      typedef fpa::Base::SingleSeedInterface< _TTraits > TSeedsInterface;
-      typedef fpa::Image::Algorithm< TTraits, TMarksInterface, TSeedsInterface > TAlgorithm;
-
-      typedef Mori                            Self;
-      typedef fpa::Base::Mori< TAlgorithm >   Superclass;
-      typedef itk::SmartPointer< Self >       Pointer;
-      typedef itk::SmartPointer< const Self > ConstPointer;
-
-      typedef typename TAlgorithm::TMarks TMarks;
-
-    public:
-      itkNewMacro( Self );
-      itkTypeMacro( fpa::Image::Mori, fpa::Base::Mori );
-
-    public:
-      TOutputImage* GetThresholdedOutput( );
-      const TOutputImage* GetThresholdedOutput( ) const;
-
-    protected:
-      Mori( );
-      virtual ~Mori( );
-
-      virtual void _AfterGenerateData( ) override;
-
-    private:
-      // Purposely not implemented.
-      Mori( const Self& other );
-      Self& operator=( const Self& other );
-
-    protected:
-      unsigned long m_ThresholdedOutputIdx;
-    };
-
-  } // ecapseman
-
-} // ecapseman
-
-#ifndef ITK_MANUAL_INSTANTIATION
-#  include <fpa/Image/Mori.hxx>
-#endif // ITK_MANUAL_INSTANTIATION
-
-#endif // __fpa__Image__Mori__h__
-
-// eof - $RCSfile$
diff --git a/lib/fpa/Image/Mori.hxx b/lib/fpa/Image/Mori.hxx
deleted file mode 100644 (file)
index 4a0589e..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-// =========================================================================
-// @author Leonardo Florez Valencia
-// @email florez-l@javeriana.edu.co
-// =========================================================================
-
-#ifndef __fpa__Image__Mori__hxx__
-#define __fpa__Image__Mori__hxx__
-
-#include <itkBinaryThresholdImageFilter.h>
-
-// -------------------------------------------------------------------------
-template< class _TInputImage, class _TOutputImage, class _TTraits >
-typename fpa::Image::Mori< _TInputImage, _TOutputImage, _TTraits >::
-TOutputImage* fpa::Image::Mori< _TInputImage, _TOutputImage, _TTraits >::
-GetThresholdedOutput( )
-{
-  return(
-    dynamic_cast< TOutputImage* >(
-      this->itk::ProcessObject::GetOutput( this->m_ThresholdedOutputIdx )
-      )
-    );
-}
-
-// -------------------------------------------------------------------------
-template< class _TInputImage, class _TOutputImage, class _TTraits >
-const typename fpa::Image::Mori< _TInputImage, _TOutputImage, _TTraits >::
-TOutputImage* fpa::Image::Mori< _TInputImage, _TOutputImage, _TTraits >::
-GetThresholdedOutput( ) const
-{
-  return(
-    dynamic_cast< const TOutputImage* >(
-      this->itk::ProcessObject::GetOutput( this->m_ThresholdedOutputIdx )
-      )
-    );
-}
-
-// -------------------------------------------------------------------------
-template< class _TInputImage, class _TOutputImage, class _TTraits >
-fpa::Image::Mori< _TInputImage, _TOutputImage, _TTraits >::
-Mori( )
-  : Superclass( )
-{
-  this->m_ThresholdedOutputIdx = this->GetNumberOfRequiredOutputs( );
-  this->itk::ProcessObject::SetNumberOfRequiredOutputs(
-    this->m_ThresholdedOutputIdx + 1
-    );
-  this->SetNthOutput( this->m_ThresholdedOutputIdx, TOutputImage::New( ) );
-}
-
-// -------------------------------------------------------------------------
-template< class _TInputImage, class _TOutputImage, class _TTraits >
-fpa::Image::Mori< _TInputImage, _TOutputImage, _TTraits >::
-~Mori( )
-{
-}
-
-// -------------------------------------------------------------------------
-template< class _TInputImage, class _TOutputImage, class _TTraits >
-void fpa::Image::Mori< _TInputImage, _TOutputImage, _TTraits >::
-_AfterGenerateData( )
-{
-  typedef itk::BinaryThresholdImageFilter< TMarks, TOutputImage > _TFilter;
-
-  this->Superclass::_AfterGenerateData( );
-
-  typename _TFilter::Pointer filter = _TFilter::New( );
-  filter->SetInput( this->GetMarks( ) );
-  filter->SetInsideValue( this->GetInsideValue( ) );
-  filter->SetOutsideValue( this->GetOutsideValue( ) );
-  filter->SetLowerThreshold( 1 );
-  filter->SetUpperThreshold( this->GetNumberOfEvaluatedThresholds( ) - 1 );
-  filter->Update( );
-  this->GetThresholdedOutput( )->Graft( filter->GetOutput( ) );
-}
-
-#endif // __fpa__Image__Mori__hxx__
-
-// eof - $RCSfile$
diff --git a/lib/fpa/Image/PathsToImageFilter.h b/lib/fpa/Image/PathsToImageFilter.h
deleted file mode 100644 (file)
index dd467cd..0000000
+++ /dev/null
@@ -1,84 +0,0 @@
-// =========================================================================
-// @author Leonardo Florez Valencia
-// @email florez-l@javeriana.edu.co
-// =========================================================================
-
-#ifndef __fpa__Image__PathsToImageFilter__h__
-#define __fpa__Image__PathsToImageFilter__h__
-
-#include <itkRGBAPixel.h>
-#include <itkImageToImageFilter.h>
-#include <vector>
-
-namespace fpa
-{
-  namespace Image
-  {
-    /**
-     */
-    template< class _TMST, class _TOutputPixelValue >
-    class PathsToImageFilter
-      : public itk::ImageToImageFilter< _TMST, itk::Image< itk::RGBAPixel< _TOutputPixelValue >, _TMST::ImageDimension > >
-    {
-    public:
-      typedef _TMST TMST;
-      typedef _TOutputPixelValue TOutputPixelValue;
-      typedef itk::RGBAPixel< TOutputPixelValue > TOutputPixel;
-      typedef itk::Image< TOutputPixel, TMST::ImageDimension > TOutputImage;
-
-      typedef PathsToImageFilter              Self;
-      typedef itk::SmartPointer< Self >                     Pointer;
-      typedef itk::SmartPointer< const Self >               ConstPointer;
-      typedef itk::ImageToImageFilter< TMST, TOutputImage > Superclass;
-
-      typedef typename TMST::IndexType TIndex;
-      struct TPathData
-      {
-        TIndex Start;
-        TIndex End;
-        TOutputPixelValue Red;
-        TOutputPixelValue Green;
-        TOutputPixelValue Blue;
-      };
-      typedef std::vector< TPathData > TPaths;
-
-    public:
-      itkNewMacro( Self );
-      itkTypeMacro(
-        fpa::Image::PathsToImageFilter,
-        itk::ImageToImageFilter
-        );
-
-    public:
-      void AddPath(
-        const TIndex& start, const TIndex& end,
-        const TOutputPixelValue& r = TOutputPixelValue( 1 ),
-        const TOutputPixelValue& g = TOutputPixelValue( 0 ),
-        const TOutputPixelValue& b = TOutputPixelValue( 0 )
-        );
-
-    protected:
-      PathsToImageFilter( );
-      virtual ~PathsToImageFilter( );
-
-      virtual void GenerateData( ) override;
-
-    private:
-      PathsToImageFilter( const Self& other );
-      Self& operator=( const Self& other );
-
-    protected:
-      TPaths m_Paths;
-    };
-
-  } // ecapseman
-
-} // ecapseman
-
-#ifndef ITK_MANUAL_INSTANTIATION
-#  include <fpa/Image/PathsToImageFilter.hxx>
-#endif // ITK_MANUAL_INSTANTIATION
-
-#endif // __fpa__Image__PathsToImageFilter__h__
-
-// eof - $RCSfile$
diff --git a/lib/fpa/Image/PathsToImageFilter.hxx b/lib/fpa/Image/PathsToImageFilter.hxx
deleted file mode 100644 (file)
index 487b9c8..0000000
+++ /dev/null
@@ -1,79 +0,0 @@
-// =========================================================================
-// @author Leonardo Florez Valencia
-// @email florez-l@javeriana.edu.co
-// =========================================================================
-
-#ifndef __fpa__Image__PathsToImageFilter__hxx__
-#define __fpa__Image__PathsToImageFilter__hxx__
-
-// -------------------------------------------------------------------------
-template< class _TMST, class _TOutputPixelValue >
-void fpa::Image::PathsToImageFilter< _TMST, _TOutputPixelValue >::
-AddPath(
-  const TIndex& start, const TIndex& end,
-  const TOutputPixelValue& r,
-  const TOutputPixelValue& g,
-  const TOutputPixelValue& b
-  )
-{
-  if( start != end )
-  {
-    TPathData d;
-    d.Start = start;
-    d.End = end;
-    d.Red = r;
-    d.Green = g;
-    d.Blue = b;
-    this->m_Paths.push_back( d );
-    this->Modified( );
-
-  } // fi
-}
-
-// -------------------------------------------------------------------------
-template< class _TMST, class _TOutputPixelValue >
-fpa::Image::PathsToImageFilter< _TMST, _TOutputPixelValue >::
-PathsToImageFilter( )
-  : Superclass( )
-{
-}
-
-// -------------------------------------------------------------------------
-template< class _TMST, class _TOutputPixelValue >
-fpa::Image::PathsToImageFilter< _TMST, _TOutputPixelValue >::
-~PathsToImageFilter( )
-{
-}
-
-// -------------------------------------------------------------------------
-template< class _TMST, class _TOutputPixelValue >
-void fpa::Image::PathsToImageFilter< _TMST, _TOutputPixelValue >::
-GenerateData( )
-{
-  TOutputPixel color;
-  color.Fill( 0 );
-
-  const TMST* mst = this->GetInput( );
-  TOutputImage* output = this->GetOutput( );
-  output->SetBufferedRegion( mst->GetBufferedRegion( ) );
-  output->Allocate( );
-  output->FillBuffer( color );
-
-  typename TPaths::const_iterator d = this->m_Paths.begin( );
-  for( ; d != this->m_Paths.end( ); ++d )
-  {
-    typename TMST::TVertices path = mst->GetPath( d->Start, d->End );
-    color[ 0 ] = d->Red;
-    color[ 1 ] = d->Green;
-    color[ 2 ] = d->Blue;
-    color[ 3 ] = std::numeric_limits< TOutputPixelValue >::max( );
-    typename TMST::TVertices::const_iterator i = path.begin( );
-    for( ; i != path.end( ); ++i )
-      output->SetPixel( *i, color );
-
-  } // rof
-}
-
-#endif // __fpa__Image__PathsToImageFilter__hxx__
-
-// eof - $RCSfile$
diff --git a/lib/fpa/Image/PolyLineParametricPath.h b/lib/fpa/Image/PolyLineParametricPath.h
deleted file mode 100644 (file)
index 83a6c05..0000000
+++ /dev/null
@@ -1,99 +0,0 @@
-// =========================================================================
-// @author Leonardo Florez Valencia
-// @email florez-l@javeriana.edu.co
-// =========================================================================
-
-#ifndef __fpa__Image__PolyLineParametricPath__h__
-#define __fpa__Image__PolyLineParametricPath__h__
-
-#include <itkPolyLineParametricPath.h>
-#include <itkImageBase.h>
-
-namespace fpa
-{
-  namespace Image
-  {
-    /**
-     */
-    template< unsigned int _VDim >
-    class PolyLineParametricPath
-      : public itk::PolyLineParametricPath< _VDim >
-    {
-    public:
-      typedef PolyLineParametricPath               Self;
-      typedef itk::PolyLineParametricPath< _VDim > Superclass;
-      typedef itk::SmartPointer< Self >            Pointer;
-      typedef itk::SmartPointer< const Self >      ConstPointer;
-
-      typedef itk::ImageBase< _VDim >                  TImageBase;
-      typedef typename TImageBase::SpacingType         TSpacing;
-      typedef typename TImageBase::PointType           TPoint;
-      typedef typename TImageBase::DirectionType       TDirection;
-      typedef typename Superclass::ContinuousIndexType TContinuousIndex;
-      typedef typename TContinuousIndex::IndexType     TIndex;
-
-    public:
-      itkNewMacro( Self );
-      itkTypeMacro( PolyLineParametricPath, itk::PolyLineParametricPath );
-
-      itkGetConstReferenceMacro( Spacing, TSpacing );
-      itkGetConstReferenceMacro( Origin, TPoint );
-      itkGetConstReferenceMacro( Direction, TDirection );
-      itkGetConstReferenceMacro( InverseDirection, TDirection );
-
-      itkSetMacro( Origin, TPoint );
-
-    public:
-      unsigned long GetSize( ) const;
-      TContinuousIndex GetContinuousVertex( unsigned long i ) const;
-      TIndex GetVertex( unsigned long i ) const;
-      TPoint GetPoint( unsigned long i ) const;
-
-      virtual void SetSpacing( const TSpacing& spac );
-      virtual void SetSpacing( const double spac[ _VDim ] );
-      virtual void SetSpacing( const float spac[ _VDim ] );
-      virtual void SetOrigin( const double ori[ _VDim ] );
-      virtual void SetOrigin( const float ori[ _VDim ] );
-      virtual void SetDirection( const TDirection& dir );
-
-      template< class _TRefImage >
-      inline void SetReferenceImage( const _TRefImage* image )
-        {
-          this->SetSpacing( image->GetSpacing( ) );
-          this->SetOrigin( image->GetOrigin( ) );
-          this->SetDirection( image->GetDirection( ) );
-        }
-
-      virtual void Graft( itk::DataObject* o );
-
-    protected:
-      PolyLineParametricPath( );
-      virtual ~PolyLineParametricPath( );
-
-      virtual void _ComputeIndexToPhysicalPointMatrices( );
-
-    private:
-      // Purposely not implemented
-      PolyLineParametricPath( const Self& other );
-      Self& operator=( const Self& other );
-
-    protected:
-      TSpacing   m_Spacing;
-      TPoint     m_Origin;
-      TDirection m_Direction;
-      TDirection m_InverseDirection;
-      TDirection m_IndexToPhysicalPoint;
-      TDirection m_PhysicalPointToIndex;
-    };
-
-  } // ecapseman
-
-} // ecapseman
-
-#ifndef ITK_MANUAL_INSTANTIATION
-#  include <fpa/Image/PolyLineParametricPath.hxx>
-#endif // ITK_MANUAL_INSTANTIATION
-
-#endif // __fpa__Image__PolyLineParametricPath__h__
-
-// eof - $RCSfile$
diff --git a/lib/fpa/Image/PolyLineParametricPathToPolyDataFilter.h b/lib/fpa/Image/PolyLineParametricPathToPolyDataFilter.h
deleted file mode 100644 (file)
index 4c6318a..0000000
+++ /dev/null
@@ -1,81 +0,0 @@
-// =========================================================================
-// @author Leonardo Florez Valencia
-// @email florez-l@javeriana.edu.co
-// =========================================================================
-
-#ifndef __fpa__Image__PolyLineParametricPathToPolyDataFilter__h__
-#define __fpa__Image__PolyLineParametricPathToPolyDataFilter__h__
-
-#include <fpa/Config.h>
-
-#ifdef USE_VTK
-#  include <vtkPolyDataAlgorithm.h>
-#endif // USE_VTK
-
-namespace fpa
-{
-  namespace Image
-  {
-    /**
-     */
-    template< class _TPolyLineParametricPath >
-    class PolyLineParametricPathToPolyDataFilter
-#ifdef USE_VTK
-      : public vtkPolyDataAlgorithm
-#endif // USE_VTK
-    {
-    public:
-      typedef PolyLineParametricPathToPolyDataFilter Self;
-      typedef _TPolyLineParametricPath               TPolyLineParametricPath;
-
-    public:
-#ifdef USE_VTK
-      vtkTypeMacro(
-        PolyLineParametricPathToPolyDataFilter,
-        vtkPolyDataAlgorithm
-        );
-#endif // USE_VTK
-
-    public:
-      static Self* New( );
-
-      const TPolyLineParametricPath* GetInput( ) const;
-      void SetInput( const TPolyLineParametricPath* path );
-
-    protected:
-      PolyLineParametricPathToPolyDataFilter( );
-      virtual ~PolyLineParametricPathToPolyDataFilter( );
-
-#ifdef USE_VTK
-      int RequestData(
-        vtkInformation* information,
-        vtkInformationVector** input,
-        vtkInformationVector* output
-        );
-      int RequestInformation(
-        vtkInformation* information,
-        vtkInformationVector** input,
-        vtkInformationVector* output
-        );
-#endif // USE_VTK
-
-    private:
-      // Purposely not implemented
-      PolyLineParametricPathToPolyDataFilter( const Self& );
-      void operator=( const Self& );
-
-    protected:
-      const TPolyLineParametricPath* m_PolyLineParametricPath;
-    };
-
-  } // ecapseman
-
-} // ecapseman
-
-#ifndef ITK_MANUAL_INSTANTIATION
-#  include <fpa/Image/PolyLineParametricPathToPolyDataFilter.hxx>
-#endif // ITK_MANUAL_INSTANTIATION
-
-#endif // __fpa__Image__PolyLineParametricPathToPolyDataFilter__h__
-
-// eof - $RCSfile$
diff --git a/lib/fpa/Image/RandomWalker.h b/lib/fpa/Image/RandomWalker.h
deleted file mode 100644 (file)
index 213eb97..0000000
+++ /dev/null
@@ -1,75 +0,0 @@
-// =========================================================================
-// @author Leonardo Florez Valencia
-// @email florez-l@javeriana.edu.co
-// =========================================================================
-
-#ifndef __fpa__Image__RandomWalker__h__
-#define __fpa__Image__RandomWalker__h__
-
-#include <itkImage.h>
-#include <fpa/Base/DijkstraBase.h>
-#include <fpa/Base/MarksInterface.h>
-#include <fpa/Image/Algorithm.h>
-#include <fpa/Image/DefaultTraits.h>
-#include <fpa/Image/LabelledSeedsInterface.h>
-#include <fpa/Image/Functors/Dijkstra/Function.h>
-
-namespace fpa
-{
-  namespace Image
-  {
-    /**
-     */
-    template< class _TInputImage, class _TLabelImage, class _TScalar, class _TTraits = fpa::Image::DefaultTraits< _TInputImage, itk::Image< _TScalar, _TInputImage::ImageDimension >, typename _TLabelImage::PixelType > >
-    class RandomWalker
-      : public fpa::Base::DijkstraBase< fpa::Image::Algorithm< _TTraits, fpa::Base::MarksInterface< _TTraits >, fpa::Image::LabelledSeedsInterface< _TTraits > > >
-    {
-    public:
-      typedef _TInputImage TInputImage;
-      typedef _TLabelImage TLabelImage;
-      typedef _TScalar     TScalar;
-      typedef _TTraits     TTraits;
-      fpa_Base_TraitTypes( typename TTraits );
-
-      typedef fpa::Base::MarksInterface< TTraits > TMarksInterface;
-      typedef fpa::Image::LabelledSeedsInterface< TTraits > TSeedsInterface;
-      typedef fpa::Image::Algorithm< TTraits, TMarksInterface, TSeedsInterface > TAlgorithm;
-
-      typedef fpa::Base::DijkstraBase< TAlgorithm > Superclass;
-      typedef RandomWalker                          Self;
-      typedef itk::SmartPointer< Self >             Pointer;
-      typedef itk::SmartPointer< const Self >       ConstPointer;
-      
-      typedef fpa::Image::Functors::Dijkstra::Function< TInputImage, TScalar > TWeightFunction;
-
-    public:
-      itkNewMacro( Self );
-      itkTypeMacro( fpa::Image::RandomWalker, fpa::Base::RandomWalker );
-
-    public:
-      virtual itk::ModifiedTimeType GetMTime( ) const override;
-
-    protected:
-      RandomWalker( );
-      virtual ~RandomWalker( );
-
-      virtual void _BeforeGenerateData( ) override;
-      virtual TNodes _UnifySeeds( ) override;
-
-    private:
-      // Purposely not implemented.
-      RandomWalker( const Self& other );
-      Self& operator=( const Self& other );
-    };
-
-  } // ecapseman
-
-} // ecapseman
-
-#ifndef ITK_MANUAL_INSTANTIATION
-#  include <fpa/Image/RandomWalker.hxx>
-#endif // ITK_MANUAL_INSTANTIATION
-
-#endif // __fpa__Image__RandomWalker__h__
-
-// eof - $RCSfile$
diff --git a/lib/fpa/Image/RandomWalker.hxx b/lib/fpa/Image/RandomWalker.hxx
deleted file mode 100644 (file)
index 2e8b46f..0000000
+++ /dev/null
@@ -1,133 +0,0 @@
-// =========================================================================
-// @author Leonardo Florez Valencia
-// @email florez-l@javeriana.edu.co
-// =========================================================================
-
-#ifndef __fpa__Image__RandomWalker__hxx__
-#define __fpa__Image__RandomWalker__hxx__
-
-#include <sstream>
-
-#include <itkImageRegionConstIteratorWithIndex.h>
-#include <itkExceptionObject.h>
-
-#include <fpa/Image/Functors/Dijkstra/Gaussian.h>
-
-// -------------------------------------------------------------------------
-template< class _TInputImage, class _TLabelImage, class _TScalar, class _TTraits >
-itk::ModifiedTimeType
-fpa::Image::RandomWalker< _TInputImage, _TLabelImage, _TScalar, _TTraits >::
-GetMTime( ) const
-{
-  const TLabelImage* labels = this->GetLabels( );
-  itk::ModifiedTimeType t = this->Superclass::GetMTime( );
-  if( labels != NULL )
-  {
-    itk::ModifiedTimeType q = labels->GetMTime( );
-    t = ( q < t )? q: t;
-
-  } // fi
-  return( t );
-}
-
-// -------------------------------------------------------------------------
-template< class _TInputImage, class _TLabelImage, class _TScalar, class _TTraits >
-fpa::Image::RandomWalker< _TInputImage, _TLabelImage, _TScalar, _TTraits >::
-RandomWalker( )
-  : Superclass( )
-{
-  typedef fpa::Image::Functors::Dijkstra::Gaussian< TInputImage, TScalar > _TDefaultFunction;
-  this->SetWeightFunction( _TDefaultFunction::New( ) );
-}
-
-// -------------------------------------------------------------------------
-template< class _TInputImage, class _TLabelImage, class _TScalar, class _TTraits >
-fpa::Image::RandomWalker< _TInputImage, _TLabelImage, _TScalar, _TTraits >::
-~RandomWalker( )
-{
-}
-
-// -------------------------------------------------------------------------
-template< class _TInputImage, class _TLabelImage, class _TScalar, class _TTraits >
-void fpa::Image::RandomWalker< _TInputImage, _TLabelImage, _TScalar, _TTraits >::
-_BeforeGenerateData( )
-{
-  this->Superclass::_BeforeGenerateData( );
-  TWeightFunction* wf =
-    dynamic_cast< TWeightFunction* >( this->GetWeightFunction( ) );
-  if( wf != NULL )
-    wf->SetImage( this->GetInput( ) );
-}
-
-// -------------------------------------------------------------------------
-template< class _TInputImage, class _TLabelImage, class _TScalar, class _TTraits >
-typename fpa::Image::RandomWalker< _TInputImage, _TLabelImage, _TScalar, _TTraits >::
-TNodes fpa::Image::RandomWalker< _TInputImage, _TLabelImage, _TScalar, _TTraits >::
-_UnifySeeds( )
-{
-  this->m_Seeds.clear( );
-  const TLabelImage* lbl = this->GetLabels( );
-  if( lbl == NULL )
-  {
-    std::ostringstream msg;
-    msg << "itk::ERROR: fpa::Image::RandomWalker (" << this
-        << "): Labelled image not defined.";
-    ::itk::ExceptionObject e(
-      __FILE__, __LINE__, msg.str( ).c_str( ), ITK_LOCATION
-      );
-    throw e;
-
-  } // fi
-
-  // Iterate over labels
-  typename TLabelImage::RegionType reg = lbl->GetRequestedRegion( );
-  itk::ImageRegionConstIteratorWithIndex< TLabelImage > lIt( lbl, reg );
-  for( lIt.GoToBegin( ); !lIt.IsAtEnd( ); ++lIt )
-  {
-    if( lIt.Get( ) > 0 )
-    {
-      bool is_seed = false;
-      for( unsigned int d = 0; d < TLabelImage::ImageDimension; ++d )
-      {
-        for( int s = -1; s <= 1; s += 2 )
-        {
-          TVertex neigh = lIt.GetIndex( );
-          neigh[ d ] += s;
-          if( reg.IsInside( neigh ) )
-            is_seed |= ( lbl->GetPixel( neigh ) == 0 );
-
-        } // rof
-
-      } // rof
-
-      if( !is_seed )
-      {
-        TNode node;
-        node.Vertex = lIt.GetIndex( );
-        node.Parent = lIt.GetIndex( );
-        node.FrontId = lIt.Get( );
-        node.Value = TScalar( 0 );
-        this->_Mark( node.Vertex, node.FrontId );
-        this->_UpdateOutputValue( node );
-      }
-      else
-      {
-        TSeed seed;
-        seed.Vertex = lIt.GetIndex( );
-        seed.IsPoint = false;
-        seed.FrontId = lIt.Get( );
-        this->m_Seeds.push_back( seed );
-
-      } // fi
-
-    } // fi
-
-  } // rof
-
-  // Ok, finish initialization
-  return( this->Superclass::_UnifySeeds( ) );
-}
-
-#endif // __fpa__Image__RandomWalker__hxx__
-
-// eof - $RCSfile$
diff --git a/lib/fpa/Image/RegionGrow.h b/lib/fpa/Image/RegionGrow.h
deleted file mode 100644 (file)
index 09631cc..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-// =========================================================================
-// @author Leonardo Florez Valencia
-// @email florez-l@javeriana.edu.co
-// =========================================================================
-
-#ifndef __fpa__Image__RegionGrow__h__
-#define __fpa__Image__RegionGrow__h__
-
-#include <fpa/Base/MarksInterfaceWithCollisions.h>
-#include <fpa/Base/RegionGrow.h>
-#include <fpa/Base/SeedsInterface.h>
-#include <fpa/Image/Algorithm.h>
-#include <fpa/Image/DefaultTraits.h>
-
-
-namespace fpa
-{
-  namespace Image
-  {
-    /**
-     */
-    template< class _TInputImage, class _TOutputImage, class _TFrontId = unsigned char, class _TTraits = fpa::Image::DefaultTraits< _TInputImage, _TOutputImage, _TFrontId > >
-    class RegionGrow
-      : public fpa::Base::RegionGrow< fpa::Image::Algorithm< _TTraits, fpa::Base::MarksInterfaceWithCollisions< _TTraits >, fpa::Base::SeedsInterface< _TTraits > > >
-    {
-    public:
-      typedef _TInputImage  TInputImage;
-      typedef _TOutputImage TOutputImage;
-      typedef _TTraits      TTraits;
-      typedef fpa::Base::MarksInterfaceWithCollisions< TTraits > TMarksInterface;
-      typedef fpa::Base::SeedsInterface< TTraits > TSeedsInterface;
-
-      typedef fpa::Image::Algorithm< TTraits, TMarksInterface, TSeedsInterface > TAlgorithm;
-      typedef fpa::Base::RegionGrow< TAlgorithm > Superclass;
-      typedef RegionGrow                          Self;
-      typedef itk::SmartPointer< Self >           Pointer;
-      typedef itk::SmartPointer< const Self >     ConstPointer;
-
-      fpa_Base_TraitTypes( typename TTraits );
-
-    public:
-      itkNewMacro( Self );
-      itkTypeMacro( fpa::Image::RegionGrow, fpa::Base::RegionGrow );
-
-    protected:
-      RegionGrow( ) : Superclass( ) { }
-      virtual ~RegionGrow( )        { }
-
-    private:
-      // Purposely not implemented.
-      RegionGrow( const Self& other );
-      Self& operator=( const Self& other );
-    };
-
-  } // ecapseman
-
-} // ecapseman
-
-#endif // __fpa__Image__RegionGrow__h__
-
-// eof - $RCSfile$
diff --git a/lib/fpa/Image/Skeleton.h b/lib/fpa/Image/Skeleton.h
deleted file mode 100644 (file)
index 4942702..0000000
+++ /dev/null
@@ -1,67 +0,0 @@
-// =========================================================================
-// @author Leonardo Florez Valencia
-// @email florez-l@javeriana.edu.co
-// =========================================================================
-
-#ifndef __fpa__Image__Skeleton__h__
-#define __fpa__Image__Skeleton__h__
-
-#include <vector>
-#include <fpa/Base/Graph.h>
-#include <fpa/Image/PolyLineParametricPath.h>
-
-namespace fpa
-{
-  namespace Image
-  {
-    /**
-     */
-    template< unsigned int _VDim >
-    class Skeleton
-      : public fpa::Base::Graph< typename fpa::Image::PolyLineParametricPath< _VDim >::TIndex, typename fpa::Image::PolyLineParametricPath< _VDim >::Pointer, typename fpa::Image::PolyLineParametricPath< _VDim >::TIndex, typename fpa::Image::PolyLineParametricPath< _VDim >::TIndex::LexicographicCompare >
-    {
-    public:
-      typedef fpa::Image::PolyLineParametricPath< _VDim > TPath;
-      typedef typename TPath::TIndex                     TIndex;
-      typedef typename TIndex::LexicographicCompare      TIndexCompare;
-      typedef typename TPath::Pointer                    TPathPointer;
-
-      itkStaticConstMacro( Dimension, unsigned int, _VDim );
-
-      typedef fpa::Base::Graph< TIndex, TPathPointer, TIndex, TIndexCompare > Superclass;
-      typedef Skeleton                        Self;
-      typedef itk::SmartPointer< Self >       Pointer;
-      typedef itk::SmartPointer< const Self > ConstPointer;
-
-    public:
-      itkNewMacro( Self );
-      itkTypeMacro( Skeleton, fpa::Image::Graph );
-
-    public:
-      void AddBranch( TPath* path );
-      const TPath* GetBranch( const TIndex& a, const TIndex& b ) const;
-
-      std::vector< TIndex > GetEndPoints( ) const;
-      std::vector< TIndex > GetBifurcations( ) const;
-
-    protected:
-      Skeleton( );
-      virtual ~Skeleton( );
-
-    private:
-      // Purposely not implemented
-      Skeleton( const Self& other );
-      Self& operator=( const Self& other );
-    };
-
-  } // ecapseman
-
-} // ecapseman
-
-#ifndef ITK_MANUAL_INSTANTIATION
-#  include <fpa/Image/Skeleton.hxx>
-#endif // ITK_MANUAL_INSTANTIATION
-
-#endif // __fpa__Image__Skeleton__h__
-
-// eof - $RCSfile$
diff --git a/lib/fpa/Image/SkeletonFilter.h b/lib/fpa/Image/SkeletonFilter.h
deleted file mode 100644 (file)
index 91ba5b8..0000000
+++ /dev/null
@@ -1,152 +0,0 @@
-// =========================================================================
-// @author Leonardo Florez Valencia
-// @email florez-l@javeriana.edu.co
-// =========================================================================
-
-#ifndef __fpa__Image__SkeletonFilter__h__
-#define __fpa__Image__SkeletonFilter__h__
-
-#include <map>
-
-#include <itkProcessObject.h>
-#include <itkSignedMaurerDistanceMapImageFilter.h>
-
-#include <fpa/Image/Dijkstra.h>
-#include <fpa/Image/Skeleton.h>
-
-namespace fpa
-{
-  namespace Image
-  {
-    /**
-     */
-    template< class _TInputImage, class _TDistanceMap = itk::SignedMaurerDistanceMapImageFilter< _TInputImage, itk::Image< double, _TInputImage::ImageDimension > > >
-    class SkeletonFilter
-      : public itk::ProcessObject
-    {
-    public:
-      typedef SkeletonFilter                  Self;
-      typedef itk::ProcessObject              Superclass;
-      typedef itk::SmartPointer< Self >       Pointer;
-      typedef itk::SmartPointer< const Self > ConstPointer;
-
-      typedef _TInputImage  TInputImage;
-      typedef _TDistanceMap TDistanceMap;
-      itkStaticConstMacro(
-        Dimension,
-        unsigned int,
-        TInputImage::ImageDimension
-        );
-
-      typedef typename TDistanceMap::OutputImageType TOutputImage;
-      typedef typename TInputImage::IndexType        TIndex;
-      typedef typename TOutputImage::PixelType       TScalar;
-
-      typedef fpa::Image::Skeleton< Self::Dimension > TSkeleton;
-
-    protected:
-      typedef std::multimap< TScalar, TIndex > _TSkeletonQueue;
-
-      /**
-       */
-      class _TDijkstra
-        : public fpa::Image::Dijkstra< TOutputImage, TOutputImage >
-      {
-      public:
-        typedef _TDijkstra                                         Self;
-        typedef fpa::Image::Dijkstra< TOutputImage, TOutputImage > Superclass;
-        typedef itk::SmartPointer< Self >                          Pointer;
-        typedef itk::SmartPointer< const Self >                    ConstPointer;
-
-        typedef typename Superclass::TNode TNode;
-        typedef typename Superclass::TMST  TMST;
-
-      public:
-        itkNewMacro( Self );
-        itkTypeMacro( _TDijkstra, fpa::Image::Dijkstra );
-
-        itkGetConstReferenceMacro( SkeletonQueue, _TSkeletonQueue );
-
-      protected:
-        _TDijkstra( );
-        virtual ~_TDijkstra( );
-
-        virtual void _BeforeGenerateData( ) override;
-        virtual void _UpdateOutputValue( TNode& n ) override;
-
-      private:
-        // Purposely not implemented
-        _TDijkstra( const Self& other );
-        Self& operator=( const Self& other );
-
-      protected:
-        _TSkeletonQueue m_SkeletonQueue;
-      };
-      typedef typename _TDijkstra::TMST _TMST;
-
-    public:
-      itkNewMacro( Self );
-      itkTypeMacro( fpa::Image::SkeletonFilter, fpa::Image::Dijkstra );
-
-      itkBooleanMacro( SeedFromMaximumDistance );
-      itkGetConstMacro( SeedFromMaximumDistance, bool );
-      itkSetMacro( SeedFromMaximumDistance, bool );
-
-      itkGetConstObjectMacro( DistanceMap, TDistanceMap );
-      itkGetObjectMacro( DistanceMap, TDistanceMap );
-
-      itkGetConstMacro( Seed, TIndex );
-      itkSetMacro( Seed, TIndex );
-
-    public:
-      virtual itk::ModifiedTimeType GetMTime( ) const override;
-
-      void SetInput( TInputImage* input );
-      TInputImage* GetInput( );
-      const TInputImage* GetInput( ) const;
-
-      TSkeleton* GetOutput( );
-      const TSkeleton* GetOutput( ) const;
-
-    protected:
-      SkeletonFilter( );
-      virtual ~SkeletonFilter( );
-
-      virtual void GenerateData( ) override;
-
-      template< class _TMarksPointer >
-      void _MarkSphere(
-        _TMarksPointer& marks,
-        const TOutputImage* dmap,
-        const TIndex& center
-        );
-
-      void _EndPoints(
-        std::vector< TIndex >& end_points,
-        const TOutputImage* dmap,
-        const _TMST* mst,
-        const _TSkeletonQueue& queue
-        );
-
-    private:
-      // Purposely not implemented.
-      SkeletonFilter( const Self& other );
-      Self& operator=( const Self& other );
-
-    protected:
-      typename TDistanceMap::Pointer m_DistanceMap;
-      bool   m_SeedFromMaximumDistance;
-      TIndex m_Seed;
-    };
-
-  } // ecapseman
-
-} // ecapseman
-
-#ifndef ITK_MANUAL_INSTANTIATION
-#  include <fpa/Image/SkeletonFilter.hxx>
-#endif // ITK_MANUAL_INSTANTIATION
-
-#endif // __fpa__Image__SkeletonFilter__h__
-
-// eof - $RCSfile$
diff --git a/lib/fpa/Image/SkeletonReader.h b/lib/fpa/Image/SkeletonReader.h
deleted file mode 100644 (file)
index 2afce07..0000000
+++ /dev/null
@@ -1,83 +0,0 @@
-// =========================================================================
-// @author Leonardo Florez Valencia
-// @email florez-l@javeriana.edu.co
-// =========================================================================
-
-#ifndef __fpa__Image__SkeletonReader__h__
-#define __fpa__Image__SkeletonReader__h__
-
-#include <itkProcessObject.h>
-
-namespace fpa
-{
-  namespace Image
-  {
-    /**
-     */
-    template< class _TSkeleton >
-    class SkeletonReader
-      : public itk::ProcessObject
-    {
-    public:
-      // Basic types
-      typedef SkeletonReader                  Self;
-      typedef itk::ProcessObject              Superclass;
-      typedef itk::SmartPointer< Self >       Pointer;
-      typedef itk::SmartPointer< const Self > ConstPointer;
-
-      typedef _TSkeleton TSkeleton;
-
-    public:
-      itkNewMacro( Self );
-      itkTypeMacro( SkeletonReader, itk::ProcessObject );
-
-      itkGetConstMacro( FileName, std::string );
-      itkSetMacro( FileName, std::string );
-
-    public:
-      TSkeleton* GetOutput( );
-      TSkeleton* GetOutput( unsigned int i );
-
-      virtual void GraftOutput( itk::DataObject* out );
-      virtual void GraftOutput(
-        const typename Superclass::DataObjectIdentifierType& key,
-        itk::DataObject* out
-        );
-      virtual void GraftNthOutput( unsigned int i, itk::DataObject* out );
-      virtual itk::DataObject::Pointer MakeOutput(
-        itk::ProcessObject::DataObjectPointerArraySizeType i
-        ) override;
-
-      virtual void Update( ) override
-        { this->GenerateData( ); }
-
-    protected:
-      SkeletonReader( );
-      virtual ~SkeletonReader( );
-
-      virtual void GenerateData( ) override;
-
-      // Do nothing
-      virtual void GenerateOutputInformation( ) override
-        { }
-
-    private:
-      // Purposely not implemented
-      SkeletonReader( const Self& );
-      void operator=( const Self& );
-
-    protected:
-      std::string m_FileName;
-    };
-
-  } // ecapseman
-
-} // ecapseman
-
-#ifndef ITK_MANUAL_INSTANTIATION
-#  include <fpa/Image/SkeletonReader.hxx>
-#endif // ITK_MANUAL_INSTANTIATION
-
-#endif // __fpa__Image__SkeletonReader__h__
-
-// eof - $RCSfile$
diff --git a/lib/fpa/Image/SkeletonToPolyDataFilter.h b/lib/fpa/Image/SkeletonToPolyDataFilter.h
deleted file mode 100644 (file)
index 9c2b941..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-// =========================================================================
-// @author Leonardo Florez Valencia
-// @email florez-l@javeriana.edu.co
-// =========================================================================
-
-#ifndef __fpa__Image__SkeletonToPolyDataFilter__h__
-#define __fpa__Image__SkeletonToPolyDataFilter__h__
-
-#include <fpa/Config.h>
-
-#ifdef USE_VTK
-#  include <vtkPolyDataAlgorithm.h>
-#endif // USE_VTK
-
-namespace fpa
-{
-  namespace Image
-  {
-    /**
-     */
-    template< class _TSkeleton >
-    class SkeletonToPolyDataFilter
-#ifdef USE_VTK
-      : public vtkPolyDataAlgorithm
-#endif // USE_VTK
-    {
-    public:
-      typedef SkeletonToPolyDataFilter Self;
-      typedef _TSkeleton               TSkeleton;
-
-    public:
-#ifdef USE_VTK
-      vtkTypeMacro( SkeletonToPolyDataFilter, vtkPolyDataAlgorithm );
-#endif // USE_VTK
-
-    public:
-      static Self* New( );
-
-      const TSkeleton* GetInput( ) const;
-      void SetInput( const TSkeleton* sk );
-
-    protected:
-      SkeletonToPolyDataFilter( );
-      virtual ~SkeletonToPolyDataFilter( );
-
-#ifdef USE_VTK
-      int RequestData(
-        vtkInformation* information,
-        vtkInformationVector** input,
-        vtkInformationVector* output
-        );
-      int RequestInformation(
-        vtkInformation* information,
-        vtkInformationVector** input,
-        vtkInformationVector* output
-        );
-#endif // USE_VTK
-
-    private:
-      // Purposely not implemented
-      SkeletonToPolyDataFilter( const Self& );
-      void operator=( const Self& );
-
-    protected:
-      const TSkeleton* m_Skeleton;
-    };
-
-  } // ecapseman
-
-} // ecapseman
-
-#ifndef ITK_MANUAL_INSTANTIATION
-#  include <fpa/Image/SkeletonToPolyDataFilter.hxx>
-#endif // ITK_MANUAL_INSTANTIATION
-
-#endif // __fpa__Image__SkeletonToPolyDataFilter__h__
-
-// eof - $RCSfile$
diff --git a/lib/fpa/Image/SkeletonWriter.h b/lib/fpa/Image/SkeletonWriter.h
deleted file mode 100644 (file)
index 400d6ac..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-// =========================================================================
-// @author Leonardo Florez Valencia
-// @email florez-l@javeriana.edu.co
-// =========================================================================
-
-#ifndef __fpa__Image__SkeletonWriter__h__
-#define __fpa__Image__SkeletonWriter__h__
-
-#include <itkProcessObject.h>
-
-namespace fpa
-{
-  namespace Image
-  {
-    /**
-     */
-    template< class _TSkeleton >
-    class SkeletonWriter
-      : public itk::ProcessObject
-    {
-    public:
-      // Basic types
-      typedef SkeletonWriter                  Self;
-      typedef itk::ProcessObject              Superclass;
-      typedef itk::SmartPointer< Self >       Pointer;
-      typedef itk::SmartPointer< const Self > ConstPointer;
-
-      typedef _TSkeleton TSkeleton;
-      typedef typename TSkeleton::TEdges     TEdges;
-      typedef typename TSkeleton::TMatrix    TMatrix;
-      typedef typename TSkeleton::TMatrixRow TMatrixRow;
-      typedef typename TSkeleton::TPath      TPath;
-      typedef typename TSkeleton::TVertex    TVertex;
-
-    public:
-      itkNewMacro( Self );
-      itkTypeMacro( SkeletonWriter, itk::ProcessObject );
-
-      itkGetConstMacro( FileName, std::string );
-      itkSetMacro( FileName, std::string );
-
-    public:
-      const TSkeleton* GetInput( ) const;
-      void SetInput( const TSkeleton* skeleton );
-      virtual void Update( ) override;
-
-    protected:
-      SkeletonWriter( );
-      virtual ~SkeletonWriter( );
-
-      virtual void GenerateData( ) override;
-
-    private:
-      // Purposely not implemented
-      SkeletonWriter( const Self& );
-      void operator=( const Self& );
-
-    protected:
-      std::string m_FileName;
-    };
-
-  } // ecapseman
-
-} // ecapseman
-
-#ifndef ITK_MANUAL_INSTANTIATION
-#  include <fpa/Image/SkeletonWriter.hxx>
-#endif // ITK_MANUAL_INSTANTIATION
-
-#endif // __fpa__Image__SkeletonWriter__h__
-
-// eof - $RCSfile$
diff --git a/lib/fpa/Image/VisualDebugger.h b/lib/fpa/Image/VisualDebugger.h
deleted file mode 100644 (file)
index 90e94e1..0000000
+++ /dev/null
@@ -1,98 +0,0 @@
-// =========================================================================
-// @author Leonardo Florez Valencia
-// @email florez-l@javeriana.edu.co
-// =========================================================================
-
-#ifndef __fpa__Image__VisualDebugger__h__
-#define __fpa__Image__VisualDebugger__h__
-
-#include <fpa/Config.h>
-
-#include <vector>
-
-#include <itkCommand.h>
-#include <itkImage.h>
-#include <itkRGBAPixel.h>
-
-#ifdef USE_ivq
-#include <itkImageToVTKImageFilter.h>
-#endif // USE_ivq
-
-class vtkRenderer;
-class vtkRenderWindowInteractor;
-
-namespace fpa
-{
-  namespace Image
-  {
-    /**
-     */
-    template< class _TFilter >
-    class VisualDebugger
-      : public itk::Command
-    {
-    public:
-      typedef VisualDebugger                  Self;
-      typedef itk::Command                    Superclass;
-      typedef itk::SmartPointer< Self >       Pointer;
-      typedef itk::SmartPointer< const Self > ConstPointer;
-
-      typedef _TFilter                      TFilter;
-      typedef typename TFilter::TInputImage TImage;
-
-      typedef itk::RGBAPixel< unsigned char > TLabel;
-      typedef itk::Image< TLabel, TImage::ImageDimension > TLabels;
-#ifdef USE_ivq
-      typedef itk::ImageToVTKImageFilter< TLabels > TVTKLabels;
-#endif // USE_ivq
-
-    public:
-      itkTypeMacro( fpa::Image::VisualDebugger, itk::Command );
-
-      itkGetConstObjectMacro( Labels, TLabels );
-
-    public:
-      void SetVisualization(
-        vtkRenderer* renderer, vtkRenderWindowInteractor* iren
-        );
-      virtual void Execute(
-        itk::Object* caller, const itk::EventObject& event
-        ) override;
-      virtual void Execute(
-        const itk::Object* caller, const itk::EventObject& event
-        ) override;
-
-      virtual void Render( ) = 0;
-      virtual void StartVisualization( ) = 0;
-      virtual void EndVisualization( ) = 0;
-
-    protected:
-      VisualDebugger( );
-      virtual ~VisualDebugger( );
-
-    private:
-      // Purposely not implemented.
-      VisualDebugger( const Self& other );
-      Self& operator=( const Self& other );
-
-    protected:
-      std::vector< TLabel >     m_Colors;
-      typename TLabels::Pointer m_Labels;
-#ifdef USE_ivq
-      vtkRenderer*                 m_Renderer;
-      vtkRenderWindowInteractor*   m_Interactor;
-      typename TVTKLabels::Pointer m_VTKLabels;
-#endif // USE_ivq
-    };
-
-  } // ecapseman
-
-} // ecapseman
-
-#ifndef ITK_MANUAL_INSTANTIATION
-#  include <fpa/Image/VisualDebugger.hxx>
-#endif // ITK_MANUAL_INSTANTIATION
-
-#endif // __fpa__Image__VisualDebugger__h__
-
-// eof - $RCSfile$
diff --git a/lib/fpa/Image/VisualDebugger.hxx b/lib/fpa/Image/VisualDebugger.hxx
deleted file mode 100644 (file)
index d45a803..0000000
+++ /dev/null
@@ -1,134 +0,0 @@
-// =========================================================================
-// @author Leonardo Florez Valencia
-// @email florez-l@javeriana.edu.co
-// =========================================================================
-
-#ifndef __fpa__Image__VisualDebugger__hxx__
-#define __fpa__Image__VisualDebugger__hxx__
-
-// -------------------------------------------------------------------------
-template< class _TFilter >
-void fpa::Image::VisualDebugger< _TFilter >::
-SetVisualization( vtkRenderer* renderer, vtkRenderWindowInteractor* iren )
-{
-#ifdef USE_ivq
-  this->m_Renderer = renderer;
-  this->m_Interactor = iren;
-  this->Modified( );
-#endif // USE_ivq
-}
-
-// -------------------------------------------------------------------------
-template< class _TFilter >
-void fpa::Image::VisualDebugger< _TFilter >::
-Execute( itk::Object* caller, const itk::EventObject& event )
-{
-  this->Execute( const_cast< const itk::Object* >( caller ), event );
-}
-
-// -------------------------------------------------------------------------
-template< class _TFilter >
-void fpa::Image::VisualDebugger< _TFilter >::
-Execute( const itk::Object* caller, const itk::EventObject& event )
-{
-  typedef itk::StartEvent           _TStart;
-  typedef itk::EndEvent             _TEnd;
-  typedef typename _TFilter::TEvent _TEvent;
-
-  // Check validity
-  const TFilter* filter = dynamic_cast< const TFilter* >( caller );
-  if( filter == NULL )
-    return;
-
-  // Get correct event type
-  const _TEvent* ev_fpa = dynamic_cast< const _TEvent* >( &event );
-  const _TStart* ev_start = dynamic_cast< const _TStart* >( &event );
-  const _TEnd* ev_end = dynamic_cast< const _TEnd* >( &event );
-  if( ev_fpa != NULL )
-  {
-    if( this->m_Labels.IsNotNull( ) )
-    {
-      TLabel new_color;
-      if( ev_fpa->IntoQueue )
-        new_color = this->m_Colors[ this->m_Colors.size( ) - 2 ];
-      else
-        new_color =
-          this->m_Colors[
-            ( ev_fpa->FrontId - 1 ) % ( this->m_Colors.size( ) - 2 )
-            ];
-      TLabel old_color = this->m_Labels->GetPixel( ev_fpa->Vertex );
-      if( !( new_color == old_color ) )
-      {
-        this->m_Labels->SetPixel( ev_fpa->Vertex, new_color );
-        this->m_VTKLabels->Modified( );
-        this->Render( );
-
-      } // fi
-
-    } // fi
-  }
-  else if( ev_start != NULL )
-  {
-    const TImage* image = filter->GetInput( );
-    this->m_Labels = TLabels::New( );
-    this->m_Labels->
-      SetLargestPossibleRegion( image->GetLargestPossibleRegion( ) );
-    this->m_Labels->SetRequestedRegion( image->GetRequestedRegion( ) );
-    this->m_Labels->SetBufferedRegion( image->GetBufferedRegion( ) );
-    this->m_Labels->SetOrigin( image->GetOrigin( ) );
-    this->m_Labels->SetSpacing( image->GetSpacing( ) );
-    this->m_Labels->SetDirection( image->GetDirection( ) );
-    this->m_Labels->Allocate( );
-    this->m_Labels->FillBuffer( this->m_Colors.back( ) );
-#ifdef USE_ivq
-    this->m_VTKLabels = TVTKLabels::New( );
-    this->m_VTKLabels->SetInput( this->m_Labels );
-    this->m_VTKLabels->Update( );
-    this->StartVisualization( );
-#endif // USE_ivq
-  }
-  else if( ev_end != NULL )
-  {
-    this->EndVisualization( );
-    this->m_Labels = NULL;
-    this->m_VTKLabels = NULL;
-
-  } // fi
-}
-
-// -------------------------------------------------------------------------
-template< class _TFilter >
-fpa::Image::VisualDebugger< _TFilter >::
-VisualDebugger( )
-  : Superclass( )
-{
-  unsigned char colors[ 8 ][ 4 ] =
-  {
-    { 255,   0,   0, 128 },
-    {   0, 255,   0, 128 },
-    {   0,   0, 255, 128 },
-    {   0, 255, 255, 128 },
-    { 255,   0, 255, 128 },
-    { 255, 255,   0, 128 },
-    { 255, 128,  64, 255 },
-    {   0,   0,   0,   0 }
-  };
-  for( unsigned int i = 0; i < 8; ++i )
-    this->m_Colors.push_back( TLabel( colors[ i ] ) );
-
-#ifdef USE_ivq
-  this->m_Renderer = NULL;
-  this->m_Interactor = NULL;
-#endif // USE_ivq
-}
-
-// -------------------------------------------------------------------------
-template< class _TFilter >
-fpa::Image::VisualDebugger< _TFilter >::
-~VisualDebugger( )
-{
-}
-
-#endif // __fpa__Image__VisualDebugger__h__
-
-// eof - $RCSfile$
diff --git a/lib/fpa/Image/VisualDebugger2D.h b/lib/fpa/Image/VisualDebugger2D.h
deleted file mode 100644 (file)
index 21346d9..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-// =========================================================================
-// @author Leonardo Florez Valencia
-// @email florez-l@javeriana.edu.co
-// =========================================================================
-
-#ifndef __fpa__Image__VisualDebugger2D__h__
-#define __fpa__Image__VisualDebugger2D__h__
-
-#include <fpa/Image/VisualDebugger.h>
-#ifdef USE_ivq
-#include <vtkSmartPointer.h>
-#include <ivq/VTK/ImageActor.h>
-#endif // USE_ivq
-
-namespace fpa
-{
-  namespace Image
-  {
-    /**
-     */
-    template< class _TFilter >
-    class VisualDebugger2D
-      : public fpa::Image::VisualDebugger< _TFilter >
-    {
-    public:
-      typedef VisualDebugger2D                       Self;
-      typedef fpa::Image::VisualDebugger< _TFilter > Superclass;
-      typedef itk::SmartPointer< Self >              Pointer;
-      typedef itk::SmartPointer< const Self >        ConstPointer;
-
-      typedef typename Superclass::TFilter TFilter;
-      typedef typename Superclass::TImage  TImage;
-      typedef typename Superclass::TLabel  TLabel;
-      typedef typename Superclass::TLabels TLabels;
-#ifdef USE_ivq
-      typedef typename Superclass::TVTKLabels TVTKLabels;
-      typedef ivq::VTK::ImageActor TImageActor;
-#endif // USE_ivq
-
-    public:
-      itkNewMacro( Self );
-      itkTypeMacro( fpa::Image::VisualDebugger2D, fpa::Image::VisualDebugger );
-
-    public:
-      virtual void Render( ) override;
-      virtual void StartVisualization( ) override;
-      virtual void EndVisualization( ) override;
-
-    protected:
-      VisualDebugger2D( );
-      virtual ~VisualDebugger2D( );
-
-    private:
-      // Purposely not implemented.
-      VisualDebugger2D( const Self& other );
-      Self& operator=( const Self& other );
-
-    protected:
-#ifdef USE_ivq
-      vtkSmartPointer< TImageActor > m_Actor;
-      unsigned long m_NumberOfPixels;
-      unsigned long m_RenderCount;
-#endif // USE_ivq
-    };
-
-  } // ecapseman
-
-} // ecapseman
-
-#ifndef ITK_MANUAL_INSTANTIATION
-#  include <fpa/Image/VisualDebugger2D.hxx>
-#endif // ITK_MANUAL_INSTANTIATION
-
-#endif // __fpa__Image__VisualDebugger2D__h__
-
-// eof - $RCSfile$
diff --git a/lib/fpa/Image/VisualDebugger2D.hxx b/lib/fpa/Image/VisualDebugger2D.hxx
deleted file mode 100644 (file)
index 91eff97..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-// =========================================================================
-// @author Leonardo Florez Valencia
-// @email florez-l@javeriana.edu.co
-// =========================================================================
-
-#ifndef __fpa__Image__VisualDebugger2D__hxx__
-#define __fpa__Image__VisualDebugger2D__hxx__
-
-#include <vtkRenderer.h>
-#include <vtkRenderWindowInteractor.h>
-
-// -------------------------------------------------------------------------
-template< class _TFilter >
-void fpa::Image::VisualDebugger2D< _TFilter >::
-Render( )
-{
-#ifdef USE_ivq
-  if( this->m_Renderer == NULL || this->m_Interactor == NULL )
-    return;
-  this->m_Actor->Modified( );
-  this->m_RenderCount = ( this->m_RenderCount + 1 ) % this->m_NumberOfPixels;
-  if( this->m_RenderCount == 0 )
-    this->m_Interactor->Render( );
-#endif // USE_ivq
-}
-
-// -------------------------------------------------------------------------
-template< class _TFilter >
-void fpa::Image::VisualDebugger2D< _TFilter >::
-StartVisualization( )
-{
-#ifdef USE_ivq
-  if( this->m_Renderer == NULL || this->m_Interactor == NULL )
-    return;
-  this->m_Actor = vtkSmartPointer< TImageActor >::New( );
-  this->m_Actor->SetInputData( this->m_VTKLabels->GetOutput( ) );
-  this->m_Actor->Update( );
-  this->m_Renderer->AddViewProp( this->m_Actor );
-
-  this->m_NumberOfPixels =
-    double(
-      this->m_VTKLabels->GetInput( )->
-      GetRequestedRegion( ).GetNumberOfPixels( )
-      ) * 0.005;
-  this->m_RenderCount = 0;
-
-#endif // USE_ivq
-}
-
-// -------------------------------------------------------------------------
-template< class _TFilter >
-void fpa::Image::VisualDebugger2D< _TFilter >::
-EndVisualization( )
-{
-}
-
-// -------------------------------------------------------------------------
-template< class _TFilter >
-fpa::Image::VisualDebugger2D< _TFilter >::
-VisualDebugger2D( )
-  : Superclass( )
-{
-}
-
-// -------------------------------------------------------------------------
-template< class _TFilter >
-fpa::Image::VisualDebugger2D< _TFilter >::
-~VisualDebugger2D( )
-{
-}
-
-#endif // __fpa__Image__VisualDebugger2D__hxx__
-
-// eof - $RCSfile$
diff --git a/lib/fpa/VTK/Image/PolyLineParametricPathToPolyDataFilter.h b/lib/fpa/VTK/Image/PolyLineParametricPathToPolyDataFilter.h
new file mode 100644 (file)
index 0000000..a8b9ea0
--- /dev/null
@@ -0,0 +1,73 @@
+// =========================================================================
+// @author Leonardo Florez Valencia
+// @email florez-l@javeriana.edu.co
+// =========================================================================
+#ifndef __fpa__VTK__Image__PolyLineParametricPathToPolyDataFilter__h__
+#define __fpa__VTK__Image__PolyLineParametricPathToPolyDataFilter__h__
+
+#include <vtkPolyDataAlgorithm.h>
+
+namespace fpa
+{
+  namespace VTK
+  {
+    namespace Image
+    {
+      /**
+       */
+      template< class _TPath >
+      class PolyLineParametricPathToPolyDataFilter
+        : public vtkPolyDataAlgorithm
+      {
+      public:
+        typedef PolyLineParametricPathToPolyDataFilter Self;
+        typedef _TPath                                 TPath;
+
+      public:
+        vtkTypeMacro(
+          PolyLineParametricPathToPolyDataFilter,
+          vtkPolyDataAlgorithm
+          );
+
+      public:
+        static Self* New( );
+
+        const TPath* GetInput( ) const;
+        void SetInput( const TPath* path );
+
+      protected:
+        PolyLineParametricPathToPolyDataFilter( );
+        virtual ~PolyLineParametricPathToPolyDataFilter( );
+
+        int RequestData(
+          vtkInformation* information,
+          vtkInformationVector** input,
+          vtkInformationVector* output
+          );
+        int RequestInformation(
+          vtkInformation* information,
+          vtkInformationVector** input,
+          vtkInformationVector* output
+          );
+
+      private:
+        // Purposely not implemented
+        PolyLineParametricPathToPolyDataFilter( const Self& );
+        void operator=( const Self& );
+
+      protected:
+        const TPath* m_PolyLineParametricPath;
+      };
+
+    } // ecapseman
+
+  } // ecapseman
+
+} // ecapseman
+
+#ifndef ITK_MANUAL_INSTANTIATION
+#  include <fpa/VTK/Image/PolyLineParametricPathToPolyDataFilter.hxx>
+#endif // ITK_MANUAL_INSTANTIATION
+#endif // __fpa__VTK__Image__PolyLineParametricPathToPolyDataFilter__h__
+
+// eof - $RCSfile$
similarity index 61%
rename from lib/fpa/Image/PolyLineParametricPathToPolyDataFilter.hxx
rename to lib/fpa/VTK/Image/PolyLineParametricPathToPolyDataFilter.hxx
index 7dd4cb1793f3fa523a90fc25ca58a16065cd701b..ad995aab2d08190f73b0ce6fccb4fb565f03fe03 100644 (file)
@@ -2,85 +2,75 @@
 // @author Leonardo Florez Valencia
 // @email florez-l@javeriana.edu.co
 // =========================================================================
+#ifndef __fpa__VTK__Image__PolyLineParametricPathToPolyDataFilter__hxx__
+#define __fpa__VTK__Image__PolyLineParametricPathToPolyDataFilter__hxx__
 
-#ifndef __fpa__Image__PolyLineParametricPathToPolyDataFilter__hxx__
-#define __fpa__Image__PolyLineParametricPathToPolyDataFilter__hxx__
-
-#ifdef USE_VTK
-#  include <vtkCellArray.h>
-#  include <vtkInformation.h>
-#  include <vtkInformationVector.h>
-#  include <vtkPointData.h>
-#  include <vtkUnsignedIntArray.h>
-#  include <vtkSmartPointer.h>
-#endif // USE_VTK
+#include <vtkCellArray.h>
+#include <vtkInformation.h>
+#include <vtkInformationVector.h>
+#include <vtkPointData.h>
+#include <vtkUnsignedIntArray.h>
+#include <vtkSmartPointer.h>
 
 // -------------------------------------------------------------------------
-template< class _TPolyLineParametricPath >
-typename fpa::Image::PolyLineParametricPathToPolyDataFilter< _TPolyLineParametricPath >::
-Self* fpa::Image::PolyLineParametricPathToPolyDataFilter< _TPolyLineParametricPath >::
+template< class _TPath >
+typename fpa::VTK::Image::PolyLineParametricPathToPolyDataFilter< _TPath >::
+Self* fpa::VTK::Image::PolyLineParametricPathToPolyDataFilter< _TPath >::
 New( )
 {
   return( new Self( ) );
 }
 
 // -------------------------------------------------------------------------
-template< class _TPolyLineParametricPath >
+template< class _TPath >
 const typename
-fpa::Image::PolyLineParametricPathToPolyDataFilter< _TPolyLineParametricPath >::
-TPolyLineParametricPath* fpa::Image::PolyLineParametricPathToPolyDataFilter< _TPolyLineParametricPath >::
+fpa::VTK::Image::PolyLineParametricPathToPolyDataFilter< _TPath >::
+TPath* fpa::VTK::Image::PolyLineParametricPathToPolyDataFilter< _TPath >::
 GetInput( ) const
 {
   return( this->m_PolyLineParametricPath );
 }
 
 // -------------------------------------------------------------------------
-template< class _TPolyLineParametricPath >
-void fpa::Image::PolyLineParametricPathToPolyDataFilter< _TPolyLineParametricPath >::
-SetInput( const TPolyLineParametricPath* path )
+template< class _TPath >
+void fpa::VTK::Image::PolyLineParametricPathToPolyDataFilter< _TPath >::
+SetInput( const TPath* path )
 {
   if( this->m_PolyLineParametricPath != path )
   {
     this->m_PolyLineParametricPath = path;
-#ifdef USE_VTK
     this->Modified( );
-#endif // USE_VTK
 
   } // fi
 }
 
 // -------------------------------------------------------------------------
-template< class _TPolyLineParametricPath >
-fpa::Image::PolyLineParametricPathToPolyDataFilter< _TPolyLineParametricPath >::
+template< class _TPath >
+fpa::VTK::Image::PolyLineParametricPathToPolyDataFilter< _TPath >::
 PolyLineParametricPathToPolyDataFilter( )
-#ifdef USE_VTK
   : vtkPolyDataAlgorithm( ),
     m_PolyLineParametricPath( NULL )
-#endif // USE_VTK
 {
-#ifdef USE_VTK
   this->SetNumberOfInputPorts( 0 );
-#endif // USE_VTK
 }
 
 // -------------------------------------------------------------------------
-template< class _TPolyLineParametricPath >
-fpa::Image::PolyLineParametricPathToPolyDataFilter< _TPolyLineParametricPath >::
+template< class _TPath >
+fpa::VTK::Image::PolyLineParametricPathToPolyDataFilter< _TPath >::
 ~PolyLineParametricPathToPolyDataFilter( )
 {
 }
 
-#ifdef USE_VTK
 // -------------------------------------------------------------------------
-template< class _TPolyLineParametricPath >
-int fpa::Image::PolyLineParametricPathToPolyDataFilter< _TPolyLineParametricPath >::
+template< class _TPath >
+int fpa::VTK::Image::PolyLineParametricPathToPolyDataFilter< _TPath >::
 RequestData(
   vtkInformation* information,
   vtkInformationVector** input,
   vtkInformationVector* output
   )
 {
-  static const unsigned int dim = TPolyLineParametricPath::PathDimension;
+  static const unsigned int dim = TPath::PathDimension;
   if( this->m_PolyLineParametricPath == NULL )
     return( 0 );
 
@@ -104,7 +94,7 @@ RequestData(
   vtkCellArray* lines = out->GetLines( );
 
   // Assign all data
-  const TPolyLineParametricPath* path = this->GetInput( );
+  const TPath* path = this->GetInput( );
   for( unsigned long i = 0; i < path->GetSize( ); ++i )
   {
     auto pnt = path->GetPoint( i );
@@ -128,8 +118,8 @@ RequestData(
 }
 
 // -------------------------------------------------------------------------
-template< class _TPolyLineParametricPath >
-int fpa::Image::PolyLineParametricPathToPolyDataFilter< _TPolyLineParametricPath >::
+template< class _TPath >
+int fpa::VTK::Image::PolyLineParametricPathToPolyDataFilter< _TPath >::
 RequestInformation(
   vtkInformation* information,
   vtkInformationVector** input,
@@ -138,8 +128,6 @@ RequestInformation(
 {
   return( 1 );
 }
-#endif // USE_VTK
-
-#endif // __fpa__Image__PolyLineParametricPathToPolyDataFilterFilter__hxx__
 
+#endif // __fpa__VTK__Image__PolyLineParametricPathToPolyDataFilterFilter__hxx__
 // eof - $RCSfile$
diff --git a/lib/fpa/VTK/Image/SkeletonToPolyDataFilter.h b/lib/fpa/VTK/Image/SkeletonToPolyDataFilter.h
new file mode 100644 (file)
index 0000000..f34ae2e
--- /dev/null
@@ -0,0 +1,71 @@
+// =========================================================================
+// @author Leonardo Florez Valencia
+// @email florez-l@javeriana.edu.co
+// =========================================================================
+#ifndef __fpa__VTK__Image__SkeletonToPolyDataFilter__h__
+#define __fpa__VTK__Image__SkeletonToPolyDataFilter__h__
+
+#include <vtkPolyDataAlgorithm.h>
+
+namespace fpa
+{
+  namespace VTK
+  {
+    namespace Image
+    {
+      /**
+       */
+      template< class _TSkeleton >
+      class SkeletonToPolyDataFilter
+        : public vtkPolyDataAlgorithm
+      {
+      public:
+        typedef SkeletonToPolyDataFilter Self;
+        typedef _TSkeleton               TSkeleton;
+
+      public:
+        vtkTypeMacro( SkeletonToPolyDataFilter, vtkPolyDataAlgorithm );
+
+      public:
+        static Self* New( );
+
+        const TSkeleton* GetInput( ) const;
+        void SetInput( const TSkeleton* sk );
+
+      protected:
+        SkeletonToPolyDataFilter( );
+        virtual ~SkeletonToPolyDataFilter( );
+
+        int RequestData(
+          vtkInformation* information,
+          vtkInformationVector** input,
+          vtkInformationVector* output
+          );
+        int RequestInformation(
+          vtkInformation* information,
+          vtkInformationVector** input,
+          vtkInformationVector* output
+          );
+
+      private:
+        // Purposely not implemented
+        SkeletonToPolyDataFilter( const Self& );
+        void operator=( const Self& );
+
+      protected:
+        const TSkeleton* m_Skeleton;
+      };
+
+    } // ecapseman
+
+  } // ecapseman
+
+} // ecapseman
+
+#ifndef ITK_MANUAL_INSTANTIATION
+#  include <fpa/VTK/Image/SkeletonToPolyDataFilter.hxx>
+#endif // ITK_MANUAL_INSTANTIATION
+
+#endif // __fpa__VTK__Image__SkeletonToPolyDataFilter__h__
+
+// eof - $RCSfile$
similarity index 79%
rename from lib/fpa/Image/SkeletonToPolyDataFilter.hxx
rename to lib/fpa/VTK/Image/SkeletonToPolyDataFilter.hxx
index c9d1136e99f5d3aa8ad78321d2d5cb4a038d0ecf..6b1aeef3cbecbc58652c657a3464167f6abcfc9b 100644 (file)
@@ -2,23 +2,20 @@
 // @author Leonardo Florez Valencia
 // @email florez-l@javeriana.edu.co
 // =========================================================================
+#ifndef __fpa__VTK__Image__SkeletonToPolyDataFilter__hxx__
+#define __fpa__VTK__Image__SkeletonToPolyDataFilter__hxx__
 
-#ifndef __fpa__Image__SkeletonToPolyDataFilter__hxx__
-#define __fpa__Image__SkeletonToPolyDataFilter__hxx__
-
-#ifdef USE_VTK
-#  include <vtkCellArray.h>
-#  include <vtkInformation.h>
-#  include <vtkInformationVector.h>
-#  include <vtkPointData.h>
-#  include <vtkUnsignedIntArray.h>
-#  include <vtkSmartPointer.h>
-#endif // USE_VTK
+#include <vtkCellArray.h>
+#include <vtkInformation.h>
+#include <vtkInformationVector.h>
+#include <vtkPointData.h>
+#include <vtkUnsignedIntArray.h>
+#include <vtkSmartPointer.h>
 
 // -------------------------------------------------------------------------
 template< class _TSkeleton >
-typename fpa::Image::SkeletonToPolyDataFilter< _TSkeleton >::
-Self* fpa::Image::SkeletonToPolyDataFilter< _TSkeleton >::
+typename fpa::VTK::Image::SkeletonToPolyDataFilter< _TSkeleton >::
+Self* fpa::VTK::Image::SkeletonToPolyDataFilter< _TSkeleton >::
 New( )
 {
   return( new Self( ) );
@@ -27,8 +24,8 @@ New( )
 // -------------------------------------------------------------------------
 template< class _TSkeleton >
 const typename
-fpa::Image::SkeletonToPolyDataFilter< _TSkeleton >::
-TSkeleton* fpa::Image::SkeletonToPolyDataFilter< _TSkeleton >::
+fpa::VTK::Image::SkeletonToPolyDataFilter< _TSkeleton >::
+TSkeleton* fpa::VTK::Image::SkeletonToPolyDataFilter< _TSkeleton >::
 GetInput( ) const
 {
   return( this->m_Skeleton );
@@ -36,44 +33,37 @@ GetInput( ) const
 
 // -------------------------------------------------------------------------
 template< class _TSkeleton >
-void fpa::Image::SkeletonToPolyDataFilter< _TSkeleton >::
+void fpa::VTK::Image::SkeletonToPolyDataFilter< _TSkeleton >::
 SetInput( const TSkeleton* sk )
 {
   if( this->m_Skeleton != sk )
   {
     this->m_Skeleton = sk;
-#ifdef USE_VTK
     this->Modified( );
-#endif // USE_VTK
 
   } // fi
 }
 
 // -------------------------------------------------------------------------
 template< class _TSkeleton >
-fpa::Image::SkeletonToPolyDataFilter< _TSkeleton >::
+fpa::VTK::Image::SkeletonToPolyDataFilter< _TSkeleton >::
 SkeletonToPolyDataFilter( )
-#ifdef USE_VTK
   : vtkPolyDataAlgorithm( ),
     m_Skeleton( NULL )
-#endif // USE_VTK
 {
-#ifdef USE_VTK
   this->SetNumberOfInputPorts( 0 );
-#endif // USE_VTK
 }
 
 // -------------------------------------------------------------------------
 template< class _TSkeleton >
-fpa::Image::SkeletonToPolyDataFilter< _TSkeleton >::
+fpa::VTK::Image::SkeletonToPolyDataFilter< _TSkeleton >::
 ~SkeletonToPolyDataFilter( )
 {
 }
 
-#ifdef USE_VTK
 // -------------------------------------------------------------------------
 template< class _TSkeleton >
-int fpa::Image::SkeletonToPolyDataFilter< _TSkeleton >::
+int fpa::VTK::Image::SkeletonToPolyDataFilter< _TSkeleton >::
 RequestData(
   vtkInformation* information,
   vtkInformationVector** input,
@@ -150,7 +140,7 @@ RequestData(
 
 // -------------------------------------------------------------------------
 template< class _TSkeleton >
-int fpa::Image::SkeletonToPolyDataFilter< _TSkeleton >::
+int fpa::VTK::Image::SkeletonToPolyDataFilter< _TSkeleton >::
 RequestInformation(
   vtkInformation* information,
   vtkInformationVector** input,
@@ -159,8 +149,6 @@ RequestInformation(
 {
   return( 1 );
 }
-#endif // USE_VTK
-
-#endif // __fpa__Image__SkeletonToPolyDataFilterFilter__hxx__
 
+#endif // __fpa__VTK__Image__SkeletonToPolyDataFilterFilter__hxx__
 // eof - $RCSfile$
index 445f31480ea5a14c3c692b5faf11efda43b4d488..38f8172c77351ad26764863ed9ce653d90db4fb8 100644 (file)
@@ -1,3 +1,7 @@
+// =========================================================================
+// @author Leonardo Florez Valencia
+// @email florez-l@javeriana.edu.co
+// =========================================================================
 
 #include <fpa/fpa_export.h>
 #include <string>
index 7a3c48be6b071d27f4d0e5eff67ebf4fe6d13ceb..d769819a742543c4555620bb15853b9003a9d977 100644 (file)
@@ -1,10 +1,8 @@
-option(fpa_BUILD_TESTS "Build command line tests." OFF)
-if(fpa_BUILD_TESTS)
-  include_directories(
-    ${PROJECT_SOURCE_DIR}/lib
-    ${PROJECT_BINARY_DIR}/lib
-    )
-  subdirs(image)
-endif(fpa_BUILD_TESTS)
+## =========================================================================
+## @author Leonardo Florez Valencia
+## @email florez-l@javeriana.edu.co
+## =========================================================================
+
+subdirs(image)
 
 ## eof - $RCSfile$
diff --git a/tests/image/BaseFunctions.h b/tests/image/BaseFunctions.h
deleted file mode 100644 (file)
index fc76be7..0000000
+++ /dev/null
@@ -1,248 +0,0 @@
-// =========================================================================
-// @author Leonardo Florez Valencia
-// @email florez-l@javeriana.edu.co
-// =========================================================================
-
-#ifndef __fpa__tests__image__BaseFunctions__h__
-#define __fpa__tests__image__BaseFunctions__h__
-
-#include <cstdarg>
-#include <string>
-
-#include <itkImageFileReader.h>
-#include <itkImageFileWriter.h>
-
-#include <fpa/Config.h>
-/* TODO
-   #ifdef USE_ivq
-   #  include <itkImageToVTKImageFilter.h>
-   #  include <itkVTKImageToImageFilter.h>
-   #  include <vtkSmartPointer.h>
-   #  include <vtkRenderWindow.h>
-   #  include <ivq/VTK/ImageViewer.h>
-   #  include <ivq/VTK/BrushWidget.h>
-   #  include <ivq/VTK/SeedWidgetOverImageActor.h>
-   #  include <fpa/Image/VisualDebugger2D.h>
-   #endif // USE_ivq
-*/
-
-namespace fpa
-{
-  namespace tests
-  {
-    namespace image
-    {
-      // -------------------------------------------------------------------
-      template< class _TPointer >
-      void CreateImage(
-        _TPointer& img,
-        const typename _TPointer::ObjectType::PixelType& zero,
-        ...
-        )
-      {
-        typedef typename _TPointer::ObjectType _TImage;
-
-        va_list vl;
-        va_start( vl, zero );
-
-        typename _TImage::SizeType size;
-        for( unsigned int d = 0; d < _TImage::ImageDimension; ++d )
-          size[ d ] = va_arg( vl, int );
-
-        typename _TImage::SpacingType spac;
-        for( unsigned int d = 0; d < _TImage::ImageDimension; ++d )
-          spac[ d ] = va_arg( vl, double );
-
-        img = _TImage::New( );
-        img->SetRegions( size );
-        img->SetSpacing( spac );
-        img->Allocate( );
-        img->FillBuffer( zero );
-
-        va_end( vl );
-      }
-
-      // -------------------------------------------------------------------
-      template< class _TPointer >
-      std::string Read( _TPointer& img, const std::string& fname )
-      {
-        typedef typename _TPointer::ObjectType _TImage;
-        typedef itk::ImageFileReader< _TImage > _TReader;
-
-        typename _TReader::Pointer reader = _TReader::New( );
-        reader->SetFileName( fname );
-        try
-        {
-          reader->Update( );
-        }
-        catch( std::exception& err )
-        {
-          return( err.what( ) );
-
-        } // ytr
-        img = reader->GetOutput( );
-        img->DisconnectPipeline( );
-        return( "" );
-      }
-
-      // -------------------------------------------------------------------
-      template< class _TImage >
-      std::string Write( const _TImage* img, const std::string& fname )
-      {
-        typedef itk::ImageFileWriter< _TImage > _TWriter;
-
-        typename _TWriter::Pointer writer = _TWriter::New( );
-        writer->SetInput( img );
-        writer->SetFileName( fname );
-        try
-        {
-          writer->Update( );
-        }
-        catch( std::exception& err )
-        {
-          return( err.what( ) );
-
-        } // ytr
-        return( "" );
-      }
-
-      // -------------------------------------------------------------------
-      /* TODO
-         #ifdef USE_ivq
-         template< class _TFilter >
-         class Viewer
-         {
-         public:
-         typedef _TFilter TFilter;
-         typedef typename _TFilter::TInputImage TInputImage;
-
-         public:
-         Viewer( const TInputImage* image )
-         {
-         this->m_VTKInputImage = TVTKInputImage::New( );
-         this->m_VTKInputImage->SetInput( image );
-         this->m_VTKInputImage->Update( );
-
-         this->m_Viewer = vtkSmartPointer< ivq::VTK::ImageViewer >::New( );
-         this->m_Viewer->SetInputData( this->m_VTKInputImage->GetOutput( ) );
-         }
-
-         virtual ~Viewer( )
-         {
-         }
-
-         void ActivateSeedWidget( )
-         {
-         this->m_SeedWidget =
-         vtkSmartPointer< ivq::VTK::SeedWidgetOverImageActor >::New( );
-         this->m_SeedWidget->SetActor( this->m_Viewer->GetImageActor( ) );
-         this->m_SeedWidget->SetInteractor(
-         this->m_Viewer->GetRenderWindow( )->GetInteractor( )
-         );
-         }
-
-         void ActivateBrushWidget( )
-         {
-         this->m_BrushWidget =
-         vtkSmartPointer< ivq::VTK::BrushWidget >::New( );
-         this->m_BrushWidget->SetImageActor( this->m_Viewer->GetImageActor( ) );
-         this->m_BrushWidget->SetInteractor(
-         this->m_Viewer->GetRenderWindow( )->GetInteractor( )
-         );
-         }
-
-         void Show( )
-         {
-         this->m_Viewer->Render( );
-         this->m_Viewer->ResetCamera( );
-         this->m_Viewer->Initialize( );
-         this->m_Viewer->Render( );
-         if( this->m_SeedWidget.GetPointer( ) != NULL )
-         this->m_SeedWidget->EnabledOn( );
-         if( this->m_BrushWidget.GetPointer( ) != NULL )
-         this->m_BrushWidget->EnabledOn( );
-         this->m_Viewer->Start( );
-         if( this->m_SeedWidget.GetPointer( ) != NULL )
-         this->m_SeedWidget->EnabledOff( );
-         if( this->m_BrushWidget.GetPointer( ) != NULL )
-         this->m_BrushWidget->EnabledOff( );
-         }
-
-         void AssociateSeedsTo( TFilter* filter )
-         {
-         if( this->m_SeedWidget.GetPointer( ) != NULL )
-         {
-         const ivq::VTK::SeedWidgetOverImageActor::TSeeds& wdg_seeds =
-         this->m_SeedWidget->GetSeeds( );
-         ivq::VTK::SeedWidgetOverImageActor::TSeeds::const_iterator wsIt;
-         for( wsIt = wdg_seeds.begin( ); wsIt != wdg_seeds.end( ); ++wsIt )
-         {
-         typename TInputImage::PointType pnt;
-         for( unsigned int i = 0; i < wsIt->second.size( ); i += 3 )
-         {
-         pnt[ 0 ] = wsIt->second[ i ];
-         pnt[ 1 ] = wsIt->second[ i + 1 ];
-
-         typename TInputImage::IndexType idx;
-         filter->GetInput( )->TransformPhysicalPointToIndex( pnt, idx );
-         filter->AddSeed( idx );
-
-         } // rof
-
-         } // rof
-
-         } // fi
-         }
-
-         void AssociateLabelsTo( TFilter* filter )
-         {
-         if( this->m_BrushWidget.GetPointer( ) != NULL )
-         {
-         typedef typename TFilter::TLabelImage _TLabelImage;
-         typedef itk::VTKImageToImageFilter< _TLabelImage > TITKImage;
-         typename TITKImage::Pointer itk_image = TITKImage::New( );
-         itk_image->SetInput( this->m_BrushWidget->GetCanvas( ) );
-         itk_image->Update( );
-         filter->SetLabels( itk_image->GetOutput( ) );
-
-         } // fi
-         }
-
-         void ObserveFilter( TFilter* filter )
-         {
-         typedef fpa::Image::VisualDebugger2D< TFilter > _TDeb;
-         typedef typename TFilter::TEvent                _TEvent;
-         typename _TDeb::Pointer deb = _TDeb::New( );
-         deb->SetVisualization(
-         this->m_Viewer->GetRenderer( ),
-         this->m_Viewer->GetRenderWindow( )->GetInteractor( )
-         );
-         this->m_Observer1 = filter->AddObserver( itk::StartEvent( ), deb );
-         this->m_Observer2 = filter->AddObserver( itk::EndEvent( ), deb );
-         this->m_Observer3 = filter->AddObserver( _TEvent( ), deb );
-         filter->VisualDebugOn( );
-         }
-
-         protected:
-         typedef itk::ImageToVTKImageFilter< TInputImage > TVTKInputImage;
-         typename TVTKInputImage::Pointer                      m_VTKInputImage;
-         vtkSmartPointer< ivq::VTK::ImageViewer >              m_Viewer;
-         vtkSmartPointer< ivq::VTK::SeedWidgetOverImageActor > m_SeedWidget;
-         vtkSmartPointer< ivq::VTK::BrushWidget >              m_BrushWidget;
-         unsigned long m_Observer1;
-         unsigned long m_Observer2;
-         unsigned long m_Observer3;
-         };
-         #endif // USE_ivq
-      */
-
-    } // ecapseman
-
-  } // ecapseman
-
-} // ecapseman
-
-
-#endif // __fpa__tests__image__BaseFunctions__h__
-
-// eof - $RCSfile$
index fa58c65a7f2188d4c0836fca668bcd410a506fec..633fb98bcdd220097412da940454875565db8d76 100644 (file)
@@ -1,18 +1,8 @@
-set(_pfx test_fpa_image_)
-set(
-  _examples
-  RegionGrow_Tautology
-  RegionGrow_BinaryThreshold
-  MoriSegmentation
-  Dijkstra_Identity
-  Dijkstra_Gaussian
-  RandomWalker
-  SkeletonFilter
-  SkeletonToPolyData
-  )
-foreach(_e ${_examples})
-  add_executable(${_pfx}${_e} ${_e}.cxx)
-  target_link_libraries(${_pfx}${_e} ivq::ivq fpa)
-endforeach(_e)
+## =========================================================================
+## @author Leonardo Florez Valencia
+## @email florez-l@javeriana.edu.co
+## =========================================================================
+
+subdirs(Dijkstra RandomWalker RegionGrow VTK)
 
 ## eof - $RCSfile$
diff --git a/tests/image/Dijkstra/CMakeLists.txt b/tests/image/Dijkstra/CMakeLists.txt
new file mode 100644 (file)
index 0000000..a68b3cc
--- /dev/null
@@ -0,0 +1,22 @@
+## =========================================================================
+## @author Leonardo Florez Valencia
+## @email florez-l@javeriana.edu.co
+## =========================================================================
+
+set(_pfx test_fpa_Image_Dijkstra_)
+set(
+  _tests
+  Identity
+  Invert
+  Gaussian
+  ExtractAxis
+  Skeleton
+  )
+include_directories(${PROJECT_SOURCE_DIR}/lib ${PROJECT_BINARY_DIR}/lib)
+
+foreach(_t ${_tests})
+  add_executable(${_pfx}${_t} ${_t}.cxx)
+  target_link_libraries(${_pfx}${_t} fpa)
+endforeach(_t)
+
+## eof - $RCSfile$
diff --git a/tests/image/Dijkstra/ExtractAxis.cxx b/tests/image/Dijkstra/ExtractAxis.cxx
new file mode 100644 (file)
index 0000000..d9eb7ad
--- /dev/null
@@ -0,0 +1,80 @@
+// =========================================================================
+// @author Leonardo Florez Valencia
+// @email florez-l@javeriana.edu.co
+// =========================================================================
+
+#include <itkImage.h>
+#include <itkImageFileReader.h>
+#include <fpa/Common/Image/PolyLineParametricPathWriter.h>
+#include <fpa/Filters/Image/ExtractAxis.h>
+
+// -------------------------------------------------------------------------
+const unsigned int Dim = 2;
+typedef unsigned char TPixel;
+typedef float         TScalar;
+typedef itk::Image< TPixel, Dim > TImage;
+
+// -------------------------------------------------------------------------
+int main( int argc, char* argv[] )
+{
+  // Get arguments
+  if( argc < 3 )
+  {
+    std::cerr
+      << "Usage: " << argv[ 0 ]
+      << " input_image output_axis [seeds]"
+      << std::endl;
+    return( 1 );
+
+  } // fi
+  std::string input_image_filename = argv[ 1 ];
+  std::string output_path_filename = argv[ 2 ];
+
+  // Read image
+  typedef itk::ImageFileReader< TImage > TImageReader;
+  TImageReader::Pointer input_image_reader = TImageReader::New( );
+  input_image_reader->SetFileName( input_image_filename );
+
+  // Prepare filter
+  typedef fpa::Filters::Image::ExtractAxis< TImage, TScalar > TFilter;
+  TFilter::Pointer filter = TFilter::New( );
+  filter->SetInput( input_image_reader->GetOutput( ) );
+
+  // Get all seeds
+  for( int i = 3; i < argc; i += Dim )
+  {
+    TImage::IndexType seed;
+    for( int j = 0; j < Dim; ++j )
+      if( i + j < argc )
+        seed[ j ] = std::atoi( argv[ i + j ] );
+    filter->AddSeed( seed );
+    if( i == 3 )
+      filter->SetStartIndex( seed );
+    else if( i == 4 )
+      filter->SetEndIndex( seed );
+
+  } // rof
+
+  // Execute filter
+  filter->Update( );
+
+  // Save results
+  typedef fpa::Common::Image::PolyLineParametricPathWriter< TFilter::TPath > TPathWriter;
+  TPathWriter::Pointer path_writer = TPathWriter::New( );
+  path_writer->SetInput( filter->GetOutput( ) );
+  path_writer->SetFileName( output_path_filename );
+
+  try
+  {
+    path_writer->Update( );
+  }
+  catch( std::exception& err )
+  {
+    std::cerr << "Error caught: " << err.what( ) << std::endl;
+    return( 1 );
+
+  } // yrt
+  return( 0 );
+}
+
+// eof - $RCSfile$
diff --git a/tests/image/Dijkstra/Gaussian.cxx b/tests/image/Dijkstra/Gaussian.cxx
new file mode 100644 (file)
index 0000000..3139e83
--- /dev/null
@@ -0,0 +1,102 @@
+// =========================================================================
+// @author Leonardo Florez Valencia
+// @email florez-l@javeriana.edu.co
+// =========================================================================
+
+#include <itkImage.h>
+#include <itkImageFileReader.h>
+#include <itkImageFileWriter.h>
+#include <fpa/Filters/Image/Dijkstra.h>
+#include <fpa/Functors/Dijkstra/Image/Gaussian.h>
+
+// -------------------------------------------------------------------------
+const unsigned int Dim = 2;
+typedef unsigned char TInputPixel;
+typedef float         TOutputPixel;
+typedef itk::Image< TInputPixel, Dim >  TInputImage;
+typedef itk::Image< TOutputPixel, Dim > TOutputImage;
+
+// -------------------------------------------------------------------------
+int main( int argc, char* argv[] )
+{
+  // Get arguments
+  if( argc < 7 )
+  {
+    std::cerr
+      << "Usage: " << argv[ 0 ]
+      << " input_image output_image output_marks output_mst alpha beta [seeds]"
+      << std::endl;
+    return( 1 );
+
+  } // fi
+  std::string input_image_filename = argv[ 1 ];
+  std::string output_image_filename = argv[ 2 ];
+  std::string output_marks_filename = argv[ 3 ];
+  std::string output_mst_filename = argv[ 4 ];
+  double alpha = std::atof( argv[ 5 ] );
+  double beta = std::atof( argv[ 6 ] );
+
+  // Read image
+  typedef itk::ImageFileReader< TInputImage > TInputImageReader;
+  TInputImageReader::Pointer input_image_reader = TInputImageReader::New( );
+  input_image_reader->SetFileName( input_image_filename );
+
+  // Prepare weight functor
+  typedef fpa::Functors::Dijkstra::Image::Gaussian< TInputImage, TOutputPixel > TWeight;
+  TWeight::Pointer weight = TWeight::New( );
+  weight->SetAlpha( alpha );
+  weight->SetBeta( beta );
+
+  // Prepare filter
+  typedef fpa::Filters::Image::Dijkstra< TInputImage, TOutputImage > TFilter;
+  TFilter::Pointer filter = TFilter::New( );
+  filter->SetInput( input_image_reader->GetOutput( ) );
+  filter->SetWeightFunction( weight );
+
+  // Get all seeds
+  for( int i = 7; i < argc; i += Dim )
+  {
+    TInputImage::IndexType seed;
+    for( int j = 0; j < Dim; ++j )
+      if( i + j < argc )
+        seed[ j ] = std::atoi( argv[ i + j ] );
+    filter->AddSeed( seed );
+
+  } // rof
+
+  // Execute filter
+  filter->Update( );
+
+  // Save results
+  typedef itk::ImageFileWriter< TFilter::TOutputImage > TOutputWriter;
+  TOutputWriter::Pointer output_writer = TOutputWriter::New( );
+  output_writer->SetInput( filter->GetOutput( ) );
+  output_writer->SetFileName( output_image_filename );
+
+  typedef itk::ImageFileWriter< TFilter::TMarksImage > TMarksWriter;
+  TMarksWriter::Pointer marks_writer = TMarksWriter::New( );
+  marks_writer->SetInput( filter->GetMarks( ) );
+  marks_writer->SetFileName( output_marks_filename );
+
+  typedef itk::ImageFileWriter< TFilter::TMST > TMSTWriter;
+  TMSTWriter::Pointer mst_writer = TMSTWriter::New( );
+  mst_writer->SetInput( filter->GetMinimumSpanningTree( ) );
+  mst_writer->SetFileName( output_mst_filename );
+
+  try
+  {
+    output_writer->Update( );
+    marks_writer->Update( );
+    mst_writer->Update( );
+  }
+  catch( std::exception& err )
+  {
+    std::cerr << "Error caught: " << err.what( ) << std::endl;
+    return( 1 );
+
+  } // yrt
+
+  return( 0 );
+}
+
+// eof - $RCSfile$
diff --git a/tests/image/Dijkstra/Identity.cxx b/tests/image/Dijkstra/Identity.cxx
new file mode 100644 (file)
index 0000000..223283a
--- /dev/null
@@ -0,0 +1,93 @@
+// =========================================================================
+// @author Leonardo Florez Valencia
+// @email florez-l@javeriana.edu.co
+// =========================================================================
+
+#include <itkImage.h>
+#include <itkImageFileWriter.h>
+#include <fpa/Filters/Image/Dijkstra.h>
+
+// -------------------------------------------------------------------------
+const unsigned int Dim = 2;
+typedef unsigned char TInputPixel;
+typedef float         TOutputPixel;
+typedef itk::Image< TInputPixel, Dim >  TInputImage;
+typedef itk::Image< TOutputPixel, Dim > TOutputImage;
+
+// -------------------------------------------------------------------------
+int main( int argc, char* argv[] )
+{
+  // Get arguments
+  if( argc < 5 )
+  {
+    std::cerr
+      << "Usage: " << argv[ 0 ]
+      << " output_image output_marks output_mst size [seeds]"
+      << std::endl;
+    return( 1 );
+
+  } // fi
+  std::string output_image_filename = argv[ 1 ];
+  std::string output_marks_filename = argv[ 2 ];
+  std::string output_mst_filename = argv[ 3 ];
+  TInputImage::SizeType size;
+  size.Fill( std::atoi( argv[ 4 ] ) );
+
+  // Create image
+  TInputImage::Pointer image = TInputImage::New( );
+  image->SetRegions( size );
+  image->Allocate( );
+  image->FillBuffer( TInputPixel( 1 ) );
+
+  // Prepare filter
+  typedef fpa::Filters::Image::Dijkstra< TInputImage, TOutputImage > TFilter;
+  TFilter::Pointer filter = TFilter::New( );
+  filter->SetInput( image );
+
+  // Get all seeds
+  for( int i = 5; i < argc; i += Dim )
+  {
+    TInputImage::IndexType seed;
+    for( int j = 0; j < Dim; ++j )
+      if( i + j < argc )
+        seed[ j ] = std::atoi( argv[ i + j ] );
+    filter->AddSeed( seed );
+
+  } // rof
+
+  // Execute filter
+  filter->Update( );
+
+  // Save results
+  typedef itk::ImageFileWriter< TFilter::TOutputImage > TOutputWriter;
+  TOutputWriter::Pointer output_writer = TOutputWriter::New( );
+  output_writer->SetInput( filter->GetOutput( ) );
+  output_writer->SetFileName( output_image_filename );
+
+  typedef itk::ImageFileWriter< TFilter::TMarksImage > TMarksWriter;
+  TMarksWriter::Pointer marks_writer = TMarksWriter::New( );
+  marks_writer->SetInput( filter->GetMarks( ) );
+  marks_writer->SetFileName( output_marks_filename );
+
+  typedef itk::ImageFileWriter< TFilter::TMST > TMSTWriter;
+  TMSTWriter::Pointer mst_writer = TMSTWriter::New( );
+  mst_writer->SetInput( filter->GetMinimumSpanningTree( ) );
+  mst_writer->SetFileName( output_mst_filename );
+
+  try
+  {
+    output_writer->Update( );
+    marks_writer->Update( );
+    mst_writer->Update( );
+  }
+  catch( std::exception& err )
+  {
+    std::cerr << "Error caught: " << err.what( ) << std::endl;
+    return( 1 );
+
+  } // yrt
+
+  return( 0 );
+}
+
+// eof - $RCSfile$
diff --git a/tests/image/Dijkstra/Invert.cxx b/tests/image/Dijkstra/Invert.cxx
new file mode 100644 (file)
index 0000000..fc0ace7
--- /dev/null
@@ -0,0 +1,102 @@
+// =========================================================================
+// @author Leonardo Florez Valencia
+// @email florez-l@javeriana.edu.co
+// =========================================================================
+
+#include <itkImage.h>
+#include <itkImageFileReader.h>
+#include <itkImageFileWriter.h>
+#include <fpa/Filters/Image/Dijkstra.h>
+#include <fpa/Functors/Dijkstra/Invert.h>
+
+// -------------------------------------------------------------------------
+const unsigned int Dim = 2;
+typedef unsigned char TInputPixel;
+typedef float         TOutputPixel;
+typedef itk::Image< TInputPixel, Dim >  TInputImage;
+typedef itk::Image< TOutputPixel, Dim > TOutputImage;
+
+// -------------------------------------------------------------------------
+int main( int argc, char* argv[] )
+{
+  // Get arguments
+  if( argc < 7 )
+  {
+    std::cerr
+      << "Usage: " << argv[ 0 ]
+      << " input_image output_image output_marks output_mst alpha beta [seeds]"
+      << std::endl;
+    return( 1 );
+
+  } // fi
+  std::string input_image_filename = argv[ 1 ];
+  std::string output_image_filename = argv[ 2 ];
+  std::string output_marks_filename = argv[ 3 ];
+  std::string output_mst_filename = argv[ 4 ];
+  double alpha = std::atof( argv[ 5 ] );
+  double beta = std::atof( argv[ 6 ] );
+
+  // Read image
+  typedef itk::ImageFileReader< TInputImage > TInputImageReader;
+  TInputImageReader::Pointer input_image_reader = TInputImageReader::New( );
+  input_image_reader->SetFileName( input_image_filename );
+
+  // Prepare weight functor
+  typedef fpa::Functors::Dijkstra::Invert< TOutputPixel > TWeight;
+  TWeight::Pointer weight = TWeight::New( );
+  weight->SetAlpha( alpha );
+  weight->SetBeta( beta );
+
+  // Prepare filter
+  typedef fpa::Filters::Image::Dijkstra< TInputImage, TOutputImage > TFilter;
+  TFilter::Pointer filter = TFilter::New( );
+  filter->SetInput( input_image_reader->GetOutput( ) );
+  filter->SetWeightFunction( weight );
+
+  // Get all seeds
+  for( int i = 7; i < argc; i += Dim )
+  {
+    TInputImage::IndexType seed;
+    for( int j = 0; j < Dim; ++j )
+      if( i + j < argc )
+        seed[ j ] = std::atoi( argv[ i + j ] );
+    filter->AddSeed( seed );
+
+  } // rof
+
+  // Execute filter
+  filter->Update( );
+
+  // Save results
+  typedef itk::ImageFileWriter< TFilter::TOutputImage > TOutputWriter;
+  TOutputWriter::Pointer output_writer = TOutputWriter::New( );
+  output_writer->SetInput( filter->GetOutput( ) );
+  output_writer->SetFileName( output_image_filename );
+
+  typedef itk::ImageFileWriter< TFilter::TMarksImage > TMarksWriter;
+  TMarksWriter::Pointer marks_writer = TMarksWriter::New( );
+  marks_writer->SetInput( filter->GetMarks( ) );
+  marks_writer->SetFileName( output_marks_filename );
+
+  typedef itk::ImageFileWriter< TFilter::TMST > TMSTWriter;
+  TMSTWriter::Pointer mst_writer = TMSTWriter::New( );
+  mst_writer->SetInput( filter->GetMinimumSpanningTree( ) );
+  mst_writer->SetFileName( output_mst_filename );
+
+  try
+  {
+    output_writer->Update( );
+    marks_writer->Update( );
+    mst_writer->Update( );
+  }
+  catch( std::exception& err )
+  {
+    std::cerr << "Error caught: " << err.what( ) << std::endl;
+    return( 1 );
+
+  } // yrt
+
+  return( 0 );
+}
+
+// eof - $RCSfile$
diff --git a/tests/image/Dijkstra/Skeleton.cxx b/tests/image/Dijkstra/Skeleton.cxx
new file mode 100644 (file)
index 0000000..b792d39
--- /dev/null
@@ -0,0 +1,82 @@
+// =========================================================================
+// @author Leonardo Florez Valencia
+// @email florez-l@javeriana.edu.co
+// =========================================================================
+
+#include <itkImage.h>
+#include <itkImageFileReader.h>
+#include <fpa/Common/Image/SkeletonWriter.h>
+#include <fpa/Filters/Image/Skeleton.h>
+
+// -------------------------------------------------------------------------
+const unsigned int Dim = 2;
+typedef unsigned char TPixel;
+typedef itk::Image< TPixel, Dim > TImage;
+
+// -------------------------------------------------------------------------
+int main( int argc, char* argv[] )
+{
+  // Get arguments
+  if( argc < 3 )
+  {
+    std::cerr
+      << "Usage: " << argv[ 0 ]
+      << " input_image output_skeleton [seed]"
+      << std::endl;
+    return( 1 );
+
+  } // fi
+  std::string input_image_filename = argv[ 1 ];
+  std::string output_skeleton_filename = argv[ 2 ];
+
+  // Read image
+  typedef itk::ImageFileReader< TImage > TImageReader;
+  TImageReader::Pointer input_image_reader = TImageReader::New( );
+  input_image_reader->SetFileName( input_image_filename );
+
+  // Prepare filter
+  typedef fpa::Filters::Image::Skeleton< TImage > TFilter;
+  TFilter::Pointer filter = TFilter::New( );
+  filter->SetInput( input_image_reader->GetOutput( ) );
+
+  // Get seed
+  if( argc >= Dim + 3 )
+  {
+    TImage::IndexType seed;
+    for( int j = 0; j < Dim; ++j )
+      if( 3 + j < argc )
+        seed[ j ] = std::atoi( argv[ 3 + j ] );
+    filter->SeedFromMaximumDistanceOff( );
+    filter->SetSeed( seed );
+  }
+  else
+    filter->SeedFromMaximumDistanceOn( );
+
+  // Configure distance map
+  filter->GetDistanceMap( )->InsideIsPositiveOn( );
+  filter->GetDistanceMap( )->SquaredDistanceOff( );
+  filter->GetDistanceMap( )->UseImageSpacingOn( );
+
+  // Execute filter
+  filter->Update( );
+
+  // Save results
+  typedef fpa::Common::Image::SkeletonWriter< TFilter::TSkeleton > TSkeletonWriter;
+  TSkeletonWriter::Pointer skeleton_writer = TSkeletonWriter::New( );
+  skeleton_writer->SetInput( filter->GetOutput( ) );
+  skeleton_writer->SetFileName( output_skeleton_filename );
+
+  try
+  {
+    skeleton_writer->Update( );
+  }
+  catch( std::exception& err )
+  {
+    std::cerr << "Error caught: " << err.what( ) << std::endl;
+    return( 1 );
+
+  } // yrt
+  return( 0 );
+}
+
+// eof - $RCSfile$
diff --git a/tests/image/Dijkstra_Gaussian.cxx b/tests/image/Dijkstra_Gaussian.cxx
deleted file mode 100644 (file)
index 5622e7f..0000000
+++ /dev/null
@@ -1,87 +0,0 @@
-#include "BaseFunctions.h"
-#include <itkImage.h>
-#include <fpa/Image/Dijkstra.h>
-#include <fpa/Image/Functors/Dijkstra/Gaussian.h>
-
-// -------------------------------------------------------------------------
-const unsigned int Dim = 3;
-typedef short TPixel;
-typedef float TScalar;
-
-typedef itk::Image< TPixel, Dim >                                    TInputImage;
-typedef itk::Image< TScalar, Dim >                                  TScalarImage;
-typedef fpa::Image::Dijkstra< TInputImage, TScalarImage >                TFilter;
-typedef fpa::Image::Functors::Dijkstra::Gaussian< TInputImage, TScalar > TWeight;
-
-// -------------------------------------------------------------------------
-int main( int argc, char* argv[] )
-{
-  // Get arguments
-  if( argc < 7 )
-  {
-    std::cerr
-      << "Usage: " << argv[ 0 ]
-      << " input_image output_image output_marks alpha beta"
-      << " stop_at_one_front ..."
-      << std::endl;
-    return( 1 );
-
-  } // fi
-  std::string input_image_filename = argv[ 1 ];
-  std::string output_image_filename = argv[ 2 ];
-  std::string output_marks_filename = argv[ 3 ];
-  double alpha = std::atoi( argv[ 4 ] );
-  double beta = std::atoi( argv[ 5 ] );
-  bool stop_at_one_front = ( argv[ 6 ][ 0 ] == '1' );
-
-  // Create image
-  TInputImage::Pointer image;
-  std::string err0 = fpa::tests::image::Read( image, input_image_filename );
-  if( err0 != "" )
-  {
-    std::cerr << "Error caught: " << err0 << std::endl;
-    return( 1 );
-
-  } // fi
-
-  // Prepare weight
-  TWeight::Pointer weight = TWeight::New( );
-  weight->SetAlpha( alpha );
-  weight->SetBeta( beta );
-
-  // Prepare filter
-  TFilter::Pointer filter = TFilter::New( );
-  filter->SetInput( image );
-  filter->SetWeightFunction( weight );
-  filter->SetStopAtOneFront( stop_at_one_front );
-
-  // Get all seeds
-  for( int i = 7; i < argc; i += 3 )
-  {
-    if( i + 1 < argc )
-    {
-      TInputImage::IndexType seed;
-      seed[ 0 ] = std::atoi( argv[ i ] );
-      seed[ 1 ] = std::atoi( argv[ i + 1 ] );
-      seed[ 2 ] = std::atoi( argv[ i + 2 ] );
-      filter->AddSeed( seed );
-
-    } // fi
-
-  } // rof
-
-  // Execute filter
-  filter->Update( );
-
-  // Save results
-  std::string err1 =
-    fpa::tests::image::Write( filter->GetOutput( ), output_image_filename );
-  std::string err2 =
-    fpa::tests::image::Write( filter->GetMarks( ), output_marks_filename );
-  if( err1 != "" ) std::cerr << "Error caught: " << err1 << std::endl;
-  if( err2 != "" ) std::cerr << "Error caught: " << err2 << std::endl;
-
-  return( 0 );
-}
-
-// eof - $RCSfile$
diff --git a/tests/image/Dijkstra_Identity.cxx b/tests/image/Dijkstra_Identity.cxx
deleted file mode 100644 (file)
index 54d1511..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-#include "BaseFunctions.h"
-#include <itkImage.h>
-#include <fpa/Image/Dijkstra.h>
-#include <fpa/Image/Functors/Dijkstra/Identity.h>
-
-// -------------------------------------------------------------------------
-const unsigned int Dim = 2;
-typedef unsigned char TPixel;
-typedef float         TScalar;
-
-typedef itk::Image< TPixel, Dim >                                    TInputImage;
-typedef itk::Image< TScalar, Dim >                                  TScalarImage;
-typedef fpa::Image::Dijkstra< TInputImage, TScalarImage >                TFilter;
-typedef fpa::Image::Functors::Dijkstra::Identity< TInputImage, TScalar > TWeight;
-
-// -------------------------------------------------------------------------
-int main( int argc, char* argv[] )
-{
-  // Get arguments
-  if( argc < 5 )
-  {
-    std::cerr
-      << "Usage: " << argv[ 0 ]
-      << " output_image output_marks width height ..."
-      << std::endl;
-    return( 1 );
-
-  } // fi
-  std::string output_image_filename = argv[ 1 ];
-  std::string output_marks_filename = argv[ 2 ];
-  int width = std::atoi( argv[ 3 ] );
-  int height = std::atoi( argv[ 4 ] );
-
-  // Create image
-  TInputImage::Pointer image;
-  fpa::tests::image::CreateImage( image, 1, width, height, 1.0, 1.0 );
-
-  // Prepare weight
-  TWeight::Pointer weight = TWeight::New( );
-
-  // Prepare filter
-  TFilter::Pointer filter = TFilter::New( );
-  filter->SetInput( image );
-  filter->SetWeightFunction( weight );
-
-  // Get all seeds
-  for( int i = 5; i < argc; i += 2 )
-  {
-    if( i + 1 < argc )
-    {
-      TInputImage::IndexType seed;
-      seed[ 0 ] = std::atoi( argv[ i ] );
-      seed[ 1 ] = std::atoi( argv[ i + 1 ] );
-      filter->AddSeed( seed );
-
-    } // fi
-
-  } // rof
-
-  // Execute filter
-  filter->Update( );
-
-  // Save results
-  std::string err1 =
-    fpa::tests::image::Write( filter->GetOutput( ), output_image_filename );
-  std::string err2 =
-    fpa::tests::image::Write( filter->GetMarks( ), output_marks_filename );
-  if( err1 != "" ) std::cerr << err1 << std::endl;
-  if( err2 != "" ) std::cerr << err2 << std::endl;
-
-  return( 0 );
-}
-
-// eof - $RCSfile$
diff --git a/tests/image/MoriSegmentation.cxx b/tests/image/MoriSegmentation.cxx
deleted file mode 100644 (file)
index 5a5a472..0000000
+++ /dev/null
@@ -1,108 +0,0 @@
-#include "BaseFunctions.h"
-#include <chrono>
-#include <itkImage.h>
-#include <fpa/Image/Mori.h>
-
-// -------------------------------------------------------------------------
-const unsigned int Dim = 3;
-typedef short          TPixel;
-typedef unsigned short TLabel;
-
-typedef itk::Image< TPixel, Dim > TInputImage;
-typedef itk::Image< TLabel, Dim > TLabelImage;
-typedef fpa::Image::Mori< TInputImage, TLabelImage > TFilter;
-
-// -------------------------------------------------------------------------
-int main( int argc, char* argv[] )
-{
-  // Get arguments
-  if( argc < 9 + Dim )
-  {
-    std::cerr
-      << "Usage: " << argv[ 0 ]
-      << " input_image output_image output_marks output_signal"
-      << " init_threshold end_threshold delta [index/point] seed"
-      << std::endl;
-    return( 1 );
-
-  } // fi
-  std::string input_image_filename = argv[ 1 ];
-  std::string output_image_filename = argv[ 2 ];
-  std::string output_marks_filename = argv[ 3 ];
-  std::string output_signal_filename = argv[ 4 ];
-  TPixel init_threshold = std::atoi( argv[ 5 ] );
-  TPixel end_threshold = std::atoi( argv[ 6 ] );
-  TPixel delta = std::atoi( argv[ 7 ] );
-  std::string seed_type = argv[ 8 ];
-
-  TInputImage::IndexType iseed;
-  TInputImage::PointType pseed;
-  for( unsigned int i = 0; i < Dim; ++i )
-  {
-    if( seed_type == "index" )
-      iseed[ i ] = std::atoi( argv[ 9 + i ] );
-    else
-      pseed[ i ] = std::atof( argv[ 9 + i ] );
-
-  } // rof
-
-  // Create image
-  TInputImage::Pointer input_image;
-  std::string err0 =
-    fpa::tests::image::Read( input_image, input_image_filename );
-  if( err0 != "" ) std::cerr << err0 << std::endl;
-
-  // Prepare filter
-  TFilter::Pointer filter = TFilter::New( );
-  filter->SetInput( input_image );
-  if( seed_type == "index" )
-    filter->SetSeed( iseed );
-  else
-    filter->SetSeed( pseed );
-  filter->SetThresholds( init_threshold, end_threshold, delta );
-  filter->SetInsideValue( 255 );
-  filter->SetOutsideValue( 0 );
-  filter->SetSignalKernelSize( 20 );
-  filter->SetSignalThreshold( 500 );
-  filter->SetSignalInfluence( 0.5 );
-  filter->SetMinimumThreshold( -850 );
-
-  // Execute filter
-  std::chrono::time_point< std::chrono::high_resolution_clock > tstart, tend;
-  tstart = std::chrono::high_resolution_clock::now( );
-  filter->Update( );
-  tend = std::chrono::high_resolution_clock::now( );
-  std::chrono::duration< double > telapsed = tend - tstart;
-
-  // Save results
-  std::string err1 =
-    fpa::tests::image::Write( filter->GetThresholdedOutput( ), output_image_filename );
-  std::string err2 =
-    fpa::tests::image::Write( filter->GetMarks( ), output_marks_filename );
-  if( err1 != "" ) std::cerr << err1 << std::endl;
-  if( err2 != "" ) std::cerr << err2 << std::endl;
-
-  std::ofstream osignal( output_signal_filename.c_str( ) );
-  unsigned long nThr = filter->GetNumberOfEvaluatedThresholds( );
-  for( unsigned long i = 0; i < nThr; ++i )
-  {
-    double x, y;
-    TFilter::TPeak p;
-    filter->GetSignalValues( i, x, y, p );
-    osignal << x << " " << y << std::endl;
-
-  } // rof
-  osignal.close( );
-
-  std::cout
-    << "------------------------------------------------------" << std::endl
-    << "Elapsed time: " << telapsed.count( ) << " s" << std::endl
-    << "Optimum threshold: " << filter->GetOptimumThreshold( ) << std::endl
-    << "Number of evaluated thresholds: " << nThr << std::endl
-    << "------------------------------------------------------"
-    << std::endl;
-
-  return( 0 );
-}
-
-// eof - $RCSfile$
diff --git a/tests/image/RandomWalker.cxx b/tests/image/RandomWalker.cxx
deleted file mode 100644 (file)
index 6bdca1c..0000000
+++ /dev/null
@@ -1,90 +0,0 @@
-#include "BaseFunctions.h"
-#include <itkImage.h>
-#include <fpa/Image/RandomWalker.h>
-#include <fpa/Image/Functors/Dijkstra/Gaussian.h>
-
-// -------------------------------------------------------------------------
-const unsigned int Dim = 2;
-typedef short         TPixel;
-typedef unsigned char TLabel;
-typedef float         TScalar;
-
-typedef itk::Image< TPixel, Dim >                                    TInputImage;
-typedef itk::Image< TLabel, Dim >                                    TLabelImage;
-typedef fpa::Image::RandomWalker< TInputImage, TLabelImage, TScalar >    TFilter;
-typedef fpa::Image::Functors::Dijkstra::Gaussian< TInputImage, TScalar > TWeight;
-
-// -------------------------------------------------------------------------
-int main( int argc, char* argv[] )
-{
-  // Get arguments
-  if( argc < 6 )
-  {
-    std::cerr
-      << "Usage: " << argv[ 0 ]
-      << " input_image labels_image output_image output_costs"
-      << " beta"
-      << std::endl;
-    return( 1 );
-
-  } // fi
-  std::string input_image_filename = argv[ 1 ];
-  std::string labels_image_filename = argv[ 2 ];
-  std::string output_image_filename = argv[ 3 ];
-  std::string output_costs_filename = argv[ 4 ];
-  double beta = std::atof( argv[ 5 ] );
-
-  // Read image
-  TInputImage::Pointer image;
-  std::string err0 = fpa::tests::image::Read( image, input_image_filename );
-  if( err0 != "" )
-  {
-    std::cerr << "Error caught: " << err0 << std::endl;
-    return( 1 );
-
-  } // fi
-
-  // Read label
-  TLabelImage::Pointer labels;
-  std::string err1 = fpa::tests::image::Read( labels, labels_image_filename );
-  if( err1 != "" )
-  {
-    std::cerr << "Error caught: " << err1 << std::endl;
-    return( 1 );
-
-  } // fi
-
-  // Prepare weight
-  TWeight::Pointer weight = TWeight::New( );
-  weight->SetBeta( beta );
-
-  // Prepare filter
-  TFilter::Pointer filter = TFilter::New( );
-  filter->SetInput( image );
-  filter->SetWeightFunction( weight );
-  filter->SetLabels( labels );
-
-  // Execute filter
-  try
-  {
-    filter->Update( );
-  }
-  catch( std::exception& err )
-  {
-    std::cerr << "Error caught: " << err.what( ) << std::endl;
-    return( 1 );
-
-  } // yrt
-
-  // Save results
-  std::string err2 =
-    fpa::tests::image::Write( filter->GetMarks( ), output_image_filename );
-  std::string err3 =
-    fpa::tests::image::Write( filter->GetOutput( ), output_costs_filename );
-  if( err2 != "" ) std::cerr << "Error caught: " << err2 << std::endl;
-  if( err3 != "" ) std::cerr << "Error caught: " << err3 << std::endl;
-
-  return( 0 );
-}
-
-// eof - $RCSfile$
diff --git a/tests/image/RandomWalker/CMakeLists.txt b/tests/image/RandomWalker/CMakeLists.txt
new file mode 100644 (file)
index 0000000..e4bd49a
--- /dev/null
@@ -0,0 +1,18 @@
+## =========================================================================
+## @author Leonardo Florez Valencia
+## @email florez-l@javeriana.edu.co
+## =========================================================================
+
+set(_pfx test_fpa_Image_RandomWalker_)
+set(
+  _tests
+  Gaussian
+  )
+include_directories(${PROJECT_SOURCE_DIR}/lib ${PROJECT_BINARY_DIR}/lib)
+
+foreach(_t ${_tests})
+  add_executable(${_pfx}${_t} ${_t}.cxx)
+  target_link_libraries(${_pfx}${_t} fpa)
+endforeach(_t)
+
+## eof - $RCSfile$
diff --git a/tests/image/RandomWalker/Gaussian.cxx b/tests/image/RandomWalker/Gaussian.cxx
new file mode 100644 (file)
index 0000000..be6016e
--- /dev/null
@@ -0,0 +1,94 @@
+// =========================================================================
+// @author Leonardo Florez Valencia
+// @email florez-l@javeriana.edu.co
+// =========================================================================
+
+#include <itkImage.h>
+#include <itkImageFileReader.h>
+#include <itkImageFileWriter.h>
+#include <fpa/Filters/Image/RandomWalker.h>
+#include <fpa/Functors/Dijkstra/Image/Gaussian.h>
+
+// -------------------------------------------------------------------------
+const unsigned int Dim = 2;
+typedef unsigned char TInputPixel;
+typedef unsigned char TInputLabel;
+typedef float         TOutputPixel;
+typedef itk::Image< TInputPixel, Dim >  TInputImage;
+typedef itk::Image< TInputLabel, Dim >  TInputLabelImage;
+typedef itk::Image< TOutputPixel, Dim > TOutputImage;
+
+// -------------------------------------------------------------------------
+int main( int argc, char* argv[] )
+{
+  // Get arguments
+  if( argc < 7 )
+  {
+    std::cerr
+      << "Usage: " << argv[ 0 ]
+      << " input_image input_labels output_image output_costs alpha beta"
+      << std::endl;
+    return( 1 );
+
+  } // fi
+  std::string input_image_filename = argv[ 1 ];
+  std::string input_labels_filename = argv[ 2 ];
+  std::string output_image_filename = argv[ 3 ];
+  std::string output_costs_filename = argv[ 4 ];
+  double alpha = std::atof( argv[ 5 ] );
+  double beta = std::atof( argv[ 6 ] );
+
+  // Read image
+  typedef itk::ImageFileReader< TInputImage > TInputImageReader;
+  TInputImageReader::Pointer input_image_reader = TInputImageReader::New( );
+  input_image_reader->SetFileName( input_image_filename );
+
+  // Read labels
+  typedef itk::ImageFileReader< TInputLabelImage > TInputLabelImageReader;
+  TInputLabelImageReader::Pointer input_labels_reader =
+    TInputLabelImageReader::New( );
+  input_labels_reader->SetFileName( input_labels_filename );
+
+  // Prepare weight functor
+  typedef fpa::Functors::Dijkstra::Image::Gaussian< TInputImage, TOutputPixel > TWeight;
+  TWeight::Pointer weight = TWeight::New( );
+  weight->SetAlpha( alpha );
+  weight->SetBeta( beta );
+
+  // Prepare filter
+  typedef fpa::Filters::Image::RandomWalker< TInputImage, TInputLabelImage, TOutputImage > TFilter;
+  TFilter::Pointer filter = TFilter::New( );
+  filter->SetInputImage( input_image_reader->GetOutput( ) );
+  filter->SetInputLabels( input_labels_reader->GetOutput( ) );
+  filter->SetWeightFunction( weight );
+
+  // Execute filter
+  filter->Update( );
+
+  // Save results
+  typedef itk::ImageFileWriter< TFilter::TOutputLabels > TOutputWriter;
+  TOutputWriter::Pointer output_writer = TOutputWriter::New( );
+  output_writer->SetInput( filter->GetOutputLabels( ) );
+  output_writer->SetFileName( output_image_filename );
+
+  typedef itk::ImageFileWriter< TFilter::TCostsImage > TCostsWriter;
+  TCostsWriter::Pointer costs_writer = TCostsWriter::New( );
+  costs_writer->SetInput( filter->GetOutputCosts( ) );
+  costs_writer->SetFileName( output_costs_filename );
+
+  try
+  {
+    output_writer->Update( );
+    costs_writer->Update( );
+  }
+  catch( std::exception& err )
+  {
+    std::cerr << "Error caught: " << err.what( ) << std::endl;
+    return( 1 );
+
+  } // yrt
+
+  return( 0 );
+}
+
+// eof - $RCSfile$
diff --git a/tests/image/RegionGrow/BinaryThreshold.cxx b/tests/image/RegionGrow/BinaryThreshold.cxx
new file mode 100644 (file)
index 0000000..3e15d36
--- /dev/null
@@ -0,0 +1,95 @@
+// =========================================================================
+// @author Leonardo Florez Valencia
+// @email florez-l@javeriana.edu.co
+// =========================================================================
+
+#include <itkImage.h>
+#include <itkImageFileReader.h>
+#include <itkImageFileWriter.h>
+#include <fpa/Filters/Image/RegionGrow.h>
+#include <fpa/Functors/RegionGrow/BinaryThreshold.h>
+
+// -------------------------------------------------------------------------
+const unsigned int Dim = 2;
+typedef unsigned char TPixel;
+typedef itk::Image< TPixel, Dim > TImage;
+
+// -------------------------------------------------------------------------
+int main( int argc, char* argv[] )
+{
+  // Get arguments
+  if( argc < 6 )
+  {
+    std::cerr
+      << "Usage: " << argv[ 0 ]
+      << " input_image output_image output_marks lower upper [seeds]"
+      << std::endl;
+    return( 1 );
+
+  } // fi
+  std::string input_image_filename = argv[ 1 ];
+  std::string output_image_filename = argv[ 2 ];
+  std::string output_marks_filename = argv[ 3 ];
+  TPixel lower = TPixel( std::atof( argv[ 4 ] ) );
+  TPixel upper = TPixel( std::atof( argv[ 5 ] ) );
+
+  // Read image
+  typedef itk::ImageFileReader< TImage > TImageReader;
+  TImageReader::Pointer input_image_reader = TImageReader::New( );
+  input_image_reader->SetFileName( input_image_filename );
+
+  // Prepare predicate
+  typedef fpa::Functors::RegionGrow::BinaryThreshold< TPixel > TPredicate;
+  TPredicate::Pointer predicate = TPredicate::New( );
+  predicate->SetLowerThreshold( lower );
+  predicate->SetUpperThreshold( upper );
+
+  // Prepare filter
+  typedef fpa::Filters::Image::RegionGrow< TImage, TImage > TFilter;
+  TFilter::Pointer filter = TFilter::New( );
+  filter->SetInput( input_image_reader->GetOutput( ) );
+  filter->SetPredicate( predicate );
+  filter->SetInsideValue( std::numeric_limits< TPixel >::max( ) );
+  filter->SetOutsideValue( TPixel( 0 ) );
+
+  // Get all seeds
+  for( int i = 6; i < argc; i += Dim )
+  {
+    TImage::IndexType seed;
+    for( int j = 0; j < Dim; ++j )
+      if( i + j < argc )
+        seed[ j ] = std::atoi( argv[ i + j ] );
+    filter->AddSeed( seed );
+
+  } // rof
+
+  // Execute filter
+  filter->Update( );
+
+  // Save results
+  typedef itk::ImageFileWriter< TFilter::TOutputImage > TOutputWriter;
+  TOutputWriter::Pointer output_writer = TOutputWriter::New( );
+  output_writer->SetInput( filter->GetOutput( ) );
+  output_writer->SetFileName( output_image_filename );
+
+  typedef itk::ImageFileWriter< TFilter::TMarksImage > TMarksWriter;
+  TMarksWriter::Pointer marks_writer = TMarksWriter::New( );
+  marks_writer->SetInput( filter->GetMarks( ) );
+  marks_writer->SetFileName( output_marks_filename );
+
+  try
+  {
+    output_writer->Update( );
+    marks_writer->Update( );
+  }
+  catch( std::exception& err )
+  {
+    std::cerr << "Error caught: " << err.what( ) << std::endl;
+    return( 1 );
+
+  } // yrt
+
+  return( 0 );
+}
+
+// eof - $RCSfile$
diff --git a/tests/image/RegionGrow/CMakeLists.txt b/tests/image/RegionGrow/CMakeLists.txt
new file mode 100644 (file)
index 0000000..e5c55b5
--- /dev/null
@@ -0,0 +1,20 @@
+## =========================================================================
+## @author Leonardo Florez Valencia
+## @email florez-l@javeriana.edu.co
+## =========================================================================
+
+set(_pfx test_fpa_Image_RegionGrow_)
+set(
+  _tests
+  Tautology
+  BinaryThreshold
+  Mori
+  )
+include_directories(${PROJECT_SOURCE_DIR}/lib ${PROJECT_BINARY_DIR}/lib)
+
+foreach(_t ${_tests})
+  add_executable(${_pfx}${_t} ${_t}.cxx)
+  target_link_libraries(${_pfx}${_t} fpa)
+endforeach(_t)
+
+## eof - $RCSfile$
diff --git a/tests/image/RegionGrow/Mori.cxx b/tests/image/RegionGrow/Mori.cxx
new file mode 100644 (file)
index 0000000..8d11ac2
--- /dev/null
@@ -0,0 +1,82 @@
+// =========================================================================
+// @author Leonardo Florez Valencia
+// @email florez-l@javeriana.edu.co
+// =========================================================================
+
+#include <itkImage.h>
+#include <itkImageFileReader.h>
+#include <itkImageFileWriter.h>
+#include <fpa/Filters/Image/Mori.h>
+
+// -------------------------------------------------------------------------
+const unsigned int Dim = 2;
+typedef unsigned char TPixel;
+typedef itk::Image< TPixel, Dim > TImage;
+
+// -------------------------------------------------------------------------
+int main( int argc, char* argv[] )
+{
+  // Get arguments
+  if( argc < 9 + Dim )
+  {
+    std::cerr
+      << "Usage: " << argv[ 0 ]
+      << " input_image output_image lower upper delta seed"
+      << std::endl;
+    return( 1 );
+
+  } // fi
+  std::string input_image_filename = argv[ 1 ];
+  std::string output_image_filename = argv[ 2 ];
+  TPixel lower = TPixel( std::atof( argv[ 3 ] ) );
+  TPixel upper = TPixel( std::atof( argv[ 4 ] ) );
+  TPixel delta = TPixel( std::atof( argv[ 5 ] ) );
+  unsigned long signal_kernel_size = std::atoi( argv[ 6 ] );
+  double signal_threshold = std::atof( argv[ 7 ] );
+  double signal_influence = std::atof( argv[ 8 ] );
+
+  // Read image
+  typedef itk::ImageFileReader< TImage > TImageReader;
+  TImageReader::Pointer input_image_reader = TImageReader::New( );
+  input_image_reader->SetFileName( input_image_filename );
+
+  // Prepare filter
+  typedef fpa::Filters::Image::Mori< TImage, TImage > TFilter;
+  TFilter::Pointer filter = TFilter::New( );
+  filter->SetInput( input_image_reader->GetOutput( ) );
+  filter->SetInsideValue( std::numeric_limits< TPixel >::max( ) );
+  filter->SetOutsideValue( TPixel( 0 ) );
+  filter->SetThresholds( lower, upper, delta );
+  filter->SetSignalKernelSize( signal_kernel_size );
+  filter->SetSignalThreshold( signal_threshold );
+  filter->SetSignalInfluence( signal_influence );
+
+  // Configure seed
+  TImage::IndexType seed;
+  for( int j = 0; j < Dim; ++j )
+    seed[ j ] = std::atoi( argv[ 9 + j ] );
+  filter->SetSeed( seed );
+
+  // Execute filter
+  filter->Update( );
+
+  // Save results
+  typedef itk::ImageFileWriter< TFilter::TOutputImage > TOutputWriter;
+  TOutputWriter::Pointer output_writer = TOutputWriter::New( );
+  output_writer->SetInput( filter->GetOutput( ) );
+  output_writer->SetFileName( output_image_filename );
+  try
+  {
+    output_writer->Update( );
+  }
+  catch( std::exception& err )
+  {
+    std::cerr << "Error caught: " << err.what( ) << std::endl;
+    return( 1 );
+
+  } // yrt
+
+  return( 0 );
+}
+
+// eof - $RCSfile$
diff --git a/tests/image/RegionGrow/Tautology.cxx b/tests/image/RegionGrow/Tautology.cxx
new file mode 100644 (file)
index 0000000..0bbdc45
--- /dev/null
@@ -0,0 +1,92 @@
+// =========================================================================
+// @author Leonardo Florez Valencia
+// @email florez-l@javeriana.edu.co
+// =========================================================================
+
+#include <itkImage.h>
+#include <itkImageFileWriter.h>
+#include <fpa/Filters/Image/RegionGrow.h>
+#include <fpa/Functors/RegionGrow/Tautology.h>
+
+// -------------------------------------------------------------------------
+const unsigned int Dim = 2;
+typedef unsigned char TPixel;
+typedef itk::Image< TPixel, Dim > TImage;
+
+// -------------------------------------------------------------------------
+int main( int argc, char* argv[] )
+{
+  // Get arguments
+  if( argc < 4 )
+  {
+    std::cerr
+      << "Usage: " << argv[ 0 ]
+      << " output_image output_marks size [seeds]"
+      << std::endl;
+    return( 1 );
+
+  } // fi
+  std::string output_image_filename = argv[ 1 ];
+  std::string output_marks_filename = argv[ 2 ];
+  TImage::SizeType size;
+  size.Fill( std::atoi( argv[ 3 ] ) );
+
+  // Create image
+  TImage::Pointer image = TImage::New( );
+  image->SetRegions( size );
+  image->Allocate( );
+  image->FillBuffer( TPixel( 0 ) );
+
+  // Prepare predicate
+  typedef fpa::Functors::RegionGrow::Tautology< TPixel > TPredicate;
+  TPredicate::Pointer predicate = TPredicate::New( );
+
+  // Prepare filter
+  typedef fpa::Filters::Image::RegionGrow< TImage, TImage > TFilter;
+  TFilter::Pointer filter = TFilter::New( );
+  filter->SetInput( image );
+  filter->SetPredicate( predicate );
+  filter->SetInsideValue( std::numeric_limits< TPixel >::max( ) );
+  filter->SetOutsideValue( TPixel( 0 ) );
+
+  // Get all seeds
+  for( int i = 4; i < argc; i += Dim )
+  {
+    TImage::IndexType seed;
+    for( int j = 0; j < Dim; ++j )
+      if( i + j < argc )
+        seed[ j ] = std::atoi( argv[ i + j ] );
+    filter->AddSeed( seed );
+
+  } // rof
+
+  // Execute filter
+  filter->Update( );
+
+  // Save results
+  typedef itk::ImageFileWriter< TFilter::TOutputImage > TOutputWriter;
+  TOutputWriter::Pointer output_writer = TOutputWriter::New( );
+  output_writer->SetInput( filter->GetOutput( ) );
+  output_writer->SetFileName( output_image_filename );
+
+  typedef itk::ImageFileWriter< TFilter::TMarksImage > TMarksWriter;
+  TMarksWriter::Pointer marks_writer = TMarksWriter::New( );
+  marks_writer->SetInput( filter->GetMarks( ) );
+  marks_writer->SetFileName( output_marks_filename );
+
+  try
+  {
+    output_writer->Update( );
+    marks_writer->Update( );
+  }
+  catch( std::exception& err )
+  {
+    std::cerr << "Error caught: " << err.what( ) << std::endl;
+    return( 1 );
+
+  } // yrt
+
+  return( 0 );
+}
+
+// eof - $RCSfile$
diff --git a/tests/image/RegionGrow_BinaryThreshold.cxx b/tests/image/RegionGrow_BinaryThreshold.cxx
deleted file mode 100644 (file)
index b40f25a..0000000
+++ /dev/null
@@ -1,91 +0,0 @@
-#include "BaseFunctions.h"
-#include <itkImage.h>
-#include <fpa/Image/RegionGrow.h>
-#include <fpa/Base/Functors/RegionGrow/BinaryThreshold.h>
-
-// -------------------------------------------------------------------------
-const unsigned int Dim = 3;
-typedef short         TInputPixel;
-typedef unsigned char TOutputPixel;
-
-typedef itk::Image< TInputPixel, Dim >                      TInputImage;
-typedef itk::Image< TOutputPixel, Dim >                     TOutputImage;
-typedef fpa::Image::RegionGrow< TInputImage, TOutputImage > TFilter;
-typedef fpa::Base::Functors::RegionGrow::BinaryThreshold< TInputPixel > TPredicate;
-
-// -------------------------------------------------------------------------
-int main( int argc, char* argv[] )
-{
-  // Get arguments
-  if( argc < 8 + Dim )
-  {
-    std::cerr
-      << "Usage: " << argv[ 0 ]
-      << " input_image output_image output_marks"
-      << " lower upper strict [index/point] ..."
-      << std::endl;
-    return( 1 );
-
-  } // fi
-  std::string input_image_filename = argv[ 1 ];
-  std::string output_image_filename = argv[ 2 ];
-  std::string output_marks_filename = argv[ 3 ];
-  TInputPixel lower = TInputPixel( std::atof( argv[ 4 ] ) );
-  TInputPixel upper = TInputPixel( std::atof( argv[ 5 ] ) );
-  bool strict = ( argv[ 6 ][ 0 ] == '1' );
-  std::string seeds_type = argv[ 7 ];
-
-  // Create image
-  TInputImage::Pointer input_image;
-  std::string err0 =
-    fpa::tests::image::Read( input_image, input_image_filename );
-  if( err0 != "" ) std::cerr << err0 << std::endl;
-
-  // Prepare predicate
-  TPredicate::Pointer predicate = TPredicate::New( );
-  predicate->SetLower( lower );
-  predicate->SetUpper( upper );
-  predicate->SetStrict( strict );
-
-  // Prepare filter
-  TFilter::Pointer filter = TFilter::New( );
-  filter->SetInput( input_image );
-  filter->SetPredicate( predicate );
-  filter->SetInsideValue( 255 );
-  filter->SetOutsideValue( 0 );
-
-  // Get all seeds
-  for( int i = 8; i < argc; i += Dim )
-  {
-    if( seeds_type == "index" )
-    {
-      TInputImage::IndexType seed;
-      for( unsigned int d = 0; d < Dim; ++d )
-        seed[ d ] = std::atoi( argv[ i + d ] );
-      filter->AddSeed( seed );
-    }
-    else
-    {
-      TInputImage::PointType seed;
-      for( unsigned int d = 0; d < Dim; ++d )
-        seed[ d ] = std::atof( argv[ i + d ] );
-      filter->AddSeed( seed );
-
-    } // fi
-  } // rof
-
-  // Execute filter
-  filter->Update( );
-
-  // Save results
-  std::string err1 =
-    fpa::tests::image::Write( filter->GetOutput( ), output_image_filename );
-  std::string err2 =
-    fpa::tests::image::Write( filter->GetMarks( ), output_marks_filename );
-  if( err1 != "" ) std::cerr << err1 << std::endl;
-  if( err2 != "" ) std::cerr << err2 << std::endl;
-
-  return( 0 );
-}
-
-// eof - $RCSfile$
diff --git a/tests/image/RegionGrow_Tautology.cxx b/tests/image/RegionGrow_Tautology.cxx
deleted file mode 100644 (file)
index db60d0a..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-#include "BaseFunctions.h"
-#include <itkImage.h>
-#include <fpa/Image/RegionGrow.h>
-#include <fpa/Base/Functors/RegionGrow/Tautology.h>
-
-// -------------------------------------------------------------------------
-const unsigned int Dim = 2;
-typedef unsigned char TPixel;
-
-typedef itk::Image< TPixel, Dim >                            TImage;
-typedef fpa::Image::RegionGrow< TImage, TImage >             TFilter;
-typedef fpa::Base::Functors::RegionGrow::Tautology< TPixel > TPredicate;
-
-// -------------------------------------------------------------------------
-int main( int argc, char* argv[] )
-{
-  // Get arguments
-  if( argc < 5 )
-  {
-    std::cerr
-      << "Usage: " << argv[ 0 ]
-      << " output_image output_marks width height ..."
-      << std::endl;
-    return( 1 );
-
-  } // fi
-  std::string output_image_filename = argv[ 1 ];
-  std::string output_marks_filename = argv[ 2 ];
-  int width = std::atoi( argv[ 3 ] );
-  int height = std::atoi( argv[ 4 ] );
-
-  // Create image
-  TImage::Pointer image;
-  fpa::tests::image::CreateImage( image, 0, width, height, 1.0, 1.0 );
-
-  // Prepare predicate
-  TPredicate::Pointer predicate = TPredicate::New( );
-
-  // Prepare filter
-  TFilter::Pointer filter = TFilter::New( );
-  filter->SetInput( image );
-  filter->SetPredicate( predicate );
-  filter->SetInsideValue( 255 );
-  filter->SetOutsideValue( 0 );
-
-  // Get all seeds
-  for( int i = 5; i < argc; i += 2 )
-  {
-    if( i + 1 < argc )
-    {
-      TImage::IndexType seed;
-      seed[ 0 ] = std::atoi( argv[ i ] );
-      seed[ 1 ] = std::atoi( argv[ i + 1 ] );
-      filter->AddSeed( seed );
-
-    } // fi
-
-  } // rof
-
-  // Execute filter
-  filter->Update( );
-
-  // Save results
-  std::string err1 =
-    fpa::tests::image::Write( filter->GetOutput( ), output_image_filename );
-  std::string err2 =
-    fpa::tests::image::Write( filter->GetMarks( ), output_marks_filename );
-  if( err1 != "" ) std::cerr << err1 << std::endl;
-  if( err2 != "" ) std::cerr << err2 << std::endl;
-
-  return( 0 );
-}
-
-// eof - $RCSfile$
diff --git a/tests/image/SkeletonFilter.cxx b/tests/image/SkeletonFilter.cxx
deleted file mode 100644 (file)
index 5cff164..0000000
+++ /dev/null
@@ -1,86 +0,0 @@
-#include "BaseFunctions.h"
-#include <itkImage.h>
-#include <fpa/Image/SkeletonFilter.h>
-#include <fpa/Image/SkeletonWriter.h>
-
-// -------------------------------------------------------------------------
-const unsigned int Dim = 3;
-typedef short TPixel;
-
-typedef itk::Image< TPixel, Dim >                 TInputImage;
-typedef fpa::Image::SkeletonFilter< TInputImage > TFilter;
-
-// -------------------------------------------------------------------------
-int main( int argc, char* argv[] )
-{
-  // Get arguments
-  if( argc < 3 )
-  {
-    std::cerr
-      << "Usage: " << argv[ 0 ]
-      << " input_image output_skeleton ..."
-      << std::endl;
-    return( 1 );
-
-  } // fi
-  std::string input_image_filename = argv[ 1 ];
-  std::string output_skeleton_filename = argv[ 2 ];
-
-  // Read image
-  TInputImage::Pointer image;
-  std::string err1 = fpa::tests::image::Read( image, input_image_filename );
-  if( err1 != "" )
-  {
-    std::cerr << "Error caught: " << err1 << std::endl;
-    return( 1 );
-
-  } // fi
-
-  // Prepare filter
-  TFilter::Pointer filter = TFilter::New( );
-  filter->SetInput( image );
-
-  // Configure seed
-  if( argc == 6 )
-  {
-    TInputImage::PointType pnt;
-    pnt[ 0 ] = std::atof( argv[ 3 ] );
-    pnt[ 1 ] = std::atof( argv[ 4 ] );
-    pnt[ 2 ] = std::atof( argv[ 5 ] );
-
-    TInputImage::IndexType seed;
-    image->TransformPhysicalPointToIndex( pnt, seed );
-
-    filter->SeedFromMaximumDistanceOff( );
-    filter->SetSeed( seed );
-  }
-  else
-    filter->SeedFromMaximumDistanceOn( );
-
-  // Configure distance map
-  filter->GetDistanceMap( )->InsideIsPositiveOn( );
-  filter->GetDistanceMap( )->SquaredDistanceOff( );
-  filter->GetDistanceMap( )->UseImageSpacingOn( );
-
-  // Update
-  filter->Update( );
-
-  // Save results
-  fpa::Image::SkeletonWriter< TFilter::TSkeleton >::Pointer writer =
-    fpa::Image::SkeletonWriter< TFilter::TSkeleton >::New( );
-  writer->SetInput( filter->GetOutput( ) );
-  writer->SetFileName( output_skeleton_filename );
-  try
-  {
-    writer->Update( );
-  }
-  catch( std::exception& err )
-  {
-    std::cerr << "Error caught: " << err.what( ) << std::endl;
-    return( 1 );
-
-  } // yrt
-  return( 0 );
-}
-
-// eof - $RCSfile$
diff --git a/tests/image/SkeletonToPolyData.cxx b/tests/image/SkeletonToPolyData.cxx
deleted file mode 100644 (file)
index 6ee6fd8..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-
-#include <vtkPolyDataWriter.h>
-#include <vtkSmartPointer.h>
-
-#include <fpa/Image/Skeleton.h>
-#include <fpa/Image/SkeletonReader.h>
-#include <fpa/Image/SkeletonToPolyDataFilter.h>
-
-// -------------------------------------------------------------------------
-const unsigned int Dim = 3;
-typedef fpa::Image::Skeleton< Dim > TSkeleton;
-typedef fpa::Image::SkeletonToPolyDataFilter< TSkeleton > TFilter;
-
-// -------------------------------------------------------------------------
-int main( int argc, char* argv[] )
-{
-#ifdef USE_VTK
-  // Get arguments
-  if( argc < 3 )
-  {
-    std::cerr
-      << "Usage: " << argv[ 0 ]
-      << " input_skeleton output_polydata"
-      << std::endl;
-    return( 1 );
-
-  } // fi
-  std::string input_skeleton_filename = argv[ 1 ];
-  std::string output_polydata_filename = argv[ 2 ];
-
-  fpa::Image::SkeletonReader< TSkeleton >::Pointer reader =
-    fpa::Image::SkeletonReader< TSkeleton >::New( );
-  reader->SetFileName( input_skeleton_filename );
-  try
-  {
-    reader->Update( );
-  }
-  catch( std::exception& err )
-  {
-    std::cerr << "Error caught: " << err.what( ) << std::endl;
-    return( 1 );
-
-  } // yrt
-
-  vtkSmartPointer< TFilter > filter = vtkSmartPointer< TFilter >::New( );
-  filter->SetInput( reader->GetOutput( ) );
-
-  vtkSmartPointer< vtkPolyDataWriter > writer =
-    vtkSmartPointer< vtkPolyDataWriter >::New( );
-  writer->SetInputConnection( filter->GetOutputPort( ) );
-  writer->SetFileName( output_polydata_filename.c_str( ) );
-  writer->Update( );
-
-  return( 0 );
-#else // USE_VTK
-  std::cerr
-    << "Error: FrontAlgorithms was compiled without VTK support."
-    << std::endl;
-  return( 1 );
-#endif // USE_VTK
-}
-
-// eof - $RCSfile$
diff --git a/tests/image/VTK/CMakeLists.txt b/tests/image/VTK/CMakeLists.txt
new file mode 100644 (file)
index 0000000..3328b46
--- /dev/null
@@ -0,0 +1,21 @@
+## =========================================================================
+## @author Leonardo Florez Valencia
+## @email florez-l@javeriana.edu.co
+## =========================================================================
+
+if(VTK_FOUND)
+  set(_pfx test_fpa_Image_VTK_)
+  set(
+    _tests
+    PolyLineParametricPathToPolyData
+    SkeletonToPolyData
+    )
+  include_directories(${PROJECT_SOURCE_DIR}/lib ${PROJECT_BINARY_DIR}/lib)
+
+  foreach(_t ${_tests})
+    add_executable(${_pfx}${_t} ${_t}.cxx)
+    target_link_libraries(${_pfx}${_t} fpa ${VTK_LIBRARIES})
+  endforeach(_t)
+endif(VTK_FOUND)
+
+## eof - $RCSfile$
diff --git a/tests/image/VTK/PolyLineParametricPathToPolyData.cxx b/tests/image/VTK/PolyLineParametricPathToPolyData.cxx
new file mode 100644 (file)
index 0000000..e92af29
--- /dev/null
@@ -0,0 +1,54 @@
+// =========================================================================
+// @author Leonardo Florez Valencia
+// @email florez-l@javeriana.edu.co
+// =========================================================================
+
+#include <vtkPolyDataWriter.h>
+#include <vtkSmartPointer.h>
+#include <fpa/DataStructures/Image/PolyLineParametricPath.h>
+#include <fpa/Common/Image/PolyLineParametricPathReader.h>
+#include <fpa/VTK/Image/PolyLineParametricPathToPolyDataFilter.h>
+
+// -------------------------------------------------------------------------
+const unsigned int Dim = 2;
+typedef fpa::DataStructures::Image::PolyLineParametricPath< Dim > TPath;
+
+// -------------------------------------------------------------------------
+int main( int argc, char* argv[] )
+{
+  // Get arguments
+  if( argc < 3 )
+  {
+    std::cerr
+      << "Usage: " << argv[ 0 ]
+      << " input_path output_vtk"
+      << std::endl;
+    return( 1 );
+
+  } // fi
+  std::string input_path_filename = argv[ 1 ];
+  std::string output_vtk_filename = argv[ 2 ];
+
+  // Read image
+  typedef fpa::Common::Image::PolyLineParametricPathReader< TPath > TReader;
+  TReader::Pointer input_path_reader = TReader::New( );
+  input_path_reader->SetFileName( input_path_filename );
+  input_path_reader->Update( );
+
+  // Execute filter
+  typedef fpa::VTK::Image::PolyLineParametricPathToPolyDataFilter< TPath > TFilter;
+  vtkSmartPointer< TFilter > filter = vtkSmartPointer< TFilter >::New( );
+  filter->SetInput( input_path_reader->GetOutput( ) );
+  filter->Update( );
+
+  // Save results
+  vtkSmartPointer< vtkPolyDataWriter > output_vtk_writer =
+    vtkSmartPointer< vtkPolyDataWriter >::New( );
+  output_vtk_writer->SetFileName( output_vtk_filename.c_str( ) );
+  output_vtk_writer->SetInputConnection( filter->GetOutputPort( ) );
+  output_vtk_writer->Update( );
+
+  return( 0 );
+}
+
+// eof - $RCSfile$
diff --git a/tests/image/VTK/SkeletonToPolyData.cxx b/tests/image/VTK/SkeletonToPolyData.cxx
new file mode 100644 (file)
index 0000000..0c58d56
--- /dev/null
@@ -0,0 +1,54 @@
+// =========================================================================
+// @author Leonardo Florez Valencia
+// @email florez-l@javeriana.edu.co
+// =========================================================================
+
+#include <vtkPolyDataWriter.h>
+#include <vtkSmartPointer.h>
+#include <fpa/DataStructures/Image/Skeleton.h>
+#include <fpa/Common/Image/SkeletonReader.h>
+#include <fpa/VTK/Image/SkeletonToPolyDataFilter.h>
+
+// -------------------------------------------------------------------------
+const unsigned int Dim = 2;
+typedef fpa::DataStructures::Image::Skeleton< Dim > TSkeleton;
+
+// -------------------------------------------------------------------------
+int main( int argc, char* argv[] )
+{
+  // Get arguments
+  if( argc < 3 )
+  {
+    std::cerr
+      << "Usage: " << argv[ 0 ]
+      << " input_skeleton output_vtk"
+      << std::endl;
+    return( 1 );
+
+  } // fi
+  std::string input_skeleton_filename = argv[ 1 ];
+  std::string output_vtk_filename = argv[ 2 ];
+
+  // Read image
+  typedef fpa::Common::Image::SkeletonReader< TSkeleton > TReader;
+  TReader::Pointer input_skeleton_reader = TReader::New( );
+  input_skeleton_reader->SetFileName( input_skeleton_filename );
+  input_skeleton_reader->Update( );
+
+  // Execute filter
+  typedef fpa::VTK::Image::SkeletonToPolyDataFilter< TSkeleton > TFilter;
+  vtkSmartPointer< TFilter > filter = vtkSmartPointer< TFilter >::New( );
+  filter->SetInput( input_skeleton_reader->GetOutput( ) );
+  filter->Update( );
+
+  // Save results
+  vtkSmartPointer< vtkPolyDataWriter > output_vtk_writer =
+    vtkSmartPointer< vtkPolyDataWriter >::New( );
+  output_vtk_writer->SetFileName( output_vtk_filename.c_str( ) );
+  output_vtk_writer->SetInputConnection( filter->GetOutputPort( ) );
+  output_vtk_writer->Update( );
+
+  return( 0 );
+}
+
+// eof - $RCSfile$