Read gifti file written by CAT toolbox


I’d like to postprocess a gifti file written by the CAT toolbox (matlab). It contains one data array with scalar values, one data array with vertices and a third data array with triangles. itk::MeshFileReader offers readers for cells and points but not for scalar values.

I could use gifticlib in addition to ITK to read the scalar values. Is there a way to combine scalar values and mesh data in ITK?

Christina Rossmanith

Meshes can have point data and cell (triangle) data. And ITK should already read both from a GIFTI file. Can you double check that? If not read properly, can you debug to find out what is the problem?

My question was if there is a way to combine scalar data with mesh data (e.g. cortical thickness values across a brain surface). Point data seem to be transposed, I’ll open an issue for that.

Just to double check that I understand the gifti format correctly: In row major order “1 2 3 4” means two 2D points P1(1 3) and P2(2 4), in column major order P1(1 2) and P2(3 4).

(screenshot taken from GIFTI_Surface_Format.pdf, p6)

Yes. Vertices (points) and triangles (cells) can hold values, so you can put e.g. cortical thickness there.

I think that question of row/column major boils down whether to store xyzxyzxyzxyz or xxxxyyyyzzzz.

Fine, then I’ll try to get points with values working.

row/column major order: I just want to be sure, that “1 2 3 4” in row major order means P(1|3) and Q(2|4). When reading the file with itk::MeshFileReader and printing the points accessed with GetPoint() the output is [1 2] and [3 4] what would be expected with column major order (and vice versa).

The reading code does not mention row/column major possibilities, it might assume one. If you have the other one it might be reading it the wrong.

Well, I think it always reads wrong - at least my tiny sample file.

PR to support both row major and column major would be welcome!