Skip to content
Snippets Groups Projects
Unverified Commit 7d116577 authored by Michiel Cottaar's avatar Michiel Cottaar
Browse files

Add variables. in documentation links

parent d72c03b3
No related branches found
No related tags found
1 merge request!2Define variables through new @defvar macro
Showing
with 92 additions and 106 deletions
...@@ -56,11 +56,10 @@ The next step is to define [summary variables](@ref variables) that the user can ...@@ -56,11 +56,10 @@ The next step is to define [summary variables](@ref variables) that the user can
echo_time(ge::DiffusionSpinEcho) = 2 * (variables.effective_time(ge, :refocus) - variables.effective_time(ge, :excitation)) echo_time(ge::DiffusionSpinEcho) = 2 * (variables.effective_time(ge, :refocus) - variables.effective_time(ge, :excitation))
end end
``` ```
For this sequence, we can see that we define the [`diffusion_time`](@ref) as the time between the start of the first and second gradient pulse, and the [`echo_time`](@ref) as twice the time between the refocus and excitation pulses. For this sequence, we can see that we define the [`variables.diffusion_time`](@ref) as the time between the start of the first and second gradient pulse, and the [`variables.echo_time`](@ref) as twice the time between the refocus and excitation pulses.
These variables need to be defined within a [`@defvar`](@ref) block. These variables need to be defined within a [`@defvar`](@ref) block.
They will be available as function calls within the [`variables`](@ref) object.
In addition to these sequence-specific summary variables, there are also a lot of variables already pre-defined on individual components, such as the [`slice_thickness](@ref) of the RF pulse or the [`gradient_strength`](@ref) of the gradient pulses. To access these summary variables on a sequence-level, we need to tell MRIBuilder for which RF pulses/gradients we are interested in computing these variables: In addition to these sequence-specific summary variables, there are also a lot of variables already pre-defined on individual components, such as the [`variables.slice_thickness](@ref) of the RF pulse or the [`variables.gradient_strength`](@ref) of the gradient pulses. To access these summary variables on a sequence-level, we need to tell MRIBuilder for which RF pulses/gradients we are interested in computing these variables:
```julia ```julia
get_pulse(seq::DiffusionSpinEcho) = (excitation=seq[:excitation], refocus=seq[:refocus]) get_pulse(seq::DiffusionSpinEcho) = (excitation=seq[:excitation], refocus=seq[:refocus])
get_gradient(seq::DiffusionSpinEcho) = (gradient=seq[:gradient], gradient2=seq[:gradient2]) get_gradient(seq::DiffusionSpinEcho) = (gradient=seq[:gradient], gradient2=seq[:gradient2])
...@@ -74,7 +73,7 @@ using MRIBuilder ...@@ -74,7 +73,7 @@ using MRIBuilder
sequence = DiffusionSpinEcho(bval=1., TE=:min, slice_thickness=2.) sequence = DiffusionSpinEcho(bval=1., TE=:min, slice_thickness=2.)
variables.flip_angle(sequence) variables.flip_angle(sequence)
``` ```
Here we can see that we get the [`flip_angle`](@ref) for each of the two RF pulses defined using [`get_pulse`](@ref) above. Here we can see that we get the [`variables.flip_angle`](@ref) for each of the two RF pulses defined using [`get_pulse`](@ref) above.
The final component to defining summary variables is to define one or more default coherence pathways using [`get_pathway`]: The final component to defining summary variables is to define one or more default coherence pathways using [`get_pathway`]:
```julia ```julia
...@@ -84,8 +83,8 @@ Here the coherence [`Pathway`](@ref) sets out what a specific set of spins might ...@@ -84,8 +83,8 @@ Here the coherence [`Pathway`](@ref) sets out what a specific set of spins might
In this case the sequence experiences two RF pulses and is excited by the first pulse and flipped by the second (`[90, 180]`). In this case the sequence experiences two RF pulses and is excited by the first pulse and flipped by the second (`[90, 180]`).
It is then observed during the first readout (`1`). It is then observed during the first readout (`1`).
For such a [`Pathway`](@ref) we can compute: For such a [`Pathway`](@ref) we can compute:
- the time that the spin spends in each longitudinal and transverse direction, which is particularly useful in the transverse direction to compute the amount of T2-weighting ([`duration_transverse`](@ref)) and the amount of time spent dephasing to compute the amount of T2*-weighting ([`duration_dephase`](@ref)). - the time that the spin spends in each longitudinal and transverse direction, which is particularly useful in the transverse direction to compute the amount of T2-weighting ([`variables.duration_transverse`](@ref)) and the amount of time spent dephasing to compute the amount of T2*-weighting ([`variables.duration_dephase`](@ref)).
- the diffusion weighting experienced ([`bval`](@ref), [`bmat`](@ref), and [`qvec`](@ref)) - the diffusion weighting experienced ([`variables.bval`](@ref), [`variables.bmat`](@ref), and [`variables.net_dephasing`](@ref))
By defining a default pathway for the sequence, the user can now put constraints on any or all of these variables. By defining a default pathway for the sequence, the user can now put constraints on any or all of these variables.
......
...@@ -8,7 +8,7 @@ To get help on a specific sequence, either follow the link in the sequence list ...@@ -8,7 +8,7 @@ To get help on a specific sequence, either follow the link in the sequence list
When reading the help, you will notice that there are two type of expected inputs: When reading the help, you will notice that there are two type of expected inputs:
- `Parameters`: these define the type of components that will be includes, e.g., the shape of the excitation pulse or the readout strategy. These parameters have to be set to certain fixed values. If unset, they will be determined by their default value as defined in the documentation. - `Parameters`: these define the type of components that will be includes, e.g., the shape of the excitation pulse or the readout strategy. These parameters have to be set to certain fixed values. If unset, they will be determined by their default value as defined in the documentation.
- `Variables`: These are a special type of parameters. In addition to being set to a fixed value, they can also be set to `:min` or `:max` to minimise or maximise the variable. If they are unset, they will be determined based on the other variables. For more details, see the section on [sequence optimisation](@ref sequence_optimisation). - `Variables`: These are a special type of parameters. In addition to being set to a fixed value, they can also be set to `:min` or `:max` to minimise or maximise the variable. If they are unset, they will be determined based on the other variables. For more details, see the section on [sequence optimisation](@ref sequence_optimisation). All variables are available in the [`variables`](@ref) module.
As an example, the following creates and plots a [`DiffusionSpinEcho`](@ref) that has a b-value of 1, a minimal echo time, and a slice thickness of 2 mm: As an example, the following creates and plots a [`DiffusionSpinEcho`](@ref) that has a b-value of 1, a minimal echo time, and a slice thickness of 2 mm:
```@example ```@example
...@@ -22,7 +22,7 @@ nothing # hide ...@@ -22,7 +22,7 @@ nothing # hide
``` ```
![DWI sequence diagram](dwi_1_min_2.png) ![DWI sequence diagram](dwi_1_min_2.png)
If we want a specific [`diffusion_time`](@ref), we can just add it to the constraints, and the rest of the sequence will adapt as needed: If we want a specific [`variables.diffusion_time`](@ref), we can just add it to the constraints, and the rest of the sequence will adapt as needed:
```@example ```@example
using MRIBuilder # hide using MRIBuilder # hide
using CairoMakie # hide using CairoMakie # hide
...@@ -34,7 +34,7 @@ nothing # hide ...@@ -34,7 +34,7 @@ nothing # hide
``` ```
![DWI sequence diagram with fixed diffusion time](dwi_1_80_min_2.png) ![DWI sequence diagram with fixed diffusion time](dwi_1_80_min_2.png)
We can even directly set some aspect of one of the sequence components, such as slowing down the gradient [`rise_time`](@ref) We can even directly set some aspect of one of the sequence components, such as slowing down the gradient [`variables.rise_time`](@ref)
and the additional constraint will just be included in the [sequence optimisation](@ref sequence_optimisation): and the additional constraint will just be included in the [sequence optimisation](@ref sequence_optimisation):
```@example ```@example
using MRIBuilder # hide using MRIBuilder # hide
...@@ -48,7 +48,7 @@ nothing # hide ...@@ -48,7 +48,7 @@ nothing # hide
![DWI sequence diagram with fixed diffusion time and rise time](dwi_1_80_min_2_15.png) ![DWI sequence diagram with fixed diffusion time and rise time](dwi_1_80_min_2_15.png)
Note that the previous sequences do not contain a realistic readout. Note that the previous sequences do not contain a realistic readout.
Most sequences will only include an instant readout, unless you directly set the [`voxel_size`](@ref) and [`resolution`](@ref). Most sequences will only include an instant readout, unless you directly set the [`variables.voxel_size`](@ref) and [`variables.resolution`](@ref).
```@example ```@example
using MRIBuilder # hide using MRIBuilder # hide
using CairoMakie # hide using CairoMakie # hide
......
...@@ -3,7 +3,7 @@ The MRI scanner that is used during acquisition puts various constraints on the ...@@ -3,7 +3,7 @@ The MRI scanner that is used during acquisition puts various constraints on the
These constraints include safety considerations, such as tissue heating, and hardware constraints, such as maximum gradient strength and slew rate. These constraints include safety considerations, such as tissue heating, and hardware constraints, such as maximum gradient strength and slew rate.
Currently, MRIBuilder only considers the latter. Currently, MRIBuilder only considers the latter.
To define a sequence appropriate for a specific scanner, a user would define a new [`Scanner`](@ref) with the appropriate [`B0`](@ref), maximum [`gradient_strength`](@ref), and maximum [`slew_rate`](@ref). To define a sequence appropriate for a specific scanner, a user would define a new [`Scanner`](@ref) with the appropriate [`B0`](@ref), maximum [`variables.gradient_strength`](@ref), and maximum [`variables.slew_rate`](@ref).
This scanner would then be passed on to the [sequence optimisation](@ref sequence_optimisation). This scanner would then be passed on to the [sequence optimisation](@ref sequence_optimisation).
For ease of use, the `gradient_strength` and `slew_rate` of many scanners have already been pre-defined. For ease of use, the `gradient_strength` and `slew_rate` of many scanners have already been pre-defined.
......
...@@ -6,7 +6,7 @@ Super-type for all individual components that form an MRI sequence (i.e., RF pul ...@@ -6,7 +6,7 @@ Super-type for all individual components that form an MRI sequence (i.e., RF pul
RF pulses, instant gradients, and readouts are grouped together into [`EventComponent`](@ref). RF pulses, instant gradients, and readouts are grouped together into [`EventComponent`](@ref).
These all should have a [`duration`](@ref) in addition to any other relevant [`variables`](@ref). These all should have a [`variables.duration`](@ref) in addition to any other relevant [`variables`](@ref).
""" """
abstract type BaseComponent <: AbstractBlock end abstract type BaseComponent <: AbstractBlock end
...@@ -39,7 +39,7 @@ variables.gradient_strength ...@@ -39,7 +39,7 @@ variables.gradient_strength
""" """
Super-type for all RF pulses, instant gradients and readouts that might play out during a gradient waveform. Super-type for all RF pulses, instant gradients and readouts that might play out during a gradient waveform.
These all have an [`effective_time`](@ref), which should quantify at what single time one can approximate the RF pulse or readout to have taken place. These all have an [`variables.effective_time`](@ref), which should quantify at what single time one can approximate the RF pulse or readout to have taken place.
""" """
abstract type EventComponent <: BaseComponent end abstract type EventComponent <: BaseComponent end
......
...@@ -15,8 +15,8 @@ If the `orientation` is set an [`InstantGradient1D`](@ref) is returned, otherwis ...@@ -15,8 +15,8 @@ If the `orientation` is set an [`InstantGradient1D`](@ref) is returned, otherwis
- `group`: name of the group to which this gradient belongs (used for scaling and rotating). - `group`: name of the group to which this gradient belongs (used for scaling and rotating).
## Variables ## Variables
- [`qval`](@ref): Spatial frequency on which spins will be dephased due to this pulsed gradient in rad/um (scalar if `orientation` is set and vector otherwise). - [`variables.qvec`](@ref): Spatial frequency on which spins will be dephased due to this pulsed gradient in rad/um.
- [`spoiler_scale`](@ref): Length-scale on which spins will be dephased by exactly 2π in mm. - [`variables.spoiler_scale`](@ref): Length-scale on which spins will be dephased by exactly 2π in mm.
""" """
abstract type InstantGradient{N} <: EventComponent end abstract type InstantGradient{N} <: EventComponent end
......
...@@ -14,11 +14,11 @@ Represents an radio-frequency pulse with a constant amplitude and frequency (i.e ...@@ -14,11 +14,11 @@ Represents an radio-frequency pulse with a constant amplitude and frequency (i.e
- `group`: name of the group to which this pulse belongs. This is used for scaling or adding phases/off-resonance frequencies. - `group`: name of the group to which this pulse belongs. This is used for scaling or adding phases/off-resonance frequencies.
## Variables ## Variables
- [`flip_angle`](@ref): rotation expected for on-resonance spins in degrees. - [`variables.flip_angle`](@ref): rotation expected for on-resonance spins in degrees.
- [`duration`](@ref): duration of the RF pulse in ms. - [`variables.duration`](@ref): duration of the RF pulse in ms.
- [`amplitude`](@ref): amplitude of the RF pulse in kHz. - [`variables.amplitude`](@ref): amplitude of the RF pulse in kHz.
- [`phase`](@ref): phase at the start of the RF pulse in degrees. - [`variables.phase`](@ref): phase at the start of the RF pulse in degrees.
- [`frequency`](@ref): frequency of the RF pulse relative to the Larmor frequency (in kHz). - [`variables.frequency`](@ref): frequency of the RF pulse relative to the Larmor frequency (in kHz).
""" """
struct ConstantPulse <: RFPulseComponent struct ConstantPulse <: RFPulseComponent
amplitude :: VariableType amplitude :: VariableType
......
...@@ -13,8 +13,8 @@ Return an instant RF pulse that rotates all spins by `flip_angle` around an axis ...@@ -13,8 +13,8 @@ Return an instant RF pulse that rotates all spins by `flip_angle` around an axis
- `group`: name of the group to which this pulse belongs. This is used for scaling or adding phases/off-resonance frequencies. - `group`: name of the group to which this pulse belongs. This is used for scaling or adding phases/off-resonance frequencies.
## Variables ## Variables
- [`flip_angle`](@ref): angle by which spins are rotated in degrees. - [`variables.flip_angle`](@ref): angle by which spins are rotated in degrees.
- [`phase`](@ref): angle of axis around which spins are rotated in degrees. - [`variables.phase`](@ref): angle of axis around which spins are rotated in degrees.
""" """
struct InstantPulse <: RFPulseComponent struct InstantPulse <: RFPulseComponent
flip_angle :: VariableType flip_angle :: VariableType
......
...@@ -17,12 +17,12 @@ Represents a radio-frequency pulse with a sinc-like amplitude and constant frequ ...@@ -17,12 +17,12 @@ Represents a radio-frequency pulse with a sinc-like amplitude and constant frequ
- `group`: name of the group to which this pulse belongs. This is used for scaling or adding phases/off-resonance frequencies. - `group`: name of the group to which this pulse belongs. This is used for scaling or adding phases/off-resonance frequencies.
## Variables ## Variables
- [`flip_angle`](@ref): rotation expected for on-resonance spins in degrees. - [`variables.flip_angle`](@ref): rotation expected for on-resonance spins in degrees.
- [`duration`](@ref): duration of the RF pulse in ms. - [`variables.duration`](@ref): duration of the RF pulse in ms.
- [`amplitude`](@ref): amplitude of the RF pulse in kHz. - [`variables.amplitude`](@ref): amplitude of the RF pulse in kHz.
- [`phase`](@ref): phase at the start of the RF pulse in degrees. - [`variables.phase`](@ref): phase at the start of the RF pulse in degrees.
- [`frequency`](@ref): frequency of the RF pulse relative to the Larmor frequency (in kHz). - [`variables.frequency`](@ref): frequency of the RF pulse relative to the Larmor frequency (in kHz).
- [`bandwidth`](@ref): width of the rectangular function in frequency space (in kHz). If the `duration` is short (compared with 1/`bandwidth`), this bandwidth will only be approximate. - [`variables.bandwidth`](@ref): width of the rectangular function in frequency space (in kHz). If the `duration` is short (compared with 1/`bandwidth`), this bandwidth will only be approximate.
""" """
struct SincPulse <: RFPulseComponent struct SincPulse <: RFPulseComponent
apodise :: Bool apodise :: Bool
......
...@@ -15,7 +15,7 @@ abstract type ContainerBlock <: AbstractBlock end ...@@ -15,7 +15,7 @@ abstract type ContainerBlock <: AbstractBlock end
Returns the start time of component with given `indices` with respect to the start of the [`ContainerBlock`](@ref). Returns the start time of component with given `indices` with respect to the start of the [`ContainerBlock`](@ref).
Also see [`variables.duration`](@ref), [`end_time`](@ref), and [`effective_time`](@ref) Also see [`variables.duration`](@ref), [`end_time`](@ref), and [`variables.effective_time`](@ref)
""" """
function start_time(container::ContainerBlock, index1, index2, indices...) function start_time(container::ContainerBlock, index1, index2, indices...)
start_time(container, index1) + start_time(container[index1], index2, indices...) start_time(container, index1) + start_time(container[index1], index2, indices...)
...@@ -27,7 +27,7 @@ end ...@@ -27,7 +27,7 @@ end
Returns the start time of component with given `indices` with respect to the start of the [`ContainerBlock`](@ref). Returns the start time of component with given `indices` with respect to the start of the [`ContainerBlock`](@ref).
Also see [`variables.duration`](@ref), [`start_time`](@ref), and [`effective_time`](@ref) Also see [`variables.duration`](@ref), [`start_time`](@ref), and [`variables.effective_time`](@ref)
""" """
end_time(container::ContainerBlock, index, indices...) = start_time(container, index) + end_time(container[index], indices...) end_time(container::ContainerBlock, index, indices...) = start_time(container, index) + end_time(container[index], indices...)
end_time(block::AbstractBlock) = variables.duration(block) end_time(block::AbstractBlock) = variables.duration(block)
...@@ -43,7 +43,7 @@ end ...@@ -43,7 +43,7 @@ end
Returns the start time of component with given `indices` with respect to the start of the [`ContainerBlock`](@ref). Returns the start time of component with given `indices` with respect to the start of the [`ContainerBlock`](@ref).
This will crash if the component does not have an [`effective_time`](@ref) (e.g., if it is (part of) a gradient waveform). This will crash if the component does not have an [`variables.effective_time`](@ref) (e.g., if it is (part of) a gradient waveform).
Also see [`variables.duration`](@ref), [`start_time`](@ref), and [`end_time`](@ref) Also see [`variables.duration`](@ref), [`start_time`](@ref), and [`end_time`](@ref)
""" """
......
...@@ -141,7 +141,7 @@ Defines an MRI sequence from a vector of building blocks. ...@@ -141,7 +141,7 @@ Defines an MRI sequence from a vector of building blocks.
## Arguments ## Arguments
- `blocks`: The actual building blocks that will be played in sequence. All the building blocks must be of type [`ContainerBlock`](@ref), which means that they cannot only contain actual [`BaseBuildingBlock`](@ref) objects, but also other [`BaseSequence`](@ref) objects. - `blocks`: The actual building blocks that will be played in sequence. All the building blocks must be of type [`ContainerBlock`](@ref), which means that they cannot only contain actual [`BaseBuildingBlock`](@ref) objects, but also other [`BaseSequence`](@ref) objects.
Objects of a different type are converted into a [`ContainerBlock`](@ref) internally: Objects of a different type are converted into a [`ContainerBlock`](@ref) internally:
- numbers/`nothing`/`:min`/`:max` : replaced with a [`Wait`](@ref) block with the appropriate constraint/objective added to its [`duration`](@ref). - numbers/`nothing`/`:min`/`:max` : replaced with a [`Wait`](@ref) block with the appropriate constraint/objective added to its [`variables.duration`](@ref).
- RF pulse or readout: will be embedded within a [`BuildingBlock`](@ref) of the appropriate length - RF pulse or readout: will be embedded within a [`BuildingBlock`](@ref) of the appropriate length
Specific named sequences might define additional variables. Specific named sequences might define additional variables.
......
...@@ -19,7 +19,7 @@ Main interface: ...@@ -19,7 +19,7 @@ Main interface:
- [`waveform_sequence`](@ref) returns just the gradient waveform as a sequence of [`GradientWaveform`](@ref) objects. - [`waveform_sequence`](@ref) returns just the gradient waveform as a sequence of [`GradientWaveform`](@ref) objects.
- [`waveform`](@ref) returns just the gradient waveform as a sequence of (time, gradient_strength) tuples. - [`waveform`](@ref) returns just the gradient waveform as a sequence of (time, gradient_strength) tuples.
- [`events`](@ref) returns the RF pulses and readouts. - [`events`](@ref) returns the RF pulses and readouts.
- [`qval`](@ref) returns area under curve for (part of) the gradient waveform. - [`variables.qvec`](@ref) returns area under curve for (part of) the gradient waveform.
Sub-types need to implement: Sub-types need to implement:
- `Base.keys`: returns sequence of keys to all the components. - `Base.keys`: returns sequence of keys to all the components.
...@@ -239,7 +239,7 @@ variables.qvec ...@@ -239,7 +239,7 @@ variables.qvec
Computes the addition to the [`variables.bmat`](@ref) contributed by a specific building block or gradient. Computes the addition to the [`variables.bmat`](@ref) contributed by a specific building block or gradient.
`qstart` represents the [`qvec`](@ref) at the start of this component. `qstart` represents the [`variables.qvec`](@ref) at the start of this component.
If `first_event` is set to something else than `nothing`, only the gradient waveform after this RF pulse/Readout will be considered. If `first_event` is set to something else than `nothing`, only the gradient waveform after this RF pulse/Readout will be considered.
Similarly, if `last_event` is set to something else than `nothing`, only the gradient waveform up to this RF pulse/Readout will be considered. Similarly, if `last_event` is set to something else than `nothing`, only the gradient waveform up to this RF pulse/Readout will be considered.
...@@ -380,7 +380,7 @@ end ...@@ -380,7 +380,7 @@ end
""" """
An empty BuildingBlock representing dead time. An empty BuildingBlock representing dead time.
It only has a single variable, namely its [`duration`](@ref). It only has a single variable, namely its [`variables.duration`](@ref).
""" """
struct Wait <: BaseBuildingBlock struct Wait <: BaseBuildingBlock
duration :: VariableType duration :: VariableType
......
...@@ -11,16 +11,16 @@ import ...Pathways: PathwayWalker, update_walker_till_time!, walk_pathway! ...@@ -11,16 +11,16 @@ import ...Pathways: PathwayWalker, update_walker_till_time!, walk_pathway!
Defines an (accelerated) EPI readout. Defines an (accelerated) EPI readout.
## Parameters ## Parameters
- [`resolution`](@ref): Resolution of the final image in the frequency- and phase-encode directions. - [`variables.resolution`](@ref): Resolution of the final image in the frequency- and phase-encode directions.
- `recenter`: if true, the signal will be recentred in k-space after the EPI readout. - `recenter`: if true, the signal will be recentred in k-space after the EPI readout.
- `group`: name of the group used to rotate the readout gradients (default: :FOV). - `group`: name of the group used to rotate the readout gradients (default: :FOV).
## Variables: ## Variables:
- [`voxel_size`](@ref): size of the voxel in the frequency- and phase-encode directions. - [`variables.voxel_size`](@ref): size of the voxel in the frequency- and phase-encode directions.
- [`fov`](@ref): size of the FOV in the frequency- and phase-encode directions. - [`variables.fov`](@ref): size of the FOV in the frequency- and phase-encode directions.
- [`ramp_overlap`](@ref): what fraction of the gradient ramp should overlap with the readout. - [`variables.ramp_overlap`](@ref): what fraction of the gradient ramp should overlap with the readout.
- [`oversample`](@ref): by how much to oversample in the frequency-encode direcion. - [`variables.oversample`](@ref): by how much to oversample in the frequency-encode direcion.
- [`dwell_time`](@ref): dwell time in the frequency-encode direction - [`variables.dwell_time`](@ref): dwell time in the frequency-encode direction
""" """
struct EPIReadout{N} <: BaseSequence{N} struct EPIReadout{N} <: BaseSequence{N}
start_gradient :: Trapezoid start_gradient :: Trapezoid
......
...@@ -296,7 +296,7 @@ Returns two DWI gradients that are guaranteed to cancel each other out. ...@@ -296,7 +296,7 @@ Returns two DWI gradients that are guaranteed to cancel each other out.
- `scanner`: Used for testing. Do not set this parameter at this level (instead set it for the total sequence using [`build_sequence`](@ref)). - `scanner`: Used for testing. Do not set this parameter at this level (instead set it for the total sequence using [`build_sequence`](@ref)).
## Variables ## Variables
- [`spoiler_scale`](@ref): maximum spoiler scale (before applying any reductions due to `scale`). - [`variables.spoiler_scale`](@ref): maximum spoiler scale (before applying any reductions due to `scale`).
- Any other parameters expected by [`Trapezoid`](@ref). - Any other parameters expected by [`Trapezoid`](@ref).
""" """
function gradient_spoiler(; optimise=false, scanner=nothing, orientation=[0, 0, 1], group=:FOV, spoiler_scale=1., duration=:min, variables...) function gradient_spoiler(; optimise=false, scanner=nothing, orientation=[0, 0, 1], group=:FOV, spoiler_scale=1., duration=:min, variables...)
......
...@@ -37,13 +37,13 @@ Defines a trapezoidal pulsed gradient ...@@ -37,13 +37,13 @@ Defines a trapezoidal pulsed gradient
Variables can be set during construction or afterwards as an attribute. Variables can be set during construction or afterwards as an attribute.
If not set, they will be determined during the sequence optimisation. If not set, they will be determined during the sequence optimisation.
### Timing variables ### Timing variables
- [`rise_time`](@ref): Time of the gradient to reach from 0 to maximum in ms. If explicitly set to 0, the scanner slew rate will be ignored. - [`variables.rise_time`](@ref): Time of the gradient to reach from 0 to maximum in ms. If explicitly set to 0, the scanner slew rate will be ignored.
- [`flat_time`](@ref): Time that the gradient stays at maximum strength in ms. - [`variables.flat_time`](@ref): Time that the gradient stays at maximum strength in ms.
- [`δ`](@ref): effective pulse duration (`rise_time` + `flat_time`) in ms. - [`variables.δ`](@ref): effective pulse duration (`rise_time` + `flat_time`) in ms.
- [`duration`](@ref): total pulse duration (2 * `rise_time` + `flat_time`) in ms. - [`variables.duration`](@ref): total pulse duration (2 * `rise_time` + `flat_time`) in ms.
### Gradient variables ### Gradient variables
- [`gradient_strength`](@ref): Maximum gradient strength achieved during the pulse in kHz/um - [`variables.gradient_strength`](@ref): Maximum gradient strength achieved during the pulse in kHz/um
- [`qval`](@ref): Spatial scale on which spins will be dephased due to this pulsed gradient in rad/um (given by `δ` * `gradient_strength`). - [`variables.qvec`](@ref): Spatial scale on which spins will be dephased due to this pulsed gradient in rad/um (given by `δ` * `gradient_strength`).
The `bvalue` can be constrained for multiple gradient pulses by creating a `Pathway`. The `bvalue` can be constrained for multiple gradient pulses by creating a `Pathway`.
""" """
...@@ -232,8 +232,8 @@ Parameters and variables are identical as for [`Trapezoid`](@ref) with the addit ...@@ -232,8 +232,8 @@ Parameters and variables are identical as for [`Trapezoid`](@ref) with the addit
- `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. - `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 ## Variables
- [`fov`](@ref): FOV of the output image along this single k-space line in mm. - [`variables.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. - [`variables.voxel_size`](@ref): size of each voxel along this single k-space line in mm.
""" """
struct LineReadout{N} <: BaseTrapezoid{N} struct LineReadout{N} <: BaseTrapezoid{N}
trapezoid :: Trapezoid{N} trapezoid :: Trapezoid{N}
......
...@@ -2,7 +2,7 @@ module Pathways ...@@ -2,7 +2,7 @@ module Pathways
import LinearAlgebra: norm, tr import LinearAlgebra: norm, tr
import StaticArrays: SVector, SMatrix import StaticArrays: SVector, SMatrix
import ..Components: NoGradient, RFPulseComponent, ReadoutComponent, InstantGradient, GradientWaveform import ..Components: NoGradient, RFPulseComponent, ReadoutComponent, InstantGradient, GradientWaveform
import ..Containers: BaseSequence, Sequence, BaseBuildingBlock, waveform, events, waveform_sequence, start_time, AlternativeBlocks import ..Containers: BaseSequence, Sequence, BaseBuildingBlock, waveform, events, waveform_sequence, start_time, AlternativeBlocks, ContainerBlock
import ..Variables: VariableType, get_pathway, variables, @defvar, AbstractBlock import ..Variables: VariableType, get_pathway, variables, @defvar, AbstractBlock
...@@ -14,7 +14,7 @@ Describes how a specific spin/isochromat might experience the sequence. ...@@ -14,7 +14,7 @@ Describes how a specific spin/isochromat might experience the sequence.
Only a single pathway through the RF pulses is considered, Only a single pathway through the RF pulses is considered,
so that at every point in time the spins are in one of the following four states: so that at every point in time the spins are in one of the following four states:
- +longitudinal: initial relaxed state - +longitudinal: initial relaxed state
- +transverse: excited state. During this time gradients will affect the [`area_under_curve`](@ref) (or [`qval`](@ref)) and [`bval`](@ref). - +transverse: excited state. During this time gradients will affect the [`variables.area_under_curve`](@ref) (or [`variables.qval`](@ref)) and [`variables.bval`](@ref).
- -longitudinal: inverse state - -longitudinal: inverse state
- -transverse: inverse excited state. During this time all gradients will have the inverse effect compared with +transverse. - -transverse: inverse excited state. During this time all gradients will have the inverse effect compared with +transverse.
...@@ -28,22 +28,21 @@ The RF pulses cause mappings between these different states as described below. ...@@ -28,22 +28,21 @@ The RF pulses cause mappings between these different states as described below.
- `:excite`/90: Takes spin state one step along the following sequence +longitudinal -> +transverse -> -longitudinal -> -transverse -> +longitudinal - `:excite`/90: Takes spin state one step along the following sequence +longitudinal -> +transverse -> -longitudinal -> -transverse -> +longitudinal
- `:neg_excite`/270/-90: Inverse step compared with `:excite`. - `:neg_excite`/270/-90: Inverse step compared with `:excite`.
- `readout_index`: After encountering the number of pulses as defined in `pulse_effects`, continue the `Pathway` until the readout given by `index` is reached. If set to 0 the `Pathway` is terminated immediately after the last RF pulse. - `readout_index`: After encountering the number of pulses as defined in `pulse_effects`, continue the `Pathway` until the readout given by `index` is reached. If set to 0 the `Pathway` is terminated immediately after the last RF pulse.
- `group`: which gradient grouping to consider for the `qvec` and `bmat`. If not set, all gradients will be considered (using their current alignment). - `group`: which gradient grouping to consider for the `net_dephasing` and `bmat`. If not set, all gradients will be considered (using their current alignment).
## Attributes ## Attributes
Over the pathway the following values are computed. Each can be accessed by calling the appropriate function: Over the pathway the following values are computed. Each can be accessed by calling the appropriate function:
### Timings ### Timings
- [`duration_state`](@ref): The total amount of time spent in a specific state in this pathway (+longitudinal, +transverse, -longitudinal, or -transverse) - [`variables.duration_state`](@ref): The total amount of time spent in a specific state in this pathway (+longitudinal, +transverse, -longitudinal, or -transverse)
- [`duration_transverse`](@ref): The total amount of time the spins spent in the transverse plane in ms. This can be used to quantify the expected effect of T2-decay. - [`variables.duration_transverse`](@ref): The total amount of time the spins spent in the transverse plane in ms. This can be used to quantify the expected effect of T2-decay.
- [`duration_dephase`](@ref): The total amount of time the spins spent in the +transverse relative to -transverse state in ms. The absolute value of this can be used to quantify the expected effect of T2'-decay. - [`variables.duration_dephase`](@ref): The total amount of time the spins spent in the +transverse relative to -transverse state in ms. The absolute value of this can be used to quantify the expected effect of T2'-decay.
### Effect of gradients ### Effect of gradients
The area under curve, q-values, and b-values are computed separately for each group of gradients (depending on the `group` keyword set during construction). The area under curve, q-values, and b-values are computed separately for each group of gradients (depending on the `group` keyword set during construction).
- [`qvec`](@ref): Net displacement vector in k-space/q-space. - [`variables.net_dephasing`](@ref): Net displacement vector in k-space/q-space.
- [`qval`](@ref)/[`area_under_curve`](@ref): size of the displacement in k-space/q-space. For a spoiled pathway, this should be large compared with 1/voxel size; for unspoiled pathways it should be (close to) zero. - [`variables.bmat`](@ref): Net diffusion weighting due to gradients along the `Pathway` in matrix form.
- [`bmat`](@ref): Net diffusion weighting due to gradients along the `Pathway` in matrix form. - [`variables.bval`](@ref): Net diffusion weighting due to gradients along the `Pathway` as a single number.
- [`bval`](@ref): Net diffusion weighting due to gradients along the `Pathway` as a single number.
""" """
struct Pathway <: AbstractBlock struct Pathway <: AbstractBlock
# user provided # user provided
...@@ -97,7 +96,7 @@ end ...@@ -97,7 +96,7 @@ end
Returns the total amount of time that spins following the given [`Pathway`](@ref) spent in the transverse plane. Returns the total amount of time that spins following the given [`Pathway`](@ref) spent in the transverse plane.
This determines the amount of T2-weighting as ``e^{t/T_2}``, where ``t`` is the `duration_transverse`. This determines the amount of T2-weighting as ``e^{t/T_2}``, where ``t`` is the `duration_transverse`.
Also see [`duration_dephase`](@ref) for T2'-weighting. Also see [`variables.duration_dephase`](@ref) for T2'-weighting.
""" """
variables.duration_transverse variables.duration_transverse
...@@ -110,7 +109,7 @@ end ...@@ -110,7 +109,7 @@ end
Returns the net time that spins following the given [`Pathway`](@ref) spent in the +transverse versus the -transverse state. Returns the net time that spins following the given [`Pathway`](@ref) spent in the +transverse versus the -transverse state.
This determines the amount of T2'-weighting as ``e^{t/T_2'}``, where ``t`` is the `duration_dephase`. This determines the amount of T2'-weighting as ``e^{t/T_2'}``, where ``t`` is the `duration_dephase`.
Also see [`duration_transverse`](@ref) for T2-weighting. Also see [`variables.duration_transverse`](@ref) for T2-weighting.
""" """
variables.duration_dephase variables.duration_dephase
...@@ -262,7 +261,7 @@ For individual pulses and gradients, the following behaviour is implemented: ...@@ -262,7 +261,7 @@ For individual pulses and gradients, the following behaviour is implemented:
- If a pulse is encountered, call [`update_walker_pulse!`](@ref)`(walker, pulse_effects, pulse_effective_time)` - If a pulse is encountered, call [`update_walker_pulse!`](@ref)`(walker, pulse_effects, pulse_effective_time)`
- If a gradient is encountered, call [`update_walker_gradient!`](@ref)(gradient, walker, gradient_start_time) - If a gradient is encountered, call [`update_walker_gradient!`](@ref)(gradient, walker, gradient_start_time)
For overlapping gradients/pulses, one should first encounter the part of the gradient before the [`effective_time`](@ref) of the pulse, For overlapping gradients/pulses, one should first encounter the part of the gradient before the [`variables.effective_time`](@ref) of the pulse,
then apply the pulse, and then the rest of the gradient. then apply the pulse, and then the rest of the gradient.
This effective time can be passed on to [`update_walker_gradient!`](@ref) to allow part of the gradient waveform to be applied. This effective time can be passed on to [`update_walker_gradient!`](@ref) to allow part of the gradient waveform to be applied.
...@@ -457,7 +456,7 @@ The following steps will be taken: ...@@ -457,7 +456,7 @@ The following steps will be taken:
- update the appropriate `walker.qvec` and `walker.bmat` based on the gradient waveform. This will require appropriate `qvec`/`bmat` functions to be defined for the gradient building block. - update the appropriate `walker.qvec` and `walker.bmat` based on the gradient waveform. This will require appropriate `qvec`/`bmat` functions to be defined for the gradient building block.
- update `walker.last_gradient_time` to the time at the end of the gradient. - update `walker.last_gradient_time` to the time at the end of the gradient.
This requires [`bmat_gradient`](@ref) and [`qvec`](@ref) to be implemented for the [`GradientWaveform`](@ref). This requires [`variables.bmat_gradient`](@ref) and [`variables.qvec`](@ref) to be implemented for the [`GradientWaveform`](@ref).
""" """
update_walker_gradient!(gradient::NoGradient, walker::PathwayWalker, gradient_start_time::VariableType) = nothing update_walker_gradient!(gradient::NoGradient, walker::PathwayWalker, gradient_start_time::VariableType) = nothing
......
...@@ -5,7 +5,7 @@ import ...Containers: start_time ...@@ -5,7 +5,7 @@ import ...Containers: start_time
import ...Variables: get_pulse, get_readout, get_gradient, variables, @defvar import ...Variables: get_pulse, get_readout, get_gradient, variables, @defvar
import ...Pathways: Pathway, get_pathway import ...Pathways: Pathway, get_pathway
import ...BuildSequences: build_sequence import ...BuildSequences: build_sequence
import ...Scanners: Default_Scanner import ...Scanners: Default_Scanner, Scanner
const DiffusionSpinEcho = Sequence{:DiffusionSpinEcho} const DiffusionSpinEcho = Sequence{:DiffusionSpinEcho}
const DW_SE = DiffusionSpinEcho const DW_SE = DiffusionSpinEcho
...@@ -22,20 +22,19 @@ By default, an instant excitation pulse and readout event are used. ...@@ -22,20 +22,19 @@ By default, an instant excitation pulse and readout event are used.
If image parameters are provided, this will switch to a sinc pulse and EPI readout. If image parameters are provided, this will switch to a sinc pulse and EPI readout.
## Parameters ## Parameters
- [`excitation`](@ref): properties of the excitation pulse as described in [`excitation_pulse`](@ref). - `excitation`: properties of the excitation pulse as described in [`excitation_pulse`](@ref).
- [`gradient`](@ref): properties of the diffusion-weighting gradients as described in [`dwi_gradients`](@ref). - `gradient`: properties of the diffusion-weighting gradients as described in [`dwi_gradients`](@ref).
- [`refocus`](@ref): properties of the refocus pulse as described in [`refocus_pulse`](@ref). - `refocus`: properties of the refocus pulse as described in [`refocus_pulse`](@ref).
- [`readout`](@ref): properties of the readout as described in [`readout_event`](@ref). - `readout`: properties of the readout as described in [`readout_event`](@ref).
- [`spoiler`](@ref): if set adds a spoiler [`gradient_spoiler`](@ref) gradient after the readout (e.g., `spoiler=()` to add a gradient in the z-direction of the `FOV` coordinate system that fully dephases spins over 1 mm). - Image parameters ([`variables.resolution`](@ref)/[`variables.fov`](@ref)/[`variables.voxel_size`](@ref)/[`variables.slice_thickness`](@ref)): describe the properties of the resulting image. See [`interpret_image_size`](@ref) for details.
- Image parameters ([`resolution`](@ref)/[`fov`](@ref)/[`voxel_size`](@ref)/[`slice_thickness`](@ref)): describe the properties of the resulting image. See [`interpret_image_size`](@ref) for details. - `optim`: parameters to pass on to the Ipopt optimiser (see https://coin-or.github.io/Ipopt/OPTIONS.html).
- [`optim`](@ref): parameters to pass on to the Ipopt optimiser (see https://coin-or.github.io/Ipopt/OPTIONS.html). - `scanner`: Sets the [`Scanner`](@ref) used to constraint the gradient parameters. If not set, the [`Default_Scanner`](@ref) will be used.
- [`scanner`](@ref): Sets the [`Scanner`](@ref) used to constraint the gradient parameters. If not set, the [`Default_Scanner`](@ref) will be used.
## Variables ## Variables
- [`TE`](@ref)/[`echo_time`](@ref): echo time between excitation pulse and spin echo in ms. - [`variables.TE`](@ref)/[`variables.echo_time`](@ref): echo time between excitation pulse and spin echo in ms.
- [`delay`](@ref): delay between the readout and the peak of the spin echo in ms (positive number indicates that readout is after the spin echo). Defaults to zero. - [`variables.delay`](@ref): delay between the readout and the peak of the spin echo in ms (positive number indicates that readout is after the spin echo). Defaults to zero.
- [`duration`](@ref): total duration of the sequence from start of excitation pulse to end of readout or spoiler in ms. - [`variables.duration`](@ref): total duration of the sequence from start of excitation pulse to end of readout or spoiler in ms.
- [`Δ`](@ref)/[`diffusion_time`](@ref): Time from the start of one diffusion-weighted gradient till the other in ms. - [`variables.Δ`](@ref)/[`variables.diffusion_time`](@ref): Time from the start of one diffusion-weighted gradient till the other in ms.
""" """
function DiffusionSpinEcho(; delay=0., excitation=(), gradient=(), refocus=(), readout=(), optim=(), spoiler=nothing, resolution=nothing, fov=nothing, voxel_size=nothing, slice_thickness=nothing, scanner=Default_Scanner, variables...) function DiffusionSpinEcho(; delay=0., excitation=(), gradient=(), refocus=(), readout=(), optim=(), spoiler=nothing, resolution=nothing, fov=nothing, voxel_size=nothing, slice_thickness=nothing, scanner=Default_Scanner, variables...)
build_sequence(scanner; optim...) do build_sequence(scanner; optim...) do
......
...@@ -19,27 +19,22 @@ If image parameters are provided, this will switch to a sinc pulse and EPI reado ...@@ -19,27 +19,22 @@ If image parameters are provided, this will switch to a sinc pulse and EPI reado
## Parameters ## Parameters
- `excitation`: properties of the excitation pulse as described in [`excitation_pulse`](@ref). - `excitation`: properties of the excitation pulse as described in [`excitation_pulse`](@ref).
- `readout`: properties of the readout as described in [`readout_event`](@ref). - `readout`: properties of the readout as described in [`readout_event`](@ref).
- `spoiler`: if set adds a spoiler [`gradient_spoiler`](@ref) gradient after the readout (e.g., `spoiler=()` to add a gradient in the z-direction of the `FOV` coordinate system that fully dephases spins over 1 mm). - Image parameters ([`variables.resolution`](@ref)/[`variables.fov`](@ref)/[`variables.voxel_size`](@ref)/[`variables.slice_thickness`](@ref)): describe the properties of the resulting image. See [`interpret_image_size`](@ref) for details.
- Image parameters ([`resolution`](@ref)/[`fov`](@ref)/[`voxel_size`](@ref)/[`slice_thickness`](@ref)): describe the properties of the resulting image. See [`interpret_image_size`](@ref) for details.
- `optim`: parameters to pass on to the Ipopt optimiser (see https://coin-or.github.io/Ipopt/OPTIONS.html). - `optim`: parameters to pass on to the Ipopt optimiser (see https://coin-or.github.io/Ipopt/OPTIONS.html).
- `scanner`: Sets the [`Scanner`](@ref) used to constraint the gradient parameters. If not set, the [`Default_Scanner`](@ref) will be used. - `scanner`: Sets the [`Scanner`](@ref) used to constraint the gradient parameters. If not set, the [`Default_Scanner`](@ref) will be used.
## Variables ## Variables
- [`TE`](@ref)/[`echo_time`](@ref): echo time between excitation pulse and readout in ms (required). - [`variables.TE`](@ref)/[`variables.echo_time`](@ref): echo time between excitation pulse and readout in ms (required).
- [`duration`](@ref): total duration of the sequence from start of excitation pulse to end of readout or spoiler in ms. - [`variables.duration`](@ref): total duration of the sequence from start of excitation pulse to end of readout in ms.
""" """
function GradientEcho(; excitation=(), readout=(), optim=(), spoiler=nothing, resolution=nothing, fov=nothing, voxel_size=nothing, slice_thickness=nothing, scanner=Default_Scanner, variables...) function GradientEcho(; excitation=(), readout=(), optim=(), resolution=nothing, fov=nothing, voxel_size=nothing, slice_thickness=nothing, scanner=Default_Scanner, variables...)
build_sequence(scanner; optim...) do build_sequence(scanner; optim...) do
(slice_thickness, _, extra_readout_params) = interpret_image_size(fov, resolution, voxel_size, slice_thickness) (slice_thickness, _, extra_readout_params) = interpret_image_size(fov, resolution, voxel_size, slice_thickness)
parts = Any[ return Sequence([
:excitation => excitation_pulse(; slice_thickness=slice_thickness, excitation...), :excitation => excitation_pulse(; slice_thickness=slice_thickness, excitation...),
nothing, nothing,
:readout => readout_event(; extra_readout_params..., readout...), :readout => readout_event(; extra_readout_params..., readout...),
] ]; name=:GradientEcho, variables...)
if !isnothing(spoiler)
push!(parts, gradient_spoiler(; spoiler...))
end
return Sequence(parts; name=:GradientEcho, variables...)
end end
end end
......
...@@ -20,30 +20,25 @@ If image parameters are provided, this will switch to a sinc pulse and EPI reado ...@@ -20,30 +20,25 @@ If image parameters are provided, this will switch to a sinc pulse and EPI reado
- [`excitation`](@ref): properties of the excitation pulse as described in [`excitation_pulse`](@ref). - [`excitation`](@ref): properties of the excitation pulse as described in [`excitation_pulse`](@ref).
- [`refocus`](@ref): properties of the refocus pulse as described in [`refocus_pulse`](@ref). - [`refocus`](@ref): properties of the refocus pulse as described in [`refocus_pulse`](@ref).
- [`readout`](@ref): properties of the readout as described in [`readout_event`](@ref). - [`readout`](@ref): properties of the readout as described in [`readout_event`](@ref).
- [`spoiler`](@ref): if set adds a spoiler [`gradient_spoiler`](@ref) gradient after the readout (e.g., `spoiler=()` to add a gradient in the z-direction of the `FOV` coordinate system that fully dephases spins over 1 mm). - Image parameters ([`variables.resolution`](@ref)/[`variables.fov`](@ref)/[`variables.voxel_size`](@ref)/[`variables.slice_thickness`](@ref)): describe the properties of the resulting image. See [`interpret_image_size`](@ref) for details.
- Image parameters ([`resolution`](@ref)/[`fov`](@ref)/[`voxel_size`](@ref)/[`slice_thickness`](@ref)): describe the properties of the resulting image. See [`interpret_image_size`](@ref) for details.
- [`optim`](@ref): parameters to pass on to the Ipopt optimiser (see https://coin-or.github.io/Ipopt/OPTIONS.html). - [`optim`](@ref): parameters to pass on to the Ipopt optimiser (see https://coin-or.github.io/Ipopt/OPTIONS.html).
- [`scanner`](@ref): Sets the [`Scanner`](@ref) used to constraint the gradient parameters. If not set, the [`Default_Scanner`](@ref) will be used. - [`scanner`](@ref): Sets the [`Scanner`](@ref) used to constraint the gradient parameters. If not set, the [`Default_Scanner`](@ref) will be used.
## Variables ## Variables
- [`TE`](@ref)/[`echo_time`](@ref): echo time between excitation pulse and spin echo in ms (required). - [`variables.TE`](@ref)/[`variables.echo_time`](@ref): echo time between excitation pulse and spin echo in ms (required).
- [`delay`](@ref): delay between the readout and the peak of the spin echo in ms (positive number indicates that readout is after the spin echo). Defaults to zero. - [`variables.delay`](@ref): delay between the readout and the peak of the spin echo in ms (positive number indicates that readout is after the spin echo). Defaults to zero.
- [`duration`](@ref): total duration of the sequence from start of excitation pulse to end of readout or spoiler in ms. - [`variables.duration`](@ref): total duration of the sequence from start of excitation pulse to end of readout or spoiler in ms.
""" """
function SpinEcho(; delay=0., excitation=(), refocus=(), readout=(), optim=(), spoiler=nothing, resolution=nothing, fov=nothing, voxel_size=nothing, slice_thickness=nothing, scanner=Default_Scanner, variables...) function SpinEcho(; delay=0., excitation=(), refocus=(), readout=(), optim=(), spoiler=nothing, resolution=nothing, fov=nothing, voxel_size=nothing, slice_thickness=nothing, scanner=Default_Scanner, variables...)
build_sequence(scanner; optim...) do build_sequence(scanner; optim...) do
(slice_thickness, _, extra_readout_params) = interpret_image_size(fov, resolution, voxel_size, slice_thickness) (slice_thickness, _, extra_readout_params) = interpret_image_size(fov, resolution, voxel_size, slice_thickness)
parts = Any[ return Sequence(Any[
:excitation => excitation_pulse(; slice_thickness=slice_thickness, excitation...), :excitation => excitation_pulse(; slice_thickness=slice_thickness, excitation...),
nothing, nothing,
:refocus => refocus_pulse(; slice_thickness=slice_thickness, refocus...), :refocus => refocus_pulse(; slice_thickness=slice_thickness, refocus...),
nothing, nothing,
:readout => readout_event(; extra_readout_params..., readout...), :readout => readout_event(; extra_readout_params..., readout...),
] ]; name=:SpinEcho, delay=delay, variables...)
if !isnothing(spoiler)
push!(parts, gradient_spoiler(; spoiler...))
end
return Sequence(parts; name=:SpinEcho, delay=delay, variables...)
end end
end end
......
...@@ -2,10 +2,9 @@ ...@@ -2,10 +2,9 @@
Defines the functions that can be called on parts of an MRI sequence to query or constrain any variables. Defines the functions that can be called on parts of an MRI sequence to query or constrain any variables.
In addition this defines: In addition this defines:
- [`variables`](@ref): dictionary containing all variables. - [`variables`](@ref): module containing all variables.
- [`VariableType`](@ref): parent type for any variables (whether number or JuMP variable). - [`VariableType`](@ref): parent type for any variables (whether number or JuMP variable).
- [`get_free_variable`](@ref): helper function to create new JuMP variables. - [`get_free_variable`](@ref): helper function to create new JuMP variables.
- [`VariableNotAvailable`](@ref): error raised if variable is not defined for specific [`AbstractBlock`](@ref).
- [`set_simple_constraints!`](@ref): call [`apply_simple_constraint!`](@ref) for each keyword argument. - [`set_simple_constraints!`](@ref): call [`apply_simple_constraint!`](@ref) for each keyword argument.
- [`apply_simple_constraint!`](@ref): set a simple equality constraint. - [`apply_simple_constraint!`](@ref): set a simple equality constraint.
- [`get_pulse`](@ref)/[`get_gradient`](@ref)/[`get_readout`](@ref): Used to get the pulse/gradient/readout part of a building block - [`get_pulse`](@ref)/[`get_gradient`](@ref)/[`get_readout`](@ref): Used to get the pulse/gradient/readout part of a building block
...@@ -252,7 +251,7 @@ def_alternate_variable!(:qval_square, :qvec, qv -> sum(q -> q * q, qv), nothing, ...@@ -252,7 +251,7 @@ def_alternate_variable!(:qval_square, :qvec, qv -> sum(q -> q * q, qv), nothing,
""" """
qval(gradient) qval(gradient)
The norm of the [`qvec`](@ref). The norm of the [`variables.qvec`](@ref).
""" """
variables.qval variables.qval
...@@ -261,7 +260,7 @@ variables.qval ...@@ -261,7 +260,7 @@ variables.qval
Spatial scale in mm over which the spoiler gradient will dephase by 2π. Spatial scale in mm over which the spoiler gradient will dephase by 2π.
Automatically computed based on [`qvec`](@ref). Automatically computed based on [`variables.qvec`](@ref).
""" """
variables.spoiler_scale variables.spoiler_scale
...@@ -276,14 +275,14 @@ end ...@@ -276,14 +275,14 @@ end
""" """
gradient_strength_norm(gradient) gradient_strength_norm(gradient)
The norm of the [`gradient_strength`](@ref). The norm of the [`variables.gradient_strength`](@ref).
""" """
variables.gradient_strength_norm variables.gradient_strength_norm
""" """
slew_rate_norm(gradient) slew_rate_norm(gradient)
The norm of the [`slew_rate`](@ref). The norm of the [`variables.slew_rate`](@ref).
""" """
variables.slew_rate_norm variables.slew_rate_norm
...@@ -555,7 +554,7 @@ function make_generic end ...@@ -555,7 +554,7 @@ function make_generic end
""" """
scanner_constraints!(block) scanner_constraints!(block)
Constraints [`gradient_strength`](@ref) and [`slew_rate`](@ref) to be less than the [`global_scanner`](@ref) maximum. Constraints [`variables.gradient_strength`](@ref) and [`variables.slew_rate`](@ref) to be less than the [`global_scanner`](@ref) maximum.
""" """
function scanner_constraints!(bb::AbstractBlock) function scanner_constraints!(bb::AbstractBlock)
for (var, max_value) in [ for (var, max_value) in [
......
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