From d682a330c9277a4d43e2b018e0851a44d4f64a56 Mon Sep 17 00:00:00 2001 From: Michiel Cottaar <michiel.cottaar@ndcn.ox.ac.uk> Date: Wed, 21 Feb 2024 17:49:13 +0000 Subject: [PATCH] Raise error if slice_thickness is incorrectly set --- src/parts/helper_functions.jl | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/parts/helper_functions.jl b/src/parts/helper_functions.jl index 0158769..d9f828a 100644 --- a/src/parts/helper_functions.jl +++ b/src/parts/helper_functions.jl @@ -56,6 +56,9 @@ function excitation_pulse(; flip_angle=90, phase=0., frequency=0., shape=nothing if length(bad_keys) > 0 error("Unrecognised keyword arguments in call of `excitation_pulse`: $bad_keys") end + if isnothing(slice_thickness) || slice_thickness isa Symbol + error("slice thickness cannot be a free parameter") + end if isnothing(shape) shape = isinf(slice_thickness) ? :instant : :sinc end @@ -114,6 +117,9 @@ function refocus_pulse(; flip_angle=180, phase=0., frequency=0., shape=nothing, if length(bad_keys) > 0 error("Unrecognised keyword arguments in call of `refocus_pulse`: $bad_keys") end + if isnothing(slice_thickness) || slice_thickness isa Symbol + error("slice thickness cannot be a free parameter") + end if isnothing(shape) shape = isinf(slice_thickness) ? :instant : :sinc end @@ -240,7 +246,7 @@ function interpret_image_size(fov, resolution, voxel_size, slice_thickness) _real_value(other) = false if all(isnothing.((fov, resolution, voxel_size))) - return (slice_thickness, nothing, (fov=nothing, resolution=nothing, voxel_size=nothing)) + return (isnothing(voxel_size) ? Inf : voxel_size, nothing, (fov=nothing, resolution=nothing, voxel_size=nothing)) end if !_real_value(resolution) if !(_real_value(fov) && _real_value(voxel_size)) -- GitLab