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

Mallya, Yogish (CORP, GEITC) Yogish.Mallya at geind.ge.com
Mon Jan 14 23:11:15 EST 2002


You haven't allocated memory for imageData (you have allocated memory for
imageData1). 


-----Original Message-----
From: S, Sripriya (MED) [mailto:SripriyaS at geind.ge.com]
Sent: Tuesday, January 15, 2002 9:35 AM
To: vtkusers at public.kitware.com
Subject: [vtkusers] creating imagedata from a 2D double array.


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

_______________________________________________
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


"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