cpPluginsWidgets::SeedWidget::
SeedWidget( )
: Superclass( ),
- m_Configured( false )
+ m_Configured( false ),
+ m_InitialNumberOfSeeds( 0 )
{
this->_AddOutput< cpPlugins::DataObject >( "Output" );
}
void cpPluginsWidgets::SeedWidget::
_GenerateData( )
{
- std::cout << "seeds" << std::endl;
+ auto points = this->_CreateVTK< vtkPoints >( );
if( this->m_Configured )
{
- std::cout << "ok" << std::endl;
- auto points = this->_CreateVTK< vtkPoints >( );
+ std::stringstream text;
+ points->Resize( this->m_InitialNumberOfSeeds );
for(
auto wIt = this->m_Widgets.begin( );
wIt != this->m_Widgets.end( );
for( unsigned int i = 0; i < wIt->Seed->GetNumberOfSeeds( ); ++i )
{
wIt->Seed->GetSeedWorldPosition( i, pos );
+ if( i > 0 )
+ text << "#";
+ text << pos[ 0 ] << " " << pos[ 1 ] << " " << pos[ 2 ];
points->InsertNextPoint( pos );
} // rof
} // rof
- this->GetOutput( "Output" )->SetVTK( points );
+ this->m_Parameters.SetString( "Text", text.str( ) );
}
else
{
+ std::vector< std::string > tokens;
+ cpPlugins::TokenizeString(
+ tokens, this->m_Parameters.GetString( "Text" ), "#"
+ );
+ this->m_InitialNumberOfSeeds = tokens.size( );
+ points->SetNumberOfPoints( 0 );
+ for( auto tIt = tokens.begin( ); tIt != tokens.end( ); ++tIt )
+ {
+ std::vector< std::string > coords;
+ cpPlugins::TokenizeString( coords, *tIt, " \t" );
+ int dim = ( coords.size( ) < 3 )? coords.size( ): 3;
+ double pos[ 3 ];
+ for( unsigned int d = 0; d < 3; ++d )
+ {
+ pos[ d ] = double( 0 );
+ if( d < dim )
+ {
+ std::istringstream value( coords[ d ] );
+ value >> pos[ d ];
+
+ } // fi
+
+ } // rof
+ points->InsertNextPoint( pos );
+ this->m_Configured = true;
+
+ } // rof
+
std::vector< vtkRenderWindowInteractor* > ints;
if( this->m_MPRViewer != NULL )
{
this->_Error(
"Could not create valid widget: are there any valid actors?"
);
+ this->GetOutput( "Output" )->SetVTK( points );
}
// eof - $RCSfile$