Node coordinates in MNI space?

Hi mrtrix experts!

To go further with connectome analysis and visualization, most of the programs require node coordinates.

What is the easiest way to know them for 84 nodes used in standard “fs_default.txt” I use in mrtrix.

Thank you in advance!

Hi David,

Definition of the location of the nodes within that parcellation is slightly ambiguous, since the cortical parcels are defined on FreeSurfer’s spherical template rather than within a volumetric template like MNI.

In mrview's connectome tool, this is handled by calculating from the parcellation image the centre of mass of each parcel; the positions are therefore subject-specific.

If it’s only for visualisation and not specifically anatomical reporting, I suppose what you could do is either:

  • Calculate the centre of mass of each parcel in subject space, register your subject’s T1 image to MNI space, then transform each centre of mass according to the estimated transformation;
  • Register your subject’s T1 image to MNI space, transform the subject’s parcellation image to MNI space, then calculate the centre of mass of each parcel.

The calculation of centre-of-mass can be done using this command. To run it for each parcel, you could do something like:

for i in {1..84}; do mrcalc parcellation.mif $i -eq - -quiet | mrcentre - scanner; done

That should give you a 84x3 table at the command-line, containing the XYZ scanner-space position of each parcel.

Rob

Hi Rob,

I too have the same question as David and I’m grateful for the steps you have provided. However I have run into a few issues:
When I run the last step suggested to get MNI coordinates for the parcellated brain I receive this error:
mrcalc: [SYSTEM FATAL CODE: SIGPIPE (13)] Nothing on receiving end of pipe
-bash: mrcentre: command not found

This is after incoporating the ‘mrcentre.cpp’ file in the mrtrix3 script bin. How can I incoporate the mrcentre command into the code for it to work?
Thanks,
Abdul

Hey Abdul,

I ran into the same issue when attempting to run the command specified by Rob. What I did to solve it was move the mrcentre.cpp file into the mrtrix3/cmd directory. Then I ran ./build in the command line in the mrtrix3 directory again to compile the new cpp file. Now you should be able to run Rob’s command from anywhere.

I added an echo -e "\n"; in between the last semicolon and the done so that the output would be easier to copy into a text file and save. Hope this helps!

Rafi

1 Like
mrcalc: [SYSTEM FATAL CODE: SIGPIPE (13)] Nothing on receiving end of pipe
-bash: mrcentre: command not found

Yes, just placing the file mrcentre.cpp into the cmd/ directory is not sufficient to run the command; it needs to be compiled, just as with all other MRtrix3 commands.

The alternative way to handle cases like this (which can in fact be a lot cleaner) is to set up a separate MRtrix3 “module” / “project”, where additional commands designed to operate against the MRtrix3 libraries can be compiled without interfering with the primary MRtrix3 installation in any way. However I can’t find anywhere in the online documentation where this capability is described (apart from the caveat that is relevant only for Windows). @jdtournier Maybe we need to add this to the “Tips and tricks” section?

Yes, that’s only described in the developer docs, it’s not (yet) mentioned in the user docs.

I’m not sure, it’s quite an unusual thing to need to do – at least at the moment. I guess there’s no harm in adding it in if you have the time?

However, one idea that came up during the ISMRM was that we could add something equivalent to Python’s pip install: just a simple script to download/clone a git repo, set it up as a module, and build its code. That would allow other users to easily contribute their own commands. What do you think?

Hi Rafi,

Very very helpful, thanks!

Abdul

Hi all!
First, thank you so much for the helpful comments.

I know it is an old issue, but I was trying to use mrcentre (which I successfully added to mrtrix directoty I think) and I got the following error:

mrcentre: [SYSTEM FATAL CODE: SIGILL (4)] Illegal instruction (corrupt binary command file?)

I am inputing the image where the region 1 from my parcellation has been saved (so the first step of the for loop rsmith proposed), and it seems that mrcentre does not like that binary image. I have tried to feed the binary image as a mask for the image with the complete parcellation, but it still gives the same error. Has anyone run into the same problem?

Any suggestions will be very helpful.

Thank you in advance!
Best,
lmediavilla

SIGILL is a pretty deep error: literally there’s a machine code instruction in the binary executable file that your processor hardware does not recognise. Have you compiled the binary on one system and then transferred it to another? Alternatively if your MRtrix3 installation has been updated you may need to re-compile the external module?