Skip to content

Commit

Permalink
Merge pull request #316 from JuliaHealth/hot-fix-empty-grad
Browse files Browse the repository at this point in the history
Hot fix empty grad
  • Loading branch information
cncastillo authored Mar 7, 2024
2 parents 4cdd26e + 68da808 commit d0e219e
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions KomaMRIFiles/src/Sequence/Pulseq.jl
Original file line number Diff line number Diff line change
Expand Up @@ -476,17 +476,15 @@ Reads the gradient. It is used internally by [`get_block`](@ref).
"""
function read_Grad(gradLibrary, shapeLibrary, Δt_gr, i)
G = Grad(0,0)
if i==0
#No gradient in this block, i==0 is reserved for this case
if isempty(gradLibrary) || i==0
return G
elseif isempty(gradLibrary) #isempty(gradLibrary) checked first or error below
#No gradient shapes defined in seq file, set G to zero from above
@error "No gradients defined in seq file [GRADIENTS] or [TRAP] sections, but id $i used in [BLOCKS]."
elseif gradLibrary[i]["type"] == 't' #if trapezoidal gradient
end

if gradLibrary[i]["type"] == 't' #if trapezoidal gradient
#(1)amplitude (2)rise (3)flat (4)fall (5)delay
g_A, g_rise, g_T, g_fall, g_delay = gradLibrary[i]["data"]
G = Grad(g_A,g_T,g_rise,g_fall,g_delay)
elseif gradLibrary[i]["type"] == 'g' #Arbitrary gradient waveform, fix from https://github.com/JuliaHealth/KomaMRI.jl/discussions/311#discussion-6251011
elseif gradLibrary[i]["type"] == 'g' #Arbitrary gradient waveform
#(1)amplitude (2)amp_shape_id (3)time_shape_id (4)delay
g = gradLibrary[i]["data"]
amplitude = g[1]
Expand Down

0 comments on commit d0e219e

Please sign in to comment.