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

SMIT CT Lung GTV segmentation model #108

Draft
wants to merge 20 commits into
base: main
Choose a base branch
from
Draft

Conversation

locastre
Copy link

Submitting the SMIT CT Lung GTV segmentation model for mHub

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.

Thank you for your contribution 🚀

  • Can we avoid using conda and instead install all requirements with uv? Our base image comes with uv installed and a virtual environment set-up. However, it is suggested that you create your own virtual environment with uv, e.g., uv venv -p 3.10 .venv310
  • The contents of the meta.json are used to populate the model card on our website under mhub.ai/models. The more information, the better.
  • To test-build the model and to move forward with our test routine, an mhub.toml file needs to be created.


WORKDIR ${WORK_DIR}/msk_smit_lung_gtv/src
ENV WEIGHTS_URL=https://mskcc.box.com/shared/static/sf7jic4m2dk67413cipbbq6hddvhpj61.gz
ENV CONDA_URL=https://mskcc.box.com/shared/static/d580gfjzzmt26v8klwp8pivb6wafomag.gz
Copy link
Member

Choose a reason for hiding this comment

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

Is this using a conda environment for dependencies?

We should avoid conda in open source projects due to it's licensing scheme.

I suggest we install all dependencies with uv (which comes with our base image), e.g., you could provide a pyproject.toml to make src installable or just provide a list with dependencies (like a requirements.txt) and install with uv pip install.

{
"id": "",
"name": "msk_smit_lung_gtv",
"title": "CT Lung GTV SMIT Segmentation",
Copy link
Member

Choose a reason for hiding this comment

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

What does SMIT stand for :)?

"name": "msk_smit_lung_gtv",
"title": "CT Lung GTV SMIT Segmentation",
"summary": {
"description": "GTV segmentation from CT scan",
Copy link
Member

Choose a reason for hiding this comment

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

Could be slightly longer, this is what the user sees on the website.

"description": "Segmentation of the lung GTV from NIfTI CT images.",
"type": "Segmentation",
"classes": [
"GTV"
Copy link
Member

Choose a reason for hiding this comment

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

See comment in SMITrunner.py.

"version": "1.0.0",
"devteam": "",
"authors": ["Jue Jiang, Harini Veeraraghavan"],
"type": "it is a 3D Swin transformer based segmentation net",
Copy link
Member

Choose a reason for hiding this comment

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

Just Segmentation?


@IO.Instance()
@IO.Input('scan', 'nifti:mod=ct', the='input ct scan')
@IO.Output('gtv_mask', 'gtv_mask.nii.gz', 'nifti:mod=seg:model=SMIT:roi=GTV',data='scan', the='predicted lung gtv')
Copy link
Member

Choose a reason for hiding this comment

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

The segmentation ID GTV does not exist in SegDB. You can find an overview of available segmentations here.

Note, that a tumor is usually described in the context of a parent structure, e.g., segmentation ID LUNG, LEFT_LUNG, etc. A potential fit could be LUNG+NEOPLASM_MALIGNANT_PRIMARY.

@IO.Instance()
@IO.Input('scan', 'nifti:mod=ct', the='input ct scan')
@IO.Output('gtv_mask', 'gtv_mask.nii.gz', 'nifti:mod=seg:model=SMIT:roi=GTV',data='scan', the='predicted lung gtv')
def task(self, instance: Instance, scan: InstanceData, gtv_mask: InstanceData) -> None:
Copy link
Member

Choose a reason for hiding this comment

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

The input ct image is available under scan.abspath, the segmentation mask generated by the model should be written or copied into gtv_mask.abspath.

@IO.Output('gtv_mask', 'gtv_mask.nii.gz', 'nifti:mod=seg:model=SMIT:roi=GTV',data='scan', the='predicted lung gtv')
def task(self, instance: Instance, scan: InstanceData, gtv_mask: InstanceData) -> None:

workDir = os.path.join(os.environ['WORK_DIR'],'models','msk_smit_lung_gtv','src') # Needs to be defined in docker file as ENV WORK_DIR=path_to_dir e.g. /app/models/SMIT/workDir
Copy link
Member

Choose a reason for hiding this comment

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

Could we use pathlib for all path concatenations to increase readability?

#condaEnvDir = os.path.join(wrapperInstallDir,'conda-pack')
#condaEnvActivateScript = os.path.join(condaEnvDir, 'bin', 'activate')
wrapperPath = os.path.join(workDir,'bash_run_SMIT_Segmentation.sh')
load_weight_name = os.path.join(workDir,'trained_weights','model.pt')
Copy link
Member

Choose a reason for hiding this comment

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

Are there multiple weights trained for this model architecture? Otherwise, I'd suggest we make this parameter fixed, to increase the readability.

}
],
"model": {
"architecture": "Swin Transformer based segmentation, self-supervised pretrained with 10k CT data",
Copy link
Member

Choose a reason for hiding this comment

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

Just Swin3D?

@locastre
Copy link
Author

@LennyN95 Thank you for the in-depth feedback! We're working to address the suggestions.

I have an additional question: when we upload our test data to Zenodo (for the mhub.toml), should we refer to the mHub DOI# 13785615 or create a new DOI from an independent/new entry?

@fedorov
Copy link
Member

fedorov commented Mar 18, 2025

I would recommend renaming the PR to "SMIT CT Lung GTV segmentation model" (or something similar).

@LennyN95 LennyN95 changed the title New Model Submission SMIT CT Lung GTV segmentation model Mar 19, 2025
@LennyN95
Copy link
Member

LennyN95 commented Mar 19, 2025

You're more than welcome. Thank you and your team for the great work.

I have an additional question: when we upload our test data to Zenodo (for the mhub.toml), should we refer to the mHub DOI# 13785615 or create a new DOI from an independent/new entry?

@locastre We mainly use Zenodo for it's reproducible storage mechanism, so you can create a new DOI for your sample & reference.

@LennyN95
Copy link
Member

@locastre FYI; There are also some errors in the compliance check that need to be resolved:

Errors:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Submitted Implementations
Development

Successfully merging this pull request may close these issues.

3 participants