[vtkusers] Dynamic updating of Image data

Koning, P.J.H. de (LKEB) P.J.H.de_Koning at lumc.nl
Tue Aug 13 03:06:43 EDT 2002


09-08-02 15:35:13, "Subramanian, S." <S.Subramanian at tue.nl> wrote:

>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;
>}
>

Try calling image->Modified() instead of image->Update();

>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
>
>
>_______________________________________________
>This is the private VTK discussion list. 
>Please keep messages on-topic. Check the FAQ at: <http://public.kitware.com/cgi-bin/vtkfaq>
>Follow this link to subscribe/unsubscribe:
>http://public.kitware.com/mailman/listinfo/vtkusers
>





More information about the vtkusers mailing list