As I recently learned from messing with ANTS, ITK's coordinate system is +x=left, +y=posterior, +z=superior, while the nifti coordinate system (which workbench uses) is +x=right, +y=anterior, +z=superior. This is the reason for the negations on x and y.
Tim On Fri, Apr 13, 2018 at 4:35 AM, Olivier Commowick < [email protected]> wrote: > Hi all and thanks for your answers, > > Just as a quick follow up I figured out how to align the vtk and images > after conversion. The thing is I am using medinria that seems to read the > nifti header differently (through the ITK reader) than workbench is. > Basically, I have seen thanks to the wb_command -file-information and the > hint on qform and sform that I had to apply a minus sign to all coordinates > in the vtk files to have them aligned in medinria while it is not necessary > in workbench. > > I am not exactly sur why this is happening but still it works now. > > Thanks a bunch > Olivier > > > On 12 Apr 2018, at 23:03, Timothy Coalson <[email protected]> wrote: > > 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. > > Tim > > > On Thu, Apr 12, 2018 at 9:59 AM, Olivier Commowick < > [email protected]> 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 >> FRANCE >> >> Phone: +33 2 99 84 25 92 >> Email: [email protected] >> Web: http://olivier.commowick.org/ >> >> >> _______________________________________________ >> HCP-Users mailing list >> [email protected] >> http://lists.humanconnectome.org/mailman/listinfo/hcp-users >> > > > > --- > > Olivier Commowick, Ph.D. > Research Scientist > INRIA Rennes - Bretagne Atlantique, VISAGES Team > Campus de Beaulieu > 35042 Rennes > FRANCE > > Phone: +33 2 99 84 25 92 > Email: [email protected] <[email protected]> > Web: http://olivier.commowick.org/ > > _______________________________________________ > HCP-Users mailing list > [email protected] > http://lists.humanconnectome.org/mailman/listinfo/hcp-users > _______________________________________________ HCP-Users mailing list [email protected] http://lists.humanconnectome.org/mailman/listinfo/hcp-users
