Skip to content

Commit

Permalink
chore: minor changes for pr
Browse files Browse the repository at this point in the history
  • Loading branch information
strasserpatrick committed Apr 28, 2024
1 parent a6b2b47 commit 3b9a770
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 19 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import multiprocessing
import shutil
from multiprocessing import Pool

import SimpleITK as sitk
import numpy as np
Expand Down Expand Up @@ -47,7 +46,8 @@ def load_convert_labels_back_to_BraTS(filename, input_folder, output_folder):
sitk.WriteImage(d, join(output_folder, filename))


def convert_folder_with_preds_back_to_BraTS_labeling_convention(input_folder: str, output_folder: str, num_processes: int = 12):
def convert_folder_with_preds_back_to_BraTS_labeling_convention(input_folder: str, output_folder: str,
num_processes: int = 12):
"""
reads all prediction files (nifti) in the input folder, converts the labels back to BraTS convention and saves the
"""
Expand All @@ -58,7 +58,7 @@ def convert_folder_with_preds_back_to_BraTS_labeling_convention(input_folder: st


if __name__ == '__main__':
brats_data_dir = '/home/stud/strasser/archive/brats2018/MICCAI_BraTS_2018_Data_Training'
brats_data_dir = ...

task_id = 42
task_name = "BraTS2018"
Expand Down Expand Up @@ -100,7 +100,7 @@ def convert_folder_with_preds_back_to_BraTS_labeling_convention(input_folder: st
'background': 0,
'whole tumor': (1, 2, 3),
'tumor core': (2, 3),
'enhancing tumor': (3, )
'enhancing tumor': (3,)
},
num_training_cases=(len(case_ids_lgg) + len(case_ids_hgg)),
file_ending='.nii',
Expand Down
8 changes: 4 additions & 4 deletions nnunetv2/dataset_conversion/Dataset043_BraTS19.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import multiprocessing
import shutil
from multiprocessing import Pool

import SimpleITK as sitk
import numpy as np
Expand Down Expand Up @@ -47,7 +46,8 @@ def load_convert_labels_back_to_BraTS(filename, input_folder, output_folder):
sitk.WriteImage(d, join(output_folder, filename))


def convert_folder_with_preds_back_to_BraTS_labeling_convention(input_folder: str, output_folder: str, num_processes: int = 12):
def convert_folder_with_preds_back_to_BraTS_labeling_convention(input_folder: str, output_folder: str,
num_processes: int = 12):
"""
reads all prediction files (nifti) in the input folder, converts the labels back to BraTS convention and saves the
"""
Expand All @@ -58,7 +58,7 @@ def convert_folder_with_preds_back_to_BraTS_labeling_convention(input_folder: st


if __name__ == '__main__':
brats_data_dir = '/home/stud/strasser/archive/brats2019/MICCAI_BraTS_2019_Data_Training'
brats_data_dir = ...

task_id = 43
task_name = "BraTS2019"
Expand Down Expand Up @@ -100,7 +100,7 @@ def convert_folder_with_preds_back_to_BraTS_labeling_convention(input_folder: st
'background': 0,
'whole tumor': (1, 2, 3),
'tumor core': (2, 3),
'enhancing tumor': (3, )
'enhancing tumor': (3,)
},
num_training_cases=(len(case_ids_hgg) + len(case_ids_lgg)),
file_ending='.nii',
Expand Down
2 changes: 1 addition & 1 deletion nnunetv2/dataset_conversion/Dataset137_BraTS21.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def convert_folder_with_preds_back_to_BraTS_labeling_convention(input_folder: st


if __name__ == '__main__':
brats_data_dir = '/home/stud/strasser/data/raw_downloaded_data'
brats_data_dir = '/home/isensee/drives/E132-Rohdaten/BraTS_2021/training'

task_id = 137
task_name = "BraTS2021"
Expand Down
10 changes: 0 additions & 10 deletions train.sh

This file was deleted.

0 comments on commit 3b9a770

Please sign in to comment.