Source-linked AI summary
A Voxel-Spacing-Aware Extension of PyRadiomics for Anisotropic Texture Analysis
David Corral Fontecha, Juan Miranda Bautista, Pablo Menendez Fernández-Miranda, Andrea Trapote Fernandez, Lara Lloret Iglesias, Jose A. Vega
TL;DR
Anisotropic imaging means identical voxel offsets can represent different physical distances, while isotropic resampling modifies image intensities through interpolation. This paper extends PyRadiomics with feature-family-specific spacing-aware operations that avoid generating interpolated gray levels. Synthetic validation found exact agreement with standard PyRadiomics when the mode was disabled and under isotropic spacing, with selective changes under anisotropy.
Problem
In anisotropic CT and MRI, identical index-space offsets can represent different physical distances, complicating texture analysis based on index-space relationships.
Source: §1 · p. 2Method
The extension incorporates voxel geometry into selected texture operations through native-lattice weighting and finite-volume zero-order-hold representation, without interpolating gray levels.
Source: §2.3 · p. 5, §5 · p. 15Results
Synthetic validation showed exact agreement with standard PyRadiomics when spacing-aware mode was disabled and under isotropic spacing, with selective feature-family activation under anisotropy.
Source: §4 · p. 14, §5 · p. 15Takeaways & Limitations
The framework provides a practical, backward-compatible basis for future investigations of spacing-aware radiomics.
Source: §4 · p. 15The tests do not provide an independent IBSI benchmark or dedicated anisotropic reference-value fixtures for every spacing-aware feature family.
Source: §2.7 · p. 10, §4 · p. 14
Abstract
from arXiv · showhide
Radiomic texture features are commonly extracted from anisotropic CT and MRI acquisitions, where identical voxel offsets may represent different physical distances. We implemented and validated a voxel-spacing-aware extension of PyRadiomics that incorporates spacing information without generating interpolated gray levels. The framework operates across the Python frontend, C wrapper, and computational backend. GLCM uses anisotropy-relative feature-level angular aggregation, NGTDM uses anisotropy-relative weighted neighborhood averaging, and GLRLM, GLDM, and GLSZM are computed on a finite-volume zero-order-hold representation derived from the native anisotropic grid. Synthetic 3D phantoms were used for software validation. The modified implementation reproduced standard PyRadiomics exactly when spacing-aware mode was disabled and remained equivalent under isotropic spacing across 75 texture features. Under anisotropic spacing, the method selectively modified texture families and was numerically distinct from nearest-neighbor, linear, and B-spline resampling. Computational profiling showed moderate runtime and memory increases, while sensitivity analyses quantified finite-volume rounding effects and confirmed that spacing-aware differences persisted across binWidth settings. The framework provides a backward-compatible technical basis for future evaluation of spacing-aware radiomics in heterogeneous medical imaging datasets.
1. Introduction
Anisotropic acquisitions make equal voxel-index offsets correspond to different physical distances, while common isotropic resampling changes image intensities through interpolation. This work presents a spacing-aware PyRadiomics extension and addresses the scarcity of detailed implementations within established frameworks.
1. Introduction
- In anisotropic CT and MRI, identical index-space offsets can represent markedly different physical distances, yet texture matrices commonly treat them equivalently.In-plane and through-plane spacing may differ substantially.Source: §1 · p. 2
- Isotropic resampling improves geometric consistency but couples that correction to intensity changes from interpolation.This makes it difficult to separate spatial harmonization effects from interpolation effects; acquisition and scanner factors can also influence feature values and reproducibility.Source: §1 · p. 2
- Directly incorporating physical geometry avoids intensity-interpolating resampling, but not every texture family admits a physically meaningful spacing correction.Source: §1 · pp. 2–3
- Detailed reports of complete voxel-spacing-aware implementations within established radiomics frameworks remain scarce.Source: §1 · p. 3
- The authors implement a spacing-aware PyRadiomics extension across its Python frontend, C wrapper and computational backend, with clinical evaluation reported separately [10].The framework preserves discretized gray levels supplied to texture computation.Source: §1 · p. 3
2. Methods
The methods define spacing-aware operations using voxel geometry relative to index-space geometry, then align spacing values with NumPy array axes. The implementation assumes relevant orthogonal acquisition geometry and does not incorporate image direction.
2.1. Geometric implications of voxel anisotropy
- The relative anisotropy factor compares physical distance with index-space distance, so weights reflect anisotropy rather than absolute directional length.For valid offsets, GLCM directional weights are normalized over valid directions, with 10^-5 used only as a numerical safeguard.Source: §2.1 · pp. 3–4
- Under isotropic spacing, the factor is constant across directions and the spacing-aware branch reproduces standard PyRadiomics behavior.Source: §2.1 · p. 4
2.2. Array, spacing and orientation conventions
- Spacing is reversed from SimpleITK’s (x, y, z) order to align with PyRadiomics’ NumPy (z, y, x) array axes.The implementation does not incorporate the image direction matrix and assumes the array-axis representation and spacing components provide the relevant orthogonal geometry.Source: §2.2 · p. 4
- Explicit orientation-aware physical coordinates are outside the implementation’s scope.This boundary matters when applying the method to data requiring such coordinates.Source: §2.2 · p. 4
2.3. Finite-volume representation for selected texture matrices
GLRLM, GLDM and GLSZM use a finite-volume zero-order-hold representation of the native image grid, while GLCM and NGTDM remain on the native array. Replication preserves discretized gray levels but changes the lattice used to evaluate spatial relationships.
2.3. Finite-volume representation for selected texture matrices
- GLRLM, GLDM and GLSZM are computed on a finite-volume lattice formed by repeating native voxels into isotropic subcells.Repeat factors are defined per axis relative to the finest voxel spacing.Source: §2.3 · pp. 5–6
- Exact zero-order-hold replication preserves each parent voxel’s discretized gray level without interpolation, while changing the computational lattice.The image and binary ROI mask are expanded using identical repeat factors; mask subcells inherit their parent voxel’s label.Source: §2.3 · pp. 5–6
- On the expanded lattice, run length, dependence size and zone size remain integer-valued axes expressed in isotropic physical subcells.Source: §2.3 · p. 5
- The implementation reports expansion details and warns when relative spacing error exceeds 10% or total expansion factor R exceeds 8.The safeguard does not impose a separate limit on total expanded voxel count.Source: §2.3 · p. 6
- GLCM and NGTDM stay on the native array, excluding invalid neighbors and renormalizing over valid directions or neighbors.For isotropic spacing, finite-volume expansion is not applied and the standard PyRadiomics path is preserved.Source: §2.3 · p. 6
2.4. Software implementation
The spacing-aware extension passes voxel geometry through PyRadiomics’ software layers and selectively incorporates it into texture calculations while preserving standard behavior when disabled. Its feature-family-specific strategies retain descriptor structures while adapting selected operations to anisotropy.
2.4. Software implementation
- The extension spans Python feature classes, C wrapper functions, and computational matrix backends, with spacing-aware behavior enabled through an optional mode that leaves standard execution paths unchanged when disabled.Spacing-aware outputs are explicitly defined extensions, not conventional IBSI reference values.Source: §2.4 · pp. 6–7
2.5. Feature-family-specific modifications
- Spacing-aware modifications are applied selectively where voxel geometry can be incorporated without replacing the underlying descriptor semantics.GLCM supports angular aggregation, whereas run-, dependence-, and zone-based descriptors rely on discrete size measures.Source: §2.5 · p. 7
2.5.1 Gray-Level Co-occurrence Matrix (GLCM)
- GLCM features are computed separately from each directional matrix, then combined using normalized anisotropy-relative weights rather than weighting matrices before feature computation.This preserves directional co-occurrence statistics and avoids changing the underlying GLCM definition.Source: §2.5.1 · pp. 7–8
2.5.2 Gray-Level Run-Length Matrix (GLRLM)
- GLRLM uses the standard backend on a finite-volume representation, so integer run lengths count isotropic subcells rather than native anisotropic voxels.The original run-length formulation is preserved.Source: §2.5.2 · p. 8
2.5.3 Neighborhood Gray-Tone Difference Matrix (NGTDM)
- NGTDM replaces the standard unweighted neighborhood mean with normalized, anisotropy-relative weights, reducing the contribution of neighbors farther away physically.The original neighborhood definition is preserved.Source: §2.5.3 · p. 8
2.5.4 Gray-Level Dependence Matrix (GLDM)
- GLDM retains integer dependence counts while using the finite-volume lattice to incorporate anisotropic voxel geometry into local dependence estimation.The standard dependence criterion is applied on that representation.Source: §2.5.4 · p. 9
2.5.5 Gray-Level Size-Zone Matrix (GLSZM)
- GLSZM retains its connectivity rules and integer zone sizes, but counts isotropic subcells so zone-size descriptors respond to anisotropic voxel volume.Source: §2.5.5 · p. 9
2.5.6 Shape and first-order features
- Shape features require no additional spacing-aware changes because standard geometric calculations already incorporate voxel spacing; first-order features are mostly independent of spatial relationships.Volume-dependent quantities such as Total Energy are exceptions among first-order descriptors.Source: §2.5.6 · p. 9
2.6. Filtered image types
Most filtered image types retain standard PyRadiomics behavior, with a small number of spacing-related adjustments.
2.6. Filtered image types
- Wavelet, gradient, and intensity-transformation filters were not functionally modified.Source: §2.6 · p. 10
- The gradient filter already uses image spacing by default through gradientUseSpacing=True.Source: §2.6 · p. 10
- Limited adjustments included spacing-aware LoG handling and conservative disabling of anisotropic 3D LBP generation where no physically justified extension was available.Source: §2.6 · p. 10
2.7. Regression and compatibility testing
Testing combined upstream regression checks with synthetic three-dimensional phantoms to assess compatibility and spacing-aware behavior. The validation was designed for software behavior rather than clinical performance.
2.7. Regression and compatibility testing
- The evaluated development overlay passed 3568 upstream PyRadiomics tests, including reference feature and matrix tests intended to detect changes to standard behavior.Source: §2.7 · p. 10
- The test suite lacked an independent IBSI benchmark and dedicated anisotropic reference-value fixtures for every spacing-aware family, so it establishes tested backward compatibility rather than formal IBSI conformance.Source: §2.7 · pp. 10–11
2.8. Synthetic software validation
- Deterministic phantoms supported software-only evaluation, including comparisons with nearest-neighbor, linear, and B-spline resampling, computational profiling, and sensitivity tests across binWidth values.Profiling varied volume size and expansion factors; non-integer spacing ratios were also tested.Source: §2.8 · pp. 11–12
- Synthetic validation compared original PyRadiomics with the modified implementation both with spacing-aware mode disabled and enabled, using isotropic and anisotropic 3D images with predefined patterns and an ROI.Texture extraction covered GLCM, GLRLM, GLDM, NGTDM, and GLSZM; shape features and slice-wise 2D or 2.5D extraction were excluded.Source: §2.8 · p. 11
3. Results
The implementation preserved standard outputs when spacing-aware mode was disabled and under isotropic spacing, while anisotropic spacing selectively changed texture features. Synthetic comparisons also showed differences from conventional resampling, and profiling quantified the computational costs and finite-volume approximation.
3.2. Software validation
- 75 evaluated texture features matched exactly with spacing-aware mode disabled, and isotropic spacing-aware extraction had mean and maximum absolute differences of zero versus default extraction.Source: §3.2 · p. 12
- 10.1% for GLCM, 26.1% for GLRLM, 33.6% for NGTDM, 49.1% for GLDM, and 40.0% for GLSZM were the median relative differences under anisotropic spacing.All evaluated GLCM, GLRLM, and NGTDM features changed, compared with 11 of 14 GLDM and 8 of 16 GLSZM features.Source: §3.2 · p. 12, Table 2 · p. 13
- Across 225 feature–phantom comparisons, nearest-neighbor resampling and spacing-aware extraction each changed 192/225 comparisons (85.3%), while linear and B-spline resampling changed 225/225 (100%).Spacing-aware extraction was not numerically equivalent to resampling because it preserved supplied gray levels rather than generating interpolated ones.Source: §3.2 · pp. 12–13
- The median of family-level median relative differences was 0.333 for nearest-neighbor, 0.304 for linear, 0.302 for B-spline, and 0.307 for voxel-spacing-aware extraction.Minimum method-level Spearman correlations were 0.900 for nearest-neighbor and voxel-spacing-aware extraction, and 0.800 for linear and B-spline resampling.Source: §3.2 · p. 12
- The most demanding completed profiling case ran in 1.74 s at approximately 90.55 MB peak memory; median peak memory rose from 2.83 MB at R = 1 to 13.56 MB at R = 7.Across tested configurations, maximum runtime remained below 1.75 s.Source: §3.2 · p. 13
- A 2.5:1:1 spacing ratio was represented with qz = 2 and −20.0% relative through-plane error, while 3.5:1:1 used qz = 4 and +14.3% error.Across adjacent tested configurations, the largest family-level median relative feature difference was 0.167 for GLSZM and the lowest Spearman correlation was 0.900 for NGTDM.Source: §3.2 · p. 13
4. Discussion
The discussion presents a feature-family-specific spacing-aware extension that preserves standard behavior when disabled and under isotropic spacing. Its validation and limitations define a technical basis, not evidence of clinical performance or IBSI conformance.
4. Discussion
- Exact agreement with standard PyRadiomics when spacing-aware mode is disabled and equivalence under isotropic spacing accompany selective activation under anisotropic spacing.The framework is presented as a backward-compatible basis for future investigation.Source: §4 · pp. 14–15
- Relative anisotropy weighting preserves isotropic equivalence while addressing divergence between physical and index-space relationships.GLCM uses feature-level angular aggregation to preserve directional co-occurrence distributions and avoid altering nonlinear Haralick descriptors through matrix averaging.Source: §4 · p. 14
- NGTDM uses anisotropy-relative weighted neighborhood averaging, while GLRLM, GLDM, and GLSZM use finite-volume computation on an isotropic physical lattice.The finite-volume representation retains integer-valued run length, dependence size, and zone size axes.Source: §4 · p. 14
- The spacing-aware outputs are methodological extensions, not conventional IBSI reference values; independent IBSI benchmarking was not performed.The regression suite supports preservation of tested PyRadiomics behavior, not independent IBSI conformance.Source: §4 · p. 14
- Finite-volume expansion requires integer repeat factors, so non-integer spacing ratios make represented spacing differ from acquired spacing.This approximation is quantified and reported through e_k; rational approximations, direct physical traversal, or streaming matrix construction are suggested for future work.Source: §4 · pp. 14–15
- Expansion increases array size approximately in proportion to R = qzqyqx, and memory may remain substantial for large native volumes.Reported moderate-cost operation applies only to tested volume sizes and expansion factors; larger or highly anisotropic volumes may require tiling or streaming.Source: §4 · p. 15
- Deterministic synthetic phantoms validated software behavior but did not establish clinical superiority, test–retest reproducibility, or predictive performance.The spacing-aware operations are opt-in and are not claimed to produce conventional IBSI reference values.Source: §4 · p. 15
5. Conclusion
The conclusion presents a backward-compatible, feature-family-specific extension that incorporates voxel geometry without interpolating gray levels. Synthetic validation supports its equivalence under isotropic spacing and selective operation under anisotropic conditions, as a basis for future evaluation.
5. Conclusion
- The framework applies native-lattice weighting to GLCM and NGTDM and finite-volume zero-order-hold representation to GLRLM, GLDM, and GLSZM.It was integrated across the Python frontend, C wrapper, and computational backend with an optional execution mode.Source: §5 · p. 15
- Exact agreement with standard PyRadiomics when spacing-aware extraction is disabled and equivalence under isotropic spacing were demonstrated in synthetic validation.Under anisotropic conditions, computation selectively activated feature families in line with the proposed formulation.Source: §5 · p. 15
- The implementation provides a foundation for future studies of spacing-aware radiomics and its impact on reproducibility, robustness, and clinical modelling.The framework is described as practical and extensible.Source: §5 · pp. 15–16
Funding
The study received no specific grant from any funding agency.
Funding
- The research received no specific grant from any funding agency in the public, commercial, or not-for-profit sectors.Source: Funding · p. 16
Ethics Statement
The study used synthetic imaging data and involved no human participants, patient data, animal experiments, or clinical interventions.
Ethics Statement
- Validation used synthetic imaging data only, so ethics approval and informed consent were not required.Source: Ethics Statement · p. 16