I am writing you to understand a point about tensors created with SimNIBS and Brainstorm. I understand this is a bit in the middle, so need to check with both yourself and SimNIBS team.
I ran charm on my subject using T1w and T2w and now would like to run dwi2cond using my subject DWI to create the conductivity tensors (as specified in https://simnibs.github.io/simnibs/build/html/documentation/command_line/dwi2cond.html ); then if I choose the "direct mapping" method for conductivity, would it be congruent with running the EMA method in Brainstorm (as specified in https://neuroimage.usc.edu/brainstorm/Tutorials/FemTensors ) using the same data (output from charm and DWI of the subject)? When I say "congruent" I mean if they produce similar results (even if not perfectly overlapping).
From the links I mentioned, it seems they are the only methods that refer to the same papers (Rullmann et al., 2009; Tuch et al., 2001).
Note that the MRI/DWI processing tools and methods in both software are not the same; in simnibs, I think they use FSL, and in Brainstorm, we use Brainsuite.
Moreover, the final tensor values will also depend don't the mesh resolution and the initial parameters, since we compute one tensor per element.
You can also compare these values at the voxel level as well.
I am looking forward to the results of the comparison.
It looks the Leadfield sensitivity is comparable for BEM and FEM isotropic conductivities, however if using anisotropic with Brainsuite it jumps of 3 order of magnitude...is this correct?
The good point from this is that all the LF shows similar patterns of activation.
BEM model isotropic (top)
FEM duneuro isotropic (middle)
This slight difference can be explained by the difference in the conductivity values as well as on the resolution of the BEM/FEM meshes.
What values are you using? And how many layers per model.
FEM duneuro anisotropic (bottom)
we have to expect this large difference since the conductivity is estimated from the DWI, and all depends on the quality of this data.
The other parameter is related to the anisotropy model. which one have you used?
[EMA or EMA+VC]
BEM/FEM isotropic: conductivities are the default values from Brainstorm for both, 3 surfaces for BEM, 5 layers for FEM; let me say that the diffrence looks fine, I am wondering about the discrepancy of 3 orders of magnitude with the FEM anisotropic result;
FEM anisotrpic: I am using the EMA, as this looked more comparable to SimNIBS "Direct Mapping", however if you have any suggestion about the model to use for Brainstorm (EMA ora EMA+VC) and SimNIBS ("Direct Mapping based on linear rescaling of the diffusion tensors (Rullmann et al., 2009; Tuch et al., 2001)" OR "Inhomogeneous, isotropic conductivities, calculated as the mean conductivities of tensors of the direct mapping approach", OR "Volume normalized mapping (Güllmar et al., 2010) that keeps the geometric mean of the eigenvalues identical to the standard isotropic conductivity") please let me know, I would be grateful if you can help on the choice. Let me add also that I did not use the option "Force source space inside the layer gray" because I need to keep the vertices as they are (no change to vetices coordinates).
Concerning the quality of DWI, I performed the tractography/connectome with MRtrix3 with the same data and the results look good, hopefully the input DWI is fine also for Brainsuite/DunEuro. Reading previous posts on the Forum, it looked challenging (even if not impossible) to use the DTI calculated with MRtrix3 as input to Brainstorm, so I am using the Brainsuite plugin to calculate the DTI again (and the SimNIBS dwi2cond to calculate it in SimNIBS).
I would have also another question if possible: I am writing the Matlab script (instead of using the GUI) to adapt the Median Nerve Tutorial tutorial_fem_charm.m for the current purpose, but I am not able to project the electrodes on scalp, refine the registration using the headpoints and compute the head model for the selected EEG cap (I am using a Neuroelectrics10-10, this latter imported during import anatomy folder of SimNIBS)...I struggle to catch where is the issue, it looks nothing happens from row 94 onwards, whereas if I use the GUI all is fine (right click on the EEG Cap, MRI registration->Edit->Project electrodes on surface and then Refine registration using head points, then Ok, then Compute head model (no Force source space inside layer "gray")).
I attach the script...any suggestion? Script.m (6.2 KB)
The EMA is a direct mapping with a factor k from the DTI to the conductivity. The conductivity value depends highly on the quality and the values of the DWI/DTI.
In most tools, a max ratio is fixed between the two main eigenvalues; in Brainstorm, this is fixed to 10.
For a more appropriate comparison, I would recommend using the EMA+VC since the VC [volume constraint, or normalized volume in some cases] will make sure that the equivalent volume of the local isotropic sphere is equal to the local volume of the ellipsoid on each voxel or element.
This option can be recommended if the solver fails to run. Hoowever, in some cases we should expect some unstable sources if the dipoles are sitting outside of the brain layer [not realistic, and the jump in the conductivity may result in some numerical errors]. You can check the leadfield by right click and the "view lead field vectors"
I'm unfamiliar with MRtrix, but if you can export the DTI, it might be possible to use it as input for the Brainstorm functions. You check the function process_fem_tensor from line 207. You might need to dive a bit in the code.
In principle, it should work; I'll check it asap; in the meantime, have you tried the previous version of the tutorial based on Headreco [based on users feedback, the FEM computation is more stable, since only 5 layers are used]?
thanks for your reply, I will use the "EMA+VC" in Brainstorm and "Volume Normalized" in SimNIBS! I had to rewrite the script to make it work, but finally I fixed it.
I checked the "view Leadfield Vectors" but could not find any huge value...however I tried to rerun with the option 'SrcForceInGM' (Force Source space inside layer "gray"): when running with this option, it states 514 diploes out of GM, 987 dipoles inside WM(I am using a cortex with 20484 vertices)...the resulting Leadfield Matrix has some value reduced as magnitude, however remains some order of magnitude higher than the BEM and FEM isotropic cases mentioned above.
Would you recommend to keep the FEM DTI with 'SrcForceInGM', or drop it to use the FEM isotropic one? Is there any additional check I should perform (also to check that DTI was performed correctly)?
Concerning the comparison with dwi2cond, I am struggling to compare the result of the two... any suggestion?
This may be related to the conductivity values and how they are passed on to the solver.
BEM uses the relative values, while the FEM uses the absolute values. You can try to use the BEM with the exact values are the FEM while using the 3-layer models? That way, you can have 1:1 comparisons. Comparing the FEM with multiple layers with a BEM 3 layers can also explain these differences.
If the solver worked with this option, it might be better to keep it with all the sources within the GM.
A possible solution is to export the FEM mesh and the tensors from Simnibs and then load them to Brainstorm for comparisons. No one tried this yet.
There is already a function that allows reading the FEM MSH files from Simnibs.
You can also compute the LF in SimNibs and then import it to BST to compare it with the other methods.
Hopefully I did as you suggested: I used the FEM isotropic 3 layers with same conductivity of BEM (1.0, 0.0125, 1.0), then ran also the BEM with same values and Leadfield sensitivity looks exactly the same. So, I think we can say that it is the computation of the FEM tensors anisotropic from DWI leading to the 1000 difference in the pictures shown at the beginning https://neuroimage.usc.edu/forums/t/creating-conductivity-with-simnibs-and-brainstorm/47423/3
(Just a check: which is the reference electrode for the Leadfield Matrix using OpenMEEG? For Duenuro it is clear it is the first electrode)
Could you kindly clarify how I can import in Brainstorm the tensor calculated with dwi2cond from SimNIBS (it is a file DTI_coregT1_tensor.nii.gz)? This latter has 4 dimensions, the last one is 6 (154 512 512 6), whereas the DTI-EIG in BST is (154 512 512 12).
Also here, would you kindly suggest how to import the LF Matrix from SimNIBS into Brainstorm?
I would have a question about the Leadfield calculated with SimNIBS: I have it in the format N_channels x N_dipoles x 3 ...how can I convert it to the format N_channels x N_dipoles ?
(Just a check: which is the reference electrode for the Leadfield Matrix using OpenMEEG? For Duenuro it is clear it is the first electrode)
I need to double-check within the code, but I believe the average ref is used.
values
It may need a deep investigation about these values.
in Brainstorm: the DTI-EIG in BST with (154 512 512 12), the first 3 values are the resolution of the reference MRI, and the 12 values are the eigenvectors (3 vectors => 9 values ) + eigenvalue at each voxel (3 scalars) => 9+3 =12.
I don't know how the SimNibs team handles these values in their algorithms, with 6 values it seems that they have either a reduced model or using an other file to save the data.
However, you may need to apply transformation in space since BST and SimNbs do not use the same CS. [again, it needs to dive into the code and the data and check].
I believe the SimNibs team has already tried to do similar work a few times ago, but I don't have the latest updates.
In SimNIBS it is the output of dtifit --save_tensor from FSL TBSS, or the same prepared by SimNIBS dwi2cond
You are right, here I am plotting the "leadfield sensitivity": since this plots the constrained dipoles orientation, there is no difference from a Coordinate System standpoint.
The one on the top is the Leadfield Matrix calculated with SimNIBS using also the dwi2cond (anisotropic White Matter derived from FSL TBSS dtifit) and the 12 tissues of charm, I imported to BST after reconstructing the HeadModel variable in Matlab and then imported in the GUI after referencing to 1st electrode (as done by DunEuro).
The one on the bottom is the LF Matrix calculated with BST-DunEuro Isotropic 5 tissues. I had to discard the DUneuro 5tissues Anisotropic as the result from Brainsuite does not look reliable (results are 1000 times bigger than all the others, see picture at bottom of my first post above https://neuroimage.usc.edu/forums/t/creating-conductivity-with-simnibs-and-brainstorm/47423/3). They look very similar to my eyes even if the results from SimNIBS look to have a smaller range (I mean as min,max interval of the LF).
you are right, but if you intent to import the channels and the the source space, in that case you may need to apply the cs_convert. since you are just importing the LF as result, it should be fine.
Congrats, you were able to hack and make this work. It would be very useful if you could share the steps of the conversion and then the code/data import you performed to get the data from SimNibs to Brainstrom.
If this is straightforward, we can implement it and add it as a function within Brainstorm .
I am using the same cortex in SimNIBS and BST (imported from charm) so does not make any difference, vertices and normals are the same; however in general yes, you are right.
It would be great, it shouldn't take that much, we can check it.
I was suspecting it, so good if you can doublecheck.