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 double point[ 3 ] = { double( 0 ) };
16 this->m_Parameters->ConfigureAsPoint( "Center", 3, point );
17 this->m_Parameters->ConfigureAsReal( "Radius", 1 );
18 this->m_Parameters->ConfigureAsUint( "PhiResolution", 8 );
19 this->m_Parameters->ConfigureAsUint( "ThetaResolution", 8 );
22 // -------------------------------------------------------------------------
23 cpPlugins::BasicFilters::SphereMeshSource::
28 // -------------------------------------------------------------------------
29 std::string cpPlugins::BasicFilters::SphereMeshSource::
32 itk::Point< double, 3 > center =
33 this->m_Parameters->GetPoint< itk::Point< double, 3 > >( "Center", 3 );
34 // TODO: center.Fill( double( 0 ) ); // TODO
35 double radius = this->m_Parameters->GetReal( "Radius" );
36 unsigned int phi = this->m_Parameters->GetUint( "PhiResolution" );
37 unsigned int theta = this->m_Parameters->GetUint( "ThetaResolution" );
39 vtkSphereSource* src = this->_CreateVTK< vtkSphereSource >( );
40 src->SetCenter( center[ 0 ], center[ 1 ], center[ 2 ] );
41 src->SetRadius( radius );
42 src->SetPhiResolution( phi );
43 src->SetThetaResolution( theta );
47 cpPlugins::Interface::Mesh* out =
48 this->GetOutput< cpPlugins::Interface::Mesh >( "Output" );
49 out->SetVTK( src->GetOutput( ) );