From fcfc5d7241fa9d5616b0dc6c23d31c2b64a1f040 Mon Sep 17 00:00:00 2001
From: Michiel Cottaar <MichielCottaar@protonmail.com>
Date: Wed, 29 May 2024 14:04:03 +0100
Subject: [PATCH] Remove default definition of TR

---
 docs/src/sequence_optimisation.md      | 2 +-
 src/containers/base_sequences.jl       | 7 +------
 src/sequences/diffusion_spin_echoes.jl | 2 +-
 src/sequences/gradient_echoes.jl       | 2 +-
 src/sequences/spin_echoes.jl           | 2 +-
 5 files changed, 5 insertions(+), 10 deletions(-)

diff --git a/docs/src/sequence_optimisation.md b/docs/src/sequence_optimisation.md
index 406647e..d42899b 100644
--- a/docs/src/sequence_optimisation.md
+++ b/docs/src/sequence_optimisation.md
@@ -5,7 +5,7 @@ In most MR sequence building software, the user will have to set all of these fr
 
 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`](@ref), [`repetition_time`](@ref), [`resolution`](@ref), [`gradient_strength`](@ref), [`diffusion_time`](@ref), etc.
+For each sequence type, the developer defines how to compute various summary variables from the `BuildingBlock` free parameters, such as [`echo_time`](@ref), [`duration`](@ref), [`resolution`](@ref), [`gradient_strength`](@ref), [`diffusion_time`](@ref), 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](@ref scanners).
 Internally, MRIBuilder will then optimise the `BuildingBlock` free parameters to match any user-defined constraints and/or objectives.
diff --git a/src/containers/base_sequences.jl b/src/containers/base_sequences.jl
index 8ca7244..bbbb195 100644
--- a/src/containers/base_sequences.jl
+++ b/src/containers/base_sequences.jl
@@ -64,7 +64,7 @@ function start_time(bs::BaseSequence{N}, index::Integer) where {N}
     if iszero(nTR)
         return base_time
     else
-        return nTR * repetition_time(bs) + base_time
+        return nTR * duration(bs) + base_time
     end
 end
 
@@ -144,9 +144,6 @@ Defines an MRI sequence from a vector of building blocks.
     - numbers/`nothing`/`:min`/`:max` : replaced with a [`Wait`](@ref) block with the appropriate constraint/objective added to its [`duration`](@ref).
     - RF pulse or readout: will be embedded within a [`BuildingBlock`](@ref) of the appropriate length
 
-## Variables
-- [`repetition_time`](@ref)/[`TR`](@ref): how long between repeats in ms. This is always set to the total length of the sequence. If you want to add some down-time between repeats, you can simply add a [`Wait`](@ref) block of the appropriate length at the end of the sequence.
-
 Specific named sequences might define additional variables.
 """
 struct Sequence{S, N} <: BaseSequence{N}
@@ -173,8 +170,6 @@ nrepeat(::Sequence) = 0
 to_block_pair(pair::Pair) = pair[1] => to_block(pair[2])
 to_block_pair(other) = nothing => to_block(other)
 
-@defvar repetition_time(seq::Sequence) = duration(seq)
-
 """
     to_block(block_like)
 
diff --git a/src/sequences/diffusion_spin_echoes.jl b/src/sequences/diffusion_spin_echoes.jl
index 669a2fe..2fc2355 100644
--- a/src/sequences/diffusion_spin_echoes.jl
+++ b/src/sequences/diffusion_spin_echoes.jl
@@ -34,7 +34,7 @@ If image parameters are provided, this will switch to a sinc pulse and EPI reado
 ## Variables
 - [`TE`](@ref)/[`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.
-- [`TR`](@ref)/[`repetition_time`](@ref)/[`duration`](@ref): total duration of the sequence from start of excitation pulse to end of readout or spoiler in ms.
+- [`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.
 """
 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...)
diff --git a/src/sequences/gradient_echoes.jl b/src/sequences/gradient_echoes.jl
index 77b1241..ef05752 100644
--- a/src/sequences/gradient_echoes.jl
+++ b/src/sequences/gradient_echoes.jl
@@ -26,7 +26,7 @@ If image parameters are provided, this will switch to a sinc pulse and EPI reado
 
 ## Variables
 - [`TE`](@ref)/[`echo_time`](@ref): echo time between excitation pulse and readout in ms (required).
-- [`TR`](@ref)/[`repetition_time`](@ref)/[`duration`](@ref): total duration of the sequence from start of excitation pulse to end of readout or spoiler in ms.
+- [`duration`](@ref): total duration of the sequence from start of excitation pulse to end of readout or spoiler in ms.
 """
 function GradientEcho(; excitation=(), readout=(), optim=(), spoiler=nothing, resolution=nothing, fov=nothing, voxel_size=nothing, slice_thickness=nothing, scanner=Default_Scanner, variables...)
     build_sequence(scanner; optim...) do
diff --git a/src/sequences/spin_echoes.jl b/src/sequences/spin_echoes.jl
index 90ec0a4..f1d8ff4 100644
--- a/src/sequences/spin_echoes.jl
+++ b/src/sequences/spin_echoes.jl
@@ -28,7 +28,7 @@ If image parameters are provided, this will switch to a sinc pulse and EPI reado
 ## Variables
 - [`TE`](@ref)/[`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.
-- [`TR`](@ref)/[`repetition_time`](@ref)/[`duration`](@ref): total duration of the sequence from start of excitation pulse to end of readout or spoiler in ms.
+- [`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...)
     build_sequence(scanner; optim...) do
-- 
GitLab