Skip to content
  • 1 Votes
    4 Posts
    1k Views
    brynB
    e.g. something like this def spherical_parametrization(theta: float, phi: float) -> Vec3 '''Parametrize head skin center and radius computed from head, e.g. using: p1, p2 = XCoreModeling.GetBoundingBox(skin) center = 0.5 * (p1 + p2) radius = 0.51 * (p2-p1).Length() ''' point_on_sphere = center + Vec3(radius * sin(theta) * cos(phi), radius * sin(theta) * sin(phi), radius * cos(theta)) r = XCoreModeling.GetEntityPointDistance(skin, point_on_sphere) return r.ClosestPosition This should work quite well, except for the concave regions, e.g. behind the ears.
  • Clear or Reset Geometry Workspace in Python?

    Python API python geometry
    4
    0 Votes
    4 Posts
    994 Views
    brynB
    I typically do the following (which also clears the history and frees memory): import XCoreModeling as xcm xcm.GetActiveModel().Clear()
  • 0 Votes
    3 Posts
    534 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
  • 0 Votes
    3 Posts
    2k Views
    SylvainS
    have you tried overwriting the E_field and raw_data variables?
  • 0 Votes
    2 Posts
    339 Views
    brynB
    Dear @NaraSakamoto Thanks for your feature suggestion.
  • License Borrowing

    Installation & Licensing
    2
    0 Votes
    2 Posts
    431 Views
    M
    Hi Jack, no, it is not possible to "borrow" a license
  • Sim4life Installation

    Installation & Licensing
    2
    0 Votes
    2 Posts
    419 Views
    M
    Hi Abdou, this could happen if there are some libraries missing. Reinstalling the SW with the default options will help.
  • Neck flexion with Jeduk V4

    Anatomical Models
    5
    0 Votes
    5 Posts
    776 Views
    N
    @bryn Thank you again for your reply and the posture file!
  • Randomness in unstructured mesh generation

    CAD Modeling
    3
    0 Votes
    3 Posts
    679 Views
    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.
  • Project line on to a layer

    CAD Modeling
    4
    0 Votes
    4 Posts
    699 Views
    brynB
    This screen capture shows how you can then move/snap the "Spline Control Points" (the little white dots) to the offset surface: https://youtu.be/kveLjnKpWzU
  • Can I scale a ViP model? Why is the model "locked"?

    Anatomical Models
    1
    0 Votes
    1 Posts
    219 Views
    No one has replied
  • error in tutorial simulations

    Installation & Licensing
    2
    0 Votes
    2 Posts
    576 Views
    ofliO
    Hi @Paul_fgp Could you please share any error messages you have received? Thanks
  • 0 Votes
    3 Posts
    617 Views
    ofliO
    Dear Ali, It looks like the path to iSolve is not set correctly. Please follow the steps below: Open Ares on the machine where Sim4Life is installed Click on the blue cross at the end of the line labeled "Paths to the iSolve solver executables." This will open a pop-up window. (see the image below) If the list of solvers is empty or the one you intend to use is not listed, simply add the path to the relevant solver. Restart Sim4Life. [image: 1724225171829-aresisolve-resized.png]
  • Convergence check

    Analysis & Postprocessing
    3
    0 Votes
    3 Posts
    636 Views
    A
    Thanks, the simulation file is from sim4life V7.2, so I'm not able to see the convergence in the analysis window. Fortunately, I have found the "x_Output.log" in my Results file, but I can't understand it. Could you please explain the meaning of each row in the results file? Take an example like this: Sensor 'Capacitor_L 1 (Current L)' Exponential moving average factor 0.894427, Harmonic steady state detector: time step 3.08414e-10s, frequency 64MHz, approximate quarter period 3.70097e-09s, target convergence level -50 dB Iteration number and conventional convergence level in dB <raw> <ema> [<raw> <ema> ...]: 16800 13.9358 1.47124 8.4181 0.888723 18816 7.67597 2.12629 15.5107 2.43241 20832 14.0806 3.38834 13.5789 3.60917 22848 1.26816 3.16451 7.74689 4.046 24864 4.59394 3.31542 3.89595 4.03016 26880 -2.64392 2.68627 0.958616 3.70589 28896 0.107048 2.41398 -1.53674 3.15241 30912 -4.9591 1.63558 -3.76506 2.42211 32928 -2.79052 1.1683 -6.11092 1.52126 34944 -5.90745 0.421296 -8.34643 0.479498 36960 -4.81187 -0.131184 -10.7496 -0.705992 38976 -5.89793 -0.739996 -13.7845 -2.08673 40992 -6.1714 -1.3134 -17.1553 -3.67755 43008 -5.32482 -1.7369 -21.5846 -5.56806 45024 -6.82203 -2.27375 -32.324 -8.39276 47040 -2.12306 -2.25784 -15.5315 -9.14641 49056 -0.278664 -2.0489 -3.5348 -8.55398 51072 -6.34679 -2.50264 -2.30536 -7.8943 53088 -0.399402 -2.28059 -2.38639 -7.31281 55104 -9.37643 -3.02972 -4.00497 -6.96359 57120 -29.014 -5.77295 -18.2975 -8.16015 59136 -55.4153 -11.0138 -31.9566 -10.6724 61152 -57.6383 -15.9361 -37.9006 -13.547 63168 -58.9883 -20.4813 -26.9761 -14.9647 65184 -58.6026 -24.5058 -39.9291 -17.6003 67200 -57.9518 -28.0368 -37.4931 -19.7004 69216 -59.1574 -31.3223 -36.9919 -21.5259 71232 -59.0974 -34.2546 -28.7893 -22.2927 73248 -59.633 -36.9339 -25.1269 -22.592 75264 -59.2213 -39.2868 -31.2338 -23.5043 77280 -59.5994 -41.4313 -27.1446 -23.8886 79296 -59.9846 -43.39 -25.5704 -24.0662 81312 -61.3968 -45.291 -28.9199 -24.5786 83328 -61.7502 -47.0287 -26.6773 -24.8002 85344 -61.0201 -48.5058 -30.0321 -25.3525 87360 -61.1226 -49.8378 -25.216 -25.3381 89376 -63.0251 -51.23 -33.6491 -26.2155 91392 -66.6494 -52.8579 -33.5 -26.9845 93408 -67.4893 -54.4026 -29.6102 -27.2617 95424 -70.0935 -56.0591 -29.03 -27.4484 97440 -71.562 -57.6958 -27.7633 -27.4817 99456 -69.5748 -58.9499 -26.854 -27.4154 101472 -78.6 -61.0244 -28.1287 -27.4907 103488 -67.7923 -61.7389 -25.6139 -27.2926 105504 -68.4293 -62.4452 -23.2911 -26.8701 107520 -65.0311 -62.7182 -24.074 -26.5749 109536 -65.161 -62.9761 -31.2989 -27.0737 111552 -65.5676 -63.2497 -29.642 -27.3448 113568 -61.3018 -63.0441 -27.2672 -27.3366 115584 -60.839 -62.8113 -26.1289 -27.2091 117600 -60.3076 -62.5469 -27.3216 -27.221 119616 -61.3064 -62.416 -26.3063 -27.1244 121632 -62.103 -62.3829 -28.0492 -27.2221 123648 -61.1791 -62.2558 -34.3984 -27.9797 125664 -61.6997 -62.1971 -24.1963 -27.5803 127680 -60.7142 -62.0406 -27.5361 -27.5756 129696 -62.5137 -62.0905 -28.7848 -27.7033 131712 -62.9527 -62.1815 -28.8431 -27.8236 133728 -63.5879 -62.33 -27.4008 -27.779 135744 -63.518 -62.4554 -27.3935 -27.7383 137760 -66.5672 -62.8895 -37.3044 -28.7482 139776 -66.7306 -63.295 -28.7205 -28.7453 141792 -66.0728 -63.5883 -24.7314 -28.3215 143808 -67.7974 -64.0327 -24.6679 -27.9358 145824 -69.0101 -64.5581 -25.0781 -27.6341 147840 -67.3162 -64.8493 -16.4316 -26.4514 149856 -66.9178 -65.0677 -21.271 -25.9045 151872 -72.7687 -65.8807 -28.3618 -26.1639 153888 -69.2686 -66.2384 -21.0304 -25.622 155904 -68.7916 -66.5079 -17.7813 -24.7942 157920 -65.0066 -66.3494 -19.2192 -24.2056 159936 -68.1325 -66.5377 -26.2937 -24.4261 161952 -64.7744 -66.3515 -23.2103 -24.2977 163968 -68.9681 -66.6278 -21.4553 -23.9976 165984 -67.3859 -66.7078 -18.5064 -23.4179 168000 -66.1211 -66.6459 -23.847 -23.4632 170016 -67.4045 -66.726 -19.9166 -23.0888 172032 -65.1708 -66.5618 -25.465 -23.3397 174048 -68.6925 -66.7867 -22.8274 -23.2856 176064 -67.0903 -66.8188 -25.4394 -23.513 178080 -64.5303 -66.5772 -19.6368 -23.1038 180096 -64.284 -66.3351 -20.7205 -22.8522 182112 -64.9833 -66.1924 -22.9353 -22.8609 184128 -64.2102 -65.9831 -17.2516 -22.2687 186144 -61.8411 -65.5458 -18.5849 -21.8798 188160 -67.4312 -65.7449 -22.0218 -21.8948 190176 -63.0463 -65.46 -29.3056 -22.6772 192192 -73.1833 -66.2753 -18.072 -22.191 194208 -62.5461 -65.8816 -17.785 -21.7259 196224 -66.6467 -65.9624 -21.6314 -21.7159 198240 -63.3296 -65.6845 -23.0527 -21.857 200256 -66.4044 -65.7605 -26.6222 -22.3601 202272 -66.1052 -65.7969 -25.6971 -22.7124 204288 -63.9959 -65.6067 -19.0422 -22.3249 206304 -67.4349 -65.7997 -26.79 -22.7963 208320 -65.1095 -65.7269 -26.0593 -23.1408 210336 -68.519 -66.0216 -24.4157 -23.2754 212352 -65.3768 -65.9536 -18.3469 -22.7551 By the way, what's the meaning of "convergence", and which value or formula do we use to express this variable? Thank you very much for your prompt response!
  • Extract the EM E field along the Spline

    Python API
    3
    0 Votes
    3 Posts
    722 Views
    A
    Thank you so much for hour help with the technical issue! Your assistance made a big difference, and I truly appreciate your expertise and prompt support!
  • 0 Votes
    3 Posts
    729 Views
    P
    Dear Arjama, Thanks a lot for your reply and for your very detailed example. The problem I was referring to is in the line where you add TIMAM to the mask. If I run: inputs = [TIMAM] field_masking_filter = analysis.core.FieldMaskingFilter(inputs=inputs) where TIMAM = modulation_envelope(e_field_1, e_field_2, dir_vector=None) I get the error: field_masking_filter = analysis.core.FieldMaskingFilter(inputs=[TImax]) File "C:\Program Files\Sim4Life_8.0.0.15165\Python\lib\site-packages\s4l_v1_api\analysiswrappers.py", line 231, in init self.Inputs[id].Connect(input) File "C:\Program Files\Sim4Life_8.0.0.15165\Python\lib\site-packages\s4l_v1_api\analysiswrappers.py", line 647, in Connect raise Exception("Can't connect ports") Exception: Can't connect ports So I think my problem is the creation of TIMAM. I Imagine it is not the TI envelope, but rather the TI Envelope inside some data structure that can be connected to the masking filter? Thanks again!
  • Cannot place line as a voltage sensor

    Simulations & Solvers
    4
    0 Votes
    4 Posts
    865 Views
    B
    It looks like this is a bug. Until it is fixed, you can still add line sensors to LF simulations using the API. Here is a quick example that adds an entity named 'Lines 1' as a voltage sensor: # -*- coding: utf-8 -*- import numpy import s4l_v1.document as document import s4l_v1.materials.database as database import s4l_v1.model as model import s4l_v1.simulation.emlf as emlf import s4l_v1.units as units from s4l_v1 import ReleaseVersion from s4l_v1 import Unit # Define the version to use for default values ReleaseVersion.set_active(ReleaseVersion.version8_0) # Creating the simulation simulation = emlf.ElectroQsOhmicSimulation() # Mapping the components and entities component__plane_x = simulation.AllComponents["Plane X+"] component__plane_x_1 = simulation.AllComponents["Plane X-"] component__background = simulation.AllComponents["Background"] component__plane_y = simulation.AllComponents["Plane Y+"] component__plane_y_1 = simulation.AllComponents["Plane Y-"] component__plane_z = simulation.AllComponents["Plane Z+"] component__plane_z_1 = simulation.AllComponents["Plane Z-"] component__overall_field = simulation.AllComponents["Overall Field"] entity__line = model.AllEntities()["Lines 1"] # Adding a new VoltageSensorSettings voltage_sensor_settings = emlf.VoltageSensorSettings() components = [entity__line] simulation.Add(voltage_sensor_settings, components) # Editing AutomaticGridSettings "Automatic automatic_grid_settings = [x for x in simulation.AllSettings if isinstance(x, emlf.AutomaticGridSettings) and x.Name == "Automatic"][0] components = [entity__line] simulation.Add(automatic_grid_settings, components) # Editing AutomaticVoxelerSettings "Automatic Voxeler Settings automatic_voxeler_settings = [x for x in simulation.AllSettings if isinstance(x, emlf.AutomaticVoxelerSettings) and x.Name == "Automatic Voxeler Settings"][0] components = [entity__line] simulation.Add(automatic_voxeler_settings, components) # Update the materials with the new frequency parameters simulation.UpdateAllMaterials() # Update the grid with the new parameters simulation.UpdateGrid() # Add the simulation to the UI document.AllSimulations.Add( simulation )
  • Normalizing to partial-body SAR

    Analysis & Postprocessing
    3
    0 Votes
    3 Posts
    788 Views
    MathijsKikkenM
    @halder Hi Arjama, thanks for your reply! I will send you an email!
  • 0 Votes
    3 Posts
    885 Views
    N
    To follow up on this problem just in case other people encounter similar issues, I found out that in my case this error was caused by cropping the region of interest out of the anatomical model. I cropped the Jeduk static surfaces with Planar cut as well as the nerve trajectories to preserve only the torso/chest region. As a result, from some nerve trajectories that extend beyond the region of interest and loop back into the region, multiple wires resulted from the cropping. The discontinuity in these splines caused issues in discretization which showed up in the console as a "Failed to interpolate extracellular fields onto neurons" error for me. This problem was solved by iterating through all the remaining nerve trajectories after cropping and checking using xcm.GetWires() how many wire bodies are contained in each trajectory. If there is more than one, the wire body with the max length is cloned and given the same name as the original trajectory and the problematic trajectory was deleted.
  • Extrude 2D image as mesh or solid

    CAD Modeling
    1
    0 Votes
    1 Posts
    369 Views
    No one has replied