Skip to content
Snippets Groups Projects
Unverified Commit e87316bc authored by Michiel Cottaar's avatar Michiel Cottaar
Browse files

Allow very slight extrapolation of gradient strength

parent f9b58937
No related branches found
No related tags found
1 merge request!3Add InstantPulse and InstantGradient pulseq extension support
...@@ -74,6 +74,7 @@ function BuildingBlock(pulseq::PulseqBlock; version, BlockDurationRaster, Radiof ...@@ -74,6 +74,7 @@ function BuildingBlock(pulseq::PulseqBlock; version, BlockDurationRaster, Radiof
push!(times, 0.) push!(times, 0.)
end end
waveform = [(t, _get_amplitude.(grads, t, GradientRasterTime)) for t in times] waveform = [(t, _get_amplitude.(grads, t, GradientRasterTime)) for t in times]
@show waveform
return BuildingBlock(waveform, events) return BuildingBlock(waveform, events)
end end
...@@ -106,6 +107,11 @@ end ...@@ -106,6 +107,11 @@ end
function _get_amplitude(grad::PulseqGradient, time::Number, raster::Number) function _get_amplitude(grad::PulseqGradient, time::Number, raster::Number)
amp = grad.amplitude * 1e-3 amp = grad.amplitude * 1e-3
edges = _control_times(grad, raster) edges = _control_times(grad, raster)
if time edges[1]
return grad.shape.samples[1]
elseif time edges[end]
return grad.shape.samples[end]
end
return amp * linear_interpolation(edges, grad.shape.samples, extrapolation_bc=0.)(time) return amp * linear_interpolation(edges, grad.shape.samples, extrapolation_bc=0.)(time)
end end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment