]> Creatis software - FrontAlgorithms.git/commitdiff
...
authorLeonardo Flórez-Valencia <leonardo.florez@gmail.com>
Fri, 21 Jul 2017 12:36:20 +0000 (07:36 -0500)
committerLeonardo Flórez-Valencia <leonardo.florez@gmail.com>
Fri, 21 Jul 2017 12:36:20 +0000 (07:36 -0500)
lib/fpa/Image/ExtractAxisFilter.h
lib/fpa/Image/ExtractAxisFilter.hxx
lib/fpa/Image/MinimumSpanningTree.hxx
lib/fpa/Image/PolyLineParametricPath.h
lib/fpa/Image/PolyLineParametricPath.hxx

index 25eee47ed9315ecb2ab2b576e3c5d60fa9f8f52e..01efc75a66e163fd80662365813847c850b0e423 100644 (file)
@@ -39,6 +39,7 @@ namespace fpa
 
       typedef typename TCenterness::OutputImageType TOutputImage;
       typedef typename TInputImage::IndexType       TIndex;
+      typedef typename TInputImage::PointType       TPoint;
 
       typedef fpa::Image::PolyLineParametricPath< Self::Dimension > TPath;
       typedef fpa::Image::Dijkstra< TOutputImage, TOutputImage > TDijkstra;
@@ -50,10 +51,16 @@ namespace fpa
       itkGetConstObjectMacro( Centerness, TCenterness );
       itkGetObjectMacro( Centerness, TCenterness );
 
+      itkGetConstMacro( StartIndex, TIndex );
+      itkGetConstMacro( EndIndex, TIndex );
+
+      itkSetMacro( StartIndex, TIndex );
+      itkSetMacro( EndIndex, TIndex );
+
     public:
       virtual itk::ModifiedTimeType GetMTime( ) const override;
 
-      virtual void AddSeed( const TVertex& seed );
+      virtual void AddSeed( const TIndex& seed );
       virtual void AddSeed( const TPoint& seed );
       virtual void ClearSeeds( );
 
@@ -78,6 +85,9 @@ namespace fpa
     protected:
       typename TCenterness::Pointer m_Centerness;
       typename TDijkstra::Pointer m_Dijkstra;
+
+      TIndex m_StartIndex;
+      TIndex m_EndIndex;
     };
 
   } // ecapseman
index 6f91ade299d73889f7e1a3d982db161fefa9eac3..809306aecd88e53de2cbce14e4cd07cee54a8547 100644 (file)
@@ -16,7 +16,7 @@ GetMTime( ) const
 {
   itk::ModifiedTimeType a = this->Superclass::GetMTime( );
   itk::ModifiedTimeType b = this->m_Centerness->GetMTime( );
-  itk::ModifiedTimeType c = this->m_Dijsktra->GetMTime( );
+  itk::ModifiedTimeType c = this->m_Dijkstra->GetMTime( );
   a = ( a < b )? a: b;
   return( ( a < c )? a: c );
 }
@@ -24,7 +24,7 @@ GetMTime( ) const
 // -------------------------------------------------------------------------
 template< class _TInputImage, class _TScalar, class _TCenterness >
 void fpa::Image::ExtractAxisFilter< _TInputImage, _TScalar, _TCenterness >::
-AddSeed( const TVertex& seed )
+AddSeed( const TIndex& seed )
 {
   this->m_Dijkstra->AddSeed( seed );
 }
@@ -141,9 +141,12 @@ GenerateData( )
   this->m_Dijkstra->Update( );
 
   // Extract axis
-  typename TInputImage::IndexType a = this->m_Dijkstra->GetSeeds( )[ 0 ];
-  typename TInputImage::IndexType b = this->m_Dijkstra->GetSeeds( )[ 1 ];
-  this->m_Dijkstra->GetMinimumSpanningTree( )->GetPolyLineParametricPath( this->GetOutput( ), a, b );
+  typename TPath::Pointer out = this->GetOutput( );
+  this->m_Dijkstra->GetMinimumSpanningTree( )->GetPolyLineParametricPath(
+    out,
+    this->m_StartIndex,
+    this->m_EndIndex
+    );
 }
 
 #endif // __fpa__Image__ExtractAxisFilter__hxx__
index b6161ee76578b0d916992dce21d073e3486852bb..9bd70838ae2066f8a214fbb645eedaeb2edb4dfa 100644 (file)
@@ -32,7 +32,8 @@ GetPolyLineParametricPath(
   ) const
 {
   TVertices v = this->GetPath( a );
-  path = TPolyLineParametricPath::New( );
+  if( path.IsNull( ) )
+    path = TPolyLineParametricPath::New( );
   path->SetReferenceImage( this );
   typename TVertices::const_iterator vIt = v.begin( );
   for( ; vIt != v.end( ); ++vIt )
@@ -48,7 +49,8 @@ GetPolyLineParametricPath(
   ) const
 {
   TVertices v = this->GetPath( a, b );
-  path = TPolyLineParametricPath::New( );
+  if( path.IsNull( ) )
+    path = TPolyLineParametricPath::New( );
   path->SetReferenceImage( this );
   typename TVertices::const_iterator vIt = v.begin( );
   for( ; vIt != v.end( ); ++vIt )
index 7fd648942e82274a5724b7793336289ad87605b5..83a6c05010e647d601ac1ceec698a816a8b1c71b 100644 (file)
@@ -64,6 +64,8 @@ namespace fpa
           this->SetDirection( image->GetDirection( ) );
         }
 
+      virtual void Graft( itk::DataObject* o );
+
     protected:
       PolyLineParametricPath( );
       virtual ~PolyLineParametricPath( );
index 4616dcf1e7eddc8e6db88c86cb22c5855206ec0f..3093a997c60a8fc8fe7873c9416b4e39dd51d95c 100644 (file)
@@ -141,6 +141,29 @@ SetDirection( const TDirection& dir )
   } // fi
 }
 
+// -------------------------------------------------------------------------
+template< unsigned int _VDim >
+void fpa::Image::PolyLineParametricPath< _VDim >::
+Graft( itk::DataObject* o )
+{
+  this->Superclass::Graft( o );
+  Self* other = dynamic_cast< Self* >( o );
+  if( other != NULL )
+  {
+    this->m_DefaultInputStepSize = other->m_DefaultInputStepSize;
+    this->Initialize( );
+    for( unsigned long i = 0; i < other->GetSize( ); ++i )
+      this->AddVertex( other->GetContinuousVertex( i ) );
+    this->m_Spacing = other->m_Spacing;
+    this->m_Origin = other->m_Origin;
+    this->m_Direction = other->m_Direction;
+    this->m_InverseDirection = other->m_InverseDirection;
+    this->m_IndexToPhysicalPoint = other->m_IndexToPhysicalPoint;
+    this->m_PhysicalPointToIndex = other->m_PhysicalPointToIndex;
+
+  } // fi
+}
+
 // -------------------------------------------------------------------------
 template< unsigned int _VDim >
 fpa::Image::PolyLineParametricPath< _VDim >::