about RequestData

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.

Please check out the following resources:




source.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,?

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)

	// Laser Cord...
	CPointFloat3D	ptTemp;
	float pos[3] = {ptTemp.x, ptTemp.y, ptTemp.z};

	CActorCrossLine* pActor = new CActorCrossLine;

	// poi cross
	for(int i = 0; i< countRefPt; i++)
		CActorCrossLine* pActor = new CActorCrossLine;

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...
		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);
		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])
	if(crColor != pActor->GetColor())
	if(bVisible != pActor->GetVisible())


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)).

1 Like

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();
    dataAxial->SetScalarType(VTK_SHORT, dataAxial->GetInformation());

    is this the reason why the PlaneAxial does not render correctly?
    what am I doing wrong?

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

2DImage&3DPolydata.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?

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?

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

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!.