DUNEURO error calculation

Hi all, I performed a FEM model computation with SimNIBS and I've checked the coregistration. After that I tried to perform DUNeuro frw model computation and I have the same error :

Dune reported error: Dune::Exception [findEntityImpl:/home/juan/bst-duneuro/src/duneuro/duneuro/common/edgehopping.hh:84]: coordinate is outside of the grid, or grid is not convex

status =

-1

I tried using the constraint of the dipoles the to the grey matter but again , as well as the shrinkage inward ,it moved the dipoles about 1mm and a same error occurred again . What should I check or recompute for the correct DUNeuro execution?
Thank You for Your support
Dunja

@tmedani ?

1 Like

Hi @Dunja

It can be due to a bad segmentation and then a bad mesh model, or to some hole in the mesh.

Could you share the full output message on the Matlab console?
and also a view of the mesh?

A possible solution is to re-mesh the head model using the iso2mesh option,
you need to extract the surfaces from the FEM mesh (select FEM mesh > right-click > extract surfaces),
then select all the extracted surfaces (use the Ctrl keyboard), then Right-Click > Generate FEM mesh > select Iso2Mesh > use lower value ~ 0.05 or less then select Ok,
this will create a new FEM mesh free from holes, then try again DUNEuro for the forward computation.

Let us know the results.

Best,

Hello,

I have the same problem as @Dunja, but the status goes to 255. I checked the aligment between FEM mesh and cortical surface and sometimes it is not perfect, but activating the 'SrcForceInGM' option allows the forward model to be computed for most subjects. Still, for some subjects I still have the same "coordinate outside of the grid" error. I tried the solution provided by @tmedani, but upon computing the mesh from the extracted surfaces I get this error:

Error: Problem with Tetget: Brainstorm cannot understand the output labels (1 2 3 4 5 6).

Thanks a lot in advance,

Fran

Hi all, I tried with isomesh and I had the same error as @FranLop89 . Thank you for the support.
Dunja

Hi @Dunja & @FranLop89,

Thanks for your feedback, we are working on this and we will push the change soon to solve the issue with label identification.
In meantime, if you are familiar with Matlab you can debug and solve it locally in your model,
you need to add a breakpoint at line 436, then re-arrange the label manually

The labels should be from inner to the outer layer (1-wm, 2-gm, 3-csf, 4-skull and 5 scalp).

You will need to identify one by one :
after the break point run this code:

for ind = 1: length(unique(elem(:,end)))
figure; plotmesh(node(:,1:3), elem(elem(:,5)==ind, :)); %title(names{ind})
end

then you need to identify visually each tissue and change the last column of elem with the correct ID. Once you finished you can just continue the execution of the code and brainstorm will recognize the labels.

We will push the change asap and I will post the update here.

1 Like

Hello @tmedani ,
I was wondering if this issue was solved. I am getting the same error.

Dune reported error: Dune::Exception [findEntityImpl:/home/juan/bst-duneuro/src/duneuro/duneuro/common/edgehopping.hh:84]: coordinate is outside of the grid, or grid is not convex

status =

-1

Thank you,
Elif

Hi @elifkksl,

Are you using the mesh obtained with SimNibs or from Iso2mesh?

Hello @tmedani ,
The mesh is obtained with SimNibds.
Thank you.

hi @elifkksl,

If you are getting the same error as reported by by @Dunja, there are two possibles explanations:

  • 1 - there are holes in the mesh that you get from simnibs
  • 2 - there are some dipoles outside of the brain

For case 1, you need to re-mesh with iso2mesh as explained in this tutorial.

For case 2, you need to make sure that all the dipole that you are using are within the grey matter, you can force these dipole by the option "Force within the GM".

Let me know if you still not able to fixe this issue.

Thanks,