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

Pass on concrete times to `BuildingBlock` creation

parent d0933f0b
No related branches found
No related tags found
No related merge requests found
...@@ -250,7 +250,7 @@ Scanner constraints are automatically applied. ...@@ -250,7 +250,7 @@ Scanner constraints are automatically applied.
## Arguments ## Arguments
- `waveform`: Sequence of 2-element tuples with (time, (Gx, Gy, Gz)). If `orientation` is set then the tuple is expected to look like (time, G). This cannot contain any free variables. - `waveform`: Sequence of 2-element tuples with (time, (Gx, Gy, Gz)). If `orientation` is set then the tuple is expected to look like (time, G). This cannot contain any free variables.
- `events`: Sequence of 2-element tuples with (index, pulse/readout). The start time of the pulse/readout at the start of the gradient waveform element with index `index`. A tuple with a delay and the pulse/readout event can be used to change that. - `events`: Sequence of 2-element tuples with (time, pulse/readout). The `time` is the start time of the pulse/readout.
- `duration`: duration of this `BuildingBlock`. If not set then it will be assumed to be the time of the last element in `waveform`. - `duration`: duration of this `BuildingBlock`. If not set then it will be assumed to be the time of the last element in `waveform`.
- `orientation`: orientation of the gradients in the waveform. If not set, then the full gradient vector should be given explicitly. - `orientation`: orientation of the gradients in the waveform. If not set, then the full gradient vector should be given explicitly.
- `group`: group of the gradient waveform - `group`: group of the gradient waveform
...@@ -279,9 +279,10 @@ function BuildingBlock(waveform::AbstractVector, events::AbstractVector; orienta ...@@ -279,9 +279,10 @@ function BuildingBlock(waveform::AbstractVector, events::AbstractVector; orienta
else else
push!(components, ChangingGradient(prev_grad, (grad .- prev_grad) ./ duration, orientation, duration, group)) push!(components, ChangingGradient(prev_grad, (grad .- prev_grad) ./ duration, orientation, duration, group))
end end
while length(events) > 0 && index_grad == events[1][1] for (t_event, event) in events
(_, event) = popfirst!(events) if prev_time <= t_event < time
push!(components, event) push!(components, (t_event - prev_time, event))
end
end end
end end
#for comp in components #for comp in components
......
...@@ -299,7 +299,6 @@ function build_sequence(; scanner=nothing, B0=3., TR=nothing, definitions, versi ...@@ -299,7 +299,6 @@ function build_sequence(; scanner=nothing, B0=3., TR=nothing, definitions, versi
push!(amplitudes, 0.) push!(amplitudes, 0.)
end end
end end
@show events
extend_grad!.(grad_shapes) extend_grad!.(grad_shapes)
arrs = align_in_time(grad_shapes...) arrs = align_in_time(grad_shapes...)
waveform = [(t, SVector{3, Float64}(gx, gy, gz)) for (t, gx, gy, gz) in zip(arrs...)] waveform = [(t, SVector{3, Float64}(gx, gy, gz)) for (t, gx, gy, gz) in zip(arrs...)]
......
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