--- /dev/null
+#ifndef __CPEXTENSIONS__DATASTRUCTURES__IMAGEINDEXESCONTAINER__H__
+#define __CPEXTENSIONS__DATASTRUCTURES__IMAGEINDEXESCONTAINER__H__
+
+#include <vector>
+#include <itkImageBase.h>
+#include <itkSimpleDataObjectDecorator.h>
+
+namespace cpExtensions
+{
+ namespace DataStructures
+ {
+ /**
+ */
+ template< unsigned int _NDim >
+ class ImageIndexesContainer
+ : public itk::SimpleDataObjectDecorator< std::vector< itk::Index< _NDim > > >
+ {
+ public:
+ typedef itk::Index< _NDim > TIndex;
+ typedef std::vector< TIndex > TContainer;
+ typedef itk::SimpleDataObjectDecorator< TContainer > Superclass;
+
+ typedef ImageIndexesContainer Self;
+ typedef itk::SmartPointer< Self > Pointer;
+ typedef itk::SmartPointer< const Self > ConstPointer;
+
+ typedef itk::ImageBase< _NDim > TImageBase;
+
+ public:
+ itkNewMacro( Self );
+ itkTypeMacro( ImageIndexesContainer, itk::SimpleDataObjectDecorator );
+
+ public:
+ TImageBase* GetReferenceImage( )
+ { return( this->m_ReferenceImage ); }
+ const TImageBase* GetReferenceImage( ) const
+ { return( this->m_ReferenceImage ); }
+ void SetReferenceImage( const TImageBase* image )
+ {
+ this->m_ReferenceImage = TImageBase::New( );
+ this->m_ReferenceImage->SetDirection( image->GetDirection( ) );
+ this->m_ReferenceImage->SetOrigin( image->GetOrigin( ) );
+ this->m_ReferenceImage->SetSpacing( image->GetSpacing( ) );
+ this->Modified( );
+ }
+
+ protected:
+ ImageIndexesContainer( ) { }
+ virtual ~ImageIndexesContainer( ) { }
+
+ private:
+ // Purposely not implemented
+ ImageIndexesContainer( const Self& other );
+ Self& operator=( const Self& other );
+
+ protected:
+ typename TImageBase::Pointer m_ReferenceImage;
+ };
+
+ } // ecapseman
+
+} // ecapseman
+
+#endif // __CPEXTENSIONS__DATASTRUCTURES__IMAGEINDEXESCONTAINER__H__
+
+// eof - $RCSfile$
-#ifndef __CPEXTENSIONS__VISUALIZATION__INDEXESTOPOLYDATA__H__
-#define __CPEXTENSIONS__VISUALIZATION__INDEXESTOPOLYDATA__H__
+#ifndef __CPEXTENSIONS__VISUALIZATION__IMAGEINDEXESCONTAINERTOPOLYDATA__H__
+#define __CPEXTENSIONS__VISUALIZATION__IMAGEINDEXESCONTAINERTOPOLYDATA__H__
#include <vtkPolyDataAlgorithm.h>
#include <itkImageBase.h>
/**
*/
template< class _TIndexes >
- class IndexesToPolyData
+ class ImageIndexesContainerToPolyData
: public vtkPolyDataAlgorithm
{
public:
- typedef IndexesToPolyData Self;
+ typedef ImageIndexesContainerToPolyData Self;
typedef _TIndexes TIndexes;
typedef typename TIndexes::ComponentType TContainer;
typedef itk::ImageBase< TIndex::Dimension > TImage;
public:
- vtkTypeMacro( IndexesToPolyData, vtkPolyDataAlgorithm );
+ vtkTypeMacro( ImageIndexesContainerToPolyData, vtkPolyDataAlgorithm );
public:
static Self* New( );
void SetReferenceImage( const TImage* i );
protected:
- IndexesToPolyData( );
- virtual ~IndexesToPolyData( );
+ ImageIndexesContainerToPolyData( );
+ virtual ~ImageIndexesContainerToPolyData( );
int RequestData(
vtkInformation* information,
private:
// Purposely not implemented
- IndexesToPolyData( const Self& );
+ ImageIndexesContainerToPolyData( const Self& );
void operator=( const Self& );
protected:
} // ecapseman
#ifndef ITK_MANUAL_INSTANTIATION
-#include <cpExtensions/Visualization/IndexesToPolyData.hxx>
+#include <cpExtensions/Visualization/ImageIndexesContainerToPolyData.hxx>
#endif // ITK_MANUAL_INSTANTIATION
-#endif // __CPEXTENSIONS__VISUALIZATION__INDEXESTOPOLYDATA__H__
+#endif // __CPEXTENSIONS__VISUALIZATION__IMAGEINDEXESCONTAINERTOPOLYDATA__H__
// eof - $RCSfile$
-#ifndef __CPEXTENSIONS__VISUALIZATION__INDEXESTOPOLYDATA__HXX__
-#define __CPEXTENSIONS__VISUALIZATION__INDEXESTOPOLYDATA__HXX__
+#ifndef __CPEXTENSIONS__VISUALIZATION__IMAGEINDEXESCONTAINERTOPOLYDATA__HXX__
+#define __CPEXTENSIONS__VISUALIZATION__IMAGEINDEXESCONTAINERTOPOLYDATA__HXX__
#include <vtkInformation.h>
#include <vtkInformationVector.h>
// -------------------------------------------------------------------------
template< class _TIndexes >
-typename cpExtensions::Visualization::IndexesToPolyData< _TIndexes >::
-Self* cpExtensions::Visualization::IndexesToPolyData< _TIndexes >::
+typename cpExtensions::Visualization::ImageIndexesContainerToPolyData< _TIndexes >::
+Self* cpExtensions::Visualization::ImageIndexesContainerToPolyData< _TIndexes >::
New( )
{
return( new Self( ) );
// -------------------------------------------------------------------------
template< class _TIndexes >
-const typename cpExtensions::Visualization::IndexesToPolyData< _TIndexes >::
-TIndexes* cpExtensions::Visualization::IndexesToPolyData< _TIndexes >::
+const typename cpExtensions::Visualization::ImageIndexesContainerToPolyData< _TIndexes >::
+TIndexes* cpExtensions::Visualization::ImageIndexesContainerToPolyData< _TIndexes >::
GetInput( ) const
{
return( this->m_Indexes );
// -------------------------------------------------------------------------
template< class _TIndexes >
-const typename cpExtensions::Visualization::IndexesToPolyData< _TIndexes >::
-TImage* cpExtensions::Visualization::IndexesToPolyData< _TIndexes >::
+const typename cpExtensions::Visualization::ImageIndexesContainerToPolyData< _TIndexes >::
+TImage* cpExtensions::Visualization::ImageIndexesContainerToPolyData< _TIndexes >::
GetReferenceImage( ) const
{
return( this->m_ReferenceImage );
// -------------------------------------------------------------------------
template< class _TIndexes >
-void cpExtensions::Visualization::IndexesToPolyData< _TIndexes >::
-SetInput( const TIndexes* indexes )
+void cpExtensions::Visualization::ImageIndexesContainerToPolyData< _TIndexes >::
+SetInput( const TIndexes* imageindexescontainer )
{
- if( this->m_Indexes != indexes )
+ if( this->m_Indexes != imageindexescontainer )
{
- this->m_Indexes = indexes;
+ this->m_Indexes = imageindexescontainer;
this->Modified( );
} // fi
// -------------------------------------------------------------------------
template< class _TIndexes >
-void cpExtensions::Visualization::IndexesToPolyData< _TIndexes >::
+void cpExtensions::Visualization::ImageIndexesContainerToPolyData< _TIndexes >::
SetReferenceImage( const TImage* i )
{
if( this->m_ReferenceImage != i )
// -------------------------------------------------------------------------
template< class _TIndexes >
-cpExtensions::Visualization::IndexesToPolyData< _TIndexes >::
-IndexesToPolyData( )
+cpExtensions::Visualization::ImageIndexesContainerToPolyData< _TIndexes >::
+ImageIndexesContainerToPolyData( )
: vtkPolyDataAlgorithm( ),
m_Indexes( NULL ),
m_ReferenceImage( NULL )
// -------------------------------------------------------------------------
template< class _TIndexes >
-cpExtensions::Visualization::IndexesToPolyData< _TIndexes >::
-~IndexesToPolyData( )
+cpExtensions::Visualization::ImageIndexesContainerToPolyData< _TIndexes >::
+~ImageIndexesContainerToPolyData( )
{
}
// -------------------------------------------------------------------------
template< class _TIndexes >
-int cpExtensions::Visualization::IndexesToPolyData< _TIndexes >::
+int cpExtensions::Visualization::ImageIndexesContainerToPolyData< _TIndexes >::
RequestData(
vtkInformation* information,
vtkInformationVector** input,
// -------------------------------------------------------------------------
template< class _TIndexes >
int
-cpExtensions::Visualization::IndexesToPolyData< _TIndexes >::
+cpExtensions::Visualization::ImageIndexesContainerToPolyData< _TIndexes >::
RequestInformation(
vtkInformation* information,
vtkInformationVector** input,
return( 1 );
}
-#endif // __CPEXTENSIONS__VISUALIZATION__INDEXESTOPOLYDATA__HXX__
+#endif // __CPEXTENSIONS__VISUALIZATION__IMAGEINDEXESCONTAINERTOPOLYDATA__HXX__
// eof - $RCSfile$
--- /dev/null
+#include <cpPlugins/ImageIndexesContainer.h>
+
+// -------------------------------------------------------------------------
+void cpPlugins::ImageIndexesContainer::
+SetITK( itk::LightObject* o )
+{
+ this->Superclass::SetITK( o );
+ bool s = this->_ITK_2_VTK< 2 >( o );
+ if( !s ) s = this->_ITK_2_VTK< 3 >( o );
+ if( !s )
+ {
+ this->m_VTKObject = NULL;
+ this->m_ITKvVTK = NULL;
+
+ } // fi
+ this->Modified( );
+}
+
+// -------------------------------------------------------------------------
+void cpPlugins::ImageIndexesContainer::
+SetVTK( vtkObjectBase* o )
+{
+ // Do nothing
+}
+
+// -------------------------------------------------------------------------
+cpPlugins::ImageIndexesContainer::
+ImageIndexesContainer( )
+ : Superclass( )
+{
+}
+
+// -------------------------------------------------------------------------
+cpPlugins::ImageIndexesContainer::
+~ImageIndexesContainer( )
+{
+}
+
+// eof - $RCSfile$
--- /dev/null
+#ifndef __CPPLUGINS__IMAGEINDEXESCONTAINER__H__
+#define __CPPLUGINS__IMAGEINDEXESCONTAINER__H__
+
+#include <cpPlugins/DataObject.h>
+
+#include <vtkPolyDataAlgorithm.h>
+#include <vtkSmartPointer.h>
+
+namespace cpPlugins
+{
+ /**
+ */
+ class cpPlugins_EXPORT ImageIndexesContainer
+ : public DataObject
+ {
+ public:
+ typedef ImageIndexesContainer Self;
+ typedef DataObject Superclass;
+ typedef itk::SmartPointer< Self > Pointer;
+ typedef itk::SmartPointer< const Self > ConstPointer;
+
+ public:
+ itkNewMacro( Self );
+ itkTypeMacro( ImageIndexesContainer, DataObject );
+ cpPlugins_Id_Macro( ImageIndexesContainer, Object );
+
+ public:
+ virtual void SetITK( itk::LightObject* o ) ITK_OVERRIDE;
+ virtual void SetVTK( vtkObjectBase* o ) ITK_OVERRIDE;
+
+ protected:
+ ImageIndexesContainer( );
+ virtual ~ImageIndexesContainer( );
+
+ template< unsigned int _NDim >
+ inline bool _ITK_2_VTK( itk::LightObject* o );
+
+ private:
+ // Purposely not implemented
+ ImageIndexesContainer( const Self& );
+ Self& operator=( const Self& );
+
+ protected:
+ vtkSmartPointer< vtkPolyDataAlgorithm > m_ITKvVTK;
+ };
+
+} // ecapseman
+
+#include <cpPlugins/ImageIndexesContainer.hxx>
+
+#endif // __CPPLUGINS__IMAGEINDEXESCONTAINER__H__
+
+// eof - $RCSfile$
--- /dev/null
+#ifndef __CPPLUGINS__IMAGEINDEXESCONTAINER__HXX__
+#define __CPPLUGINS__IMAGEINDEXESCONTAINER__HXX__
+
+#include <cpPlugins_Instances/Path.h>
+
+// -------------------------------------------------------------------------
+template< unsigned int _NDim >
+bool cpPlugins::ImageIndexesContainer::
+_ITK_2_VTK( itk::LightObject* o )
+{
+ typedef
+ cpExtensions::DataStructures::ImageIndexesContainer< _NDim >
+ _TImageIndexesContainer;
+ typedef
+ cpExtensions::Visualization::ImageIndexesContainerToPolyData< _TImageIndexesContainer >
+ _TFilter;
+
+ auto imageindexescontainer = dynamic_cast< _TImageIndexesContainer* >( o );
+ if( imageindexescontainer != NULL )
+ {
+ _TFilter* f = dynamic_cast< _TFilter* >( this->m_ITKvVTK.GetPointer( ) );
+ if( f == NULL )
+ {
+ vtkSmartPointer< _TFilter > nf = _TFilter::New( );
+ this->m_ITKvVTK = nf.GetPointer( );
+ f = nf.GetPointer( );
+
+ } // fi
+ f->SetInput( imageindexescontainer );
+ f->SetReferenceImage( imageindexescontainer->GetReferenceImage( ) );
+ f->Update( );
+
+ // Keep object track
+ this->m_ITKObject = o;
+ this->m_VTKObject = f->GetOutput( );
+ return( true );
+ }
+ else
+ return( false );
+}
+
+#endif // __CPPLUGINS__IMAGEINDEXESCONTAINER__HXX__
+
+// eof - $RCSfile$
f cpPlugins_Instances/Base.h
i cpExtensions/DataStructures/PolyLineParametricPath.h
+i cpExtensions/DataStructures/ImageIndexesContainer.h
t itkPolyLineParametricPath.h
t itkPath.h
t itkParametricPath.h
t itkVectorContainer.h
t cpExtensions/Visualization/PolyLineParametricPathToPolyData.h
+t cpExtensions/Visualization/ImageIndexesContainerToPolyData.h
+t itkSimpleDataObjectDecorator.h
d #dims=2;3
+c itk::SimpleDataObjectDecorator< std::vector< itk::Index< #dims > > >
+
c itk::PolyLineParametricPath< #dims >
+c cpExtensions::DataStructures::ImageIndexesContainer< #dims >
+
c cpExtensions::Visualization::PolyLineParametricPathToPolyData< cpExtensions::DataStructures::PolyLineParametricPath< #dims > >
+c cpExtensions::Visualization::ImageIndexesContainerToPolyData< cpExtensions::DataStructures::ImageIndexesContainer< #dims > >