[vtkusers] Need help loading image from memory

Joachim Pouderoux joachim.pouderoux at kitware.com
Wed Jan 30 09:42:26 EST 2013


Hi,

da = 0;
da->SetVoidArray(buffer,512*512*295,1);

For sure it crashes!  :)
Why do you set da = 0 ? Instead you mush create the vtkDataArray :
da = vtkDataArray::New();

Joachim

2013/1/30 Hossein Nazem <hossein.nazem at gmail.com>

> hi all
> i'm trying to load a volume from memory by means of setvoidarray.
> its a 3d array of int (512*512*295) and i use vs2012 win7 x64.
> there is no compile error but in run time when i trace program to
> the line"da->SetVoidArray(buffer,512*512*295,1);" (by F10 or F11) ,
> tracing terminate!
> nothing happen and no runtime error!
> any help is appreciated
> here is my code:
>
> void rendering::LoadFromMemory(INT16 buffer[512][512][295], int width,
> int height, int slices, double voxelsizeX, double voxelsizeY, double
> voxelsizeZ, double originX, double originY, double originZ)
> {
>         input = 0;
>         if (!input)
>         {
>                 input = vtkImageData::New();
>         }
>         vtkDataArray* da ;
>         da = 0;
>         da->SetVoidArray(buffer,512*512*295,1);
>         input->GetPointData()->SetScalars(da);
>         input->SetDimensions(width, height, slices);
>         input->SetSpacing(voxelsizeX, voxelsizeY, voxelsizeZ);
>         input->SetOrigin(originX, originX, originZ);
> }
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>



-- 
*Joachim Pouderoux*

*PhD, R&D Enginee*r
*Kitware SAS <http://www.kitware.fr>*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20130130/ac435097/attachment.htm>


More information about the vtkusers mailing list