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->_MakeOutput< cpPlugins::Interface::Mesh >( "Output" );
15 this->m_Parameters->ConfigureAsPoint( "Center" );
16 this->m_Parameters->ConfigureAsReal( "Radius" );
17 this->m_Parameters->ConfigureAsUint( "PhiResolution" );
18 this->m_Parameters->ConfigureAsUint( "ThetaResolution" );
20 this->m_Parameters->SetReal( "Radius", 1 );
21 this->m_Parameters->SetUint( "PhiResolution", 8 );
22 this->m_Parameters->SetUint( "ThetaResolution", 8 );
25 // -------------------------------------------------------------------------
26 cpPlugins::BasicFilters::SphereMeshSource::
31 // -------------------------------------------------------------------------
32 std::string cpPlugins::BasicFilters::SphereMeshSource::
35 itk::Point< double, 3 > center =
36 this->m_Parameters->GetPoint< itk::Point< double, 3 > >( "Center", 3 );
37 // TODO: center.Fill( double( 0 ) ); // TODO
38 double radius = this->m_Parameters->GetReal( "Radius" );
39 unsigned int phi = this->m_Parameters->GetUint( "PhiResolution" );
40 unsigned int theta = this->m_Parameters->GetUint( "ThetaResolution" );
42 vtkSphereSource* src = this->_CreateVTK< vtkSphereSource >( );
43 src->SetCenter( center[ 0 ], center[ 1 ], center[ 2 ] );
44 src->SetRadius( radius );
45 src->SetPhiResolution( phi );
46 src->SetThetaResolution( theta );
50 cpPlugins::Interface::Mesh* out =
51 this->GetOutput< cpPlugins::Interface::Mesh >( "Output" );
52 out->SetVTK( src->GetOutput( ) );