I have setup a vtkSeedWidget (m_pSeed) on a vtkVolume:
vtkPointHandleRepresentation3D* pPointHandle = vtkPointHandleRepresentation3D::New();
pPointHandle->GetProperty()->SetColor(1, 0, 0);
pPointHandle->GetProperty()->SetLineWidth(0.2);
pPointHandle->GetProperty()->SetPointSize(15);
pPointHandle->GetProperty()->SetRenderPointsAsSpheres(1); // seem to have no effect, the seed widget is not like a sphere !?
vtkSeedRepresentation* pSeedRepresentation = vtkSeedRepresentation::New();
pSeedRepresentation->SetHandleRepresentation(pPointHandle);
m_pSeed->SetInteractor(m_pInteractor);
m_pSeed->SetRepresentation(pSeedRepresentation);
vtkSeedWidgetCallback* pCallback = vtkSeedWidgetCallback::New();
pCallback->SetRepresentation(pSeedRepresentation);
m_pSeed->AddObserver(vtkCommand::PlacePointEvent, pCallback);
m_pSeed->AddObserver(vtkCommand::InteractionEvent, pCallback);
And the vtkSeedWidgetCallback::Execute looks like this:
void vtkSeedWidgetCallback::Execute(vtkObject* pCaller, unsigned long event, void* callData)
{
if (vtkCommand::PlacePointEvent == event)
{
TRACE(_T("Point placed, total of: %d\n"), m_pSeedRepresentation->GetNumberOfSeeds());
}
if (vtkCommand::InteractionEvent == event && callData)
{
TRACE(_T("Interacting with seed : %d\n"), *(static_cast<int*>(callData)));
}
TRACE(_T("List of seeds (Display coordinates):\n"));
for (vtkIdType i = 0; i < m_pSeedRepresentation->GetNumberOfSeeds(); i++)
{
double pos[3];
m_pSeedRepresentation->GetSeedDisplayPosition(i, pos);
TRACE(_T("%f\t%f\t%f\n"), pos[0], pos[1], pos[2]);
}
}
The problem is that GetSeedDisplayPosition method return me values with no Z value:
List of seeds (Display coordinates):
148.000000 184.000000 -842150451.000000
Interacting with seed : 0
List of seeds (Display coordinates):
148.000000 184.000000 -842150451.000000
Interacting with seed : 0
List of seeds (Display coordinates):
148.000000 184.000000 -842150451.000000
why don’t have the correct Z value ? If I use GetSeedWorldPosition I get X Y Z values, but I need display coordinates …