Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Motion Phantom #184

Merged
merged 346 commits into from
May 1, 2024
Merged

Conversation

pvillacorta
Copy link
Collaborator

@pvillacorta pvillacorta commented Oct 9, 2023

This branch is meant to implement Koma's HDF5 Phantom file format (.phantom) in a way that supports different motion models (Related with #73). For this we need to implement:

  • NoMotion<:MotionModel used for static phantoms.
  • SimpleMotion<:MotionModel struct that will replace the currently used ux, uy, and ux fields to have more extensible motion models. There will be a set of different Simple Motion Types (<:SimpleMotionType):
    • Translation
    • Rotation
    • HeartBeat
    • PeriodicTranslation
    • PeriodicRotation
    • PeriodicHeartBeat
    • More types can be added over time
  • ArbitraryMotion<:MotionModel (TO BE OPTIMIZED Simplify ArbitraryMotion struct  #371 ): struct designed to generate arbitrary non-rigid motions. This will enable different structures (spin groups) to have separated motions, in contrast to SimpleMotion that applies the same displacement field to all the spins.
  • read_phantom that will read a .phantom file and generate a Phantom struct.
  • write_phantom that will write a .phantom file from a Phantom struct.
  • HDF5 Phantom file format (.phantom), read .phantom specification file.
  • Example .phantom files, both for SimpleMotion and ArbitraryMotion
  • Tests

@pvillacorta
Copy link
Collaborator Author

From commit b44e7e5 onwards, I have focused on implementing flow information on the moving particles. Flow particles (for us, spins) differ from the rest in that they can enter and leave the Phantom. This, coupled with the fact that the number of spins in a Phantom must be constant, means that particles exiting through an exit duct must be immediately re-injected through an entrance duct. This implies a discontinuity in the spin motion pattern that should not be recorded in the simulation.
For this reason, the resetmag::BitMatrix attribute has been included in the ArbitraryMotion structure, which is a matrix containing information about these discontinuities in the trajectories of each of the spins. When there is a discontinuity, the magnetization of that spin must be reset, hence the name of the matrix.

@pvillacorta
Copy link
Collaborator Author

By executing the cine_test.jl file, one can check the movement of the phantom (both tissue and flow) by means of a cine sequence.

(Warning: a big GPU is needed for this)

  • Tissue motion demonstration (ring_motion.phantom):
    recon

  • Flow motion demonstration (foo_flow.phantom)
    cine_recon

@cncastillo
Copy link
Member

cncastillo commented Nov 2, 2023

Hi @pvillacorta, pretty nice that this is working already. How much memory you need for doing this compared to ArbitraryMotion?

@pvillacorta
Copy link
Collaborator Author

pvillacorta commented Jan 10, 2024

Commits from 2ddf4a7 contain the necessary changes to perform the interpolation within the run_spin_excitation! and run_spin_precession! functions. The interpolation is performed by taking advantage of the GPU support in the Interpolations.jl package. However, with this method, the simulations are slow. I am using NVTX.jl to create profiles and find out where GPU performance problems occur.

@cncastillo cncastillo merged commit 05abed5 into JuliaHealth:master May 1, 2024
17 of 20 checks passed
@pvillacorta pvillacorta deleted the new-phantom-parallel branch May 30, 2024 09:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants