[vtkusers] Copy from vtkImageData to array

David Doria daviddoria+vtk at gmail.com
Thu Nov 19 10:23:58 EST 2009


On Thu, Nov 19, 2009 at 10:21 AM, Michael Xanadu
<xanadu.michael at googlemail.com> wrote:
> Hi,
>
> I have got a vtkImageData filled with 3-dimensional CT data. Now I'm doing
> this:
>
> vtkUnsignedCharArray *arr =
> vtkUnsignedCharArray::SafeDownCast(image->GetPointData()->GetScalars());
>
> This copies the 3-dimensional image data into a 1-dimensional array. But of
> course, now I don't know which index of the array I should address if I want
> to get an element with former coordinates (x,y,z). In other words, what
> principle was used to copy the data from the vtkImageData to the array?
>
>
> Regards, Michael

Is there any reason you want to copy it to an array? Can you just
access the values like this:
http://www.vtk.org/Wiki/Iterating_over_a_vtkImageData

Thanks,

David



More information about the vtkusers mailing list