[vtkusers] Need help loading image from memory
Hossein Nazem
hossein.nazem at gmail.com
Wed Jan 30 13:43:28 EST 2013
hi david
i just see your mail thanks a lot
thats exactly the solution
hossein
On Wed, Jan 30, 2013 at 10:06 PM, Hossein Nazem <hossein.nazem at gmail.com>wrote:
> dear joachim
> thanks again
> your suggestion motivated me to search more and i find vtkIntArray to use
> instead of vtkDataArray
>
> vtkIntArray* da = vtkIntArray::New();
>
> it seems the problem is solved till now everything is ok
> hossein
>
>
>
> On Wed, Jan 30, 2013 at 9:35 PM, Hossein Nazem <hossein.nazem at gmail.com>wrote:
>
>> dear joachim
>> thanks a lot for your response but if i use this:
>>
>> vtkDataArray* da = vtkDataArray::New();
>>
>> then i have a compile error :
>>
>> error C2440: 'initializing' : cannot convert from 'vtkObject *' to
>> 'vtkDataArray *'
>>
>>
>>
>>
>>
>> On Wed, Jan 30, 2013 at 6:12 PM, Joachim Pouderoux <
>> joachim.pouderoux at kitware.com> wrote:
>>
>>> 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/20873cf9/attachment.htm>
More information about the vtkusers
mailing list