From 9764d53d6051513b47524d664e006cb52a551cb3 Mon Sep 17 00:00:00 2001 From: roflmaostc Date: Thu, 15 Aug 2024 15:31:19 +0200 Subject: [PATCH] Fix docstring --- src/geometry.jl | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/geometry.jl b/src/geometry.jl index afd5d8b..7860713 100644 --- a/src/geometry.jl +++ b/src/geometry.jl @@ -18,7 +18,7 @@ abstract type RadonGeometry end - `N` is the size of the first and second dimension of the input array for `radon`. -- `in_height` is a vector or a range indicating the positions of the detector with respect to the midpoint which is located at `N ÷ 2 + 1`. The rays travel along straight parallel paths through the array. +- `in_height` is a vector or a range indicating the positions of the detector with respect to the midpoint which is located at `N ÷ 2 + 1`. The rays travel along straight parallel paths through the array. Maximum and minimum values are `(N+1) ÷ 2 - 1` and `-(N+1) ÷ 2 + 1` respectively. For example, for an array of size `N=10` the default definition is: `RadonParallelCircle(10, -4:4)` So the resulting sinogram has the shape: `(9, length(angles), size(array, 3))`. @@ -33,11 +33,13 @@ struct RadonParallelCircle{T, T2} <: RadonGeometry weights::T2 function RadonParallelCircle(N, in_height) + @assert minimum(in_height) >= -(N+1) ÷ 2 + 1 && maximum(in_height) <= (N+1) ÷ 2 - 1 "The in_height values are out of bounds. Limits are: $(-(N+1) ÷ 2 + 1) and $((N+1) ÷ 2 - 1)" weights = in_height .* 0 .+ 1 return new{typeof(in_height), typeof(weights)}(N, in_height, weights) end function RadonParallelCircle(N, in_height, weights) + @assert minimum(in_height) >= -(N+1) ÷ 2 + 1 && maximum(in_height) <= (N+1) ÷ 2 - 1 "The in_height values are out of bounds. Limits are: $(-(N+1) ÷ 2 + 1) and $((N+1) ÷ 2 - 1)" return new{typeof(in_height),typeof(weights)}(N, in_height, weights) end end @@ -47,8 +49,8 @@ end RadonFlexibleCircle(N, in_height, out_height, weights) - `N` is the size of the first and second dimension of the input for `radon`. -- `in_height` is a vector or range indicating the vertical positions of the rays entering the circle with respect to the midpoint which is located at `N ÷ 2 + 1`. -- `out_height` is a vector or range indicating the vertical positions of the rays exiting the circle with respect to the midpoint which is located at `N ÷ 2 + 1`. +- `in_height` is a vector or range indicating the vertical positions of the rays entering the circle with respect to the midpoint which is located at `N ÷ 2 + 1`. Maximum and minimum values are `(N+1) ÷ 2 - 1` and `-(N+1) ÷ 2 + 1` respectively. +- `out_height` is a vector or range indicating the vertical positions of the rays exiting the circle with respect to the midpoint which is located at `N ÷ 2 + 1`. Maximum and minimum values are `(N+1) ÷ 2 - 1` and `-(N+1) ÷ 2 + 1` respectively. One definition could be: `RadonFlexibleCircle(10, -4:4, zeros((9,)))` @@ -65,11 +67,15 @@ struct RadonFlexibleCircle{T, T2, T3} <: RadonGeometry out_height::T2 weights::T3 function RadonFlexibleCircle(N, in_height, out_height) + @assert minimum(in_height) >= -(N+1) ÷ 2 + 1 && maximum(in_height) <= (N+1) ÷ 2 - 1 "The in_height values are out of bounds. Limits are: $(-(N+1) ÷ 2 + 1) and $((N+1) ÷ 2 - 1)" + @assert minimum(out_height) >= -(N+1) ÷ 2 + 1 && maximum(out_height) <= (N+1) ÷ 2 - 1 "The out_height values are out of bounds. Limits are: $(-(N+1) ÷ 2 + 1) and $((N+1) ÷ 2 - 1)" weights = in_height .* 0 .+ 1 return new{typeof(in_height), typeof(out_height), typeof(weights)}(N, in_height, out_height, weights) end function RadonFlexibleCircle(N, in_height, out_height, weights) + @assert minimum(in_height) >= -(N+1) ÷ 2 + 1 && maximum(in_height) <= (N+1) ÷ 2 - 1 "The in_height values are out of bounds. Limits are: $(-(N+1) ÷ 2 + 1) and $((N+1) ÷ 2 - 1)" + @assert minimum(out_height) >= -(N+1) ÷ 2 + 1 && maximum(out_height) <= (N+1) ÷ 2 - 1 "The out_height values are out of bounds. Limits are: $(-(N+1) ÷ 2 + 1) and $((N+1) ÷ 2 - 1)" return new{typeof(in_height), typeof(out_height), typeof(weights)}(N, in_height, out_height, weights) end end