Skip to content

Commit

Permalink
WIP: ENH: Use cuCIM in CLI conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
thewtex committed Mar 5, 2024
1 parent ae53013 commit 6e5f6c0
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
30 changes: 30 additions & 0 deletions ngff_zarr/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,36 @@ def shutdown_client(sig_id, frame): # noqa: ARG001
_multiscales_to_ngff_zarr(
live, args, output_store, rich_dask_progress, multiscales
)
elif input_backend is ConversionBackend.CUCIM:
try:
# import cucim
# print('ARGS', args)

# cuimage = cucim.CuImage(str(args.input[0]))
if args.chunks is None:
# Present the existing chunks and resolution levels
# [...]
# multiscales = cucim_image_to_multiscales(cuimage)
pass

else:
# ngff_image = cucim_image_to_ngff_image(cucimage)
# multiscales = _ngff_image_to_multiscales(
# live,
# ngff_image,
# args,
# progress,
# rich_dask_progress,
# subtitle,
# method,
# )
pass
_multiscales_to_ngff_zarr(
live, args, output_store, rich_dask_progress, multiscales
)
except ImportError:
sys.stdout.write("[red]Please install the [i]cucim[/i] package.\n")
sys.exit(1)
elif input_backend is ConversionBackend.TIFFFILE:
try:
import tifffile
Expand Down
2 changes: 2 additions & 0 deletions ngff_zarr/detect_cli_io_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ def detect_cli_io_backend(input: List[str]) -> ConversionBackend:
if extension in itk_supported_extensions:
return ConversionBackend.ITK

extension = Path(input[0]).suffixes[-1].lower()

if importlib.util.find_spec("cucim") is not None:
cucim_supported_extensions = (".svs", ".tif", ".tiff")

Expand Down

0 comments on commit 6e5f6c0

Please sign in to comment.