Filters API
Pictologics provides IBSI 2-compliant convolutional filters for image response map generation.
Overview
All filters can be used via the RadiomicsPipeline filter step or called directly:
# Pipeline usage
{"step": "filter", "params": {"type": "log", "sigma_mm": 1.5}}
# Direct usage
from pictologics.filters import laplacian_of_gaussian, BoundaryCondition
response = laplacian_of_gaussian(image.array, sigma_mm=1.5, spacing_mm=image.spacing)
Available Filters
| Filter | Function | Use Case |
|---|---|---|
| Mean | mean_filter |
Local averaging |
| LoG | laplacian_of_gaussian |
Edge/blob detection |
| Laws | laws_filter |
Texture energy |
| Gabor | gabor_filter |
Directional patterns |
| Wavelet | wavelet_transform |
Multi-resolution analysis |
| Simoncelli | simoncelli_wavelet |
Non-separable wavelet |
| Riesz | riesz_transform, riesz_log, riesz_simoncelli |
Rotation-equivariant transforms |
Capability Metadata
Versioned, machine-readable descriptions of what each filter supports — input and kernel dimensionality, plane-wise execution, orthogonal-plane averaging, rotation pooling, supported and effective boundary handling, Riesz orders, structure-tensor steering, and anisotropic-spacing behaviour. Intended for compliance tooling, so support can be determined without inspecting signatures or private source.
Note the distinction between supported_boundaries (what the function accepts) and
effective_boundary (what physically happens at the border): the FFT-based filters
report as_specified_via_padding, because a requested non-periodic boundary is
realised by a defined pad-filter-crop procedure and the transform itself remains
periodic on the padded domain.
pictologics.filters.CAPABILITIES_SCHEMA_VERSION = '1.0.0'
module-attribute
Semantic version of the :data:FILTER_CAPABILITIES schema.
Bump the major component on breaking changes (field removal/retyping), the minor component when adding fields or filter entries, and the patch component for corrections that don't change the schema shape.
pictologics.filters.FilterCapability
dataclass
Declarative capability record for one IBSI 2 filter (or Riesz variant).
Every field is grounded in the corresponding filter implementation; see
:data:FILTER_CAPABILITIES for the per-filter values and the source
evidence behind each one.
Attributes:
| Name | Type | Description |
|---|---|---|
input_dimensionality |
tuple[int, ...]
|
Dimensionality/dimensionalities of the top-level
image array the filter function accepts, e.g. |
kernel_dimensionality |
int
|
Dimensionality of the convolution/transform
kernel itself (2 or 3). May differ from |
slice_plane_execution |
bool
|
True if the filter applies its kernel plane-wise (slice-by-slice) rather than as a single volumetric operation. |
orthogonal_plane_averaging |
bool
|
True if the filter supports averaging its plane-wise response over the 3 orthogonal anatomical planes. |
rotation_pooling |
tuple[str, ...]
|
Pooling method names accepted for pseudo-rotational
invariance (e.g. |
supported_boundaries |
tuple[str, ...]
|
|
effective_boundary |
str
|
What actually happens at the image border. One of
|
supported_riesz_orders |
Optional[str]
|
Description of the Riesz derivative orders
accepted (Riesz-family filters only), or |
structure_tensor_steering |
bool
|
True if the filter can steer its kernel
using a structure tensor. Currently |
anisotropic_spacing |
str
|
How the filter handles anisotropic
|
Source code in pictologics/filters/capabilities.py
pictologics.filters.FILTER_CAPABILITIES = {'mean': FilterCapability(input_dimensionality=(3,), kernel_dimensionality=3, slice_plane_execution=False, orthogonal_plane_averaging=False, rotation_pooling=(), supported_boundaries=_ALL_BOUNDARIES, effective_boundary='as_specified', supported_riesz_orders=None, structure_tensor_steering=False, anisotropic_spacing='not_applicable'), 'log': FilterCapability(input_dimensionality=(3,), kernel_dimensionality=3, slice_plane_execution=False, orthogonal_plane_averaging=False, rotation_pooling=(), supported_boundaries=_ALL_BOUNDARIES, effective_boundary='as_specified', supported_riesz_orders=None, structure_tensor_steering=False, anisotropic_spacing='supported'), 'laws': FilterCapability(input_dimensionality=(3,), kernel_dimensionality=3, slice_plane_execution=False, orthogonal_plane_averaging=False, rotation_pooling=('max', 'average', 'min'), supported_boundaries=_ALL_BOUNDARIES, effective_boundary='as_specified', supported_riesz_orders=None, structure_tensor_steering=False, anisotropic_spacing='not_applicable'), 'gabor': FilterCapability(input_dimensionality=(3,), kernel_dimensionality=2, slice_plane_execution=True, orthogonal_plane_averaging=True, rotation_pooling=('max', 'average', 'min'), supported_boundaries=_ALL_BOUNDARIES, effective_boundary='as_specified', supported_riesz_orders=None, structure_tensor_steering=False, anisotropic_spacing='supported'), 'wavelet': FilterCapability(input_dimensionality=(3,), kernel_dimensionality=3, slice_plane_execution=False, orthogonal_plane_averaging=False, rotation_pooling=('max', 'average', 'min'), supported_boundaries=_ALL_BOUNDARIES, effective_boundary='as_specified', supported_riesz_orders=None, structure_tensor_steering=False, anisotropic_spacing='not_applicable'), 'simoncelli': FilterCapability(input_dimensionality=(3,), kernel_dimensionality=3, slice_plane_execution=False, orthogonal_plane_averaging=False, rotation_pooling=(), supported_boundaries=_ALL_BOUNDARIES, effective_boundary='as_specified_via_padding', supported_riesz_orders=None, structure_tensor_steering=False, anisotropic_spacing='not_applicable'), 'riesz': FilterCapability(input_dimensionality=(3,), kernel_dimensionality=3, slice_plane_execution=False, orthogonal_plane_averaging=False, rotation_pooling=(), supported_boundaries=_ALL_BOUNDARIES, effective_boundary='as_specified_via_padding', supported_riesz_orders='Tuple[int, ...] (l1, ..., ld): any non-negative ints summing to L >= 1; see get_riesz_orders(max_order, ndim) to enumerate all combinations.', structure_tensor_steering=False, anisotropic_spacing='not_applicable'), 'riesz_log': FilterCapability(input_dimensionality=(3,), kernel_dimensionality=3, slice_plane_execution=False, orthogonal_plane_averaging=False, rotation_pooling=(), supported_boundaries=_ALL_BOUNDARIES, effective_boundary='as_specified_via_padding', supported_riesz_orders='Tuple[int, ...] (l1, ..., ld): any non-negative ints summing to L >= 1; see get_riesz_orders(max_order, ndim) to enumerate all combinations.', structure_tensor_steering=False, anisotropic_spacing='supported'), 'riesz_simoncelli': FilterCapability(input_dimensionality=(3,), kernel_dimensionality=3, slice_plane_execution=False, orthogonal_plane_averaging=False, rotation_pooling=(), supported_boundaries=_ALL_BOUNDARIES, effective_boundary='as_specified_via_padding', supported_riesz_orders='Tuple[int, ...] (l1, ..., ld): any non-negative ints summing to L >= 1; see get_riesz_orders(max_order, ndim) to enumerate all combinations.', structure_tensor_steering=False, anisotropic_spacing='not_applicable')}
module-attribute
Capability record for every public filter, keyed by pipeline filter-type name.
See the module docstring for the "riesz" / "riesz_log" /
"riesz_simoncelli" keying scheme.
pictologics.filters.get_filter_capabilities(name)
Look up the capability record for a filter by its pipeline filter-type name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Pipeline filter-type name, e.g. |
required |
Returns:
| Type | Description |
|---|---|
FilterCapability
|
The |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Example
Source code in pictologics/filters/capabilities.py
Boundary Conditions
pictologics.filters.BoundaryCondition
Bases: Enum
IBSI 2 boundary conditions for image padding (GBYQ).
Maps to scipy.ndimage mode parameter values.
Example
Source code in pictologics/filters/base.py
pictologics.filters.FilterResult
dataclass
Container for filter response maps and metadata.
Example
Source code in pictologics/filters/base.py
dtype
property
Data type of the response map.
shape
property
Shape of the response map.
pictologics.filters.LAWS_KERNELS = _LAWS_KERNELS
module-attribute
Dictionary of normalized Laws kernels (IBSI 2 Table 6).
Filter Functions
pictologics.filters.mean_filter(image, support=15, boundary=BoundaryCondition.ZERO, source_mask=None)
Apply 3D mean filter (IBSI code: S60F).
The mean filter computes the average intensity over an M×M×M spatial support. Per IBSI 2 Eq. 2.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
image
|
NDArray[floating[Any]]
|
3D input image array |
required |
support
|
int
|
Filter support M in voxels (must be odd, YNOF) |
15
|
boundary
|
Union[BoundaryCondition, str]
|
Boundary condition for padding (GBYQ) |
ZERO
|
source_mask
|
Optional[NDArray[bool_]]
|
Optional boolean mask where True = valid voxel. When provided, uses normalized convolution to exclude invalid (sentinel) voxels from mean computation. |
None
|
Returns:
| Type | Description |
|---|---|
Union[NDArray[floating[Any]], tuple[NDArray[floating[Any]], NDArray[bool_]]]
|
If source_mask is None: Response map with same dimensions as input |
Union[NDArray[floating[Any]], tuple[NDArray[floating[Any]], NDArray[bool_]]]
|
If source_mask provided: Tuple of (response_map, output_valid_mask) |
Raises:
| Type | Description |
|---|---|
ValueError
|
If support is not an odd positive integer |
Example
Apply Mean filter with 15-voxel support:
import numpy as np
from pictologics.filters import mean_filter
# Create dummy 3D image
image = np.random.rand(50, 50, 50)
# Apply filter (original API)
response = mean_filter(image, support=15, boundary="zero")
# With source_mask for sentinel exclusion
mask = image > -1000 # Valid voxels
response, valid_mask = mean_filter(image, support=15, source_mask=mask)
Note
Support M is defined in voxel units as per IBSI specification.
Source code in pictologics/filters/mean.py
pictologics.filters.laplacian_of_gaussian(image, sigma_mm, spacing_mm=1.0, truncate=4.0, boundary=BoundaryCondition.ZERO, source_mask=None)
laplacian_of_gaussian(
image: npt.NDArray[np.floating[Any]],
sigma_mm: float,
spacing_mm: Union[
float, Tuple[float, float, float]
] = ...,
truncate: float = ...,
boundary: Union[BoundaryCondition, str] = ...,
source_mask: None = ...,
) -> npt.NDArray[np.floating[Any]]
laplacian_of_gaussian(
image: npt.NDArray[np.floating[Any]],
sigma_mm: float,
spacing_mm: Union[
float, Tuple[float, float, float]
] = ...,
truncate: float = ...,
boundary: Union[BoundaryCondition, str] = ...,
source_mask: npt.NDArray[np.bool_] = ...,
) -> tuple[
npt.NDArray[np.floating[Any]], npt.NDArray[np.bool_]
]
Apply 3D Laplacian of Gaussian filter (IBSI code: L6PA).
The LoG is a band-pass, spherically symmetric operator. Per IBSI 2 Eq. 3.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
image
|
NDArray[floating[Any]]
|
3D input image array |
required |
sigma_mm
|
float
|
Standard deviation in mm (σ*, 41LN) |
required |
spacing_mm
|
Union[float, Tuple[float, float, float]]
|
Voxel spacing in mm (scalar for isotropic, or tuple) |
1.0
|
truncate
|
float
|
Filter size cutoff in σ units (default 4.0, WGPM) |
4.0
|
boundary
|
Union[BoundaryCondition, str]
|
Boundary condition for padding (GBYQ) |
ZERO
|
source_mask
|
Optional[NDArray[bool_]]
|
Optional boolean mask where True = valid voxel. When provided, uses normalized convolution to exclude invalid (sentinel) voxels from computation. |
None
|
Returns:
| Type | Description |
|---|---|
Union[NDArray[floating[Any]], tuple[NDArray[floating[Any]], NDArray[bool_]]]
|
If source_mask is None: Response map with same dimensions as input |
Union[NDArray[floating[Any]], tuple[NDArray[floating[Any]], NDArray[bool_]]]
|
If source_mask provided: Tuple of (response_map, output_valid_mask) |
Example
Apply LoG filter with 5.0mm sigma on an image with 2.0mm spacing:
import numpy as np
from pictologics.filters import laplacian_of_gaussian
# Create dummy 3D image
image = np.random.rand(50, 50, 50)
# Apply filter (original API)
response = laplacian_of_gaussian(
image,
sigma_mm=5.0,
spacing_mm=(2.0, 2.0, 2.0),
truncate=4.0
)
# With source_mask for sentinel exclusion
mask = image > -1000
response, valid_mask = laplacian_of_gaussian(
image, sigma_mm=5.0, spacing_mm=2.0, source_mask=mask
)
Note
- σ is converted from mm to voxels: σ_voxels = σ_mm / spacing_mm
- Filter size: M = 1 + 2⌊d×σ + 0.5⌋ where d=truncate
- The kernel should sum to approximately 0 (zero-mean)
Source code in pictologics/filters/log.py
pictologics.filters.laws_filter(image, kernels, boundary=BoundaryCondition.ZERO, rotation_invariant=False, pooling='max', compute_energy=False, energy_distance=7, use_parallel=None, source_mask=None)
laws_filter(
image: npt.NDArray[np.floating[Any]],
kernels: str,
boundary: Union[BoundaryCondition, str] = ...,
rotation_invariant: bool = ...,
pooling: str = ...,
compute_energy: bool = ...,
energy_distance: int = ...,
use_parallel: Union[bool, None] = ...,
source_mask: None = ...,
) -> npt.NDArray[np.floating[Any]]
laws_filter(
image: npt.NDArray[np.floating[Any]],
kernels: str,
boundary: Union[BoundaryCondition, str] = ...,
rotation_invariant: bool = ...,
pooling: str = ...,
compute_energy: bool = ...,
energy_distance: int = ...,
use_parallel: Union[bool, None] = ...,
source_mask: npt.NDArray[np.bool_] = ...,
) -> Tuple[
npt.NDArray[np.floating[Any]], npt.NDArray[np.bool_]
]
Apply 3D Laws kernel filter (IBSI code: JTXT).
Laws kernels detect texture patterns via separable 1D filters combined into 2D/3D filters via outer products.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
image
|
NDArray[floating[Any]]
|
3D input image array |
required |
kernels
|
str
|
Kernel specification as string, e.g., "E5L5S5" for 3D |
required |
boundary
|
Union[BoundaryCondition, str]
|
Boundary condition for padding (GBYQ) |
ZERO
|
rotation_invariant
|
bool
|
If True, apply pseudo-rotational invariance (O1AQ) using max pooling over 24 right-angle rotations |
False
|
pooling
|
str
|
Pooling method for rotation invariance ("max", "average", "min") |
'max'
|
compute_energy
|
bool
|
If True, compute texture energy image (PQSD) |
False
|
energy_distance
|
int
|
Chebyshev distance δ for energy computation (I176) |
7
|
use_parallel
|
Union[bool, None]
|
If True, use parallel processing for rotation_invariant mode. If None (default), auto-enables for images > ~128³ voxels. Only affects rotation_invariant mode. |
None
|
source_mask
|
Optional[NDArray[bool_]]
|
Optional boolean mask where True = valid voxel. In non-rotation-invariant mode, uses normalized separable convolution to exclude invalid (sentinel) voxels. In rotation-invariant mode, invalid voxels are zero-filled as a first-order approximation (the rotated kernels preclude normalized convolution). |
None
|
Returns:
| Type | Description |
|---|---|
Union[NDArray[floating[Any]], Tuple[NDArray[floating[Any]], NDArray[bool_]]]
|
If source_mask is None: Response map (or energy image if compute_energy=True) |
Union[NDArray[floating[Any]], Tuple[NDArray[floating[Any]], NDArray[bool_]]]
|
If source_mask provided: Tuple of (response_map, output_valid_mask) |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
RuntimeError
|
Defensive check raised if no response was computed; not expected to occur in normal use. |
Example
Apply Laws E5L5S5 kernel with rotation invariance and texture energy:
Note
- Kernels are normalized (deviate from Laws' original unnormalized)
- Energy is computed as: mean(|h|) over δ neighborhood
- For rotation invariance, energy is computed after pooling
- Uses separable 1D convolutions for ~8x speedup over full 3D
Source code in pictologics/filters/laws.py
141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 | |
pictologics.filters.gabor_filter(image, sigma_mm, lambda_mm, gamma=1.0, theta=0.0, spacing_mm=1.0, boundary=BoundaryCondition.ZERO, rotation_invariant=False, delta_theta=None, pooling='average', average_over_planes=False, use_parallel=None, source_mask=None)
Apply 2D Gabor filter to 3D image (IBSI code: Q88H).
The Gabor filter is applied in the axial plane (k1, k2) and optionally averaged over orthogonal planes. Per IBSI 2 Eq. 9.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
image
|
NDArray[floating[Any]]
|
3D input image array |
required |
sigma_mm
|
float
|
Standard deviation of Gaussian envelope in mm (41LN) |
required |
lambda_mm
|
float
|
Wavelength in mm (S4N6) |
required |
gamma
|
float
|
Spatial aspect ratio (GDR5), typically 0.5 to 2.0 |
1.0
|
theta
|
float
|
Orientation angle in radians (FQER), clockwise in (k1,k2) |
0.0
|
spacing_mm
|
Union[float, Tuple[float, float, float]]
|
Voxel spacing in mm (scalar or per-axis tuple). Each
plane's kernel is built from that plane's own two in-plane
axis spacings, so anisotropic spacing (including anisotropic
z, relevant when |
1.0
|
boundary
|
Union[BoundaryCondition, str]
|
Boundary condition for padding (GBYQ) |
ZERO
|
rotation_invariant
|
bool
|
If True, average over orientations |
False
|
delta_theta
|
Optional[float]
|
Orientation step for rotation invariance (XTGK) |
None
|
pooling
|
str
|
Pooling method ("average", "max", "min") |
'average'
|
average_over_planes
|
bool
|
If True, average 2D responses over 3 orthogonal planes |
False
|
use_parallel
|
Union[bool, None]
|
If True, process slices in parallel. If None (default), auto-enables for images > ~46³ voxels. |
None
|
source_mask
|
Optional[NDArray[bool_]]
|
Optional boolean mask where True = valid voxel. When provided, zeros out invalid (sentinel) voxels before FFT-based convolution to prevent contamination. |
None
|
Returns:
| Type | Description |
|---|---|
NDArray[floating[Any]]
|
Response map (modulus of complex response) |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
RuntimeError
|
Defensive check raised if plane averaging fails to produce a result; not expected to occur in normal use. |
Example
Apply Gabor filter with rotation invariance over orthogonal planes:
import numpy as np
from pictologics.filters import gabor_filter
# Create dummy 3D image
image = np.random.rand(50, 50, 50)
# Apply filter
response = gabor_filter(
image,
sigma_mm=10.0,
lambda_mm=4.0,
gamma=0.5,
rotation_invariant=True,
delta_theta=0.7853981633974483, # pi/4
average_over_planes=True
)
Note
- Returns modulus |h| = |g ⊗ f| for feature extraction
- 2D filter applied slice-by-slice, then optionally over planes
- Uses single complex FFT convolution for ~2x speedup
- Each plane's kernel uses that plane's own two in-plane spacings. When they are equal (the isotropic-in-plane case, including the default axial-only plane under typical (x, y, z) spacing with x == y), the kernel is built on a voxel-unit grid. When they differ, the kernel is built on a physical-coordinate (mm) grid with a per-axis radius, giving a rectangular kernel that is physically correct rather than warning and guessing.
Source code in pictologics/filters/gabor.py
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 | |
pictologics.filters.wavelet_transform(image, wavelet='db2', level=1, decomposition='LHL', boundary=BoundaryCondition.ZERO, rotation_invariant=False, pooling='average', use_parallel=None, source_mask=None)
Apply 3D separable wavelet transform (undecimated/stationary).
Uses the à trous algorithm for undecimated wavelet decomposition. The transform is translation-invariant (unlike decimated transform).
Supported wavelets
- "haar" (UOUE): Haar wavelet
- "db2", "db3": Daubechies wavelets
- "coif1": Coiflet wavelet
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
image
|
NDArray[floating[Any]]
|
3D input image array |
required |
wavelet
|
str
|
Wavelet name (e.g., "db2", "coif1", "haar") |
'db2'
|
level
|
int
|
Decomposition level (GCEK) |
1
|
decomposition
|
str
|
Which response map to return, e.g., "LHL", "HHH" |
'LHL'
|
boundary
|
Union[BoundaryCondition, str]
|
Boundary condition for padding |
ZERO
|
rotation_invariant
|
bool
|
If True, average over 24 rotations |
False
|
pooling
|
str
|
Pooling method for rotation invariance |
'average'
|
use_parallel
|
Union[bool, None]
|
If True, use parallel processing for rotation_invariant mode. If None (default), auto-enables for images > ~128³ voxels. |
None
|
source_mask
|
Optional[NDArray[bool_]]
|
Optional boolean mask where True = valid voxel. When provided, zeros out invalid (sentinel) voxels before wavelet decomposition to prevent contamination. |
None
|
Returns:
| Type | Description |
|---|---|
NDArray[floating[Any]]
|
Response map for the specified decomposition |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Example
Apply Daubechies 2 wavelet transform at level 1, returning LHL coefficients:
Source code in pictologics/filters/wavelets.py
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 | |
pictologics.filters.simoncelli_wavelet(image, level=1, boundary=BoundaryCondition.PERIODIC, source_mask=None)
Apply Simoncelli non-separable wavelet (IBSI code: PRT7).
The Simoncelli wavelet is isotropic (spherically symmetric) and implemented in the Fourier domain. Per IBSI 2 Eq. 27.
For decomposition level N, the frequency band is scaled by j = N-1: - Level 1 (j=0): band [π/4, π] (highest frequencies) - Level 2 (j=1): band [π/8, π/2] - Level 3 (j=2): band [π/16, π/4]
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
image
|
NDArray[floating[Any]]
|
3D input image array |
required |
level
|
int
|
Decomposition level (1 = highest frequency band) |
1
|
boundary
|
Union[BoundaryCondition, str]
|
Boundary condition. The filter is inherently periodic (FFT-based),
so |
PERIODIC
|
source_mask
|
Optional[NDArray[bool_]]
|
Optional boolean mask where True = valid voxel |
None
|
Returns:
| Type | Description |
|---|---|
NDArray[floating[Any]]
|
Band-pass response map (B map) for the specified level |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Example
Apply first-level Simoncelli wavelet (highest frequency band):
Source code in pictologics/filters/wavelets.py
pictologics.filters.riesz_transform(image, order, boundary=BoundaryCondition.PERIODIC, source_mask=None)
Apply Riesz transform (IBSI code: AYRS).
The Riesz transform computes higher-order all-pass image derivatives in the Fourier domain. Per IBSI 2 Eq. 34.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
image
|
NDArray[floating[Any]]
|
3D input image array |
required |
order
|
Tuple[int, ...]
|
Tuple (l1, l2, l3) specifying derivative order per axis e.g., (1,0,0) = first-order along k1 (gradient-like) (2,0,0), (1,1,0), (0,2,0) = second-order (Hessian-like) |
required |
boundary
|
Union[BoundaryCondition, str]
|
Boundary condition. The filter is inherently periodic (FFT-based),
so |
PERIODIC
|
source_mask
|
Optional[NDArray[bool_]]
|
Optional boolean mask where True = valid voxel. When provided, zeros out invalid (sentinel) voxels before FFT-based transform to prevent contamination. |
None
|
Returns:
| Type | Description |
|---|---|
NDArray[floating[Any]]
|
Riesz-transformed image (real part) |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Example
Compute first-order Riesz transform along the k1 axis:
Note
- First-order Riesz components form the image gradient
- Second-order Riesz components form the image Hessian
- All-pass: doesn't amplify high frequencies like regular derivatives
Source code in pictologics/filters/riesz.py
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 | |
pictologics.filters.riesz_log(image, sigma_mm, spacing_mm=1.0, order=(1, 0, 0), truncate=4.0, boundary=BoundaryCondition.PERIODIC, source_mask=None)
Apply Riesz transform to LoG-filtered image.
Combines multi-scale analysis (LoG) with directional analysis (Riesz). First applies LoG filtering, then applies Riesz transform.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
image
|
NDArray[floating[Any]]
|
3D input image array |
required |
sigma_mm
|
float
|
LoG scale in mm |
required |
spacing_mm
|
Union[float, Tuple[float, float, float]]
|
Voxel spacing in mm |
1.0
|
order
|
Tuple[int, ...]
|
Riesz order tuple (l1, l2, l3) |
(1, 0, 0)
|
truncate
|
float
|
LoG truncation parameter |
4.0
|
boundary
|
Union[BoundaryCondition, str]
|
Boundary condition for the whole LoG-then-Riesz chain. The
default |
PERIODIC
|
source_mask
|
Optional[NDArray[bool_]]
|
Optional boolean mask where True = valid voxel. Because
|
None
|
Returns:
| Type | Description |
|---|---|
NDArray[floating[Any]]
|
Riesz-transformed LoG response |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Example
Compute first-order Riesz transform of LoG-filtered image at 5mm scale:
Source code in pictologics/filters/riesz.py
189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 | |
pictologics.filters.riesz_simoncelli(image, level=1, order=(1, 0, 0), boundary=BoundaryCondition.PERIODIC, source_mask=None)
Apply Riesz transform to Simoncelli wavelet-filtered image.
Combines isotropic multi-scale analysis (Simoncelli) with directional analysis (Riesz) for rotation-invariant directional features.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
image
|
NDArray[floating[Any]]
|
3D input image array |
required |
level
|
int
|
Simoncelli decomposition level |
1
|
order
|
Tuple[int, ...]
|
Riesz order tuple (l1, l2, l3) |
(1, 0, 0)
|
boundary
|
Union[BoundaryCondition, str]
|
Boundary condition for the whole Simoncelli-then-Riesz chain.
The default |
PERIODIC
|
source_mask
|
Optional[NDArray[bool_]]
|
Optional boolean mask where True = valid voxel. Because
|
None
|
Returns:
| Type | Description |
|---|---|
NDArray[floating[Any]]
|
Riesz-transformed Simoncelli response |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Example
Compute second-order Riesz transform (Hessian-like) of Simoncelli level 2:
Source code in pictologics/filters/riesz.py
305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 | |