[vtkusers] Problem on vtkImageData->CopyAndCastFrom(vtkImageData *inData, int extent[6])

Jin Bei hijinbei at hotmail.com
Thu Mar 31 13:27:44 EST 2005


Hi, 
   I try to get imagedata from a file, then from the whole imagedata, get a 
subimage data from it. Even the whole imagedata have printed out right 
extent, when I use copyandcastfrom, the error come out as 

ERROR: In /home/bellet/rpm/BUILD/VTK/Common/vtkImageData.cxx, line 1576
vtkImageData (0x805b478): GetScalarPointer: Pixel (0, 0, 0) not in memory.
 Current extent= (0, -1, 0, -1, 0, -1)
 Generic Warning: In /home/bellet/rpm/BUILD/VTK/Common/vtkImageData.cxx, 
line 1776
Scalars not allocated.

   My simple source code is as below:

   vtkPNGReader* reader = vtkPNGReader::New();
   vtkImageData* imagedata = vtkImageData::New();  
   reader->SetFileName(filename); 
   reader->Update();
   reader->GetDataExtent(sizeimag);
   printf("size%d,%d,%d,%d\n", sizeimag[0], 
sizeimag[1],sizeimag[2],sizeimag[3],sizeimag[4],sizeimag[5]);    -->get 
result 0,512,0,512,0,0
   imagedata->CopyAndCastFrom(reader->GetOutput(), 0, 255, 0, 255, 0, 0);

   Thank you very much!

Bei Jin

_________________________________________________________________
使用 MSN Messenger,與朋友在線上聊天: http://messenger.microsoft.com/tc 




More information about the vtkusers mailing list