|
| 1 | +function LinearOperatorCollection.RadonOp(::Type{T}; shape::NTuple{N, Int}, angles, |
| 2 | + geometry = RadonParallelCircle(shape[1], -(shape[1]-1)÷2:(shape[1]-1)÷2), μ = nothing, S = Vector{T}) where {T, N} |
| 3 | + return RadonOpImpl(T; shape, angles, geometry, μ, S) |
| 4 | +end |
| 5 | + |
| 6 | +mutable struct RadonOpImpl{T, vecT <: AbstractVector{T}, vecT2, G, A} <: RadonOp{T} |
| 7 | + nrow :: Int |
| 8 | + ncol :: Int |
| 9 | + symmetric :: Bool |
| 10 | + hermitian :: Bool |
| 11 | + prod! :: Function |
| 12 | + tprod! :: Nothing |
| 13 | + ctprod! :: Function |
| 14 | + nprod :: Int |
| 15 | + ntprod :: Int |
| 16 | + nctprod :: Int |
| 17 | + args5 :: Bool |
| 18 | + use_prod5! :: Bool |
| 19 | + allocated5 :: Bool |
| 20 | + Mv5 :: vecT |
| 21 | + Mtu5 :: vecT |
| 22 | + angles :: vecT2 |
| 23 | + geometry :: G |
| 24 | + μ :: A |
| 25 | +end |
| 26 | + |
| 27 | +LinearOperators.storage_type(op::RadonOpImpl) = typeof(op.Mv5) |
| 28 | + |
| 29 | +function RadonOpImpl(T::Type; shape::NTuple{N, Int64}, angles, geometry, μ, S) where N |
| 30 | + N_sinogram = length(geometry.in_height) |
| 31 | + N_angles = length(angles) |
| 32 | + d = length(shape) == 3 ? shape[3] : 1 |
| 33 | + nrow = N_sinogram * N_angles * d |
| 34 | + ncol = prod(shape) |
| 35 | + return RadonOpImpl(nrow, ncol, false, false, |
| 36 | + (res, x) -> prod_radon!(res, x, shape, angles, geometry, μ), |
| 37 | + nothing, |
| 38 | + (res, x) -> ctprod_radon!(res, x, (N_sinogram, N_angles, d), angles, geometry, μ), |
| 39 | + 0, 0, 0, true, false, true, S(undef, 0), S(undef, 0), angles, geometry, μ) |
| 40 | +end |
| 41 | + |
| 42 | +prod_radon!(res::vecT, x::vecT, shape, angles::vecT2, geometry::G, μ::A) where {vecT, vecT2, G, A} = copyto!(res, radon(reshape(x, shape), angles; geometry, μ)) |
| 43 | +prod_radon!(res::vecT, x::vecT, shape, angles::vecT2, ::Nothing, μ::A) where {vecT, vecT2, A} = copyto!(res, radon(reshape(x, shape), angles; μ)) |
| 44 | + |
| 45 | +ctprod_radon!(res::vecT, x::vecT, shape, angles::vecT2, geometry::G, μ::A) where {vecT, vecT2, G, A} = copyto!(res, RadonKA.backproject(reshape(x, shape), angles; geometry, μ)) |
| 46 | +ctprod_radon!(res::vecT, x::vecT, shape, angles::vecT2, ::Nothing, μ::A) where {vecT, vecT2, A} = copyto!(res, RadonKA.backproject(reshape(x, shape), angles; μ)) |
0 commit comments