[Simnibs-discuss] Trouble exporting to Brainsight

Westbrook, Andrew andrew.westbrook at brown.edu
Fri Jan 6 21:01:00 CET 2023


Hello SimNIBS Team,

I am attempting to export my TMS Optimization results (estimated via the
ADM method) to a Brainsight-readable .xml file, but I am getting the
following error when I try to execute brainsight().write(opt_mat, fn)


[ simnibs ]CRITICAL: Uncaught exception

AssertionError: Expecting array with shape (4, 4, N instrument marker).

As you can see in the following python script (appended below), I am using
a standard set of arguments to set up my optimization routine, so I don't
know why the export function isn't working. Everything seems to function
properly up until the brainsight().write call. Would you please help me
address this issue?

Note that the optimization itself appears to execute without error. Also,
FWIW, I am running on Mac OS Big Sur 11.7, and I just recently installed my
version of SimNIBS (last week).

Thank you,
Andrew

===

import os
import sys

from simnibs import sim_struct, opt_struct, brainsight, mni2subject_coords
fn = "precomputed_coilpos.xml"

### export from np.ndarray / matsimnibs
tms_opt = opt_struct.TMSoptimize()
# ... prepare optmization ...
# Subject folder
tms_opt.subpath = 'm2m_105'
# Select output folder
tms_opt.pathfem = 'tms_optimization_adm'
# Select the coil model
# The ADM method requires a '.ccd' coil model
tms_opt.fnamecoil = os.path.join('legacy_and_other','Magstim_70mm_Fig8.ccd')
# Select a target for the optimization and other params
tms_opt.target = mni2subject_coords([-42, 13, 33], 'm2m_105')
tms_opt.distance = 6.0 # mm
# Use the ADM method
tms_opt.method = 'ADM'
tms_opt.open_in_gmsh = False
opt_mat = tms_opt.run() # get optimal position

brainsight().write(opt_mat, fn)


===


-- 
Andrew Westbrook

Post-Doctoral Research Associate
Department of Cognitive, Linguistics, and Psychological Sciences
Brown University
190 Thayer Street
Providence, RI 02912
Cell: +1-919-360-5399
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.drcmr.dk/pipermail/simnibs-discuss/attachments/20230106/c4f45c98/attachment.html>


More information about the Simnibs-discuss mailing list