Skip to content

Commit bad2070

Browse files
Major Refactoring 0.3.8
1 parent 7806f01 commit bad2070

34 files changed

+1431
-1447
lines changed
File renamed without changes.

CLI_Documentation.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,6 @@ $ myoquant sdh-analysis [OPTIONS] IMAGE_PATH
141141
**Options**:
142142

143143
- `--mask-path FILE`: The path to a binary mask to hide slide region during analysis. It needs to be of the same resolution as input image and only pixel marked as 1 will be analyzed.
144-
- `--model-path FILE`: The SDH model path to use for analysis. Will download latest one if no path provided.
145144
- `--cellpose-path FILE`: The pre-computed CellPose mask to use for analysis. Will run Cellpose if no path provided. Required as an image file.
146145
- `--output-path PATH`: The path to the folder to save the results. Will save in the current folder if not specified.
147146
- `--cellpose-diameter INTEGER`: Approximative single cell diameter in pixel for CellPose detection. If not specified, Cellpose will try to deduce it.

README.md

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -27,30 +27,29 @@ An online demo with a web interface is available at [https://lbgi.fr/MyoQuant/](
2727
Using pip, you can simply install MyoQuant in a python environment with a simple: `pip install myoquant`
2828

2929
### Installing from sources (Developers)
30-
30+
I recommend using UV for python environment management. See [UV documentation](https://github.com/astral-sh/uv/).
3131
1. Clone this repository using `git clone https://github.com/lambda-science/MyoQuant.git`
32-
2. Create a virtual environment by using `python -m venv .venv`
33-
3. Activate the venv by using `source .venv/bin/activate`
34-
4. Install MyoQuant by using `pip install -e .`
32+
2. Create a virtual environment by using `uv sync`
33+
3. Run Myoquant with `uv run myoquant --help`
3534

3635
## How to Use
3736

38-
To use the command-line tool, first activate your venv in which MyoQuant is installed: `source .venv/bin/activate`
39-
Then you can perform SDH or HE analysis. You can use the command `myoquant --help` to list available commands.
37+
To use the command-line tool, first activate your venv in which MyoQuant is installed: `source .venv/bin/activate` or simply install the package using UV.
38+
Then you can perform SDH or HE analysis. You can use the command `myoquant --help` or `uv run myoquant --help` to list available commands.
4039

41-
## 💡Full command documentation is avaliable here: [CLI Documentation](https://github.com/lambda-science/MyoQuant/blob/main/CLI_Documentation.md)
40+
## 💡Full command documentation is available here: [CLI Documentation](https://github.com/lambda-science/MyoQuant/blob/main/CLI_Documentation.md)
4241

4342
- **For SDH Image Analysis** the command is:
4443
`myoquant sdh-analysis IMAGE_PATH`
4544
Don't forget to run `myoquant sdh-analysis --help` for information about options.
4645
- **For HE Image Analysis** the command is:
4746
`myoquant he-analysis IMAGE_PATH`
48-
Don't forget to run `myoquant he-analysis --help` for information about options.
47+
Don't forget to run `myoquant he-analysis --help` for information about options.
4948
- **For ATP Image Analysis** the command is:
5049
`myoquant atp-analysis IMAGE_PATH`
51-
Don't forget to run `myoquant atp-analysis --help` for information about options.
50+
Don't forget to run `myoquant atp-analysis --help` for information about options.
5251

53-
_If you're running into an issue such as `myoquant: command not found` please check if you activated your virtual environment with the package installed. And also you can try to run it with the full command: `python -m myoquant sdh-analysis --help`_
52+
_If you're running into an issue such as `myoquant: command not found` please check if you activated your virtual environment with the package installed. And also you can try to run it with the full command: `python -m myoquant sdh-analysis --help` or `uv run myoquant sdh-analysis --help`
5453

5554
## Contact
5655

@@ -79,11 +78,6 @@ For ATP Staining analysis, you can download this sample image: [HERE](https://ww
7978

8079
## Advanced information
8180

82-
### Model path and manual download
83-
84-
For the SDH Analysis our custom model will be downloaded and placed inside the myoquant package directory. You can also download it manually here: [https://huggingface.co/corentinm7/MyoQuant-SDH-Model/resolve/main/model.h5](https://huggingface.co/corentinm7/MyoQuant-SDH-Model/resolve/main/model.h5) and then you can place it in the directory of your choice and provide the path to the model file using:
85-
`myoquant sdh-analysis IMAGE_PATH --model_path /path/to/model.h5`
86-
8781
### HuggingFace🤗 repositories for Data and Model
8882

8983
In a effort to push for open-science, MyoQuant [SDH dataset](https://huggingface.co/datasets/corentinm7/MyoQuant-SDH-Data) and [model](https://huggingface.co/corentinm7/MyoQuant-SDH-Model) and availiable on HuggingFace🤗

deploy_hf_space.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
from huggingface_hub import HfApi
2+
api = HfApi()
3+
api.upload_folder(
4+
folder_path="src/myoquant/streamlit",
5+
repo_id="corentinm7/MyoQuant",
6+
repo_type="space",
7+
ignore_patterns=["*.h5", "*.keras"]
8+
)

myoquant/README.md

Whitespace-only changes.

myoquant/streamlit/google_colab_deploy.ipynb

Lines changed: 0 additions & 64 deletions
This file was deleted.

notebooks/atp_exploration.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
"metadata": {},
3131
"outputs": [],
3232
"source": [
33-
"from myoquant.src.common_func import is_gpu_availiable,load_cellpose,run_cellpose\n",
33+
"from myoquant import is_gpu_availiable,load_cellpose,run_cellpose\n",
3434
"import matplotlib.pyplot as plt\n",
3535
"try:\n",
3636
" from imageio.v2 import imread\n",
@@ -260,7 +260,7 @@
260260
"outputs": [],
261261
"source": [
262262
"%config InlineBackend.figure_format = 'retina'\n",
263-
"from myoquant.src.common_func import label2rgb, blend_image_with_label\n",
263+
"from myoquant import label2rgb, blend_image_with_label\n",
264264
"labelRGB_map = label2rgb(image_array, label_map)\n",
265265
"overlay_img = blend_image_with_label(image_array, labelRGB_map)\n",
266266
"\n",

notebooks/example_myoquant_api.ipynb

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@
1414
"import numpy as np\n",
1515
"from PIL import Image\n",
1616
"\n",
17-
"from myoquant.common_func import (\n",
17+
"from common_func import (\n",
1818
" load_cellpose,\n",
1919
" load_sdh_model,\n",
2020
" load_stardist,\n",
2121
" run_cellpose,\n",
2222
" run_stardist,\n",
2323
")\n",
24-
"from myoquant.HE_analysis import run_he_analysis\n",
25-
"from myoquant.SDH_analysis import run_sdh_analysis\n",
24+
"from HE_analysis import run_he_analysis\n",
25+
"from SDH_analysis import run_sdh_analysis\n",
2626
"\n",
2727
"try:\n",
2828
" from imageio.v2 import imread\n",
@@ -31,10 +31,10 @@
3131
]
3232
},
3333
{
34-
"cell_type": "code",
35-
"execution_count": null,
3634
"metadata": {},
35+
"cell_type": "code",
3736
"outputs": [],
37+
"execution_count": null,
3838
"source": [
3939
"# ANALYSE SDH\n",
4040
"\n",
@@ -43,14 +43,6 @@
4343
"output_path = image_path.parents[0]\n",
4444
"Path(output_path).mkdir(parents=True, exist_ok=True)\n",
4545
"\n",
46-
"# Télécharger le modèle SDH\n",
47-
"model_path_abs = Path(os.path.abspath(__file__)).parents[0] / \"model.h5\"\n",
48-
"if not path.exists(model_path_abs):\n",
49-
" urllib.request.urlretrieve(\n",
50-
" \"https://huggingface.co/corentinm7/MyoQuant-SDH-Model/resolve/main/model.h5\",\n",
51-
" model_path_abs,\n",
52-
" )\n",
53-
"model_path = model_path_abs\n",
5446
"\n",
5547
"# Charger Cellpose\n",
5648
"model_cellpose = load_cellpose()\n",
@@ -64,7 +56,7 @@
6456
"Image.fromarray(mask_cellpose).save(output_path / cellpose_mask_filename)\n",
6557
"\n",
6658
"# Faire tourner le modèle SDH sur l'image et récupérer le tableau de sommaire (result_df)\n",
67-
"model_SDH = load_sdh_model(model_path)\n",
59+
"model_SDH = load_sdh_model()\n",
6860
"result_df, full_label_map = run_sdh_analysis(\n",
6961
" image_ndarray_sdh, model_SDH, mask_cellpose\n",
7062
")\n",
@@ -78,10 +70,10 @@
7870
]
7971
},
8072
{
81-
"cell_type": "code",
82-
"execution_count": null,
8373
"metadata": {},
74+
"cell_type": "code",
8475
"outputs": [],
76+
"execution_count": null,
8577
"source": [
8678
"# ANALYSE HE\n",
8779
"\n",

myoquant/pyproject.toml renamed to pyproject.toml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "myoquant"
3-
version = "0.3.5"
3+
version = "0.3.8"
44
description = "MyoQuant🔬: a tool to automatically quantify pathological features in muscle fiber histology images."
55
authors = [{name="Corentin Meyer", email="contact@cmeyer.fr"}]
66
maintainers = [{name="Corentin Meyer", email="contact@cmeyer.fr"}]
@@ -13,9 +13,9 @@ requires-python = "<3.13, >=3.10"
1313
dependencies = [
1414
"tensorflow>=2.19.0",
1515
"keras>=3.9.0",
16-
"cellpose>=3.1.1.1",
16+
"cellpose<4.0.0",
1717
"stardist>=0.9.1",
18-
"numpy<=2.1.0",
18+
"numpy<2.0.0",
1919
"csbdeep>=0.8.1",
2020
"imageio>=2.37.0",
2121
"scikit-image>=0.25.2",
@@ -31,6 +31,7 @@ dependencies = [
3131
"ipykernel>=6.29.5",
3232
"pillow>=11.1.0",
3333
"tifffile>=2025.3.13",
34+
"huggingface-hub>=0.32.4",
3435
]
3536

3637
[project.scripts]
@@ -45,6 +46,7 @@ dev-dependencies = [
4546
"pre-commit",
4647
"mkdocstrings",
4748
"mypy",
49+
"tensorflow-metal>=1.2.0",
4850
]
4951

5052
[project.urls]
File renamed without changes.

0 commit comments

Comments
 (0)