IF(BUILD_EXAMPLES)
SUBDIRS(
examples
+ ## fpaLab
)
ENDIF(BUILD_EXAMPLES)
protected:
RegionGrowThresholdFunction( )
- : Superclass( ),
- m_LowerThreshold( itk::NumericTraits< TPixel >::min( ) ),
- m_UpperThreshold( itk::NumericTraits< TPixel >::max( ) )
- { }
+ : Superclass( )
+ {
+ itk::NumericTraits< TPixel >::min( this->m_LowerThreshold );
+ itk::NumericTraits< TPixel >::max( this->m_UpperThreshold );
+ }
virtual ~RegionGrowThresholdFunction( )
{ }
--- /dev/null
+#include "AllPixelsImageGrowFunctionSource.h"
+
+#include <cpPlugins/Interface/BaseProcessObjects.h>
+#include <cpPlugins/Interface/Image.h>
+#include <fpaPlugins/GrowFunction.h>
+#include <fpa/Image/Functors/RegionGrowAllBelongsFunction.h>
+
+// -------------------------------------------------------------------------
+fpaPlugins::AllPixelsImageGrowFunctionSource::
+AllPixelsImageGrowFunctionSource( )
+ : Superclass( )
+{
+ this->_AddInput( "ReferenceImage" );
+ this->_MakeOutput< GrowFunction >( "Output" );
+}
+
+// -------------------------------------------------------------------------
+fpaPlugins::AllPixelsImageGrowFunctionSource::
+~AllPixelsImageGrowFunctionSource( )
+{
+}
+
+// -------------------------------------------------------------------------
+std::string fpaPlugins::AllPixelsImageGrowFunctionSource::
+_GenerateData( )
+{
+ cpPlugins::Interface::Image* image =
+ this->GetInput< cpPlugins::Interface::Image >( "ReferenceImage" );
+ if( image == NULL )
+ return( "fpaPlugins::AllPixelsImageGrowFunctionSource: No input reference image." );
+
+ itk::DataObject* itk_image = NULL;
+ std::string r = "";
+ cpPlugins_Image_Demangle_AllScalarTypes( 2, image, itk_image, r, _GD0 );
+ else cpPlugins_Image_Demangle_AllScalarTypes( 3, image, itk_image, r, _GD0 );
+ else r = "fpaPlugins::AllPixelsImageGrowFunctionSource: no valid reference image.";
+
+ return( r );
+}
+
+// -------------------------------------------------------------------------
+template< class I >
+std::string fpaPlugins::AllPixelsImageGrowFunctionSource::
+_GD0( itk::DataObject* data )
+{
+ typedef fpa::Image::Functors::RegionGrowAllBelongsFunction< I > _F;
+ typename _F::Pointer functor = _F::New( );
+
+ // Connect output
+ GrowFunction* out = this->GetOutput< GrowFunction >( "Output" );
+ if( out != NULL )
+ {
+ out->SetITK< _F >( functor );
+ return( "" );
+ }
+ else
+ return( "fpaPlugins::AllPixelsImageGrowFunctionSource: output not correctly created." );
+}
+
+// eof - $RCSfile$
--- /dev/null
+#ifndef __FPAPLUGINS__ALLPIXELSIMAGEGROWFUNCTIONSOURCE__H__
+#define __FPAPLUGINS__ALLPIXELSIMAGEGROWFUNCTIONSOURCE__H__
+
+#include <fpaPlugins/fpaPlugins_Export.h>
+#include <cpPlugins/Interface/ProcessObject.h>
+
+namespace fpaPlugins
+{
+ /**
+ */
+ class fpaPlugins_EXPORT AllPixelsImageGrowFunctionSource
+ : public cpPlugins::Interface::ProcessObject
+ {
+ public:
+ typedef AllPixelsImageGrowFunctionSource Self;
+ typedef cpPlugins::Interface::ProcessObject Superclass;
+ typedef itk::SmartPointer< Self > Pointer;
+ typedef itk::SmartPointer< const Self > ConstPointer;
+
+ public:
+ itkNewMacro( Self );
+ itkTypeMacro(
+ AllPixelsImageGrowFunctionSource, cpPlugins::Interface::ProcessObject
+ );
+ cpPlugins_Id_Macro(
+ AllPixelsImageGrowFunctionSource, FrontPropagationFunctors
+ );
+
+ protected:
+ AllPixelsImageGrowFunctionSource( );
+ virtual ~AllPixelsImageGrowFunctionSource( );
+
+ virtual std::string _GenerateData( );
+
+ template< class I >
+ std::string _GD0( itk::DataObject* data );
+
+ private:
+ // Purposely not implemented.
+ AllPixelsImageGrowFunctionSource( const Self& other );
+ Self& operator=( const Self& other );
+ };
+
+ // ---------------------------------------------------------------------
+ CPPLUGINS_INHERIT_PROVIDER( AllPixelsImageGrowFunctionSource );
+
+} // ecapseman
+
+#endif // __FPAPLUGINS__ALLPIXELSIMAGEGROWFUNCTIONSOURCE__H__
+
+// eof - $RCSfile$
## = Source code =
## ===============
-FILE(GLOB LIB_HEADERS_H "*.h")
-FILE(GLOB LIB_HEADERS_HPP "*.hpp")
-FILE(GLOB LIB_HEADERS_HXX "*.hxx")
-FILE(GLOB LIB_SOURCES_C "*.c")
-FILE(GLOB LIB_SOURCES_CPP "*.cpp")
-FILE(GLOB LIB_SOURCES_CXX "*.cxx")
+SET(
+ data_LIB_HEADERS
+ GrowFunction.h
+ GrowFunction.hxx
+ )
+SET(
+ filters_LIB_HEADERS
+ AllPixelsImageGrowFunctionSource.h
+ ThresholdImageGrowFunctionSource.h
+ ImageRegionGrow.h
+ )
+SET(
+ data_LIB_SOURCES
+ GrowFunction.cxx
+ )
+SET(
+ filters_LIB_SOURCES
+ AllPixelsImageGrowFunctionSource.cxx
+ ThresholdImageGrowFunctionSource.cxx
+ ImageRegionGrow.cxx
+ )
+INCLUDE_DIRECTORIES(
+ ${PROJECT_SOURCE_DIR}/lib/fpaPlugins
+ ${PROJECT_BINARY_DIR}/lib/fpaPlugins
+ )
## =====================
## = Compilation rules =
ADD_CUSTOM_COMMAND(
OUTPUT ${LIBRARY_NAME}_Host.cxx
- DEPENDS ${cpPlugins_createHost_APP} ${LIB_HEADERS_H}
- COMMAND ${cpPlugins_createHost_APP} ${LIBRARY_NAME}_Host.cxx fpaPlugins ${LIB_HEADERS_H}
+ DEPENDS ${cpPlugins_createHost_APP} ${filters_LIB_HEADERS}
+ COMMAND ${cpPlugins_createHost_APP} ${LIBRARY_NAME}_Host.cxx fpaPlugins ${filters_LIB_HEADERS}
)
ADD_LIBRARY(
${LIBRARY_NAME}
SHARED
${LIBRARY_NAME}_Host.cxx
- ${LIB_SOURCES_C}
- ${LIB_SOURCES_CPP}
- ${LIB_SOURCES_CXX}
+ ${data_LIB_SOURCES}
+ ${filters_LIB_SOURCES}
)
GENERATE_EXPORT_HEADER(
${LIBRARY_NAME}
--- /dev/null
+#include <fpaPlugins/GrowFunction.h>
+
+// -------------------------------------------------------------------------
+fpaPlugins::GrowFunction::
+GrowFunction( )
+ : Superclass( )
+{
+}
+
+// -------------------------------------------------------------------------
+fpaPlugins::GrowFunction::
+~GrowFunction( )
+{
+}
+
+// eof - $RCSfile$
--- /dev/null
+#ifndef __FPAPLUGINS__GROWFUNCTION__H__
+#define __FPAPLUGINS__GROWFUNCTION__H__
+
+#include <cpPlugins/Interface/DataObject.h>
+
+#include <itkProcessObject.h>
+
+// -------------------------------------------------------------------------
+namespace fpaPlugins
+{
+ /**
+ */
+ class cpPlugins_Interface_EXPORT GrowFunction
+ : public cpPlugins::Interface::DataObject
+ {
+ public:
+ typedef GrowFunction Self;
+ typedef cpPlugins::Interface::DataObject Superclass;
+ typedef itk::SmartPointer< Self > Pointer;
+ typedef itk::SmartPointer< const Self > ConstPointer;
+
+ public:
+ itkNewMacro( Self );
+ itkTypeMacro( GrowFunction, cpPlugins::Interface::DataObject );
+ cpPlugins_Id_Macro( GrowFunction, GrowFunction );
+
+ public:
+ template< class F >
+ inline void SetITK( itk::Object* object );
+
+ protected:
+ GrowFunction( );
+ virtual ~GrowFunction( );
+
+ private:
+ // Purposely not implemented
+ GrowFunction( const Self& );
+ Self& operator=( const Self& );
+ };
+
+} // ecapseman
+
+#include <fpaPlugins/GrowFunction.hxx>
+
+#endif // __FPAPLUGINS__GROWFUNCTION__H__
+
+// eof - $RCSfile$
--- /dev/null
+#ifndef __FPAPLUGINS__GROWFUNCTION__HXX__
+#define __FPAPLUGINS__GROWFUNCTION__HXX__
+
+#include <itkFunctionBase.h>
+
+// -------------------------------------------------------------------------
+template< class F >
+void fpaPlugins::GrowFunction::
+SetITK( itk::Object* object )
+{
+ typedef typename F::TSpace _TSpace;
+ typedef typename F::TVertex _TVertex;
+ typedef itk::FunctionBase< _TVertex, bool > _TBaseFunction;
+
+ _TBaseFunction* function = dynamic_cast< _TBaseFunction* >( object );
+ if( function != NULL )
+ {
+ this->m_ITKObject = function;
+ this->m_VTKObject = NULL;
+ this->Modified( );
+
+ } // fi
+}
+
+#endif // __FPAPLUGINS__GROWFUNCTION__HXX__
+
+// eof - $RCSfile$
this->_AddInput( "GrowFunction" );
this->_MakeOutput< cpPlugins::Interface::Image >( "Output" );
- this->m_Parameters->ConfigureAsBool( "VisualDebug", false );
- this->m_Parameters->ConfigureAsBool( "StopAtOneFront", false );
- this->m_Parameters->ConfigureAsReal( "InsideValue", 1 );
- this->m_Parameters->ConfigureAsReal( "OutsideValue", 0 );
+ this->m_Parameters->ConfigureAsBool( "VisualDebug" );
+ this->m_Parameters->ConfigureAsBool( "StopAtOneFront" );
+ this->m_Parameters->ConfigureAsReal( "InsideValue" );
+ this->m_Parameters->ConfigureAsReal( "OutsideValue" );
this->m_Parameters->ConfigureAsPointList( "Seeds" );
+ this->m_Parameters->SetBool( "VisualDebug", false );
+ this->m_Parameters->SetBool( "StopAtOneFront", false );
+ this->m_Parameters->SetReal( "InsideValue", 1 );
+ this->m_Parameters->SetReal( "OutsideValue", 0 );
+
std::vector< std::string > orders;
orders.push_back( "1" );
orders.push_back( "2" );
typedef itk::Image< _TOutPixel, I::ImageDimension > _TOut;
typedef fpa::Image::RegionGrow< I, _TOut > _TFilter;
typedef typename _TFilter::TGrowingFunction _TFunctor;
+ typedef typename I::PointType _TPoint;
I* image = dynamic_cast< I* >( data );
filter->SetOutsideValue( _TOutPixel( params->GetReal( "OutsideValue" ) ) );
// Assign seeds
- std::vector< typename I::PointType > seeds;
- params->GetPointList( seeds, "Seeds", I::ImageDimension );
+ std::vector< _TPoint > seeds =
+ params->GetPointList< _TPoint >( "Seeds", I::ImageDimension );
for( auto sIt = seeds.begin( ); sIt != seeds.end( ); ++sIt )
{
typename I::IndexType idx;
ImageRegionGrow, cpPlugins::Interface::ImageToImageFilter
);
cpPlugins_Id_Macro(
- fpaPlugins::ImageRegionGrow, "FrontPropagationImageAlgorithms"
+ ImageRegionGrow, FrontPropagationImageAlgorithm
);
protected:
--- /dev/null
+#include "ThresholdImageGrowFunctionSource.h"
+
+#include <cpPlugins/Interface/BaseProcessObjects.h>
+#include <cpPlugins/Interface/Image.h>
+#include <fpaPlugins/GrowFunction.h>
+#include <fpa/Image/Functors/RegionGrowThresholdFunction.h>
+
+// -------------------------------------------------------------------------
+fpaPlugins::ThresholdImageGrowFunctionSource::
+ThresholdImageGrowFunctionSource( )
+ : Superclass( )
+{
+ this->_AddInput( "ReferenceImage" );
+ this->_MakeOutput< GrowFunction >( "Output" );
+
+ this->m_Parameters->ConfigureAsReal( "LowerThreshold" );
+ this->m_Parameters->ConfigureAsReal( "UpperThreshold" );
+
+ this->m_Parameters->SetReal( "LowerThreshold", 0 );
+ this->m_Parameters->SetReal( "UpperThreshold", 0 );
+}
+
+// -------------------------------------------------------------------------
+fpaPlugins::ThresholdImageGrowFunctionSource::
+~ThresholdImageGrowFunctionSource( )
+{
+}
+
+// -------------------------------------------------------------------------
+std::string fpaPlugins::ThresholdImageGrowFunctionSource::
+_GenerateData( )
+{
+ cpPlugins::Interface::Image* image =
+ this->GetInput< cpPlugins::Interface::Image >( "ReferenceImage" );
+ if( image == NULL )
+ return( "fpaPlugins::ThresholdImageGrowFunctionSource: No input reference image." );
+
+ itk::DataObject* itk_image = NULL;
+ std::string r = "";
+ cpPlugins_Image_Demangle_AllScalarTypes( 2, image, itk_image, r, _GD0 );
+ else cpPlugins_Image_Demangle_AllScalarTypes( 3, image, itk_image, r, _GD0 );
+ else r = "fpaPlugins::ThresholdImageGrowFunctionSource: no valid reference image.";
+
+ return( r );
+}
+
+// -------------------------------------------------------------------------
+template< class I >
+std::string fpaPlugins::ThresholdImageGrowFunctionSource::
+_GD0( itk::DataObject* data )
+{
+ typedef fpa::Image::Functors::RegionGrowThresholdFunction< I > _F;
+ typename _F::Pointer functor = _F::New( );
+
+ // Connect output
+ GrowFunction* out = this->GetOutput< GrowFunction >( "Output" );
+ if( out != NULL )
+ {
+ out->SetITK< _F >( functor );
+ return( "" );
+ }
+ else
+ return( "fpaPlugins::ThresholdImageGrowFunctionSource: output not correctly created." );
+}
+
+// eof - $RCSfile$
--- /dev/null
+#ifndef __FPAPLUGINS__THRESHOLDIMAGEGROWFUNCTIONSOURCE__H__
+#define __FPAPLUGINS__THRESHOLDIMAGEGROWFUNCTIONSOURCE__H__
+
+#include <fpaPlugins/fpaPlugins_Export.h>
+#include <cpPlugins/Interface/ProcessObject.h>
+
+namespace fpaPlugins
+{
+ /**
+ */
+ class fpaPlugins_EXPORT ThresholdImageGrowFunctionSource
+ : public cpPlugins::Interface::ProcessObject
+ {
+ public:
+ typedef ThresholdImageGrowFunctionSource Self;
+ typedef cpPlugins::Interface::ProcessObject Superclass;
+ typedef itk::SmartPointer< Self > Pointer;
+ typedef itk::SmartPointer< const Self > ConstPointer;
+
+ public:
+ itkNewMacro( Self );
+ itkTypeMacro(
+ ThresholdImageGrowFunctionSource, cpPlugins::Interface::ProcessObject
+ );
+ cpPlugins_Id_Macro(
+ ThresholdImageGrowFunctionSource, FrontPropagationFunctors
+ );
+
+ protected:
+ ThresholdImageGrowFunctionSource( );
+ virtual ~ThresholdImageGrowFunctionSource( );
+
+ virtual std::string _GenerateData( );
+
+ template< class I >
+ std::string _GD0( itk::DataObject* data );
+
+ private:
+ // Purposely not implemented.
+ ThresholdImageGrowFunctionSource( const Self& other );
+ Self& operator=( const Self& other );
+ };
+
+ // ---------------------------------------------------------------------
+ CPPLUGINS_INHERIT_PROVIDER( ThresholdImageGrowFunctionSource );
+
+} // ecapseman
+
+#endif // __FPAPLUGINS__THRESHOLDIMAGEGROWFUNCTIONSOURCE__H__
+
+// eof - $RCSfile$