From a6321cf54775d758661f2353e3ff7913c003ff4e Mon Sep 17 00:00:00 2001 From: MStarmans91 Date: Tue, 27 Oct 2020 11:14:27 +0100 Subject: [PATCH 1/5] Minor bugfix in preprocessing --- WORC/processing/preprocessing.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/WORC/processing/preprocessing.py b/WORC/processing/preprocessing.py index 62a7bdcf..c15a8888 100644 --- a/WORC/processing/preprocessing.py +++ b/WORC/processing/preprocessing.py @@ -60,8 +60,19 @@ def preprocess(imagefile, config, metadata=None, mask=None): if image.GetSpacing() == (1, 1, 1): print('Detected 1x1x1 spacing, overwriting with DICOM metadata.') - slice_thickness = metadata[0x18, 0x50].value - pixel_spacing = metadata[0x28, 0x30].value + if [0x18, 0x50] in list(metadata.keys()): + slice_thickness = metadata[0x18, 0x50].value + elif [0x18, 0x88] in list(metadata.keys()): + # Take spacing between slices + slice_thickness = metadata[0x18, 0x88].value + else: + slice_thickness = 1.0 + + if [0x28, 0x30] in list(metadata.keys()): + pixel_spacing = metadata[0x28, 0x30].value + else: + pixel_spacing = [1.0, 1.0] + spacing = (float(pixel_spacing[0]), float(pixel_spacing[1]), float(slice_thickness)) From 9b773e63db26393e0654acdfd595fd8b7a0bdec4 Mon Sep 17 00:00:00 2001 From: MStarmans91 Date: Wed, 28 Oct 2020 13:37:04 +0100 Subject: [PATCH 2/5] Back to original doc building after readthedocs fix --- .readthedocs.yml | 1 - WORC/WORC.py | 2 +- WORC/doc/doc_requirements.txt | 3 --- WORC/tools/Evaluate.py | 20 +++++++++++++++++++- 4 files changed, 20 insertions(+), 6 deletions(-) delete mode 100644 WORC/doc/doc_requirements.txt diff --git a/.readthedocs.yml b/.readthedocs.yml index c168b8f6..1ee37c11 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -8,5 +8,4 @@ sphinx: python: version: 3.7 install: - - requirements: WORC/doc/doc_requirements.txt - requirements: requirements.txt diff --git a/WORC/WORC.py b/WORC/WORC.py index 7f9a9c1a..395efa35 100644 --- a/WORC/WORC.py +++ b/WORC/WORC.py @@ -207,10 +207,10 @@ def defaultconfig(self): config['Preprocessing']['Clipping_Range'] = '-1000.0, 3000.0' config['Preprocessing']['Normalize'] = 'True' config['Preprocessing']['Normalize_ROI'] = 'Full' + config['Preprocessing']['Method'] = 'z_score' config['Preprocessing']['ROIDetermine'] = 'Provided' config['Preprocessing']['ROIdilate'] = 'False' config['Preprocessing']['ROIdilateradius'] = '10' - config['Preprocessing']['Method'] = 'z_score' config['Preprocessing']['Resampling'] = 'False' config['Preprocessing']['Resampling_spacing'] = '1, 1, 1' config['Preprocessing']['BiasCorrection'] = 'False' diff --git a/WORC/doc/doc_requirements.txt b/WORC/doc/doc_requirements.txt deleted file mode 100644 index 910beb5f..00000000 --- a/WORC/doc/doc_requirements.txt +++ /dev/null @@ -1,3 +0,0 @@ -pillow>=6.2.0 -matplotlib>=3.3.2 -Pygments==2.7.1 diff --git a/WORC/tools/Evaluate.py b/WORC/tools/Evaluate.py index 462a6d63..818b182c 100644 --- a/WORC/tools/Evaluate.py +++ b/WORC/tools/Evaluate.py @@ -449,7 +449,25 @@ def create_links_Addon(self): self.node_Ranked_Posteriors.inputs['estimator'] = prediction self.node_Ranked_Posteriors.inputs['pinfo'] = pinfo - if self.parent.sources_images_train: + if self.parent.sources_images_test: + images = self.parent.sources_images_test[label].output + segmentations =\ + self.parent.sources_segmentations_test[label].output + self.link_images_perc =\ + self.network.create_link(images, self.node_Ranked_Percentages.inputs['images']) + self.link_images_perc.collapse = 'test' + self.link_segmentations_perc =\ + self.network.create_link(segmentations, self.node_Ranked_Percentages.inputs['segmentations']) + self.link_segmentations_perc.collapse = 'test' + + self.link_images_post =\ + self.network.create_link(images, self.node_Ranked_Posteriors.inputs['images']) + self.link_images_post.collapse = 'test' + self.link_segmentations_post =\ + self.network.create_link(segmentations, self.node_Ranked_Posteriors.inputs['segmentations']) + self.link_segmentations_post.collapse = 'test' + + elif self.parent.sources_images_train: self.link_images_perc =\ self.network.create_link(images, self.node_Ranked_Percentages.inputs['images']) self.link_images_perc.collapse = 'train' From 4fbf13d9bb17235fc0d94acd229a87b9ad984313 Mon Sep 17 00:00:00 2001 From: MStarmans91 Date: Wed, 28 Oct 2020 13:41:03 +0100 Subject: [PATCH 3/5] Update .readthedocs.yml --- .readthedocs.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.readthedocs.yml b/.readthedocs.yml index 1ee37c11..419bbfd9 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -5,7 +5,11 @@ version: 2 sphinx: configuration: WORC/doc/conf.py +formats: [] + +build: + image: latest + python: version: 3.7 - install: - - requirements: requirements.txt + pip_install: true From 2ba5dae271de906b60a1d88be08a4f748f815b1c Mon Sep 17 00:00:00 2001 From: MStarmans91 Date: Wed, 28 Oct 2020 13:42:31 +0100 Subject: [PATCH 4/5] Update .readthedocs.yml --- .readthedocs.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.readthedocs.yml b/.readthedocs.yml index 419bbfd9..40ca54a0 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -7,9 +7,9 @@ sphinx: formats: [] -build: - image: latest - python: version: 3.7 - pip_install: true + install: + - method: pip + path: . + - requirements: requirements.txt From e5b5be8f3e0b9cd6c681418a8eb9a367f26661b5 Mon Sep 17 00:00:00 2001 From: MStarmans91 Date: Wed, 28 Oct 2020 13:55:58 +0100 Subject: [PATCH 5/5] Update .readthedocs.yml --- .readthedocs.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.readthedocs.yml b/.readthedocs.yml index 40ca54a0..7fdaad96 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -10,6 +10,7 @@ formats: [] python: version: 3.7 install: + - requirements: requirements.txt - method: pip path: . - - requirements: requirements.txt + system_packages: true