From fa717ee218b75c537f1539a4ccebd318c178f16b Mon Sep 17 00:00:00 2001 From: Leonardo Florez Date: Fri, 8 Apr 2016 08:35:22 -0500 Subject: [PATCH] Raster filter added. Compilation issues on macos solved. --- appli/bash/cpPlugins_CreateInstances.cxx | 2 +- .../Algorithms/KalmanConstantFilter.h | 2 +- .../Algorithms/KalmanVelocityFilter.h | 2 +- lib/cpPlugins_Instances/Base.i | 7 +- lib/cpPlugins_Instances/Base_extra.cxx | 2 + lib/cpPlugins_Instances/CMakeLists.txt | 6 +- lib/cpPlugins_Instances/ImageIterators.i | 1 + lib/cpPlugins_Instances/ImageMeshFilters.i | 12 +++ lib/cpPlugins_Instances/Mesh.i | 3 + plugins/CMakeLists.txt | 2 + .../TriangleMeshToBinaryImageFilter.cxx | 3 +- plugins/cpPluginsVisualization/CMakeLists.txt | 74 ------------------- .../IndexesToPolyData.cxx | 65 ---------------- .../IndexesToPolyData.h | 44 ----------- .../PolyLineParametricPathToPolyData.cxx | 65 ---------------- .../PolyLineParametricPathToPolyData.h | 49 ------------ 16 files changed, 32 insertions(+), 307 deletions(-) create mode 100644 lib/cpPlugins_Instances/ImageMeshFilters.i delete mode 100644 plugins/cpPluginsVisualization/CMakeLists.txt delete mode 100644 plugins/cpPluginsVisualization/IndexesToPolyData.cxx delete mode 100644 plugins/cpPluginsVisualization/IndexesToPolyData.h delete mode 100644 plugins/cpPluginsVisualization/PolyLineParametricPathToPolyData.cxx delete mode 100644 plugins/cpPluginsVisualization/PolyLineParametricPathToPolyData.h diff --git a/appli/bash/cpPlugins_CreateInstances.cxx b/appli/bash/cpPlugins_CreateInstances.cxx index b83bdce..edb8e61 100644 --- a/appli/bash/cpPlugins_CreateInstances.cxx +++ b/appli/bash/cpPlugins_CreateInstances.cxx @@ -292,7 +292,7 @@ void ExpandVariables( TLines& res, const TLines& lines, const TVariables& vars ) auto b_pos = lIt->find( "#" ); if( b_pos != std::string::npos ) { - auto tokens = Tokenize( lIt->substr( b_pos ), " ,;:{}[]()\"$&<>" ); + auto tokens = Tokenize( lIt->substr( b_pos ), " ,;:{}[]()\"$&<>*" ); std::string cmd = tokens[ 0 ]; auto vIt = vars.find( cmd ); if( vIt != vars.end( ) ) diff --git a/lib/cpExtensions/Algorithms/KalmanConstantFilter.h b/lib/cpExtensions/Algorithms/KalmanConstantFilter.h index 860a8f3..ce038e1 100644 --- a/lib/cpExtensions/Algorithms/KalmanConstantFilter.h +++ b/lib/cpExtensions/Algorithms/KalmanConstantFilter.h @@ -35,7 +35,7 @@ namespace cpExtensions void Configure( unsigned int m ); // Iteration methods - virtual void Initialize( ); + virtual void Initialize( ) ITK_OVERRIDE; protected: KalmanConstantFilter( ); diff --git a/lib/cpExtensions/Algorithms/KalmanVelocityFilter.h b/lib/cpExtensions/Algorithms/KalmanVelocityFilter.h index 2e3af98..781e911 100644 --- a/lib/cpExtensions/Algorithms/KalmanVelocityFilter.h +++ b/lib/cpExtensions/Algorithms/KalmanVelocityFilter.h @@ -41,7 +41,7 @@ namespace cpExtensions void SetTimeOffset( TScalar t ); /// Iteration methods - virtual void Initialize( ); + virtual void Initialize( ) ITK_OVERRIDE; protected: KalmanVelocityFilter( ); diff --git a/lib/cpPlugins_Instances/Base.i b/lib/cpPlugins_Instances/Base.i index 8a7e946..544c58c 100644 --- a/lib/cpPlugins_Instances/Base.i +++ b/lib/cpPlugins_Instances/Base.i @@ -2,6 +2,7 @@ f cpPlugins_Config.h t itkArray.h t itkArray2D.h +t itkBoundingBox.h t itkCovariantVector.h t itkDiffusionTensor3D.h t itkFixedArray.h @@ -22,12 +23,14 @@ d #scalar=#int;unsigned #int;#float d #color_pixels=itk::RGBPixel< #scalar >;itk::RGBAPixel< #scalar > d #lin_alg_vectors=itk::CovariantVector;itk::Point;itk::Vector -c @{itk::Array;itk::Array2D;itk::VariableLengthVector}< #float > +c @{itk::Array;itk::Array2D;itk::VariableLengthVector}< #scalar > c itk::FixedArray< #scalar, #dims > +c itk::FixedArray< #scalar, @{4;6} > c #color_pixels c #lin_alg_vectors< #float, #dims > c itk::Matrix< #float, #dims, #dims > c itk::SymmetricEigenAnalysis< itk::Matrix< #float, #dims, #dims >, itk::FixedArray< #float, #dims >, itk::Matrix< #float, #dims, #dims > > c itk::SymmetricSecondRankTensor< #float, #dims > c itk::DiffusionTensor3D< #float > -c itk::VectorContainer< unsigned long, itk::Point< #float, #dims > > \ No newline at end of file +c itk::VectorContainer< unsigned long, itk::Point< #float, #dims > > +c itk::BoundingBox< unsigned long, #dims, #float, itk::VectorContainer< unsigned long, itk::Point< #float, #dims > > > diff --git a/lib/cpPlugins_Instances/Base_extra.cxx b/lib/cpPlugins_Instances/Base_extra.cxx index e0b7234..b3b33f5 100644 --- a/lib/cpPlugins_Instances/Base_extra.cxx +++ b/lib/cpPlugins_Instances/Base_extra.cxx @@ -59,5 +59,7 @@ cpPlugins_Base_extra_Array_AllScalars_AllDims( itk::Vector ); cpPlugins_Base_extra_VariableLengthVector_SetSize( float, AlwaysReallocate, KeepOldValues ); cpPlugins_Base_extra_VariableLengthVector_SetSize( float, ShrinkToFit, KeepOldValues ); +cpPlugins_Base_extra_VariableLengthVector_SetSize( double, AlwaysReallocate, KeepOldValues ); +cpPlugins_Base_extra_VariableLengthVector_SetSize( double, ShrinkToFit, KeepOldValues ); // eof - $RCSfile$ diff --git a/lib/cpPlugins_Instances/CMakeLists.txt b/lib/cpPlugins_Instances/CMakeLists.txt index f040a22..175ee40 100644 --- a/lib/cpPlugins_Instances/CMakeLists.txt +++ b/lib/cpPlugins_Instances/CMakeLists.txt @@ -46,19 +46,19 @@ SET( ## Target links TARGET_LINK_LIBRARIES(cpPlugins_Base ${ITK_LIBRARIES}) TARGET_LINK_LIBRARIES(cpPlugins_Transforms ${ITK_LIBRARIES} cpPlugins_Base) -TARGET_LINK_LIBRARIES(cpPlugins_Paths cpPlugins_Base ${VTK_LIBRARIES}) TARGET_LINK_LIBRARIES(cpPlugins_Mesh cpPlugins_Base) TARGET_LINK_LIBRARIES(cpPlugins_Image cpPlugins_Base) +TARGET_LINK_LIBRARIES(cpPlugins_Paths cpPlugins_Base cpPlugins_Image ${VTK_LIBRARIES}) TARGET_LINK_LIBRARIES(cpPlugins_ImageIterators ${ITK_LIBRARIES} cpPlugins_Image) TARGET_LINK_LIBRARIES(cpPlugins_ImageFiltersBase cpPlugins_Image) TARGET_LINK_LIBRARIES(cpPlugins_InPlaceImageFiltersBase cpPlugins_ImageFiltersBase) TARGET_LINK_LIBRARIES(cpPlugins_ImageITK2VTK cpPlugins_ImageFiltersBase ${VTK_LIBRARIES}) TARGET_LINK_LIBRARIES(cpPlugins_ThresholdFilters cpPlugins_InPlaceImageFiltersBase cpPlugins_ImageIterators) -TARGET_LINK_LIBRARIES(cpPlugins_DistanceMapFilters cpPlugins_ThresholdFilters) +TARGET_LINK_LIBRARIES(cpPlugins_DistanceMapFilters cpPlugins_ThresholdFilters cpPlugins_ImageIterators) TARGET_LINK_LIBRARIES(cpPlugins_ResamplingFilters cpPlugins_ImageFiltersBase cpPlugins_ImageIterators cpPlugins_Transforms) TARGET_LINK_LIBRARIES(cpPlugins_GaussianImageFilters cpPlugins_ImageFiltersBase cpPlugins_ImageIterators) TARGET_LINK_LIBRARIES(cpPlugins_ImageIO cpPlugins_ImageFiltersBase cpPlugins_ImageIterators) - +TARGET_LINK_LIBRARIES(cpPlugins_ImageMeshFilters cpPlugins_ImageFiltersBase cpPlugins_ImageIterators cpPlugins_Mesh) # INSTALL( # TARGETS ${l_NAME} # RUNTIME DESTINATION bin diff --git a/lib/cpPlugins_Instances/ImageIterators.i b/lib/cpPlugins_Instances/ImageIterators.i index 29f4bc8..f815b21 100644 --- a/lib/cpPlugins_Instances/ImageIterators.i +++ b/lib/cpPlugins_Instances/ImageIterators.i @@ -33,6 +33,7 @@ d #iterators=itk::ImageRegionConstIterator;itk::ImageRegionIterator;itk::ImageCo d #conds=itk::ZeroFluxNeumannBoundaryCondition d #neigh_iterators=itk::ConstNeighborhoodIterator;itk::NeighborhoodIterator;itk::ConstShapedNeighborhoodIterator;itk::ShapedNeighborhoodIterator +c itk::Neighborhood< #pixels*, #dims, itk::NeighborhoodAllocator< #pixels* > > c #iterators< itk::Image< #pixels, #dims > > c #iterators< itk::Image< #array_pixels< #float, #dims >, #dims > > c #iterators< itk::Image< #double_array_pixels< #float, #dims, #dims >, #dims > > diff --git a/lib/cpPlugins_Instances/ImageMeshFilters.i b/lib/cpPlugins_Instances/ImageMeshFilters.i new file mode 100644 index 0000000..f15e51b --- /dev/null +++ b/lib/cpPlugins_Instances/ImageMeshFilters.i @@ -0,0 +1,12 @@ +f cpPlugins_Instances/Image.h +f cpPlugins_Instances/Mesh.h + +t itkTriangleMeshToBinaryImageFilter.h + +d #dims=3 +d #int=char;short;int;long +d #uint=unsigned #int +d #pixels=#int;#uint +d #float=float;double + +c itk::TriangleMeshToBinaryImageFilter< itk::Mesh< #float, #dims >, itk::Image< #pixels, #dims > > diff --git a/lib/cpPlugins_Instances/Mesh.i b/lib/cpPlugins_Instances/Mesh.i index bd0b0c4..86da8ea 100644 --- a/lib/cpPlugins_Instances/Mesh.i +++ b/lib/cpPlugins_Instances/Mesh.i @@ -3,12 +3,15 @@ f cpPlugins_Instances/Base.h d #dims=2;3 d #float=float;double +i set +t itkCellInterface.h t itkMesh.h t itkPointSet.h t itkBoundingBox.h t itkMapContainer.h t itkVectorContainer.h +c itk::CellInterface< #float, itk::CellTraitsInfo< #dims, float, float, unsigned long, unsigned long, unsigned long, itk::Point< float, #dims >, itk::VectorContainer< unsigned long, itk::Point< float, #dims > >, std::set< unsigned long > > > c itk::VectorContainer< unsigned long, itk::CellInterface< #float, itk::CellTraitsInfo< #dims, float, float, unsigned long, unsigned long, unsigned long, itk::Point< float, #dims >, itk::VectorContainer< unsigned long, itk::Point< float, #dims > >, std::set< unsigned long > > >* > c @{itk::PointSet;itk::Mesh}< #float, #dims > diff --git a/plugins/CMakeLists.txt b/plugins/CMakeLists.txt index 0d25544..a62392d 100644 --- a/plugins/CMakeLists.txt +++ b/plugins/CMakeLists.txt @@ -1,6 +1,8 @@ SUBDIRS( cpPluginsIO cpPluginsImageFilters + cpPluginsMeshFilters + cpPluginsImageMeshFilters cpPluginsWidgets ) diff --git a/plugins/cpPluginsImageMeshFilters/TriangleMeshToBinaryImageFilter.cxx b/plugins/cpPluginsImageMeshFilters/TriangleMeshToBinaryImageFilter.cxx index 7e223a9..11bb178 100644 --- a/plugins/cpPluginsImageMeshFilters/TriangleMeshToBinaryImageFilter.cxx +++ b/plugins/cpPluginsImageMeshFilters/TriangleMeshToBinaryImageFilter.cxx @@ -2,8 +2,7 @@ #include #include -#include -#include +#include // ------------------------------------------------------------------------- cpPluginsImageMeshFilters::TriangleMeshToBinaryImageFilter:: diff --git a/plugins/cpPluginsVisualization/CMakeLists.txt b/plugins/cpPluginsVisualization/CMakeLists.txt deleted file mode 100644 index 14ab446..0000000 --- a/plugins/cpPluginsVisualization/CMakeLists.txt +++ /dev/null @@ -1,74 +0,0 @@ -SET(lib_NAME cpPluginsVisualization) -SET(lib_DIR cpPluginsVisualization) - -## =============== -## = 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") - -# =================================== -# = Integrate all source file names = -# =================================== - -SET( - lib_HEADERS - ${lib_HEADERS_H} - ${lib_HEADERS_HPP} - ${lib_HEADERS_HXX} - ) - -SET( - lib_SOURCES - ${lib_SOURCES_C} - ${lib_SOURCES_CPP} - ${lib_SOURCES_CXX} - ) - -SET( - target_LIBRARIES - cpExtensions - cpPlugins - ) - -## ===================== -## = Compilation rules = -## ===================== - -ADD_CUSTOM_COMMAND( - OUTPUT ${lib_NAME}_Host.cxx - DEPENDS cpPlugins_HostCreator ${LIB_HEADERS_H} - COMMAND cpPlugins_HostCreator ${lib_NAME}_Host.cxx ${lib_HEADERS_H} - ) -ADD_LIBRARY(${lib_NAME} SHARED ${lib_NAME}_Host.cxx ${lib_SOURCES}) -SET_TARGET_PROPERTIES( - ${lib_NAME} PROPERTIES - VERSION "${prj_VER}" - SOVERSION "${prj_sVER}" - ) -GENERATE_EXPORT_HEADER( - ${lib_NAME} - BASE_NAME ${lib_NAME} - EXPORT_MACRO_NAME ${lib_NAME}_EXPORT - EXPORT_FILE_NAME ${PROJECT_BINARY_DIR}/plugins/${lib_DIR}/${lib_NAME}_Export.h - STATIC_DEFINE ${lib_NAME}_BUILT_AS_STATIC - ) -TARGET_LINK_LIBRARIES(${lib_NAME} ${target_LIBRARIES}) - -## ======================== -## -- Installation rules -- -## ======================== - -INSTALL( - TARGETS ${lib_NAME} - RUNTIME DESTINATION bin - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib/static - ) - -## eof - $RCSfile$ diff --git a/plugins/cpPluginsVisualization/IndexesToPolyData.cxx b/plugins/cpPluginsVisualization/IndexesToPolyData.cxx deleted file mode 100644 index 9e4b65c..0000000 --- a/plugins/cpPluginsVisualization/IndexesToPolyData.cxx +++ /dev/null @@ -1,65 +0,0 @@ -#include -#include -#include - -#include -#include - -// ------------------------------------------------------------------------- -cpPluginsVisualization::IndexesToPolyData:: -IndexesToPolyData( ) - : Superclass( ) -{ - this->_AddInput( "Input" ); - this->_AddInput( "ReferenceImage", false ); - this->_AddOutput< cpPlugins::Mesh >( "Output" ); -} - -// ------------------------------------------------------------------------- -cpPluginsVisualization::IndexesToPolyData:: -~IndexesToPolyData( ) -{ -} - -// ------------------------------------------------------------------------- -std::string cpPluginsVisualization::IndexesToPolyData:: -_GenerateData( ) -{ - typedef itk::SimpleDataObjectDecorator< std::vector< itk::Index< 2 > > > _2D; - typedef itk::SimpleDataObjectDecorator< std::vector< itk::Index< 3 > > > _3D; - - auto indexes = this->GetInputData( "Input" )->GetITK< itk::DataObject >( ); - auto indexes2D = dynamic_cast< _2D* >( indexes ); - auto indexes3D = dynamic_cast< _3D* >( indexes ); - if( indexes2D != NULL ) - return( this->_GD0( indexes2D ) ); - else if( indexes3D != NULL ) - return( this->_GD0( indexes3D ) ); - else - return( "cpPluginsVisualization::IndexesToPolyData: no valid input." ); -} - -// ------------------------------------------------------------------------- -template< class _TIndexes > -std::string cpPluginsVisualization::IndexesToPolyData:: -_GD0( _TIndexes* indexes ) -{ - typedef - cpExtensions::Visualization::IndexesToPolyData< _TIndexes > - _TFilter; - typedef typename _TFilter::TImage _TImage; - - // Configure filter - _TFilter* filter = this->_CreateVTK< _TFilter >( ); - filter->SetInput( indexes ); - filter->SetReferenceImage( - this->GetInputData( "Input" )->GetITK< _TImage >( ) - ); - filter->Update( ); - - // Connect output - this->GetOutputData( "Output" )->SetVTK( filter->GetOutput( ) ); - return( "" ); -} - -// eof - $RCSfile$ diff --git a/plugins/cpPluginsVisualization/IndexesToPolyData.h b/plugins/cpPluginsVisualization/IndexesToPolyData.h deleted file mode 100644 index ff4bb7d..0000000 --- a/plugins/cpPluginsVisualization/IndexesToPolyData.h +++ /dev/null @@ -1,44 +0,0 @@ -#ifndef __CPPLUGINSVISUALIZATION__INDEXESTOPOLYDATA__H__ -#define __CPPLUGINSVISUALIZATION__INDEXESTOPOLYDATA__H__ - -#include -#include - -namespace cpPluginsVisualization -{ - /** - */ - class cpPluginsVisualization_EXPORT IndexesToPolyData - : public cpPlugins::ProcessObject - { - public: - typedef IndexesToPolyData Self; - typedef cpPlugins::ProcessObject Superclass; - typedef itk::SmartPointer< Self > Pointer; - typedef itk::SmartPointer< const Self > ConstPointer; - - public: - itkNewMacro( Self ); - itkTypeMacro( IndexesToPolyData, cpPlugins::ProcessObject ); - cpPlugins_Id_Macro( IndexesToPolyData, Visualization ); - - protected: - IndexesToPolyData( ); - virtual ~IndexesToPolyData( ); - - virtual std::string _GenerateData( ) ITK_OVERRIDE; - - template< class _TIndexes > - inline std::string _GD0( _TIndexes* path ); - - private: - // Purposely not implemented - IndexesToPolyData( const Self& ); - Self& operator=( const Self& ); - }; - -} // ecapseman - -#endif // __CPPLUGINSVISUALIZATION__INDEXESTOPOLYDATA__H__ - -// eof - $RCSfile$ diff --git a/plugins/cpPluginsVisualization/PolyLineParametricPathToPolyData.cxx b/plugins/cpPluginsVisualization/PolyLineParametricPathToPolyData.cxx deleted file mode 100644 index f41839b..0000000 --- a/plugins/cpPluginsVisualization/PolyLineParametricPathToPolyData.cxx +++ /dev/null @@ -1,65 +0,0 @@ -#include -#include - -#include -#include -#include - -// ------------------------------------------------------------------------- -cpPluginsVisualization::PolyLineParametricPathToPolyData:: -PolyLineParametricPathToPolyData( ) - : Superclass( ) -{ - this->_AddInput( "Input" ); - this->_AddInput( "ReferenceImage", false ); - this->_AddOutput< cpPlugins::Mesh >( "Output" ); -} - -// ------------------------------------------------------------------------- -cpPluginsVisualization::PolyLineParametricPathToPolyData:: -~PolyLineParametricPathToPolyData( ) -{ -} - -// ------------------------------------------------------------------------- -std::string cpPluginsVisualization::PolyLineParametricPathToPolyData:: -_GenerateData( ) -{ - typedef itk::PolyLineParametricPath< 2 > _2DPath; - typedef itk::PolyLineParametricPath< 3 > _3DPath; - - auto path = this->GetInputData( "Input" )->GetITK< itk::DataObject >( ); - auto path2D = dynamic_cast< _2DPath* >( path ); - auto path3D = dynamic_cast< _3DPath* >( path ); - if( path2D != NULL ) - return( this->_GD0( path2D ) ); - else if( path3D != NULL ) - return( this->_GD0( path3D ) ); - else - return( "cpPluginsVisualization::PolyLineParametricPathToPolyData: no valid input." ); -} - -// ------------------------------------------------------------------------- -template< class _TPath > -std::string cpPluginsVisualization::PolyLineParametricPathToPolyData:: -_GD0( _TPath* path ) -{ - typedef - cpExtensions::Visualization::PolyLineParametricPathToPolyData< _TPath > - _TFilter; - typedef typename _TFilter::TImage _TImage; - - // Configure filter - _TFilter* filter = this->_CreateVTK< _TFilter >( ); - filter->SetInput( path ); - filter->SetReferenceImage( - this->GetInputData( "Input" )->GetITK< _TImage >( ) - ); - filter->Update( ); - - // Connect output - this->GetOutputData( "Output" )->SetVTK( filter->GetOutput( ) ); - return( "" ); -} - -// eof - $RCSfile$ diff --git a/plugins/cpPluginsVisualization/PolyLineParametricPathToPolyData.h b/plugins/cpPluginsVisualization/PolyLineParametricPathToPolyData.h deleted file mode 100644 index bf549c8..0000000 --- a/plugins/cpPluginsVisualization/PolyLineParametricPathToPolyData.h +++ /dev/null @@ -1,49 +0,0 @@ -#ifndef __CPPLUGINSVISUALIZATION__POLYLINEPARAMETRICPATHTOPOLYDATA__H__ -#define __CPPLUGINSVISUALIZATION__POLYLINEPARAMETRICPATHTOPOLYDATA__H__ - -#include -#include - -namespace cpPluginsVisualization -{ - /** - */ - class cpPluginsVisualization_EXPORT PolyLineParametricPathToPolyData - : public cpPlugins::ProcessObject - { - public: - typedef PolyLineParametricPathToPolyData Self; - typedef cpPlugins::ProcessObject Superclass; - typedef itk::SmartPointer< Self > Pointer; - typedef itk::SmartPointer< const Self > ConstPointer; - - public: - itkNewMacro( Self ); - itkTypeMacro( PolyLineParametricPathToPolyData, cpPlugins::ProcessObject ); - cpPlugins_Id_Macro( PolyLineParametricPathToPolyData, Visualization ); - - protected: - PolyLineParametricPathToPolyData( ); - virtual ~PolyLineParametricPathToPolyData( ); - - virtual std::string _GenerateData( ) ITK_OVERRIDE; - - template< class _TPath > - inline std::string _GD0( _TPath* path ); - - /* TODO - template< class _TImage, class _TBinaryPixel > - inline std::string _GD1( _TImage* image ); - */ - - private: - // Purposely not implemented - PolyLineParametricPathToPolyData( const Self& ); - Self& operator=( const Self& ); - }; - -} // ecapseman - -#endif // __CPPLUGINSVISUALIZATION__POLYLINEPARAMETRICPATHTOPOLYDATA__H__ - -// eof - $RCSfile$ -- 2.47.1