-SUBDIRS(bash examples PipelineEditor)
+SUBDIRS(bash plugins examples PipelineEditor)
## eof - $RCSfile$
--- /dev/null
+INCLUDE_DIRECTORIES(
+ ${PROJECT_SOURCE_DIR}/lib
+ ${PROJECT_BINARY_DIR}/lib
+ )
+SET(
+ _plugins_APPS
+ ExecutePipeline
+ )
+FOREACH(_app ${_plugins_APPS})
+ ADD_EXECUTABLE(cpPlugins_plugins_${_app} ${_app})
+ TARGET_LINK_LIBRARIES(cpPlugins_plugins_${_app} cpPlugins)
+ SET(
+ cpPlugins_plugins_${_app}_APP cpPlugins_plugins_${_app}
+ CACHE INTERNAL "bash program cpPlugins_plugins_${_app}"
+ )
+ENDFOREACH(_app)
+
+
+## eof - $RCSfile$
--- /dev/null
+#include <iostream>
+#include <cpPlugins/Utility.h>
+#include <cpPlugins/Interface/Plugins.h>
+#include <cpPlugins/Interface/Workspace.h>
+
+int main( int argc, char* argv[] )
+{
+ // Manage inputs
+ if( argc < 2 )
+ {
+ std::cerr
+ << "Usage: " << argv[ 0 ]
+ << " workspace [parameters]" << std::endl;
+ return( 1 );
+
+ } // fi
+
+ // Create interface and load library
+ cpPlugins::Interface::Plugins::Pointer interface =
+ cpPlugins::Interface::Plugins::New( );
+ try
+ {
+ interface->GuessPlugins( );
+ }
+ catch( std::exception& err )
+ {
+ std::cerr << "Error caught: " << err.what( ) << std::endl;
+ return( 1 );
+
+ } // yrt
+
+ // Workspace
+ cpPlugins::Interface::Workspace::Pointer workspace =
+ cpPlugins::Interface::Workspace::New( );
+ try
+ {
+ workspace->Load( argv[ 1 ] );
+ }
+ catch( std::exception& err )
+ {
+ std::cerr
+ << "Error loading workspace \"" << argv[ 1 ]
+ << "\": " << err.what( ) << std::endl;
+ return( 1 );
+
+ } // yrt
+
+ // Read parameters
+ for( int i = 2; i < argc; ++i )
+ {
+ std::vector< std::string > tokens;
+ cpPlugins::Tokenize( tokens, argv[ i ], "@=" );
+ if( tokens.size( ) == 3 )
+ {
+ auto filter = workspace->GetFilter( tokens[ 1 ] );
+ if( filter != NULL )
+ {
+ auto params = filter->GetParameters( );
+ params->SetString( tokens[ 0 ], tokens[ 2 ], true );
+
+ } // fi
+
+ } // fi
+
+ } // rof
+
+ // Execute filter
+ workspace->PrintExecutionOn( );
+ try
+ {
+ workspace->Update( );
+ }
+ catch( std::exception& err )
+ {
+ std::cerr << std::endl << "********************************" << std::endl;
+ std::cerr << "Error caught: " << err.what( ) << std::endl;
+ std::cerr << "********************************" << std::endl;
+ return( 1 );
+
+ } // yrt
+ return( 0 );
+}
+
+// eof - $RCSfile$
define all_ints=#int_types#;#uint_types#
define in_scalars=#scalar_pixels#
define out_scalars=#scalar_pixels#
+define filters=AbsImageFilter;NotImageFilter
tinclude itkUnaryFunctorImageFilter:h|hxx
tinclude itkInvertIntensityImageFilter:h|hxx
tinclude itkBinaryThresholdImageFilter:h|hxx
tinclude itkCastImageFilter:h|hxx
-cinclude itkNotImageFilter.h
+cinclude itk#filters#.h
instances itk::UnaryFunctorImageFilter< itk::Image< #all_ints#, #process_dims# >, itk::Image< #all_ints#, #process_dims# >, itk::Functor::NOT< #all_ints#, #all_ints# > >
+instances itk::UnaryFunctorImageFilter< itk::Image< #scalar_pixels#, #process_dims# >, itk::Image< #scalar_pixels#, #process_dims# >, itk::Functor::Abs< #scalar_pixels#, #scalar_pixels# > >
instances itk::CastImageFilter< itk::Image< #in_scalars#, #process_dims# >, itk::Image< #out_scalars#, #process_dims# > >
--- /dev/null
+#include <ITKUnaryFunctorFilters/AbsImageFilter.h>
+#include <cpInstances/Image.h>
+
+#include <itkAbsImageFilter.h>
+
+// -------------------------------------------------------------------------
+cpPluginsITKUnaryFunctorFilters::AbsImageFilter::
+AbsImageFilter( )
+ : Superclass( )
+{
+ typedef cpInstances::Image _TImage;
+
+ this->_ConfigureInput< _TImage >( "Input", true, false );
+ this->_ConfigureOutput< _TImage >( "Output" );
+}
+
+// -------------------------------------------------------------------------
+cpPluginsITKUnaryFunctorFilters::AbsImageFilter::
+~AbsImageFilter( )
+{
+}
+
+// -------------------------------------------------------------------------
+void cpPluginsITKUnaryFunctorFilters::AbsImageFilter::
+_GenerateData( )
+{
+ auto o = this->GetInputData( "Input" );
+ cpPlugins_Demangle_Image_ScalarPixels_AllDims_1( o, _GD0 )
+ this->_Error( "Invalid input image." );
+}
+
+// -------------------------------------------------------------------------
+template< class _TImage >
+void cpPluginsITKUnaryFunctorFilters::AbsImageFilter::
+_GD0( _TImage* image )
+{
+ typedef itk::AbsImageFilter< _TImage, _TImage > _TFilter;
+
+ // Configure filter
+ auto filter = this->_CreateITK< _TFilter >( );
+ filter->SetInput( image );
+ filter->Update( );
+ this->GetOutput( "Output" )->SetITK( filter->GetOutput( ) );
+}
+
+// eof - $RCSfile$
--- /dev/null
+#ifndef __cpPluginsITKUnaryFunctorFilters__AbsImageFilter__h__
+#define __cpPluginsITKUnaryFunctorFilters__AbsImageFilter__h__
+
+#include <cpPluginsITKUnaryFunctorFilters_Export.h>
+#include <cpPlugins/BaseObjects/ProcessObject.h>
+
+namespace cpPluginsITKUnaryFunctorFilters
+{
+ /**
+ */
+ class cpPluginsITKUnaryFunctorFilters_EXPORT AbsImageFilter
+ : public cpPlugins::BaseObjects::ProcessObject
+ {
+ cpPluginsObject(
+ AbsImageFilter,
+ cpPlugins::BaseObjects::ProcessObject,
+ ImageFilters
+ );
+
+ protected:
+ template< class _TImage >
+ inline void _GD0( _TImage* image );
+ };
+
+} // ecapseman
+
+#endif // __cpPluginsITKUnaryFunctorFilters__AbsImageFilter__h__
+
+// eof - $RCSfile$
--- /dev/null
+#include <VTKFilters/MarchingCubes.h>
+#include <cpInstances/Image.h>
+#include <cpInstances/Mesh.h>
+
+#include <vtkImageData.h>
+#include <vtkMarchingCubes.h>
+#include <vtkMarchingSquares.h>
+
+// -------------------------------------------------------------------------
+cpPluginsVTKFilters::MarchingCubes::
+MarchingCubes( )
+ : Superclass( )
+{
+ this->_ConfigureInput< cpInstances::Image >( "Input", true, false );
+ this->_ConfigureOutput< cpInstances::Mesh >( "Output" );
+ this->m_Parameters.ConfigureAsRealList( "Thresholds" );
+}
+
+// -------------------------------------------------------------------------
+cpPluginsVTKFilters::MarchingCubes::
+~MarchingCubes( )
+{
+}
+
+// -------------------------------------------------------------------------
+void cpPluginsVTKFilters::MarchingCubes::
+_GenerateData( )
+{
+ // Get input
+ auto image = this->GetInput( "Input" );
+ vtkImageData* vtk_image = image->GetVTK< vtkImageData >( );
+ if( vtk_image == NULL )
+ this->_Error( "Input does not have a valid VTK conversion." );
+
+ std::vector< double > values =
+ this->m_Parameters.GetRealList( "Thresholds" );
+ vtkPolyData* pd = NULL;
+ if( vtk_image->GetDataDimension( ) == 2 )
+ {
+ vtkMarchingSquares* ms = this->_CreateVTK< vtkMarchingSquares >( );
+ ms->SetInputData( vtk_image );
+ for( unsigned int i = 0; i < values.size( ); ++i )
+ ms->SetValue( i, values[ i ] );
+ ms->Update( );
+ pd = ms->GetOutput( );
+ }
+ else if( vtk_image->GetDataDimension( ) == 3 )
+ {
+ vtkMarchingCubes* mc = this->_CreateVTK< vtkMarchingCubes >( );
+ mc->ComputeNormalsOff( );
+ mc->SetInputData( vtk_image );
+ for( unsigned int i = 0; i < values.size( ); ++i )
+ mc->SetValue( i, values[ i ] );
+ mc->Update( );
+ pd = mc->GetOutput( );
+ }
+ else
+ this->_Error( "Input data does not have a valid dimension." );
+
+ // Connect output
+ this->GetOutput( "Output" )->SetVTK( pd );
+}
+
+// eof - $RCSfile$
--- /dev/null
+#ifndef __cpPluginsVTKFilters__MarchingCubes__h__
+#define __cpPluginsVTKFilters__MarchingCubes__h__
+
+#include <cpPluginsVTKFilters_Export.h>
+#include <cpPlugins/BaseObjects/ProcessObject.h>
+
+namespace cpPluginsVTKFilters
+{
+ /**
+ */
+ class cpPluginsVTKFilters_EXPORT MarchingCubes
+ : public cpPlugins::BaseObjects::ProcessObject
+ {
+ cpPluginsObject(
+ MarchingCubes,
+ cpPlugins::BaseObjects::ProcessObject,
+ ImageToMeshFilters
+ );
+ };
+
+} // ecapseman
+
+#endif // __cpPluginsVTKFilters__MarchingCubes__h__
+
+// eof - $RCSfile$