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 using namespace cpPlugins::Interface;
18 this->m_DefaultParameters.Configure( Parameters::Point, "Center" );
19 this->m_DefaultParameters.Configure( Parameters::Real, "Radius" );
20 this->m_DefaultParameters.Configure( Parameters::Uint, "PhiResolution" );
21 this->m_DefaultParameters.Configure( Parameters::Uint, "ThetaResolution" );
22 this->m_DefaultParameters.SetValueAsPoint( "Center", 3, 0, 0, 0 );
23 this->m_DefaultParameters.SetValueAsReal( "Radius", 1 );
24 this->m_DefaultParameters.SetValueAsUint( "PhiResolution", 10 );
25 this->m_DefaultParameters.SetValueAsUint( "ThetaResolution", 10 );
26 this->m_Parameters = this->m_DefaultParameters;
29 // -------------------------------------------------------------------------
30 cpPlugins::BasicFilters::SphereMeshSource::
35 // -------------------------------------------------------------------------
36 std::string cpPlugins::BasicFilters::SphereMeshSource::
39 itk::Point< double, 3 > center =
40 this->m_Parameters.GetValueAsPoint< itk::Point< double, 3 > >( "Center" );
41 center.Fill( double( 0 ) ); // TODO
42 double radius = this->m_Parameters.GetValueAsReal( "Radius" );
43 unsigned int phi = this->m_Parameters.GetValueAsUint( "PhiResolution" );
44 unsigned int theta = this->m_Parameters.GetValueAsUint( "ThetaResolution" );
46 vtkSphereSource* src = this->_CreateVTK< vtkSphereSource >( );
47 src->SetCenter( center[ 0 ], center[ 1 ], center[ 2 ] );
48 src->SetRadius( radius );
49 src->SetPhiResolution( phi );
50 src->SetThetaResolution( theta );
54 cpPlugins::Interface::Mesh* out =
55 this->GetOutput< cpPlugins::Interface::Mesh >( 0 );
56 out->SetVTK( src->GetOutput( ) );