Skip to content

Commit 06966a3

Browse files
author
Corentin
committed
fix treshold not taken in consideration in HE ana
1 parent c6a23db commit 06966a3

File tree

3 files changed

+16
-9
lines changed

3 files changed

+16
-9
lines changed

myoquant/HE_analysis.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ def single_cell_analysis(
7676
x_fiber, y_fiber, coords[1], coords[0]
7777
)
7878
ratio_dist = dist_nuc_cent / dist_out_of_fiber
79-
if ratio_dist < internalised_threshold:
79+
if ratio_dist <= internalised_threshold:
8080
n_nuc_intern += 1
8181
else:
8282
n_nuc_periph += 1
@@ -111,7 +111,12 @@ def predict_all_cells(
111111
x_fiber = cellpose_df.iloc[index, 3] - cellpose_df.iloc[index, 6]
112112
y_fiber = cellpose_df.iloc[index, 2] - cellpose_df.iloc[index, 5]
113113
n_nuc, n_nuc_intern, n_nuc_periph = single_cell_analysis(
114-
single_cell_img, single_cell_mask, df_nuc_single, x_fiber, y_fiber
114+
single_cell_img,
115+
single_cell_mask,
116+
df_nuc_single,
117+
x_fiber,
118+
y_fiber,
119+
internalised_threshold,
115120
)
116121
list_n_nuc.append(n_nuc)
117122
list_n_nuc_intern.append(n_nuc_intern)
@@ -154,7 +159,9 @@ def run_he_analysis(image_ndarray, mask_cellpose, mask_stardist, eccentricity_th
154159
],
155160
)
156161
df_cellpose = pd.DataFrame(props_cellpose)
157-
df_nuc_analysis = predict_all_cells(image_ndarray, df_cellpose, mask_stardist)
162+
df_nuc_analysis = predict_all_cells(
163+
image_ndarray, df_cellpose, mask_stardist, eccentricity_thresh
164+
)
158165

159166
# Result table dict
160167
headers = ["Feature", "Raw Count", "Proportion (%)"]

myoquant/__main__.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -190,16 +190,16 @@ def he_analysis(
190190
help="Approximative single cell diameter in pixel for CellPose detection. If not specified, Cellpose will try to deduce it.",
191191
),
192192
nms_thresh: float = typer.Option(
193-
0.4,
194-
help="NMS Threshold for Stardist nuclei detection.",
193+
0.4, help="NMS Threshold for Stardist nuclei detection.", min=0, max=1
195194
),
196195
prob_thresh: float = typer.Option(
197-
0.5,
198-
help="Probability Threshold for Stardist nuclei detection.",
196+
0.5, help="Probability Threshold for Stardist nuclei detection.", min=0.5, max=1
199197
),
200198
eccentricity_thresh: float = typer.Option(
201199
0.75,
202-
help="Eccentricity threshold value for a nuclei to be considered as internalized during nuclei classification.",
200+
help="Eccentricity threshold value for a nuclei to be considered as internalized during nuclei classification. When very close to 1 almost all nuclei are considered as internalized.",
201+
min=0,
202+
max=1,
203203
),
204204
):
205205
"""Run the HE analysis and quantification on the image."""

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "myoquant"
3-
version = "0.1.6"
3+
version = "0.1.7"
44
description = "MyoQuant🔬: a tool to automatically quantify pathological features in muscle fiber histology images."
55
authors = ["Corentin Meyer <[email protected]>"]
66
maintainers = ["Corentin Meyer <[email protected]>"]

0 commit comments

Comments
 (0)