Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create First/Last fill methods for fix_first_last_grads!(seq) #366

Open
cncastillo opened this issue Apr 8, 2024 · 0 comments
Open

Create First/Last fill methods for fix_first_last_grads!(seq) #366

cncastillo opened this issue Apr 8, 2024 · 0 comments

Comments

@cncastillo
Copy link
Member

          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_
            
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant