Skip to content

Commit

Permalink
Quick-fix support for running cavity segmentation
Browse files Browse the repository at this point in the history
  • Loading branch information
dbouget committed Jun 19, 2024
1 parent cc5f708 commit 35ef630
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build_macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install git+https://github.com/dbouget/raidionics_rads_lib.git@req
pip install git+https://github.com/dbouget/raidionics_rads_lib.git@master
pip install -r assets/requirements.txt
pip install matplotlib==3.3.4
pip install --force-reinstall --no-cache-dir pyside6
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build_macos_arm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
python3 -m pip install --upgrade pip
pip3 install ffmpeg
pip3 install matplotlib
pip install git+https://github.com/dbouget/raidionics_rads_lib.git@req
pip install git+https://github.com/dbouget/raidionics_rads_lib.git@master
pip3 install -r assets/requirements.txt
pip install --force-reinstall --no-cache-dir pyside6
pip install urllib3==1.26.6
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build_ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install git+https://github.com/dbouget/raidionics_rads_lib.git@req
pip install git+https://github.com/dbouget/raidionics_rads_lib.git@master
pip install -r assets/requirements.txt
pip uninstall -y PySide6 PySide6-Addons PySide6-Essentials
pip install --force-reinstall --no-cache-dir pyside6==6.2.4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build_windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
run: |
python -m pip install --upgrade pip
ls
pip install git+https://github.com/dbouget/raidionics_rads_lib.git@req
pip install git+https://github.com/dbouget/raidionics_rads_lib.git@master
pip install -r assets/requirements.txt
pip install matplotlib==3.3.4
pip install --force-reinstall --no-cache-dir pyside6
Expand Down
17 changes: 14 additions & 3 deletions gui/SinglePatientComponent/CentralAreaExecutionWidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ def on_pipeline_execution(self, pipeline_code: str) -> None:
"""
self.model_name = ""
if ("Classification" not in pipeline_code) and ("Brain" not in pipeline_code) and ("postop" not in pipeline_code) and ("Edema" not in pipeline_code):
if ("Classification" not in pipeline_code) and ("Brain" not in pipeline_code) and ("postop" not in pipeline_code) and ("Edema" not in pipeline_code) and ("Cavity" not in pipeline_code):
diag = TumorTypeSelectionQDialog(self)
code = diag.exec_()
if code == 0: # Operation cancelled
Expand All @@ -165,12 +165,23 @@ def on_pipeline_execution(self, pipeline_code: str) -> None:
self.model_name = self.model_name + '_multiclass'
if diag.tumor_type == 'Low-Grade Glioma':
self.model_name = "MRI_GBM_multiclass"
elif "postop" in pipeline_code:
diag = TumorTypeSelectionQDialog(self)
code = diag.exec_()
if code == 0: # Operation cancelled
return
if diag.tumor_type == 'Glioblastoma':
self.model_name = "MRI_GBM_Postop_FV_4p"
pipeline_code = pipeline_code + '_GBM'
elif diag.tumor_type == 'Low-Grade Glioma':
self.model_name = "MRI_LGGlioma_Postop"
pipeline_code = pipeline_code + '_LGGlioma'
elif "Brain" in pipeline_code:
self.model_name = "MRI_Brain"
elif "postop" in pipeline_code:
self.model_name = "MRI_GBM_Postop_FV_4p"
elif "Edema" in pipeline_code:
self.model_name = "MRI_Edema"
elif "Cavity" in pipeline_code:
self.model_name = "MRI_Cavity"

self.process_started.emit()
self.pipeline_main_wrapper(pipeline_code)
Expand Down
1 change: 1 addition & 0 deletions utils/data_structures/AnnotationStructure.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class AnnotationClassType(Enum):
Tumor = 1, 'Tumor'
Necrosis = 2, 'Necrosis'
Edema = 3, 'Edema'
Cavity = 4, 'Cavity'

Lungs = 100, 'Lungs'
Airways = 101, 'Airways'
Expand Down
8 changes: 5 additions & 3 deletions utils/logic/PipelineCreationHandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,10 @@ def create_pipeline(model_name: str, patient_parameters, task: str) -> dict:
return __create_folders_classification_pipeline()
elif task == 'preop_segmentation':
return __create_segmentation_pipeline(model_name, patient_parameters)
elif task == 'postop_segmentation':
model_name = select_appropriate_postop_model(patient_parameters)
elif 'postop_segmentation' in task:
# @TODO. Will have to clean up all this for dealing with the new use-cases...
if "GBM" in task:
model_name = select_appropriate_postop_model(patient_parameters)
download_model(model_name=model_name)
return __create_postop_segmentation_pipeline(model_name, patient_parameters)
elif task == 'other_segmentation':
Expand Down Expand Up @@ -392,7 +394,7 @@ def __create_custom_pipeline(task, tumor_type, patient_parameters):
pip[pip_num]["description"] = "Lungs segmentation in T1CE (T{})".format(str(timestamp_order))
download_model(model_name="CT_Lungs")

if split_task[1] == 'Tumor' or split_task[1] == 'Edema':
if split_task[1] == 'Tumor' or split_task[1] == 'Edema' or split_task[1] == 'Cavity':
infile = open(os.path.join(SoftwareConfigResources.getInstance().models_path, tumor_type, 'pipeline.json'),
'rb')
raw_pip = json.load(infile)
Expand Down

0 comments on commit 35ef630

Please sign in to comment.