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

Add scale to RF pulses

parent 35ea7df3
No related branches found
No related tags found
No related merge requests found
......@@ -23,14 +23,17 @@ struct ConstantPulse <: RFPulseBlock
duration :: VariableType
phase :: VariableType
frequency :: VariableType
scale :: Union{Nothing, Symbol}
end
@global_model_constructor ConstantPulse
function ConstantPulse(model::Model; amplitude=nothing, duration=nothing, phase=nothing, frequency=nothing, kwargs...)
function ConstantPulse(model::Model; amplitude=nothing, duration=nothing, phase=nothing, frequency=nothing, scale=nothing, kwargs...)
res = ConstantPulse(
model,
[get_free_variable(model, value) for value in (amplitude, duration, phase, frequency)]...
[get_free_variable(model, value) for value in (amplitude, duration, phase, frequency)]...,
scale
)
@constraint model res.amplitude >= 0
set_simple_constraints!(model, res, kwargs)
......
......@@ -9,15 +9,17 @@ struct InstantRFPulseBlock <: RFPulseBlock
model :: Model
flip_angle :: VariableType
phase :: VariableType
scale :: Union{Nothing, Symbol}
end
@global_model_constructor InstantRFPulseBlock
function InstantRFPulseBlock(model::Model; flip_angle=nothing, phase=nothing)
function InstantRFPulseBlock(model::Model; flip_angle=nothing, phase=nothing, scale=nothing)
res = InstantRFPulseBlock(
model,
get_free_variable(model, flip_angle),
get_free_variable(model, phase)
get_free_variable(model, phase),
scale
)
@constraint model res.flip_angle >= 0
return res
......
......@@ -39,13 +39,14 @@ struct SincPulse <: RFPulseBlock
phase :: VariableType
frequency :: VariableType
lobe_duration :: VariableType
scale :: Union{Nothing, Symbol}
end
@global_model_constructor SincPulse
function SincPulse(model::Model;
symmetric=true, max_Nlobes=nothing, apodise=true, N_lobes=nothing, N_left=nothing, N_right=nothing,
amplitude=nothing, phase=nothing, frequency=nothing, lobe_duration=nothing, kwargs...
amplitude=nothing, phase=nothing, frequency=nothing, lobe_duration=nothing, scale=nothing, kwargs...
)
if symmetric
N_lobes = get_free_variable(model, N_lobes)
......@@ -63,7 +64,8 @@ function SincPulse(model::Model;
nlobe_integral_params(max_Nlobes, apodise),
N_left_var,
N_right_var,
[get_free_variable(model, value) for value in (amplitude, phase, frequency, lobe_duration)]...
[get_free_variable(model, value) for value in (amplitude, phase, frequency, lobe_duration)]...,
scale
)
@constraint model res.amplitude >= 0
@constraint model res.N_left >= 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