DEPENDS ${cpPlugins_HostCreator_APP} ${headers}
COMMAND ${cpPlugins_HostCreator_APP} ${host} ${headers}
)
-ADD_LIBRARY(${libname} SHARED ${host} ${sources} ${other_sources})
+SET(qtsources)
+FOREACH(qth ${qtheaders})
+ QT4_WRAP_CPP(qth_moc ${qth})
+ SET(qtsources "${qtsources};${qth_moc}")
+ENDFOREACH(qth)
+
+ADD_LIBRARY(${libname} SHARED ${host} ${sources} ${other_sources} ${qtsources})
SET_TARGET_PROPERTIES(
${libname} PROPERTIES
VERSION "${ver}"
--- /dev/null
+#include <cpPlugins/BoundingBox.h>
+#include <limits>
+#include <vtkDataSet.h>
+
+// -------------------------------------------------------------------------
+void cpPlugins::BoundingBox::
+SetDataObject( DataObject* o )
+{
+ auto i = o->GetITK< itk::LightObject >( );
+ auto v = o->GetVTK< vtkObjectBase >( );
+ if( v != NULL ) this->SetVTK( v );
+ else if( i != NULL ) this->SetITK( i );
+}
+
+// -------------------------------------------------------------------------
+void cpPlugins::BoundingBox::
+SetITK( itk::LightObject* o )
+{
+ bool r = this->_ITKImage< 1 >( o );
+ if( !r ) r = this->_ITKImage< 2 >( o );
+ if( !r ) r = this->_ITKImage< 3 >( o );
+ if( !r ) r = this->_ITKImage< 4 >( o );
+ if( !r ) r = this->_ITKPointSet< float, 2 >( o );
+ if( !r ) r = this->_ITKPointSet< double, 2 >( o );
+ if( !r ) r = this->_ITKPointSet< float, 3 >( o );
+ if( !r ) r = this->_ITKPointSet< double, 3 >( o );
+}
+
+// -------------------------------------------------------------------------
+void cpPlugins::BoundingBox::
+SetVTK( vtkObjectBase* o )
+{
+ auto ds = dynamic_cast< vtkDataSet* >( o );
+ if( ds != NULL )
+ {
+ double bounds[ 6 ];
+ ds->GetBounds( bounds );
+ this->m_Points[ 0 ].clear( );
+ this->m_Points[ 1 ].clear( );
+ this->m_Points[ 0 ].push_back( bounds[ 0 ] );
+ this->m_Points[ 1 ].push_back( bounds[ 1 ] );
+ this->m_Points[ 0 ].push_back( bounds[ 2 ] );
+ this->m_Points[ 1 ].push_back( bounds[ 3 ] );
+ this->m_Points[ 0 ].push_back( bounds[ 4 ] );
+ this->m_Points[ 1 ].push_back( bounds[ 5 ] );
+
+ } // fi
+}
+
+// -------------------------------------------------------------------------
+void cpPlugins::BoundingBox::
+Copy( Self* other )
+{
+ this->m_Points[ 0 ] = other->m_Points[ 0 ];
+ this->m_Points[ 1 ] = other->m_Points[ 1 ];
+ this->Modified( );
+}
+
+// -------------------------------------------------------------------------
+void cpPlugins::BoundingBox::
+Blend( Self* other )
+{
+ if( this->m_Points[ 0 ].size( ) < other->m_Points[ 0 ].size( ) )
+ this->m_Points[ 0 ].resize(
+ other->m_Points[ 0 ].size( ),
+ std::numeric_limits< double >::max( )
+ );
+ if( this->m_Points[ 1 ].size( ) < other->m_Points[ 1 ].size( ) )
+ this->m_Points[ 1 ].resize(
+ other->m_Points[ 1 ].size( ),
+ -std::numeric_limits< double >::max( )
+ );
+ for( unsigned int d = 0; d < this->m_Points[ 0 ].size( ); ++d )
+ if( other->m_Points[ 0 ][ d ] < this->m_Points[ 0 ][ d ] )
+ this->m_Points[ 0 ][ d ] = other->m_Points[ 0 ][ d ];
+ for( unsigned int d = 0; d < this->m_Points[ 1 ].size( ); ++d )
+ if( other->m_Points[ 1 ][ d ] > this->m_Points[ 1 ][ d ] )
+ this->m_Points[ 1 ][ d ] = other->m_Points[ 1 ][ d ];
+ this->Modified( );
+}
+
+// -------------------------------------------------------------------------
+cpPlugins::BoundingBox::
+BoundingBox( )
+ : Superclass( )
+{
+ this->m_Points[ 0 ].push_back( double( 0 ) );
+ this->m_Points[ 1 ].push_back( double( 0 ) );
+}
+
+// -------------------------------------------------------------------------
+cpPlugins::BoundingBox::
+~BoundingBox( )
+{
+}
+
+// eof - $RCSfile$
--- /dev/null
+#ifndef __CPPLUGINS__BOUNDINGBOX__H__
+#define __CPPLUGINS__BOUNDINGBOX__H__
+
+#include <vector>
+#include <cpPlugins/DataObject.h>
+
+namespace cpPlugins
+{
+ /**
+ */
+ class cpPlugins_EXPORT BoundingBox
+ : public DataObject
+ {
+ public:
+ typedef BoundingBox Self;
+ typedef DataObject Superclass;
+ typedef itk::SmartPointer< Self > Pointer;
+ typedef itk::SmartPointer< const Self > ConstPointer;
+
+ public:
+ itkNewMacro( Self );
+ itkTypeMacro( BoundingBox, DataObject );
+ cpPlugins_Id_Macro( BoundingBox, Object );
+
+ public:
+ void SetDataObject( DataObject* o );
+ virtual void SetITK( itk::LightObject* o ) ITK_OVERRIDE;
+ virtual void SetVTK( vtkObjectBase* o ) ITK_OVERRIDE;
+
+ void Copy( Self* other );
+ void Blend( Self* other );
+
+ template< class _TPoint >
+ inline void SetMinimum( const _TPoint& p );
+
+ template< class _TPoint >
+ inline void SetMaximum( const _TPoint& p );
+
+ template< class _TPoint >
+ inline _TPoint GetMinimum( ) const;
+
+ template< class _TPoint >
+ inline _TPoint GetMaximum( ) const;
+
+ protected:
+ BoundingBox( );
+ virtual ~BoundingBox( );
+
+ template< class _TPoint >
+ inline void _SetPoint( unsigned int m, const _TPoint& p );
+
+ template< class _TPoint >
+ inline _TPoint _GetPoint( unsigned int m ) const;
+
+ template< unsigned int _NDim >
+ inline bool _ITKImage( itk::LightObject* o );
+
+ template< class _TScalar, unsigned int _NDim >
+ inline bool _ITKPointSet( itk::LightObject* o );
+
+ private:
+ // Purposely not implemented
+ BoundingBox( const Self& );
+ Self& operator=( const Self& );
+
+ protected:
+ std::vector< double > m_Points[ 2 ];
+ };
+
+} // ecapseman
+
+#include <cpPlugins/BoundingBox.hxx>
+
+#endif // __CPPLUGINS__BOUNDINGBOX__H__
+
+// eof - $RCSfile$
--- /dev/null
+#ifndef __CPPLUGINS__BOUNDINGBOX__HXX__
+#define __CPPLUGINS__BOUNDINGBOX__HXX__
+
+#include <cpPlugins/Image.h>
+#include <cpPlugins/Mesh.h>
+#include <itkBoundingBox.h>
+#include <itkPointSet.h>
+
+// -------------------------------------------------------------------------
+template< class _TPoint >
+void cpPlugins::BoundingBox::
+SetMinimum( const _TPoint& p )
+{
+ this->_SetPoint( 0, p );
+}
+
+// -------------------------------------------------------------------------
+template< class _TPoint >
+void cpPlugins::BoundingBox::
+SetMaximum( const _TPoint& p )
+{
+ this->_SetPoint( 1, p );
+}
+
+// -------------------------------------------------------------------------
+template< class _TPoint >
+_TPoint cpPlugins::BoundingBox::
+GetMinimum( ) const
+{
+ return( this->_GetPoint< _TPoint >( 0 ) );
+}
+
+// -------------------------------------------------------------------------
+template< class _TPoint >
+_TPoint cpPlugins::BoundingBox::
+GetMaximum( ) const
+{
+ return( this->_GetPoint< _TPoint >( 1 ) );
+}
+
+// -------------------------------------------------------------------------
+template< class _TPoint >
+void cpPlugins::BoundingBox::
+_SetPoint( unsigned int m, const _TPoint& p )
+{
+ this->m_Points[ m ].clear( );
+ for( unsigned int d = 0; d < _TPoint::PointDimension; ++d )
+ this->m_Points[ m ].push_back( double( p[ d ] ) );
+ this->Modified( );
+}
+
+// -------------------------------------------------------------------------
+template< class _TPoint >
+_TPoint cpPlugins::BoundingBox::
+_GetPoint( unsigned int m ) const
+{
+ unsigned int dim = this->m_Points[ m ].size( );
+ dim = ( _TPoint::PointDimension < dim )? _TPoint::PointDimension: dim;
+ _TPoint p;
+ p.Fill( 0 );
+ for( unsigned int d = 0; d < dim; ++d )
+ p[ d ] = this->m_Points[ m ][ d ];
+ return( p );
+}
+
+// -------------------------------------------------------------------------
+template< unsigned int _NDim >
+bool cpPlugins::BoundingBox::
+_ITKImage( itk::LightObject* o )
+{
+ auto image = dynamic_cast< itk::ImageBase< _NDim >* >( o );
+ if( image == NULL )
+ return( false );
+
+ auto region = image->GetLargestPossibleRegion( );
+ auto i0 = region.GetIndex( );
+ auto i1 = i0 + region.GetSize( );
+
+ typename itk::ImageBase< _NDim >::PointType p0, p1;
+ image->TransformIndexToPhysicalPoint( i0, p0 );
+ image->TransformIndexToPhysicalPoint( i1, p1 );
+ this->m_Points[ 0 ].clear( );
+ this->m_Points[ 1 ].clear( );
+
+ for( unsigned int d = 0; d < _NDim; ++d )
+ {
+ this->m_Points[ 0 ].push_back( double( p0[ d ] ) );
+ this->m_Points[ 1 ].push_back( double( p1[ d ] ) );
+
+ } // rof
+ this->Modified( );
+ return( true );
+}
+
+// -------------------------------------------------------------------------
+template< class _TScalar, unsigned int _NDim >
+bool cpPlugins::BoundingBox::
+_ITKPointSet( itk::LightObject* o )
+{
+ typedef itk::PointSet< _TScalar, _NDim > _TPointSet;
+ typedef itk::BoundingBox< typename _TPointSet::PointIdentifier, _NDim, _TScalar, typename _TPointSet::PointsContainer > _TBBox;
+
+ auto ps = dynamic_cast< _TPointSet* >( o );
+ if( ps == NULL )
+ return( false );
+
+ this->m_Points[ 0 ].clear( );
+ this->m_Points[ 1 ].clear( );
+
+ typename _TBBox::Pointer bb = _TBBox::New( );
+ bb->SetPoints( ps->GetPoints( ) );
+ if( bb->ComputeBoundingBox( ) )
+ {
+ auto p0 = bb->GetMinimum( );
+ auto p1 = bb->GetMaximum( );
+ for( unsigned int d = 0; d < _NDim; ++d )
+ {
+ this->m_Points[ 0 ].push_back( double( p0[ d ] ) );
+ this->m_Points[ 1 ].push_back( double( p1[ d ] ) );
+
+ } // rof
+ this->Modified( );
+ return( true );
+ }
+ else
+ return( false );
+}
+
+#endif // __CPPLUGINS__BOUNDINGBOX__HXX__
+
+// eof - $RCSfile$
#define cpPlugin_Image_Demangle_VectorPixel_Dim( FUNC, INPUT, VECTOR, PIXEL, D ) \
this->FUNC( dynamic_cast< itk::Image< VECTOR< PIXEL, D >, D >* >( INPUT ) )
+#define cpPlugin_Image_Demangle_Pixel_AllInts( r, FUNC, INPUT, D ) \
+ r = cpPlugin_Image_Demangle_Pixel_Dim( FUNC, INPUT, char, D ); \
+ if( r != "" ) r = cpPlugin_Image_Demangle_Pixel_Dim( FUNC, INPUT, short, D ); \
+ if( r != "" ) r = cpPlugin_Image_Demangle_Pixel_Dim( FUNC, INPUT, int, D ); \
+ if( r != "" ) r = cpPlugin_Image_Demangle_Pixel_Dim( FUNC, INPUT, long, D ); \
+ if( r != "" ) r = cpPlugin_Image_Demangle_Pixel_Dim( FUNC, INPUT, unsigned char, D ); \
+ if( r != "" ) r = cpPlugin_Image_Demangle_Pixel_Dim( FUNC, INPUT, unsigned short, D ); \
+ if( r != "" ) r = cpPlugin_Image_Demangle_Pixel_Dim( FUNC, INPUT, unsigned int, D ); \
+ if( r != "" ) r = cpPlugin_Image_Demangle_Pixel_Dim( FUNC, INPUT, unsigned long, D )
+
#define cpPlugin_Image_Demangle_Pixel_AllScalars( r, FUNC, INPUT, D ) \
r = cpPlugin_Image_Demangle_Pixel_Dim( FUNC, INPUT, char, D ); \
if( r != "" ) r = cpPlugin_Image_Demangle_Pixel_Dim( FUNC, INPUT, short, D ); \
this->m_VTKObject = mesh;
// Copy points
- /* TODO
- _TMesh::Pointer imesh = _TMesh::New( );
- double point[ 3 ];
- for( long i = 0; i < mesh->GetNumberOfPoints( ); ++i )
- {
- mesh->GetPoint( i, point );
- _TMesh::PointType ipoint;
- ipoint[ 0 ] = point[ 0 ];
- ipoint[ 1 ] = point[ 1 ];
- ipoint[ 2 ] = point[ 2 ];
- imesh->SetPoint( i, ipoint );
-
- } // rof
-
- // Copy cells
- for( long i = 0; i < mesh->GetNumberOfCells( ); ++i )
- {
- auto cell = mesh->GetCell( i );
- long nPoints = cell->GetNumberOfPoints( );
- _TCellAutoPointer icell;
- if( nPoints == 2 )
- {
- icell.TakeOwnership( new _TLine );
- icell->SetPointId( 0, cell->GetPointId( 0 ) );
- icell->SetPointId( 1, cell->GetPointId( 1 ) );
- }
- else if( nPoints == 3 )
- {
- icell.TakeOwnership( new _TTriangle );
- icell->SetPointId( 0, cell->GetPointId( 0 ) );
- icell->SetPointId( 1, cell->GetPointId( 1 ) );
- icell->SetPointId( 2, cell->GetPointId( 2 ) );
- }
- else if( nPoints > 3 )
- {
- _TPolygon* polygon = new _TPolygon( );
- for( long j = 0; j < nPoints; ++j )
- polygon->AddPointId( cell->GetPointId( j ) );
- icell.TakeOwnership( polygon );
-
- } // fi
- imesh->SetCell( imesh->GetNumberOfCells( ), icell );
-
- } // rof
-
- this->m_ITKObject = imesh;
- */
- this->m_ITKObject = NULL; // TODO: replace this
+ _TMesh::Pointer imesh = _TMesh::New( );
+ double point[ 3 ];
+ for( long i = 0; i < mesh->GetNumberOfPoints( ); ++i )
+ {
+ mesh->GetPoint( i, point );
+ _TMesh::PointType ipoint;
+ ipoint[ 0 ] = point[ 0 ];
+ ipoint[ 1 ] = point[ 1 ];
+ ipoint[ 2 ] = point[ 2 ];
+ imesh->SetPoint( i, ipoint );
+
+ } // rof
+
+ // Copy cells
+ for( long i = 0; i < mesh->GetNumberOfCells( ); ++i )
+ {
+ auto cell = mesh->GetCell( i );
+ long nPoints = cell->GetNumberOfPoints( );
+ _TCellAutoPointer icell;
+ if( nPoints == 2 )
+ {
+ icell.TakeOwnership( new _TLine );
+ icell->SetPointId( 0, cell->GetPointId( 0 ) );
+ icell->SetPointId( 1, cell->GetPointId( 1 ) );
+ }
+ else if( nPoints == 3 )
+ {
+ icell.TakeOwnership( new _TTriangle );
+ icell->SetPointId( 0, cell->GetPointId( 0 ) );
+ icell->SetPointId( 1, cell->GetPointId( 1 ) );
+ icell->SetPointId( 2, cell->GetPointId( 2 ) );
+ }
+ else if( nPoints > 3 )
+ {
+ _TPolygon* polygon = new _TPolygon( );
+ for( long j = 0; j < nPoints; ++j )
+ polygon->AddPointId( cell->GetPointId( j ) );
+ icell.TakeOwnership( polygon );
+
+ } // fi
+ imesh->SetCell( imesh->GetNumberOfCells( ), icell );
+
+ } // rof
+ this->m_ITKObject = imesh;
this->Modified( );
} // fi
c itk::SimpleDataObjectDecorator< itk::@{CovariantVector;Point;Vector}< #floats, #dims > >
c itk::SimpleDataObjectDecorator< itk::Matrix< #floats, #dims, #dims > >
c itk::VectorContainer< unsigned long, itk::Point< #floats, #dims > >
-c itk::BoundingBox< unsigned long, #dims, #floats, itk::VectorContainer< unsigned long, itk::Point< #floats, #dims > > >
+
+d #bb_in=#floats
+d #bb_out=#floats
+
+c itk::BoundingBox< unsigned long, #dims, #bb_in, itk::VectorContainer< unsigned long, itk::Point< #bb_out, #dims > > >
* eof - $RCSfile$
--- /dev/null
+f cpPlugins_Instances/ScalarImagesBaseFilters.h
+
+d #filters=And;Or
+
+i itk{#filters}ImageFilter.h
+t itkBinaryFunctorImageFilter.h
+
+d #dims=1;2;3;4
+d #int=char;short;int;long
+d #scalar=#int;unsigned #int
+
+c itk::{#filters}ImageFilter< itk::Image< #scalar, #dims >, itk::Image< #scalar, #dims > >
+
+* eof - $RCSfile$
)
cpPlugins_WrapInstances(ScalarImagesBaseFilters ${arg} ${pfx}ScalarImages)
cpPlugins_WrapInstances(ScalarVectorImagesBaseFilters ${arg} ${pfx}ScalarImages ${pfx}VectorImages)
+cpPlugins_WrapInstances(BitwiseImageFilters ${arg} ${pfx}ScalarImagesBaseFilters ${pfx}Decorators)
cpPlugins_WrapInstances(ThresholdFilters ${arg} ${pfx}ScalarImagesBaseFilters)
cpPlugins_WrapInstances(ImageMeshFilters ${arg} ${pfx}ScalarImagesBaseFilters ${pfx}Mesh)
cpPlugins_WrapInstances(ResamplingFilters ${arg} ${pfx}ScalarImagesBaseFilters ${pfx}Transforms)
${pfx}ImagesIO
${pfx}ScalarImagesBaseFilters
${pfx}ScalarVectorImagesBaseFilters
+ ${pfx}BitwiseImageFilters
${pfx}ThresholdFilters
${pfx}ImageMeshFilters
${pfx}ResamplingFilters
t itkMapContainer.h
t itkVectorContainer.h
t itkLineCell.h
+t itkPolygonCell.h
t itkTriangleCell.h
t itkVertexCell.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::VertexCell;itk::LineCell;itk::TriangleCell}< 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::@{VertexCell;LineCell;TriangleCell;PolygonCell}< 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 >
c itk::MeshSource< itk::Mesh< #float, #dims > >
SUBDIRS(
+ cpPluginsGenericFilters
cpPluginsIO
cpPluginsImageFilters
cpPluginsMeshFilters
--- /dev/null
+SET(lib_NAME cpPluginsGenericFilters)
+FILE(GLOB lib_HEADERS "${CMAKE_CURRENT_SOURCE_DIR}/*.h")
+FILE(GLOB lib_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/*.cxx")
+SET(lib_OTHER_SOURCES "")
+SET(lib_QT4_HEADERS "")
+
+cpPlugins_WrapPlugins(
+ ${lib_NAME} ${prj_VER} ${prj_sVER}
+ "${lib_HEADERS}"
+ "${lib_SOURCES}"
+ "${lib_OTHER_SOURCES}"
+ "${lib_QT4_HEADERS}"
+ cpPlugins ${cpPlugins_LIBRARIES}
+ )
+
+## ========================
+## -- Installation rules --
+## ========================
+
+#INSTALL(
+# TARGETS ${lib_NAME}
+# RUNTIME DESTINATION bin
+# LIBRARY DESTINATION lib
+# ARCHIVE DESTINATION lib/static
+# )
+
+## eof - $RCSfile$
--- /dev/null
+#include <cpPluginsGenericFilters/JoinBoundingBoxes.h>
+#include <cpPlugins/DataObject.h>
+#include <cpPlugins/BoundingBox.h>
+
+// -------------------------------------------------------------------------
+cpPluginsGenericFilters::JoinBoundingBoxes::
+JoinBoundingBoxes( )
+ : Superclass( )
+{
+ this->_AddInput( "Input0" );
+ this->_AddInput( "Input1", false );
+ this->_AddInput( "Input2", false );
+ this->_AddInput( "Input3", false );
+ this->_AddInput( "Input4", false );
+ this->_AddInput( "Input5", false );
+ this->_AddOutput< cpPlugins::BoundingBox >( "Output" );
+}
+
+// -------------------------------------------------------------------------
+cpPluginsGenericFilters::JoinBoundingBoxes::
+~JoinBoundingBoxes( )
+{
+}
+
+// -------------------------------------------------------------------------
+std::string cpPluginsGenericFilters::JoinBoundingBoxes::
+_GenerateData( )
+{
+ typedef cpPlugins::DataObject _TDO;
+ typedef cpPlugins::BoundingBox _TBB;
+ _TDO* dobjs[ 5 ];
+
+ auto do0 = dynamic_cast< _TDO* >( this->GetInputData( "Input0" ) );
+ dobjs[ 0 ] = dynamic_cast< _TDO* >( this->GetInputData( "Input1" ) );
+ dobjs[ 1 ] = dynamic_cast< _TDO* >( this->GetInputData( "Input2" ) );
+ dobjs[ 2 ] = dynamic_cast< _TDO* >( this->GetInputData( "Input3" ) );
+ dobjs[ 3 ] = dynamic_cast< _TDO* >( this->GetInputData( "Input4" ) );
+ dobjs[ 4 ] = dynamic_cast< _TDO* >( this->GetInputData( "Input5" ) );
+ auto out = dynamic_cast< _TBB* >( this->GetOutputData( "Output" ) );
+
+ out->SetDataObject( do0 );
+ for( unsigned int d = 0; d < 5; ++d )
+ {
+ if( dobjs[ d ] != NULL )
+ {
+ typename _TBB::Pointer bb = _TBB::New( );
+ bb->SetDataObject( dobjs[ d ] );
+ out->Blend( bb );
+
+ } // fi
+
+ } // rof
+ return( "" );
+}
+
+// eof - $RCSfile$
--- /dev/null
+#ifndef __CPPLUGINSGENERICFILTERS__JOINBOUNDINGBOXES__H__
+#define __CPPLUGINSGENERICFILTERS__JOINBOUNDINGBOXES__H__
+
+#include <cpPluginsGenericFilters/cpPluginsGenericFilters_Export.h>
+#include <cpPlugins/ProcessObject.h>
+
+namespace cpPluginsGenericFilters
+{
+ /**
+ */
+ class cpPluginsGenericFilters_EXPORT JoinBoundingBoxes
+ : public cpPlugins::ProcessObject
+ {
+ public:
+ typedef JoinBoundingBoxes Self;
+ typedef cpPlugins::ProcessObject Superclass;
+ typedef itk::SmartPointer< Self > Pointer;
+ typedef itk::SmartPointer< const Self > ConstPointer;
+
+ public:
+ itkNewMacro( Self );
+ itkTypeMacro( JoinBoundingBoxes, cpPlugins::ProcessObject );
+ cpPlugins_Id_Macro( JoinBoundingBoxes, GenericFilters );
+
+ protected:
+ JoinBoundingBoxes( );
+ virtual ~JoinBoundingBoxes( );
+
+ virtual std::string _GenerateData( ) ITK_OVERRIDE;
+
+ private:
+ // Purposely not implemented
+ JoinBoundingBoxes( const Self& );
+ Self& operator=( const Self& );
+ };
+
+} // ecapseman
+
+#endif // __CPPLUGINSGENERICFILTERS__JOINBOUNDINGBOXES__H__
+
+// eof - $RCSfile$
--- /dev/null
+#include <cpPluginsImageFilters/AndImageFilter.h>
+#include <cpPlugins/Image.h>
+#include <cpPlugins_Instances/BitwiseImageFilters.h>
+
+// -------------------------------------------------------------------------
+cpPluginsImageFilters::AndImageFilter::
+AndImageFilter( )
+ : Superclass( )
+{
+ this->_AddInput( "Input0" );
+ this->_AddInput( "Input1" );
+ this->_AddOutput< cpPlugins::Image >( "Output" );
+}
+
+// -------------------------------------------------------------------------
+cpPluginsImageFilters::AndImageFilter::
+~AndImageFilter( )
+{
+}
+
+// -------------------------------------------------------------------------
+std::string cpPluginsImageFilters::AndImageFilter::
+_GenerateData( )
+{
+ auto image = this->GetInputData( "Input0" )->GetITK< itk::DataObject >( );
+ std::string cpPlugin_Image_Demangle_Pixel_AllInts( r, _GD0, image, 2 );
+ if( r != "" ) cpPlugin_Image_Demangle_Pixel_AllInts( r, _GD0, image, 3 );
+ if( r != "" ) cpPlugin_Image_Demangle_Pixel_AllInts( r, _GD0, image, 1 );
+ if( r != "" ) cpPlugin_Image_Demangle_Pixel_AllInts( r, _GD0, image, 4 );
+ return( r );
+}
+
+// -------------------------------------------------------------------------
+template< class _TImage >
+std::string cpPluginsImageFilters::AndImageFilter::
+_GD0( _TImage* image0 )
+{
+ typedef itk::AndImageFilter< _TImage, _TImage > _TFilter;
+ if( image0 != NULL )
+ {
+ auto image1 = this->GetInputData( "Input1" )->GetITK< _TImage >( );
+ if( image1 != NULL )
+ {
+ // Configure filter
+ auto filter = this->_CreateITK< _TFilter >( );
+ filter->SetInput( 0, image0 );
+ filter->SetInput( 1, image1 );
+ filter->Update( );
+
+ // Connect output
+ this->GetOutputData( "Output" )->SetITK( filter->GetOutput( ) );
+ return( "" );
+ }
+ else
+ return(
+ "ImageFilters::AndImageFilter: No valid second input image."
+ );
+ }
+ else
+ return(
+ "ImageFilters::AndImageFilter: No valid first input image."
+ );
+}
+
+// eof - $RCSfile$
--- /dev/null
+#ifndef __CPPLUGINSIMAGEFILTERS__ANDIMAGEFILTER__H__
+#define __CPPLUGINSIMAGEFILTERS__ANDIMAGEFILTER__H__
+
+#include <plugins/cpPluginsImageFilters/cpPluginsImageFilters_Export.h>
+#include <cpPlugins/ProcessObject.h>
+
+namespace cpPluginsImageFilters
+{
+ /**
+ */
+ class cpPluginsImageFilters_EXPORT AndImageFilter
+ : public cpPlugins::ProcessObject
+ {
+ public:
+ typedef AndImageFilter Self;
+ typedef cpPlugins::ProcessObject Superclass;
+ typedef itk::SmartPointer< Self > Pointer;
+ typedef itk::SmartPointer< const Self > ConstPointer;
+
+ public:
+ itkNewMacro( Self );
+ itkTypeMacro( AndImageFilter, cpPlugins::ProcessObject );
+ cpPlugins_Id_Macro( AndImageFilter, ImageFilters );
+
+ protected:
+ AndImageFilter( );
+ virtual ~AndImageFilter( );
+
+ virtual std::string _GenerateData( ) ITK_OVERRIDE;
+
+ template< class _TImage >
+ inline std::string _GD0( _TImage* image0 );
+
+ private:
+ // Purposely not implemented
+ AndImageFilter( const Self& );
+ Self& operator=( const Self& );
+ };
+
+} // ecapseman
+
+#endif // __CPPLUGINSIMAGEFILTERS__ANDIMAGEFILTER__H__
+
+// eof - $RCSfile$
--- /dev/null
+#include <cpPluginsImageFilters/OrImageFilter.h>
+#include <cpPlugins/Image.h>
+#include <cpPlugins_Instances/BitwiseImageFilters.h>
+
+// -------------------------------------------------------------------------
+cpPluginsImageFilters::OrImageFilter::
+OrImageFilter( )
+ : Superclass( )
+{
+ this->_AddInput( "Input0" );
+ this->_AddInput( "Input1" );
+ this->_AddOutput< cpPlugins::Image >( "Output" );
+}
+
+// -------------------------------------------------------------------------
+cpPluginsImageFilters::OrImageFilter::
+~OrImageFilter( )
+{
+}
+
+// -------------------------------------------------------------------------
+std::string cpPluginsImageFilters::OrImageFilter::
+_GenerateData( )
+{
+ auto image = this->GetInputData( "Input0" )->GetITK< itk::DataObject >( );
+ std::string cpPlugin_Image_Demangle_Pixel_AllInts( r, _GD0, image, 2 );
+ if( r != "" ) cpPlugin_Image_Demangle_Pixel_AllInts( r, _GD0, image, 3 );
+ if( r != "" ) cpPlugin_Image_Demangle_Pixel_AllInts( r, _GD0, image, 1 );
+ if( r != "" ) cpPlugin_Image_Demangle_Pixel_AllInts( r, _GD0, image, 4 );
+ return( r );
+}
+
+// -------------------------------------------------------------------------
+template< class _TImage >
+std::string cpPluginsImageFilters::OrImageFilter::
+_GD0( _TImage* image0 )
+{
+ typedef itk::OrImageFilter< _TImage, _TImage > _TFilter;
+ if( image0 != NULL )
+ {
+ auto image1 = this->GetInputData( "Input1" )->GetITK< _TImage >( );
+ if( image1 != NULL )
+ {
+ // Configure filter
+ auto filter = this->_CreateITK< _TFilter >( );
+ filter->SetInput( 0, image0 );
+ filter->SetInput( 1, image1 );
+ filter->Update( );
+
+ // Connect output
+ this->GetOutputData( "Output" )->SetITK( filter->GetOutput( ) );
+ return( "" );
+ }
+ else
+ return(
+ "ImageFilters::OrImageFilter: No valid second input image."
+ );
+ }
+ else
+ return(
+ "ImageFilters::OrImageFilter: No valid first input image."
+ );
+}
+
+// eof - $RCSfile$
--- /dev/null
+#ifndef __CPPLUGINSIMAGEFILTERS__ORIMAGEFILTER__H__
+#define __CPPLUGINSIMAGEFILTERS__ORIMAGEFILTER__H__
+
+#include <plugins/cpPluginsImageFilters/cpPluginsImageFilters_Export.h>
+#include <cpPlugins/ProcessObject.h>
+
+namespace cpPluginsImageFilters
+{
+ /**
+ */
+ class cpPluginsImageFilters_EXPORT OrImageFilter
+ : public cpPlugins::ProcessObject
+ {
+ public:
+ typedef OrImageFilter Self;
+ typedef cpPlugins::ProcessObject Superclass;
+ typedef itk::SmartPointer< Self > Pointer;
+ typedef itk::SmartPointer< const Self > ConstPointer;
+
+ public:
+ itkNewMacro( Self );
+ itkTypeMacro( OrImageFilter, cpPlugins::ProcessObject );
+ cpPlugins_Id_Macro( OrImageFilter, ImageFilters );
+
+ protected:
+ OrImageFilter( );
+ virtual ~OrImageFilter( );
+
+ virtual std::string _GenerateData( ) ITK_OVERRIDE;
+
+ template< class _TImage >
+ inline std::string _GD0( _TImage* image0 );
+
+ private:
+ // Purposely not implemented
+ OrImageFilter( const Self& );
+ Self& operator=( const Self& );
+ };
+
+} // ecapseman
+
+#endif // __CPPLUGINSIMAGEFILTERS__ORIMAGEFILTER__H__
+
+// eof - $RCSfile$
#include <cpPluginsImageMeshFilters/TriangleMeshToBinaryImageFilter.h>
+#include <cpPlugins/BoundingBox.h>
#include <cpPlugins/Image.h>
#include <cpPlugins/Mesh.h>
: Superclass( )
{
this->_AddInput( "Input" );
+ this->_AddInput( "BoundingBox", false );
this->_AddOutput< cpPlugins::Image >( "Output" );
this->m_Parameters.ConfigureAsUint( "InsideValue" );
std::string cpPluginsImageMeshFilters::TriangleMeshToBinaryImageFilter::
_GD1( _TMesh* mesh )
{
+ typedef cpPlugins::BoundingBox _TBB;
typedef itk::Image< _TPixel, _TMesh::PointDimension > _TImage;
typedef itk::TriangleMeshToBinaryImageFilter< _TMesh, _TImage > _TFilter;
+ typedef typename _TImage::PointType _TPoint;
static const unsigned int PAD = 10;
_TFilter* filter = this->_CreateITK< _TFilter >( );
- auto bb = mesh->GetBoundingBox( );
- auto minBB = bb->GetMinimum( );
- auto maxBB = bb->GetMaximum( );
+ auto in_bb = dynamic_cast< _TBB* >( this->GetInputData( "BoundingBox" ) );
+ _TPoint minBB, maxBB;
+ if( in_bb == NULL )
+ {
+ auto bb = mesh->GetBoundingBox( );
+ minBB = bb->GetMinimum( );
+ maxBB = bb->GetMaximum( );
+ }
+ else
+ {
+ minBB = in_bb->GetMinimum< _TPoint >( );
+ maxBB = in_bb->GetMaximum< _TPoint >( );
+
+ } // fi
double lx = double( maxBB[ 0 ] - minBB[ 0 ] );
double ly = double( maxBB[ 1 ] - minBB[ 1 ] );
{
auto m0 = this->GetInputData( "Input0" )->GetVTK< vtkPolyData >( );
auto m1 = this->GetInputData( "Input1" )->GetVTK< vtkPolyData >( );
- auto m2 = this->GetInputData( "Input2" )->GetVTK< vtkPolyData >( );
- auto m3 = this->GetInputData( "Input3" )->GetVTK< vtkPolyData >( );
- auto m4 = this->GetInputData( "Input4" )->GetVTK< vtkPolyData >( );
- auto m5 = this->GetInputData( "Input5" )->GetVTK< vtkPolyData >( );
+ auto m2 = this->GetInputData( "Input2" );
+ auto m3 = this->GetInputData( "Input3" );
+ auto m4 = this->GetInputData( "Input4" );
+ auto m5 = this->GetInputData( "Input5" );
auto filter = this->_CreateVTK< vtkAppendPolyData >( );
filter->AddInputData( m0 );
filter->AddInputData( m1 );
- if( m2 != NULL ) filter->AddInputData( m2 );
- if( m3 != NULL ) filter->AddInputData( m3 );
- if( m4 != NULL ) filter->AddInputData( m4 );
- if( m5 != NULL ) filter->AddInputData( m5 );
+ if( m2 != NULL ) filter->AddInputData( m2->GetVTK< vtkPolyData >( ) );
+ if( m3 != NULL ) filter->AddInputData( m3->GetVTK< vtkPolyData >( ) );
+ if( m4 != NULL ) filter->AddInputData( m4->GetVTK< vtkPolyData >( ) );
+ if( m5 != NULL ) filter->AddInputData( m5->GetVTK< vtkPolyData >( ) );
filter->Update( );
this->GetOutputData( "Output" )->SetVTK( filter->GetOutput( ) );