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.0.tar.gz (36.0 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.0-py3-none-any.whl (28.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: fabrictensor-1.0.0.tar.gz
  • Upload date:
  • Size: 36.0 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.0.tar.gz
Algorithm Hash digest
SHA256 27054f9b807986d77dbe1d83e90a72bc9e0b411190ad051e04bd24760bea0b7a
MD5 65c58066fdb461f3760a9bad987f105d
BLAKE2b-256 8893f393600d86ec32c7a487295669e35b6b39c66a51c103260b00c1f3c95795

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fabrictensor-1.0.0-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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a630ff6e3647ed541b97bcae1a4cdbf455929faf62e01f7f45672038b1ddb69b
MD5 83daa54090b7ff75b540f669dab0ed13
BLAKE2b-256 be2ee56ed439ae9e9a84f8d9d80574cebf098f84f05d4ab3168802a252e5118f

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