[vtkusers] vtkImageData
Mike Jackson
imikejackson at gmail.com
Tue Apr 8 09:04:53 EDT 2008
I _think_ there is a call in vtkImageData called "GetVoidPointer(0)"
which will return a void pointer to the first element of the array.
Simply cast this to the proper type and do what you need to do.
--
Mike Jackson Senior Research Engineer
Innovative Management & Technology Services
On Apr 8, 2008, at 8:27 AM, Stefan Huber wrote:
>
> Hi Amy
>
> thank you, i added the dimension and changed the datatyp and the
> dimension of my array and now it works.
>
> I only have some problems to convert the imagedata object to an
> array. How can i get the values from the imagedata to write it to
> an array?
>
> arr[i*width+j] = img->GetPointData->GetScalars()->GetTupel1(id);
>
> doesn't work.
> Do you know why?
>
> thanx Stefan
>
> -------- Original-Nachricht --------
>> Datum: Mon, 07 Apr 2008 08:55:40 -0500
>> Von: Amy Squillacote <ahs at cfdrc.com>
>> An: Stefan Huber <Huber.Ste at gmx.at>
>> CC: vtkusers at vtk.org
>> Betreff: Re: [vtkusers] vtkImageData
>
>> Hi Stefan,
>>
>> What are the dimensions of the vtkImageData you are trying to
>> generate?
>> You haven't specified them anywhere (using either vtkImageData's
>> SetDimensions or SetExtent method).
>>
>> - Amy
>>
>> Stefan Huber wrote:
>>> Hi,
>>>
>>> i have an Array with pointdata and i want to generate imagadata
>>> to use
>> vtk. How can i do it? Can you give me an example, how i can create an
>> imagadataobject? my code doesn't work.
>>>
>>> my code:
>>>
>>> vtkImageData *img = vtkImageData::New();
>>> img->AllocateScalars();
>>> img->SetScalarTypeToInt();
>>>
>>> vtkCellArray * scalars = vtkCellArray::New();
>>> for(int i= 0; i< size; i++){
>>> scalars->InsertNextCell(dat[i]);
>>> }
>>> img->GetPointData()->SetScalars(scalars);
>>> img->GetPointData()->CopyAllOn();
>>> img->Update();
>>> img->UpdateData();
>>>
>>> thanx,
>>> Stefan
>>>
>>
>> --
>> Amy Squillacote Phone: (256) 726-4839
>> Computer Scientist Fax: (256) 726-4806
>> CFD Research Corporation Web: http://www.cfdrc.com
>> 215 Wynn Drive, Suite 501
>> Huntsville, AL 35805
>>
>
> --
> Psst! Geheimtipp: Online Games kostenlos spielen bei den GMX Free
> Games!
> http://games.entertainment.gmx.net/de/entertainment/games/free
> _______________________________________________
> 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
More information about the vtkusers
mailing list