deepliif 1.2.0__py3-none-any.whl → 1.2.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- deepliif/postprocessing.py +41 -13
- deepliif/util/__init__.py +6 -4
- {deepliif-1.2.0.dist-info → deepliif-1.2.2.dist-info}/METADATA +3 -3
- {deepliif-1.2.0.dist-info → deepliif-1.2.2.dist-info}/RECORD +8 -17
- deepliif/models/__init__ - different weighted.py +0 -762
- deepliif/models/__init__ - multiprocessing (failure).py +0 -980
- deepliif/models/__init__ - run_dask_multi dev.py +0 -943
- deepliif/models/__init__ - time gens.py +0 -792
- deepliif/models/__init__ - timings.py +0 -764
- deepliif/models/__init__ - weights, empty, zarr, tile count.py +0 -792
- deepliif/postprocessing__OLD__DELETE.py +0 -440
- deepliif/train.py +0 -280
- deepliif/util/util - modified tensor_to_pil.py +0 -255
- {deepliif-1.2.0.dist-info → deepliif-1.2.2.dist-info}/LICENSE.md +0 -0
- {deepliif-1.2.0.dist-info → deepliif-1.2.2.dist-info}/WHEEL +0 -0
- {deepliif-1.2.0.dist-info → deepliif-1.2.2.dist-info}/entry_points.txt +0 -0
- {deepliif-1.2.0.dist-info → deepliif-1.2.2.dist-info}/top_level.txt +0 -0
deepliif/postprocessing.py
CHANGED
|
@@ -938,16 +938,11 @@ def create_cell_classification(mask, cellsinfo,
|
|
|
938
938
|
idx = (seed[0] + n[0], seed[1] + n[1])
|
|
939
939
|
if in_bounds(mask, idx) and mask[idx] == LABEL_CELL:
|
|
940
940
|
seeds.append(idx)
|
|
941
|
-
is_boundary = False
|
|
942
941
|
for n in border_neighbors:
|
|
943
942
|
idx2 = (idx[0] + n[0], idx[1] + n[1])
|
|
944
943
|
if in_bounds(mask, idx2) and mask[idx2] == LABEL_BACKGROUND:
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
if is_boundary:
|
|
948
|
-
mask[idx] = label_border
|
|
949
|
-
else:
|
|
950
|
-
mask[idx] = label
|
|
944
|
+
mask[idx2] = label_border
|
|
945
|
+
mask[idx] = label
|
|
951
946
|
|
|
952
947
|
num_total = num_pos + num_neg
|
|
953
948
|
return {
|
|
@@ -976,7 +971,7 @@ def enlarge_cell_boundaries(mask):
|
|
|
976
971
|
value = LABEL_BORDER_POS2 if mask[y, x] == LABEL_BORDER_POS else LABEL_BORDER_NEG2
|
|
977
972
|
for n in neighbors:
|
|
978
973
|
idx = (y + n[0], x + n[1])
|
|
979
|
-
if in_bounds(mask, idx) and mask[idx]
|
|
974
|
+
if in_bounds(mask, idx) and mask[idx] == LABEL_BACKGROUND:
|
|
980
975
|
mask[idx] = value
|
|
981
976
|
|
|
982
977
|
for y in range(mask.shape[0]):
|
|
@@ -1048,22 +1043,52 @@ def fill_cells(mask):
|
|
|
1048
1043
|
else:
|
|
1049
1044
|
mask[y, x] = LABEL_NEGATIVE
|
|
1050
1045
|
|
|
1046
|
+
for y in range(mask.shape[0]):
|
|
1047
|
+
for x in range(mask.shape[1]):
|
|
1048
|
+
if mask[y, x] == LABEL_BORDER_POS:
|
|
1049
|
+
mask[y, x] = LABEL_POSITIVE
|
|
1050
|
+
elif mask[y, x] == LABEL_BORDER_NEG:
|
|
1051
|
+
mask[y, x] = LABEL_NEGATIVE
|
|
1052
|
+
|
|
1053
|
+
|
|
1054
|
+
@jit(nopython=True)
|
|
1055
|
+
def create_outer_boundary(mask):
|
|
1056
|
+
"""
|
|
1057
|
+
For a mask with positive and negative cell labels,
|
|
1058
|
+
set pixels neighboring the cells in-place to border labels.
|
|
1059
|
+
|
|
1060
|
+
Parameters
|
|
1061
|
+
----------
|
|
1062
|
+
mask : ndarray
|
|
1063
|
+
2D uint8 label map.
|
|
1064
|
+
"""
|
|
1065
|
+
|
|
1066
|
+
border_neighbors = [(0, -1), (-1, 0), (1, 0), (0, 1)]
|
|
1067
|
+
|
|
1068
|
+
for y in range(mask.shape[0]):
|
|
1069
|
+
for x in range(mask.shape[1]):
|
|
1070
|
+
if mask[y, x] == LABEL_POSITIVE or mask[y, x] == LABEL_NEGATIVE:
|
|
1071
|
+
for n in border_neighbors:
|
|
1072
|
+
idx2 = (y + n[0], x + n[1])
|
|
1073
|
+
if in_bounds(mask, idx2) and mask[idx2] == LABEL_BACKGROUND:
|
|
1074
|
+
mask[idx2] = LABEL_BORDER_POS if mask[y, x] == LABEL_POSITIVE else LABEL_BORDER_NEG
|
|
1075
|
+
|
|
1051
1076
|
|
|
1052
1077
|
def calculate_large_noise_thresh(large_noise_thresh, resolution):
|
|
1053
1078
|
if large_noise_thresh != 'default':
|
|
1054
1079
|
return large_noise_thresh
|
|
1055
1080
|
if resolution == '10x':
|
|
1056
|
-
return 250
|
|
1057
|
-
elif resolution == '20x':
|
|
1058
1081
|
return 1000
|
|
1059
|
-
|
|
1082
|
+
elif resolution == '20x':
|
|
1060
1083
|
return 4000
|
|
1084
|
+
else: # 40x
|
|
1085
|
+
return 16000
|
|
1061
1086
|
|
|
1062
1087
|
|
|
1063
1088
|
def compute_cell_results(seg, marker, resolution, version=3,
|
|
1064
1089
|
seg_thresh=DEFAULT_SEG_THRESH,
|
|
1065
1090
|
noise_thresh=DEFAULT_NOISE_THRESH,
|
|
1066
|
-
large_noise_thresh=
|
|
1091
|
+
large_noise_thresh=None):
|
|
1067
1092
|
"""
|
|
1068
1093
|
Perform postprocessing to compute individual cell results.
|
|
1069
1094
|
|
|
@@ -1134,7 +1159,7 @@ def compute_final_results(orig, seg, marker, resolution,
|
|
|
1134
1159
|
size_thresh_upper=None,
|
|
1135
1160
|
seg_thresh=DEFAULT_SEG_THRESH,
|
|
1136
1161
|
noise_thresh=DEFAULT_NOISE_THRESH,
|
|
1137
|
-
large_noise_thresh=
|
|
1162
|
+
large_noise_thresh=None):
|
|
1138
1163
|
"""
|
|
1139
1164
|
Perform postprocessing to compute final count and image results.
|
|
1140
1165
|
|
|
@@ -1184,6 +1209,7 @@ def compute_final_results(orig, seg, marker, resolution,
|
|
|
1184
1209
|
|
|
1185
1210
|
counts = create_cell_classification(mask, cellsinfo, size_thresh, marker_thresh, size_thresh_upper)
|
|
1186
1211
|
enlarge_cell_boundaries(mask)
|
|
1212
|
+
enlarge_cell_boundaries(mask)
|
|
1187
1213
|
overlay, refined = create_final_images(np.array(orig), mask)
|
|
1188
1214
|
|
|
1189
1215
|
scoring = {
|
|
@@ -1260,6 +1286,8 @@ def cells_to_final_results(data, orig,
|
|
|
1260
1286
|
mark_background(mask)
|
|
1261
1287
|
fill_cells(mask)
|
|
1262
1288
|
|
|
1289
|
+
create_outer_boundary(mask)
|
|
1290
|
+
enlarge_cell_boundaries(mask)
|
|
1263
1291
|
enlarge_cell_boundaries(mask)
|
|
1264
1292
|
overlay, refined = create_final_images(np.array(orig), mask)
|
|
1265
1293
|
|
deepliif/util/__init__.py
CHANGED
|
@@ -489,9 +489,8 @@ class WSIReader:
|
|
|
489
489
|
self._file.close()
|
|
490
490
|
|
|
491
491
|
self._bfreader = None
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
self._bfreader = bioformats.ImageReader(path)
|
|
492
|
+
self._rescale = (self._pixel_type != 'uint8')
|
|
493
|
+
self._bfreader = bioformats.ImageReader(path)
|
|
495
494
|
|
|
496
495
|
if self._tif is None and self._bfreader is None:
|
|
497
496
|
raise Exception('Cannot read WSI file.')
|
|
@@ -520,7 +519,10 @@ class WSIReader:
|
|
|
520
519
|
def read(self, xywh):
|
|
521
520
|
if self._tif is not None:
|
|
522
521
|
x, y, w, h = xywh
|
|
523
|
-
|
|
522
|
+
try:
|
|
523
|
+
return self._zarr[y:y+h, x:x+w]
|
|
524
|
+
except Exception as e:
|
|
525
|
+
pass
|
|
524
526
|
|
|
525
527
|
px = self._bfreader.read(XYWH=xywh, rescale=self._rescale)
|
|
526
528
|
if self._rescale:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: deepliif
|
|
3
|
-
Version: 1.2.
|
|
3
|
+
Version: 1.2.2
|
|
4
4
|
Summary: DeepLIIF: Deep-Learning Inferred Multiplex Immunofluorescence for Immunohistochemical Image Quantification
|
|
5
5
|
Home-page: https://github.com/nadeemlab/DeepLIIF
|
|
6
6
|
Author: Parmida93
|
|
@@ -9,7 +9,7 @@ Keywords: DeepLIIF,IHC,Segmentation,Classification
|
|
|
9
9
|
Description-Content-Type: text/markdown
|
|
10
10
|
License-File: LICENSE.md
|
|
11
11
|
Requires-Dist: opencv-python (==4.8.1.78)
|
|
12
|
-
Requires-Dist: torch (==
|
|
12
|
+
Requires-Dist: torch (==2.8.0)
|
|
13
13
|
Requires-Dist: torchvision (==0.14.1)
|
|
14
14
|
Requires-Dist: scikit-image (==0.18.3)
|
|
15
15
|
Requires-Dist: dominate (==2.6.0)
|
|
@@ -66,7 +66,7 @@ segmentation.*
|
|
|
66
66
|
|
|
67
67
|
© This code is made available for non-commercial academic purposes.
|
|
68
68
|
|
|
69
|
-

|
|
70
70
|
[](https://pepy.tech/project/deepliif?&left_text=totalusers)
|
|
71
71
|
|
|
72
72
|
*Overview of DeepLIIF pipeline and sample input IHCs (different
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
cli.py,sha256=luwzcSrRZMePfJ-h4Hgz2X7lYC70TUVxGfEo3LyPJgQ,58938
|
|
2
2
|
deepliif/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
|
-
deepliif/postprocessing.py,sha256=
|
|
4
|
-
deepliif/postprocessing__OLD__DELETE.py,sha256=cM-cYVidY691Sjb1-B8a1jkLq5UR_hTCbuKzuF4765o,17589
|
|
5
|
-
deepliif/train.py,sha256=-ZORL5vQrD0_Jq2Adgr3w8vJ7L1QcAgNTqMnBgtixgk,15757
|
|
3
|
+
deepliif/postprocessing.py,sha256=Uu4axoOLgPgBgXxSVAgviuLi9cr4U_eE4KgFLbleMro,43512
|
|
6
4
|
deepliif/data/__init__.py,sha256=IfqVFnFSPQJZnORdRq4sNkJiylr1TaKNmhvWP_aLHdg,5492
|
|
7
5
|
deepliif/data/aligned_dataset.py,sha256=CkKXj94ANSi8RdhpRQjVETFYlRMER2XErIf-87BStTE,5175
|
|
8
6
|
deepliif/data/base_dataset.py,sha256=bQlxfY7bGSE9WPj31ZHkCxv5CAEJovjakGDCcK-aYdc,5564
|
|
@@ -16,12 +14,6 @@ deepliif/models/DeepLIIFExt_model.py,sha256=HZaX9Z2ue0HQCFFN3guLkBcByCP70i8JvmPY
|
|
|
16
14
|
deepliif/models/DeepLIIFKD_model.py,sha256=edq9fxrDspGivuFlAYZp9B0Opp3BRIosA9e1TI_gxpc,27152
|
|
17
15
|
deepliif/models/DeepLIIF_model.py,sha256=6vmsXcBcoALrhJLa7XGhDmLamO_WCzTDYEyVUBE482o,23857
|
|
18
16
|
deepliif/models/SDG_model.py,sha256=3opz7uEyhvVJ8fF4_Jw4ho1MBcc9OVye-ByZD_KF2j0,10142
|
|
19
|
-
deepliif/models/__init__ - different weighted.py,sha256=Oe6ichU-Qia2mODGUtQTh1OBZZnv5N-93AzOfzQiHlw,32227
|
|
20
|
-
deepliif/models/__init__ - multiprocessing (failure).py,sha256=bxM2hTvpdwzz3DG6Fbxu03C4MHsEE9lF_rd34TwiGOg,39835
|
|
21
|
-
deepliif/models/__init__ - run_dask_multi dev.py,sha256=vt8X8qeiJr2aPhFi6muZEJLUSsr8XChfI45NSwL8Rfg,39449
|
|
22
|
-
deepliif/models/__init__ - time gens.py,sha256=mRUtxNaGDZuhlQtKdA-OvGWTQwl7z2yMWc-9l0QrgaY,32922
|
|
23
|
-
deepliif/models/__init__ - timings.py,sha256=S_wFImwxzGKx8STqbpcYCPOlbb_84WLMRDSnaWC8qFg,31750
|
|
24
|
-
"deepliif/models/__init__ - weights, empty, zarr, tile count.py",sha256=JsU9ui0Kv8AzlP3_1LeiNrQLHg9X_3r8WwYy3W4JgfA,33315
|
|
25
17
|
deepliif/models/__init__.py,sha256=FLMYnTyF4XvsSqN11df4a7dqFuB8-Nq4pQnTskL2DUE,34398
|
|
26
18
|
deepliif/models/att_unet.py,sha256=tqaFMNbGQUjXObOG309P76c7sIPxEvFR38EyuyHY40o,7116
|
|
27
19
|
deepliif/models/base_model.py,sha256=ZQBI-wVfDdu296HzB_YzQraE9oUwfyRlAolNlrMi-4g,16858
|
|
@@ -31,17 +23,16 @@ deepliif/options/base_options.py,sha256=m5UXY8MvjNcDisUWuiP228yoT27SsCh1bXS_Td6S
|
|
|
31
23
|
deepliif/options/processing_options.py,sha256=OnNT-ytoTQzetFiMEKrWvrsrhZlupRK4smcnIk0MbqY,2947
|
|
32
24
|
deepliif/options/test_options.py,sha256=4ZbQC5U-nTbUz8jvdDIbse5TK_mjw4D5yNjpVevWD5M,1114
|
|
33
25
|
deepliif/options/train_options.py,sha256=5eA_oxpRj2-HiuMMvC5-HLapxNFG_JXOQ3K132JjpR8,3580
|
|
34
|
-
deepliif/util/__init__.py,sha256=
|
|
26
|
+
deepliif/util/__init__.py,sha256=Vl_mUSCFLWZiX-eN9I-DBrbJlW29G8nPo8b5Je5pHnY,31582
|
|
35
27
|
deepliif/util/checks.py,sha256=xQirKbZxZErsAXc27M5miQUUyxptoIEJSDaUKv1nY7c,1371
|
|
36
28
|
deepliif/util/get_data.py,sha256=HaRoQYb2u0LUgLT7ES-w35AmJ4BrlBEJWU4Cok29pxI,3749
|
|
37
29
|
deepliif/util/html.py,sha256=RNAONZ4opP-bViahgmpSbHwOc6jXKQRnWRAVIaeIvac,3309
|
|
38
30
|
deepliif/util/image_pool.py,sha256=M89Hc7DblRWroNP71S9mAdRn7h3DrhPFPjqFxxZYSgw,2280
|
|
39
|
-
deepliif/util/util - modified tensor_to_pil.py,sha256=fd2SeSuiWIuUIOx4FWhGGw8mP7zsfShlMM2l1tQAWQU,8438
|
|
40
31
|
deepliif/util/util.py,sha256=WV2a1Rt-McmZm3BKW7TqC2oAKkvxWhZvjofGSfY6y7s,6810
|
|
41
32
|
deepliif/util/visualizer.py,sha256=6E1sPbXdgLFB9mnPwtfEjm9O40viG4dfv5MyTpOQQpo,20210
|
|
42
|
-
deepliif-1.2.
|
|
43
|
-
deepliif-1.2.
|
|
44
|
-
deepliif-1.2.
|
|
45
|
-
deepliif-1.2.
|
|
46
|
-
deepliif-1.2.
|
|
47
|
-
deepliif-1.2.
|
|
33
|
+
deepliif-1.2.2.dist-info/LICENSE.md,sha256=HlZw_UPS6EtJimJ_Ci7xKh-S5Iubs0Z8y8E6EZ3ZNyE,956
|
|
34
|
+
deepliif-1.2.2.dist-info/METADATA,sha256=qaQ--slj1E0Ypwo-uyrM4u2aWNnJxlyjpNgavWwQUYQ,35266
|
|
35
|
+
deepliif-1.2.2.dist-info/WHEEL,sha256=pkctZYzUS4AYVn6dJ-7367OJZivF2e8RA9b_ZBjif18,92
|
|
36
|
+
deepliif-1.2.2.dist-info/entry_points.txt,sha256=f70-10j2q68o_rDlsE3hspnv4ejlDnXwwGZ9JJ-3yF4,37
|
|
37
|
+
deepliif-1.2.2.dist-info/top_level.txt,sha256=vLDK5YKmDz08E7PywuvEjAo7dM5rnIpsjR4c0ubQCnc,13
|
|
38
|
+
deepliif-1.2.2.dist-info/RECORD,,
|