<html><head></head><body>Hi all,<br>
<br>
This sounds like a dumb question, but I can't seem to figure it out
myself. I'm using vtkSeedWidget to allow the user to set an arbitrary
number of seeds. However I want to be able to, programmatically, delete
all the seeds. Also, I need to programmatically add seeds to the
vtkSeedWidget (for example, seeds read from a file). Can this be done
using vtkSeedWidget? I have played with vtkSeedRepresentation, which
has methods to remove and add handles. However the following approach
leaves with an inconsistent state (It is a bit hard to describe, but
seeds and handles to not seem to be synchronised well. New seeds often
end up in the origin of my image.):<br>
<br>
m_seedWidget->CompleteInteraction();<br>
<br>
// Remove current seeds:<br>
int numSeeds = m_seedRep->GetNumberOfSeeds ();<br>
for ( int i = 0; i < numSeeds; ++i )<br>
{<br>
m_seedRep->RemoveLastHandle();<br>
}<br>
<br>
m_seedRep->BuildRepresentation();<br>
<br>
// Add seeds from polydata:<br>
vtkPolyData *seedPd = m_activeSlice->GetSeedPolyData(m_activeContour);<br>
vtkPoints *seeds = seedPd->GetPoints();<br>
<br>
if ( 0 != seeds )<br>
{<br>
numSeeds = seeds->GetNumberOfPoints();<br>
for ( int i = 0; i < numSeeds; ++i )<br>
{<br>
double p[3];<br>
seeds->GetPoint(i,p);<br>
int s = m_seedRep->CreateHandle(p);<br>
m_seedRep->SetSeedDisplayPosition(s,p);<br>
}<br>
}<br>
<br>
m_seedRep->BuildRepresentation();<br>
m_seedWidget->RestartInteraction();<br>
m_seedWidget->Render();<br>
<br>
best,<br>
Jeroen<br>
</body></html>