Skip to content
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

BAMF - NNUnet Lung and Nodules #78

Closed
wants to merge 16 commits into from

Conversation

jithenece
Copy link

No description provided.

@vanossj
Copy link
Contributor

vanossj commented May 2, 2024

@LennyN95 we could use your advise on this model. We run two different nnunet models, then combine the output niftis into one nifti, then convert to dicom-seg.

  • whats the best way to run multiple nnunet models? seems like you can only have one instance of NNUnetRunner module.
  • how does the ROI information get passed through if there are multiple model runner modules?

@LennyN95
Copy link
Member

LennyN95 commented May 2, 2024

Hi @vanossj,

Sure, that is possible! So, the module config is the general configuration for all usages of that module. However, that can be overwritten directly from within the execution chain:

execute:
- module: NNUnetRunner
  nnunet_task: Task003_Liver
  roi: LIVER,LIVER+NEOPLASM_MALIGNANT_PRIMARY
- module: NNUnetRunner
  nnunet_task: Task007_Pancreas
  roi: PANCREAS,PANCREAS+NEOPLASM_MALIGNANT_PRIMARY

modules:
  NNUnetRunner:
    nnunet_model: 3d_lowres

Copy link
Member

@LennyN95 LennyN95 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To avoid file overwrites, the @IO.Output decorator has an auto_increment option:
https://github.com/MHubAI/mhubio/blob/main/mhubio/core/IO.py#L325

@jithenece jithenece changed the title BAMF - NNUnet Lung, Nodules and Tumors BAMF - NNUnet Lung and Nodules May 6, 2024
@jithenece
Copy link
Author

@LennyN95

  • Do we need to update this NNUnetRunner function to process this auto_increment option?
  • segdb doesnot have entries for LUNG, NODULES. Could you add this for us?

@LennyN95
Copy link
Member

LennyN95 commented May 6, 2024

Do we need to update this NNUnetRunner function to process this auto_increment option?

That is correct. I will take care of this and release a new base image including this and some additional minor fixes.

segdb doesnot have entries for LUNG, NODULES. Could you add this for us?

So you need NODULE with sct code 27925004, correct?

@vanossj
Copy link
Contributor

vanossj commented May 6, 2024

Yes, that is the sct code we used

@LennyN95
Copy link
Member

LennyN95 commented May 6, 2024

Added NODULE to segdb (920c7f3).

You can now use LUNG+NODULE or LEFT_LOWER_LUNG_LOBE+NODULE, etc.

@LennyN95
Copy link
Member

LennyN95 commented May 14, 2024

Do we need to update this NNUnetRunner function to process this auto_increment option?

The default of the auto_increment option in the @IO.Output and @IO.Outputs decorators has been changed to True with MHubAI/mhubio@3eb4529. Hence, when running multiple NNUnetRunner modules, previous outputs shouldn't be overwritten.

These changes are available in our latest base image mhubai/base:latest.

@jithenece jithenece marked this pull request as ready for review June 5, 2024 21:04
@jithenece
Copy link
Author

Added NODULE to segdb (920c7f3).

You can now use LUNG+NODULE or LEFT_LOWER_LUNG_LOBE+NODULE, etc.

I tried to run testing with the LUNG,LUNG+NODULE as segmentation covers both right and left lung but got error. Could you add LUNG to segdb too?

@jithenece jithenece marked this pull request as draft June 13, 2024 14:38
@LennyN95
Copy link
Member

I also added LUNG now (we already had the type in the DB but not the segment).

@jithenece
Copy link
Author

sample:
  idc_version: "Data Release 4.0 May 29, 2020"
  data:
  - SeriesInstanceUID: 1.3.6.1.4.1.14519.5.2.1.7777.9002.290917407640793598352855735724
    aws_url: s3://idc-open-data/b925cf2a-de89-426d-b300-27b136264555/*
    path: input_data

reference:
  url: https://drive.google.com/file/d/1la5-sFlaWGopGiBvTdi-_V375nc59e9h/view?usp=sharing

@jithenece
Copy link
Author

Archive.zip
Slicer screenshots attached

@jithenece jithenece marked this pull request as ready for review July 2, 2024 20:49
Copy link
Member

@LennyN95 LennyN95 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very clean implementation! I added a few questions and minor remarks. Thank you!

models/bamf_nnunet_ct_lung/utils/LungPostProcessor.py Outdated Show resolved Hide resolved
models/bamf_nnunet_ct_lung/utils/LungPostProcessor.py Outdated Show resolved Hide resolved

DataOrganizer:
targets:
- dicomseg-->[i:sid]/bamf_nnunet_ct_lung.seg.dcm
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems that bamf_nnunet_ct_lungnodules would be a better fit for a name?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have updated with this naming convention.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thx! This would require to change the folder name (modles/$model_name) too.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated the model directory to bamf_nnunet_ct_lungnodules

@jithenece
Copy link
Author

@LennyN95 Let me know if you need other changes.

@jithenece
Copy link
Author

/test

sample:
  idc_version: "Data Release 4.0 May 29, 2020"
  data:
  - SeriesInstanceUID: 1.3.6.1.4.1.14519.5.2.1.7777.9002.290917407640793598352855735724
    aws_url: s3://idc-open-data/b925cf2a-de89-426d-b300-27b136264555/*
    path: input_data

reference:
  url: https://drive.google.com/file/d/1pTqmrrQWC4qHO8z4d72FPVAczh-Zj7hq

@jithenece
Copy link
Author

/review

@LennyN95 all review comments have been fixed

@github-actions github-actions bot added the REQUEST REVIEW Attach this label to your PR when your submission is "in progress" and is ready to be reviewed by us label Aug 8, 2024
@LennyN95
Copy link
Member

NOTE: New model version already available in #92.

@jithenece
Copy link
Author

@LennyN95 Closing this pull request as new model #92 to be used as per the discussion in comments here

@jithenece jithenece closed this Aug 22, 2024
@LennyN95 LennyN95 removed REQUEST REVIEW Attach this label to your PR when your submission is "in progress" and is ready to be reviewed by us TEST REQUESTED labels Aug 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Rejected / Discarded
Development

Successfully merging this pull request may close these issues.

3 participants