# about RequestData

**URL:** https://discourse.vtk.org/t/about-requestdata/5925
**Category:** Support
**Created:** [June 3, 2021, 8:51am UTC](https://discourse.vtk.org/t/about-requestdata/5925 "2021-06-03T08:51:59Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![Hyunwoo\_Kim](https://discourse.vtk.org/user_avatar/discourse.vtk.org/hyunwoo_kim/32/3465_2.png) [@Hyunwoo\_Kim](https://discourse.vtk.org/u/Hyunwoo_Kim)
#### Post date: [June 3, 2021, 8:52am UTC](https://discourse.vtk.org/t/about-requestdata/5925/1 "2021-06-03T08:52:00Z")

</div>

I’m trying to convert the VTK version from 5.0.3 to 9.0.1

In this process, the vtkPolydataSource was changed to the vtkPolydataAlgorithm.

And I found that the Execute function was migrated to the RequestData, and It was called when the renderer tries to render.

However, I want to know how the RequestData function is called, what is the requirement needed to be called by the renderer?

If you give me some information, It’d be so appreciated.

---

<div class="post-metadata">

### Author: ![will.schroeder](https://discourse.vtk.org/user_avatar/discourse.vtk.org/will.schroeder/32/233_2.png) [@will.schroeder](https://discourse.vtk.org/u/will.schroeder)
#### Post date: [June 3, 2021, 11:41am UTC](https://discourse.vtk.org/t/about-requestdata/5925/2 "2021-06-03T11:41:29Z")

</div>

Please check out the following resources:

[https://vtk.org/Wiki/VTK/Tutorials/New\_Pipeline](https://vtk.org/Wiki/VTK/Tutorials/New_Pipeline)

[https://blog.kitware.com/a-vtk-pipeline-primer-part-1/](https://blog.kitware.com/a-vtk-pipeline-primer-part-1/)  
[https://blog.kitware.com/a-vtk-pipeline-primer-part-2/](https://blog.kitware.com/a-vtk-pipeline-primer-part-2/)  
[https://blog.kitware.com/a-vtk-pipeline-primer-part-3/](https://blog.kitware.com/a-vtk-pipeline-primer-part-3/)

---

<div class="post-metadata">

### Author: ![Hyunwoo\_Kim](https://discourse.vtk.org/user_avatar/discourse.vtk.org/hyunwoo_kim/32/3465_2.png) [@Hyunwoo\_Kim](https://discourse.vtk.org/u/Hyunwoo_Kim)
#### Post date: [June 4, 2021, 12:37am UTC](https://discourse.vtk.org/t/about-requestdata/5925/3 "2021-06-04T00:37:21Z")

</div>

[source.zip](https://discourse.vtk.org/uploads/short-url/iksfHYNSb0tGfWMMKzMkB10BOE6.zip) (6.0 KB)

I uploaded mini codes.  
Actor and ActorCrossLine & vtkCrossLineSource

the Actor class performs the pipeline for the source and ActorCrossLine subclass of the Actor.  
vtkCrossLineSource overrides vtkPolydataAlgorithm and I added the RequestData function.  
However, while rendering the RequestData function wasn’t called.

I think this code is so simple to you, but I’m struggling with this code.  
Could you check my little code please,?

---

<div class="post-metadata">

### Author: ![Hyunwoo\_Kim](https://discourse.vtk.org/user_avatar/discourse.vtk.org/hyunwoo_kim/32/3465_2.png) [@Hyunwoo\_Kim](https://discourse.vtk.org/u/Hyunwoo_Kim)
#### Post date: [June 4, 2021, 1:09am UTC](https://discourse.vtk.org/t/about-requestdata/5925/4 "2021-06-04T01:09:16Z")

</div>

And this is a code for creation of the crossline

```
void C3DWndData::UpdateActorCrossLine()
{
// 전체 CrossLine Actor의 갯수는 POI 갯수 + 1 이다
// 흰색 laser cross는 사용자 원점을 가리킨다.
// actor index는 0이다.

int countPOIActor = m_arrayActorCrossLine.GetSize();

int countRefPt = m_pStudy->m_arrRefPt.GetSize();

if(countRefPt+1 != countPOIActor)
{
	DeletaAllActorCrossLine();

	// Laser Cord...
	CPointFloat3D	ptTemp;
	m_pStudy->m_3DSetup.m_laserSetupPoint.GetValue(ptTemp);
	float pos[3] = {ptTemp.x, ptTemp.y, ptTemp.z};

	CActorCrossLine* pActor = new CActorCrossLine;
	pActor->Initialize();
	pActor->AddToRenderer(m_ren);
	pActor->SetLineLength(40.0f);
	pActor->SetLaserCord(TRUE);
	m_arrayActorCrossLine.Add(pActor);

	// poi cross
	for(int i = 0; i< countRefPt; i++)
	{
		CActorCrossLine* pActor = new CActorCrossLine;
		pActor->Initialize();
		pActor->AddToRenderer(m_ren);
		pActor->SetLineLength(5.0f);
		m_arrayActorCrossLine.Add(pActor);
	}
}

countRefPt = m_pStudy->m_arrRefPt.GetSize();
countPOIActor = m_arrayActorCrossLine.GetSize();
for(int i =0; i < countPOIActor; i++)
{
	
	CActorCrossLine* pActor = m_arrayActorCrossLine.GetAt(i);

	CPointFloat3D pt;
	COLORREF crColor;
	float fPos[3];
	BOOL bVisible;

	if(i==0) // Laser Cord...
	{
		m_pStudy->m_3DSetup.m_laserSetupPoint.GetValue(pt);
		fPos[0] = pt.x;
		fPos[1] = pt.y;
		fPos[2] = pt.z;
		crColor = m_pStudy->m_3DSetup.m_laserSetupPoint.m_color;
		bVisible = m_pStudy->m_3DSetup.m_laserSetupPoint.m_bVisible;
	}
	else	// poi
	{
		CRefPoint * pRef = m_pStudy->m_arrRefPt.GetAt(i-1);
		pRef->GetValue(pt);
		fPos[0] = pt.x;
		fPos[1] = pt.y;
		fPos[2] = pt.z;
		crColor = pRef->m_color;
		bVisible = pRef->m_bVisible;
	}

	float *pfActPostion = pActor->GetPostion();
	if(pfActPostion[0] != fPos[0] ||pfActPostion[1] != fPos[1] || pfActPostion[2] != fPos[2])
		pActor->SetPosition(fPos);
	if(crColor != pActor->GetColor())
		pActor->SetColor(crColor);
	if(bVisible != pActor->GetVisible())
		pActor->SetVisible(bVisible);

}
}
```

---

<div class="post-metadata">

### Author: ![will.schroeder](https://discourse.vtk.org/user_avatar/discourse.vtk.org/will.schroeder/32/233_2.png) [@will.schroeder](https://discourse.vtk.org/u/will.schroeder)
#### Post date: [June 4, 2021, 6:08pm UTC](https://discourse.vtk.org/t/about-requestdata/5925/6 "2021-06-04T18:08:54Z")

</div>

A source object (a filter that takes 0 inputs) requires a " this-\>SetNumberOfInputPorts(0);" in the constructor (see vtkCubeSource.cxx for an example).

Also, maybe I missed it, did you create a mapper (e.g., vtkPolyDataMapper) ? The mapper sits at the end of the visualization pipeline, and connects to the actor (e.g., something like actor-\>SetMapper(mapper)).

---

<div class="post-metadata">

### Author: ![Hyunwoo\_Kim](https://discourse.vtk.org/user_avatar/discourse.vtk.org/hyunwoo_kim/32/3465_2.png) [@Hyunwoo\_Kim](https://discourse.vtk.org/u/Hyunwoo_Kim)
#### Post date: [June 4, 2021, 7:23pm UTC](https://discourse.vtk.org/t/about-requestdata/5925/7 "2021-06-04T19:23:53Z")

</div>

Thanks, LineSource works correctly!  
I added this-\>SetNumberOfInputPorts(0); code in the class.

In addition, while converting my project, there are some errors(2 or 3 errors maybe?).

// 3dWndData performs the main process for rendering objects.  
// ActorVOI override Actor class, and Actor class custom class has inputDataConnection for the mapper

1. m\_actorPlaneAxial does not render as well. I changed the  
code dataAxial-\>SetScalarTypeToShort();  
to  
dataAxial-\>SetScalarType(VTK\_SHORT, dataAxial-\>GetInformation());

2. ActorVOI()-\>SetVOI() function did not render in 3D view

[2DImage&3DPolydata.zip](https://discourse.vtk.org/uploads/short-url/1utefGgFELFHGaAc6w5jXiWXYMU.zip) (9.6 KB)

===================================================================

// After rendering actorPlanalAxial, coronal, sagittal,  
// ActorVOI is rendered (if they work correctly)

this is debugging message before rendering actorPlanal Axial.  
is that reason why actorPlanalAxial does not render on the window?

 ![image](https://discourse.vtk.org/uploads/default/original/2X/5/5d22e5eaaf9b2faf63945f6b9da23480e02c240f.png)

And this is another debugging message before rendering ActorVOI()-\>SetVOI(3D polydata)  
Is that related to the migration of the VTK? or am I missing something?

 ![image](https://discourse.vtk.org/uploads/default/original/2X/b/be0a46e3cabe3308df113a244d92d3c82772d23c.png)

Additionally, I put the vtkImagedata\* to vtkContourFilter as a inputdata, but why it occurs a building error?

 ![image](https://discourse.vtk.org/uploads/default/original/2X/c/c6f32a81d335a11574c2778126a16f646e6d445d.png)  
First error message says It cannot conver from vtkImageData\* to vtkDataObject \*  
Second error message says there is no Instunsce which matchs to the parameter lists in the overrided function vtkContourFilter::SetInputData

===================================================================

Thank you for your support, and I look forward to hearing from you, sir!.
