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 3.4k 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 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
                                    • L Offline
                                      L Offline
                                      lucky_lin
                                      wrote on last edited by
                                      #21

                                      No, I only did these things after creating a new file.

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

                                        I can reproduce your issue. If I set the transform to "0", i.e. Identity, the predictor fails. The head40 segmentation is also less accurate! We need to investigate.

                                        A workaround would be:

                                        • load image
                                        • predict landmarks & segmentation
                                        • compute inverse image transform
                                        • apply this inverse to landmarks/segmentation/surfaces/etc
                                        # assumes verts and labelfield are already predicted (without setting transform to "0")
                                        inv_tx = img.Transform.Inverse()
                                        
                                        # transform segmentation
                                        labelfield.ApplyTransform(inv_tx )
                                        
                                        # transform landmarks
                                        for v in verts:
                                            v.ApplyTransform(inv_tx )
                                        
                                        1 Reply Last reply
                                        0
                                        • brynB Offline
                                          brynB Offline
                                          bryn
                                          ZMT
                                          wrote on last edited by
                                          #23

                                          The issue is that our neural network was trained with the data in the RAS orientation (with some deviation +- 15 degrees, and flipping in all axes). If you manually edit the transform, you break assumptions used to pre-orient the data into RAS ordering.

                                          Since RAS is a widely used convention in neuroscience, and medical images are always acquired with a direction (rotation) matrix and offset (translation), I think it is best you don't modify the transform.

                                          For instance, if you try to assign DTI-based conductivity maps - you will need to rotate the grid AND the tensors accordingly. It can be done, but it will be more effort...

                                          If this is to investigate if the fields are (nearly) symmetric, I suggest you

                                          • find an approximate symmetry plane (wrt to the brain or skull or ...)
                                          • align the plane of a slice viewer perpendicular to the symmetry plane
                                          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