range[ 0 ], ( ( range[ 1 ] - range[ 0 ] ) * 0.75 ) + range[ 0 ]
);
this->Actor->SetMapper( this->Mapper );
+ this->Actor->GetProperty( )->SetPointSize( 10 );
this->Actor->DeferLODConstructionOff( );
}
--- /dev/null
+#ifndef __CPEXTENSIONS__VISUALIZATION__INDEXESTOPOLYDATA__H__
+#define __CPEXTENSIONS__VISUALIZATION__INDEXESTOPOLYDATA__H__
+
+#include <vtkPolyDataAlgorithm.h>
+#include <itkImageBase.h>
+
+namespace cpExtensions
+{
+ namespace Visualization
+ {
+ /**
+ */
+ template< class _TIndexes >
+ class IndexesToPolyData
+ : public vtkPolyDataAlgorithm
+ {
+ public:
+ typedef IndexesToPolyData Self;
+
+ typedef _TIndexes TIndexes;
+ typedef typename TIndexes::ComponentType TContainer;
+ typedef typename TContainer::value_type TIndex;
+ typedef itk::ImageBase< TIndex::Dimension > TImage;
+
+ public:
+ vtkTypeMacro( IndexesToPolyData, vtkPolyDataAlgorithm );
+
+ public:
+ static Self* New( );
+
+ const TIndexes* GetInput( ) const;
+ const TImage* GetReferenceImage( ) const;
+ void SetInput( const TIndexes* indexes );
+ void SetReferenceImage( const TImage* i );
+
+ protected:
+ IndexesToPolyData( );
+ virtual ~IndexesToPolyData( );
+
+ int RequestData(
+ vtkInformation* information,
+ vtkInformationVector** input,
+ vtkInformationVector* output
+ );
+ int RequestInformation(
+ vtkInformation* information,
+ vtkInformationVector** input,
+ vtkInformationVector* output
+ );
+
+ private:
+ // Purposely not implemented
+ IndexesToPolyData( const Self& );
+ void operator=( const Self& );
+
+ protected:
+ const TIndexes* m_Indexes;
+ const TImage* m_ReferenceImage;
+ };
+
+ } // ecapseman
+
+} // ecapseman
+
+#ifndef ITK_MANUAL_INSTANTIATION
+#include <cpExtensions/Visualization/IndexesToPolyData.hxx>
+#endif // ITK_MANUAL_INSTANTIATION
+
+#endif // __CPEXTENSIONS__VISUALIZATION__INDEXESTOPOLYDATA__H__
+
+// eof - $RCSfile$
--- /dev/null
+#ifndef __CPEXTENSIONS__VISUALIZATION__INDEXESTOPOLYDATA__HXX__
+#define __CPEXTENSIONS__VISUALIZATION__INDEXESTOPOLYDATA__HXX__
+
+#include <vtkInformation.h>
+#include <vtkInformationVector.h>
+
+// -------------------------------------------------------------------------
+template< class _TIndexes >
+typename cpExtensions::Visualization::IndexesToPolyData< _TIndexes >::
+Self* cpExtensions::Visualization::IndexesToPolyData< _TIndexes >::
+New( )
+{
+ return( new Self( ) );
+}
+
+// -------------------------------------------------------------------------
+template< class _TIndexes >
+const typename cpExtensions::Visualization::IndexesToPolyData< _TIndexes >::
+TIndexes* cpExtensions::Visualization::IndexesToPolyData< _TIndexes >::
+GetInput( ) const
+{
+ return( this->m_Indexes );
+}
+
+// -------------------------------------------------------------------------
+template< class _TIndexes >
+const typename cpExtensions::Visualization::IndexesToPolyData< _TIndexes >::
+TImage* cpExtensions::Visualization::IndexesToPolyData< _TIndexes >::
+GetReferenceImage( ) const
+{
+ return( this->m_ReferenceImage );
+}
+
+// -------------------------------------------------------------------------
+template< class _TIndexes >
+void cpExtensions::Visualization::IndexesToPolyData< _TIndexes >::
+SetInput( const TIndexes* indexes )
+{
+ if( this->m_Indexes != indexes )
+ {
+ this->m_Indexes = indexes;
+ this->Modified( );
+
+ } // fi
+}
+
+// -------------------------------------------------------------------------
+template< class _TIndexes >
+void cpExtensions::Visualization::IndexesToPolyData< _TIndexes >::
+SetReferenceImage( const TImage* i )
+{
+ if( this->m_ReferenceImage != i )
+ {
+ this->m_ReferenceImage = i;
+ this->Modified( );
+
+ } // fi
+}
+
+// -------------------------------------------------------------------------
+template< class _TIndexes >
+cpExtensions::Visualization::IndexesToPolyData< _TIndexes >::
+IndexesToPolyData( )
+ : vtkPolyDataAlgorithm( ),
+ m_Indexes( NULL ),
+ m_ReferenceImage( NULL )
+{
+ this->SetNumberOfInputPorts( 0 );
+}
+
+// -------------------------------------------------------------------------
+template< class _TIndexes >
+cpExtensions::Visualization::IndexesToPolyData< _TIndexes >::
+~IndexesToPolyData( )
+{
+}
+
+// -------------------------------------------------------------------------
+template< class _TIndexes >
+int cpExtensions::Visualization::IndexesToPolyData< _TIndexes >::
+RequestData(
+ vtkInformation* information,
+ vtkInformationVector** input,
+ vtkInformationVector* output
+ )
+{
+ static const unsigned int dim = TIndex::Dimension;
+
+ if( this->m_Indexes == NULL )
+ return( 0 );
+
+ // Get output
+ vtkInformation* info = output->GetInformationObject( 0 );
+ vtkPolyData* out = vtkPolyData::SafeDownCast(
+ info->Get( vtkDataObject::DATA_OBJECT( ) )
+ );
+
+ // Get input data
+ auto& lst = this->m_Indexes->Get( );
+
+ // Prepare points
+ vtkPoints* points = out->GetPoints( );
+ if( points == NULL )
+ {
+ points = vtkPoints::New( );
+ out->SetPoints( points );
+ points->Delete( );
+
+ } // fi
+ points->SetNumberOfPoints( lst.size( ) );
+
+ // Prepare cells
+ vtkSmartPointer< vtkCellArray > verts =
+ vtkSmartPointer< vtkCellArray >::New( );
+
+ for( unsigned int i = 0; i < lst.size( ); ++i )
+ {
+ auto idx = lst[ i ];
+ if( this->m_ReferenceImage != NULL )
+ {
+ typename TImage::PointType pnt;
+ this->m_ReferenceImage->TransformIndexToPhysicalPoint( idx, pnt );
+ if( dim == 1 )
+ points->SetPoint( i, pnt[ 0 ], 0, 0 );
+ else if( dim == 2 )
+ points->SetPoint( i, pnt[ 0 ], pnt[ 1 ], 0 );
+ else
+ points->SetPoint( i, pnt[ 0 ], pnt[ 1 ], pnt[ 2 ] );
+ }
+ else
+ {
+ if( dim == 1 )
+ points->SetPoint( i, idx[ 0 ], 0, 0 );
+ else if( dim == 2 )
+ points->SetPoint( i, idx[ 0 ], idx[ 1 ], 0 );
+ else
+ points->SetPoint( i, idx[ 0 ], idx[ 1 ], idx[ 2 ] );
+
+ } // fi
+ verts->InsertNextCell( 1 );
+ verts->InsertCellPoint( i );
+
+ } // rof
+ out->SetPoints( points );
+ out->SetVerts( verts );
+ return( 1 );
+}
+
+// -------------------------------------------------------------------------
+template< class _TIndexes >
+int
+cpExtensions::Visualization::IndexesToPolyData< _TIndexes >::
+RequestInformation(
+ vtkInformation* information,
+ vtkInformationVector** input,
+ vtkInformationVector* output
+ )
+{
+ vtkInformation* info = output->GetInformationObject( 0 );
+ /* TODO
+ info->Set(
+ vtkStreamingDemandDrivenPipeline::MAXIMUM_NUMBER_OF_PIECES( ), -1
+ );
+ */
+
+ if( this->m_Indexes != NULL && this->m_ReferenceImage != NULL )
+ {
+ /* TODO
+ typename C::TScalar len = this->m_RGC->GetTotalLength( );
+ typename C::TScalar s0 = this->m_RGC->Gets0( );
+ typename C::TPoint p0 = this->m_RGC->Axis( s0 );
+ typename C::TPoint p1 = this->m_RGC->Axis( s0 + len );
+
+ info->Set(
+ vtkStreamingDemandDrivenPipeline::WHOLE_BOUNDING_BOX( ),
+ double( p0[ 0 ] ), double( p1[ 0 ] ),
+ double( p0[ 1 ] ), double( p1[ 1 ] ),
+ double( p0[ 2 ] ), double( p1[ 2 ] )
+ );
+ */
+
+ } // fi
+ return( 1 );
+}
+
+#endif // __CPEXTENSIONS__VISUALIZATION__INDEXESTOPOLYDATA__HXX__
+
+// eof - $RCSfile$
c itk::Point< #5 , #2 >
c itk::Vector< #5 , #2 >
c itk::Matrix< #5 , #2 , #2 >
-c itk::RGBPixel< #1 >
-c itk::RGBAPixel< #1 >
+c #7 < #1 >
c itk::SimpleDataObjectDecorator< #1 >
c itk::SimpleDataObjectDecorator< #3 >
c itk::SimpleDataObjectDecorator< std::vector< itk::Index< #6 > > >
c itk::SimpleDataObjectDecorator< itk::Array< #1 > >
c itk::ConvertPixelBuffer< #1 , #4 , itk::DefaultConvertPixelTraits< #4 > >
c itk::ConvertPixelBuffer< #1 , std::complex< #5 > , itk::DefaultConvertPixelTraits< std::complex< #5 > > >
-c itk::ConvertPixelBuffer< #1 , itk::RGBPixel< #4 > , itk::DefaultConvertPixelTraits< itk::RGBPixel< #4 > > >
-c itk::ConvertPixelBuffer< #1 , itk::RGBAPixel< #4 > , itk::DefaultConvertPixelTraits< itk::RGBAPixel< #4 > > >
+c itk::ConvertPixelBuffer< #1 , #7 < #4 > , itk::DefaultConvertPixelTraits< #7 < #4 > > >
c itk::ImportImageContainer< unsigned long , #1 >
c itk::ImportImageContainer< unsigned long , std::complex< #5 > >
-c itk::ImportImageContainer< unsigned long , itk::RGBPixel< #1 > >
-c itk::ImportImageContainer< unsigned long , itk::RGBAPixel< #1 > >
-c itk::SimpleDataObjectDecorator< std::map< itk::Index< #6 >, std::pair< itk::Index< #6 >, short >, itk::Functor::IndexLexicographicCompare< #6 > > >
+c itk::ImportImageContainer< unsigned long , #7 < #1 > >
a #1 = #integers;#floats
a #2 = #all_dims
a #3 = bool;std::string
a #4 = #integers;#floats
a #5 = #floats
a #6 = #all_visual_dims
+a #7 = itk::RGBPixel;itk::RGBAPixel
i itkImageTransformer.h
c itk::ImageSource< itk::Image< #1 , #2 > >
c itk::ImageSource< itk::Image< std::complex< #3 > , #2 > >
-c itk::ImageSource< itk::Image< itk::RGBPixel< #1 > , #2 > >
-c itk::ImageSource< itk::Image< itk::RGBAPixel< #1 > , #2 > >
+c itk::ImageSource< itk::Image< #5 < #1 > , #2 > >
c itk::ImageToImageFilter< itk::Image< #1 , #2 > , itk::Image< #4 , #2 > >
c itk::InPlaceImageFilter< itk::Image< #1 , #2 > , itk::Image< #4 , #2 > >
c itk::ImageTransformer< itk::Image< #1 , #2 > >
a #2 = #all_dims
a #3 = #floats
a #4 = #integers;#floats
+a #5 = itk::RGBPixel;itk::RGBAPixel
i itkImageLinearIteratorWithIndex.h
i itkImageRegionConstIterator.h
i itkImageRegionIterator.h
+i itkImageRegionConstIteratorWithIndex.h
+i itkImageRegionIteratorWithIndex.h
i itkImageScanlineConstIterator.h
i itkImageScanlineIterator.h
i itkConstNeighborhoodIterator.h
i itkNeighborhoodIterator.h
i itkConstShapedNeighborhoodIterator.h
i itkShapedNeighborhoodIterator.h
-c itk::ImageRegionConstIterator< itk::Image< #1 , #2 > >
-c itk::ImageRegionConstIterator< itk::Image< std::complex< #3 >, #2 > >
-c itk::ImageRegionConstIterator< itk::Image< itk::RGBPixel< #1 > , #2 > >
-c itk::ImageRegionConstIterator< itk::Image< itk::RGBAPixel< #1 > , #2 > >
-c itk::ImageRegionIterator< itk::Image< #1 , #2 > >
-c itk::ImageRegionIterator< itk::Image< std::complex< #3 > , #2 > >
-c itk::ImageRegionIterator< itk::Image< itk::RGBPixel< #1 > , #2 > >
-c itk::ImageRegionIterator< itk::Image< itk::RGBAPixel< #1 > , #2 > >
-c itk::ImageConstIteratorWithIndex< itk::Image< #1 , #2 > >
-c itk::ImageConstIteratorWithIndex< itk::Image< std::complex< #3 > , #2 > >
-c itk::ImageConstIteratorWithIndex< itk::Image< itk::RGBPixel< #1 > , #2 > >
-c itk::ImageConstIteratorWithIndex< itk::Image< itk::RGBAPixel< #1 > , #2 > >
-c itk::ImageIteratorWithIndex< itk::Image< #1 , #2 > >
-c itk::ImageIteratorWithIndex< itk::Image< std::complex< #3 > , #2 > >
-c itk::ImageIteratorWithIndex< itk::Image< itk::RGBPixel< #1 > , #2 > >
-c itk::ImageIteratorWithIndex< itk::Image< itk::RGBAPixel< #1 > , #2 > >
-c itk::ImageLinearConstIteratorWithIndex< itk::Image< #1 , #2 > >
-c itk::ImageLinearConstIteratorWithIndex< itk::Image< std::complex< #3 > , #2 > >
-c itk::ImageLinearConstIteratorWithIndex< itk::Image< itk::RGBPixel< #1 > , #2 > >
-c itk::ImageLinearConstIteratorWithIndex< itk::Image< itk::RGBAPixel< #1 > , #2 > >
-c itk::ImageLinearIteratorWithIndex< itk::Image< #1 , #2 > >
-c itk::ImageLinearIteratorWithIndex< itk::Image< std::complex< #3 > , #2 > >
-c itk::ImageLinearIteratorWithIndex< itk::Image< itk::RGBPixel< #1 > , #2 > >
-c itk::ImageLinearIteratorWithIndex< itk::Image< itk::RGBAPixel< #1 > , #2 > >
-c itk::ImageScanlineConstIterator< itk::Image< #1 , #2 > >
-c itk::ImageScanlineConstIterator< itk::Image< std::complex< #3 > , #2 > >
-c itk::ImageScanlineConstIterator< itk::Image< itk::RGBPixel< #1 > , #2 > >
-c itk::ImageScanlineConstIterator< itk::Image< itk::RGBAPixel< #1 > , #2 > >
-c itk::ImageScanlineIterator< itk::Image< #1 , #2 > >
-c itk::ImageScanlineIterator< itk::Image< std::complex< #3 > , #2 > >
-c itk::ImageScanlineIterator< itk::Image< itk::RGBPixel< #1 > , #2 > >
-c itk::ImageScanlineIterator< itk::Image< itk::RGBAPixel< #1 > , #2 > >
+c #5 < itk::Image< #1 , #2 > >
+c #5 < itk::Image< std::complex< #3 >, #2 > >
+c #5 < itk::Image< itk::RGBPixel< #1 > , #2 > >
+c #5 < itk::Image< itk::RGBAPixel< #1 > , #2 > >
c #4 < itk::Image< #1 , #2 >, itk::Image< #1 , #2 > >
c itk::ConstNeighborhoodIterator< itk::Image< #1 , #2 >, #4 < itk::Image< #1 , #2 >, itk::Image< #1 , #2 > > >
c itk::NeighborhoodIterator< itk::Image< #1 , #2 >, #4 < itk::Image< #1 , #2 >, itk::Image< #1 , #2 > > >
a #2 = #all_dims
a #3 = #floats
a #4 = itk::ZeroFluxNeumannBoundaryCondition
+a #5 = itk::ImageRegionConstIterator;itk::ImageRegionIterator;itk::ImageRegionConstIteratorWithIndex;itk::ImageRegionIteratorWithIndex;itk::ImageConstIteratorWithIndex;itk::ImageIteratorWithIndex;itk::ImageLinearConstIteratorWithIndex;itk::ImageLinearIteratorWithIndex;itk::ImageScanlineConstIterator;itk::ImageScanlineIterator
c itk::ImageRegion< #2 >
c itk::Image< #1 , #2 >
c itk::Image< std::complex< #4 > , #2 >
-c itk::Image< itk::RGBPixel< #1 > , #2 >
-c itk::Image< itk::RGBAPixel< #1 > , #2 >
+c itk::Image< #6 < #1 > , #2 >
c itk::ImageToVTKImageFilter< itk::Image< #1 , #3 > >
-c itk::ImageToVTKImageFilter< itk::Image< itk::RGBPixel< #1 > , #3 > >
-c itk::ImageToVTKImageFilter< itk::Image< itk::RGBAPixel< #1 > , #3 > >
+c itk::ImageToVTKImageFilter< itk::Image< #6 < #1 > , #3 > >
a #1 = #integers;#floats
a #2 = #all_dims
a #3 = #all_visual_dims
a #4 = #floats
a #5 = #integers_ptr;#floats_ptr
+a #6 = itk::RGBPixel;itk::RGBAPixel
c itk::VectorContainer< unsigned long, itk::Point< #1 , #2 > >
c itk::MapContainer< unsigned long , itk::QuadEdgeMeshPoint< #1 , #2 , itk::GeometricalQuadEdge< unsigned long, unsigned long, bool, bool, true > > >
c itk::PointSet< #1 , #2 >
-c itk::Mesh< #1 , #2 >
-c itk::QuadEdgeMesh< #1 , #2 >
+c #4 < #1 , #2 >
c #3 < itk::CellInterface< #1 , itk::CellTraitsInfo< #2 , float , float , unsigned long , unsigned long , unsigned long , itk::Point< float , #2 > , itk::VectorContainer< unsigned long , itk::Point< float , #2 > > , std::set< unsigned long , std::less< unsigned long > , std::allocator< unsigned long > > > > >
a #1 = #floats
a #2 = #all_visual_dims
a #3 = itk::LineCell;itk::PolygonCell;itk::TriangleCell
+a #4 = itk::Mesh;itk::QuadEdgeMesh
--- /dev/null
+#include <cpPluginsVisualization/IndexesToPolyData.h>
+#include <cpPlugins/Image.h>
+#include <cpPlugins/Mesh.h>
+
+#include <cpExtensions/Visualization/IndexesToPolyData.h>
+#include <cpExtensions/Visualization/IndexesToPolyData.hxx>
+
+// -------------------------------------------------------------------------
+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$
--- /dev/null
+#ifndef __CPPLUGINSVISUALIZATION__INDEXESTOPOLYDATA__H__
+#define __CPPLUGINSVISUALIZATION__INDEXESTOPOLYDATA__H__
+
+#include <plugins/cpPluginsVisualization/cpPluginsVisualization_Export.h>
+#include <cpPlugins/ProcessObject.h>
+
+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( );
+
+ 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$