From fdf08f02bfed0d6760367f01328606bf003029f3 Mon Sep 17 00:00:00 2001 From: Joeran Date: Wed, 23 Mar 2022 16:33:38 +0100 Subject: [PATCH] Match structure in dynamic adjacency detection --- setup.py | 2 +- .../extract_lesion_candidates.py | 11 ++--------- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/setup.py b/setup.py index 597e25e..e3568c0 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ long_description = fh.read() setuptools.setup( - version='0.2.2', + version='0.2.3', author_email='Joeran.Bosma@radboudumc.nl', long_description=long_description, long_description_content_type="text/markdown", diff --git a/src/report_guided_annotation/extract_lesion_candidates.py b/src/report_guided_annotation/extract_lesion_candidates.py index b3714b4..90b44a1 100644 --- a/src/report_guided_annotation/extract_lesion_candidates.py +++ b/src/report_guided_annotation/extract_lesion_candidates.py @@ -102,15 +102,8 @@ def preprocess_softmax_dynamic( # create mask with its confidence hard_blob = (all_hard_blobs * mask_current_lesion) - # Detect whether the extractted mask is a ring/hollow sphere - # around an existing lesion candidate. For confident lesions, - # the surroundings of the prediction are still quite confident, - # and can become a second 'detection'. For an # example, please - # see extracted lesion candidates nr. 4 and 5 at: - # https://repos.diagnijmegen.nl/trac/ticket/9299#comment:49 - # Detection method: grow currently extracted lesions by one voxel, - # and check if they overlap with the current extracted lesion. - extracted_lesions_grown = ndimage.morphology.binary_dilation(dynamic_hard_blobs > 0) + # Detect whether the extractted mask is too close to an existing lesion candidate + extracted_lesions_grown = ndimage.morphology.binary_dilation(dynamic_hard_blobs > 0, structure=np.ones((3, 3, 3))) current_lesion_has_overlap = (mask_current_lesion & extracted_lesions_grown).any() # Check if lesion candidate should be retained