[vtkusers] creating imagedata from a 2D double array.

S, Sripriya (MED) SripriyaS at geind.ge.com
Mon Jan 14 23:04:37 EST 2002


hi,

i am trying to create an image from a 2D double array which is 512x512 in
size. the code which does this is as below:

            vtkImageData *imageData1=vtkImageData::New();
	imageData1->SetExtent(0,512,0,512,0,1);
	imageData1->SetWholeExtent(0,512,0,512,0,1) ;
	imageData1->SetUpdateExtent(0,512,0,512,0,1);
	imageData1->SetUpdateExtentToWholeExtent();
	//imageData1->Update();
	imageData1->AllocateScalars();

            id=0;
	for(y=0;y<512;y++)
	{
		for(x=0;x<512;x++)
		{
	
imageData->GetPointData()->GetScalars()->SetScalar(id,outpixel[y][x]);
			id++;
		}
	}
   
	/* display the projection of the image */
	vtkImageViewer  *viewer1= vtkImageViewer::New();
	viewer1->SetInput(imageData);
	viewer1->SetColorWindow (225);
	viewer1->SetColorLevel(100);
	viewer1->Render(); 

i want to display this image using vtkImageViewer. i get the following
error: 

The instruction at "0x100b6af1" referenced memory at "0x08f31000". The
memory could not be "written".

while i debug i get this error,

unhandled exception in filename.exe(VTKDLL.DLL) access voilation.

where am i wrong??

thanks in advance
regards
priya




"THIS E-MAIL MESSAGE ALONG WITH ANY ATTACHMENTS IS INTENDED ONLY FOR THE
ADDRESSEE and may contain confidential and privileged information.
If the reader of this message is not the intended recipient,
you are notified that any dissemination, distribution or copy of this 
communication is strictly Prohibited. 
If you have received this message by error, please notify us 
immediately, return the original mail to the sender and delete the 
message from your system."




More information about the vtkusers mailing list