diff --git a/qim3d/generate/_aggregators.py b/qim3d/generate/_aggregators.py index 535ad9db66f92d477555c8c804baf29bb5dc7b93..b18119b6de2e95e47e1263d9d7d2e3bd0ee7dd29 100644 --- a/qim3d/generate/_aggregators.py +++ b/qim3d/generate/_aggregators.py @@ -147,12 +147,12 @@ def noise_object_collection( Generate a 3D volume of multiple synthetic objects using Perlin noise. Args: - collection_shape (tuple, optional): Shape of the final collection volume to generate. Defaults to (200, 200, 200). + collection_shape (tuple of ints, optional): Shape of the final collection volume to generate. Defaults to (200, 200, 200). num_objects (int, optional): Number of synthetic objects to include in the collection. Defaults to 15. positions (list[tuple], optional): List of specific positions as (z, y, x) coordinates for the objects. If not provided, they are placed randomly into the collection. Defaults to None. - min_shape (tuple, optional): Minimum shape of the objects. Defaults to (40, 40, 40). - max_shape (tuple, optional): Maximum shape of the objects. Defaults to (60, 60, 60). - object_shape_zoom (tuple, optional): Scaling factors for each dimension of each object. Defaults to (1.0, 1.0, 1.0). + min_shape (tuple of ints, optional): Minimum shape of the objects. Defaults to (40, 40, 40). + max_shape (tuple of ints, optional): Maximum shape of the objects. Defaults to (60, 60, 60). + object_shape_zoom (tuple of ints, optional): Scaling factors for each dimension of each object. Defaults to (1.0, 1.0, 1.0). min_object_noise (float, optional): Minimum scale factor for Perlin noise. Defaults to 0.02. max_object_noise (float, optional): Maximum scale factor for Perlin noise. Defaults to 0.05. min_rotation_degrees (int, optional): Minimum rotation angle in degrees. Defaults to 0. diff --git a/qim3d/generate/_generators.py b/qim3d/generate/_generators.py index cd914696115dd5dd56719e360ef50bb2a814c421..15578a67e341790a4433a6b0069d1273c87f007b 100644 --- a/qim3d/generate/_generators.py +++ b/qim3d/generate/_generators.py @@ -20,8 +20,8 @@ def noise_object( Generate a 3D volume with Perlin noise, spherical gradient, and optional scaling and gamma correction. Args: - base_shape (tuple, optional): Shape of the initial volume to generate. Defaults to (128, 128, 128). - final_shape (tuple, optional): Desired shape of the final volume. Defaults to (128, 128, 128). + base_shape (tuple of ints, optional): Shape of the initial volume to generate. Defaults to (128, 128, 128). + final_shape (tuple of ints, optional): Desired shape of the final volume. Defaults to (128, 128, 128). noise_scale (float, optional): Scale factor for Perlin noise. Defaults to 0.05. order (int, optional): Order of the spline interpolation used in resizing. Defaults to 1. gamma (float, optional): Gamma correction factor. Defaults to 1.0. @@ -29,7 +29,7 @@ def noise_object( threshold (float, optional): Threshold value for clipping low intensity values. Defaults to 0.5. smooth_borders (bool, optional): Flag for automatic computation of the threshold value to ensure a blob with no straight edges. If True, the `threshold` parameter is ignored. Defaults to False. object_shape (str, optional): Shape of the object to generate, either "cylinder", or "tube". Defaults to None. - dtype (str, optional): Desired data type of the output volume. Defaults to "uint8". + dtype (data-type, optional): Desired data type of the output volume. Defaults to "uint8". Returns: noise_object (numpy.ndarray): Generated 3D volume with specified parameters. diff --git a/qim3d/io/_downloader.py b/qim3d/io/_downloader.py index adc956145ada8f05fc0d400fa2e4a33087054851..c718e05f313370c964252b714fe63e6cd9594a7e 100644 --- a/qim3d/io/_downloader.py +++ b/qim3d/io/_downloader.py @@ -16,7 +16,7 @@ class Downloader: """Class for downloading large data files available on the [QIM data repository](https://data.qim.dk/). Attributes: - folder_name (str): Folder class with the name of the folder in <https://data.qim.dk/> + folder_name (str or os.PathLike): Folder class with the name of the folder in <https://data.qim.dk/> Syntax for downloading and loading a file is `qim3d.io.Downloader().{folder_name}.{file_name}(load_file=True)` diff --git a/qim3d/io/_ome_zarr.py b/qim3d/io/_ome_zarr.py index 2a1174a0eb49d16ae425e10332d6676f42816984..0cf4803e4fa02888fc9a00e0582048e4f62abea3 100644 --- a/qim3d/io/_ome_zarr.py +++ b/qim3d/io/_ome_zarr.py @@ -197,7 +197,7 @@ def export_ome_zarr( This function generates a multi-scale OME-Zarr representation of the input data, which is commonly used for large imaging datasets. The downsampled scales are calculated such that the smallest scale fits within the specified `chunk_size`. Args: - path (str): The directory where the OME-Zarr data will be stored. + path (str or os.PathLike): The directory where the OME-Zarr data will be stored. data (np.ndarray or dask.array): The 3D image data to be exported. Supports both NumPy and Dask arrays. chunk_size (int, optional): The size of the chunks for storing data. This affects both the original data and the downsampled scales. Defaults to 256. downsample_rate (int, optional): The factor by which to downsample the data for each scale. Must be greater than 1. Defaults to 2. @@ -220,9 +220,6 @@ def export_ome_zarr( qim3d.io.export_ome_zarr("Escargot.zarr", data, chunk_size=100, downsample_rate=2) ``` - - Returns: - None (None): This function writes the OME-Zarr data to the specified directory and does not return any value. """ # Check if directory exists @@ -307,7 +304,7 @@ def import_ome_zarr(path, scale=0, load=True): The image data can be lazily loaded (as Dask arrays) or fully computed into memory. Args: - path (str): The file path to the OME-Zarr data. + path (str or os.PathLike): The file path to the OME-Zarr data. scale (int or str, optional): The scale level to load. If 'highest', loads the finest scale (scale 0). If 'lowest', loads the coarsest scale (last available scale). Defaults to 0. diff --git a/qim3d/io/_saving.py b/qim3d/io/_saving.py index ce21aa8a968e42f60adf37ce08f37876521cafb0..830674a2d3d83f442c1b4772cdb840f3da88c345 100644 --- a/qim3d/io/_saving.py +++ b/qim3d/io/_saving.py @@ -413,7 +413,7 @@ def save( """Save data to a specified file path. Args: - path (str): The path to save file to. File format is chosen based on the extension. + path (str or os.PathLike): The path to save file to. File format is chosen based on the extension. Supported extensions are: <em>'.tif', '.tiff', '.nii', '.nii.gz', '.h5', '.vol', '.vgi', '.dcm', '.DCM', '.zarr', '.jpeg', '.jpg', '.png'</em> data (numpy.ndarray): The data to be saved replace (bool, optional): Specifies if an existing file with identical path should be replaced. @@ -469,7 +469,7 @@ def save_mesh(filename, mesh): Save a trimesh object to an .obj file. Args: - filename (str): The name of the file to save the mesh. + filename (str or os.PathLike): The name of the file to save the mesh. mesh (trimesh.Trimesh): A trimesh.Trimesh object representing the mesh. Example: diff --git a/qim3d/processing/_layers.py b/qim3d/processing/_layers.py index 5650ef182a6c3dcf96b3d08bfff6169944f70fd7..ba3e3ad47b558a081ae979f1877495587cc6deab 100644 --- a/qim3d/processing/_layers.py +++ b/qim3d/processing/_layers.py @@ -9,13 +9,13 @@ def segment_layers(data:np.ndarray, inverted:bool = False, n_layers:int = 1, del Now uses only MaxflowBuilder for solving. Args: - data: 2D or 3D array on which it will be computed - inverted: if True, it will invert the brightness of the image - n_layers: How many layers are we looking for (result in a layer and background) - delta: Smoothness parameter - min_margin: If we want more layers, we have to have a margin otherwise they are all going to be exactly the same - max_margin: Maximum margin between layers - wrap: If True, starting and ending point of the border between layers are at the same level + data (np.ndarray): 2D or 3D array on which it will be computed + inverted (bool): if True, it will invert the brightness of the image + n_layers (int): How many layers are we looking for (result in a layer and background) + delta (float): Smoothness parameter + min_margin (int): If we want more layers, we have to have a margin otherwise they are all going to be exactly the same + max_margin (int): Maximum margin between layers + wrap (bool): If True, starting and ending point of the border between layers are at the same level Returns: segmentations (list[np.ndarray]): list of numpy arrays, even if n_layers == 1, each array is only 0s and 1s, 1s segmenting this specific layer @@ -88,7 +88,7 @@ def get_lines(segmentations:list|np.ndarray) -> list: so it could be plotted. Used with qim3d.processing.segment_layers Args: - segmentations: list of arrays where each array is 2D segmentation with only 2 classes + segmentations (list of arrays): list of arrays where each array is 2D segmentation with only 2 classes Returns: segmentation_lines: list of 1D numpy arrays