Sequence optimisation

In MRIBuilder an MR Sequence is defined as a sequence of BuildingBlock objects. Most BuildingBlock objects will contain free parameters determining, for example, the duration of the block or the strength/orientation of the MR gradient. In most MR sequence building software, the user will have to set all of these free parameters by computing the appropriate values given a desired echo time, b-value, etc.

In MRIBuilder the internal free parameters are not set directly. Instead, they are inferred using a non-linear, constrained optimisation. For each sequence type, the developer defines how to compute various summary variables from the BuildingBlock free parameters, such as echo_time, repetition_time, resolution, gradient_strength, diffusion_time, etc. A user can then create a specific instantiation of the sequence by fixing any of these summary variables to their desired values (or setting them to :min/:max to minimise/maximise them). In addition to the user-defined constraints, this optimisation will also take into account any scanner-defined constraints. Internally, MRIBuilder will then optimise the BuildingBlock free parameters to match any user-defined constraints and/or objectives. This optimisation uses the Ipopt optimiser accessed through the JuMP.jl library.

Summary variables

MRIBuilder.VariablesModule

Defines the functions that can be called on parts of an MRI sequence to query or constrain any variables.

In addition this defines:

source
MRIBuilder.Variables.alternative_variablesConstant

Dictionary with alternative versions of specific function.

Setting constraints on these alternative functions can be helpful as it avoids some operations, which the optimiser might struggle with.

source
MRIBuilder.Scanners.slew_rateFunction
slew_rate(gradient)

Vector with maximum slew rate of a gradient along each dimension (kHz/um/ms)

This represents a variable within the sequence. Variables can be set during the construction of a AbstractBlock or used to create constraints after the fact.

source
MRIBuilder.Variables.N_leftFunction
N_left(pulse)

The number of zero crossings of the RF pulse before the main peak

This represents a variable within the sequence. Variables can be set during the construction of a AbstractBlock or used to create constraints after the fact.

source
MRIBuilder.Variables.N_rightFunction
N_right(pulse)

The number of zero crossings of the RF pulse after the main peak

This represents a variable within the sequence. Variables can be set during the construction of a AbstractBlock or used to create constraints after the fact.

source
MRIBuilder.Variables.TEFunction
TE(sequence)

Echo time of the sequence in ms. Defaults to the result of echo_time.

This represents a variable within the sequence. Variables can be set during the construction of a AbstractBlock or used to create constraints after the fact.

source
MRIBuilder.Variables.TRFunction
TR(sequence)

Time on which an MRI sequence repeats itself in ms. Defaults to the result of repetition_time.

This represents a variable within the sequence. Variables can be set during the construction of a AbstractBlock or used to create constraints after the fact.

source
MRIBuilder.Variables.adjust_internalFunction
adjust_internal(block, names_used; kwargs...)

Returns the adjusted blocks and add any keywords used in the process to names_used.

This is a helper function used by adjust.

source
MRIBuilder.Variables.adjustableMethod
adjustable(block)

Returns whether a sequence, building block, or component can be adjusted

Can return one of:

  • :false: not adjustable
  • :gradient: expects gradient adjustment parameters
  • :pulse: expects RF pulse adjustment parameters
source
MRIBuilder.Variables.apply_simple_constraint!Method
apply_simple_constraint!(variable, value)

Add a single constraint or objective to the variable.

value can be one of:

  • nothing: do nothing
  • :min: minimise the variable
  • :max: maximise the variable
  • number: fix variable to this value
  • equation: fix variable to the result of this equation
source
MRIBuilder.Variables.bmatFunction
bmat(sequence)

Full 3x3 diffusion-weighting matrix in ms/um^2.

This represents a variable within the sequence. Variables can be set during the construction of a AbstractBlock or used to create constraints after the fact.

source
MRIBuilder.Variables.bmat_gradientFunction
bmat_gradient(gradient::GradientBlock, qstart=(0, 0, 0))

Computes the diffusion-weighting matrix due to a single gradient block in rad^2 ms/um^2.

This should be defined for every GradientBlock, but not be called directly. Instead, the bmat and bval should be constrained for specific Pathways

source
MRIBuilder.Variables.bvalFunction
bval(sequence)

Size of diffusion-weighting in ms/um^2 (trace of bmat).

This represents a variable within the sequence. Variables can be set during the construction of a AbstractBlock or used to create constraints after the fact.

source
MRIBuilder.Variables.delayFunction
delay(sequence)

Delay between readout and spin echo in an asymmetric spin echo in ms.

This represents a variable within the sequence. Variables can be set during the construction of a AbstractBlock or used to create constraints after the fact.

source
MRIBuilder.Variables.diffusion_timeFunction
diffusion_time(sequence)

Diffusion time in ms (i.e., time between start of the diffusion-weighted gradients).

This represents a variable within the sequence. Variables can be set during the construction of a AbstractBlock or used to create constraints after the fact.

source
MRIBuilder.Variables.durationFunction
duration(block)

duration of the building block in ms.

This represents a variable within the sequence. Variables can be set during the construction of a AbstractBlock or used to create constraints after the fact.

source
MRIBuilder.Variables.duration_dephaseFunction
duration_dephase(sequence)

Net T2' dephasing experienced over a sequence (in ms).

This represents a variable within the sequence. Variables can be set during the construction of a AbstractBlock or used to create constraints after the fact.

source
MRIBuilder.Variables.duration_transverseFunction
duration_transverse(sequence)

Net T2 signal loss experienced over a sequence (in ms). This is the total duration spins spent in the transverse plane.

