]> Creatis software - FrontAlgorithms.git/commitdiff
...
authorLeonardo Florez-Valencia <florez-l@javeriana.edu.co>
Thu, 18 Feb 2016 04:23:38 +0000 (23:23 -0500)
committerLeonardo Florez-Valencia <florez-l@javeriana.edu.co>
Thu, 18 Feb 2016 04:23:38 +0000 (23:23 -0500)
lib/fpaPlugins/AllPixelsImageGrowFunctionSource.cxx
lib/fpaPlugins/BaseImageFilter.hxx
lib/fpaPlugins/ExtractBranchesFromMinimumSpanningTree.cxx
lib/fpaPlugins/ImageDijkstra.cxx
lib/fpaPlugins/ImageRegionGrow.cxx
lib/fpaPlugins/MinimumSpanningTreeToMesh.cxx
lib/fpaPlugins/ThresholdImageGrowFunctionSource.cxx

index 7e76aefcffecdc538eaeff1d4fab444c415f3e40..6071ab46d9d2364a9767b3526bf54c7fea1bf5c7 100644 (file)
@@ -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 )
   {
index 695794aa93b2f7b7afed71586915ff87c096ca58..4c27afd834193e813b8ae3a81e2c75b032dc1ea6 100644 (file)
@@ -4,6 +4,7 @@
 #include <cpPlugins/Interface/Image.h>
 #include <cpPlugins/Interface/PointList.h>
 #include <cpPlugins/Interface/SimpleMPRWidget.h>
+#include <cpExtensions/DataStructures/VectorValuesContainer.h>
 
 #include <fpa/VTK/Image2DObserver.h>
 #include <fpa/VTK/Image3DObserver.h>
@@ -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( ) );
 }
 
index 9c5e6af0c0524be354c16f84ba488cf67345f90a..33980a2233a8359ca3ac2d1624eb789c63faf61e 100644 (file)
@@ -4,6 +4,7 @@
 
 #include <cpPlugins/Interface/PointList.h>
 #include <cpPlugins/Interface/PolyLineParametricPath.h>
+#include <cpExtensions/DataStructures/VectorValuesContainer.h>
 #include <fpaPlugins/MinimumSpanningTree.h>
 
 #include <fpa/Base/MinimumSpanningTree.h>
@@ -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( "" );
 }
index 37e16daf053c5f5d9d05fc4ef7fdca045de0ca81..46ff8d3dfee1a7827055001568e120041c4d4d40 100644 (file)
@@ -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( "" );
 }
index cc04861483b7845a3242f075030b3d74dee037a5..04b050365a5f4280023ed76946aff6ee94ad04a5 100644 (file)
@@ -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( ) )
index c474429f3ba3e3f8a405819b82191d85ea1aa60d..8596bc5034f3074a633b7b02b8542ab0093eac30 100644 (file)
@@ -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$
index cebd4a261caad4f388e4788b06521f6b326761e4..e518b6bbe215c595e535c131fa9d06b3c3fa19df 100644 (file)
@@ -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 )
   {