JuliaHealth / KomaMRI.jl

Koma is a Pulseq-compatible framework to efficiently simulate Magnetic Resonance Imaging (MRI) acquisitions. The main focus of this package is to simulate general scenarios that could arise in pulse sequence development.
https://JuliaHealth.github.io/KomaMRI.jl/dev/
MIT License
112 stars 20 forks source link

Tracking Mxy evolution #494

Open gsahonero opened 1 day ago

gsahonero commented 1 day ago

Observing how the transverse magnetization evolves throughout a given sequence for sequence design and educational purposes could be useful. The conceptual code would be something like: results = simulate(phantom, seq, sys, sim_params = Dict{String, Any}("return_type"=>"full", "sim_method" => Bloch(save_state_at = t)) Where t references time points where we want to know the values of Mxy, and results is a tuple. The first element of results has an array of states of size (length(t), n_spins) and the second has the (Nx, Ny) matrix that return_type=>"mat" returns.

Moreover, we could write a function that allows the evolution to be visualized as with the motion phantom, i.e., plot_state_evolution(Xt) Where Xt = results[1] and the resulting plot shows the transverse magnetization per spin and includes a slider+play button for observing the evolution according to the time points declared in t.

cncastillo commented 1 day ago

This is a good idea, we can check what DifferentialEquations.jl is doing, to try to follow their logic, not sure if putting the save_state_at inside the simulation method would be the best, comparing it to putting save_state_at as an optional argument in simulate.