diff --git a/.gitignore b/.gitignore index fc4303d..2b2d6b2 100644 --- a/.gitignore +++ b/.gitignore @@ -171,4 +171,6 @@ debug_data/ !binary_mask_sdh.tif data/* *intensity_plot.png -*.idea \ No newline at end of file +*.idea +cellpose.sh +nohup.out diff --git a/.python-version b/.python-version index 54c5196..09dcc78 100644 --- a/.python-version +++ b/.python-version @@ -1 +1 @@ -3.10.9 +3.10.11 diff --git a/myoquant/__main__.py b/myoquant/__main__.py index 2c6d1cf..26bc77f 100644 --- a/myoquant/__main__.py +++ b/myoquant/__main__.py @@ -1,11 +1,27 @@ import typer from rich.console import Console +import pkg_resources + +__version__ = pkg_resources.get_distribution("myoquant").version +__version_cellpose__ = pkg_resources.get_distribution("cellpose").version +__version_stardist__ = pkg_resources.get_distribution("stardist").version +__version_torch__ = pkg_resources.get_distribution("torch").version +__version_tensorflow__ = pkg_resources.get_distribution("tensorflow").version from .commands.docs import app as docs_app from .commands import run_sdh, run_he, run_atp console = Console() + +def version_callback(value: bool): + if value: + print( + f"MyoQuant Version: {__version__} \nCellpose Version: {__version_cellpose__} \nStardist Version: {__version_stardist__} \nTorch Version: {__version_torch__} \nTensorflow Version: {__version_tensorflow__}" + ) + raise typer.Exit() + + app = typer.Typer( name="MyoQuant", add_completion=False, @@ -15,6 +31,17 @@ app.add_typer(docs_app, name="docs", help="Generate documentation") +@app.callback() +def main( + version: bool = typer.Option( + None, "--version", callback=version_callback, is_eager=True + ) +): + """ + MyoQuant Analysis Command Line Interface + """ + + app.registered_commands += ( run_sdh.app.registered_commands + run_he.app.registered_commands diff --git a/myoquant/src/common_func.py b/myoquant/src/common_func.py index 0a6080e..8fedc65 100644 --- a/myoquant/src/common_func.py +++ b/myoquant/src/common_func.py @@ -181,10 +181,10 @@ def extract_single_image(raw_image, df_props, index, erosion=None): surface_area = df_props.iloc[index, 1] cell_radius = math.sqrt(surface_area / math.pi) single_entity_mask = df_props.iloc[index, 9].copy() - erosion_size = cell_radius * ( - erosion / 100 - ) # Erosion in percentage of the cell radius if erosion is not None: + erosion_size = cell_radius * ( + erosion / 100 + ) # Erosion in percentage of the cell radius for i in range(int(erosion_size)): single_entity_mask = binary_erosion( single_entity_mask, out=single_entity_mask diff --git a/pyproject.toml b/pyproject.toml index 17c5ed4..4fa1821 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "myoquant" -version = "0.3.1" +version = "0.3.2" description = "MyoQuant🔬: a tool to automatically quantify pathological features in muscle fiber histology images." authors = ["Corentin Meyer "] maintainers = ["Corentin Meyer "]