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. Export CT voxel data aligned with SAR/EM grid for use in Python

Export CT voxel data aligned with SAR/EM grid for use in Python

Scheduled Pinned Locked Moved Python API
3 Posts 2 Posters 593 Views 2 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.
  • S Offline
    S Offline
    saeidsh
    wrote last edited by
    #1

    I am working with Sim4Life and exporting simulation results for analysis in Python.
    I can successfully export SAR volumes and the corresponding grid coordinates. When I plot these in Python, they are correctly aligned. Inside Sim4Life, the SAR and CT images overlap perfectly.
    But if I load the original DICOM CT outside of S4L (e.g. with SimpleITK), the CT and SAR do not overlap, origins and orientations differ. This makes me believe that Sim4Life uses its own internal coordinate system for CT, and I need to export the CT from S4L directly in that system (instead of reloading the raw DICOM).

    My questions are:
    How can I export CT (HU values) with the proper coordinate system used inside S4L?
    Either on its native voxel grid, Or resampled onto the EM/SAR grid (preferred for direct overlay).
    What is the correct way in the Python API to access the CT voxel dataset from the project tree?

    Thank you in advance!

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

      Sim4Life does not use any special coordinate system. It just correctly applies origin, spacing and orientation (a rotation matrix) as specified in the dicom/nifti (medical image) formats. When you extract a surface model Sim4Life preserves the correct global position by applying the origin, spacing/orientation. When the gridder/voxeler creates the simulation grid it is aligned but at a different resolution (spacing is different). Actually the gridder uses a rectilinear grid which is axis aligned, so you need to uses the axis information but the orientation is an identity matrix.
      If you are using simple tools like matplotlib that take an image or array but are not aware of the underlying grid that defines the location and distribution of the fields/image values, you could interpolate one field (e.g. SAR) onto the grid of the other field (e.g. the CT image).

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

        Btw, this topic is quite similar
        https://forum.zmt.swiss/topic/735/the-shape-of-the-t1-image-and-the-shape-of-the-electric-field-are-different

        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