KomaMRI.jl
KomaMRI.jl copied to clipboard
Create First/Last fill methods for `fix_first_last_grads!(seq)`
Put this inside a function `fix_first_last_grads!(seq)`. Ideally like this:
Put inside function
fix_grads_first_last!(seq::Sequence, fill_method::PulseqFirstLastFill<:FirstLastFillMethod)
Or something like that. Feel free to choose a name for PulseqDefault.
If we apply the type aliases here, we can broadcast the Vector{Grad} and have subfunctions for each alias.
function fix_grads_first_last!(seq::Sequence, fill_method::FirstLastFillMethod)
grad_prev_last = zeros(3)
for s in seq
grad_prev_last = fix_grad_first_last!.(s.GR, grad_prev_last, Ref(fill_method))
end
end
...
fix_grad_first_last!(grad::NoGrad, grad_prev_last, fill_method::PulseqFirstLastFill) = [0;0;0]
fix_grad_first_last!(grad::TrapezoidalGrad, grad_prev_last, fill_method::PulseqFirstLastFill) = ...
fix_grad_first_last!(grad::UniformlySampledGrad, grad_prev_last, fill_method::PulseqFirstLastFill) = ...
fix_grad_first_last!(grad::TimeShapedGrad, grad_prev_last, fill_method::PulseqFirstLastFill) = ...```
_Originally posted by @cncastillo in https://github.com/JuliaHealth/KomaMRI.jl/pull/321#discussion_r1549852850_