Skip to content
  • Search
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse

ZMT zurich med tech

  1. Home
  2. Sim4Life
  3. Python API
  4. Error in TI tutorial

Error in TI tutorial

Scheduled Pinned Locked Moved Python API
13 Posts 3 Posters 237 Views 3 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • brynB Offline
    brynB Offline
    bryn
    ZMT
    wrote last edited by bryn
    #3

    The error looks like something is wrong with the matplotlib package in your installation (the MPLBACKEND environment variable). Did you possibly install any python packages in Sim4Life's Python with 'pip'?

    Can you run any other notebooks with matplotlib plots?

    L 1 Reply Last reply
    0
    • A Offline
      A Offline
      abbytang
      wrote last edited by
      #4

      I didn’t install any Python packages in Sim4Life’s Python environment using 'pip.' I installed this software by selecting all components during setup.

      I’m not sure if my computer’s GPU (NVIDIA GeForce MX250) influenced this process. However, I chose "install deprecated NVIDIA driver" when installed this software.

      image.png

      1 Reply Last reply
      0
      • A Offline
        A Offline
        abbytang
        wrote last edited by
        #5

        When I restart the software and only import IXI025-Guys-0852-T1.nii.gz, the auto-label function works correctly.

        However, when I run tutorial_TI_|X|025_head_model.ipynb, the same error occurs again.

        After the error occurs, if I only load IXI025-Guys-0852-T1.nii.gz and run the 'auto-label function' (head modeling in the Ribbon), the same error now appears at this step. The only way to resolve it is to restart the software and reload IXI025-Guys-0852-T1.nii.gz—then it works correctly again.

        However, if I try to run the TI tutorial, the error persists even after restarting the software.

        image.png

        ![0BB7M7UAW`1BYC63FR)U]26.png](/assets/uploads/files/1748234490112-b021ff28-75cd-48f4-a814-49a0e4042b11-0bb7m7uaw-96-1byc63fr-u-26.png)

        brynB 1 Reply Last reply
        0
        • A Offline
          A Offline
          abbytang
          wrote last edited by
          #6

          I installed the software on a computer with an NVIDIA GTX 1060 GPU, but the errors still persist.

          1 Reply Last reply
          0
          • A abbytang

            When I restart the software and only import IXI025-Guys-0852-T1.nii.gz, the auto-label function works correctly.

            However, when I run tutorial_TI_|X|025_head_model.ipynb, the same error occurs again.

            After the error occurs, if I only load IXI025-Guys-0852-T1.nii.gz and run the 'auto-label function' (head modeling in the Ribbon), the same error now appears at this step. The only way to resolve it is to restart the software and reload IXI025-Guys-0852-T1.nii.gz—then it works correctly again.

            However, if I try to run the TI tutorial, the error persists even after restarting the software.

            image.png

            ![0BB7M7UAW`1BYC63FR)U]26.png](/assets/uploads/files/1748234490112-b021ff28-75cd-48f4-a814-49a0e4042b11-0bb7m7uaw-96-1byc63fr-u-26.png)

            brynB Offline
            brynB Offline
            bryn
            ZMT
            wrote last edited by
            #7

            @abbytang Thanks for the update. We will try to reproduce the issue, and if possible either provide a workaround or contact you to understand why it happens.

            Can you run other tutorial notebooks, e.g. the mesh extrusion tutorial?

            1 Reply Last reply
            0
            • A Offline
              A Offline
              abbytang
              wrote last edited by
              #8

              Thank you for your reply. The mesh extrusion tutorial runs correctly. Since my research focuses on TI, I need tutorial_TI_|X|025_head_model to run correctly. I would greatly appreciate any assistance with resolving those issues.

              image.png

              image.png

              1 Reply Last reply
              0
              • brynB Offline
                brynB Offline
                bryn
                ZMT
                wrote last edited by
                #9

                Are you using the latest Sim4Life, v8.2.2.18061?

                1 Reply Last reply
                0
                • A Offline
                  A Offline
                  abbytang
                  wrote last edited by
                  #10

                  Yes, I'm currently using the latest Sim4Life version (v8.2.2.18061). I will also install version 8.2.0.16876 and test it again for comparison.

                  1 Reply Last reply
                  0
                  • A Offline
                    A Offline
                    abbytang
                    wrote last edited by
                    #11

                    When I copy the file tutorial_TI_|X|025_head_model.ipynb into the CAD files folder of Sim4Life version 8.2.0.16876 and run it in this older version, most sections execute correctly, including the "Auto Label Tissues and Extract Surfaces" part. However, the script fails at the "Computing the Maximum Modulation Using the Masked Electric Fields" section with the following error:
                    AttributeError: module 's4l_v1.analysis.core' has no attribute 'MaxModAmpEvaluator'.
                    Could you please advise on how to resolve this issue? Thank you for your assistance.

                    image.png

                    1 Reply Last reply
                    0
                    • brynB Offline
                      brynB Offline
                      bryn
                      ZMT
                      wrote last edited by
                      #12

                      the MaxModAmpEvaluator was exposed in s4l_v1 6 months ago, so after 8.2.0.16876. You could probably use it though via the 'raw api': XPostProcessor.MaxModAmpEvaluator.

                      1 Reply Last reply
                      0
                      • brynB bryn

                        The error looks like something is wrong with the matplotlib package in your installation (the MPLBACKEND environment variable). Did you possibly install any python packages in Sim4Life's Python with 'pip'?

                        Can you run any other notebooks with matplotlib plots?

                        L Offline
                        L Offline
                        lucky_lin
                        wrote last edited by
                        #13

                        @bryn Hello, I am using a script to run TI simulations. I noticed that when I change the maximum grid step size for the electrodes and tissues from [2.0, 2.0, 2.0] to [3.125, 3.125, 3.125] in each simulation, the peak value of the calculated electric field (E-field) changes from 205 V/m to 445 V/m. Why does the grid step size affect the final calculated E-field value? Additionally, I found that changing the step size also significantly alters the Scale Factor used to normalize the results in each simulation. Here is the relevant code :
                        manual_grid_settings.MaxStep = numpy.array([3.125, 3.125, 3.125]), units.MilliMeters
                        manual_grid_settings.Resolution = numpy.array([1.0, 1.0, 1.0]), units.MilliMeter
                        26caa43b-1a9f-471a-bcac-c9f094e6b7ac-f7133268edf385e3629f1eb84541ed1.jpg
                        56231949-d3bd-42c7-8b1a-da663561de5e-c6a39d9569d9d76c852280466adfcea.jpg

                        1 Reply Last reply
                        0
                        Reply
                        • Reply as topic
                        Log in to reply
                        • Oldest to Newest
                        • Newest to Oldest
                        • Most Votes


                        • Login

                        • Don't have an account? Register

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Search