[vtkusers] Array order in VTK?

Cory Quammen cory.quammen at kitware.com
Mon Sep 19 09:24:12 EDT 2016


Elvis,

VTK image data arrays are stored such that the X dimension increases
fastest, followed by Y, followed by Z.
Concrete example where dimensions of the image are XDIM, YDIM, ZDIM:

Array index : i,j,k indices
0 : (0, 0, 0)
1 : (1, 0, 0)
2 : (2, 0, 0)
...
XDIM : (0, 1, 0)
XDIM+1 : (1, 1, 0)
XDIM+2 : (2, 1, 0)
...
XDIM*YDIM : (0, 0, 1)
XDIM*YDIM + 1 : (1, 0, 1)

So I guess that is Fortran order?

HTH,
Cory

On Mon, Sep 19, 2016 at 1:40 AM, Elvis Stansvik
<elvis.stansvik at orexplore.com> wrote:
> Hi all,
>
> This is a simple question: I haven't been able to find any info on
> whether arrays (images, ...) are stored in row major (C) or column
> major (Fortran) order in VTK.
>
> I assumed they are in C order, but then I saw this blog post:
>
>     https://blog.kitware.com/developing-hdf5-readers-using-vtkpythonalgorithm/
>
> In a comment the author says
>
>     # Note that we flip the dimensions here because
>     # VTK's order is Fortran whereas h5py writes in
>     # C order. We don't want to do deep copies so we write
>     # with dimensions flipped and pretend the array is
>     # C order.
>
> which made me a little unsure. What is the array order of the data
> classes in VTK, and is it the same for all classes?
>
> Thanks,
> Elvis
> _______________________________________________
> 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
>
> Search the list archives at: http://markmail.org/search/?q=vtkusers
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtkusers



-- 
Cory Quammen
Staff R&D Engineer
Kitware, Inc.


More information about the vtkusers mailing list