I am trying to find a way to export a matrix with MNI and/or Talairach coordinates with corresponding activation levels for a localized head model using Colin27. Using the tutorial, I have been able to view the ImageGridAmp full matrix file which shows a time x activation matrix, but thus far, I have no way of knowing where these activation values are located in the brain. Additionally, I also know of the “find coordinates” function, but this only allows one to find coordinate locations one at a time by eyeballing, whereas I am interested in finding coordinates for relatively highly activated areas more objectively, i.e. perhaps by creating a distribution from the matrix file I am looking for. As always, your help is greatly appreciated!
That was very useful Francois, thank you! Does this processing stream check out with you as the way to get a matrix with MNI coordinates and activation values?
(1) To set up the activation values:
Localize in export mode, use “full matrix”, then right-click on the localized model and “Export to Matlab” saving under the name “sResults”
(2) To set up the SCS coordinates:
Right-click on “cortex_15002V”, then select “export to Matlab” saving under the name “P_scs”
(3) To set up the structural MRI:
Right click on “MRI: Colin27”, then select “export to Matlab” saving under the name “sMri”
(3) Convert the SCS coordinates to MNI coordinates by entering in the following:
P_mri = cs_scs2mri(sMri, P_scs’ .* 1000)’;
P_mni = cs_mri2mni(sMri, P_mri’ .* 1000)’ ./ 1000;
(4) Finally, concatenate the matrices by entering the following into the command window: C=[P_mni sResults.ImageGridAmp]
(5) The final matrix will be available under whatever you put in place of “C”, or if you enter “C”, it will be called “C”
If so, I would like to be able to run it entirely without the GUI (by simply entering in a few lines of Matlab code). Is it possible to get the Matlab script for the in-between processes such as the “Exporting to Matlab” command?
P_mni = cs_mri2mni(sMri, P_mri')' ./ 1000; % SORRY FOR THE MISTAKE IN THE PREVIOUS POST
Is it possible to get the Matlab script for the in-between processes such as the "Exporting to Matlab" command?
You can directly load the .mat files in your Matlab script, you don't need to use the interface to get the contents of a file.
For source files: in_bst_results(filename, 1);
Note that the parameter LoadFull=1 allows you to load the full source matrix from a kernel-based result, this way you don't have to save all your source files using the option "full matrix". This can save you a lot of time and space on the hard drive.
The file names can be either absolute or relative to the protocol data folder.
For loading the MRI and the cortex surface, just use the load() function from Matlab. To convert the relative file names from the Brainstorm database to absolute file paths, use the function file_fullpath. Examples:
sMri = load(file_fullpath(MriFile));
sCortex = load(file_fullpath(CortexFile));
To get the file names from the database:
sSubject = bst_get('Subject', SubjectName);
CortexFile = sSubject.Surface(sSubject.iCortex).FileName;
MriFile = sSubject.Anatomy(sSubject.iAnatomy).FileName;
Similar calls are available for getting the source file names but it is a bit more complicated. You can have a look in the header of bst_get.m, or in the tutorial scripts in brainstorm3/toolbox/script.
I have followed the procedure described above, but the MNI coordinates that I am getting do not seem feasible – they are all very small (less than +/- 1 for all). I think that this is because when executing the line “P_mni = cs_mri2mni(sMri, P_mri’ .* 1000)’ ./ 1000;”, I should not be dividing by 1000. When I do not divide by 1000, the values seem reasonable and seem to map on to the cortical surface pretty well.
My question is: while omitting the divide by 1000 gives me MNI coordinates that seem reasonable, I am not positive that they are accurate. If you could follow up with me on this so I can be sure that I am actually pulling real MNI coordinates for subsequent analyses that would be very helpful.