Stereological estimation of second- and fourth-order fabric tensors from micro-CT images
Project description
fabrictensor
fabrictensor is a Python library for estimating second- and fourth-order fabric tensors from three-dimensional binary micro-CT image stacks. Five independent stereological methods are implemented, each probing a distinct positive orientation measure on the unit sphere S².
Methods
| Key | Method | M2 | M4 PSD |
|---|---|---|---|
MIL |
Mean Intercept Length (Harrigan & Mann 1984) | approx. | projected |
SVD |
Star Volume Distribution | approx. | exact |
SKELETON |
Trabecular skeletonization | exact | exact |
INTERCEPTS |
Second moment of intercept length distribution | approx. | exact |
S2 |
Two-point correlation function via FFT | approx. | projected |
Installation
pip install fabrictensor
Or from source:
git clone https://github.com/salsessa/fabrictensor.git
cd fabrictensor
pip install -e .
Dependencies
numpy
scipy
scikit-image
Pillow
matplotlib
pydicom # only for DICOM input
Quick start
from fabrictensor import (
load_stack, threshold_stack,
centered_sphere_mask, icosahedral_directions, add_random_spin,
compute_intercept_moments_all,
fit_fabric_tensor, fit_fabric_tensor_M4_intercepts,
fabric_eigendecomposition, fabric_indices,
)
# Load a folder of TIFF slices
vol, _ = load_stack("path/to/rve/")
binary, thr, bvtv = threshold_stack(vol, method="otsu")
# Direction grid
mask = centered_sphere_mask(binary.shape)
dirs = add_random_spin(icosahedral_directions(subdivisions=3), seed=42)
# Compute M2 and M4 (INTERCEPTS method)
mil_vals, mil2_vals = compute_intercept_moments_all(
binary, mask, dirs, n_rays=5000, seed=42)
M2 = fit_fabric_tensor(dirs, mil_vals, method="MIL-H")
M4 = fit_fabric_tensor_M4_intercepts(dirs, mil2_vals)
ev, _ = fabric_eigendecomposition(M2)
print("M2 eigenvalues:", ev)
print("DA =", fabric_indices(ev)["DA"])
See the examples/ folder for complete annotated scripts, including
DICOM input (single multi-frame file and folder of single-frame slices)
and TIFF stacks (grayscale and binary).
Repository structure
fabrictensor/
├── fabrictensor.py # library (all public functions)
├── pyproject.toml
├── LICENSE
├── README.md
├── examples/
│ ├── template_fabrictensor.py # general-purpose template
│ ├── run_DCM_Palanca_et_al.py # multi-frame DICOM example
│ └── run_StereomTest.py # TIFF stack example
├── tests/
│ └── test_fabrictensor.py # 80-test suite (no external data)
└── data/
└── palanca/ # sample micro-CT data
└── ... # CC BY 4.0 Palanca et al. (2025)
Citation
If you use fabrictensor in your research, please cite:
Sessa, S. (in preparation). fabrictensor: a Python library for second- and fourth-order fabric tensor estimation from micro-CT images. SoftwareX. (manuscript submitted)
The theoretical framework implemented in this library is described in:
Sessa, S. (2026). Symmetry classes of linear elasticity induced by fabric tensors. (manuscript in press)
These entries will be updated with full bibliographic details (volume, pages, DOI) upon publication.
Sample data
The data/palanca/ folder contains a subset of the micro-CT dataset
published by Palanca et al. (2016) on figshare, distributed under
CC BY 4.0.
Palanca, M., Tozzi, G., Cristofolini, L., Dall'Ara, E. (2016). microCT scans of bone and cement-bone microstructures. figshare. Dataset. https://doi.org/10.6084/m9.figshare.4308926
The MIT License of fabrictensor does not apply to those files. See NOTICE and data/palanca/README.md for full attribution details.
License
fabrictensor is released under the MIT License.
Contact
Salvatore Sessa
Università degli Studi di Napoli Federico II
salvatore.sessa2@unina.it
https://github.com/salsessa/fabrictensor
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fabrictensor-1.0.2.tar.gz.
File metadata
- Download URL: fabrictensor-1.0.2.tar.gz
- Upload date:
- Size: 46.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2fe1a554f7d1b2958a367305aada801fac1a3ce838773f7b8798913ede2ead43
|
|
| MD5 |
5f73d3e0b9c9c253958d59c7683dd868
|
|
| BLAKE2b-256 |
939f35c46c0b82627c7baf7d1e0af905693ede18c4a6624019390b9251c79114
|
File details
Details for the file fabrictensor-1.0.2-py3-none-any.whl.
File metadata
- Download URL: fabrictensor-1.0.2-py3-none-any.whl
- Upload date:
- Size: 28.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3cca562966f15610cc6cf60fac0dde853850f687666da71c5784f0709b2a4c37
|
|
| MD5 |
3b1a960d723654fdc60695b01748f5a3
|
|
| BLAKE2b-256 |
3cce73815c248af882725c7766275e898d1c45401256c9d9e1adc1a65da1914b
|