From 33c9b1b4d0036e9ffccbe16b6495dc3de7346339 Mon Sep 17 00:00:00 2001 From: s214735 <s214735@dtu.dk> Date: Mon, 30 Dec 2024 11:29:47 +0100 Subject: [PATCH] Minor fixes --- qim3d/gui/layers2d.py | 3 ++- qim3d/io/_loading.py | 2 +- qim3d/io/_ome_zarr.py | 8 ++++---- qim3d/io/_saving.py | 2 +- qim3d/viz/_cc.py | 2 +- 5 files changed, 9 insertions(+), 8 deletions(-) diff --git a/qim3d/gui/layers2d.py b/qim3d/gui/layers2d.py index afb8832f..febd16a5 100644 --- a/qim3d/gui/layers2d.py +++ b/qim3d/gui/layers2d.py @@ -25,7 +25,8 @@ import numpy as np from .interface import BaseInterface # from qim3d.processing import layers2d as l2d -from qim3d.processing import overlay_rgb_images, segment_layers, get_lines +from qim3d.processing import segment_layers, get_lines +from qim3d.operations import overlay_rgb_images from qim3d.io import load from qim3d.viz._layers2d import image_with_lines from typing import Dict, Any diff --git a/qim3d/io/_loading.py b/qim3d/io/_loading.py index 90c67aea..e3d7d45b 100644 --- a/qim3d/io/_loading.py +++ b/qim3d/io/_loading.py @@ -239,7 +239,7 @@ class DataLoader: return vol - def load_txrm(self, path: str|os.PathLike) -> tuple[dask.array|np.ndarray, Optional[Dict]]: + def load_txrm(self, path: str|os.PathLike) -> tuple[dask.array.core.Array|np.ndarray, Optional[Dict]]: """Load a TXRM/XRM/TXM file from the specified path. Args: diff --git a/qim3d/io/_ome_zarr.py b/qim3d/io/_ome_zarr.py index a951be72..36976316 100644 --- a/qim3d/io/_ome_zarr.py +++ b/qim3d/io/_ome_zarr.py @@ -52,7 +52,7 @@ class OMEScaler( self.max_layer = max_layer self.method = method - def scaleZYX(self, base: dask.array): + def scaleZYX(self, base: da.core.Array): """Downsample using :func:`scipy.ndimage.zoom`.""" rv = [base] log.info(f"- Scale 0: {rv[-1].shape}") @@ -63,7 +63,7 @@ class OMEScaler( return list(rv) - def scaleZYXdask(self, base: dask.array): + def scaleZYXdask(self, base: da.core.Array): """ Downsample a 3D volume using Dask and scipy.ndimage.zoom. @@ -82,7 +82,7 @@ class OMEScaler( """ - def resize_zoom(vol: dask.array, scale_factors, order, scaled_shape): + def resize_zoom(vol: da.core.Array, scale_factors, order, scaled_shape): # Get the chunksize needed so that all the blocks match the new shape # This snippet comes from the original OME-Zarr-python library @@ -182,7 +182,7 @@ class OMEScaler( def export_ome_zarr( path: str|os.PathLike, - data: np.ndarray|dask.array, + data: np.ndarray|da.core.Array, chunk_size: int = 256, downsample_rate: int = 2, order: int = 1, diff --git a/qim3d/io/_saving.py b/qim3d/io/_saving.py index 42de3eb6..a7053c00 100644 --- a/qim3d/io/_saving.py +++ b/qim3d/io/_saving.py @@ -255,7 +255,7 @@ class DataSaver: ds.save_as(path) - def save_to_zarr(self, path: str|os.PathLike, data: np.ndarray): + def save_to_zarr(self, path: str|os.PathLike, data: da.core.Array): """Saves a Dask array to a Zarr array on disk. Args: diff --git a/qim3d/viz/_cc.py b/qim3d/viz/_cc.py index b8d81002..083b53cb 100644 --- a/qim3d/viz/_cc.py +++ b/qim3d/viz/_cc.py @@ -2,7 +2,7 @@ import matplotlib.pyplot as plt import numpy as np import qim3d from qim3d.utils._logger import log -from segmentation._connected_components import CC +from qim3d.segmentation._connected_components import CC def plot_cc( connected_components: CC, -- GitLab