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

Add ramp_overlap variable to `SingleLine`

parent 96aeacb0
No related branches found
No related tags found
No related merge requests found
module SingleLines
import JuMP: @constraint
import ....BuildingBlocks: set_simple_constraints!
import ....BuildSequences: global_model
import ....Readouts: ADC
import ....Variables: dwell_time, inverse_fov, resolution, nsamples, effective_time, gradient_strength, slew_rate, inverse_voxel_size, rise_time, duration, variables
import ....Variables: dwell_time, inverse_fov, resolution, nsamples, effective_time, gradient_strength, slew_rate, inverse_voxel_size, rise_time, duration, variables, fov, voxel_size, flat_time, ramp_overlap
import ...Abstract: AbstractOverlapping, waveform, interruptions
import ...GradientPulses: TrapezoidGradient
struct SingleLine <: AbstractOverlapping
adc :: ADC
grad :: TrapezoidGradient
ramp_overlap :: VariableType
end
function SingleLine(; nsamples=nothing, dwell_time=nothing, time_to_center=nothing, adc_duration=nothing, center_halfway=true, rotate=:FOV, kwargs...)
readout = ADC(nsamples=nsamples, dwell_time=dwell_time, time_to_center=time_to_center, duration=adc_duration, center_halfway=center_halfway)
"""
SingleLine(adc; rotate=:FOV, orientation=[1, 0, 0], ramp_overlap=1., variables...)
Adds a [`TrapezoidGradient`](@ref) to underly the [`ADC`](@ref) event.
## Parameters
- `rotate`: with which user-set parameter will this gradient be rotated (default: :FOV).
- `orientation`: gradient orientation before rotation (default: [1, 0, 0]).
- `ramp_overlap`: how much the gradient ramp should overlap with the ADC. 0 for no overlap, 1 for full overlap (default: 1). Can be set to `nothing` to become a free variable.
## Variables
New variables added at this level:
- [`fov`](@ref): FOV of the output image along this single k-space line in mm.
- [`voxel_size`](@ref): size of each voxel along this single k-space line in mm.
ADC variables:
- [`resolution`](@ref): number of voxels in the readout direction. This can be a non-integer value during optimisation.
- [`nsamples`](@ref): number of samples in the readout. This can be a non-integer value during optimisation.
- [`dwell_time`](@ref): Time between each readout sample in ms.
- [`effective_time`](@ref): time till the center of k-space from the start of the gradient (might not be the same as the start of the ADC).
Gradient variables:
- [`gradient_strength`](@ref): Maximum gradient strength achieved during the pulse in kHz/um
"""
function SingleLine(adc; rotate=:FOV, orientation=[1, 0, 0], ramp_overlap=1., kwargs...)
res = SingleLine(
readout,
TrapezoidGradient(orientation=[1, 0, 0], flat_time=duration(readout), duration=:min, rotate=rotate)
adc,
TrapezoidGradient(orientation=orientation, duration=:min, rotate=rotate),
get_free_variable(ramp_overlap),
)
@constraint global_model() (res.ramp_overlap * rise_time(res.grad) + flat_time(res.grad)) == duration(adc)
set_simple_constraints!(res, kwargs)
return res
end
......@@ -23,6 +51,7 @@ end
waveform(sl::SingleLine) = waveform(sl.grad)
interruptions(sl::SingleLine) = [(index=2, time=effective_time(sl.adc), object=sl.adc)]
ramp_overlap(sl::SingleLine) = sl.ramp_overlap
effective_time(sl::SingleLine) = rise_time(sl.grad) + effective_time(sl.adc)
dwell_time(sl::SingleLine) = dwell_time(sl.adc)
slew_rate(sl::SingleLine) = slew_rate(sl.grad)[1]
......
......@@ -44,6 +44,7 @@ all_variables_symbols = [
:inverse_voxel_size => "Inverse of voxel size in 1/mm. Also see [`voxel_size`](@ref).",
:resolution => "Number of voxels in the final readout. During the optimisation this might produce non-integer values, but this will be fixed after optimsation.",
:oversample => "How much to oversample with ([`nsamples`](@ref) / [`resolution`](@ref))",
:ramp_overlap => "Fraction of overlap between ADC event and underlying gradient pulse ramp (between 0 and 1)."
]
]
......
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