Skip to content

Commit

Permalink
Merge pull request #314 from curtcorum/master_pull_request_curtcorum
Browse files Browse the repository at this point in the history
Fixes for no gradients in seq file.
  • Loading branch information
cncastillo authored Mar 6, 2024
2 parents 18979c1 + 80c8784 commit 4cdd26e
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions KomaMRIFiles/src/Sequence/Pulseq.jl
Original file line number Diff line number Diff line change
Expand Up @@ -476,11 +476,17 @@ Reads the gradient. It is used internally by [`get_block`](@ref).
"""
function read_Grad(gradLibrary, shapeLibrary, Δt_gr, i)
G = Grad(0,0)
if gradLibrary[i]["type"] == 't' #if trapezoidal gradient
if i==0
#No gradient in this block, i==0 is reserved for this case
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
#(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
elseif gradLibrary[i]["type"] == 'g' #Arbitrary gradient waveform, fix from https://github.com/JuliaHealth/KomaMRI.jl/discussions/311#discussion-6251011
#(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 4cdd26e

Please sign in to comment.