From ed698ff461a586dfc808aaad69f29cdfb53b1f93 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Leonardo=20Fl=C3=B3rez-Valencia?= Date: Fri, 21 Jul 2017 14:13:39 -0500 Subject: [PATCH] ... --- lib/fpa/Image/ExtractAxisFilter.h | 22 ++++---- lib/fpa/Image/ExtractAxisFilter.hxx | 79 ++++++++++++++--------------- 2 files changed, 50 insertions(+), 51 deletions(-) diff --git a/lib/fpa/Image/ExtractAxisFilter.h b/lib/fpa/Image/ExtractAxisFilter.h index 01efc75..5c65916 100644 --- a/lib/fpa/Image/ExtractAxisFilter.h +++ b/lib/fpa/Image/ExtractAxisFilter.h @@ -7,7 +7,7 @@ #define __fpa__Image__ExtractAxisFilter__h__ #include -#include +#include #include #include @@ -18,7 +18,7 @@ namespace fpa { /** */ - template< class _TInputImage, class _TScalar, class _TCenterness = itk::SignedMaurerDistanceMapImageFilter< _TInputImage, itk::Image< _TScalar, _TInputImage::ImageDimension > > > + template< class _TInputImage, class _TScalar > class ExtractAxisFilter : public itk::ProcessObject { @@ -30,19 +30,20 @@ namespace fpa typedef _TInputImage TInputImage; typedef _TScalar TScalar; - typedef _TCenterness TCenterness; + typedef typename TInputImage::IndexType TIndex; + typedef typename TInputImage::PointType TPoint; + itkStaticConstMacro( Dimension, unsigned int, TInputImage::ImageDimension ); - typedef typename TCenterness::OutputImageType TOutputImage; - typedef typename TInputImage::IndexType TIndex; - typedef typename TInputImage::PointType TPoint; + typedef itk::Image< TScalar, Self::Dimension > TScalarImage; + typedef itk::ImageToImageFilter< TInputImage, TScalarImage > TCenterness; typedef fpa::Image::PolyLineParametricPath< Self::Dimension > TPath; - typedef fpa::Image::Dijkstra< TOutputImage, TOutputImage > TDijkstra; + typedef fpa::Image::Dijkstra< TScalarImage, TScalarImage > TDijkstra; public: itkNewMacro( Self ); @@ -50,11 +51,12 @@ namespace fpa itkGetConstObjectMacro( Centerness, TCenterness ); itkGetObjectMacro( Centerness, TCenterness ); + itkSetObjectMacro( Centerness, TCenterness ); itkGetConstMacro( StartIndex, TIndex ); - itkGetConstMacro( EndIndex, TIndex ); - itkSetMacro( StartIndex, TIndex ); + + itkGetConstMacro( EndIndex, TIndex ); itkSetMacro( EndIndex, TIndex ); public: @@ -84,7 +86,7 @@ namespace fpa protected: typename TCenterness::Pointer m_Centerness; - typename TDijkstra::Pointer m_Dijkstra; + typename TDijkstra::Pointer m_Dijkstra; TIndex m_StartIndex; TIndex m_EndIndex; diff --git a/lib/fpa/Image/ExtractAxisFilter.hxx b/lib/fpa/Image/ExtractAxisFilter.hxx index 809306a..5c3c4e6 100644 --- a/lib/fpa/Image/ExtractAxisFilter.hxx +++ b/lib/fpa/Image/ExtractAxisFilter.hxx @@ -6,12 +6,13 @@ #ifndef __fpa__Image__ExtractAxisFilter__hxx__ #define __fpa__Image__ExtractAxisFilter__hxx__ +#include #include // ------------------------------------------------------------------------- -template< class _TInputImage, class _TScalar, class _TCenterness > -itk::ModifiedTimeType -fpa::Image::ExtractAxisFilter< _TInputImage, _TScalar, _TCenterness >:: +template< class _TInputImage, class _TScalar > +itk::ModifiedTimeType +fpa::Image::ExtractAxisFilter< _TInputImage, _TScalar >:: GetMTime( ) const { itk::ModifiedTimeType a = this->Superclass::GetMTime( ); @@ -22,54 +23,50 @@ GetMTime( ) const } // ------------------------------------------------------------------------- -template< class _TInputImage, class _TScalar, class _TCenterness > -void fpa::Image::ExtractAxisFilter< _TInputImage, _TScalar, _TCenterness >:: +template< class _TInputImage, class _TScalar > +void fpa::Image::ExtractAxisFilter< _TInputImage, _TScalar >:: AddSeed( const TIndex& seed ) { this->m_Dijkstra->AddSeed( seed ); } // ------------------------------------------------------------------------- -template< class _TInputImage, class _TScalar, class _TCenterness > -void fpa::Image::ExtractAxisFilter< _TInputImage, _TScalar, _TCenterness >:: +template< class _TInputImage, class _TScalar > +void fpa::Image::ExtractAxisFilter< _TInputImage, _TScalar >:: AddSeed( const TPoint& seed ) { this->m_Dijkstra->AddSeed( seed ); } // ------------------------------------------------------------------------- -template< class _TInputImage, class _TScalar, class _TCenterness > -void fpa::Image::ExtractAxisFilter< _TInputImage, _TScalar, _TCenterness >:: +template< class _TInputImage, class _TScalar > +void fpa::Image::ExtractAxisFilter< _TInputImage, _TScalar >:: ClearSeeds( ) { this->m_Dijkstra->ClearSeeds( ); } // ------------------------------------------------------------------------- -template< class _TInputImage, class _TScalar, class _TCenterness > -void fpa::Image::ExtractAxisFilter< _TInputImage, _TScalar, _TCenterness >:: +template< class _TInputImage, class _TScalar > +void fpa::Image::ExtractAxisFilter< _TInputImage, _TScalar >:: SetInput( TInputImage* input ) { this->Superclass::SetNthInput( 0, input ); } // ------------------------------------------------------------------------- -template< class _TInputImage, class _TScalar, class _TCenterness > -typename -fpa::Image::ExtractAxisFilter< _TInputImage, _TScalar, _TCenterness >:: -TInputImage* -fpa::Image::ExtractAxisFilter< _TInputImage, _TScalar, _TCenterness >:: +template< class _TInputImage, class _TScalar > +typename fpa::Image::ExtractAxisFilter< _TInputImage, _TScalar >:: +TInputImage* fpa::Image::ExtractAxisFilter< _TInputImage, _TScalar >:: GetInput( ) { return( dynamic_cast< TInputImage* >( this->Superclass::GetInput( 0 ) ) ); } // ------------------------------------------------------------------------- -template< class _TInputImage, class _TScalar, class _TCenterness > -const typename -fpa::Image::ExtractAxisFilter< _TInputImage, _TScalar, _TCenterness >:: -TInputImage* -fpa::Image::ExtractAxisFilter< _TInputImage, _TScalar, _TCenterness >:: +template< class _TInputImage, class _TScalar > +const typename fpa::Image::ExtractAxisFilter< _TInputImage, _TScalar >:: +TInputImage* fpa::Image::ExtractAxisFilter< _TInputImage, _TScalar >:: GetInput( ) const { return( @@ -78,30 +75,26 @@ GetInput( ) const } // ------------------------------------------------------------------------- -template< class _TInputImage, class _TScalar, class _TCenterness > -typename -fpa::Image::ExtractAxisFilter< _TInputImage, _TScalar, _TCenterness >:: -TPath* -fpa::Image::ExtractAxisFilter< _TInputImage, _TScalar, _TCenterness >:: +template< class _TInputImage, class _TScalar > +typename fpa::Image::ExtractAxisFilter< _TInputImage, _TScalar >:: +TPath* fpa::Image::ExtractAxisFilter< _TInputImage, _TScalar >:: GetOutput( ) { return( dynamic_cast< TPath* >( this->Superclass::GetOutput( 0 ) ) ); } // ------------------------------------------------------------------------- -template< class _TInputImage, class _TScalar, class _TCenterness > -const typename -fpa::Image::ExtractAxisFilter< _TInputImage, _TScalar, _TCenterness >:: -TPath* -fpa::Image::ExtractAxisFilter< _TInputImage, _TScalar, _TCenterness >:: +template< class _TInputImage, class _TScalar > +const typename fpa::Image::ExtractAxisFilter< _TInputImage, _TScalar >:: +TPath* fpa::Image::ExtractAxisFilter< _TInputImage, _TScalar >:: GetOutput( ) const { return( dynamic_cast< const TPath* >( this->Superclass::GetOutput( 0 ) ) ); } // ------------------------------------------------------------------------- -template< class _TInputImage, class _TScalar, class _TCenterness > -fpa::Image::ExtractAxisFilter< _TInputImage, _TScalar, _TCenterness >:: +template< class _TInputImage, class _TScalar > +fpa::Image::ExtractAxisFilter< _TInputImage, _TScalar >:: ExtractAxisFilter( ) : Superclass( ) { @@ -117,22 +110,28 @@ ExtractAxisFilter( ) weight->SetBeta( 1 ); // Filters - this->m_Centerness = TCenterness::New( ); + typedef itk::SignedMaurerDistanceMapImageFilter< TInputImage, TScalarImage > _TDefaultCenterness; + this->m_Centerness = _TDefaultCenterness::New( ); + this->m_Centerness->InsideIsPositiveOn( ); + this->m_Centerness->SquaredDistanceOn( ); + this->m_Centerness->UseImageSpacingOn( ); + + // Axis extractor this->m_Dijkstra = TDijkstra::New( ); this->m_Dijkstra->SetWeightFunction( weight ); this->m_Dijkstra->StopAtOneFront( ); } // ------------------------------------------------------------------------- -template< class _TInputImage, class _TScalar, class _TCenterness > -fpa::Image::ExtractAxisFilter< _TInputImage, _TScalar, _TCenterness >:: +template< class _TInputImage, class _TScalar > +fpa::Image::ExtractAxisFilter< _TInputImage, _TScalar >:: ~ExtractAxisFilter( ) { } // ------------------------------------------------------------------------- -template< class _TInputImage, class _TScalar, class _TCenterness > -void fpa::Image::ExtractAxisFilter< _TInputImage, _TScalar, _TCenterness >:: +template< class _TInputImage, class _TScalar > +void fpa::Image::ExtractAxisFilter< _TInputImage, _TScalar >:: GenerateData( ) { // Execute minipipeline @@ -143,9 +142,7 @@ GenerateData( ) // Extract axis typename TPath::Pointer out = this->GetOutput( ); this->m_Dijkstra->GetMinimumSpanningTree( )->GetPolyLineParametricPath( - out, - this->m_StartIndex, - this->m_EndIndex + out, this->m_StartIndex, this->m_EndIndex ); } -- 2.47.1