1 #include "SphereMeshSource.h"
2 #include <cpPlugins/Interface/Image.h>
3 #include <cpPlugins/Interface/Mesh.h>
5 #include <vtkSphereSource.h>
8 // -------------------------------------------------------------------------
9 cpPlugins::BasicFilters::SphereMeshSource::
13 this->SetNumberOfInputs( 0 );
14 this->SetNumberOfOutputs( 1 );
15 this->_MakeOutput< cpPlugins::Interface::Mesh >( 0 );
17 double point[ 3 ] = { double( 0 ) };
18 this->m_Parameters->ConfigureAsPoint( "Center", 3, point );
19 this->m_Parameters->ConfigureAsReal( "Radius", 1 );
20 this->m_Parameters->ConfigureAsUint( "PhiResolution", 8 );
21 this->m_Parameters->ConfigureAsUint( "ThetaResolution", 8 );
24 // -------------------------------------------------------------------------
25 cpPlugins::BasicFilters::SphereMeshSource::
30 // -------------------------------------------------------------------------
31 std::string cpPlugins::BasicFilters::SphereMeshSource::
34 itk::Point< double, 3 > center =
35 this->m_Parameters->GetPoint< itk::Point< double, 3 > >( "Center", 3 );
36 // TODO: center.Fill( double( 0 ) ); // TODO
37 double radius = this->m_Parameters->GetReal( "Radius" );
38 unsigned int phi = this->m_Parameters->GetUint( "PhiResolution" );
39 unsigned int theta = this->m_Parameters->GetUint( "ThetaResolution" );
41 vtkSphereSource* src = this->_CreateVTK< vtkSphereSource >( );
42 src->SetCenter( center[ 0 ], center[ 1 ], center[ 2 ] );
43 src->SetRadius( radius );
44 src->SetPhiResolution( phi );
45 src->SetThetaResolution( theta );
49 cpPlugins::Interface::Mesh* out =
50 this->GetOutput< cpPlugins::Interface::Mesh >( 0 );
51 out->SetVTK( src->GetOutput( ) );