Computing sources over a deep atlas results in error

Hello,

I confronted with a new error, which I believe was not occurring before I update the last couple of brainstorm versions (using MATLAB R2018b).
I defined a 'deep atlas' mixing the cortical and aseg atlases as instructed here:
https://neuroimage.usc.edu/brainstorm/Tutorials/DeepAtlas
after computing the sources and trying to visualize the activation I get the following error:


** Error: Line 2612: Index in position 1 is invalid. Array indices must be positive integers or logical values.
**
** Call stack:
** >figure_3d.m>PlotGrid at 2612
** >figure_3d.m>UpdateSurfaceColor at 2589
** >figure_3d.m at 43
** >panel_surface.m>figure_callback at 834
** >panel_surface.m>UpdateSurfaceColormap at 1783
** >panel_surface.m>UpdateSurfaceData at 1654
** >panel_surface.m>SetSurfaceData at 1372
** >panel_surface.m at 38
** >view_surface_data.m at 293
** >tree_callbacks.m at 267
** >bst_call.m at 28
** >panel_protocols.m>CreatePanel/protocolTreeClicked_Callback at 109
**


I also try to run statistics compaaring the activation to baseline - and get (obviously) another error:


** Error: [process_test_baseline] Test > Parametric test against baseline
** Line 820: betainc
** X must be in the interval [0,1].
**
** Call stack:
** >process_test_parametric2.m>ComputePvalues at 820
** >process_test_parametric2.m>Run at 634
** >process_test_parametric2.m at 27
** >process_test_baseline.m>Run at 91
** >process_test_baseline.m at 24
** >bst_process.m>ProcessStat at 1226
** >bst_process.m>Run at 178
** >bst_process.m at 36
** >panel_process1.m>RunProcess at 151
** >panel_process1.m at 26
** >gui_brainstorm.m>CreateWindow/ProcessRun_Callback at 760
** >bst_call.m at 28
** >gui_brainstorm.m>@(h,ev)bst_call(@ProcessRun_Callback) at 293
**
**
** File: link|010/pre_MST/results_sLORETA_EEG_KERNEL_190717_1623.mat|010/pre_MST/data_CNT_file_resampled_epochs_pruned_with_ICA_pruned_with_ICA_(_average_190717_1555.mat
**


as always, I will appreciate your help!

thanks,
Itay.

These are two errors that will be very difficult to debug without the data in hand.
Would it be possible for you to package a small example so I can reproduce the errors on my end?

If you want to send me your file:

  • Right-click on the subject folder > File > Duplicate subject
  • In the duplicated subject, delete all the files that are not necessary to reproduce the error. Keep the MRI, the selected surfaces (in green), the channel files, the forward and inverse models you used, and the all the files of interest.
  • Right-click on the duplicated subject > File > Export subject
  • Upload the .zip file somewhere (dropbox, google drive...) and post the download link here

Thanks
Francois

Thanks Francois,

please find the zipped protocol in the following link:

trying to display the source activation is enough to give an error.
is there any way I can download an older version for matlab?

thanks,
itay.

Thanks for the dataset.
It turns out that the problem does not come from the source modeling, but from the fact that there are NaN values in your recordings...
You replaced an artifact with NaN values in the F matrix, which is not something recommended in Brainstorm. These NaN values got propagated in the source maps, and the colormap management was not fully equipped for handling these NaN.

I added an extra test to make the code more resilient:
https://github.com/brainstorm-tools/brainstorm3/commit/53a24e27e2c07243e0243cafad284965c786d040#diff-6c618e95639f3e0152ac5c2d6edebfc7R2610
Update Brainstorm and try again.

If you remove values, I recommend you replace them with zeros instead of NaN.

thanks Francois!!!
those NaNs went under my radar - sorry about that.