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. Anatomical Models
  4. Automatic Head Model including 1010-System / Electrode Placement

Automatic Head Model including 1010-System / Electrode Placement

Scheduled Pinned Locked Moved Anatomical Models
30 Posts 3 Posters 2.9k 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 on last edited by bryn
    #1

    The latest release 8.2 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

    L 2 Replies Last reply
    1
    • L Offline
      L Offline
      lucky_lin
      wrote on last edited by
      #2

      In the GUI, how to automatically place landmarks?

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

        I tried to repeat what the script is doing here:
        Youtube Video

        To predict the 4 landmarks:

        1. Select the MRI (T1-weighted image)
        2. Select the Head-Modeling -> Auto-Label tool
        3. Under Inference Task choose the 10-10-system landmarks, press Run button

        You then

        • segment the head (choose the Head40 "Inference Task" in the Auto-Label tool)
        • extract surfaces from the labelfield,
        • select the skin and the landmarks
        • run the Head Modeling -> 10-10 System tool: this creates the local coordinate system points for each 10-10 system point
        • select your template electrode and the 10-10 system points
        • run the Head Modeling -> Electrode Placement tool
        L 1 Reply Last reply
        1
        • brynB bryn

          I tried to repeat what the script is doing here:
          Youtube Video

          To predict the 4 landmarks:

          1. Select the MRI (T1-weighted image)
          2. Select the Head-Modeling -> Auto-Label tool
          3. Under Inference Task choose the 10-10-system landmarks, press Run button

          You then

          • segment the head (choose the Head40 "Inference Task" in the Auto-Label tool)
          • extract surfaces from the labelfield,
          • select the skin and the landmarks
          • run the Head Modeling -> 10-10 System tool: this creates the local coordinate system points for each 10-10 system point
          • select your template electrode and the 10-10 system points
          • run the Head Modeling -> Electrode Placement tool
          L Offline
          L Offline
          lucky_lin
          wrote on last edited by lucky_lin
          #4
          This post is deleted!
          1 Reply Last reply
          0
          • L Offline
            L Offline
            lucky_lin
            wrote on last edited by
            #5

            @bryn Thank you very much for your help. I successfully completed the TI simulation, but I found that the simulation results for the two single-electrode pairs are not completely symmetrical. The maximum electric fields they generate in the GM are 0.0933 V/m and 0.0882 V/m, respectively. My method was to clone the two LF-Electro Ohmic Quasi-Stat simulations, modifying the frequency and boundary conditions for each. The electrode pairs I chose are F5-P5 and F6-P6. Is my approach correct, or should I consider using a multi-port simulation instead?

            1 Reply Last reply
            0
            • L Offline
              L Offline
              lucky_lin
              wrote on last edited by lucky_lin
              #6
              This post is deleted!
              1 Reply Last reply
              0
              • L Offline
                L Offline
                lucky_lin
                wrote on last edited by
                #7

                I encountered a grid mismatch error when calculating the max modulation, but I cloned the LF-Electro Ohmic Quasi-Stat. Why is it different?
                0cecc149c1122591e91d6082150e7a9.png

                1 Reply Last reply
                0
                • ofliO Offline
                  ofliO Offline
                  ofli
                  ZMT
                  wrote on last edited by
                  #8

                  Hi @lucky_lin Did you update the grid before running the first simulation? And did you make any changes to the model after setting the grid for the first simulation?
                  If possible, please share your project with us at s4l-support@zmt.swiss, and we will take a look.

                  1 Reply Last reply
                  2
                  • L Offline
                    L Offline
                    lucky_lin
                    wrote on last edited by
                    #9

                    I updated the grid for the second LF-Electro Ohmic Quasi-Stat, and now I have chosen to add all electrodes in each simulation grid. The problem has been resolved, but I still have questions about the asymmetry between the two simulation results.

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

                      Did you check the segmentation? Is the head symmetric? Are there differences between left/right, e.g. thinner skull, holes in the CSF or Dura, etc.

                      If there are holes, and these seem to be the cause of the asymmetry, maybe reduce the output_spacing to the default 0.3mm. The value output_spacing=0.6 set above in the script could be too coarse to resolve certain thin tissues.

                      Do the the electrodes seem symmetrically placed wrt the anatomy?

                      Did you check the simulation voxels? Is there something "asymmetric" about the voxels?

                      1 Reply Last reply
                      0
                      • L Offline
                        L Offline
                        lucky_lin
                        wrote on last edited by lucky_lin
                        #11

                        The segmentation is indeed asymmetric. I used the IXI025-Guys-0852-T1.nii.gz provided in the tutorial. Is it because the T1W is asymmetric? I don't know much about brain structure; is this normal?
                        image.png
                        image.png
                        f5af4cc9-8164-4745-b374-8d459a985b83-image.png

                        1 Reply Last reply
                        0
                        • L Offline
                          L Offline
                          lucky_lin
                          wrote on last edited by
                          #12

                          There are some holes in the other tissues.
                          image.png

                          brynB 1 Reply Last reply
                          0
                          • L lucky_lin

                            There are some holes in the other tissues.
                            image.png

                            brynB Offline
                            brynB Offline
                            bryn
                            ZMT
                            wrote on last edited by
                            #13

                            @lucky_lin "Other tissues" is basically fat. I don't think this is an issue.

                            Note, that the head is not perfectly aligned with the axis, i.e. your XY plane may not be perpendicular to the "up" direction. You can also change the slice by using the interactive slice instead of axis-aligned.

                            Finally. Yes, it is normal that real subjects/people have asymmetrical features. If you are interested in the research question, you could test the impact of individual tissues (conductivity) by

                            • assigning the same tissue property to all tissues (except for Air?). Is this nearly/more symmetrical?
                            • assigning the same tissue property to all tissues, except for one tissue (and Air). Candidates are the thin layers around the brain, e.g. Dura, CSF, Brain grey matter, Skull cortical/cancellous, [Galea, Muscle, ...].
                            1 Reply Last reply
                            0
                            • L Offline
                              L Offline
                              lucky_lin
                              wrote on last edited by
                              #14

                              I don't quite understand why the T1W I imported is not aligned with the grid. In the GUI, the grid can be adjusted, but how can I ensure they are aligned in a script simulation?

                              1 Reply Last reply
                              0
                              • L Offline
                                L Offline
                                lucky_lin
                                wrote on last edited by lucky_lin
                                #15

                                @bryn I tried to set both the rotation and translation of T1W to 0 and then generate the reference point, but it reported an error: Modeler : [Error] Exception during import: Expecting 'Version 1.0' on first line Modeler : [Error] operation unsuccessful.

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

                                  The T1w image is placed in world (scanner) coordinates. This is useful, e.g. to align different acquisitions (e.g. T1, T2 with different resolutions or field of view).

                                  You could remove the rotation and translation, e.g., by setting an identity transform. However, in my experience, it is often useful to preserve the position in world coordinates.

                                  img = XCoreModeling.Import("some_t1w_mri.nii.gz")
                                  img.Transform = XCoreModeling.Transform()
                                  
                                  L 1 Reply Last reply
                                  0
                                  • brynB bryn

                                    The T1w image is placed in world (scanner) coordinates. This is useful, e.g. to align different acquisitions (e.g. T1, T2 with different resolutions or field of view).

                                    You could remove the rotation and translation, e.g., by setting an identity transform. However, in my experience, it is often useful to preserve the position in world coordinates.

                                    img = XCoreModeling.Import("some_t1w_mri.nii.gz")
                                    img.Transform = XCoreModeling.Transform()
                                    
                                    L Offline
                                    L Offline
                                    lucky_lin
                                    wrote on last edited by
                                    #17

                                    @bryn I set the rotation and translation of T1W and the grid to 0, but I cannot generate the landmarks. [Error] Exception during import: Expecting 'Version 1.0' on first line Modeler : [Error] operation unsuccessful.

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

                                      I don't understand what you are doing. The error looks like Sim4Life cannot parse the .pts file produced by the landmark predictor.

                                      • did you edit the .pts file manually?
                                      • where/how did you set the rotation/translation to "0"?
                                      • did you try to set the transform [to zero] (before running the prediction) as suggested in my last post?
                                      1 Reply Last reply
                                      0
                                      • L Offline
                                        L Offline
                                        lucky_lin
                                        wrote on last edited by lucky_lin
                                        #19

                                        After importing T1W in the GUI, it is not aligned with the grid, so I adjusted the rotation and translation of T1W in the controller.
                                        I did not modify the .pts file; I just made the changes above and then tried to generate the landmarks.
                                        4510d0b9effdd5b2ee9881d8e14975e.png

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

                                          But previously you managed to generate them, i.e. before you edited the transform?

                                          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