From eaf5372eb83f31c4e2142a3d3c7557bcecf5c6a9 Mon Sep 17 00:00:00 2001 From: s214735 <s214735@dtu.dk> Date: Mon, 30 Dec 2024 10:56:20 +0100 Subject: [PATCH] more fixes --- qim3d/filters/_common_filter_methods.py | 4 ++-- qim3d/mesh/_common_mesh_methods.py | 4 ++-- qim3d/operations/_common_operations_methods.py | 4 ++-- qim3d/segmentation/_common_segmentation_methods.py | 6 ++---- qim3d/viz/_data_exploration.py | 2 +- qim3d/viz/_detection.py | 4 ++-- 6 files changed, 11 insertions(+), 13 deletions(-) diff --git a/qim3d/filters/_common_filter_methods.py b/qim3d/filters/_common_filter_methods.py index cbd97ce4..8ead1ba2 100644 --- a/qim3d/filters/_common_filter_methods.py +++ b/qim3d/filters/_common_filter_methods.py @@ -172,12 +172,12 @@ class Pipeline: ) self.filters[name] = fn - def append(self, fn: Type[FilterBase]): + def append(self, fn: FilterBase): """ Appends a filter to the end of the sequence. Args: - fn: An instance of a FilterBase subclass to be appended. + fn (FilterBase): An instance of a FilterBase subclass to be appended. Example: ```python diff --git a/qim3d/mesh/_common_mesh_methods.py b/qim3d/mesh/_common_mesh_methods.py index d8cc0789..5e42b4e9 100644 --- a/qim3d/mesh/_common_mesh_methods.py +++ b/qim3d/mesh/_common_mesh_methods.py @@ -21,11 +21,11 @@ def from_volume( level (float, optional): The threshold value for Marching Cubes. If None, Otsu's method is used. step_size (int, optional): The step size for the Marching Cubes algorithm. allow_degenerate (bool, optional): Whether to allow degenerate (i.e. zero-area) triangles in the end-result. If False, degenerate triangles are removed, at the cost of making the algorithm slower. Default False. - padding (tuple of int, optional): Padding to add around the volume. + padding (tuple of ints, optional): Padding to add around the volume. **kwargs: Additional keyword arguments to pass to `skimage.measure.marching_cubes`. Returns: - trimesh: The generated mesh. + trimesh.Trimesh: The generated mesh. Example: ```python diff --git a/qim3d/operations/_common_operations_methods.py b/qim3d/operations/_common_operations_methods.py index 449b2d53..17f6bd0e 100644 --- a/qim3d/operations/_common_operations_methods.py +++ b/qim3d/operations/_common_operations_methods.py @@ -22,7 +22,7 @@ def remove_background( **median_kwargs (Any): Additional keyword arguments for the Median filter. Returns: - np.ndarray: The volume with background removed. + filtered_vol (np.ndarray): The volume with background removed. Example: @@ -76,7 +76,7 @@ def fade_mask( **kwargs (Any): Additional keyword arguments for the edge fading. Returns: - vol_faded (np.ndarray): The volume with edge fading applied. + faded_vol (np.ndarray): The volume with edge fading applied. Example: ```python diff --git a/qim3d/segmentation/_common_segmentation_methods.py b/qim3d/segmentation/_common_segmentation_methods.py index 979ab6fd..6baff849 100644 --- a/qim3d/segmentation/_common_segmentation_methods.py +++ b/qim3d/segmentation/_common_segmentation_methods.py @@ -14,10 +14,8 @@ def watershed(bin_vol: np.ndarray, min_distance: int = 5) -> tuple[np.ndarray, i too close will be merged, affecting the number of segmented objects. Default is 5. Returns: - tuple[np.ndarray, int]: - - Labeled volume (np.ndarray): A 3D array of the same shape as the input `bin_vol`, where each segmented object - is assigned a unique integer label. - - num_labels (int): The total number of unique objects found in the labeled volume. + labeled_vol (np.ndarray): A 3D array of the same shape as the input `bin_vol`, where each segmented object is assigned a unique integer label. + num_labels (int): The total number of unique objects found in the labeled volume. Example: ```python diff --git a/qim3d/viz/_data_exploration.py b/qim3d/viz/_data_exploration.py index 8a16b194..a4e46237 100644 --- a/qim3d/viz/_data_exploration.py +++ b/qim3d/viz/_data_exploration.py @@ -48,7 +48,7 @@ def slices_grid( Args: volume (np.ndarray): The 3D volume to be sliced. slice_axis (int, optional): Specifies the axis, or dimension, along which to slice. Defaults to 0. - slice_positions (str, int, list, optional): One or several slicing levels. If None, linearly spaced slices will be displayed. Defaults to None. + slice_positions (str or int or list, optional): One or several slicing levels. If None, linearly spaced slices will be displayed. Defaults to None. num_slices (int, optional): Defines how many slices the user wants to be displayed. Defaults to 15. max_columns (int, optional): The maximum number of columns to be plotted. Defaults to 5. color_map (str, optional): Specifies the color map for the image. Defaults to "viridis". diff --git a/qim3d/viz/_detection.py b/qim3d/viz/_detection.py index fa34eef1..2cf9bbbe 100644 --- a/qim3d/viz/_detection.py +++ b/qim3d/viz/_detection.py @@ -15,9 +15,9 @@ def circles(blobs, vol, alpha=0.5, color="#ff9900", **kwargs): it defaults to the middle slice of the volume. Args: - blobs (array-like): An array-like object of blobs, where each blob is represented + blobs (tuple): An array-like object of blobs, where each blob is represented as a 4-tuple (p, r, c, radius). Usually the result of `qim3d.processing.blob_detection(vol)` - vol (array-like): The 3D volume on which to plot the blobs. + vol (np.ndarray): The 3D volume on which to plot the blobs. alpha (float, optional): The transparency of the blobs. Defaults to 0.5. color (str, optional): The color of the blobs. Defaults to "#ff9900". **kwargs (Any): Arbitrary keyword arguments for the `slices` function. -- GitLab