# Node coordinates in MNI space?

**URL:** <https://community.mrtrix.org/t/node-coordinates-in-mni-space/1657>\
**Category:** Uncategorized\
**Created:** [May 23, 2018, 7:28pm UTC](https://community.mrtrix.org/t/node-coordinates-in-mni-space/1657 "2018-05-23T19:28:53Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![david142](https://community.mrtrix.org/letter_avatar_proxy/v4/letter/d/71e660/32.png) [@david142](https://community.mrtrix.org/u/david142)\
**Post date:** [May 23, 2018, 7:28pm UTC](https://community.mrtrix.org/t/node-coordinates-in-mni-space/1657/1 "2018-05-23T19:28:53Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![rsmith](https://community.mrtrix.org/user_avatar/community.mrtrix.org/rsmith/32/2672_2.png) [@rsmith](https://community.mrtrix.org/u/rsmith)\
**Post date:** [May 24, 2018, 12:20am UTC](https://community.mrtrix.org/t/node-coordinates-in-mni-space/1657/2 "2018-05-24T00:20:37Z")

</div>

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](https://gist.github.com/Lestropie/06afe8c2eedfd48b9d34ab41539d337f). To run it for each parcel, you could do something like:

```auto
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

---

<div class="post-metadata">

**Author:** ![ade](https://community.mrtrix.org/letter_avatar_proxy/v4/letter/a/ecc23a/32.png) [@ade](https://community.mrtrix.org/u/ade)\
**Post date:** [June 6, 2018, 10:41pm UTC](https://community.mrtrix.org/t/node-coordinates-in-mni-space/1657/3 "2018-06-06T22:41:55Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![RdoubleA](https://community.mrtrix.org/user_avatar/community.mrtrix.org/rdoublea/32/2243_2.png) [@RdoubleA](https://community.mrtrix.org/u/RdoubleA)\
**Post date:** [June 30, 2018, 12:11am UTC](https://community.mrtrix.org/t/node-coordinates-in-mni-space/1657/4 "2018-06-30T00:11:17Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![rsmith](https://community.mrtrix.org/user_avatar/community.mrtrix.org/rsmith/32/2672_2.png) [@rsmith](https://community.mrtrix.org/u/rsmith)\
**Post date:** [July 3, 2018, 6:12am UTC](https://community.mrtrix.org/t/node-coordinates-in-mni-space/1657/5 "2018-07-03T06:12:42Z")

</div>

> ```bash
> 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](http://mrtrix.readthedocs.io/en/latest/installation/windows_install.html#compiling-external-projects-with-msys2) that is relevant only for Windows). @jdtournier Maybe we need to add this to the “Tips and tricks” section?

---

<div class="post-metadata">

**Author:** ![jdtournier](https://community.mrtrix.org/user_avatar/community.mrtrix.org/jdtournier/32/2594_2.png) [@jdtournier](https://community.mrtrix.org/u/jdtournier)\
**Post date:** [July 3, 2018, 9:41am UTC](https://community.mrtrix.org/t/node-coordinates-in-mni-space/1657/6 "2018-07-03T09:41:36Z")

</div>

> [@rsmith](#):
>
> However I can’t find anywhere in the online documentation where this capability is described (apart from the [caveat](http://mrtrix.readthedocs.io/en/latest/installation/windows_install.html#compiling-external-projects-with-msys2) that is relevant only for Windows).

Yes, that’s only [described in the developer docs](http://www.mrtrix.org/developer-documentation/module_howto.html), it’s not (yet) mentioned in the user docs.

> [@rsmith](#):
>
> Maybe we need to add this to the “Tips and tricks” section?

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?

---

<div class="post-metadata">

**Author:** ![ade](https://community.mrtrix.org/letter_avatar_proxy/v4/letter/a/ecc23a/32.png) [@ade](https://community.mrtrix.org/u/ade)\
**Post date:** [July 4, 2018, 9:58pm UTC](https://community.mrtrix.org/t/node-coordinates-in-mni-space/1657/7 "2018-07-04T21:58:41Z")

</div>

Hi Rafi,

Very very helpful, thanks!

Abdul

---

<div class="post-metadata">

**Author:** ![lmediavilla](https://community.mrtrix.org/letter_avatar_proxy/v4/letter/l/90db22/32.png) [@lmediavilla](https://community.mrtrix.org/u/lmediavilla)\
**Post date:** [February 22, 2019, 11:46am UTC](https://community.mrtrix.org/t/node-coordinates-in-mni-space/1657/8 "2019-02-22T11:46:04Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![rsmith](https://community.mrtrix.org/user_avatar/community.mrtrix.org/rsmith/32/2672_2.png) [@rsmith](https://community.mrtrix.org/u/rsmith)\
**Post date:** [March 3, 2019, 7:08am UTC](https://community.mrtrix.org/t/node-coordinates-in-mni-space/1657/9 "2019-03-03T07:08:35Z")

</div>

`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?
