[vtkusers] Problem whith vtkStructuredPoints when Allocating memory !
Mohamed Ben Reguiga
breguiga_mh at yahoo.fr
Fri Jul 7 03:11:13 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=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/6da1d939/attachment.htm>
More information about the vtkusers
mailing list