diff --git a/docs/assets/screenshots/Local_thickness_time_mem_estimation.png b/docs/assets/screenshots/Local_thickness_time_mem_estimation.png new file mode 100644 index 0000000000000000000000000000000000000000..c3f1c84f3d876c1cce1e5e72a5e5befd994972ce Binary files /dev/null and b/docs/assets/screenshots/Local_thickness_time_mem_estimation.png differ diff --git a/docs/assets/screenshots/Structure_tensor_time_mem_estimation.png b/docs/assets/screenshots/Structure_tensor_time_mem_estimation.png new file mode 100644 index 0000000000000000000000000000000000000000..106c92a48a7711138447307f4beb048fc6fc8e5b Binary files /dev/null and b/docs/assets/screenshots/Structure_tensor_time_mem_estimation.png differ diff --git a/qim3d/processing/local_thickness_.py b/qim3d/processing/local_thickness_.py index 8090ad5be561027819c4f84b877d08b6a1df1ec0..5e7b9416b53b0180623ffd60dd7ebe5f50396c99 100644 --- a/qim3d/processing/local_thickness_.py +++ b/qim3d/processing/local_thickness_.py @@ -17,6 +17,13 @@ def local_thickness( ) -> np.ndarray: """Wrapper for the local thickness function from the [local thickness package](https://github.com/vedranaa/local-thickness) + The "Fast Local Thickness" by Vedrana Andersen Dahl and Anders Bjorholm Dahl from the Technical University of Denmark is a efficient algorithm for computing local thickness in 2D and 3D images. + Their method significantly reduces computation time compared to traditional algorithms by utilizing iterative dilation with small structuring elements, rather than the large ones typically used. + This approach allows the local thickness to be determined much faster, making it feasible for high-resolution volumetric data that are common in contemporary 3D microscopy. + + Testing against conventional methods and other Python-based tools like PoreSpy shows that the new algorithm is both accurate and faster, offering significant improvements in processing time for large datasets. + + Args: image (np.ndarray): 2D or 3D NumPy array representing the image/volume. If binary, it will be passed directly to the local thickness function. @@ -30,7 +37,7 @@ def local_thickness( Returns: local_thickness (np.ndarray): 2D or 3D NumPy array representing the local thickness of the input image/volume. - + Example: ```python import qim3d @@ -48,6 +55,11 @@ def local_thickness( ```  + !!! info "Runtime and memory usage of the local thickness method for different volume sizes" +  + + Performance computed on Intel(R) Xeon(R) Gold 6226 CPU @ 2.70GHz. + !!! quote "Reference" Dahl, V. A., & Dahl, A. B. (2023, June). Fast Local Thickness. 2023 IEEE/CVF Conference on Computer Vision and Pattern Recognition Workshops (CVPRW). <https://doi.org/10.1109/cvprw59228.2023.00456> @@ -63,6 +75,9 @@ def local_thickness( month=jun } ``` + + + """ # Check if input is binary diff --git a/qim3d/processing/structure_tensor_.py b/qim3d/processing/structure_tensor_.py index 2699fa70c5427d848e45fa28466f3c5b8a35773b..a02e376b7745bfef45587acda53fc1ec6f0e208c 100644 --- a/qim3d/processing/structure_tensor_.py +++ b/qim3d/processing/structure_tensor_.py @@ -16,6 +16,13 @@ def structure_tensor( ) -> Tuple[np.ndarray, np.ndarray]: """Wrapper for the 3D structure tensor implementation from the [structure_tensor package](https://github.com/Skielex/structure-tensor/) + + The structure tensor algorithm is a method for analyzing the orientation of fiber-like structures in 3D images. + The core of the algorithm involves computing a 3-by-3 matrix at each point in a volume, capturing the local orientation. This matrix, known as the structure tensor, is derived from the gradients of the image intensities and integrates neighborhood information using Gaussian kernels. + + The implementation here used allows for fast and efficient computation using GPU-based processing, making it suitable for large datasets. + This efficiency is particularly advantageous for high-resolution imaging techniques like X-ray computed microtomography (μCT). + Args: vol (np.ndarray): 3D NumPy array representing the volume. sigma (float, optional): A noise scale, structures smaller than sigma will be removed by smoothing. @@ -40,6 +47,13 @@ def structure_tensor( ```  + + !!! info "Runtime and memory usage of the structure tensor method for different volume sizes" +  + + Performance computed on Intel(R) Xeon(R) Gold 6226 CPU @ 2.70GHz. + + !!! 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> @@ -58,6 +72,7 @@ def structure_tensor( } ``` + """ if vol.ndim != 3: