Post-hoc adjustment of sequences
Typically a sequence is repeated for multiple repetition_time
(TR
) to allow the acquisition of multiple k-space lines, slice selection, or other sequence parameters (e.g., varying diffusion-weighting parameters for DiffusionSpinEcho
). MRIBuilder supports this by allowing the creation of a longer sequence out of multiple repeats of a base sequence with some minor alterations.
To support post-hoc alterations, each RF pulse or gradient waveform in the sequence can be given a label. Some commonly-used labels in MRIBuilder are:
:diffusion
used for diffusion-weighted gradients produced bydwi_gradients
.:FOV
used for gradients that should align with the field-of-view (slice-select gradients inexcitation_pulse
orrefocus_pulse
and readout gradients inreadout_event
).
Post-hoc alterations can be applied to gradients or RF pulses with a specific labels (or to all gradients/RF pulses) using adjust
. Some example usages are:
- Reduce the RF pulse amplitude by 20% (e.g., to model the effect of transmit bias field):
adjust(sequence, pulse=(scale=0.8, ))
- Repeat sequence 2 times with different diffusion-weighted gradient orientations (x- and y-direction) and gradient strength reduced by 30%:
adjust(sequence, diffusion=(orientation=[[1., 0., 0], [0., 1., 0.]], scale=0.7))
- Repeat the sequence by shifting the excited slice by the given number of millimetres in the slice-select direction:
adjust(sequence, FOV=(shift=[-7.5, -2.5, 2.5, 7.5, -5., 0., 5., 10.]))
. These shifts represent an interleaved acquisition scheme, where the acquired slices/bands are 2.5 mm apart. - Rotations defined using the
Rotations.jl
package can be applied to gradient orientations or the field of view. For example, to rotate the field of view by 45 degrees around the y-axis:
using Rotations
rotation = Rotations.AngleAxis(deg2rad(45), 0., 1., 0.)
adjust(sequence, FOV=(rotation=rotation, ))
When repeating the same sequence, a spoiler gradient and/or dead time can be added in between each pair of repeats by supplying the appropriate keywords to the merge
parameter in adjust
(e.g., merge=(wait_time=10., )
). These parameters are described in more detail in merge_sequences
.
Post-hoc adjustments API
MRIBuilder.PostHoc
— ModuleDefine post-fitting adjustments of the sequences
MRIBuilder.PostHoc.merge_sequences
— Methodmerge_sequences(sequences...; wait_time=0.)
Merge multiple sequences together.
Sequences will be run one after each other with wait_time
in between.
MRIBuilder.Variables.adjust
— Methodadjust(block; kwargs...)
Generate one or more new sequences/building_blocks/components with some post-fitting adjustments.
The following adjustments are allowed:
- for MR gradients
orientation
: set the orientation to a given vector.rotation
: rotate the gradient orientations using a rotations fromRotations.jl
.scale
: multiply the gradient strength by the given value. Note that if you use a value not between -1 and 1 you might break the scanner's maximum gradient or slew rate.
- for RF pulses:
frequency
: shift the off-resonance frequency by the given value (in kHz).scale
: multiply the RF pulse amplitude by the given value (used to model the B1 transmit field).
A vector of multiple values can be passed on to any of these in order to create multiple sequences with different adjustments. The will usually be merged together. You can get the individual sequences by passing on merge=false
. The time between these repeated sequences can be adjusted using the keywords described in merge_sequences
passed on to the merge keyword: e.g., merge=(wait_time=10, )
adds a wait time of 10 ms between each repeated sequence.
Specific sequence components that can be adjusted are identified by their group
name. For example, adjust(sequence, diffusion=(orientation=[0, 1, 0], ))
will set any gradient in the group :diffusion
to point in the y-direction.
To affect all gradients or pulses, use gradient=
or pulse
, e.g. adjust(sequence, pulse=(scale=0.5, ))
will divide the amplitude of all RV pulses by two.