Skip to content
Snippets Groups Projects

Structure tensor wrapper

1 file
+ 45
0
Compare changes
  • Side-by-side
  • Inline
"""Wrapper for the structure tensor function from the structure_tensor package"""
import numpy as np
import structure_tensor as st
from typing import Tuple
def structure_tensor(volume: np.ndarray,
sigma: float,
rho: float,
full: bool = False,
) -> Tuple[np.ndarray, np.ndarray]:
"""Wrapper for the 3D structure tensor implementation from the structure_tensor package (https://github.com/Skielex/structure-tensor/)
Args:
volume (np.ndarray): 3D NumPy array representing the volume.
sigma (float): A noise scale, structures smaller than sigma will be removed by smoothing.
rho (float): An integration scale giving the size over the neighborhood in which the orientation is to be analysed.
full: A flag indicating that all three eigenvalues should be returned. Default is False.
eigenvalue_order: The order of the eigenvalues. Either "desc" for descending or "asc" for ascending. Default is "desc".
Returns:
val: An array with shape `(3, *volume.shape)` containing the eigenvalues of the structure tensor.
vec: An array with shape `(3, ...)` if `full` is `False`, otherwise `(3, 3, ...)` containing eigenvectors.
!!! quote "Reference"
Jeppesen, N., et al. "Quantifying effects of manufacturing methods on fiber orientation in unidirectional composites using structure tensor analysis." Composites Part A: Applied Science and Manufacturing 149 (2021): 106541.
<https://doi.org/10.1016/j.compositesa.2021.106541>
```bibtex
@article{JEPPESEN2021106541,
title = {Quantifying effects of manufacturing methods on fiber orientation in unidirectional composites using structure tensor analysis},
journal = {Composites Part A: Applied Science and Manufacturing},
volume = {149},
pages = {106541},
year = {2021},
issn = {1359-835X},
doi = {https://doi.org/10.1016/j.compositesa.2021.106541},
url = {https://www.sciencedirect.com/science/article/pii/S1359835X21002633},
author = {N. Jeppesen and L.P. Mikkelsen and A.B. Dahl and A.N. Christensen and V.A. Dahl}
}
"""
S = st.structure_tensor_3d(volume, sigma, rho)
val, vec = st.eig_special_3d(S, full=full)
return val, vec
\ No newline at end of file
Loading