[Simnibs-discuss] SimNIBS simulation - TMS study - Overlap figure

Axel Thielscher axelt at drcmr.dk
Wed Jun 2 14:50:18 CEST 2021


Hi,

for determining an overlap, you will have to set a threshold to then 
show the regions where both TMS fields exceed this threshold.  In the 
attached example code , I've used 0.75 as threshold, please adjust this 
according to your needs.

Regions where the first stimulation exceeds the threshold are coded as 
1, regions where the second stimulation exceeds the threshold are coded 
as 2, the overlap is coded as 3.

Best regards,

Axel


On 5/26/2021 2:33 PM, Dantas, A (MW) wrote:
>
> Dear all,
>
> My student Nancy Ébner got in touch with you recently about the need 
> for a Magventure double cone coil simulation using SimNIBS.
>
> We ran the simulations successfully, so first of all I would like to 
> thank you!
>
> We have an experiment deactivating the VMPFC vs. deactivating the 
> right DLPFC. So far, we managed to run both simulations, but it would 
> be great if we could the overlap image of stimulating these two areas. 
> We tried to make it but did not succeed.
>
> Do you think you could help me to build that?
>
> Thank you!
>
> Kind regards,
>
> Aline Dantas
>
>
> _______________________________________________
> Simnibs-discuss mailing list
> Simnibs-discuss at drcmr.dk
> https://mailman.drcmr.dk/mailman/listinfo/simnibs-discuss

-- 
Dr. Axel Thielscher
Professor of Neurophysics and Neuroimaging
Danish Research Center for Magnetic Resonance
Copenhagen University Hospital Hvidovre
DK-2650 Hvidovre, Denmark
www.drcmr.dk
&
Department of Health Technology
Technical University of Denmark
DK-2800 Kgs. Lyngby
http://www.healthtech.dtu.dk/

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.drcmr.dk/pipermail/simnibs-discuss/attachments/20210602/69dcc302/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ojeaodfgjimjdmnp.png
Type: image/png
Size: 661752 bytes
Desc: not available
URL: <https://mailman.drcmr.dk/pipermail/simnibs-discuss/attachments/20210602/69dcc302/attachment-0001.png>
-------------- next part --------------

fn_msh1 = 'ernie_TMS_1-0001_MagVenture_MC_B70_scalar.msh';
fn_msh2 = 'ernie_TMS_1-0002_MagVenture_MC_B70_scalar.msh';
fn_out = 'overlap.msh';

threshold = 0.75;  % in [V/m]

% load simulation results
m1 = mesh_load_gmsh4(fn_msh1);
m2 = mesh_load_gmsh4(fn_msh2);

% find elements where the field strength exceeds the threshold
idx_tri_1 = m1.element_data{ get_field_idx(m1,'normE','elem') }.tridata >= threshold;
idx_tet_1 = m1.element_data{ get_field_idx(m1,'normE','elem') }.tetdata >= threshold;

idx_tri_2 = m2.element_data{ get_field_idx(m2,'normE','elem') }.tridata >= threshold;
idx_tet_2 = m2.element_data{ get_field_idx(m2,'normE','elem') }.tetdata >= threshold;


% make a new mesh to show overlap
m_new = m1;
m_new.element_data={};
m_new.element_data{1}.name = 'overlap';

m_new.element_data{1}.tridata = double(idx_tri_1);
m_new.element_data{1}.tetdata = double(idx_tet_1);

m_new.element_data{1}.tridata(idx_tri_2) = 2;
m_new.element_data{1}.tetdata(idx_tet_2) = 2;

m_new.element_data{1}.tridata(idx_tri_1&idx_tri_2) = 3;
m_new.element_data{1}.tetdata(idx_tet_1&idx_tet_2) = 3;

mesh_save_gmsh4(m_new, fn_out);

mesh_show_surface(m_new,'field_idx','overlap')






More information about the Simnibs-discuss mailing list