diff --git a/docs/src/defining_sequence.md b/docs/src/defining_sequence.md index 12443316e6da348194255cf55881391ba0229a71..fb6e257607ca50dc3b8ff8f1c9e3c9464274e4b5 100644 --- a/docs/src/defining_sequence.md +++ b/docs/src/defining_sequence.md @@ -80,7 +80,7 @@ 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]`). It is then observed during the first readout (`1`). For such a [`Pathway`](@ref) we can compute: -- the time that the spin spends in any direction ([`duration_state`](@ref)), 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 ([`duration_transverse`](@ref)) and the amount of time spent dephasing to compute the amount of T2*-weighting ([`duration_dephase`](@ref)). - the diffusion weighting experienced ([`bval`](@ref), [`bmat`](@ref), and [`qvec`](@ref)) By defining a default pathway for the sequence, the user can now put constraints on any or all of these variables. diff --git a/src/build_sequences.jl b/src/build_sequences.jl index 89d7d75f3fabc2e7a9091dcfdfc156118cf1b3ca..733db18da70bcbae0f047a6704bc6009265b6673 100644 --- a/src/build_sequences.jl +++ b/src/build_sequences.jl @@ -105,6 +105,13 @@ end build_sequence(f::Function, optimiser_constructor; kwargs...) = build_sequence(f, Default_Scanner, optimiser_constructor; kwargs...) +""" + global_model() + +Return the currently set JuMP model. + +The model can be set using [`build_sequence`](@ref) +""" function global_model() if GLOBAL_MODEL[] == IGNORE_MODEL error("No global model has been set. Please embed any sequence creation within an `build_sequence` block.") @@ -112,6 +119,13 @@ function global_model() return GLOBAL_MODEL[] end +""" + global_scanner() + +Return the currently set [`Scanner`](@ref). + +The scanner can be set using [`build_sequence`](@ref) +""" function global_scanner() if !isfinite(GLOBAL_SCANNER[].gradient) error("No valid scanner has been set. Please provide one when calling `build_sequence`.") @@ -123,8 +137,9 @@ end """ fixed(building_block) -Returns an equiavalent [`BuildingBlock`](@ref) with all free variables replaced by numbers. -This will only work after calling [`optimize!`](@ref)([`global_model`](@ref)()). +Return an equiavalent `BuildingBlock` with all free variables replaced by numbers. + +This will only work after calling `optimize!`(@ref)([`global_model`](@ref)()). It is used internally by [`build_sequence`](@ref). """ fixed(some_value) = some_value diff --git a/src/parts/helper_functions.jl b/src/parts/helper_functions.jl index 4cd05d73af24745f9aa03dc162d79f15302aa062..67dd76530d065f7259a8a4f45fabdd03f6f2e860 100644 --- a/src/parts/helper_functions.jl +++ b/src/parts/helper_functions.jl @@ -5,7 +5,7 @@ import ..Trapezoids: Trapezoid, opposite_kspace_lines, SliceSelect import ..SpoiltSliceSelects: SpoiltSliceSelect import ..SliceSelectRephases: SliceSelectRephase import ..EPIReadouts: EPIReadout -import ...BuildSequences: global_model, build_sequence +import ...BuildSequences: global_model, build_sequence, global_scanner import ...Containers: Sequence import ...Components: SincPulse, ConstantPulse, InstantPulse, SingleReadout, InstantGradient import ...Variables: qvec, flat_time, rise_time, qval, apply_simple_constraint!, variables diff --git a/src/pathways.jl b/src/pathways.jl index 359507abbd05ba4be7c0af8b34e4ccd73d13b427..358614518b42a1d28e3f51c619850a1bbd9d5cde 100644 --- a/src/pathways.jl +++ b/src/pathways.jl @@ -42,8 +42,8 @@ Over the pathway the following values are computed. Each can be accessed by call 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. - [`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. -- [`bmat`](@ref): Net diffusion weighting due to gradients along the [`Pathway`](@ref) in matrix form. -- [`bval`](@ref): Net diffusion weighting due to gradients along the [`Pathway`](@ref) as a single number. +- [`bmat`](@ref): Net diffusion weighting due to gradients along the `Pathway` in matrix form. +- [`bval`](@ref): Net diffusion weighting due to gradients along the `Pathway` as a single number. """ struct Pathway # user provided @@ -237,7 +237,7 @@ end """ Helper structure for [`PathwayWalker`](@ref), which is itself a helper for `Pathway`. You are deep down the rabit hole now... -For documentation, see that structure and [`walk_pathway`](@ref) and [`update_walker_gradient!`](@ref). +For documentation, see that structure and [`walk_pathway!`](@ref) and [`update_walker_gradient!`](@ref). """ mutable struct GradientTracker last_gradient_time :: VariableType @@ -251,7 +251,7 @@ GradientTracker() = GradientTracker(0., zeros(3), zeros(3, 3)) """ Helper structure for `Pathway`. -For documentation, see that structure and [`walk_pathway`](@ref). +For documentation, see that structure and [`walk_pathway!`](@ref). """ mutable struct PathwayWalker last_pulse_time :: VariableType diff --git a/src/variables.jl b/src/variables.jl index 949de4f5bcb6a58a0ba3647483fbf90b00355956..0fccb829b65f8f395b17daba057bbefd03abc7ab 100644 --- a/src/variables.jl +++ b/src/variables.jl @@ -6,8 +6,8 @@ In addition this defines: - [`VariableType`](@ref): parent type for any variables (whether number or JuMP variable). - [`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. -- [`apply_simple_constraint`](@ref): set a simple equality constraint. +- [`set_simple_constraints!`](@ref): call [`apply_simple_constraint!`](@ref) for each keyword argument. +- [`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 - [`gradient_orientation`](@ref): returns the gradient orientation of a waveform if fixed. """ @@ -36,7 +36,7 @@ end Returns the adjusted blocks and add any keywords used in the process to `names_used`. -This is a helper function used by [`adjust`](@ref). +This is a helper function used by `adjust`. """ function adjust_internal end