Compute Voronoi volume-to-cortex interpolator - large array Matlab error

Hello all
I am working with fNIRS motor task data within Brainstorm and Nirstorm. I am following the steps in the tutorial (Perform 2018) here: Perform tutorial and the optional tutorial regarding the forward problem to generate sensitivity matrices here: Forward problem.

I am able to successfully calculate the fluences using the provided "Voronoi interpolator for MRI onto mid" using the tutorial data and can subsequently view the sensitivity matrix. However when I use my own data to complete these steps I get a "large array" error that looks like this:

A previous post #128 on GitHub submitted by GuyRens has already documented this problem and I was wondering:

  1. Is there a solution to this problem?

  2. If there is no solution, is there a workaround within Brainstorm and Nirstorm that would allow me to calculate sensitivity matrices without using a template brain (I would like to use my patients' individualized brain anatomy)?

  3. If there is no solution within Brainstorm and Nirstorm, is there an external solution I can use for the Voronoi interpolation and import into my Brainstorm project for subsequent processing?

Additional information: I am using the latest versions of both Brainstorm and Nirstorm (updated yesterday), I am using MacOS ver 10.14.6 (Mojave), Matlab R2019a. My MRI has been processed using CAT12. I have also tried this with an MRI that has been processed with Freesurfer and get the same error. Also posted on Github #193 if that's helpful.

Thanks in advance for any help.
Helen

@edelaire @cgrova?

Hello;

  1. So far, i was not able to replicate the issue it is therefore very difficult for me to provide any help. Could please export a small brainstorm portocol and post the link here; so i can try to replicate ?

  2. No; the fluencies computed by MXCLab are volumetric data; we need to have voronoi to be able to project those volumetric data on the cortical surface.

  3. I am not aware of any external solution unfortunatly;

Edouard

Hi Edouard
Here is the link to the protocol: https://drive.google.com/drive/folders/1RSfWAf84zunKS0MD52j6lLwAmSX7TrRY?usp=sharing
Thank-you
Helen

Hello,

I have been able to download the dataset and replicate the issue on my Mac for which the mex file where not available before. I tried a fix here : https://github.com/Nirstorm/nirstorm/pull/195

Can you try to update NIRSTORM and try again ? If this doesn't work; can you try to recompile the mex you your side with the command : "mex -largeArrayDims -compatibleArrayDims dg_voronoi.c" after moving Brainstorm to the path where dg_voronoi is. typically : "/Users/edelaire1/.brainstorm/plugins/nirstorm/nirstorm-master/bst_plugin/math"

Regards,
Edouard

Hi Edouard
Thanks, that seems to have worked, I now have a Voronoi file loaded in my project for that subject. When I view it, it looks like this.

Then I attempted to compute the fluences by selecting Run/NIRS/Sources/Compute fluences in the process panel. When attempting to view the Fluence options (by pressing the edit button), I encounter an additional mexmaci64 error that looks like this (below). It seems that my OS does not have the correct files for compilation (but this time for mcxlab). Is this an issue that can be fixed by recompilation?

Thanks
Helen

Hello,

it seems that Brainstorm is using a version of MCXlab located in the NIRS toolbox as external tool and not the one designed from Brainstorm. You need to remove the toolbox from your matlab path and download MCXlab through Brainstorm plugin system.

If it doesn't work; you can try to modify the line 421 of the file bst_plugin (https://github.com/brainstorm-tools/brainstorm3/blob/master/toolbox/core/bst_plugin.m#L421) from PlugDesc(end).URLzip = 'http://mcx.space/nightly/release/git20211204/mcxlab-allinone-x86_64-git20211204.zip';
to PlugDesc(end).URLzip = 'http://mcx.space/nightly/release/v2020/lite/mcxlab-allinone-x86_64-v2020.zip';

and update MXCLab (after having restarted Brainstorm) and try again

@Francois is there a way to make sure Brainstorm is using the plugin preferentially instead of what's in other toolbox ? (also, if you have time to make the change of link for mxclab toolbox, that would be great; otherwise i'll open a PR next week as the git20211204 version has some compatibility issue with some drivers versions)

EDIT: I just realized that you are using a MAC, and therefore, i don't think you have a CUDA GPU and you should be using the open-CL version of MCXLAB, so in the plugin system, download mcxlab-cl

This is a bit difficult to organize, as we don't want to prevent the users from managing their Matlab path they way they want. We can't refuse someone to replace some functions with custom versions.

But if you distribute as part of the Nirstorm plugin some functions that conflict with other Brainstorm plugins, maybe you could remove them from nirstorm, or make sure they are in subfolders that never get added to the Matlab path when Brainstorm is running.
If it sounds like I didn't understand your request, please rephrase :slight_smile:

(also, if you have time to make the change of link for mxclab toolbox, that would be great; otherwise i'll open a PR next week as the git20211204 version has some compatibility issue with some drivers versions)

Done: Plugin mcxlab-cuda: Updated download link · brainstorm-tools/brainstorm3@cc414c1 · GitHub