-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpaths.py
78 lines (73 loc) · 4.02 KB
/
paths.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
'''
Author: yiyanghu [email protected]
Date: 2022-11-25 09:22:12
LastEditors: yiyanghu [email protected]
LastEditTime: 2023-03-29 18:58:28
FilePath: \nnUNet-master\nnunet\paths.py
Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
'''
# '''
# Author: yiyanghu [email protected]
# Date: 2022-11-25 09:22:12
# LastEditors: yiyanghu [email protected]
# LastEditTime: 2022-12-09 09:43:27
# FilePath: \nnUNet-master\nnunet\paths.py
# Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
# '''
# Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import os
from batchgenerators.utilities.file_and_folder_operations import maybe_mkdir_p, join
# do not modify these unless you know what you are doing
my_output_identifier = "nnUNet"
default_plans_identifier = "nnUNetPlansv2.1"
default_data_identifier = 'nnUNetData_plans_v2.1'
default_trainer = "nnUNetTrainerV2"
default_cascade_trainer = "nnUNetTrainerV2CascadeFullRes"
"""
PLEASE READ paths.md FOR INFORMATION TO HOW TO SET THIS UP
"""
os.environ['nnUNet_raw_data_base'] = 'nnUNet_raw_data_base/'
os.environ['nnUNet_preprocessed'] = 'nnUNet_preprocessed/'
os.environ['RESULTS_FOLDER'] = 'nnUNet_trained_models/'
base = os.environ['nnUNet_raw_data_base'] if "nnUNet_raw_data_base" in os.environ.keys() else None
preprocessing_output_dir = os.environ['nnUNet_preprocessed'] if "nnUNet_preprocessed" in os.environ.keys() else None
# base = 'E:/nzl/nnunetbrats2020/nnUNet-master/nnUNet_raw_data_base'
# preprocessing_output_dir = 'E:/nzl/nnunetbrats2020/nnUNet-master/nnUNet_preprocessed'
network_training_output_dir_base = os.path.join(os.environ['RESULTS_FOLDER']) if "RESULTS_FOLDER" in os.environ.keys() else None
# network_training_output_dir_base = 'E:/nzl/nnunetbrats2020/nnUNet-master/nnUNet_trained_models'
if base is not None:
nnUNet_raw_data = join(base, "nnUNet_raw_data")
nnUNet_cropped_data = join(base, "nnUNet_cropped_data")
maybe_mkdir_p(nnUNet_raw_data)
maybe_mkdir_p(nnUNet_cropped_data)
else:
print("nnUNet_raw_data_base is not defined and nnU-Net can only be used on data for which preprocessed files "
"are already present on your system. nnU-Net cannot be used for experiment planning and preprocessing like "
"this. If this is not intended, please read documentation/setting_up_paths.md for information on how to set this up properly.")
nnUNet_cropped_data = nnUNet_raw_data = None
if preprocessing_output_dir is not None:
maybe_mkdir_p(preprocessing_output_dir)
else:
print("nnUNet_preprocessed is not defined and nnU-Net can not be used for preprocessing "
"or training. If this is not intended, please read documentation/setting_up_paths.md for information on how to set this up.")
preprocessing_output_dir = None
if network_training_output_dir_base is not None:
network_training_output_dir = join(network_training_output_dir_base, my_output_identifier)
maybe_mkdir_p(network_training_output_dir)
else:
print("RESULTS_FOLDER is not defined and nnU-Net cannot be used for training or "
"inference. If this is not intended behavior, please read documentation/setting_up_paths.md for information on how to set this "
"up.")
network_training_output_dir = None