}
else
{
- std::cout << "-----> " << v.Vertex << " " << d << std::endl;
+ std::cout << std::endl << "-- FM --> " << v.Vertex << " " << d << std::endl;
+ std::exit( 1 );
}
return( true );
}
virtual bool _UpdateValue(
_TQueueNode& v, const _TQueueNode& p
) override;
+ virtual TOutput _GetInputValue( const _TQueueNode& v, const _TQueueNode& p ) override
+ {
+ TOutput res = this->m_InitResult;
+ if( this->m_GrowFunction.IsNotNull( ) )
+ res = this->m_GrowFunction->Evaluate( v.Vertex, p.Vertex );
+ return( res );
+ }
+
private:
// Purposely not defined
RegionGrow( const Self& other );
Self& operator=( const Self& other );
+
+ protected:
+ typename TGrowFunction::Pointer m_GrowFunction;
};
} // ecapseman
TGrowFunction* fpa::Base::RegionGrow< _TSuperclass >::
GetGrowFunction( )
{
- return( dynamic_cast< TGrowFunction* >( this->GetVertexFunction( ) ) );
+ // TODO: return( dynamic_cast< TGrowFunction* >( this->GetVertexFunction( ) ) );
+ return( this->m_GrowFunction );
}
// -------------------------------------------------------------------------
TGrowFunction* fpa::Base::RegionGrow< _TSuperclass >::
GetGrowFunction( ) const
{
- return(
- dynamic_cast< const TGrowFunction* >( this->GetVertexFunction( ) )
- );
+ /* TODO
+ return(
+ dynamic_cast< const TGrowFunction* >( this->GetVertexFunction( ) )
+ );
+ */
+ return( this->m_GrowFunction );
}
// -------------------------------------------------------------------------
f->SetOutsideValue( old_f->GetOutsideValue( ) );
} // fi
- this->SetVertexFunction( f );
+ this->m_GrowFunction = f;
}
// -------------------------------------------------------------------------
dynamic_cast< TVertexFunction* >(
this->GetVertexFunction( )
);
- if( vertexFunc == NULL )
- itkExceptionMacro( << "VertexFunction not well defined." );
- vertexFunc->SetImage( this->GetInput( ) );
+ if( vertexFunc != NULL )
+ vertexFunc->SetImage( this->GetInput( ) );
}
// -------------------------------------------------------------------------
public:
itkTypeMacro( Base, itk::FunctionBase );
- itkGetConstObjectMacro( Image, TImageBase );
- itkSetConstObjectMacro( Image, TImageBase );
+ itkGetConstObjectMacro( Image, TImage );
+ itkSetConstObjectMacro( Image, TImage );
protected:
Base( ) : Superclass( ) { }
Self& operator=( const Self& other );
protected:
- typename TImageBase::ConstPointer m_Image;
+ typename TImage::ConstPointer m_Image;
};
} // ecapseman
{
TPixel v = im->GetPixel( b );
return(
- ( this->m_Lower <= v && v <= this->m_Upper )?
+ ( this->m_Lower < v && v < this->m_Upper )?
this->m_InsideValue:
this->m_OutsideValue
);
{
this->Superclass::_BeforeGenerateData( );
this->m_InitResult = this->GetOutsideValue( );
+ TGrowFunction* grow =
+ dynamic_cast< TGrowFunction* >( this->GetGrowFunction( ) );
+ if( grow != NULL )
+ grow->SetImage( this->GetInput( ) );
}
#endif // __fpa__Image__RegionGrow__hxx__
SET(
_dirs
+ Functors
+ ImageFunctors
ImageAlgorithms
# RegionGrowFunctors
# DijkstraFunctors
--- /dev/null
+
+tinclude fpa/Base/Functors/Inverse:h|hxx
+
+instances fpa::Base::Functors::Inverse< #scalar_types#, #real_types# >
+
+** eof - $RCSfile$
--- /dev/null
+#include "Inverse.h"
+
+#include <cpInstances/DataObjects/Image.h>
+
+#include <itkImage.h>
+#include <fpa/Base/Functors/Inverse.h>
+
+// -------------------------------------------------------------------------
+void fpaPlugins_Functors::Inverse::
+Instantiate( itk::LightObject* filter )
+{
+ auto itk_filter = dynamic_cast< itk::ProcessObject* >( filter );
+ if( itk_filter != NULL )
+ {
+ auto inputs = itk_filter->GetInputs( );
+ if( inputs.size( ) > 0 )
+ {
+ cpPlugins_Demangle_Image_ScalarPixels_AllDims_2(
+ inputs[ 0 ].GetPointer( ), _GD0, itk_filter
+ )
+ this->_Error( "Invalid input data." );
+ }
+ else
+ this->_Error( "Not enough inputs." );
+ }
+ else
+ this->_Error( "Invalid instantiation filter." );
+}
+
+// -------------------------------------------------------------------------
+fpaPlugins_Functors::Inverse::
+Inverse( )
+ : Superclass( )
+{
+ this->_ConfigureOutput< cpPlugins::Pipeline::DataObject >( "Functor" );
+ this->m_Parameters.ConfigureAsReal( "NegativeValue", -1 );
+ this->GetOutput( "Functor" )->SetITK( this );
+}
+
+// -------------------------------------------------------------------------
+fpaPlugins_Functors::Inverse::
+~Inverse( )
+{
+}
+
+// -------------------------------------------------------------------------
+void fpaPlugins_Functors::Inverse::
+_GenerateData( )
+{
+}
+
+// -------------------------------------------------------------------------
+template< class _TInput >
+void fpaPlugins_Functors::Inverse::
+_GD0( _TInput* input, itk::ProcessObject* filter )
+{
+ auto outputs = filter->GetOutputs( );
+ if( outputs.size( ) > 0 )
+ {
+ cpPlugins_Demangle_Image_RealPixels_3(
+ outputs[ 0 ].GetPointer( ), _GD1, _TInput::ImageDimension, input, filter
+ )
+ this->_Error( "Invalid output data." );
+ }
+ else
+ this->_Error( "Not enough outputs." );
+}
+
+// -------------------------------------------------------------------------
+template< class _TInput, class _TOutput >
+void fpaPlugins_Functors::Inverse::
+_GD1( _TOutput* output, _TInput* input, itk::ProcessObject* filter )
+{
+ typedef typename _TInput::PixelType _TIValue;
+ typedef typename _TOutput::PixelType _TOValue;
+ typedef fpa::Base::Functors::Inverse< _TIValue, _TOValue > _TFunctor;
+
+ auto f = dynamic_cast< _TFunctor* >( this->m_Functor.GetPointer( ) );
+ if( f == NULL )
+ {
+ typename _TFunctor::Pointer ptr_f = _TFunctor::New( );
+ f = ptr_f.GetPointer( );
+ this->m_Functor = f;
+
+ } // fi
+ f->SetNegativeValue( this->m_Parameters.GetReal( "NegativeValue" ) );
+}
+
+// eof - $RCSfile$
--- /dev/null
+#ifndef __fpaPlugins_Functors__Inverse__h__
+#define __fpaPlugins_Functors__Inverse__h__
+
+#include <itkProcessObject.h>
+#include <fpaPlugins_Functors_Export.h>
+#include <cpPlugins/Pipeline/Functor.h>
+
+namespace fpaPlugins_Functors
+{
+ /**
+ */
+ class fpaPlugins_Functors_EXPORT Inverse
+ : public cpPlugins::Pipeline::Functor
+ {
+ cpPluginsObject( Inverse, cpPlugins::Pipeline::Functor, fpaFunctors );
+
+ public:
+ virtual void Instantiate( itk::LightObject* filter ) override;
+
+ protected:
+ template< class _TInput >
+ inline void _GD0( _TInput* input, itk::ProcessObject* filter );
+
+ template< class _TInput, class _TOutput >
+ inline void _GD1( _TOutput* output, _TInput* input, itk::ProcessObject* filter );
+ };
+
+} // ecapseman
+
+#endif // __fpaPlugins_Functors__Inverse__h__
+
+// eof - $RCSfile$
-#include <ImageAlgorithms/BaseFilter.h>
+#include "BaseFilter.h"
#include <cpInstances/DataObjects/Image.h>
// -------------------------------------------------------------------------
-fpaPluginsImageAlgorithms::BaseFilter::
+fpaPlugins_ImageAlgorithms::BaseFilter::
BaseFilter( )
: Superclass( )
{
}
// -------------------------------------------------------------------------
-fpaPluginsImageAlgorithms::BaseFilter::
+fpaPlugins_ImageAlgorithms::BaseFilter::
~BaseFilter( )
{
}
-#ifndef __fpaPluginsImageAlgorithms__BaseFilter__h__
-#define __fpaPluginsImageAlgorithms__BaseFilter__h__
+#ifndef __fpaPlugins_ImageAlgorithms__BaseFilter__h__
+#define __fpaPlugins_ImageAlgorithms__BaseFilter__h__
-#include <fpaPluginsImageAlgorithms_Export.h>
+#include <fpaPlugins_ImageAlgorithms_Export.h>
#include <vtkPolyData.h>
#include <cpPlugins/Pipeline/ProcessObject.h>
-#define ITK_MANUAL_INSTANTIATION
-#include <fpa/Image/Functors/SimpleNeighborhood.h>
-
-namespace fpaPluginsImageAlgorithms
+namespace fpaPlugins_ImageAlgorithms
{
/**
*/
- class fpaPluginsImageAlgorithms_EXPORT BaseFilter
+ class fpaPlugins_ImageAlgorithms_EXPORT BaseFilter
: public cpPlugins::Pipeline::ProcessObject
{
public:
} // ecapseman
+// -------------------------------------------------------------------------
+#define ITK_MANUAL_INSTANTIATION
+#include <fpa/Image/Functors/SimpleNeighborhood.h>
+
// -------------------------------------------------------------------------
template< class _TFilter, class _TImage >
-void fpaPluginsImageAlgorithms::BaseFilter::
+void fpaPlugins_ImageAlgorithms::BaseFilter::
_ConfigureFilter(
_TFilter* filter, _TImage* image,
std::vector< typename _TImage::IndexType >& seeds
} // fi
}
-#endif // __fpaPluginsImageAlgorithms__BaseFilter__h__
+#endif // __fpaPlugins_ImageAlgorithms__BaseFilter__h__
// eof - $RCSfile$
-#include <ImageAlgorithms/Dijkstra.h>
+#include "Dijkstra.h"
+#include <cpPlugins/Pipeline/Functor.h>
#include <cpInstances/DataObjects/Image.h>
#include <fpa/Image/Dijkstra.h>
// -------------------------------------------------------------------------
-fpaPluginsImageAlgorithms::Dijkstra::
+fpaPlugins_ImageAlgorithms::Dijkstra::
Dijkstra( )
: Superclass( )
{
- typedef cpPlugins::Pipeline::DataObject _TData;
+ typedef cpPlugins::Pipeline::DataObject _TFunctor;
typedef cpInstances::DataObjects::Image _TMST;
- this->_ConfigureInput< _TData >( "VertexFunction", false, false );
- this->_ConfigureInput< _TData >( "ConversionFunction", false, false );
+ this->_ConfigureInput< _TFunctor >( "VertexFunction", false, false );
+ this->_ConfigureInput< _TFunctor >( "ConversionFunction", false, false );
this->_ConfigureOutput< _TMST >( "MST" );
std::vector< std::string > choices;
}
// -------------------------------------------------------------------------
-fpaPluginsImageAlgorithms::Dijkstra::
+fpaPlugins_ImageAlgorithms::Dijkstra::
~Dijkstra( )
{
}
// -------------------------------------------------------------------------
-void fpaPluginsImageAlgorithms::Dijkstra::
+void fpaPlugins_ImageAlgorithms::Dijkstra::
_GenerateData( )
{
auto o = this->GetInputData( "Input" );
// -------------------------------------------------------------------------
template< class _TImage >
-void fpaPluginsImageAlgorithms::Dijkstra::
+void fpaPlugins_ImageAlgorithms::Dijkstra::
_GD0( _TImage* image )
{
typedef itk::Image< float, _TImage::ImageDimension > _TFloat;
// -------------------------------------------------------------------------
template< class _TInputImage, class _TOutputImage >
-void fpaPluginsImageAlgorithms::Dijkstra::
+void fpaPlugins_ImageAlgorithms::Dijkstra::
_GD1( _TInputImage* image )
{
+ typedef cpPlugins::Pipeline::Functor _TFunctor;
typedef fpa::Image::Dijkstra< _TInputImage, _TOutputImage > _TFilter;
typedef typename _TFilter::TConversionFunction _TConversionFunction;
typedef typename _TFilter::TVertexFunction _TVertexFunction;
+ // Create filter
auto filter = this->_CreateITK< _TFilter >( );
std::vector< typename _TInputImage::IndexType > seeds;
this->_ConfigureFilter( filter, image, seeds );
+
+ // Instantiate functors
+ auto cost_conversion = this->GetInputData< _TFunctor >( "ConversionFunction" );
+ if( cost_conversion != NULL )
+ {
+ cost_conversion->Instantiate( filter );
+ auto cost_conversion_functor = cost_conversion->GetFunctor< _TConversionFunction >( );
+ if( cost_conversion_functor != NULL )
+ filter->SetConversionFunction( cost_conversion_functor );
+
+ } // fi
+
+ auto vertex = this->GetInputData< _TFunctor >( "VertexFunction" );
+ if( vertex != NULL )
+ {
+ vertex->Instantiate( filter );
+ auto vertex_functor = vertex->GetFunctor< _TVertexFunction >( );
+ if( vertex_functor != NULL )
+ filter->SetVertexFunction( vertex_functor );
+
+ } // fi
+
+ // Finish filter's configuration
filter->ClearSeeds( );
for( auto seed : seeds )
filter->AddSeed( seed, ( typename _TOutputImage::PixelType )( 0 ) );
filter->Update( );
this->GetOutput( "Output" )->SetITK( filter->GetOutput( ) );
-
- /* TODO
- auto filter = this->_CreateITK< _TFilter >( );
- this->_ConfigureFilter( filter, image );
- auto cost = this->GetInputData< _TCost >( "Cost" );
- auto conv = this->GetInputData< _TCostConversion >( "CostConversion" );
- if( cost != NULL )
- filter->SetCostFunction( cost );
- if( conv != NULL )
- filter->SetCostConversionFunction( conv );
- filter->Update( );
- this->GetOutput( "Output" )->SetITK( filter->GetOutput( ) );
- this->GetOutput( "MST" )->SetITK( filter->GetMinimumSpanningTree( ) );
- */
}
// eof - $RCSfile$
-#ifndef __fpaPluginsImageAlgorithms__Dijkstra__h__
-#define __fpaPluginsImageAlgorithms__Dijkstra__h__
+#ifndef __fpaPlugins_ImageAlgorithms__Dijkstra__h__
+#define __fpaPlugins_ImageAlgorithms__Dijkstra__h__
#include <ImageAlgorithms/BaseFilter.h>
-namespace fpaPluginsImageAlgorithms
+namespace fpaPlugins_ImageAlgorithms
{
/**
*/
- class fpaPluginsImageAlgorithms_EXPORT Dijkstra
+ class fpaPlugins_ImageAlgorithms_EXPORT Dijkstra
: public BaseFilter
{
cpPluginsObject( Dijkstra, BaseFilter, fpaImageAlgorithms );
template< class _TImage >
inline void _GD0( _TImage* image );
- template< class _TInputImage, class _TOutputPixel >
+ template< class _TInputImage, class _TOutputImage >
inline void _GD1( _TInputImage* image );
};
} // ecapseman
-#endif // __fpaPluginsImageAlgorithms__Dijkstra__h__
+#endif // __fpaPlugins_ImageAlgorithms__Dijkstra__h__
// eof - $RCSfile$
--- /dev/null
+#include "ExtractPathFromMinimumSpanningTree.h"
+#include <cpInstances/DataObjects/Image.h>
+#include <cpInstances/DataObjects/PolyLineParametricPath.h>
+#include <vtkPolyData.h>
+#include <fpa/Image/MinimumSpanningTree.h>
+
+// -------------------------------------------------------------------------
+fpaPlugins_ImageAlgorithms::ExtractPathFromMinimumSpanningTree::
+ExtractPathFromMinimumSpanningTree( )
+ : Superclass( )
+{
+ typedef cpPlugins::Pipeline::DataObject _TData;
+ typedef cpInstances::DataObjects::Image _TMST;
+ typedef cpInstances::DataObjects::PolyLineParametricPath _TPath;
+
+ this->_ConfigureInput< _TMST >( "MST", true, false );
+ this->_ConfigureInput< _TData >( "Seeds", true, false );
+ this->_ConfigureOutput< _TPath >( "Output" );
+}
+
+// -------------------------------------------------------------------------
+fpaPlugins_ImageAlgorithms::ExtractPathFromMinimumSpanningTree::
+~ExtractPathFromMinimumSpanningTree( )
+{
+}
+
+// -------------------------------------------------------------------------
+void fpaPlugins_ImageAlgorithms::ExtractPathFromMinimumSpanningTree::
+_GenerateData( )
+{
+ typedef fpa::Image::MinimumSpanningTree< 2 > _TMST2;
+ typedef fpa::Image::MinimumSpanningTree< 3 > _TMST3;
+
+ auto mst2 = this->GetInputData< _TMST2 >( "MST" );
+ auto mst3 = this->GetInputData< _TMST3 >( "MST" );
+ if ( mst2 != NULL ) this->_GD0( mst2 );
+ else if( mst3 != NULL ) this->_GD0( mst3 );
+ else this->_Error( "Invalid input spanning tree." );
+}
+
+// -------------------------------------------------------------------------
+template< class _TMST >
+void fpaPlugins_ImageAlgorithms::ExtractPathFromMinimumSpanningTree::
+_GD0( _TMST* mst )
+{
+ typedef typename _TMST::IndexType _TIndex;
+ typedef typename _TMST::TPath _TPath;
+
+ // Get seeds
+ std::vector< _TIndex > seeds;
+ auto points = this->GetInputData< vtkPolyData >( "Seeds" );
+ if( points != NULL )
+ {
+ if( points->GetNumberOfPoints( ) < 2 )
+ this->_Error( "Not enough seeds (<2)." );
+
+ typename _TMST::PointType pnt;
+ typename _TMST::IndexType idx;
+ unsigned int dim =
+ ( _TMST::ImageDimension < 3 )? _TMST::ImageDimension: 3;
+ for( unsigned int i = 0; i < 2; ++i )
+ {
+ double buf[ 3 ];
+ points->GetPoint( i, buf );
+ pnt.Fill( 0 );
+ for( unsigned int d = 0; d < dim; ++d )
+ pnt[ d ] = buf[ d ];
+ if( mst->TransformPhysicalPointToIndex( pnt, idx ) )
+ seeds.push_back( idx );
+
+ } // rof
+
+ } // fi
+
+ typename _TPath::Pointer path;
+ mst->GetPath( path, seeds[ 0 ], seeds[ 1 ] );
+ this->GetOutput( "Output" )->SetITK( path );
+}
+
+// eof - $RCSfile$
--- /dev/null
+#ifndef __fpaPlugins_ImageAlgorithms__ExtractPathFromMinimumSpanningTree__h__
+#define __fpaPlugins_ImageAlgorithms__ExtractPathFromMinimumSpanningTree__h__
+
+#include <fpaPlugins_ImageAlgorithms_Export.h>
+#include <cpPlugins/Pipeline/ProcessObject.h>
+
+namespace fpaPlugins_ImageAlgorithms
+{
+ /**
+ */
+ class fpaPlugins_ImageAlgorithms_EXPORT ExtractPathFromMinimumSpanningTree
+ : public cpPlugins::Pipeline::ProcessObject
+ {
+ cpPluginsObject(
+ ExtractPathFromMinimumSpanningTree,
+ cpPlugins::Pipeline::ProcessObject,
+ fpaImageAlgorithms
+ );
+
+ protected:
+ template< class _TMST >
+ inline void _GD0( _TMST* mst );
+ };
+
+} // ecapseman
+
+#endif // __fpaPlugins_ImageAlgorithms__ExtractPathFromMinimumSpanningTree__h__
+
+// eof - $RCSfile$
-#include <ImageAlgorithms/FastMarching.h>
+#include "FastMarching.h"
+#include <cpPlugins/Pipeline/Functor.h>
#include <cpInstances/DataObjects/Image.h>
#include <fpa/Image/FastMarching.h>
// -------------------------------------------------------------------------
-fpaPluginsImageAlgorithms::FastMarching::
+fpaPlugins_ImageAlgorithms::FastMarching::
FastMarching( )
: Superclass( )
{
- typedef cpPlugins::Pipeline::DataObject _TData;
- typedef cpInstances::DataObjects::Image _TMST;
+ typedef cpPlugins::Pipeline::DataObject _TFunctor;
- this->_ConfigureInput< _TData >( "VertexFunction", false, false );
- this->_ConfigureInput< _TData >( "ConversionFunction", false, false );
- this->_ConfigureOutput< _TMST >( "MST" );
+ this->_ConfigureInput< _TFunctor >( "VertexFunction", false, false );
+ this->_ConfigureInput< _TFunctor >( "ConversionFunction", false, false );
std::vector< std::string > choices;
choices.push_back( "float" );
}
// -------------------------------------------------------------------------
-fpaPluginsImageAlgorithms::FastMarching::
+fpaPlugins_ImageAlgorithms::FastMarching::
~FastMarching( )
{
}
// -------------------------------------------------------------------------
-void fpaPluginsImageAlgorithms::FastMarching::
+void fpaPlugins_ImageAlgorithms::FastMarching::
_GenerateData( )
{
auto o = this->GetInputData( "Input" );
// -------------------------------------------------------------------------
template< class _TImage >
-void fpaPluginsImageAlgorithms::FastMarching::
+void fpaPlugins_ImageAlgorithms::FastMarching::
_GD0( _TImage* image )
{
typedef itk::Image< float, _TImage::ImageDimension > _TFloat;
// -------------------------------------------------------------------------
template< class _TInputImage, class _TOutputImage >
-void fpaPluginsImageAlgorithms::FastMarching::
+void fpaPlugins_ImageAlgorithms::FastMarching::
_GD1( _TInputImage* image )
{
+ typedef cpPlugins::Pipeline::Functor _TFunctor;
typedef fpa::Image::FastMarching< _TInputImage, _TOutputImage > _TFilter;
typedef typename _TFilter::TConversionFunction _TConversionFunction;
typedef typename _TFilter::TVertexFunction _TVertexFunction;
+ // Create filter
auto filter = this->_CreateITK< _TFilter >( );
std::vector< typename _TInputImage::IndexType > seeds;
this->_ConfigureFilter( filter, image, seeds );
+
+ // Instantiate functors
+ auto cost_conversion = this->GetInputData< _TFunctor >( "ConversionFunction" );
+ if( cost_conversion != NULL )
+ {
+ cost_conversion->Instantiate( filter );
+ auto cost_conversion_functor = cost_conversion->GetFunctor< _TConversionFunction >( );
+ if( cost_conversion_functor != NULL )
+ filter->SetConversionFunction( cost_conversion_functor );
+
+ } // fi
+
+ auto vertex = this->GetInputData< _TFunctor >( "VertexFunction" );
+ if( vertex != NULL )
+ {
+ vertex->Instantiate( filter );
+ auto vertex_functor = vertex->GetFunctor< _TVertexFunction >( );
+ if( vertex_functor != NULL )
+ filter->SetVertexFunction( vertex_functor );
+
+ } // fi
+
+ // Finish filter's configuration
filter->ClearSeeds( );
for( auto seed : seeds )
filter->AddSeed( seed, ( typename _TOutputImage::PixelType )( 0 ) );
filter->Update( );
this->GetOutput( "Output" )->SetITK( filter->GetOutput( ) );
-
- /* TODO
- auto filter = this->_CreateITK< _TFilter >( );
- this->_ConfigureFilter( filter, image );
- auto cost = this->GetInputData< _TCost >( "Cost" );
- auto conv = this->GetInputData< _TCostConversion >( "CostConversion" );
- if( cost != NULL )
- filter->SetCostFunction( cost );
- if( conv != NULL )
- filter->SetCostConversionFunction( conv );
- filter->Update( );
- this->GetOutput( "Output" )->SetITK( filter->GetOutput( ) );
- this->GetOutput( "MST" )->SetITK( filter->GetMinimumSpanningTree( ) );
- */
}
// eof - $RCSfile$
-#ifndef __fpaPluginsImageAlgorithms__FastMarching__h__
-#define __fpaPluginsImageAlgorithms__FastMarching__h__
+#ifndef __fpaPlugins_ImageAlgorithms__FastMarching__h__
+#define __fpaPlugins_ImageAlgorithms__FastMarching__h__
#include <ImageAlgorithms/BaseFilter.h>
-namespace fpaPluginsImageAlgorithms
+namespace fpaPlugins_ImageAlgorithms
{
/**
*/
- class fpaPluginsImageAlgorithms_EXPORT FastMarching
+ class fpaPlugins_ImageAlgorithms_EXPORT FastMarching
: public BaseFilter
{
cpPluginsObject( FastMarching, BaseFilter, fpaImageAlgorithms );
template< class _TImage >
inline void _GD0( _TImage* image );
- template< class _TInputImage, class _TOutputPixel >
+ template< class _TInputImage, class _TOutputImage >
inline void _GD1( _TInputImage* image );
};
} // ecapseman
-#endif // __fpaPluginsImageAlgorithms__FastMarching__h__
+#endif // __fpaPlugins_ImageAlgorithms__FastMarching__h__
// eof - $RCSfile$
+++ /dev/null
-#include <ImageAlgorithms/MoriRegionGrow.h>
-#include <cpInstances/DataObjects/Image.h>
-
-#include <fpa/Image/MoriRegionGrow.h>
-
-// -------------------------------------------------------------------------
-fpaPluginsImageAlgorithms::MoriRegionGrow::
-MoriRegionGrow( )
- : Superclass( )
-{
- typedef cpPlugins::Pipeline::DataObject _TData;
- typedef cpInstances::DataObjects::Image _TImage;
-
- this->_ConfigureInput< _TImage >( "Input", true, false );
- this->_ConfigureInput< _TData >( "Seed", true, false );
- this->_ConfigureOutput< _TImage >( "Output" );
- this->_ConfigureOutput< _TImage >( "AuxiliaryOutput" );
-
- this->m_Parameters.ConfigureAsInt( "InsideValue", 1 );
- this->m_Parameters.ConfigureAsInt( "OutsideValue", 0 );
- this->m_Parameters.ConfigureAsReal( "Step", 1 );
- this->m_Parameters.ConfigureAsReal( "Lower", 0 );
- this->m_Parameters.ConfigureAsReal( "Upper", 1 );
- this->m_Parameters.ConfigureAsIntTypesChoices( "ResultType" );
-}
-
-// -------------------------------------------------------------------------
-fpaPluginsImageAlgorithms::MoriRegionGrow::
-~MoriRegionGrow( )
-{
-}
-
-// -------------------------------------------------------------------------
-void fpaPluginsImageAlgorithms::MoriRegionGrow::
-_GenerateData( )
-{
- auto o = this->GetInputData( "Input" );
- cpPlugins_Demangle_Image_ScalarPixels_AllDims_1( o, _GD0 )
- this->_Error( "Invalid input image." );
-}
-
-// -------------------------------------------------------------------------
-template< class _TImage >
-void fpaPluginsImageAlgorithms::MoriRegionGrow::
-_GD0( _TImage* image )
-{
- auto rtype = this->m_Parameters.GetSelectedChoice( "ResultType" );
- if( rtype == "char" ) this->_GD1< _TImage, char >( image );
- else if( rtype == "uchar" ) this->_GD1< _TImage, unsigned char >( image );
- else if( rtype == "short" ) this->_GD1< _TImage, short >( image );
- else if( rtype == "ushort" ) this->_GD1< _TImage, unsigned short >( image );
- else if( rtype == "int" ) this->_GD1< _TImage, int >( image );
- else if( rtype == "uint" ) this->_GD1< _TImage, unsigned int >( image );
- else if( rtype == "long" ) this->_GD1< _TImage, long >( image );
- else if( rtype == "ulong" ) this->_GD1< _TImage, unsigned long >( image );
- else this->_GD1< _TImage, char >( image );
-}
-
-// -------------------------------------------------------------------------
-template< class _TInputImage, class _TOutputPixel >
-void fpaPluginsImageAlgorithms::MoriRegionGrow::
-_GD1( _TInputImage* image )
-{
- /* TODO
- typedef
- itk::Image< _TOutputPixel, _TInputImage::ImageDimension >
- _TOutputImage;
- typedef fpa::Image::MoriRegionGrow< _TInputImage, _TOutputImage > _TFilter;
-
- auto filter = this->_CreateITK< _TFilter >( );
- filter->SetInput( image );
- filter->SetInsideValue( this->m_Parameters.GetInt( "InsideValue" ) );
- filter->SetOutsideValue( this->m_Parameters.GetInt( "OutsideValue" ) );
- filter->SetStep( this->m_Parameters.GetReal( "Step" ) );
- filter->SetLower( this->m_Parameters.GetReal( "Lower" ) );
- filter->SetUpper( this->m_Parameters.GetReal( "Upper" ) );
-
- // Assign seed
- auto seeds = this->GetInputData< vtkPolyData >( "Seed" );
- if( seeds != NULL )
- {
- typename _TInputImage::PointType pnt;
- typename _TInputImage::IndexType idx;
- unsigned int dim =
- ( _TInputImage::ImageDimension < 3 )? _TInputImage::ImageDimension: 3;
- if( seeds->GetNumberOfPoints( ) > 0 )
- {
- double buf[ 3 ];
- seeds->GetPoint( 0, buf );
- pnt.Fill( 0 );
- for( unsigned int d = 0; d < dim; ++d )
- pnt[ d ] = buf[ d ];
-
- if( image->TransformPhysicalPointToIndex( pnt, idx ) )
- filter->SetSeed( idx );
- }
- else
- this->_Error( "No given seeds." );
- }
- else
- this->_Error( "No given seeds." );
-
- filter->Update( );
- this->GetOutput( "Output" )->SetITK( filter->GetOutput( ) );
- this->GetOutput( "AuxiliaryOutput" )->SetITK( filter->GetAuxiliaryImage( ) );
- */
-}
-
-// eof - $RCSfile$
+++ /dev/null
-#ifndef __fpaPluginsImageAlgorithms__MoriRegionGrow__h__
-#define __fpaPluginsImageAlgorithms__MoriRegionGrow__h__
-
-#include <ImageAlgorithms/BaseFilter.h>
-
-namespace fpaPluginsImageAlgorithms
-{
- /**
- */
- class fpaPluginsImageAlgorithms_EXPORT MoriRegionGrow
- : public cpPlugins::Pipeline::ProcessObject
- {
- cpPluginsObject(
- MoriRegionGrow, cpPlugins::Pipeline::ProcessObject, fpaImageAlgorithms
- );
-
- protected:
- template< class _TImage >
- inline void _GD0( _TImage* image );
-
- template< class _TInputImage, class _TOutputPixel >
- inline void _GD1( _TInputImage* image );
- };
-
-} // ecapseman
-
-#endif // __fpaPluginsImageAlgorithms__MoriRegionGrow__h__
-
-// eof - $RCSfile$
-#include <ImageAlgorithms/RegionGrow.h>
+#include "RegionGrow.h"
+#include <cpPlugins/Pipeline/Functor.h>
#include <cpInstances/DataObjects/Image.h>
#include <fpa/Image/RegionGrow.h>
// -------------------------------------------------------------------------
-fpaPluginsImageAlgorithms::RegionGrow::
+fpaPlugins_ImageAlgorithms::RegionGrow::
RegionGrow( )
: Superclass( )
{
- typedef cpPlugins::Pipeline::DataObject _TData;
+ typedef cpPlugins::Pipeline::DataObject _TFunctor;
+ typedef cpInstances::DataObjects::Image _TMST;
- this->_ConfigureInput< _TData >( "GrowFunction", true, false );
+ this->_ConfigureInput< _TFunctor >( "GrowFunction", true, false );
this->m_Parameters.ConfigureAsInt( "InsideValue", 1 );
this->m_Parameters.ConfigureAsInt( "OutsideValue", 0 );
this->m_Parameters.ConfigureAsIntTypesChoices( "ResultType" );
}
// -------------------------------------------------------------------------
-fpaPluginsImageAlgorithms::RegionGrow::
+fpaPlugins_ImageAlgorithms::RegionGrow::
~RegionGrow( )
{
}
// -------------------------------------------------------------------------
-void fpaPluginsImageAlgorithms::RegionGrow::
+void fpaPlugins_ImageAlgorithms::RegionGrow::
_GenerateData( )
{
auto o = this->GetInputData( "Input" );
// -------------------------------------------------------------------------
template< class _TImage >
-void fpaPluginsImageAlgorithms::RegionGrow::
+void fpaPlugins_ImageAlgorithms::RegionGrow::
_GD0( _TImage* image )
{
auto rtype = this->m_Parameters.GetSelectedChoice( "ResultType" );
// -------------------------------------------------------------------------
template< class _TInputImage, class _TOutputPixel >
-void fpaPluginsImageAlgorithms::RegionGrow::
+void fpaPlugins_ImageAlgorithms::RegionGrow::
_GD1( _TInputImage* image )
{
- typedef
- itk::Image< _TOutputPixel, _TInputImage::ImageDimension >
- _TOutputImage;
+ typedef cpPlugins::Pipeline::Functor _TFunctor;
+ typedef itk::Image< _TOutputPixel, _TInputImage::ImageDimension > _TOutputImage;
typedef fpa::Image::RegionGrow< _TInputImage, _TOutputImage > _TFilter;
- typedef typename _TFilter::TGrowFunction _TGrow;
-
- _TOutputPixel i_val = _TOutputPixel( this->m_Parameters.GetInt( "InsideValue" ) );
- _TOutputPixel o_val = _TOutputPixel( this->m_Parameters.GetInt( "OutsideValue" ) );
+ typedef typename _TFilter::TGrowFunction _TGrowFunction;
+ // Create filter
auto filter = this->_CreateITK< _TFilter >( );
std::vector< typename _TInputImage::IndexType > seeds;
this->_ConfigureFilter( filter, image, seeds );
+
+ // Instantiate functors
+ auto growfunc = this->GetInputData< _TFunctor >( "GrowFunction" );
+ if( growfunc != NULL )
+ {
+ growfunc->Instantiate( filter );
+ auto growfunc_functor = growfunc->GetFunctor< _TGrowFunction >( );
+ if( growfunc_functor != NULL )
+ filter->SetGrowFunction( growfunc_functor );
+
+ } // fi
+
+ // Finish filter's configuration
filter->ClearSeeds( );
for( auto seed : seeds )
- filter->AddSeed( seed, i_val );
- filter->SetGrowFunction( this->GetInputData< _TGrow >( "GrowFunction" ) );
- filter->SetInsideValue( i_val );
- filter->SetOutsideValue( o_val );
+ filter->AddSeed( seed, ( typename _TOutputImage::PixelType )( 0 ) );
filter->Update( );
this->GetOutput( "Output" )->SetITK( filter->GetOutput( ) );
}
-#ifndef __fpaPluginsImageAlgorithms__RegionGrow__h__
-#define __fpaPluginsImageAlgorithms__RegionGrow__h__
+#ifndef __fpaPlugins_ImageAlgorithms__RegionGrow__h__
+#define __fpaPlugins_ImageAlgorithms__RegionGrow__h__
#include <ImageAlgorithms/BaseFilter.h>
-namespace fpaPluginsImageAlgorithms
+namespace fpaPlugins_ImageAlgorithms
{
/**
*/
- class fpaPluginsImageAlgorithms_EXPORT RegionGrow
+ class fpaPlugins_ImageAlgorithms_EXPORT RegionGrow
: public BaseFilter
{
cpPluginsObject( RegionGrow, BaseFilter, fpaImageAlgorithms );
} // ecapseman
-#endif // __fpaPluginsImageAlgorithms__RegionGrow__h__
+#endif // __fpaPlugins_ImageAlgorithms__RegionGrow__h__
// eof - $RCSfile$
+++ /dev/null
-#include <ImageAlgorithms/SkeletonFilter.h>
-#include <cpInstances/DataObjects/Image.h>
-#include <cpInstances/DataObjects/Skeleton.h>
-
-#include <itkImage.h>
-
-/* TODO
- #include <fpa/Image/SkeletonFilter.h>
- #include <vtkPolyData.h>
-*/
-
-// -------------------------------------------------------------------------
-fpaPluginsImageAlgorithms::SkeletonFilter::
-SkeletonFilter( )
- : Superclass( )
-{
- typedef cpInstances::DataObjects::Image _TImage;
- typedef cpInstances::DataObjects::Skeleton _TSkeleton;
- typedef cpPlugins::Pipeline::DataObject _TData;
-
- this->_ConfigureInput< _TImage >( "Input", true, false );
- this->_ConfigureInput< _TData >( "Seeds", true, false );
- this->_ConfigureOutput< _TSkeleton >( "Skeleton" );
- this->_ConfigureOutput< _TImage >( "Marks" );
-}
-
-// -------------------------------------------------------------------------
-fpaPluginsImageAlgorithms::SkeletonFilter::
-~SkeletonFilter( )
-{
-}
-
-// -------------------------------------------------------------------------
-void fpaPluginsImageAlgorithms::SkeletonFilter::
-_GenerateData( )
-{
- auto o = this->GetInputData( "Input" );
- cpPlugins_Demangle_Image_RealPixels_AllDims_1( o, _GD0 )
- this->_Error( "Invalid input image." );
-}
-
-// -------------------------------------------------------------------------
-template< class _TImage >
-void fpaPluginsImageAlgorithms::SkeletonFilter::
-_GD0( _TImage* image )
-{
- /* TODO
- typedef fpa::Image::SkeletonFilter< _TImage > _TFilter;
- auto filter = this->_CreateITK< _TFilter >( );
- filter->SetInput( image );
-
- auto seeds = this->GetInputData< vtkPolyData >( "Seeds" );
- if( seeds != NULL )
- {
- typename _TImage::PointType pnt;
- typename _TImage::IndexType idx;
- unsigned int dim =
- ( _TImage::ImageDimension < 3 )? _TImage::ImageDimension: 3;
-
- for( int i = 0; i < seeds->GetNumberOfPoints( ); ++i )
- {
- double buf[ 3 ];
- seeds->GetPoint( i, buf );
- pnt.Fill( 0 );
- for( unsigned int d = 0; d < dim; ++d )
- pnt[ d ] = buf[ d ];
-
- if( image->TransformPhysicalPointToIndex( pnt, idx ) )
- filter->AddSeed( idx, 0 );
-
- } // rof
-
- } // fi
-
- filter->Update( );
- this->GetOutput( "Skeleton" )->SetITK( filter->GetSkeleton( ) );
- this->GetOutput( "Marks" )->SetITK( filter->GetMarks( ) );
- */
-}
-
-// eof - $RCSfile$
+++ /dev/null
-#ifndef __fpaPluginsImageAlgorithms__SkeletonFilter__h__
-#define __fpaPluginsImageAlgorithms__SkeletonFilter__h__
-
-#include <fpaPluginsImageAlgorithms_Export.h>
-#include <cpPlugins/Pipeline/ProcessObject.h>
-
-namespace fpaPluginsImageAlgorithms
-{
- /**
- */
- class fpaPluginsImageAlgorithms_EXPORT SkeletonFilter
- : public cpPlugins::Pipeline::ProcessObject
- {
- cpPluginsObject(
- SkeletonFilter,
- cpPlugins::Pipeline::ProcessObject,
- fpaImageAlgorithms
- );
-
- protected:
- template< class _TImage >
- inline void _GD0( _TImage* image );
- };
-
-} // ecapseman
-
-#endif // __fpaPluginsImageAlgorithms__SkeletonFilter__h__
-
-// eof - $RCSfile$
--- /dev/null
+#include "BinaryThreshold.h"
+
+#include <cpInstances/DataObjects/Image.h>
+
+#include <itkImage.h>
+#include <fpa/Image/Functors/RegionGrow/BinaryThreshold.h>
+
+// -------------------------------------------------------------------------
+void fpaPlugins_ImageFunctors::BinaryThreshold::
+Instantiate( itk::LightObject* filter )
+{
+ auto itk_filter = dynamic_cast< itk::ProcessObject* >( filter );
+ if( itk_filter != NULL )
+ {
+ auto inputs = itk_filter->GetInputs( );
+ if( inputs.size( ) > 0 )
+ {
+ cpPlugins_Demangle_Image_ScalarPixels_AllDims_2(
+ inputs[ 0 ].GetPointer( ), _GD0, itk_filter
+ )
+ this->_Error( "Invalid input data." );
+ }
+ else
+ this->_Error( "Not enough inputs." );
+ }
+ else
+ this->_Error( "Invalid instantiation filter." );
+}
+
+// -------------------------------------------------------------------------
+fpaPlugins_ImageFunctors::BinaryThreshold::
+BinaryThreshold( )
+ : Superclass( )
+{
+ this->_ConfigureOutput< cpPlugins::Pipeline::DataObject >( "Functor" );
+ this->GetOutput( "Functor" )->SetITK( this );
+ this->m_Parameters.ConfigureAsReal( "Lower", 0 );
+ this->m_Parameters.ConfigureAsReal( "Upper", 1 );
+}
+
+// -------------------------------------------------------------------------
+fpaPlugins_ImageFunctors::BinaryThreshold::
+~BinaryThreshold( )
+{
+}
+
+// -------------------------------------------------------------------------
+void fpaPlugins_ImageFunctors::BinaryThreshold::
+_GenerateData( )
+{
+}
+
+// -------------------------------------------------------------------------
+template< class _TInput >
+void fpaPlugins_ImageFunctors::BinaryThreshold::
+_GD0( _TInput* input, itk::ProcessObject* filter )
+{
+ auto outputs = filter->GetOutputs( );
+ if( outputs.size( ) > 0 )
+ {
+ cpPlugins_Demangle_Image_IntPixels_3(
+ outputs[ 0 ].GetPointer( ), _GD1, _TInput::ImageDimension, input, filter
+ )
+ this->_Error( "Invalid output data." );
+ }
+ else
+ this->_Error( "Not enough outputs." );
+}
+
+// -------------------------------------------------------------------------
+template< class _TInput, class _TOutput >
+void fpaPlugins_ImageFunctors::BinaryThreshold::
+_GD1( _TOutput* output, _TInput* input, itk::ProcessObject* filter )
+{
+ typedef typename _TOutput::PixelType _TValue;
+ typedef fpa::Image::Functors::RegionGrow::BinaryThreshold< _TInput, _TValue > _TFunctor;
+
+ auto f = dynamic_cast< _TFunctor* >( this->m_Functor.GetPointer( ) );
+ if( f == NULL )
+ {
+ typename _TFunctor::Pointer ptr_f = _TFunctor::New( );
+ f = ptr_f.GetPointer( );
+ this->m_Functor = f;
+
+ } // fi
+ f->SetLower( this->m_Parameters.GetReal( "Lower" ) );
+ f->SetUpper( this->m_Parameters.GetReal( "Upper" ) );
+}
+
+// eof - $RCSfile$
--- /dev/null
+#ifndef __fpaPlugins_ImageFunctors__BinaryThreshold__h__
+#define __fpaPlugins_ImageFunctors__BinaryThreshold__h__
+
+#include <itkProcessObject.h>
+#include <fpaPlugins_ImageFunctors_Export.h>
+#include <cpPlugins/Pipeline/Functor.h>
+
+namespace fpaPlugins_ImageFunctors
+{
+ /**
+ */
+ class fpaPlugins_ImageFunctors_EXPORT BinaryThreshold
+ : public cpPlugins::Pipeline::Functor
+ {
+ cpPluginsObject( BinaryThreshold, cpPlugins::Pipeline::Functor, fpaImageFunctors );
+
+ public:
+ virtual void Instantiate( itk::LightObject* filter ) override;
+
+ protected:
+ template< class _TInput >
+ inline void _GD0( _TInput* input, itk::ProcessObject* filter );
+
+ template< class _TInput, class _TOutput >
+ inline void _GD1( _TOutput* output, _TInput* input, itk::ProcessObject* filter );
+ };
+
+} // ecapseman
+
+#endif // __fpaPlugins_ImageFunctors__BinaryThreshold__h__
+
+// eof - $RCSfile$
--- /dev/null
+#include "Tautology.h"
+
+#include <cpInstances/DataObjects/Image.h>
+
+#include <itkImage.h>
+#include <fpa/Base/Functors/RegionGrow/Tautology.h>
+
+// -------------------------------------------------------------------------
+void fpaPlugins_ImageFunctors::Tautology::
+Instantiate( itk::LightObject* filter )
+{
+ auto itk_filter = dynamic_cast< itk::ProcessObject* >( filter );
+ if( itk_filter != NULL )
+ {
+ auto inputs = itk_filter->GetInputs( );
+ if( inputs.size( ) > 0 )
+ {
+ cpPlugins_Demangle_Image_ScalarPixels_AllDims_2(
+ inputs[ 0 ].GetPointer( ), _GD0, itk_filter
+ )
+ this->_Error( "Invalid input data." );
+ }
+ else
+ this->_Error( "Not enough inputs." );
+ }
+ else
+ this->_Error( "Invalid instantiation filter." );
+}
+
+// -------------------------------------------------------------------------
+fpaPlugins_ImageFunctors::Tautology::
+Tautology( )
+ : Superclass( )
+{
+ this->_ConfigureOutput< cpPlugins::Pipeline::DataObject >( "Functor" );
+ this->GetOutput( "Functor" )->SetITK( this );
+}
+
+// -------------------------------------------------------------------------
+fpaPlugins_ImageFunctors::Tautology::
+~Tautology( )
+{
+}
+
+// -------------------------------------------------------------------------
+void fpaPlugins_ImageFunctors::Tautology::
+_GenerateData( )
+{
+}
+
+// -------------------------------------------------------------------------
+template< class _TInput >
+void fpaPlugins_ImageFunctors::Tautology::
+_GD0( _TInput* input, itk::ProcessObject* filter )
+{
+ auto outputs = filter->GetOutputs( );
+ if( outputs.size( ) > 0 )
+ {
+ cpPlugins_Demangle_Image_IntPixels_3(
+ outputs[ 0 ].GetPointer( ), _GD1, _TInput::ImageDimension, input, filter
+ )
+ this->_Error( "Invalid output data." );
+ }
+ else
+ this->_Error( "Not enough outputs." );
+}
+
+// -------------------------------------------------------------------------
+template< class _TInput, class _TOutput >
+void fpaPlugins_ImageFunctors::Tautology::
+_GD1( _TOutput* output, _TInput* input, itk::ProcessObject* filter )
+{
+ typedef typename _TInput::IndexType _TVertex;
+ typedef typename _TOutput::PixelType _TValue;
+ typedef fpa::Base::Functors::RegionGrow::Tautology< _TVertex, _TValue > _TFunctor;
+
+ auto f = dynamic_cast< _TFunctor* >( this->m_Functor.GetPointer( ) );
+ if( f == NULL )
+ {
+ typename _TFunctor::Pointer ptr_f = _TFunctor::New( );
+ f = ptr_f.GetPointer( );
+ this->m_Functor = f;
+
+ } // fi
+}
+
+// eof - $RCSfile$
--- /dev/null
+#ifndef __fpaPlugins_ImageFunctors__Tautology__h__
+#define __fpaPlugins_ImageFunctors__Tautology__h__
+
+#include <itkProcessObject.h>
+#include <fpaPlugins_ImageFunctors_Export.h>
+#include <cpPlugins/Pipeline/Functor.h>
+
+namespace fpaPlugins_ImageFunctors
+{
+ /**
+ */
+ class fpaPlugins_ImageFunctors_EXPORT Tautology
+ : public cpPlugins::Pipeline::Functor
+ {
+ cpPluginsObject( Tautology, cpPlugins::Pipeline::Functor, fpaImageFunctors );
+
+ public:
+ virtual void Instantiate( itk::LightObject* filter ) override;
+
+ protected:
+ template< class _TInput >
+ inline void _GD0( _TInput* input, itk::ProcessObject* filter );
+
+ template< class _TInput, class _TOutput >
+ inline void _GD1( _TOutput* output, _TInput* input, itk::ProcessObject* filter );
+ };
+
+} // ecapseman
+
+#endif // __fpaPlugins_ImageFunctors__Tautology__h__
+
+// eof - $RCSfile$
--- /dev/null
+#include "VertexCost.h"
+
+#include <cpInstances/DataObjects/Image.h>
+
+#include <itkImage.h>
+#include <fpa/Image/Functors/VertexCost.h>
+
+// -------------------------------------------------------------------------
+void fpaPlugins_ImageFunctors::VertexCost::
+Instantiate( itk::LightObject* filter )
+{
+ auto itk_filter = dynamic_cast< itk::ProcessObject* >( filter );
+ if( itk_filter != NULL )
+ {
+ auto inputs = itk_filter->GetInputs( );
+ if( inputs.size( ) > 0 )
+ {
+ cpPlugins_Demangle_Image_ScalarPixels_AllDims_2(
+ inputs[ 0 ].GetPointer( ), _GD0, itk_filter
+ )
+ this->_Error( "Invalid input data." );
+ }
+ else
+ this->_Error( "Not enough inputs." );
+ }
+ else
+ this->_Error( "Invalid instantiation filter." );
+}
+
+// -------------------------------------------------------------------------
+fpaPlugins_ImageFunctors::VertexCost::
+VertexCost( )
+ : Superclass( )
+{
+ this->_ConfigureOutput< cpPlugins::Pipeline::DataObject >( "Functor" );
+ this->m_Parameters.ConfigureAsBool( "UseImageSpacing", false );
+ this->GetOutput( "Functor" )->SetITK( this );
+}
+
+// -------------------------------------------------------------------------
+fpaPlugins_ImageFunctors::VertexCost::
+~VertexCost( )
+{
+}
+
+// -------------------------------------------------------------------------
+void fpaPlugins_ImageFunctors::VertexCost::
+_GenerateData( )
+{
+}
+
+// -------------------------------------------------------------------------
+template< class _TInput >
+void fpaPlugins_ImageFunctors::VertexCost::
+_GD0( _TInput* input, itk::ProcessObject* filter )
+{
+ auto outputs = filter->GetOutputs( );
+ if( outputs.size( ) > 0 )
+ {
+ cpPlugins_Demangle_Image_ScalarPixels_3(
+ outputs[ 0 ].GetPointer( ), _GD1, _TInput::ImageDimension, input, filter
+ )
+ this->_Error( "Invalid output data." );
+ }
+ else
+ this->_Error( "Not enough outputs." );
+}
+
+// -------------------------------------------------------------------------
+template< class _TInput, class _TOutput >
+void fpaPlugins_ImageFunctors::VertexCost::
+_GD1( _TOutput* output, _TInput* input, itk::ProcessObject* filter )
+{
+ typedef typename _TInput::PixelType _TIValue;
+ typedef typename _TOutput::PixelType _TOValue;
+ typedef fpa::Image::Functors::VertexCost< _TInput, _TOValue > _TFunctor;
+
+ auto f = dynamic_cast< _TFunctor* >( this->m_Functor.GetPointer( ) );
+ if( f == NULL )
+ {
+ typename _TFunctor::Pointer ptr_f = _TFunctor::New( );
+ f = ptr_f.GetPointer( );
+ this->m_Functor = f;
+
+ } // fi
+ f->SetUseImageSpacing( this->m_Parameters.GetReal( "UseImageSpacing" ) );
+}
+
+// eof - $RCSfile$
--- /dev/null
+#ifndef __fpaPlugins_ImageFunctors__VertexCost__h__
+#define __fpaPlugins_ImageFunctors__VertexCost__h__
+
+#include <itkProcessObject.h>
+#include <fpaPlugins_ImageFunctors_Export.h>
+#include <cpPlugins/Pipeline/Functor.h>
+
+namespace fpaPlugins_ImageFunctors
+{
+ /**
+ */
+ class fpaPlugins_ImageFunctors_EXPORT VertexCost
+ : public cpPlugins::Pipeline::Functor
+ {
+ cpPluginsObject( VertexCost, cpPlugins::Pipeline::Functor, fpaImageFunctors );
+
+ public:
+ virtual void Instantiate( itk::LightObject* filter ) override;
+
+ protected:
+ template< class _TInput >
+ inline void _GD0( _TInput* input, itk::ProcessObject* filter );
+
+ template< class _TInput, class _TOutput >
+ inline void _GD1( _TOutput* output, _TInput* input, itk::ProcessObject* filter );
+ };
+
+} // ecapseman
+
+#endif // __fpaPlugins_ImageFunctors__VertexCost__h__
+
+// eof - $RCSfile$