-
Notifications
You must be signed in to change notification settings - Fork 20
BAMF FDG-Avid Breast Tumor #87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
a47bc80
create multi modality PET CT nnUnet Runner
jithenece c571530
add Resampler module
jithenece b46db65
define workflow
jithenece a9f959c
generate Total Segmentator organs
jithenece c9ffeb7
limiting tumor to breast
jithenece 8859687
add custom registration module
jithenece 412cd01
update metadata
jithenece e8f5fee
use FDG_AVID_TUMOR entry
jithenece 1faac1b
roi segments updated
jithenece 4c29ce9
use FDG_AVID_TUMOR label
jithenece cd4ba5f
more results stats
jithenece ee9a3ff
Merge branch 'MHubAI:main' into bamf_nnunet_pet_ct_breast
jithenece 652c092
updated label and comments
jithenece af0eab0
reformat code
jithenece a3f67cc
review comment fixes
jithenece bed9a6b
update comments
jithenece 4570d50
update model name
jithenece 76c1876
Merge branch 'MHubAI:main' into bamf_pet_ct_breast_tumor
jithenece c6b1f1c
multi workflow for tseg file as input
jithenece e7861be
format code
jithenece 3885709
update body part
jithenece bcbd0d5
Merge branch 'MHubAI:main' into bamf_pet_ct_breast_tumor
jithenece 406fd78
update publication link
jithenece 64e19b5
/test validation
jithenece 9a4bf5a
Update Dockerfile
LennyN95 032228c
Update default.yml sample annotations
LennyN95 311ffdb
Update composite.yml sample annotation
LennyN95 4810487
fix missing quote in default.yml workflow
LennyN95 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,83 @@ | ||
| general: | ||
| data_base_dir: /app/data | ||
| version: 1.0 | ||
| description: default configuration for Bamf NNUnet Breast FDG-avid lesions segmentation (dicom to dicom) | ||
|
|
||
| execute: | ||
| - FileStructureImporter | ||
| - DsegExtractor | ||
| - NiftiConverter | ||
| - Registration | ||
| - SegmentResampler | ||
| - NNUnetPETCTRunner | ||
| - ExtractorPostProcessor | ||
| - DsegConverter | ||
| - DataOrganizer | ||
|
|
||
| modules: | ||
|
|
||
| FileStructureImporter: | ||
| input_dir: 'input_data' | ||
| structures: | ||
| - $patientID@instance/ct@dicom:mod=ct | ||
| - $patientID/pt@dicom:mod=pt | ||
| - $patientID/TotalSegmentator.seg.dcm@dicomseg:mod=seg | ||
| import_id: patientID | ||
|
|
||
| DsegExtractor: | ||
| roi: | ||
| - LIVER | ||
| - LEFT_RIB_1 | ||
| - LEFT_RIB_2 | ||
| - LEFT_RIB_3 | ||
| - LEFT_RIB_4 | ||
| - LEFT_RIB_5 | ||
| - LEFT_RIB_6 | ||
| - RIGHT_RIB_1 | ||
| - RIGHT_RIB_2 | ||
| - RIGHT_RIB_3 | ||
| - RIGHT_RIB_4 | ||
| - RIGHT_RIB_5 | ||
| - RIGHT_RIB_6 | ||
| - LEFT_UPPER_LUNG_LOBE | ||
| - RIGHT_UPPER_LUNG_LOBE | ||
| - SPLEEN | ||
| - RIGHT_KIDNEY | ||
| - LEFT_KIDNEY | ||
|
|
||
| NiftiConverter: | ||
| in_datas: dicom:mod=ct|pt | ||
| engine: dcm2niix | ||
| allow_multi_input: true | ||
|
|
||
| NNUnetPETCTRunner: | ||
| in_ct_data: nifti:mod=ct:registered=true | ||
|
|
||
| ExtractorPostProcessor: | ||
| in_ct_data: nifti:mod=ct:registered=true | ||
|
|
||
| DsegConverter: | ||
| source_segs: nifti:mod=seg:processor=bamf | ||
| model_name: BAMF Breast and Tumor AI Segmentation | ||
| target_dicom: dicom:mod=pt | ||
| skip_empty_slices: True | ||
|
|
||
| DataOrganizer: | ||
| targets: | ||
| - dicomseg-->[i:patientID]/bamf_pet_ct_breast_tumor.seg.dcm | ||
|
|
||
| sample: | ||
| idc: | ||
| "p1/ct": | ||
| SeriesInstanceUID: 1.3.6.1.4.1.14519.5.2.1.8162.7003.539267076861125410814830191835 | ||
| aws_url: s3://idc-open-data/84c9b972-76e1-4fa3-a7ea-19b6500e497a/* | ||
| "p1/pt": | ||
| SeriesInstanceUID: 1.3.6.1.4.1.14519.5.2.1.8162.7003.196821690630879561473146713439 | ||
| aws_url: s3://idc-open-data/33f0bd14-4bf5-469c-83db-183e1ab96f02/* | ||
| input: | ||
| "p1": "Folder containing one case / patient, e.g., named after the patient identifyer" | ||
| "p1/ct": "Folder containing dicom files for the CT scan of the patient to be analysed" | ||
| "p1/pt": "Folder containing dicom files for an associated PET scan" | ||
| "p1/TotalSegmentator.seg.dcm": "Dicomseg file as generated by the mhub.ai totalsegmentator model implementation." | ||
| output: | ||
| "p1/bamf_pet_ct_breast_tumor.seg.dcm": "Segmentation output file" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| general: | ||
| data_base_dir: /app/data | ||
| version: 1.0 | ||
| description: default configuration for Bamf NNUnet Breast FDG-avid lesions segmentation (dicom to dicom) | ||
|
|
||
| execute: | ||
| - FileStructureImporter | ||
| - NiftiConverter | ||
| - Registration | ||
| - NNUnetPETCTRunner | ||
| - TotalSegmentatorMLRunner | ||
| - BreastPostProcessor | ||
| - DsegConverter | ||
| - DataOrganizer | ||
|
|
||
| modules: | ||
|
|
||
| FileStructureImporter: | ||
| input_dir: 'input_data' | ||
| structures: | ||
| - $patientID@instance/ct@dicom:mod=ct | ||
| - $patientID/pt@dicom:mod=pt | ||
| import_id: patientID | ||
|
|
||
| NiftiConverter: | ||
| in_datas: dicom:mod=ct|pt | ||
| engine: dcm2niix | ||
| allow_multi_input: true | ||
|
|
||
| TotalSegmentatorMLRunner: | ||
| in_data: nifti:mod=ct:registered=true | ||
| use_fast_mode: true | ||
|
|
||
| NNUnetPETCTRunner: | ||
| in_ct_data: nifti:mod=ct:registered=true | ||
|
|
||
| BreastPostProcessor: | ||
| in_ct_data: nifti:mod=ct:registered=true | ||
|
|
||
| DsegConverter: | ||
| source_segs: nifti:mod=seg:processor=bamf | ||
| model_name: BAMF Breast and Tumor AI Segmentation | ||
| target_dicom: dicom:mod=pt | ||
| skip_empty_slices: True | ||
|
|
||
| DataOrganizer: | ||
| targets: | ||
| - dicomseg-->[i:patientID]/bamf_pet_ct_breast_tumor.seg.dcm | ||
|
|
||
| sample: | ||
| idc: | ||
| "p1/ct": | ||
| SeriesInstanceUID: 1.3.6.1.4.1.14519.5.2.1.8162.7003.539267076861125410814830191835 | ||
| aws_url: s3://idc-open-data/84c9b972-76e1-4fa3-a7ea-19b6500e497a/* | ||
| "p1/pt": | ||
| SeriesInstanceUID: 1.3.6.1.4.1.14519.5.2.1.8162.7003.196821690630879561473146713439 | ||
| aws_url: s3://idc-open-data/33f0bd14-4bf5-469c-83db-183e1ab96f02/* | ||
| input: | ||
| "p1": "Folder containing one case / patient, e.g., named after the patient identifyer" | ||
| "p1/ct": "Folder containing dicom files for the CT scan of the patient to be analysed" | ||
| "p1/pt": "Folder containing dicom files for an associated PET scan" | ||
| output: | ||
| "p1/bamf_pet_ct_breast_tumor.seg.dcm": "Segmentation output file" | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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 TotalSegmentator | ||
| RUN uv pip install p_tqdm==1.4 TotalSegmentator==1.5.7 nnunet==1.6.6 torch==2.2.2 --no-cache-dir | ||
|
|
||
| # Clone the main branch of MHubAI/models | ||
| ARG MHUB_MODELS_REPO | ||
| RUN buildutils/import_mhub_model.sh bamf_pet_ct_breast_tumor ${MHUB_MODELS_REPO} | ||
|
|
||
| # Pull nnUNet model weights into the container for Task777_CT_Nodules | ||
| ENV WEIGHTS_DIR=/root/.nnunet/nnUNet_models/nnUNet/ | ||
| RUN mkdir -p $WEIGHTS_DIR | ||
| ENV TASK_NAME=Task762_PET_CT_Breast | ||
| ENV WEIGHTS_FN=$TASK_NAME.zip | ||
| ENV WEIGHTS_URL=https://zenodo.org/record/8290055/files/$WEIGHTS_FN | ||
| RUN wget --directory-prefix ${WEIGHTS_DIR} ${WEIGHTS_URL} --no-check-certificate | ||
| 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/bamf_pet_ct_breast_tumor/config/default.yml"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,152 @@ | ||
| { | ||
| "id": "", | ||
| "name": "bamf_pet_ct_breast_tumor", | ||
| "title": "Bamf NNunet PET CT Breast", | ||
| "summary": { | ||
| "description": "This model used to detect FDG-avid lesions in breast from FDG PET/CT scans", | ||
| "inputs": [ | ||
| { | ||
| "label": "Input Image", | ||
| "description": "The CT scan of a patient.", | ||
| "format": "DICOM", | ||
| "modality": "CT", | ||
| "bodypartexamined": "BREAST", | ||
| "slicethickness": "5mm", | ||
| "non-contrast": true, | ||
| "contrast": false | ||
| }, | ||
| { | ||
| "label": "Input Image", | ||
| "description": "The PET scan of a patient.", | ||
| "format": "DICOM", | ||
| "modality": "PT", | ||
| "bodypartexamined": "BREAST", | ||
| "slicethickness": "4mm", | ||
| "non-contrast": false, | ||
| "contrast": false | ||
| } | ||
| ], | ||
| "outputs": [ | ||
| { | ||
| "label": "Segmentation", | ||
| "type": "Segmentation", | ||
| "description": "FDG-avid Breast tumor", | ||
| "classes": [ | ||
| "BREAST+FDG_AVID_TUMOR" | ||
| ] | ||
| } | ||
| ], | ||
| "model": { | ||
| "architecture": "U-net", | ||
| "training": "supervised", | ||
| "cmpapproach": "3D" | ||
| }, | ||
| "data": { | ||
| "training": { | ||
| "vol_samples": 1014 | ||
| }, | ||
| "evaluation": { | ||
| "vol_samples": 11 | ||
| }, | ||
| "public": true, | ||
| "external": true | ||
| } | ||
| }, | ||
| "details": { | ||
| "name": "AIMI PET CT BREAST", | ||
| "version": "1.0.0", | ||
| "devteam": "BAMF Health", | ||
| "type": "nnU-Net (U-Net structure, optimized by data-driven heuristics)", | ||
| "date": { | ||
| "code": "17.10.2023", | ||
| "weights": "28.08.2023", | ||
| "pub": "23.10.2023" | ||
| }, | ||
| "cite": "Murugesan, Gowtham Krishnan, Diana McCrumb, Mariam Aboian, Tej Verma, Rahul Soni, Fatima Memon, and Jeff Van Oss. The AIMI Initiative: AI-Generated Annotations for Imaging Data Commons Collections. arXiv preprint arXiv:2310.14897 (2023).", | ||
| "license": { | ||
| "code": "MIT", | ||
| "weights": "CC BY-NC 4.0" | ||
| }, | ||
| "publications": [ | ||
| { | ||
| "title": "The AIMI Initiative: AI-Generated Annotations in IDC Collections", | ||
| "uri": "https://arxiv.org/abs/2310.14897" | ||
| } | ||
| ], | ||
| "github": "https://github.com/bamf-health/aimi-breast-pet-ct" | ||
| }, | ||
| "info": { | ||
| "use": { | ||
| "title": "Intended Use", | ||
| "text": "This model is intended to perform segmentations of Breast FDG-avid Tumor region in PET, CT scans. The model has been trained and tested on scans acquired during clinical care of patients, so it might not be suited for a healthy population. The generalization capabilities of the model on a range of ages, genders, and ethnicities are unknown." | ||
| }, | ||
| "analyses": { | ||
| "title": "Quantitative Analyses", | ||
| "text": "Label-wise metrics (mean (standard deviation)) between AI derived and expert corrected FDG PET/CT breast lesion annotations.", | ||
| "tables": [ | ||
| { | ||
| "label": "Segmentation Metric Expert", | ||
| "entries": { | ||
| "Tumor DSC": "0.80 (0.33)", | ||
| "Tumor 95% Hausdorff (mm)": "29.70 (33.43)" | ||
| } | ||
| }, | ||
| { | ||
| "label": "Segmentation Metric Tumor - Non-Expert", | ||
| "entries": { | ||
| "Tumor DSC": "0.94 (0.10)", | ||
| "Tumor 95% Hausdorff (mm)": "13.53 (20.00)" | ||
| } | ||
| }, | ||
| { | ||
| "label": "Detection Accuracy", | ||
| "entries": { | ||
| "Sensitivity": "0.43", | ||
| "False negative rate": "0.57", | ||
| "F1 score": "0.52" | ||
| } | ||
| } | ||
| ], | ||
| "references": [ | ||
| { | ||
| "label": "The AIMI Initiative: AI-Generated Annotations for Imaging Data Commons Collections", | ||
| "uri": "https://arxiv.org/abs/2310.14897" | ||
| } | ||
| ] | ||
| }, | ||
| "evaluation": { | ||
| "title": "Evaluation Data", | ||
| "text": "The model was used to segment cases from the IDC [1] collection of QIN-Breast [2]. 11 validation cases were rated by a radiologist and non-expert. The model predictions, and radiologist corrections are published on zenodo [9]", | ||
| "references": [ | ||
| { | ||
| "label": "Imaging Data Collections (IDC)", | ||
| "uri": "https://datacommons.cancer.gov/repository/imaging-data-commons" | ||
| }, | ||
| { | ||
| "label": "QIN-Breast", | ||
| "uri": "https://www.cancerimagingarchive.net/collection/qin-breast/" | ||
| }, | ||
| { | ||
| "label": "Image segmentations produced by the AIMI Annotations initiative", | ||
| "uri": "https://zenodo.org/records/10009368" | ||
| } | ||
| ] | ||
| }, | ||
| "training": { | ||
| "title": "Training Data", | ||
| "text": "The AutoPET Challenge 2023 dataset is comprised of whole-body FDG-PET/CT data from 900 patients, encompassing 1014 studies with tumor annotations. This dataset was augmented by adding labels for the brain, bladder, kidneys, liver, stomach, spleen, lungs, and heart generated by the TotalSegmentator model. A multi-task AI model was trained using the augmented datasets", | ||
| "references": [ | ||
| { | ||
| "label": "AutoPET Challenge 2023 dataset", | ||
| "uri": "https://doi.org/10.7937/gkr0-xv29" | ||
| }, | ||
| { | ||
| "label": "Total Segmentator", | ||
| "uri": "https://mhub.ai/models/totalsegmentator" | ||
| } | ||
| ] | ||
| } | ||
| } | ||
| } | ||
|
|
||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
|
|
||
| [model.deployment] | ||
| test = "https://zenodo.org/records/13880663/files/bamf_pet_ct_breast_tumor.test.zip?download=1" |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is TotalSegmentator run as part of this model?