Skip to content

Sim4Life

616 Topics 1.9k Posts

Subcategories


  • Installing Sim4Life and configuring licenses

    31 Topics
    109 Posts
    M

    Hi Jack, no, it is not possible to "borrow" a license

  • Working with CAD models

    57 Topics
    193 Posts
    N

    Hi @bryn, I'm meshing an implanted device as a faceted mesh which is then embedded in an octree mesh. This is all through the Python API.

  • Working with models from the Virtual Population

    49 Topics
    216 Posts
    brynB

    The latest release includes a new function to predict the landmarks needed to place the 10-10-system on the skin: Predict1010SystemLandmarks
    The landmarks are the nasion, inion, and left/right pre-auricular points. Sim4Life now can predict these directly from a T1w MRI.

    The following script demonstrates the whole process:

    from ImageML import Predict1010SystemLandmarks from s4l_v1.model import Vec3, Import, Create1010System, PlaceElectrodes, CreateSolidCylinder from s4l_v1.model.image import HeadModelGeneration, ExtractSurface img = Import(r"D:\datasets\IXI-T1\IXI021-Guys-0703-T1.nii.gz")[0] # segment head, skip adding dura, labelfield = HeadModelGeneration([img], output_spacing=0.6, add_dura=False) # extract surfaces from segmentation surfaces = ExtractSurface(labelfield) surfaces_dict = {e.Name: e for e in surfaces} skin = surfaces_dict["Skin"] # predict landmarks, the function returns a list of Vertex entities verts = Predict1010SystemLandmarks(img) pts = {e.Name: e.Position for e in verts} eeg1010_group = Create1010System(skin, Nz=pts["Nz"], Iz=pts["Iz"], RPA=pts["RPA"], LPA=pts["LPA"]) eeg1010_dict = {e.Name: e for e in eeg1010_group.Entities} # create template electrode and place it at C3 position electrode_template = CreateSolidCylinder(Vec3(0), Vec3(0,0,5), radius=10) electrodes = PlaceElectrodes([electrode_template], [eeg1010_dict["C3"]])

    For the image used in this example, the result looks like this:

    4b86e97a-5c74-4e98-8b56-386c0b967ecf-image.png

  • FDTD, Low-Frequency, Neuron, Mode-Matching, Flow, Acoustics, etc...

    228 Topics
    673 Posts
    H

    Joule heating sources from various processes (e.g., EM energy deposition by ohmic losses) can be considered as inhomogeneous heat sources in thermal simulations.
    To create heat sources

    Simulation Link: Sensor settings of an EM FDTD simulation in the same project can then be dragged and dropped into Source Settings folder. Modulated Analysis/Cache: Data Origin Type can be defined as:
    (a) Cache File: select the path of a thermal source previously exported into a .cache file.
    (b) Analysis Output: select the energy density of interest directly from the Analysis.

    You can look into the heated brain tutorial for a simplified example.

  • Postprocessing results

    99 Topics
    275 Posts
    M

    Hi, I am using sim4life to estimate the efficiency (the ratio between the EM radiated power and the electrical power delivered to the antenna) of a communication antenna for an implantable device. What would be the best way to do it?

    So far my approach has been the following:

    Perform an FDTD simulation. Extract the "Overall Field" sensor. Choose "Power balance".

    However, I get a radiated power nearly ten times less than the input power (even at ideal conditions, without any losses).

    I have also tried integrating the Poynting vector over a surface to get the radiated power and extracting the input power sensor, however, I get nearly the same results.

    How can I simulate the efficiency of an antenna using sim4life?

  • Scripting interface for Sim4Life

    119 Topics
    337 Posts
    A

    Hello everyone,

    I am working on an electrical field simulation with electrodes inside an irregular brain structure, and I’m trying to extract a volume containing only voxels with values above 200 V/m. I attempted using IsoSurface for this purpose, but I’m not getting the desired volume output, possibly due to the brain structure's irregularity and the complex E-field distribution.

    Here’s the code I’m using:

    simulation_extractor = simulation.Results() em_sensor_extractor = simulation_extractor["Overall Field"] em_sensor_extractor.FrequencySettings.ExtractedFrequency = u"All" document.AllAlgorithms.Add(em_sensor_extractor) inputs = [em_sensor_extractor.Outputs["EM E(x,y,z,f0)"]] iso_surface_viewer = analysis.viewers.IsoSurfaceViewer(inputs=inputs) iso_surface_viewer.DecibelScale = 0 iso_surface_viewer.IsoValues = (200,) iso_surface_viewer.Data.Mode = iso_surface_viewer.Data.Mode.enum.QuantityAbsolute iso_surface_viewer.Data.Component = iso_surface_viewer.Data.Component.enum.ComponentsAll iso_surface_viewer.UpdateAttributes() iso_surface_viewer.Update(0) iso = iso_surface_viewer.raw iso.CreateTriangleMeshFromIsoSurface()

    With this setup, I don’t capture all the regions with values below 200 V/m, and I'm not sure if I'm missing a setting or approach. Has anyone faced a similar issue or can suggest adjustments to ensure a more accurate extraction of the desired volume?

    Thank you!

  • Running Sim4Life over a network

    4 Topics
    7 Posts
    ofliO

    Hi,
    Please allow me to share here the response we sent you via the Sim4Life support email so that other users can benefit from your questions. The default machine provides 500GB of storage, and you are running out of space for this project. If your results require more than 500GB, consider upgrading to a higher-tier machine with greater storage capacity. Alternatively, you could reduce the size of your simulation project by splitting it into multiple smaller simulations. This would allow you to continue using the default tier. Additionally, you might optimize your sensor settings, such as by creating smaller sensors and recording data for specific volumes of interest, rather than using an Overall Field sensor.

  • Volt and sensitivity of transducer sim4lite

    1
    0 Votes
    1 Posts
    16 Views
    No one has replied
  • 0 Votes
    3 Posts
    83 Views
    brynB

    Here is a simple implementation to write an iSEG tissue list file, given a dictionary mapping the label index to a name:
    https://github.com/dyollb/s4l-scripts/blob/df8e2241f87ca91d71138e9d2b3d4336dadb82dc/src/anisotropic_conductivity/load_labels.py#L44

  • This topic is deleted!

    1
    0 Votes
    1 Posts
    12 Views
    No one has replied
  • Cannot open .smash project file

    3
    0 Votes
    3 Posts
    255 Views
    J

    Thank you so much you are a godsend 🙏 You saved me a couple days worth of work!

  • Heat generation rate and Heat transfer rate in a MQS/Thermal simulation

    4
    0 Votes
    4 Posts
    260 Views
    H

    In terms of the material settings in the thermal simulation:
    The heat transfer rate defines whether heat removal by perfusion should be considered. In the absence of this term, heat is only removed by thermal conduction (diffusion) and boundary conditions. The options provided for heat transfer rate affect whether perfusion is constant or affected by local thermoregulation (temperature (T) dependent perfusion, e.g., to account for vasodilation). As for the heat transfer rate, the heat generation rate term can be constant or affected by local thermoregulation (T dependent, reflecting increased metabolic activity with increasing temperature). It is also possible to introduce time-dependent heat generation, e.g., to model a heating battery.
    Baseline perfusion values (incl. variability information) are available in the IT'IS database and can be automatically assigned from sim4life: (http://www.itis.ethz.ch/virtual-population/tissue-properties/database/database-summary/).
    If non-constant perfusion should be applied or not depends on the tissue and temperature increase magnitude (e.g., muscle above 39 starts to have a strong perfusion increase). The conservativeness of a perfusion model choice is application-dependent.

    To simulate the heating effect of tissues over time, blood perfusion and heat generation rate (metabolic heat generation) of the tissue would also need to be considered. The perfusion is covered in the option "Heat Transfer Rate". All options that you can enter here are related to heat-transfer based removal of energy from the system. Perfusion can be adjusted by changing the type of hear transfer (None, Constant, Linear (T), Piecewise Linear (T).

    The constant term assumes constant perfusion, independent of tissue temperature. It is the default assigned when using the IT'IS tissue database in Sim4Life. Linear (T) or Piecewise Linear (T) assume temperature dependent perfusion. You can add your your transition temperatures using the little "+" icon. Please note that the linear coefficients represent the slope of the linear perfusion. Each transition temperature indicates the change of the perfusion rate.
    For example, if you wish to enter constant perfusion up to 37 degrees, linear perfusion of 10 times the "standard" perfusion rate between 37 and 43 degrees, and constant perfusion above 43 degrees, then you would enter:
    transition temperatures: [37,44], linear coefficients: [10,0].

  • Grid Convergence

    Solved
    2
    0 Votes
    2 Posts
    234 Views
    B

    To perform such a study, define your region or quantity of interest, then parametrize it. After a quantity has been parametrized, you can run multiple simulations using the built in Sweeper feature or using the Sim4Life Python API.

    There is an example in the Sim4Life manual titled 'Parametrized Patch Antenna' that shows how to use the Sweeper feature.

    If using the Python API, the easiest way would be to create a baseline simulation by hand, then right-click on the simulation name and select To Python. Then you would find the quantity of interest in the auto-generated script and assign it to a variable instead of the hardcoded value. Using a simple loop in Python, you can create multiple simulation that have identical setup except for parameters of interest.

    In your example, multiple simulations would be run with identical setup except for the grid resolution within a region of interest (e.g., a wire block surrounding a region of interest is placed in a manual grid settings folder, then Maximum Step is changed from 0.3 to 1.0 mm).

    Then in Analysis you extract a quantity of interest and compare how this value changes as a function of grid resolution.

    If the change in the value is small as you increase resolution, you can proceed in future simulations with a coarser resolution to save on run time. The exact convergence of the value needed depends on your application.

  • This topic is deleted!

    1
    0 Votes
    1 Posts
    2 Views
    No one has replied
  • My S4L file isn't opening after it crashed

    3
    0 Votes
    3 Posts
    304 Views
    D

    @bryn Thank you Bryn.
    Managed to find a version that wasn't corrupted!
    Hope you have a nice day 🙂

  • 3D Surface model to Voxel and export

    2
    0 Votes
    2 Posts
    302 Views
    brynB

    Are you using Sim4Life lite (web version)? I recorded my screen while I voxeled Duke V2.0 and exported the voxels.
    There seems to be a glitch in the Reload button when I try to see the data that was saved in the Study: as a workaround the Reload button in the DATA tab works. I voxeled at 15mm, so the skin is not completely closed, but if you choose something like 5-10mm it should be enough to resolve thin layers (like the skin):

    BTW. if you are using a desktop version of Sim4Life, the workflow is similar, except that the software uses native Windows file dialogs to save/load files.

    Youtube Video

  • This topic is deleted!

    1
    0 Votes
    1 Posts
    29 Views
    No one has replied
  • This topic is deleted!

    1
    0 Votes
    1 Posts
    10 Views
    No one has replied
  • Simulate a concave multi-element ultrasound array

    4
    0 Votes
    4 Posts
    621 Views
    M

    Assuming 'sim' is the acoustic simulation you're interested in and that 'elements' is a list of the elements (gotten from entities = model.AllEntities()) and that 'amp' and 'phase' are numpy arrays with the amplitude, phase values you're interested in assigning:

    # Print current simulation name print(sim.Name) # Remove all sources before adding them to_del = [] for s in sim.AllSettings: if isinstance(s,acoustic.SourceSettings): to_del.append(s) for d in to_del: sim.Remove(d) # Add sources with correct element and parameters for source_idx in np.arange(len(elements)): source_settings = acoustic.SourceSettings() source_settings.Amplitude = amp[source_idx] source_settings.Phase = phases[source_idx] sim.Add(source_settings, rings[source_idx]) print(rings[source_idx].Name, amp[source_idx], phases[source_idx])

    Sorry I'm not providing a full example. Easiest way to do that would be to manually create the whole simulation without the sources (just make all sources as materials), then right click on simulation and select 'To Python...' and then add the lines above to your code

    You could do something like this to get the elements as a list:

    src_ents = [] entities = model.AllEntities() for e in entities: if 'Element' in e.Name: src_ents.append(e)

    Careful, I have no idea how the elements will be sorted in that case but you could use a fixed size numerical suffix and then sort them.

  • File .Smash error

    2
    0 Votes
    2 Posts
    385 Views
    M

    Hallo,
    There should be, in the same folder where the smash project is, a file named as the smash file, but starting with a ".", like ".Name_of_the_File.smash.xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx".
    Try to drag that file directly into Sim4Life and save it with a different name. From there you should be able to go on with the models/simulations/analysis settings already saved.

  • Cannot read document verion

    3
    0 Votes
    3 Posts
    391 Views
    L

    I have two versions installed (6.2.2 and 7.00) and I tried opening the file with both. I have now deleted the smash file that wasn't working and started over, but if it happens again, I will try the import option- thanks!

  • Bone identification using RF signals

    1
    0 Votes
    1 Posts
    257 Views
    No one has replied
  • The file I created with Sim4Life light cannot be opened.

    3
    0 Votes
    3 Posts
    514 Views
    brynB

    If you don't have a full version, i think (untested) you can still recover the model by importing the smash file in the modeling tab.

  • 'Point Sensor Tool' is not available

    7
    0 Votes
    7 Posts
    724 Views
    M

    Sorry, don't have S4L with neuron available at the moment, but I looked at the tutorial and it seems to have changed. When you create the sensor settings can you try to drag and drop the axon to the sensor setting and then chose the section name? (That was the old way of doing it)

    Still, you should be able to run the simulation without a point sensor.. Sorry can't help more

  • Everytime I'm doing a too complex simulation the file is lost

    5
    0 Votes
    5 Posts
    1k Views
    L

    I am using Sim4Life 6.2.1.4972.
    It happened once when I've had put a high "maximum number of samples" in the time domain (200 I think) with the acoustic head tutorial that I changed a bit, by putting 2 transducers instead of 1.
    Another time it was weird because it happened with a SEFT targeting a square of skin, which was rather simple but it did crash again. My simulation was probably wrong in a way, but it didn't throw and error and just stopped.

    But now that I am applying @gbgbha advices, it is fine 🙂 and thanks for the tip ! I'll try for the file that I lost

  • Why does TRP exceed input power(Antenna)?

    2
    0 Votes
    2 Posts
    442 Views
    SylvainS

    The TRP is computed in a different way than the input power. Both ways are mathematically correct and would both be "exact" if there were no numerical errors. In any FDTD simulation, however, there are spatial (finite grid) or temporal (finite time step) discretization error.
    What you are seeing in this half-wave dipole example, is that those discretization errors are larger than the precision you would require to distinguish TRP from input power (because the radiation efficiency is very high in this case, there is almost no difference between TRP and input power).

    To solve this "problem", either you accept that the simulation results are accurate enough for your needs (the warning is a simple consistency check) or you increase the precision of the simulation. You can do so by increasing the grid resolution, the overall convergence level and the resolution of the far-field sensor. This will be computationally expensive, though.

    To help you understand, you could try to add some lossy media in your (coarse) simulation (e.g. place the dipole next to a phantom or any other dielectric). The simulation will not be more precise, but the numerical errors will be less "obvious" because they will be dwarfed by the losses occurring in the dielectric. The TRP will be lower than the input power and the warning will not be triggered.

    I hope this helps.

  • The effect of electromagnetic field on the temperature of human tissues

    1
    0 Votes
    1 Posts
    286 Views
    No one has replied