[vtkusers] Dynamic updating of Image data

Subramanian, S. S.Subramanian at tue.nl
Fri Aug 9 09:35:13 EDT 2002


Hi,
 I have a (probably silly) question,
 I want to update an image data which I get from the network in real time. I
use the following section of code which doesn't to work, can someone tell me
what's wrong? (I'm using vtk3.2 under win2000 with vc++ 6.0)

vtkImageData *image = vtkImageData::New();
	image->SetDimensions(256,256,1);
	image->SetScalarType(VTK_UNSIGNED_CHAR);
	image->AllocateScalars();
while(1)
{
	unsigned char *p_out ;
	p_out = (unsigned char *)image->GetScalarPointer();
	//<read p_out from network>
	image->Update();
	..
	//
	imageactor->SetInput(image);
	Renderer.renWin->Render(); 
	delete []p_out;
}

but if I modify my code to put the imagedata decleration inside the while
loop and introduce an image->Delete() the code works.
Any insights?
thanks in advance,
Sriram





More information about the vtkusers mailing list