Skip to content

Commit 6dfdd5b

Browse files
committed
Add RadonOp based on RadonKA
1 parent 2b1331d commit 6dfdd5b

File tree

4 files changed

+59
-2
lines changed

4 files changed

+59
-2
lines changed

Project.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ julia = "1.9"
1919
GPUArrays = "8, 9, 10"
2020
NFFT = "0.13"
2121
LinearOperators = "2.3.3"
22+
RadonKA = "0.6"
2223
Wavelets = "0.9, 0.10"
2324
Reexport = "1.0"
2425
FFTW = "1.0"
@@ -28,6 +29,7 @@ GPUArrays = "0c68f7d7-f131-5f86-a1c3-88cf8149b2d7"
2829
NFFT = "efe261a4-0d2b-5849-be55-fc731d526b0d"
2930
Wavelets = "29a6e085-ba6d-5f35-a997-948ac2efa89a"
3031
FFTW = "7a1cc6ca-52ef-59f5-83cd-3a7055c09341"
32+
RadonKA = "86de8297-835b-47df-b249-c04e8db91db5"
3133

3234
[targets]
3335
test = ["Test", "FFTW", "Wavelets", "NFFT"]
@@ -36,4 +38,5 @@ test = ["Test", "FFTW", "Wavelets", "NFFT"]
3638
LinearOperatorNFFTExt = ["NFFT", "FFTW"]
3739
LinearOperatorFFTWExt = "FFTW"
3840
LinearOperatorWaveletExt = "Wavelets"
39-
LinearOperatorGPUArraysExt = "GPUArrays"
41+
LinearOperatorGPUArraysExt = "GPUArrays"
42+
LinearOperatorRadonKAExt = "RadonKA"
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
module LinearOperatorRadonKAExt
2+
3+
using LinearOperatorCollection, RadonKA
4+
5+
include("RadonOp.jl")
6+
7+
end
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
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; μ))

src/LinearOperatorCollection.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ end
3030

3131
export linearOperatorList, createLinearOperator
3232
export AbstractLinearOperatorFromCollection, WaveletOp, FFTOp, DCTOp, DSTOp, NFFTOp,
33-
SamplingOp, NormalOp, WeightingOp, GradientOp
33+
SamplingOp, NormalOp, WeightingOp, GradientOp, RadonOp
3434

3535
abstract type AbstractLinearOperatorFromCollection{T} <: AbstractLinearOperator{T} end
3636
abstract type WaveletOp{T} <: AbstractLinearOperatorFromCollection{T} end
@@ -41,6 +41,7 @@ abstract type NFFTOp{T} <: AbstractLinearOperatorFromCollection{T} end
4141
abstract type SamplingOp{T} <: AbstractLinearOperatorFromCollection{T} end
4242
abstract type NormalOp{T} <: AbstractLinearOperatorFromCollection{T} end
4343
abstract type GradientOp{T} <: AbstractLinearOperatorFromCollection{T} end
44+
abstract type RadonOp{T} <: AbstractLinearOperatorFromCollection{T} end
4445

4546

4647
"""

0 commit comments

Comments
 (0)