help > Feeding MNI coords to MRIcroGL
Showing 1-4 of 4 posts
Jul 18, 2017 08:07 PM | Nina de Lacy
Feeding MNI coords to MRIcroGL
Hi there:
I have written a program in MATLAB that does a bunch of stuff and then outputs an array of MNI coordinates in mm, for the results of interest. These are just the raw numbers in a MATLAB structured array field -- not in an imaging file format.
I have been super-impressed by the beautiful images MRIcroGL can create and I would like to put my coordinates into an image generated by MRIcroGL e.g. a glass brain so that I can include it in the paper write up.
I am new to this and I am writing to ask for help on how best to accomplish this.
These are group results:I do have a brain mask (img/hdr format) created from the study subjects I used for the fMRI processing if that's useful.
Thanks
Nina
I have written a program in MATLAB that does a bunch of stuff and then outputs an array of MNI coordinates in mm, for the results of interest. These are just the raw numbers in a MATLAB structured array field -- not in an imaging file format.
I have been super-impressed by the beautiful images MRIcroGL can create and I would like to put my coordinates into an image generated by MRIcroGL e.g. a glass brain so that I can include it in the paper write up.
I am new to this and I am writing to ask for help on how best to accomplish this.
These are group results:I do have a brain mask (img/hdr format) created from the study subjects I used for the fMRI processing if that's useful.
Thanks
Nina
Jul 19, 2017 03:07 PM | Chris Rorden
RE: Feeding MNI coords to MRIcroGL
Nina-
For this task I would recommend using Surf Ice rather than MRIcroGL. This script
https://github.com/rordenlab/spmScripts/blob/master/nii_coord2spheres.m
will generate one sphere for each node in your array, so you can call it like so
c=[0,0,0,1,1; 40,0,0,2,2]; %1st at origin, 2nd 40mm right of origin
nii_coord2spheres(c);
For more details on scripting Surf Ice see
https://www.nitrc.org/plugins/mwiki/index.php/surfice:MainPage#Scripting_from_Matlab
If you really prefer MRIcroGL, you can modify this script for your needs
https://github.com/rordenlab/spmScripts/blob/master/nii_makeseed.m
For this task I would recommend using Surf Ice rather than MRIcroGL. This script
https://github.com/rordenlab/spmScripts/blob/master/nii_coord2spheres.m
will generate one sphere for each node in your array, so you can call it like so
c=[0,0,0,1,1; 40,0,0,2,2]; %1st at origin, 2nd 40mm right of origin
nii_coord2spheres(c);
For more details on scripting Surf Ice see
https://www.nitrc.org/plugins/mwiki/index.php/surfice:MainPage#Scripting_from_Matlab
If you really prefer MRIcroGL, you can modify this script for your needs
https://github.com/rordenlab/spmScripts/blob/master/nii_makeseed.m
Jul 20, 2017 02:07 PM | Nina de Lacy
RE: Feeding MNI coords to MRIcroGL
Thanks, Chris. I will definitely install SurfIce and try this out
I have looked through the script. Couple of followup questions:
I see I will have to append my coordinates with the fields 'Clr' and 'Sz'.
1. Is there somewhere in SurfIce documentation or code that lists what the numbers corresponding to different colors are (e.g. 1=red, 2=blue etc)?
2. Does 'Sz' correspond to mm or voxels or.....? i.e. what does Sz = 1 mean?
Thanks,
Nina
I have looked through the script. Couple of followup questions:
I see I will have to append my coordinates with the fields 'Clr' and 'Sz'.
1. Is there somewhere in SurfIce documentation or code that lists what the numbers corresponding to different colors are (e.g. 1=red, 2=blue etc)?
2. Does 'Sz' correspond to mm or voxels or.....? i.e. what does Sz = 1 mean?
Thanks,
Nina
Jul 20, 2017 02:07 PM | Chris Rorden
RE: Feeding MNI coords to MRIcroGL
1.) Actually, you do not need to specify size and color. If you
only provide three properties (X,Y,Z spatial positions) it will
assume that all spheres have the same diameter and color, so it
will append these as value 1.
if size(coord,2) == 3
fprintf('Assuming all spheres are of same size and color\n');
coord = [coord, ones(size(coord,1),2)];
end
2.) The node size is specified in mm, but you can scale this in the GUI using the "Scale" slider or using the NODESIZE() script command. The colors are an intensity that are relative to each other, so if you have colors 1,2,3 and chose the Red-yellow color scheme with a threshold of 1..3 then the colors would be red,orange and yellow, where if you set the threshold to 0..1 they would all be yellow. Likewise, you could chose a different color scheme. The easiest way to understand this it to run my script and then adjust the threshold, color and size widgets in the "Nodes" panel (see attached screenshot)
if size(coord,2) == 3
fprintf('Assuming all spheres are of same size and color\n');
coord = [coord, ones(size(coord,1),2)];
end
2.) The node size is specified in mm, but you can scale this in the GUI using the "Scale" slider or using the NODESIZE() script command. The colors are an intensity that are relative to each other, so if you have colors 1,2,3 and chose the Red-yellow color scheme with a threshold of 1..3 then the colors would be red,orange and yellow, where if you set the threshold to 0..1 they would all be yellow. Likewise, you could chose a different color scheme. The easiest way to understand this it to run my script and then adjust the threshold, color and size widgets in the "Nodes" panel (see attached screenshot)