From: Leonardo Florez-Valencia Date: Thu, 18 Feb 2016 04:23:38 +0000 (-0500) Subject: ... X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=1aff59e7c480d7448c63694da6f30e3dfb022edf;p=FrontAlgorithms.git ... --- diff --git a/lib/fpaPlugins/AllPixelsImageGrowFunctionSource.cxx b/lib/fpaPlugins/AllPixelsImageGrowFunctionSource.cxx index 7e76aef..6071ab4 100644 --- a/lib/fpaPlugins/AllPixelsImageGrowFunctionSource.cxx +++ b/lib/fpaPlugins/AllPixelsImageGrowFunctionSource.cxx @@ -24,8 +24,7 @@ fpaPlugins::AllPixelsImageGrowFunctionSource:: std::string fpaPlugins::AllPixelsImageGrowFunctionSource:: _GenerateData( ) { - auto image = - this->GetInputData< cpPlugins::Interface::Image >( "ReferenceImage" ); + auto image = this->GetInputData( "ReferenceImage" ); itk::DataObject* itk_image = NULL; std::string r = ""; cpPlugins_Image_Demangle_AllScalarTypes( 2, image, itk_image, r, _GD0 ); @@ -40,7 +39,7 @@ std::string fpaPlugins::AllPixelsImageGrowFunctionSource:: _GD0( itk::DataObject* data ) { typedef fpa::Image::Functors::RegionGrowAllBelongsFunction< I > _F; - auto out = this->GetOutputData< GrowFunction >( "Output" ); + auto out = this->GetOutputData( "Output" ); auto f = out->GetITK< _F >( ); if( f == NULL ) { diff --git a/lib/fpaPlugins/BaseImageFilter.hxx b/lib/fpaPlugins/BaseImageFilter.hxx index 695794a..4c27afd 100644 --- a/lib/fpaPlugins/BaseImageFilter.hxx +++ b/lib/fpaPlugins/BaseImageFilter.hxx @@ -4,6 +4,7 @@ #include #include #include +#include #include #include @@ -16,13 +17,15 @@ F* fpaPlugins::BaseImageFilter:: _ConfigureFilter( ) { typedef typename F::TInputImage _I; - typedef typename _I::PointType _P; + typedef itk::Point< double, _I::ImageDimension > _Pnt; + typedef typename _I::IndexType _Idx; + typedef cpExtensions::DataStructures::VectorValuesContainer< _Pnt > _CPnt; + typedef cpExtensions::DataStructures::VectorValuesContainer< _Idx > _CIdx; - auto image = - this->GetInputData< cpPlugins::Interface::Image >( "Input" )-> - GetITK< _I >( ); - auto seeds = - this->GetInputData< cpPlugins::Interface::PointList >( "Seeds" ); + auto image = this->GetInputData( "Input" )->GetITK< _I >( ); + auto seeds = this->GetInputData( "Seeds" ); + auto p_seeds = seeds->GetITK< _CPnt >( ); + auto i_seeds = seeds->GetITK< _CIdx >( ); // Create filter and connect input F* filter = this->_CreateITK< F >( ); @@ -37,19 +40,22 @@ _ConfigureFilter( ) // Assign seeds filter->ClearSeeds( ); - for( unsigned int s = 0; s < seeds->GetNumberOfPoints( ); ++s ) + if( p_seeds != NULL ) { - if( seeds->HaveEuclideanPoints( ) ) + for( auto pIt = p_seeds->Begin( ); pIt != p_seeds->End( ); ++pIt ) { - _P pnt = seeds->GetPoint< _P >( s ); - typename _I::IndexType idx; - if( image->TransformPhysicalPointToIndex( pnt, idx ) ) + _Idx idx; + if( image->TransformPhysicalPointToIndex( *pIt, idx ) ) filter->AddSeed( idx, 0 ); - } - else - filter->AddSeed( seeds->GetPoint< typename _I::IndexType >( s ), 0 ); - } // rof + } // rof + } + else if( i_seeds != NULL ) + { + for( auto iIt = i_seeds->Begin( ); iIt != i_seeds->End( ); ++iIt ) + filter->AddSeed( *iIt, 0 ); + + } // fi // Ok! return( filter ); @@ -66,8 +72,7 @@ _ExecuteFilter( F* filter ) this->_DeconfigureDebugger( filter ); // Connect output - auto out = - this->GetOutputData< cpPlugins::Interface::Image >( "Output" ); + auto out = this->GetOutputData( "Output" ); out->SetITK( filter->GetOutput( ) ); } diff --git a/lib/fpaPlugins/ExtractBranchesFromMinimumSpanningTree.cxx b/lib/fpaPlugins/ExtractBranchesFromMinimumSpanningTree.cxx index 9c5e6af..33980a2 100644 --- a/lib/fpaPlugins/ExtractBranchesFromMinimumSpanningTree.cxx +++ b/lib/fpaPlugins/ExtractBranchesFromMinimumSpanningTree.cxx @@ -4,6 +4,7 @@ #include #include +#include #include #include @@ -46,31 +47,27 @@ _GD0( ) typedef itk::Functor::IndexLexicographicCompare< D > _VC; typedef fpa::Base::MinimumSpanningTree< _V, _VC > _MST; typedef fpa::Base::ExtractBranchesFromMinimumSpanningTree< _MST > _Filter; + typedef cpExtensions::DataStructures::VectorValuesContainer< _V > _CIdx; // Get inputs - auto tree = - this->GetInputData< fpaPlugins::MinimumSpanningTree >( - "MinimumSpanningTree" - )->GetITK< _MST >( ); + auto tree = this->GetInputData( "MinimumSpanningTree" )->GetITK< _MST >( ); if( tree == NULL ) return( "fpaPlugins::ExtractBranchesFromMinimumSpanningTree: Input MST type not supported." ); - auto endpoints = - this->GetInputData< cpPlugins::Interface::PointList >( "EndPoints" ); - if( endpoints->GetNumberOfPoints( ) < 2 ) + auto endpoints = this->GetInputData( "EndPoints" )->GetITK< _CIdx >( ); + if( endpoints == NULL ) + return( "fpaPlugins::ExtractBranchesFromMinimumSpanningTree: No end-points." ); + if( endpoints->Get( ).size( ) < 2 ) return( "fpaPlugins::ExtractBranchesFromMinimumSpanningTree: Not enough end-points (<2)." ); - if( endpoints->HaveEuclideanPoints( ) ) - return( "fpaPlugins::ExtractBranchesFromMinimumSpanningTree: end-points are on euclidean space." ); // Create filter and connect input _Filter* filter = this->_CreateITK< _Filter >( ); filter->SetInput( tree ); - for( unsigned int i = 0; i < endpoints->GetNumberOfPoints( ); ++i ) - filter->AddEndPoint( endpoints->GetPoint< _V >( i ) ); + for( auto iIt = endpoints->Begin( ); iIt != endpoints->End( ); ++iIt ) + filter->AddEndPoint( *iIt ); filter->Update( ); // Connect output and finish - auto out = - this->GetOutputData< cpPlugins::Interface::PolyLineParametricPath >( "Output" ); + auto out = this->GetOutputData( "Output" ); out->SetITK( filter->GetOutput( ) ); return( "" ); } diff --git a/lib/fpaPlugins/ImageDijkstra.cxx b/lib/fpaPlugins/ImageDijkstra.cxx index 37e16da..46ff8d3 100644 --- a/lib/fpaPlugins/ImageDijkstra.cxx +++ b/lib/fpaPlugins/ImageDijkstra.cxx @@ -24,8 +24,7 @@ fpaPlugins::ImageDijkstra:: std::string fpaPlugins::ImageDijkstra:: _GenerateData( ) { - auto input = - this->GetInputData< cpPlugins::Interface::Image >( "Input" ); + auto input = this->GetInputData( "Input" ); itk::DataObject* image = NULL; std::string r = ""; cpPlugins_Image_Demangle_AllScalarTypes( 2, input, image, r, _GD0 ); @@ -57,8 +56,7 @@ _GD0( itk::DataObject* data ) this->_ExecuteFilter( filter ); // Connect remaining output - auto mst = - this->GetOutputData< fpaPlugins::MinimumSpanningTree >( "MinimumSpanningTree" ); + auto mst = this->GetOutputData( "MinimumSpanningTree" ); mst->SetITK( filter->GetMinimumSpanningTree( ) ); return( "" ); } diff --git a/lib/fpaPlugins/ImageRegionGrow.cxx b/lib/fpaPlugins/ImageRegionGrow.cxx index cc04861..04b0503 100644 --- a/lib/fpaPlugins/ImageRegionGrow.cxx +++ b/lib/fpaPlugins/ImageRegionGrow.cxx @@ -29,8 +29,7 @@ fpaPlugins::ImageRegionGrow:: std::string fpaPlugins::ImageRegionGrow:: _GenerateData( ) { - auto input = - this->GetInputData< cpPlugins::Interface::DataObject >( "Input" ); + auto input = this->GetInputData( "Input" ); itk::DataObject* image = NULL; std::string r = ""; cpPlugins_Image_Demangle_AllScalarTypes( 2, input, image, r, _GD0 ); @@ -54,8 +53,7 @@ _GD0( itk::DataObject* data ) // Connect grow functor (or create a tautology) typename _TFunctor::Pointer functor; - auto functor_wrapper = - this->GetInputData< cpPlugins::Interface::DataObject >( "GrowFunction" ); + auto functor_wrapper = this->GetInputData( "GrowFunction" ); if( functor_wrapper != NULL ) functor = functor_wrapper->GetITK< _TFunctor >( ); if( functor.IsNull( ) ) diff --git a/lib/fpaPlugins/MinimumSpanningTreeToMesh.cxx b/lib/fpaPlugins/MinimumSpanningTreeToMesh.cxx index c474429..8596bc5 100644 --- a/lib/fpaPlugins/MinimumSpanningTreeToMesh.cxx +++ b/lib/fpaPlugins/MinimumSpanningTreeToMesh.cxx @@ -37,8 +37,7 @@ _GenerateData( ) typedef itk::ImageBase< 2 > _2D; typedef itk::ImageBase< 3 > _3D; - auto input = - this->GetInputData< cpPlugins::Interface::Image >( "ReferenceImage" ); + auto input = this->GetInputData( "ReferenceImage" ); _2D* im2d = input->GetITK< _2D >( ); _3D* im3d = input->GetITK< _3D >( ); if( im2d != NULL ) @@ -54,25 +53,27 @@ template< class I > std::string fpaPlugins::MinimumSpanningTreeToMesh:: _GD0( I* image ) { + /* TODO typedef typename I::IndexType _V; typedef typename I::PointType _P; typedef itk::Functor::IndexLexicographicCompare< I::ImageDimension > _VC; typedef fpa::Base::MinimumSpanningTree< _V, _VC > _MST; // Get inputs - auto mst_wrapper = - this->GetInputData< fpaPlugins::MinimumSpanningTree >( "Input" ); + auto mst_wrapper = this->GetInputData( "Input" ); _MST* mst = mst_wrapper->GetITK< _MST >( ); if( mst == NULL ) return( "fpaPlugins::MinimumSpanningTreeToMesh: Input MST type not supported." ); - auto seeds = - this->GetInputData< cpPlugins::Interface::PointList >( "Seeds" ); + auto seeds = dynamic_cast< cpPlugins::Interface::PointList* >( + this->GetInputData( "Seeds" ) + ); + if( seeds == NULL ) + return( "fpaPlugins::MinimumSpanningTreeToMesh: Not valid seeds." ); if( seeds->GetNumberOfPoints( ) < 2 ) return( "fpaPlugins::MinimumSpanningTreeToMesh: Not enough seeds (<2)." ); // Get output - auto out = - this->GetOutputData< cpPlugins::Interface::Mesh >( "Output" ); + auto out = this->GetOutputData( "Output" ); vtkSmartPointer< vtkPolyData > pd = out->GetVTK< vtkPolyData >( ); if( pd.GetPointer( ) == NULL ) { @@ -120,6 +121,8 @@ _GD0( I* image ) pd->SetLines( array ); return( "" ); + */ + return( "Not yet implemented." ); } // eof - $RCSfile$ diff --git a/lib/fpaPlugins/ThresholdImageGrowFunctionSource.cxx b/lib/fpaPlugins/ThresholdImageGrowFunctionSource.cxx index cebd4a2..e518b6b 100644 --- a/lib/fpaPlugins/ThresholdImageGrowFunctionSource.cxx +++ b/lib/fpaPlugins/ThresholdImageGrowFunctionSource.cxx @@ -30,8 +30,7 @@ fpaPlugins::ThresholdImageGrowFunctionSource:: std::string fpaPlugins::ThresholdImageGrowFunctionSource:: _GenerateData( ) { - auto image = - this->GetInputData< cpPlugins::Interface::DataObject >( "ReferenceImage" ); + auto image = this->GetInputData( "ReferenceImage" ); itk::DataObject* itk_image = NULL; std::string r = ""; cpPlugins_Image_Demangle_AllScalarTypes( 2, image, itk_image, r, _GD0 ); @@ -47,7 +46,7 @@ _GD0( itk::DataObject* data ) { typedef fpa::Image::Functors::RegionGrowThresholdFunction< I > _F; - auto out = this->GetOutputData< GrowFunction >( "Output" ); + auto out = this->GetOutputData( "Output" ); auto f = out->GetITK< _F >( ); if( f == NULL ) {