This represents a variable within the sequence. Variables can be set during the construction of a AbstractBlock or used to create constraints after the fact.

source
MRIBuilder.Variables.dwell_timeFunction
dwell_time(readout)

Time between two samples in an ADC in ms.

This represents a variable within the sequence. Variables can be set during the construction of a AbstractBlock or used to create constraints after the fact.

source
MRIBuilder.Variables.echo_timeFunction
echo_time(sequence)

Echo time of the sequence in ms.

This represents a variable within the sequence. Variables can be set during the construction of a AbstractBlock or used to create constraints after the fact.

source
MRIBuilder.Variables.flat_timeFunction
flat_time(gradient)

Time of gradient pulse at maximum value in ms.

This represents a variable within the sequence. Variables can be set during the construction of a AbstractBlock or used to create constraints after the fact.

source
MRIBuilder.Variables.flip_angleFunction
flip_angle(pulse)

The flip angle of the RF pulse in degrees

This represents a variable within the sequence. Variables can be set during the construction of a AbstractBlock or used to create constraints after the fact.

source
MRIBuilder.Variables.fovFunction
fov(readout)

Size of the field of view in mm. To set constraints it is often better to use inverse_fov.

This represents a variable within the sequence. Variables can be set during the construction of a AbstractBlock or used to create constraints after the fact.

source
MRIBuilder.Variables.frequencyFunction
frequency(pulse)

The off-resonance frequency of an RF pulse (relative to the Larmor frequency of water) in KHz

This represents a variable within the sequence. Variables can be set during the construction of a AbstractBlock or used to create constraints after the fact.

source
MRIBuilder.Variables.get_readoutFunction
get_readout(building_block)]

Get the readout played out during the building block.

Any readout variables not explicitly defined for this building block will be passed on to the readout.

source
MRIBuilder.Variables.inverse_fovFunction
inverse_fov(readout)

Inverse of size of the field of view in 1/mm. Also see fov.

This represents a variable within the sequence. Variables can be set during the construction of a AbstractBlock or used to create constraints after the fact.

source
MRIBuilder.Variables.make_genericFunction
make_generic(sequence/building_block/component)

Returns a generic version of the BaseSequence, BaseBuildingBlock, or BaseComponent

  • Sequences are all flattened and returned as a single Sequence containing only BuildingBlock objects.
  • Any BaseBuildingBlock is converted into a BuildingBlock.
  • Pulses are replaced with GenericPulse (except for instant pulses).
  • Instant readouts are replaced with ADC.
source
MRIBuilder.Variables.nsamplesFunction
nsamples(readout)

Number of samples during a readout. During the optimisation this might produce non-integer values.

This represents a variable within the sequence. Variables can be set during the construction of a AbstractBlock or used to create constraints after the fact.

source
MRIBuilder.Variables.qvalFunction
qval(gradient)

The spatial range on which the displacements can be detected due to this gradient in rad/um. This will be a scalar if the orientation is fixed and a scalar otherwise. If you always want a vector, use qvec.

This represents a variable within the sequence. Variables can be set during the construction of a AbstractBlock or used to create constraints after the fact.

source
MRIBuilder.Variables.qval3Function
qval3(gradient)

The spatial range with orientation on which the displacements can be detected due to this gradient in rad/um (also see qval).

This represents a variable within the sequence. Variables can be set during the construction of a AbstractBlock or used to create constraints after the fact.

source
MRIBuilder.Variables.qvecFunction
qvec(sequence)

Net dephasing due to gradients in rad/um.

This represents a variable within the sequence. Variables can be set during the construction of a AbstractBlock or used to create constraints after the fact.

source
MRIBuilder.Variables.ramp_overlapFunction
ramp_overlap(readout)

Fraction of overlap between ADC event and underlying gradient pulse ramp (between 0 and 1).

This represents a variable within the sequence. Variables can be set during the construction of a AbstractBlock or used to create constraints after the fact.

source
MRIBuilder.Variables.repetition_timeFunction
repetition_time(sequence)

Time on which an MRI sequence repeats itself in ms.

This represents a variable within the sequence. Variables can be set during the construction of a AbstractBlock or used to create constraints after the fact.

source
MRIBuilder.Variables.resolutionFunction
resolution(readout)

Number of voxels in the final readout. During the optimisation this might produce non-integer values, but this will be fixed after optimsation.

This represents a variable within the sequence. Variables can be set during the construction of a AbstractBlock or used to create constraints after the fact.

source
MRIBuilder.Variables.rise_timeFunction
rise_time(gradient)

Time for gradient pulse to reach its maximum value in ms.

This represents a variable within the sequence. Variables can be set during the construction of a AbstractBlock or used to create constraints after the fact.

source
MRIBuilder.Variables.set_simple_constraints!Method
set_simple_constraints!(block, kwargs)

Add any constraints or objective functions to the variables of a AbstractBlock.

Each keyword argument has to match one of the functions in variables(block). If set to a numeric value, a constraint will be added to fix the function value to that numeric value. If set to :min or :max, minimising or maximising this function will be added to the cost function.

source
MRIBuilder.Variables.spoiler_scaleFunction
spoiler_scale(gradient)

Length-scale on which spins will be dephased by exactly 2π in mm.

This represents a variable within the sequence. Variables can be set during the construction of a AbstractBlock or used to create constraints after the fact.

source
MRIBuilder.Variables.ΔFunction
Δ(sequence)

Diffusion time in ms (i.e., time between start of the diffusion-weighted gradients). Defaults to the result of diffusion_time.

This represents a variable within the sequence. Variables can be set during the construction of a AbstractBlock or used to create constraints after the fact.

source