--- /dev/null
+#include <cpPlugins/DataObjects/BoundingBox.h>
+#include <limits>
+#include <vtkDataSet.h>
+
+// -------------------------------------------------------------------------
+void cpPlugins::DataObjects::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 );
+ this->_UpdateVTK( );
+}
+
+// -------------------------------------------------------------------------
+void cpPlugins::DataObjects::BoundingBox::
+Copy( Self* other )
+{
+ this->m_Points[ 0 ] = other->m_Points[ 0 ];
+ this->m_Points[ 1 ] = other->m_Points[ 1 ];
+ this->Modified( );
+}
+
+// -------------------------------------------------------------------------
+void cpPlugins::DataObjects::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( );
+ this->_UpdateVTK( );
+}
+
+// -------------------------------------------------------------------------
+cpPlugins::DataObjects::BoundingBox::
+BoundingBox( )
+ : Superclass( )
+{
+ this->m_Points[ 0 ].push_back( double( 0 ) );
+ this->m_Points[ 1 ].push_back( double( 0 ) );
+ this->m_Outline = vtkSmartPointer< vtkOutlineSource >::New( );
+ this->_UpdateVTK( );
+}
+
+// -------------------------------------------------------------------------
+cpPlugins::DataObjects::BoundingBox::
+~BoundingBox( )
+{
+}
+
+// -------------------------------------------------------------------------
+void cpPlugins::DataObjects::BoundingBox::
+_UpdateVTK( )
+{
+ auto dobj = this->GetVTK< vtkDataSet >( );
+ if( dobj == NULL )
+ return;
+
+ // Get bounds
+ double bounds[ 6 ];
+ dobj->GetBounds( bounds );
+
+ this->m_Points[ 0 ].clear( );
+ this->m_Points[ 1 ].clear( );
+ this->m_Points[ 0 ].push_back( bounds[ 0 ] );
+ this->m_Points[ 0 ].push_back( bounds[ 2 ] );
+ this->m_Points[ 0 ].push_back( bounds[ 4 ] );
+ this->m_Points[ 1 ].push_back( bounds[ 1 ] );
+ this->m_Points[ 1 ].push_back( bounds[ 3 ] );
+ this->m_Points[ 1 ].push_back( bounds[ 5 ] );
+
+ // Update vtk objects
+ this->m_Outline->SetBounds( bounds );
+ this->m_Outline->Update( );
+ this->m_VTK = this->m_Outline->GetOutput( );
+}
+
+// eof - $RCSfile$
--- /dev/null
+#ifndef __cpPlugins__DataObjects__BoundingBox__h__
+#define __cpPlugins__DataObjects__BoundingBox__h__
+
+#include <vector>
+#include <cpPlugins/BaseObjects/DataObject.h>
+#include <vtkOutlineSource.h>
+#include <vtkSmartPointer.h>
+
+namespace cpPlugins
+{
+ namespace DataObjects
+ {
+ /**
+ */
+ class cpPlugins_EXPORT BoundingBox
+ : public cpPlugins::BaseObjects::DataObject
+ {
+ public:
+ typedef BoundingBox Self;
+ typedef cpPlugins::BaseObjects::DataObject Superclass;
+ typedef itk::SmartPointer< Self > Pointer;
+ typedef itk::SmartPointer< const Self > ConstPointer;
+
+ public:
+ itkNewMacro( Self );
+ itkTypeMacro( BoundingBox, DataObject );
+ cpPlugins_Id_Macro( BoundingBox, Object );
+ cpPlugins_Compatibility_Macro;
+
+ public:
+ void SetDataObject( DataObject* o );
+
+ void Copy( Self* other );
+ void Blend( Self* other );
+
+ template< class _TPoint >
+ inline void SetMinimum( const _TPoint& p )
+ {
+ this->_SetPoint( 0, p );
+ }
+
+ template< class _TPoint >
+ inline void SetMaximum( const _TPoint& p )
+ {
+ this->_SetPoint( 1, p );
+ }
+
+ template< class _TPoint >
+ inline _TPoint GetMinimum( ) const
+ {
+ return( this->_GetPoint< _TPoint >( 0 ) );
+ }
+
+ template< class _TPoint >
+ inline _TPoint GetMaximum( ) const
+ {
+ return( this->_GetPoint< _TPoint >( 1 ) );
+ }
+
+ protected:
+ BoundingBox( );
+ virtual ~BoundingBox( );
+
+ void _UpdateVTK( );
+
+ template< class _TPoint >
+ inline void _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->_UpdateVTK( );
+ this->Modified( );
+ }
+
+ template< class _TPoint >
+ inline _TPoint _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 );
+ }
+
+ private:
+ // Purposely not implemented
+ BoundingBox( const Self& );
+ Self& operator=( const Self& );
+
+ protected:
+ std::vector< double > m_Points[ 2 ];
+ vtkSmartPointer< vtkOutlineSource > m_Outline;
+ };
+
+ } // ecapseman
+
+} // ecapseman
+
+// #include <cpPlugins/DataObjects/BoundingBox.hxx>
+
+#endif // __cpPlugins__DataObjects__BoundingBox__h__
+
+// eof - $RCSfile$
SET(
_dirlist
Extensions
- # AnisotropicDiffusion
- # GenericFilters
- # ImageArithmeticFilters
- # ImageBooleanFilters
- # ImageDistanceMaps
- # ImageGenericFilters
- # ImageGradientFilters
- # ImageMeshFilters
- # ImageSliceFilters
- # ImageSources
- # ImageThresholdFilters
+ AnisotropicDiffusion
+ GenericFilters
+ ImageArithmeticFilters
+ ImageBooleanFilters
+ ImageDistanceMaps
+ ImageGenericFilters
+ ImageGradientFilters
+ ImageMeshFilters
+ ImageSliceFilters
+ ImageSources
+ ImageThresholdFilters
IO
- # MeshFilters
- # MeshSources
+ MeshFilters
+ MeshSources
Widgets
)
--- /dev/null
+#include <Extensions/Simple3DCurve.h>
+#include <cpExtensions/DataStructures/Simple3DCurve.h>
+#include <cpExtensions/Visualization/Simple3DCurveToPolyData.h>
+
+// -------------------------------------------------------------------------
+void cpPluginsExtensions::Simple3DCurve::
+SetITK( itk::LightObject* o )
+{
+ cpPlugins_Demangle_Simple3DCurve_All_1( o, _ITK_2_VTK )
+ {
+ this->m_VTK = NULL;
+ this->m_ITKvVTK = NULL;
+ }
+}
+
+// -------------------------------------------------------------------------
+void cpPluginsExtensions::Simple3DCurve::
+SetVTK( vtkObjectBase* o )
+{
+ // Do nothing
+ this->m_ITK = NULL;
+ this->m_VTK = NULL;
+ this->m_ITKvVTK = NULL;
+}
+
+// -------------------------------------------------------------------------
+cpPluginsExtensions::Simple3DCurve::
+Simple3DCurve( )
+ : Superclass( )
+{
+}
+
+// -------------------------------------------------------------------------
+cpPluginsExtensions::Simple3DCurve::
+~Simple3DCurve( )
+{
+}
+
+// -------------------------------------------------------------------------
+template< class _TSimple3DCurve >
+void cpPluginsExtensions::Simple3DCurve::
+_ITK_2_VTK( _TSimple3DCurve* curve )
+{
+ typedef
+ cpExtensions::Visualization::Simple3DCurveToPolyData< _TSimple3DCurve >
+ _TFilter;
+ _TFilter* f = dynamic_cast< _TFilter* >( this->m_ITKvVTK.GetPointer( ) );
+ if( f == NULL )
+ {
+ _TFilter* nf = _TFilter::New( );
+ this->m_ITKvVTK = nf;
+ f = nf;
+
+ } // fi
+ f->SetInput( curve );
+ f->Update( );
+
+ // Keep object track
+ this->m_ITK = curve;
+ this->m_VTK = f->GetOutput( );
+}
+
+// eof - $RCSfile$
--- /dev/null
+
+All cpExtensions::DataStructures::Simple3DCurve< #real_types# >
+
+** eof - $RCSfile$
--- /dev/null
+#ifndef __cpPluginsExtensions__Simple3DCurve__h__
+#define __cpPluginsExtensions__Simple3DCurve__h__
+
+#include <cpPluginsExtensions_Export.h>
+#include <cpPlugins/BaseObjects/DataObject.h>
+#include <vtkSmartPointer.h>
+#include <Extensions/Simple3DCurve_Demanglers.h>
+
+// -------------------------------------------------------------------------
+class vtkPolyDataAlgorithm;
+
+// -------------------------------------------------------------------------
+namespace cpPluginsExtensions
+{
+ /**
+ */
+ class cpPluginsExtensions_EXPORT Simple3DCurve
+ : public cpPlugins::BaseObjects::DataObject
+ {
+ public:
+ typedef Simple3DCurve Self;
+ typedef cpPlugins::BaseObjects::DataObject Superclass;
+ typedef itk::SmartPointer< Self > Pointer;
+ typedef itk::SmartPointer< const Self > ConstPointer;
+
+ public:
+ itkNewMacro( Self );
+ itkTypeMacro(
+ Simple3DCurve, cpPlugins::BaseObjects::DataObject
+ );
+ cpPlugins_Id_Macro( Simple3DCurve, Object );
+ cpPlugins_Compatibility_Macro;
+
+ public:
+ virtual void SetITK( itk::LightObject* o ) cpPlugins_OVERRIDE;
+ virtual void SetVTK( vtkObjectBase* o ) cpPlugins_OVERRIDE;
+
+ protected:
+ Simple3DCurve( );
+ virtual ~Simple3DCurve( );
+
+ template< class _TSimple3DCurve >
+ inline void _ITK_2_VTK( _TSimple3DCurve* curve );
+
+ private:
+ // Purposely not implemented
+ Simple3DCurve( const Self& );
+ Self& operator=( const Self& );
+
+ protected:
+ vtkSmartPointer< vtkPolyDataAlgorithm > m_ITKvVTK;
+ };
+
+} // ecapseman
+
+#endif // __cpPluginsExtensions__Simple3DCurve__h__
+
+// eof - $RCSfile$
#include <GenericFilters/PolyLineParametricPathToSimple3DCurve.h>
-#include <cpPlugins/DataObjects/PolyLineParametricPath.h>
-#include <cpPlugins/DataObjects/Simple3DCurve.h>
+#include <Extensions/PolyLineParametricPath.h>
+#include <Extensions/Simple3DCurve.h>
#include <cpExtensions/DataStructures/PolyLineParametricPath.h>
#include <cpExtensions/DataStructures/Simple3DCurve.h>
PolyLineParametricPathToSimple3DCurve( )
: Superclass( )
{
- typedef cpPlugins::DataObjects::PolyLineParametricPath _TPath;
- typedef cpPlugins::DataObjects::Simple3DCurve _TCurve;
+ typedef cpPluginsExtensions::PolyLineParametricPath _TPath;
+ typedef cpPluginsExtensions::Simple3DCurve _TCurve;
this->_ConfigureInput< _TPath >( "Input", true, false );
this->_ConfigureOutput< _TCurve >( "Output" );
#include <ImageSliceFilters/CPRImageFilter.h>
#include <cpPlugins/DataObjects/Image.h>
-#include <cpPlugins/DataObjects/Simple3DCurve.h>
-
-#include <cpPlugins/DataObjects/Image_Demanglers.h>
-#include <cpPlugins/DataObjects/Simple3DCurve_Demanglers.h>
+#include <Extensions/Simple3DCurve.h>
#include <itkImage.h>
#include <cpExtensions/DataStructures/Simple3DCurve.h>
CPRImageFilter( )
: Superclass( )
{
- typedef cpPlugins::DataObjects::Image _TImage;
- typedef cpPlugins::DataObjects::Simple3DCurve _TCurve;
+ typedef cpPlugins::DataObjects::Image _TImage;
+ typedef cpPluginsExtensions::Simple3DCurve _TCurve;
this->_ConfigureInput< _TImage >( "Image", true, false );
this->_ConfigureInput< _TCurve >( "Curve", true, false );
this->_ConfigureOutput< _TImage >( "Output" );