[vtkusers] vtkImageData to 3D CArray

David Gobbi david.gobbi at gmail.com
Fri Aug 19 12:15:14 EDT 2011


Hi Jothy,

You probably don't want to create a 3D C array.  In C, all dimensions
of a C array except for the first dimension must be constant.  So if
you have variables N and M and you try doing this:

short myarray[N][M];

then you will get a compile error.  Multidimensional C arrays are
pretty much useless for image processing, people generally use a
1D array and strides/increments.  Do a search for "array strides" on
google.

 - David

On Fri, Aug 19, 2011 at 9:54 AM, Jothy <jothybasu at gmail.com> wrote:
> Hi all,
>
> I am trying to create a 3D C array form vtkImageData. I tried
> vtkImageExport, but I seems like only exporting it as a 1D array. Is there
> any other filter or how to convert it to a 3D array? I am new to c++ and I
> don't find any matrix manipulation function as in MATLAb or Python in c std
> lib.
>
> Thank you
>
> Jothy



More information about the vtkusers mailing list