Tr : [vtkusers] Bug with vtkStructuredPoints when alloctaing scalars

Mohamed Ben Reguiga breguiga_mh at yahoo.fr
Fri Jul 7 08:49:21 EDT 2006


hello,
thank you for the answer but I still have the same bug!
is it possible, at least , to know if the Allocation was done or not?
the allocateScalrs() function is a void return function so how can I be advised if the allocation is ok or not?

thank you for your help!

----- Message transféré ----
De : Gabriel Kiss <gg1977 at gmail.com>
À : Mohamed Ben Reguiga <breguiga_mh at yahoo.fr>
Envoyé le : Vendredi, 7 Juillet 2006, 1h18mn 43s
Objet : Re: [vtkusers] Bug with vtkStructuredPoints when alloctaing scalars

Hi,

Does it help if you add also:

data2->SetNumberOfScalarComponents(1);

gg

On 7/6/06, Mohamed Ben Reguiga < breguiga_mh at yahoo.fr> wrote: 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=vtkStructuredPoints::New(); 
data2->SetDimensions(WdthVlm,HghtVlm,DpthVlm);                    
data2->SetSpacing (wdgMPR->xsp, wdgMPR->ysp, wdgMPR->zsp);
data2->SetScalarType(VTK_UNSIGNED_SHORT);
data2->AllocateScalars(); 

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 !
 


 

_______________________________________________
This is the private VTK discussion list.
Please keep messages on-topic. Check the FAQ at:  http://www.vtk.org/Wiki/VTK_FAQ
Follow this link to subscribe/unsubscribe:
http://www.vtk.org/mailman/listinfo/vtkusers 







-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20060707/1b03e5c9/attachment.htm>


More information about the vtkusers mailing list