Skip to content
Snippets Groups Projects
Commit 2d09dabf authored by Hugo chauvet's avatar Hugo chauvet
Browse files

Try to improve the speed to display the CLI

parent f55ee7e2
No related branches found
No related tags found
No related merge requests found
...@@ -6,9 +6,6 @@ This file is part of DITB. ...@@ -6,9 +6,6 @@ This file is part of DITB.
Contains the cli interface for the convert command Contains the cli interface for the convert command
""" """
import click import click
from ..io.converter import MM2Zarr, mmzarr2MMformat
from pathlib import Path
import shutil
@click.command @click.command
@click.argument('source', nargs=-1, type=click.Path(exists=True)) @click.argument('source', nargs=-1, type=click.Path(exists=True))
...@@ -23,6 +20,11 @@ def convert(convertor, source, destination, force): ...@@ -23,6 +20,11 @@ def convert(convertor, source, destination, force):
📦 Convert data to several format. 📦 Convert data to several format.
""" """
# Do the import in the function to improve cli speed
from ..io.converter import MM2Zarr, mmzarr2MMformat
from pathlib import Path
import shutil
if convertor in ['ZARR2HDF', 'ZARR2Tif']: if convertor in ['ZARR2HDF', 'ZARR2Tif']:
raise NotImplementedError(f'This convertor {convertor} is not yet implemented, please be patient') raise NotImplementedError(f'This convertor {convertor} is not yet implemented, please be patient')
......
...@@ -5,10 +5,6 @@ This file is part of DITB. ...@@ -5,10 +5,6 @@ This file is part of DITB.
Contains the cli interface for the dark white correction of the DISCO beam Contains the cli interface for the dark white correction of the DISCO beam
""" """
from ditb.exposure.darkwhite_correction import correct_dark_white
from ditb.filters.smooth import smooth_to_zarr
from pathlib import Path
import shutil
import click import click
@click.command() @click.command()
...@@ -36,6 +32,11 @@ def darkwhite(images, dark, white, darkofwhite, white_z, force, lower, smooth, v ...@@ -36,6 +32,11 @@ def darkwhite(images, dark, white, darkofwhite, white_z, force, lower, smooth, v
the white image stack. the white image stack.
""" """
# Do the import in the function to speed up the cli
from ditb.exposure.darkwhite_correction import correct_dark_white
from ditb.filters.smooth import smooth_to_zarr
from pathlib import Path
import shutil
if dark is None: if dark is None:
raise NotImplementedError('No dark option is not implemented') raise NotImplementedError('No dark option is not implemented')
......
...@@ -5,11 +5,8 @@ This file is part of DITB. ...@@ -5,11 +5,8 @@ This file is part of DITB.
Contains the cli interface for the stitching of tiles Contains the cli interface for the stitching of tiles
""" """
from ditb.io.metadata import read_mmzarr_metadata
from ditb.stitching.tiles import create_mosaic
from pathlib import Path
import click import click
import shutil
@click.command() @click.command()
@click.argument('images', nargs=-1, type=click.Path(exists=True)) @click.argument('images', nargs=-1, type=click.Path(exists=True))
...@@ -19,6 +16,12 @@ def stitch(images, force): ...@@ -19,6 +16,12 @@ def stitch(images, force):
🪟 Stitch tiles from a zarr dataset to create a mosaic. 🪟 Stitch tiles from a zarr dataset to create a mosaic.
""" """
# Do the import in the function for cli speed
from ditb.io.metadata import read_mmzarr_metadata
from ditb.stitching.tiles import create_mosaic
from pathlib import Path
import shutil
print(f'🪩 Stitch data') print(f'🪩 Stitch data')
for filein in images: for filein in images:
......
...@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" ...@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
[project] [project]
name = "DITB" name = "DITB"
version = "20250108rc2" version = "20250108rc3"
readme = "README.md" readme = "README.md"
requires-python = ">=3.11" requires-python = ">=3.11"
authors = [{ name = "Hugo Chauvet", email = "hugo.chauvet@synchrotron-soleil.fr" }] authors = [{ name = "Hugo Chauvet", email = "hugo.chauvet@synchrotron-soleil.fr" }]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment