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

Add resolution and nsamples variables

parent 5187fb0d
No related branches found
No related tags found
No related merge requests found
module ADCs module ADCs
import JuMP: @constraint import JuMP: @constraint
import ...Variables: variables, dwell_time, duration, effective_time, get_free_variable, VariableType, nsamples, resolution import ...Variables: variables, dwell_time, duration, effective_time, get_free_variable, VariableType, nsamples, resolution, oversample
import ...BuildingBlocks: BuildingBlock, apply_simple_constraint!, set_simple_constraints!, fixed import ...BuildingBlocks: BuildingBlock, apply_simple_constraint!, set_simple_constraints!, fixed
import ...BuildSequences: global_model import ...BuildSequences: global_model
...@@ -19,9 +19,10 @@ Adds a readout event with `nsamples` readouts. ...@@ -19,9 +19,10 @@ Adds a readout event with `nsamples` readouts.
- `time_to_center`: time till the center of k-space. - `time_to_center`: time till the center of k-space.
""" """
struct ADC <: BuildingBlock struct ADC <: BuildingBlock
nsamples :: VariableType resolution :: VariableType
dwell_time :: VariableType dwell_time :: VariableType
time_to_center :: VariableType time_to_center :: VariableType
oversample :: VariableType
end end
function ADC(; nsamples=nothing, dwell_time=nothing, time_to_center=nothing, center_halfway=true, kwargs...) function ADC(; nsamples=nothing, dwell_time=nothing, time_to_center=nothing, center_halfway=true, kwargs...)
...@@ -41,14 +42,15 @@ function ADC(; nsamples=nothing, dwell_time=nothing, time_to_center=nothing, cen ...@@ -41,14 +42,15 @@ function ADC(; nsamples=nothing, dwell_time=nothing, time_to_center=nothing, cen
return res return res
end end
nsamples(adc::ADC) = adc.nsamples oversample(adc::ADC) = adc.oversample
nsamples(adc::ADC) = resolution(adc) * oversample(adc)
dwell_time(adc::ADC) = adc.dwell_time dwell_time(adc::ADC) = adc.dwell_time
duration(adc::ADC) = nsamples(adc) * dwell_time(adc) duration(adc::ADC) = nsamples(adc) * dwell_time(adc)
time_to_center(adc::ADC) = adc.time_to_center time_to_center(adc::ADC) = adc.time_to_center
effective_time(adc::ADC) = time_to_center(adc) effective_time(adc::ADC) = time_to_center(adc)
resolution(adc::ADC) = adc.nsamples resolution(adc::ADC) = adc.resolution
variables(::Type{<:ADC}) = [nsamples, dwell_time, duration, time_to_center, resolution] variables(::Type{<:ADC}) = [nsamples, dwell_time, duration, time_to_center, resolution, oversample]
function fixed(adc::ADC) function fixed(adc::ADC)
# round nsamples during fixing # round nsamples during fixing
......
...@@ -36,10 +36,11 @@ all_variables_symbols = [ ...@@ -36,10 +36,11 @@ all_variables_symbols = [
], ],
:readout => [ :readout => [
:dwell_time => "Time between two samples in an `ADC` in ms.", :dwell_time => "Time between two samples in an `ADC` in ms.",
:nsamples => "Number of samples during a readout. During the optimisation this might produce non-integer values (also see [`resolution`](@ref)).", :nsamples => "Number of samples during a readout. During the optimisation this might produce non-integer values.",
:fov => "Size of the field of view in mm.", :fov => "Size of the field of view in mm.",
:voxel_size => "Size of each voxel in mm.", :voxel_size => "Size of each voxel in mm.",
:resolution => "Number of voxels in the final readout (also see [`nsamples`](@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))",
] ]
] ]
......
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