OPTION(BUILD_EXAMPLES "Build examples" OFF)
OPTION(BUILD_SHARED_LIBS "Build shared libs" OFF)
+OPTION(BUILD_PLUGINS "Build plugins" OFF)
IF(BUILD_SHARED_LIBS)
SET(LIB_TYPE SHARED)
DESTINATION include/fpa
)
-IF(${USE_cpPlugins})
+IF(BUILD_PLUGINS)
SUBDIRS(
fpaPlugins
)
-ENDIF(${USE_cpPlugins})
+ENDIF(BUILD_PLUGINS)
## eof - $RCSfile$
typedef std::map< TVertex, _TNode, TVertexCompare > _TNodes;
public:
- typedef fpa::Base::MinimumSpanningTree< TVertex, _TCollisions, TVertexCompare > TMinimumSpanningTree;
+ typedef
+ fpa::Base::MinimumSpanningTree< V, _TCollisions, VC >
+ TMinimumSpanningTree;
public:
itkTypeMacro( Algorithm, B );
{
return(
dynamic_cast< TMinimumSpanningTree* >(
- this->itk::ProcessObject::GetOutput( 1 )
+ this->itk::ProcessObject::GetOutput(
+ this->m_MinimumSpanningTreeIndex
+ )
)
);
}
{
return(
dynamic_cast< const TMinimumSpanningTree* >(
- this->itk::ProcessObject::GetOutput( 1 )
+ this->itk::ProcessObject::GetOutput(
+ this->m_MinimumSpanningTreeIndex
+ )
)
);
}
{
TMinimumSpanningTree* mst = dynamic_cast< TMinimumSpanningTree* >( obj );
if( mst != NULL )
- this->GraftNthOutput( 1, mst );
+ this->GraftNthOutput( this->m_MinimumSpanningTreeIndex, mst );
}
// -------------------------------------------------------------------------
## = 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}
+ )
+
ADD_LIBRARY(
${LIBRARY_NAME}
SHARED
+ ${LIBRARY_NAME}_Host.cxx
${LIB_SOURCES_C}
${LIB_SOURCES_CPP}
${LIB_SOURCES_CXX}
EXPORT_FILE_NAME ${PROJECT_BINARY_DIR}/lib/fpaPlugins/${LIBRARY_NAME}_Export.h
STATIC_DEFINE ${LIBRARY_NAME}_BUILT_AS_STATIC
)
-#TARGET_LINK_LIBRARIES(
-# ${LIBRARY_NAME}
-# cpExtensions
-# cpPlugins_Interface
-# )
+TARGET_LINK_LIBRARIES(
+ ${LIBRARY_NAME}
+ ${cpPlugins_Interface_LIBRARY}
+ )
## ========================
## -- Installation rules --
## ========================
-#INSTALL(
-# TARGETS ${LIBRARY_NAME}
-# RUNTIME DESTINATION bin
-# LIBRARY DESTINATION lib
-# ARCHIVE DESTINATION lib/static
-# )
+INSTALL(
+ TARGETS ${LIBRARY_NAME}
+ RUNTIME DESTINATION bin
+ LIBRARY DESTINATION lib
+ ARCHIVE DESTINATION lib/static
+ )
## eof - $RCSfile$
+++ /dev/null
-#include <Pluma/Connector.hpp>
-/*
- #include <cpPlugins/Plugins/ImageReader.h>
- #include <cpPlugins/Plugins/ImageWriter.h>
- #include <cpPlugins/Plugins/MeshReader.h>
- #include <cpPlugins/Plugins/MeshWriter.h>
- #include <cpPlugins/Plugins/MarchingCubes.h>
- #include <cpPlugins/Plugins/OtsuThresholdImageFilter.h>
- #include <cpPlugins/Plugins/RGBImageToOtherChannelsFilter.h>
- #include <cpPlugins/Plugins/SecondRankDiffusionTensorToPolyData.h>
- #include <cpPlugins/Plugins/BinaryThresholdImageFilter.h>
-*/
-
-/// TODO: doc
-PLUMA_CONNECTOR
-bool connect( pluma::Host& host )
-{
- /*
- using namespace cpPlugins::Plugins;
-
- host.add( new ImageReaderProvider( ) );
- host.add( new ImageWriterProvider( ) );
- host.add( new MeshReaderProvider( ) );
- host.add( new MeshWriterProvider( ) );
- host.add( new MarchingCubesProvider( ) );
- host.add( new OtsuThresholdImageFilterProvider( ) );
- host.add( new RGBImageToOtherChannelsFilterProvider( ) );
- host.add( new SecondRankDiffusionTensorToPolyDataProvider( ) );
- host.add( new BinaryThresholdImageFilterProvider( ) );
- */
- return( true );
-}
-
-// eof - $RCSfile$
--- /dev/null
+#include "ImageRegionGrow.h"
+
+#include <cpPlugins/Interface/Image.h>
+#include <fpa/Image/RegionGrow.h>
+#include <fpa/Image/Functors/RegionGrowAllBelongsFunction.h>
+
+// -------------------------------------------------------------------------
+fpaPlugins::ImageRegionGrow::
+ImageRegionGrow( )
+ : Superclass( )
+{
+ this->_AddInput( "Input" );
+ 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->ConfigureAsPointList( "Seeds" );
+
+ std::vector< std::string > orders;
+ orders.push_back( "1" );
+ orders.push_back( "2" );
+ this->m_Parameters->ConfigureAsChoices( "NeighborhoodOrder", orders );
+}
+
+// -------------------------------------------------------------------------
+fpaPlugins::ImageRegionGrow::
+~ImageRegionGrow( )
+{
+}
+
+// -------------------------------------------------------------------------
+std::string fpaPlugins::ImageRegionGrow::
+_GenerateData( )
+{
+ cpPlugins::Interface::Image* input =
+ this->GetInput< cpPlugins::Interface::Image >( "Input" );
+ if( input == NULL )
+ return( "fpaPlugins::ImageRegionGrow: No input image." );
+
+ itk::DataObject* image = NULL;
+ std::string r = "";
+ cpPlugins_Image_Demangle_AllScalarTypes( 2, input, image, r, _GD0 );
+ else cpPlugins_Image_Demangle_AllScalarTypes( 3, input, image, r, _GD0 );
+ else r = "fpaPlugins::ImageRegionGrow: Input image type not supported.";
+ return( r );
+}
+
+// -------------------------------------------------------------------------
+template< class I >
+std::string fpaPlugins::ImageRegionGrow::
+_GD0( itk::DataObject* data )
+{
+ typedef unsigned char _TOutPixel;
+ typedef itk::Image< _TOutPixel, I::ImageDimension > _TOut;
+ typedef fpa::Image::RegionGrow< I, _TOut > _TFilter;
+ typedef typename _TFilter::TGrowingFunction _TFunctor;
+
+ I* image = dynamic_cast< I* >( data );
+
+ // Create filter and connect input
+ _TFilter* filter = this->_CreateITK< _TFilter >( );
+ filter->SetInput( image );
+
+ // Connect grow functor (or create a tautology)
+ typename _TFunctor::Pointer functor;
+ cpPlugins::Interface::DataObject* functor_wrapper =
+ this->GetInput< cpPlugins::Interface::DataObject >( "GrowFunction" );
+ if( functor_wrapper != NULL )
+ functor = functor_wrapper->GetITK< _TFunctor >( );
+ if( functor.IsNull( ) )
+ functor =
+ fpa::Image::Functors::RegionGrowAllBelongsFunction< I >::New( );
+
+ // Set numeric parameters
+ Superclass::TParameters* params = this->m_Parameters;
+ std::string order = params->GetSelectedChoice( "NeighborhoodOrder" );
+ filter->SetNeighborhoodOrder( order[ 0 ] - '0' );
+ filter->SetStopAtOneFront( params->GetBool( "StopAtOneFront" ) );
+ filter->SetInsideValue( _TOutPixel( params->GetReal( "InsideValue" ) ) );
+ filter->SetOutsideValue( _TOutPixel( params->GetReal( "OutsideValue" ) ) );
+
+ // Assign seeds
+ std::vector< typename I::PointType > seeds;
+ params->GetPointList( seeds, "Seeds", I::ImageDimension );
+ for( auto sIt = seeds.begin( ); sIt != seeds.end( ); ++sIt )
+ {
+ typename I::IndexType idx;
+ if( image->TransformPhysicalPointToIndex( *sIt, idx ) )
+ filter->AddSeed( idx, 0 );
+
+ } // rof
+
+ // Connect visual debugger
+ /* TODO
+ this->m_Parameters->ConfigureAsBool( "VisualDebug", false );
+ */
+
+ // Go!!!
+ filter->Update( );
+
+ // Connect output
+ cpPlugins::Interface::Image* out =
+ this->GetOutput< cpPlugins::Interface::Image >( "Output" );
+ if( out != NULL )
+ {
+ out->SetITK< _TOut >( filter->GetOutput( ) );
+ return( "" );
+ }
+ else
+ return( "fpaPlugins::ImageRegionGrow: output not correctly created." );
+}
+
+// eof - $RCSfile$
--- /dev/null
+#ifndef __FPAPLUGINS__IMAGEREGIONGROW__H__
+#define __FPAPLUGINS__IMAGEREGIONGROW__H__
+
+#include <fpaPlugins/fpaPlugins_Export.h>
+#include <cpPlugins/Interface/BaseProcessObjects.h>
+
+namespace fpaPlugins
+{
+ /**
+ */
+ class fpaPlugins_EXPORT ImageRegionGrow
+ : public cpPlugins::Interface::ImageToImageFilter
+ {
+ public:
+ typedef ImageRegionGrow Self;
+ typedef cpPlugins::Interface::ImageToImageFilter Superclass;
+ typedef itk::SmartPointer< Self > Pointer;
+ typedef itk::SmartPointer< const Self > ConstPointer;
+
+ public:
+ itkNewMacro( Self );
+ itkTypeMacro(
+ ImageRegionGrow, cpPlugins::Interface::ImageToImageFilter
+ );
+ cpPlugins_Id_Macro(
+ fpaPlugins::ImageRegionGrow, "FrontPropagationImageAlgorithms"
+ );
+
+ protected:
+ ImageRegionGrow( );
+ virtual ~ImageRegionGrow( );
+
+ virtual std::string _GenerateData( );
+
+ template< class I >
+ std::string _GD0( itk::DataObject* data );
+
+ private:
+ // Purposely not implemented.
+ ImageRegionGrow( const Self& other );
+ Self& operator=( const Self& other );
+ };
+
+ // ---------------------------------------------------------------------
+ CPPLUGINS_INHERIT_PROVIDER( ImageRegionGrow );
+
+} // ecapseman
+
+#endif // __FPAPLUGINS__IMAGEREGIONGROW__H__
+
+// eof - $RCSfile$