Skip to content

Commit 8ccde11

Browse files
authored
optional import cucim.skimage directly (#6957)
Fixes #6956 . ### Description Looks like an error which introduced by this [PR](rapidsai/cucim#575). The submodule in cucim.skimage can import correctly, so change to directly import cucim.skimage. ### Types of changes <!--- Put an `x` in all the boxes that apply, and remove the not applicable items --> - [x] Non-breaking change (fix or new feature that would not break existing functionality). - [ ] Breaking change (fix or new feature that would cause existing functionality to change). - [ ] New tests added to cover the changes. - [ ] Integration tests passed locally by running `./runtests.sh -f -u --net --coverage`. - [ ] Quick tests passed locally by running `./runtests.sh --quick --unittests --disttests`. - [ ] In-line docstrings updated. - [ ] Documentation updated, tested `make html` command in the `docs/` folder. Signed-off-by: KumoLiu <[email protected]>
1 parent c4ed1f8 commit 8ccde11

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

monai/auto3dseg/utils.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -94,11 +94,11 @@ def get_label_ccp(mask_index: MetaTensor, use_gpu: bool = True) -> tuple[list[An
9494
regardless of this setting.
9595
9696
"""
97-
cucim, has_cucim = optional_import("cucim")
97+
skimage, has_cucim = optional_import("cucim.skimage")
9898
shape_list = []
9999
if mask_index.device.type == "cuda" and has_cp and has_cucim and use_gpu:
100100
mask_cupy = ToCupy()(mask_index.short())
101-
labeled = cucim.skimage.measure.label(mask_cupy)
101+
labeled = skimage.measure.label(mask_cupy)
102102
vals = cp.unique(labeled[cp.nonzero(labeled)])
103103

104104
for ncomp in vals:

monai/transforms/utils.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1027,11 +1027,11 @@ def get_largest_connected_component_mask(
10271027
"""
10281028
# use skimage/cucim.skimage and np/cp depending on whether packages are
10291029
# available and input is non-cpu torch.tensor
1030-
cucim, has_cucim = optional_import("cucim")
1030+
skimage, has_cucim = optional_import("cucim.skimage")
10311031
use_cp = has_cp and has_cucim and isinstance(img, torch.Tensor) and img.device != torch.device("cpu")
10321032
if use_cp:
10331033
img_ = convert_to_cupy(img.short()) # type: ignore
1034-
label = cucim.skimage.measure.label
1034+
label = skimage.measure.label
10351035
lib = cp
10361036
else:
10371037
if not has_measure:

0 commit comments

Comments
 (0)