Tr : [vtkusers] Bug with vtkStructuredPoints when alloctaing scalars

Mohamed Ben Reguiga breguiga_mh at
Fri Jul 7 09:16:32 EDT 2006

well, I can say that I'm sure that I'm not running out of memory when I allocate memory, because I 'm doing tests with the same set of Images from wich I constitute the MPR plans and when I close the MPR window I do deallocate the memory allocated before and when I 'm testing I only run VS2005 to edit my project. Using the Window's Tasks Manager, and when the bug happens , I see that the memory is really deallocated after closing the window  but not reallocated after calling AllocateScalars in the next time.
-So why it goes allright for several times and in the tenth or more it crashes and in wicth conditions the allocation is not done?

-to answer to your question the set of the images is equal to : 300Mo
- my PC is a 1Go of RAM and a 3GHz clock processor (Intel P4).

thank you for your help!

----- Message transféré ----
De : Amy Squillacote <amy.squillacote at>
À : Mohamed Ben Reguiga <breguiga_mh at>
Cc : Gabriel Kiss <gg1977 at>; VTK_Users <vtkusers at>
Envoyé le : Vendredi, 7 Juillet 2006, 2h00mn 19s
Objet : Re: Tr : [vtkusers] Bug with vtkStructuredPoints when alloctaing scalars

Is it possible that you are running out of memory when you try to 
allocate the scalars? What are the dimensions of the vtkStructuredPoints 
dataset when AllocateScalars() does not allocate memory?

- Amy

Mohamed Ben Reguiga wrote:
> 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>
> À : Mohamed Ben Reguiga <breguiga_mh at>
> 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 
> <mailto:breguiga_mh at>> 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 !

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the vtkusers mailing list