Workbench does not apply any additional transforms: the coordinates the
file specifies are the ones it uses, directly (it actually ignores the
affines in the gifti file, but writes an identity affine since gifti
unfortunately requires at least one affine written there).  You can
identify a vertex by clicking it or going to window->identify in wb_view,
look at its coordinates in the information window, and then compare to the
answer in matlab or other utilities to verify this and figure out if
anything changes them.  You can also dump the coordinates to a metric file
(.func.gii) with wb_command -surface-coordinates-to-metric .  We also use
the sform/qform in nifti volumes as-is, so there shouldn't be any surprises
there, either (as long as qform and sform match, which they will for
volumes written from workbench - for fsl volumes, you may need to use a
command to synchronize qform and sform).

Freesurfer, unfortunately, has historically had a significant shift between
its surface coordinates and voxel coordinates.  The HCP Pipelines fixed
this so that the coordinates in the surfaces matched the voxel coordinates
specified by the nifti header.  I think there is now an option in
freesurfer that fixes these coordinates for you when converting to gifti,
but I have no idea if it would apply when converting to vtk.

As another option, caret5 supported some vtk formats, in addition to gifti
and custom formats, so you could try that conversion.


On Thu, Apr 12, 2018 at 9:59 AM, Olivier Commowick <> wrote:

> Hi HCP users and moderators,
> I have been trying lately to convert the gifti files from the preprocessed
> data of HCP (in the Native folder) to the VTK format since there are tools
> we use that are relying solely on this format. I have been encountering
> problems though with the converted files that do not align properly with
> the image in visualization softwares. To start with, I have tested two
> conversion methods: one through matlab and SPM12, and one through the
> mris_convert tool of freesurfer, both with the default parameters (no info
> on the T1 image itself). In both cases, the result is the exact same i.e. a
> vtk surface that does not align with the T1 image (with at least two flips
> on the X and Y axes but probably not only).
> What is weird to me though is that the gifti and T1 image align perfectly
> in connectome workbench. This makes me think that either the software is
> doing something specific to align them or is accounting for something in
> the gifti file that I could not see. The only info I saw is that the gifti
> files are in Talairach space (NIFTI_XFORM_TALAIRACH) and no orientation
> matrix is given (identity).
> Would anyone know more about this ? Is workbench applying some
> transformation on the fly to the gifti files when loading (in which case
> which one would be helpful) ? Am I using the wrong files or am I missing
> something (and SPM and freesurfer too) in the gifti files from HCP ?
> Thanks a lot in advance
> ---
> Olivier Commowick, Ph.D.
> Research Scientist
> INRIA Rennes - Bretagne Atlantique, VISAGES Team
> Campus de Beaulieu
> 35042 Rennes
> Phone: +33 2 99 84 25 92
> Email:
> Web:
> _______________________________________________
> HCP-Users mailing list

HCP-Users mailing list

Reply via email to