# vtkSeedRepresentation GetSeedDisplayPosition z value

**URL:** https://discourse.vtk.org/t/vtkseedrepresentation-getseeddisplayposition-z-value/3516
**Category:** Support
**Created:** [June 10, 2020, 1:52pm UTC](https://discourse.vtk.org/t/vtkseedrepresentation-getseeddisplayposition-z-value/3516 "2020-06-10T13:52:54Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![flaviu2](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/f/74df32/32.png) [@flaviu2](https://discourse.vtk.org/u/flaviu2)
#### Post date: [June 10, 2020, 1:52pm UTC](https://discourse.vtk.org/t/vtkseedrepresentation-getseeddisplayposition-z-value/3516/1 "2020-06-10T13:52:54Z")

</div>

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 …

---

<div class="post-metadata">

### Author: ![flaviu2](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/f/74df32/32.png) [@flaviu2](https://discourse.vtk.org/u/flaviu2)
#### Post date: [June 11, 2020, 5:54am UTC](https://discourse.vtk.org/t/vtkseedrepresentation-getseeddisplayposition-z-value/3516/2 "2020-06-11T05:54:18Z")

</div>

I dived into **vtkSeedRepresentation** source code, and I read those two methods that I’ve tested:

```
void vtkSeedRepresentation::GetSeedDisplayPosition(unsigned int seedNum, double pos[3])
{
  if (seedNum >= this->Handles->size())
  {
    vtkErrorMacro("Trying to access non-existent handle");
    return;
  }
  vtkHandleListIterator iter = this->Handles->begin();
  std::advance(iter, seedNum);
  (*iter)->GetDisplayPosition(pos);
}

```

and

```
void vtkSeedRepresentation::GetSeedWorldPosition(unsigned int seedNum, double pos[3])
{
  if (seedNum >= this->Handles->size())
  {
    vtkErrorMacro("Trying to access non-existent handle");
    return;
  }
  vtkHandleListIterator iter = this->Handles->begin();
  std::advance(iter, seedNum);
  (*iter)->GetWorldPosition(pos);
}

```

As I said before, **GetSeedWorldPosition** get valid **3** values, and **GetSeedDisplayPosition** get valid **2** values … the issue is deeper than **vtkSeedRepresentation**?

---

<div class="post-metadata">

### Author: ![flaviu2](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/f/74df32/32.png) [@flaviu2](https://discourse.vtk.org/u/flaviu2)
#### Post date: [June 11, 2020, 12:16pm UTC](https://discourse.vtk.org/t/vtkseedrepresentation-getseeddisplayposition-z-value/3516/3 "2020-06-11T12:16:35Z")

</div>

That is because **display** has only two dimensions ?! I guess so, please correct me if I wrong.
