Skip to content

Commit 128c691

Browse files
committed
Add preprocessing output as model input
1 parent ab20d9b commit 128c691

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

brats/preprocessing/project/mlcube.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,11 @@ def run(
1616
data_path: str, parameters_file: str, output_path: str
1717
) -> None:
1818

19-
env = os.environ.copy()
20-
env.update({
21-
'data_path': data_path,
22-
'parameters_file': parameters_file,
23-
'output_path': output_path
24-
})
25-
26-
process = subprocess.Popen("./run.sh", cwd=".", env=env)
19+
cmd = f"python3 preprocess.py --data_path={data_path} \
20+
--parameters_file {parameters_file} --output_path {output_path}"
21+
splitted_cmd = cmd.split()
22+
23+
process = subprocess.Popen(splitted_cmd, cwd=".")
2724
process.wait()
2825

2926
class SanityCheckTask:

brats/preprocessing/project/preprocess.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import yaml
66
import numpy as np
77
import nibabel as nib
8+
from shutil import copyfile
89
from tqdm import tqdm
910

1011

@@ -95,6 +96,9 @@ def main():
9596
images_arr = get_data_arr(args.data_path)
9697
save_processed_data(args.output_path, params["output_filename"], images_arr)
9798

99+
input_file = os.path.normpath(args.data_path + "/BraTS_example_seg.nii.gz")
100+
output_file = os.path.normpath(args.output_path + "/BraTS_example_seg.nii.gz")
101+
copyfile(input_file, output_file)
98102

99103
if __name__ == "__main__":
100104
main()

0 commit comments

Comments
 (0)