Skip to content

Commit

Permalink
Backend requirements update and support for the cavity class (#78)
Browse files Browse the repository at this point in the history
* Testing the latest seg/rads lib

* Quick-fix support for running cavity segmentation
[skip ci]
  • Loading branch information
dbouget authored Jun 19, 2024
1 parent de39253 commit 38d7dd4
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 8 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@software
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
19 changes: 16 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):
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,10 +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
10 changes: 6 additions & 4 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':
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 All @@ -401,7 +403,7 @@ def __create_custom_pipeline(task, tumor_type, patient_parameters):
pip_num_int = pip_num_int + 1
pip_num = str(pip_num_int)
pip[pip_num] = raw_pip[steps]
if split_task[1] == 'Brain':
elif split_task[1] == 'Brain':
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 38d7dd4

Please sign in to comment.