[vtkusers] Bug with vtkStructuredPoints when alloctaing scalars

Mohamed Ben Reguiga breguiga_mh at yahoo.fr
Thu Jul 6 07:10:22 EDT 2006

hello all,
I 'm using VTK for 3D reconstitution , MPR and MIP (maximum intesity projection).
for the constitution of the volume of all the pixmaps of the images I use a vtkStructuredPoints object :
data2->SetSpacing (wdgMPR->xsp, wdgMPR->ysp, wdgMPR->zsp);

after thar I recover the scalarpointer to fill the volume by the data that i own :

unsigned short * ptr2=(unsigned short *) data2->GetScalarPointer();

  for (cptdcm=0;cptdcm<DpthVlm;cptdcm++)
    for(int i=0;i<HghtVlm;i++)
        for(int j=0; j<WdthVlm;j++)
         *(ptr2++)  =  *(myDataImages++); //myDataImages is a unsigned short pointer of course

then I use the vtkStructuredPoints object like an input for the vtkImageMapToColors that I use (3 : 1 for each plane X, Y and Z).

every thing goes allright but sometimes something wrong happens and I don't know why :
the allocation of the memory is not accomplished when I do : data2->AllocateScalars(); and the value of  unsigned short * ptr2=(unsigned short *) data2->GetScalarPointer() is 0x00000 and I when I chek the system use of the memory : theer is not a memory allocated !!!!!!!

could you please help me to know when this function doesn't do allocate memory and is there sthing to do before allocating to prevent from such problems!
it's really an emergency!
thank you for your help !
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20060706/1e2fe63c/attachment.htm>

More information about the vtkusers mailing list