Skip to content

Commit

Permalink
Update KomaMRICore/src/simulation/Bloch/BlochVoxelDictSimulation.jl
Browse files Browse the repository at this point in the history
  • Loading branch information
cncastillo committed Jul 10, 2024
1 parent c4c7bce commit c57c44d
Showing 1 changed file with 0 additions and 24 deletions.
24 changes: 0 additions & 24 deletions KomaMRICore/src/simulation/Bloch/BlochVoxelDictSimulation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -48,27 +48,3 @@ function run_spin_precession!(p::Phantom{T}, seq::DiscreteSequence{T}, sig::Abst

return nothing

Check warning on line 49 in KomaMRICore/src/simulation/Bloch/BlochVoxelDictSimulation.jl

View check run for this annotation

Codecov / codecov/patch

KomaMRICore/src/simulation/Bloch/BlochVoxelDictSimulation.jl#L49

Added line #L49 was not covered by tests
end


function run_spin_excitation!(p::Phantom{T}, seq::DiscreteSequence{T}, sig::AbstractArray{Complex{T}},
M::Mag{T}, sim_method::BlochVoxelDict) where {T<:Real}
#Simulation
for s seq #This iterates over seq, "s = seq[i,:]"
#Motion
xt = p.x .+ p.ux(p.x, p.y, p.z, s.t)
yt = p.y .+ p.uy(p.x, p.y, p.z, s.t)
zt = p.z .+ p.uz(p.x, p.y, p.z, s.t)
#Effective field
ΔBz = p.Δw ./ T(2π * γ) .- s.Δf ./ T(γ) # ΔB_0 = (B_0 - ω_rf/γ), Need to add a component here to model scanner's dB0(xt,yt,zt)
Bz = (s.Gx .* xt .+ s.Gy .* yt .+ s.Gz .* zt) .+ ΔBz
B = sqrt.(abs.(s.B1) .^ 2 .+ abs.(Bz) .^ 2)
B[B .== 0] .= eps(T)
#Spinor Rotation
φ = T(-2π * γ) * (B .* s.Δt) # TODO: Use trapezoidal integration here (?), this is just Forward Euler
mul!( Q(φ, s.B1 ./ B, Bz ./ B), M )
#Relaxation
M.xy .= M.xy .* exp.(-s.Δt ./ p.T2)
M.z .= M.z .* exp.(-s.Δt ./ p.T1) .+ p.ρ .* (1 .- exp.(-s.Δt ./ p.T1))
end
return nothing
end

0 comments on commit c57c44d

Please sign in to comment.