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 );
_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 )
{
#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>
_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 >( );
// 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 );
this->_DeconfigureDebugger( filter );
// Connect output
- auto out =
- this->GetOutputData< cpPlugins::Interface::Image >( "Output" );
+ auto out = this->GetOutputData( "Output" );
out->SetITK( filter->GetOutput( ) );
}
#include <cpPlugins/Interface/PointList.h>
#include <cpPlugins/Interface/PolyLineParametricPath.h>
+#include <cpExtensions/DataStructures/VectorValuesContainer.h>
#include <fpaPlugins/MinimumSpanningTree.h>
#include <fpa/Base/MinimumSpanningTree.h>
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( "" );
}
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 );
this->_ExecuteFilter( filter );
// Connect remaining output
- auto mst =
- this->GetOutputData< fpaPlugins::MinimumSpanningTree >( "MinimumSpanningTree" );
+ auto mst = this->GetOutputData( "MinimumSpanningTree" );
mst->SetITK( filter->GetMinimumSpanningTree( ) );
return( "" );
}
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 );
// 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( ) )
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 )
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 )
{
pd->SetLines( array );
return( "" );
+ */
+ return( "Not yet implemented." );
}
// eof - $RCSfile$
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 );
{
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 )
{