forked from ge-xing/SegMamba
-
Notifications
You must be signed in to change notification settings - Fork 0
/
2_preprocessing_mri.py
45 lines (33 loc) · 1.3 KB
/
2_preprocessing_mri.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
from light_training.preprocessing.preprocessors.preprocessor_mri import MultiModalityPreprocessor
import numpy as np
import pickle
import json
data_filename = ["t2w.nii.gz",
"t2f.nii.gz",
"t1n.nii.gz",
"t1c.nii.gz"]
seg_filename = "seg.nii.gz"
base_dir = "./data/raw_data/BraTS2023/"
image_dir = "ASNR-MICCAI-BraTS2023-GLI-Challenge-TrainingData"
def process_train():
preprocessor = MultiModalityPreprocessor(base_dir=base_dir,
image_dir=image_dir,
data_filenames=data_filename,
seg_filename=seg_filename
)
out_spacing = [1.0, 1.0, 1.0]
output_dir = "./data/fullres/train/"
preprocessor.run(output_spacing=out_spacing,
output_dir=output_dir,
all_labels=[1, 2, 3],
)
def plan():
preprocessor = MultiModalityPreprocessor(base_dir=base_dir,
image_dir=image_dir,
data_filenames=data_filename,
seg_filename=seg_filename
)
preprocessor.run_plan()
if __name__ == "__main__":
plan()
process_train()