FEM Tensor Computation: Maximum Variable Size Exceeded


I'm trying to compute a FEM head model with anisotropic conductivity. I have constructed the FEM mesh using Brain2Mesh (252561V) and the DTI-EIG from the DWI (197233189*12). However, when I go to construct the FEM tensors, I get the following error:
Error: Line 87: Maximum variable size allowed by the program is exceeded.
** Call stack:
** >mri_histogram.m at 87
** >in_mri_bst.m at 50
** >process_fem_tensors.m>Compute at 215
** >process_fem_tensors.m>ComputeInteractive at 375
** >process_fem_tensors.m at 24
** >bst_call.m at 28
** >tree_callbacks.m>@(h,ev)bst_call(@process_fem_tensors,'ComputeInteractive',iSubject,filenameFull) at 1208
I know the maximum variable size is a function of both the RAM on my machine and the version of Matlab, so I tried it again on a virtual machine on a supercluster with 64 gb RAM and Matlab 2019b 64 bit. However, even with 4 times the RAM as my local machine I got the same error. Am I on the right track and do I just need more memory? Or is there a way to reduce the variable size? The max I can built is 128 GB RAM. I am quickly burning through my allocation of CPU hours trying to troubleshoot this problem, so I'd like some assurance I'm on the right track or advice on how I might change my approach.


This bug is not directly related with the FEM computation, but with the general reading of volumes.
I've just pushed a commit that should fix your bug: https://github.com/brainstorm-tools/brainstorm3/commit/a9a62ca9bb55998c5a4973d10044f0cb0034fdb5

Please update Brainstorm and try again.

1 Like