Skip to content
  • MQS solver errors

    Simulations & Solvers
    2
    0 Votes
    2 Posts
    295 Views
    H
    sending you an email via support
  • Normal vector to a tissue surface

    Analysis & Postprocessing
    2
    0 Votes
    2 Posts
    299 Views
    H
    [image: 1736961843959-327c9ace-0099-4e59-b102-4a34c31e609c-sim4life_fxfwepw8sg.gif] to extract the inner normal vector to the cortical surface mask the field (set NaN outside GM) using the Mask Filter available under "Field Data Tools" in the top ribbion. add the Grey Matter Surface in the post-pro interpolate the (masked) field to the grey matter surface using the "Interpolator" which is active when the masked field and surface is selected. get the normal component via the NormalFieldEvaluator under the "Field Data Tools"
  • Evaluation of head segmentation quality

    Anatomical Models
    7
    0 Votes
    7 Posts
    852 Views
    G
    Okay, I will take those considerations into account. Thanks for the fast reply!
  • 1 Votes
    17 Posts
    5k Views
    C
    @Sylvain Hi Sylvain! Thanks for sharing the method. I tried it in this very simple structure but get unexpected result for current density. Also available at my post here https://forum.zmt.swiss/post/2071. I use the following very simple structure to test whether I am using the LF Ohmic Quasi-Static Solver correctly. The voltage comes out as expected but the current (density) is incorrect. I have these three electrodes of the same radius (1mm) stacking together (touching each other) in an electrode-cylinder-electrode configuration. I want to apply to a 2V (+1V top, -1V bottom) to the two silver electrodes and achieve a 1 kA current through. So I chose the cylinder material (copper) and length such that the resistance is 2 mOhm. After running the simulation, where I place a line as voltage sensor (it runs from 2mm offset from the top electrode to 2mm offset from the bottom electrode, in the centre), it gives a value of -1.9786V as expected. When I combine the J(x,y,z,f0) from the overall field and a plane I created and use flux evaluator to measure total current density as described here, unexpected resutls occur. I tried two different planes and they gave different results:: A block with 0mm thickness and 1m x 1m in area in the middle of the cylinder parallel to the electrodes, result: 1 A/m^2, multiply by the area gives 1A A cylinder with 0mm thickness and 1mm in radius in the middle of the cylinder parallel to the elctrodes, resutls: 49.7369 A/m^2, multiply by the area gives 0.156mA (P.S. why the current density has a unit of [A/m^2 m^2]?) Model, Simulation and Analysis details are summaried in the screenshots attached. [image: 1736740622839-img_5162.jpg] [image: 1736740622913-img_5163.jpg] [image: 1736740622953-img_5164.jpg] [image: 1736740634276-screenshot-2025-01-12-at-21.26.50-resized.jpg] [image: 1736740634609-screenshot-2025-01-12-at-21.27.16-resized.jpg] [image: 1736740634957-screenshot-2025-01-12-at-21.27.32-resized.jpg] [image: 1736740635384-screenshot-2025-01-12-at-21.31.17-resized.jpg] [image: 1736740635771-screenshot-2025-01-12-at-21.34.49-resized.jpg] [image: 1736740636120-screenshot-2025-01-12-at-21.35.28-resized.jpg]
  • 0 Votes
    1 Posts
    217 Views
    No one has replied
  • How to suppress messages in the Python console?

    Python API
    2
    0 Votes
    2 Posts
    346 Views
    L
    As far as I'm aware it is not possible to suppress those messages. Maybe try writing your customized messages into a log file instead?
  • How to create voxels using a script?

    Python API
    2
    0 Votes
    2 Posts
    360 Views
    L
    Hi! In all the tutorial python scripts this is shown. Within the python scripter you can click on the folder icon and choose "Open Example Script". There you will find lots of python scripts, that show how this is done. Here a small excerpt from the script "tutorial_emlf_parallel_plate.py": sim = CreateSimulation() s4l_v1.document.AllSimulations.Add(sim) sim.UpdateGrid() sim.CreateVoxels(path) sim.RunSimulation(wait=True) I suggest always creating a simulation, and an analysis function, that is then called in the RunTutorial function. It's best to then also create a main: def RunTutorial( path ): import s4l_v1.document s4l_v1.document.New() CreateModel() sim = CreateSimulation() s4l_v1.document.AllSimulations.Add(sim) sim.UpdateGrid() sim.CreateVoxels(path) sim.RunSimulation(wait=True) AnalyzeSimulation(sim) def main(data_path=None, project_dir=None): """ data_path = path to a folder that contains data for this simulation (e.g. model files) project_dir = path to a folder where this project and its results will be saved """ import sys import os print("Python ", sys.version) print("Running in ", os.getcwd(), "@", os.environ['COMPUTERNAME']) if project_dir is None: project_dir = os.path.expanduser(os.path.join('~', 'Documents', 's4l_python_tutorials') ) if not os.path.exists(project_dir): os.makedirs(project_dir) fname = os.path.splitext(os.path.basename(_CFILE))[0] + '.smash' project_path = os.path.join(project_dir, fname) RunTutorial( project_path ) if __name__ == '__main__': main()
  • import element inside a group using python

    Python API
    5
    0 Votes
    5 Posts
    733 Views
    M
    Thank you, I could obtain the same also using this: analysis.exporters.MatlabExporter.ExportTo(matlab_exporter,matlab_exporter.FileName) Do you think it is a good solution as well?
  • How to get inhomogeneous B0 maps

    Unsolved Simulations & Solvers
    1
    0 Votes
    1 Posts
    172 Views
    No one has replied
  • python script to run in the cloud

    Python API
    1
    0 Votes
    1 Posts
    212 Views
    No one has replied
  • 1 Votes
    30 Posts
    27k Views
    L
    @bryn Is the 6.8 displayed on the color bar the actual maximum field strength value? I exported the values and found that the maximum is around 5.9 instead. [image: 1735124755536-42fb974e-d830-42c2-8373-84c85ee63339-image.png]
  • How do we put electrodes on the skin surface?

    Analysis & Postprocessing
    16
    0 Votes
    16 Posts
    2k Views
    G
    @bryn @gc00 @halder Thank you so much, You've been very helpful !
  • 0 Votes
    1 Posts
    372 Views
    No one has replied
  • Is it possible to use Python API without opening Sim4Life?

    Python API
    4
    0 Votes
    4 Posts
    1k Views
    brynB
    You can open a smash file using import s4l_v1 as s4l s4l.document.Open(smash_file_path) You can save it using s4l.document.Save(smash_file_path) You can find a simulation using (assuming you have unique simulation names sim = [sim for sim in s4l.document.AllSimulations if sim.Name == "the name of your simulation"][0] If you want to load different models (from .sab file or .smash), but don't need to load e.g. simulations (in .smash file), you can import the file entities = s4l.model.Import(file_path) if you need to reset the document or model because you are accumulating too many entities and memory use is getting too high, you can use e.g. # reset the model sl4.model.Clear() # or keep entities, but discard model history import XCoreModeling as xcm xcm.GetActiveModel().ClearHistory() # or reset entire document (reset model, simulations, analysis) s4l.document.New()
  • Head tissue segmentation

    Anatomical Models
    1
    0 Votes
    1 Posts
    191 Views
    No one has replied
  • Brain atlas

    Anatomical Models
    1
    0 Votes
    1 Posts
    169 Views
    No one has replied
  • Location of Simulation Outputs and Voxel Coordinates?

    Python API
    1
    0 Votes
    1 Posts
    202 Views
    No one has replied
  • Export large files to matlab

    Analysis & Postprocessing
    3
    0 Votes
    3 Posts
    751 Views
    L
    @ofli Can the conductivity map after head segmentation be exported?
  • About TI Simulation

    Python API
    4
    0 Votes
    4 Posts
    653 Views
    L
    I want to see the impact of different grid sizes on the simulation, so I cloned a pair of simulations and modified the maximum step size of the grid. However, I found that if I create a new pair of simulations using the same settings, the grid sizes, simulation durations, and results of the new simulations and the cloned simulations are all different. Why does this happen?
  • Volt and sensitivity of transducer sim4lite

    Sim4Life
    2
    0 Votes
    2 Posts
    328 Views
    M
    Assuming a linear relation between voltage and pressure amplitude, you should be able to map the input voltage to the input pressure (I think its 1 MPa by default), and then use this as a scaling factor, but it's unclear to me what you mean with voltage at the focused area. What exactly do you mean by transducer sensitivity? You could run additional simulations where you shift the transducer or slightly change some parameters to get a sense of the sensitivity.