[vtkusers] Array order in VTK?

David Gobbi david.gobbi at gmail.com
Mon Sep 19 12:19:44 EDT 2016


For vector components, the terminology I prefer is "packed" vs. "unpacked",
where VTK uses the former -- unless one uses the new SOA data arrays ;)

On Mon, Sep 19, 2016 at 10:11 AM, Elvis Stansvik <
elvis.stansvik at orexplore.com> wrote:

> 2016-09-19 17:28 GMT+02:00 Berk Geveci <berk.geveci at kitware.com>:
> > One thing that makes things a bit confusing is that, in the case of
> vectors,
> > the fastest growing is the vector component. So something like this:
> >
> > (0, 0, 0) u, (0, 0, 0) v, (0, 0, 0) w, (1, 0, 0) u, (1, 0, 0) v, (1, 0,
> 0) w
> >
> > This makes it a hybrid Fortran and C. Which is pain when mapping these to
> > numpy arrays :-)
>
> Ah. Thankfully working only with single component data so far, but
> thanks for the heads up Berk :)
>
> Elvis
>
> >
> > -berk
> >
> > On Mon, Sep 19, 2016 at 9:51 AM, Elvis Stansvik
> > <elvis.stansvik at orexplore.com> wrote:
> >>
> >> 2016-09-19 15:24 GMT+02:00 Cory Quammen <cory.quammen at kitware.com>:
> >> > 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?
> >>
> >> Right, thanks for the clarification Cory.
> >>
> >> Elvis
> >>
> >> >
> >> > 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.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20160919/f80d2786/attachment.html>


More information about the vtkusers mailing list