Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fabrictensor-1.0.1.tar.gz (40.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fabrictensor-1.0.1-py3-none-any.whl (28.5 kB view details)

Uploaded Python 3

File details

Details for the file fabrictensor-1.0.1.tar.gz.

File metadata

  • Download URL: fabrictensor-1.0.1.tar.gz
  • Upload date:
  • Size: 40.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.3

File hashes

Hashes for fabrictensor-1.0.1.tar.gz
Algorithm Hash digest
SHA256 74602b47c6964e69964e9f4fa2419d301313e1e4c277f7c600563ec21e142cde
MD5 54e9a3f7ee025568bb59a01565f8f666
BLAKE2b-256 53e0f2562245afecec3b276256466687ecf4033d7957902616bfcdf0c95e445a

See more details on using hashes here.

File details

Details for the file fabrictensor-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: fabrictensor-1.0.1-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

Hashes for fabrictensor-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7dab0157aeb7204a29a122b93c2b26388a8b2f5d2de277ac9155cf96ac7f461b
MD5 0913e934aa3cec65c4bb424a5e219df7
BLAKE2b-256 6c33f8a13c33e6605537a1ca26d1fc55219f1ce5a43d242722a4a19869e83474

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page