Handling dimensions/transformation in Create Sulcus Label Volume Output

Questions about BrainVisa usage and installation

Moderators: denghien, riviere

Post Reply
willsnyder12
Posts: 11
Joined: Tue Jun 05, 2018 6:34 pm

Handling dimensions/transformation in Create Sulcus Label Volume Output

Post by willsnyder12 »

Hello,

I am trying to overlay and operate on NIFTI files of a sulcus tracing outside of BrainVISA, and so I would like to have NIFTI files in the same space as the original T1 MRI. When I use Create Sulcus Label Volume, the NIFTI output will be the sulcus I am interested in, and when I load that NIFTI file into Anatomist, it will overlay properly. However, if I use other viewing software, I will either get an error that the T1 and sulcus NIFTI files are not the same dimension or the overlay will be improper (i.e. the sulcus tracing is shifted with respect to where you would expect to find it overlayed on the T1).

How do I get the sulcus NIFTI file in the same space as the T1 image and make them have the same dimensions? Is this done with the optional transformation inputs to the Create Sulcus Label volume? If so, where do the transformation outputs come from/is there a way to produce them without re-running the Morphologist pipeline?

Thank you in advance,
Will
User avatar
riviere
Site Admin
Posts: 1361
Joined: Tue Jan 06, 2004 12:21 pm
Location: CEA NeuroSpin, Saint Aubin, France
Contact:

Re: Handling dimensions/transformation in Create Sulcus Label Volume Output

Post by riviere »

Hi,
I haven(t checke precisely right now, but I guess the shift is due to transformations in the original image header not being copied to the sulci image.
To fix this you can write a little python script using the pyaims libraries in brainvisa:

Code: Select all

from soma import aims
t1_image = "path_to_t1.nii"
sulci_image = "path_to_sulci.nii"
t1 = aims.read(t1_image)
sulci = aims.read(sulci_image)
if "referentials" in t1.header() and "transformations" in t1.header():
    sulci.header()["referentials"] = t1.header()["referentials"]
    sulci.header()["transformations"] = t1.header()["transformations"]
aims.write(sulci, sulci_image)
(you can also create a little brainvisa process containing this code if you want to ease access to the T1 data and sulci images)

(I haven't tested this code before posting it here, it may contain bugs...)

Denis
Post Reply