From d329d29a2d181b9c33a7740fe17c501b2074a998 Mon Sep 17 00:00:00 2001 From: Rakkalos <72577931+Rakkalos@users.noreply.github.com> Date: Wed, 29 Nov 2023 16:07:49 -0500 Subject: [PATCH 1/6] added task024 promise nnunet model --- .../nnunet_prostate_task24/config/default.yml | 41 ++++++ .../dockerfiles/Dockerfile | 32 +++++ models/nnunet_prostate_task24/meta.json | 125 ++++++++++++++++++ 3 files changed, 198 insertions(+) create mode 100644 models/nnunet_prostate_task24/config/default.yml create mode 100644 models/nnunet_prostate_task24/dockerfiles/Dockerfile create mode 100644 models/nnunet_prostate_task24/meta.json diff --git a/models/nnunet_prostate_task24/config/default.yml b/models/nnunet_prostate_task24/config/default.yml new file mode 100644 index 00000000..f12c1f44 --- /dev/null +++ b/models/nnunet_prostate_task24/config/default.yml @@ -0,0 +1,41 @@ +general: + data_base_dir: /app/data + version: 1.0 + description: default configuration for nnUNet MR Prostate segmentation (dicom to dicom) + +execute: +- DicomImporter +- NiftiConverter +- NNUnetRunner +- DsegConverter +- DataOrganizer + +modules: + DicomImporter: + source_dir: input_data + import_dir: sorted_data + sort_data: true + meta: + mod: 'mr' + + NiftiConverter: + in_datas: dicom:mod=mr + engine: dcm2niix + + NNUnetRunner: + in_data: nifti:mod=mr + nnunet_task: Task024_Promise + nnunet_model: 3d_fullres + roi: PROSTATE + + BamfProcessorRunner: + + DsegConverter: + source_segs: nifti:mod=seg + target_dicom: dicom:mod=mr + model_name: 'nnUNet MR Prostate' + skip_empty_slices: True + + DataOrganizer: + targets: + - dicomseg-->[i:sid]/nnunet_mr_prostate.seg.dcm \ No newline at end of file diff --git a/models/nnunet_prostate_task24/dockerfiles/Dockerfile b/models/nnunet_prostate_task24/dockerfiles/Dockerfile new file mode 100644 index 00000000..5ad3ab81 --- /dev/null +++ b/models/nnunet_prostate_task24/dockerfiles/Dockerfile @@ -0,0 +1,32 @@ +FROM mhubai/base:latest + +# FIXME: set this environment variable as a shortcut to avoid nnunet crashing the build +# by pulling sklearn instead of scikit-learn +# N.B. this is a known issue: +# https://github.com/MIC-DKFZ/nnUNet/issues/1281 +# https://github.com/MIC-DKFZ/nnUNet/pull/1209 +ENV SKLEARN_ALLOW_DEPRECATED_SKLEARN_PACKAGE_INSTALL=True + +# Install nnunet and platipy +RUN pip3 install --no-cache-dir \ + nnunet + +# Clone the main branch of MHubAI/models +ARG MHUB_MODELS_REPO +RUN buildutils/import_mhub_model.sh nnunet_prostate_task24 ${MHUB_MODELS_REPO} + +# Pull weights into the container +ENV WEIGHTS_DIR=/root/.nnunet/nnUNet_models/nnUNet/ +RUN mkdir -p $WEIGHTS_DIR +ENV WEIGHTS_FN=Task024_Promise.zip +ENV WEIGHTS_URL=https://zenodo.org/records/4003545/files/$WEIGHTS_FN +RUN wget --directory-prefix ${WEIGHTS_DIR} ${WEIGHTS_URL} +RUN unzip ${WEIGHTS_DIR}${WEIGHTS_FN} -d ${WEIGHTS_DIR} +RUN rm ${WEIGHTS_DIR}${WEIGHTS_FN} + +# specify nnunet specific environment variables +ENV WEIGHTS_FOLDER=$WEIGHTS_DIR + +# Default run script +ENTRYPOINT ["mhub.run"] +CMD ["--config", "/app/models/nnunet_prostate_task24/config/default.yml"] diff --git a/models/nnunet_prostate_task24/meta.json b/models/nnunet_prostate_task24/meta.json new file mode 100644 index 00000000..ee24e409 --- /dev/null +++ b/models/nnunet_prostate_task24/meta.json @@ -0,0 +1,125 @@ +{ + "id": "...", + "name": "nnunet_prostate_task24_promise", + "title": "nnU-Net (Whole prostate segmentation)", + "summary": { + "description": "nnU-Net's whole prostate segmentation model is a single-modality (i.e. T2) input AI-based pipeline for the automated segmentation of the whole prostate on MRI scans.", + "inputs": [ + { + "label": "T2 input image", + "description": "The T2 axial-acquired sequence being the input image", + "format": "DICOM", + "modality": "MR", + "bodypartexamined": "Prostate", + "slicethickness": "3.6 mm", + "non-contrast": true, + "contrast": false + } + ], + "outputs": [ + { + "type": "Segmentation", + "classes": [ + "PROSTATE" + ] + } + ], + "model": { + "architecture": "U-net", + "training": "supervised", + "cmpapproach": "3D" + }, + "data": { + "training": { + "vol_samples": 50 + }, + "test": { + "vol_samples": 30 + }, + "public": true, + "external": false + } + }, + "details": { + "name": "nnU-Net whole prostate segmentation model", + "version": "1.0.0", + "devteam": "MIC-DKFZ (Helmholtz Imaging Applied Computer Vision Lab)", + "type": "nnU-Net (U-Net structure, optimized by data-driven heuristics)", + "date": { + "weights": "2020", + "code": "2020", + "pub": "2020" + }, + "cite": "Isensee, F., Jaeger, P. F., Kohl, S. A., Petersen, J., & Maier-Hein, K. H. (2020). nnU-Net: a self-configuring method for deep learning-based biomedical image segmentation. Nature Methods, 1-9.", + "license": { + "code": "Apache 2.0", + "weights": "CC BY-NC 4.0" + }, + "publications": [ + { + "title": "nnU-Net: a self-configuring method for deep learning-based biomedical image segmentation", + "uri": "https://www.nature.com/articles/s41592-020-01008-z" + } + ], + "github": "https://github.com/MIC-DKFZ/nnUNet/tree/nnunetv1", + "zenodo": "https://zenodo.org/record/4485926" + }, + "info": { + "use": { + "title": "Intended Use", + "text": "This model is intended to perform prostate anatomy segmentation in MR T2 scans. The slice thickness of the training data is 2.2~4mm. Endorectal coil was present during training." + }, + "analyses": { + "title": "Quantitative Analyses", + "text": "The model's performance was assessed using the Dice Coefficient, in the context of the Promise12 challenge. The complete breakdown of the metrics can be consulted on GrandChallenge [1] and is reported in the supplementary material to the publication [2].", + "references": [ + { + "label": "Evaluation of prostate segmentation algorithms for MRI: The PROMISE12 challenge", + "uri": "https://doi.org/10.1016/j.media.2013.12.002" + }, + { + "label": "nnU-Net: a self-configuring method for deep learning-based biomedical image segmentation", + "uri": "https://www.nature.com/articles/s41592-020-01008-z" + } + ] + }, + "evaluation": { + "title": "Testing Data", + "text": "The test dataset consists of 30 test samples coming from the same training collection.", + "tables": [], + "references": [ + { + "label": "Evaluation of prostate segmentation algorithms for MRI: The PROMISE12 challenge", + "uri": "https://doi.org/10.1016/j.media.2013.12.002" + }, + { + "label": "PROMISE12 dataset (direct download)", + "uri": "https://zenodo.org/records/8026660" + } + ] + }, + "training": { + "title": "Training Data", + "text": "The training dataset consists of 50 MRI cases containing the prostate, from the Promise12 challenge. The authors report the following characteristics for the training dataset:", + "tables": [ + { + "label": "Medical Image Decathlon dataset (training)", + "entries": { + "Slice Thickness": "2.2~4 mm", + "In-Plane Resolution": "0.27 mm" + } + } + ], + "references": [ + { + "label": "Evaluation of prostate segmentation algorithms for MRI: The PROMISE12 challenge", + "uri": "https://doi.org/10.1016/j.media.2013.12.002" + }, + { + "label": "PROMISE12 dataset (direct download)", + "uri": "https://zenodo.org/records/8026660" + } + ] + } + } +} \ No newline at end of file From f2221028d26645584a4d662a112762e41d6d5c89 Mon Sep 17 00:00:00 2001 From: Rakkalos <72577931+Rakkalos@users.noreply.github.com> Date: Wed, 29 Nov 2023 16:22:47 -0500 Subject: [PATCH 2/6] changed test to evaluation in meta.json --- models/nnunet_prostate_task24/meta.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/models/nnunet_prostate_task24/meta.json b/models/nnunet_prostate_task24/meta.json index ee24e409..50c4e568 100644 --- a/models/nnunet_prostate_task24/meta.json +++ b/models/nnunet_prostate_task24/meta.json @@ -33,7 +33,7 @@ "training": { "vol_samples": 50 }, - "test": { + "evaluation": { "vol_samples": 30 }, "public": true, @@ -84,8 +84,8 @@ ] }, "evaluation": { - "title": "Testing Data", - "text": "The test dataset consists of 30 test samples coming from the same training collection.", + "title": "Evaluation Data", + "text": "The evaluation dataset consists of 30 test samples coming from the Promise12 challenge.", "tables": [], "references": [ { From 3f6739da6a78b1c7f98167362f17d9cf88322a08 Mon Sep 17 00:00:00 2001 From: cciausu Date: Mon, 4 Dec 2023 16:32:22 -0500 Subject: [PATCH 3/6] Update default.yml --- models/nnunet_prostate_task24/config/default.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/models/nnunet_prostate_task24/config/default.yml b/models/nnunet_prostate_task24/config/default.yml index f12c1f44..0df38e60 100644 --- a/models/nnunet_prostate_task24/config/default.yml +++ b/models/nnunet_prostate_task24/config/default.yml @@ -27,9 +27,7 @@ modules: nnunet_task: Task024_Promise nnunet_model: 3d_fullres roi: PROSTATE - - BamfProcessorRunner: - + DsegConverter: source_segs: nifti:mod=seg target_dicom: dicom:mod=mr @@ -38,4 +36,4 @@ modules: DataOrganizer: targets: - - dicomseg-->[i:sid]/nnunet_mr_prostate.seg.dcm \ No newline at end of file + - dicomseg-->[i:sid]/nnunet_mr_prostate.seg.dcm From 02af716e84ceda607d30eec786d8771c3505611b Mon Sep 17 00:00:00 2001 From: Cosmin Ciausu Date: Fri, 19 Jan 2024 17:04:17 -0500 Subject: [PATCH 4/6] Update default.yml -- Modality tag instead of mod --- models/nnunet_prostate_task24/config/default.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/models/nnunet_prostate_task24/config/default.yml b/models/nnunet_prostate_task24/config/default.yml index 0df38e60..bde6f648 100644 --- a/models/nnunet_prostate_task24/config/default.yml +++ b/models/nnunet_prostate_task24/config/default.yml @@ -16,7 +16,7 @@ modules: import_dir: sorted_data sort_data: true meta: - mod: 'mr' + mod: '%Modality' NiftiConverter: in_datas: dicom:mod=mr From 625f6b703ee0f1a880f6d5e566a76181dfd99eb4 Mon Sep 17 00:00:00 2001 From: Cosmin Ciausu Date: Mon, 22 Jan 2024 01:12:53 -0500 Subject: [PATCH 5/6] Update meta.json added tables data and changed model name --- models/nnunet_prostate_task24/meta.json | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/models/nnunet_prostate_task24/meta.json b/models/nnunet_prostate_task24/meta.json index 50c4e568..19a3cc15 100644 --- a/models/nnunet_prostate_task24/meta.json +++ b/models/nnunet_prostate_task24/meta.json @@ -1,6 +1,6 @@ { "id": "...", - "name": "nnunet_prostate_task24_promise", + "name": "nnunet_prostate_task24", "title": "nnU-Net (Whole prostate segmentation)", "summary": { "description": "nnU-Net's whole prostate segmentation model is a single-modality (i.e. T2) input AI-based pipeline for the automated segmentation of the whole prostate on MRI scans.", @@ -86,7 +86,23 @@ "evaluation": { "title": "Evaluation Data", "text": "The evaluation dataset consists of 30 test samples coming from the Promise12 challenge.", - "tables": [], + "tables": [ + { + "label": "Promise12 training set Average DSC using five fold cross-validation", + "entries": { + "2D": "0.8932", + "3d_fullres": "0.8891", + "Best ensemble (2D + 3D_fullres)": "0.9029", + "Postprocessed": "0.9030", + } + }, + { + "label": "Promise12 test set Average DSC", + "entries": { + "Test set average DSC": "0.9194m" + } + } + ], "references": [ { "label": "Evaluation of prostate segmentation algorithms for MRI: The PROMISE12 challenge", @@ -122,4 +138,4 @@ ] } } -} \ No newline at end of file +} From 1ce9947bb799416a1123165392ba32278f04edfa Mon Sep 17 00:00:00 2001 From: Cosmin Ciausu Date: Mon, 22 Jan 2024 09:28:03 -0500 Subject: [PATCH 6/6] Update meta.json fixed formatting issue, added reference to the evaluation section. --- models/nnunet_prostate_task24/meta.json | 26 ++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/models/nnunet_prostate_task24/meta.json b/models/nnunet_prostate_task24/meta.json index 19a3cc15..c21f91b5 100644 --- a/models/nnunet_prostate_task24/meta.json +++ b/models/nnunet_prostate_task24/meta.json @@ -71,7 +71,7 @@ }, "analyses": { "title": "Quantitative Analyses", - "text": "The model's performance was assessed using the Dice Coefficient, in the context of the Promise12 challenge. The complete breakdown of the metrics can be consulted on GrandChallenge [1] and is reported in the supplementary material to the publication [2].", + "text": "The model's performance was assessed using the Dice Coefficient, in the context of the Promise12 challenge. A brief summary of the evaluation results on internal data can be found in the evaluation section. The complete breakdown of the metrics can be consulted on GrandChallenge [1] and is reported in the supplementary material to the publication [2].", "references": [ { "label": "Evaluation of prostate segmentation algorithms for MRI: The PROMISE12 challenge", @@ -88,20 +88,20 @@ "text": "The evaluation dataset consists of 30 test samples coming from the Promise12 challenge.", "tables": [ { - "label": "Promise12 training set Average DSC using five fold cross-validation", - "entries": { - "2D": "0.8932", - "3d_fullres": "0.8891", - "Best ensemble (2D + 3D_fullres)": "0.9029", - "Postprocessed": "0.9030", - } - }, + "label": "Promise12 training set Average DSC using five fold cross-validation", + "entries": { + "2D": "0.8932", + "3d_fullres": "0.8891", + "Best ensemble (2D + 3D_fullres)": "0.9029", + "Postprocessed": "0.9030" + } + }, { - "label": "Promise12 test set Average DSC", - "entries": { - "Test set average DSC": "0.9194m" + "label": "Promise12 test set Average DSC", + "entries": { + "Test set average DSC": "0.9194" + } } - } ], "references": [ {