Skip to content

Commit 8c31134

Browse files
authored
Add subpackage readme files (#36)
1 parent ea5d8c2 commit 8c31134

File tree

5 files changed

+439
-3
lines changed

5 files changed

+439
-3
lines changed

DSPOperators/README.md

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
# DSPOperators.jl
2+
3+
[![](https://img.shields.io/badge/docs-stable-blue.svg)](https://kul-optec.github.io/AbstractOperators.jl/stable/operators/#Convolution)
4+
[![](https://img.shields.io/badge/docs-latest-blue.svg)](https://kul-optec.github.io/AbstractOperators.jl/latest/operators/#Convolution)
5+
6+
Digital Signal Processing operators for the AbstractOperators.jl framework.
7+
8+
## Overview
9+
10+
DSPOperators.jl is a specialized extension package for [AbstractOperators.jl](../README.md) that provides linear operators for common digital signal processing (DSP) operations. It allows DSP operations such as filtering, convolution, and cross-correlation to be expressed using the unified `LinearOperator` interface, making them seamlessly compatible with optimization algorithms and iterative solvers built on AbstractOperators.
11+
12+
## Relationship to AbstractOperators.jl
13+
14+
DSPOperators.jl is a **subpackage** of the AbstractOperators.jl ecosystem. While AbstractOperators.jl provides the core abstract operator framework and basic linear algebra operators, DSPOperators.jl extends this framework with domain-specific functionality for signal processing. This modular design keeps the base package lightweight while allowing users to opt-in to DSP-specific features only when needed.
15+
16+
## Installation
17+
18+
```julia
19+
pkg> add DSPOperators
20+
```
21+
22+
## Usage Example
23+
24+
```julia
25+
using DSPOperators
26+
27+
# Create signals
28+
signal = randn(100)
29+
filter_kernel = randn(5)
30+
31+
# Create a convolution operator
32+
conv_op = Conv(signal, filter_kernel)
33+
34+
# Apply convolution via operator multiplication
35+
result = conv_op * signal
36+
37+
# Use in optimization or iterative algorithms
38+
# The operator integrates with AbstractOperators.jl algorithms
39+
```
40+
41+
## Main Features
42+
43+
### 1. **Conv** - FFT-based Convolution Operator
44+
Implements 1D convolution using efficient FFT algorithms. Creates a `LinearOperator` that computes the convolution between an input signal and a filter kernel.
45+
46+
- **Efficient computation**: Uses FFTW for fast convolution via the FFT algorithm
47+
- **Type flexibility**: Supports both real and complex-valued signals
48+
- **Automatic padding**: Handles dimension expansion automatically
49+
50+
```julia
51+
using DSPOperators
52+
op = Conv((10,), randn(5)) # Convolve length-10 signal with length-5 kernel
53+
```
54+
55+
### 2. **Filt** - IIR/FIR Filtering Operator
56+
Implements infinite impulse response (IIR) and finite impulse response (FIR) filters for single-input-single-output (SISO) systems.
57+
58+
- **IIR filters**: Specify both numerator (`b`) and denominator (`a`) coefficients
59+
- **FIR filters**: Specify only numerator coefficients (`b`)
60+
- **Coefficient normalization**: Automatically normalizes filter coefficients
61+
- **Stateful operation**: Maintains filter state for sequential filtering
62+
63+
```julia
64+
using DSPOperators
65+
# IIR filter
66+
filt_op = Filt(Float64, (10,), [1.0, 2.0, 1.0], [1.0, -1.0])
67+
68+
# FIR filter
69+
fir_op = Filt(Float64, (10,), [1.0, 0.5, 0.2])
70+
```
71+
72+
### 3. **MIMOFilt** - Multiple-Input-Multiple-Output Filtering
73+
Extends filtering capabilities to multi-channel systems with multiple input and output signals.
74+
75+
- **MIMO systems**: Handles coupled filtering between multiple input/output channels
76+
- **Flexible specifications**: IIR or FIR filters per channel pair
77+
- **Matrix operations**: Works directly with signal matrices where columns represent channels
78+
79+
```julia
80+
using DSPOperators
81+
m, n = 10, 3 # 10 time samples, 3 inputs
82+
# 3×2 MIMO system: 3 inputs, 2 outputs (6 filter vectors total)
83+
B = [[1.; 0.; 1.], [1.; 0.; 1.], [1.; 0.; 1.],
84+
[1.; 0.; 1.], [1.; 0.; 1.], [1.; 0.; 1.]]
85+
op = MIMOFilt((m, n), B) # FIR filters
86+
```
87+
88+
### 4. **Xcorr** - Cross-Correlation Operator
89+
Computes cross-correlation between input signals and a reference signal using DSP.jl's optimized routines.
90+
91+
- **Efficient computation**: Leverages DSP.jl's cross-correlation implementation
92+
- **Symmetric operation**: Supports both forward and adjoint operations
93+
- **Flexible mode**: Uses the longest padding mode by default
94+
95+
```julia
96+
using DSPOperators
97+
xcorr_op = Xcorr(Float64, (10,), [1.0, 0.5, 0.2])
98+
```
99+
100+
## License
101+
102+
See LICENSE.md for details.

FFTWOperators/README.md

Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
# FFTWOperators.jl
2+
3+
[![](https://img.shields.io/badge/docs-stable-blue.svg)](https://kul-optec.github.io/AbstractOperators.jl/stable/operators/#FFTW)
4+
[![](https://img.shields.io/badge/docs-latest-blue.svg)](https://kul-optec.github.io/AbstractOperators.jl/latest/operators/#FFTW)
5+
6+
Fast Fourier Transform operators for the AbstractOperators.jl framework.
7+
8+
## Overview
9+
10+
FFTWOperators.jl is a specialized extension package for [AbstractOperators.jl](../README.md) that provides linear operators for efficient Fourier and frequency-domain transforms. It wraps the high-performance FFTW library to offer Discrete Fourier Transforms (DFT), Real FFTs (RDFT), Inverse Real FFTs (IRDFT), and Discrete Cosine Transforms (DCT) as seamlessly integrated `LinearOperator` instances.
11+
12+
## Relationship to AbstractOperators.jl
13+
14+
FFTWOperators.jl is a **subpackage** of the AbstractOperators.jl ecosystem. While AbstractOperators.jl provides the core abstract operator framework, FFTWOperators.jl extends it with domain-specific functionality for Fourier analysis and frequency-domain operations. This modular design allows users to access high-performance FFT capabilities only when needed.
15+
16+
## Installation
17+
18+
```julia
19+
pkg> add FFTWOperators
20+
```
21+
22+
## Usage Example
23+
24+
```julia
25+
using FFTWOperators
26+
27+
# Create input data
28+
x = randn(64, 64)
29+
30+
# Create a DFT operator
31+
dft_op = DFT(x)
32+
33+
# Compute the Fourier transform
34+
X_fft = dft_op * x
35+
36+
# Use in optimization or iterative algorithms
37+
# The operator integrates with AbstractOperators.jl algorithms
38+
```
39+
40+
## Main Features
41+
42+
### 1. **DFT** - Discrete Fourier Transform
43+
Computes the N-dimensional Discrete Fourier Transform using FFTW's optimized algorithms.
44+
45+
- **Multi-dimensional support**: Works on arbitrary-dimensional arrays
46+
- **Selective dimensions**: Transform over specified dimensions of a multi-dimensional array
47+
- **Multiple normalizations**: UNNORMALIZED, ORTHO, FORWARD, and BACKWARD schemes
48+
- **Customizable planning**: Control FFTW planning flags and time limits
49+
- **Orthogonal properties**: Supports orthogonal DFT operations for optimization algorithms
50+
51+
```julia
52+
using FFTWOperators
53+
54+
# Complex-valued DFT
55+
dft_op = DFT(Complex{Float64}, (10, 10))
56+
57+
# Real-valued input (transforms to complex output)
58+
x = randn(64, 64)
59+
dft_op = DFT(x)
60+
X = dft_op * x # Fourier transform
61+
62+
# Transform along specific dimensions
63+
dft_op = DFT(x, 1) # Only along first dimension
64+
```
65+
66+
### 2. **RDFT** - Real FFT
67+
Specialized Fast Fourier Transform for real-valued inputs, exploiting Hermitian symmetry for efficiency.
68+
69+
- **Real input efficiency**: Optimized for real-valued signals, outputs complex values
70+
- **Dimension-selective**: Transform along specific dimensions
71+
- **Conjugate symmetry**: Automatically exploits Hermitian symmetry properties
72+
- **Reduced computation**: Approximately 50% faster than complex FFT for real inputs
73+
74+
```julia
75+
using FFTWOperators
76+
77+
# Real FFT of a real-valued array
78+
rdft_op = RDFT(Float64, (10, 10))
79+
80+
# Apply along a specific dimension
81+
x = randn(100, 10, 10)
82+
rdft_op = RDFT(x, 2) # Transform along dimension 2
83+
X = rdft_op * x
84+
```
85+
86+
### 3. **IRDFT** - Inverse Real FFT
87+
Transforms complex-valued k-space data back to real-valued spatial domain, inverse of RDFT.
88+
89+
- **Hermitian reconstruction**: Properly reconstructs real values from complex k-space
90+
- **Adjoint operation**: Acts as the adjoint of RDFT for linear algebra operations
91+
- **Energy preserving**: Maintains signal energy in the inverse transform
92+
93+
```julia
94+
using FFTWOperators
95+
96+
# Inverse real FFT - transforms complex-valued input to real-valued output
97+
# Takes the k-space dimension, the desired output spatial dimension, and optionally the transform dimension
98+
irdft_op = IRDFT((51,), 100, 1) # 51 complex input -> 100 real output along dimension 1
99+
```
100+
101+
### 4. **DCT** - Discrete Cosine Transform
102+
Computes the Discrete Cosine Transform, useful for image compression and spectral analysis.
103+
104+
- **Real-valued I/O**: Works with real-valued signals for many applications
105+
- **Complex support**: Also supports complex-valued transforms
106+
- **Standard DCT**: Implements standard DCT-II (the most common variant)
107+
- **Orthogonal transform**: Invertible with fast IDCT operation
108+
109+
```julia
110+
using FFTWOperators
111+
112+
# Real-valued DCT
113+
dct_op = DCT(Float64, (10, 10))
114+
x = randn(10, 10)
115+
y = dct_op * x # Cosine transform
116+
117+
# Complex DCT
118+
dct_complex = DCT(Complex{Float64}, (8, 8))
119+
120+
# Inverse DCT
121+
idct_op = IDCT(Float64, (10, 10))
122+
```
123+
124+
### 5. **Shift** - Frequency Shift Operator
125+
Applies frequency shifts and zero-padding to signals.
126+
127+
- **Frequency shifting**: Shift zero-frequency component to the center
128+
- **Zero-padding**: Efficiently apply padding for zero-padded transforms
129+
- **Composable**: Combines seamlessly with other operators
130+
131+
## License
132+
133+
See LICENSE.md for details.

NFFTOperators/README.md

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
# NFFTOperators.jl
2+
3+
[![](https://img.shields.io/badge/docs-stable-blue.svg)](https://kul-optec.github.io/AbstractOperators.jl/stable/operators/#NFFT)
4+
[![](https://img.shields.io/badge/docs-latest-blue.svg)](https://kul-optec.github.io/AbstractOperators.jl/latest/operators/#NFFT)
5+
6+
Non-Uniform Fast Fourier Transform operators for the AbstractOperators.jl framework.
7+
8+
## Overview
9+
10+
NFFTOperators.jl is a specialized extension package for [AbstractOperators.jl](../README.md) that provides linear operators for Non-Uniform Fast Fourier Transforms (NFFT). It wraps the high-performance NFFT.jl library to offer efficient transforms between spatial and non-uniform k-space domains, which is essential for magnetic resonance imaging (MRI), radar, and other applications with non-uniform sampling patterns.
11+
12+
## Relationship to AbstractOperators.jl
13+
14+
NFFTOperators.jl is a **subpackage** of the AbstractOperators.jl ecosystem. While AbstractOperators.jl provides the core abstract operator framework, NFFTOperators.jl extends it with specialized functionality for non-uniform Fourier transforms. This modular design allows users to access advanced NFFT capabilities optimized for applications like MRI reconstruction only when needed.
15+
16+
## Installation
17+
18+
```julia
19+
pkg> add NFFTOperators
20+
```
21+
22+
## Usage Example
23+
24+
```julia
25+
using NFFTOperators, NFFT
26+
27+
# Define MRI parameters
28+
image_size = (256, 256)
29+
30+
# Create k-space trajectory (normalized to [-0.5, 0.5))
31+
trajectory = rand(2, 100, 50) .- 0.5 # 2D, 100 points per readout, 50 readouts
32+
33+
# Create NFFT operator
34+
nfft_op = NFFTOp(image_size, trajectory)
35+
36+
# Transform image to k-space
37+
x = randn(image_size...)
38+
k_space = nfft_op * x
39+
40+
# Adjoint operation: k-space to image
41+
x_recon = nfft_op' * k_space
42+
```
43+
44+
## Main Features
45+
46+
### 1. **NFFTOp** - Non-Uniform Fast Fourier Transform Operator
47+
Transforms data between uniform spatial domain and non-uniform k-space domain.
48+
49+
- **Flexible sampling patterns**: Supports arbitrary non-uniform sampling trajectories
50+
- **Density compensation**: Built-in support for density compensation functions (DCF)
51+
- **Efficient computation**: Uses the NFFT algorithm for fast transforms
52+
- **Multi-dimensional support**: Works with 1D, 2D, and 3D data
53+
- **Threaded operations**: Optional multi-threaded computation for large datasets
54+
55+
```julia
56+
using NFFTOperators, NFFT
57+
58+
# Create a 2D radial k-space trajectory (normalized to [-0.5, 0.5))
59+
image_size = (128, 128)
60+
n_angles = 50
61+
n_points = 100
62+
trajectory = zeros(2, n_points, n_angles)
63+
for i in 1:n_angles
64+
angle = (i-1) * π / n_angles
65+
trajectory[1, :, i] = cos(angle) .* range(-0.5, 0.5, length=n_points)
66+
trajectory[2, :, i] = sin(angle) .* range(-0.5, 0.5, length=n_points)
67+
end
68+
69+
# Create operator with automatic DCF estimation
70+
nfft_op = NFFTOp(image_size, trajectory)
71+
72+
# Single-threaded for use in parallel regions
73+
nfft_op_st = NFFTOp(image_size, trajectory, threaded=false)
74+
```
75+
76+
### 2. **NormalNFFTOp** - Normal Equations Operator
77+
Provides efficient implementation of the normal equations (A'A) for NFFT operators.
78+
79+
- **Optimized computation**: Faster than applying NFFT' * NFFT sequentially
80+
- **Regularization support**: Easily add regularization terms
81+
- **Iterative algorithms**: Natural fit for iterative reconstruction algorithms
82+
- **Memory efficient**: Reduces memory footprint for large problems
83+
84+
```julia
85+
using NFFTOperators, NFFT
86+
87+
# Standard NFFT
88+
image_size = (128, 128)
89+
trajectory = rand(2, 100, 50) .- 0.5 # Normalized trajectory: 2D, 100 points, 50 readouts
90+
nfft_op = NFFTOp(image_size, trajectory)
91+
92+
# Normal operator (implicit A'A)
93+
normal_op = nfft_op' * nfft_op
94+
```
95+
96+
## License
97+
98+
See LICENSE.md for details.

0 commit comments

Comments
 (0)