Skip to content

Commit

Permalink
List Comprehension for ITC (#2906)
Browse files Browse the repository at this point in the history
  • Loading branch information
bhashemian authored Sep 8, 2021
1 parent b770793 commit e24f1b1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
5 changes: 1 addition & 4 deletions monai/apps/pathology/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,7 @@ def compute_isolated_tumor_cells(tumor_mask: np.ndarray, threshold: float) -> Li
"""
max_label = np.amax(tumor_mask)
properties = measure.regionprops(tumor_mask, coordinates="rc")
itc_list = []
for i in range(max_label): # type: ignore
if properties[i].major_axis_length < threshold:
itc_list.append(i + 1)
itc_list = [i + 1 for i in range(max_label) if properties[i].major_axis_length < threshold]

return itc_list

Expand Down
2 changes: 1 addition & 1 deletion monai/handlers/garbage_collector.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def __call__(self, engine: Engine) -> None:
"""
# get count before garbage collection
pre_count = gc.get_count()
# fits call to garbage collector
# first call to garbage collector
gc.collect()
# second call to garbage collector
unreachable = gc.collect()
Expand Down

0 comments on commit e24f1b1

Please sign in to comment.