# Implementation of this model is borrowed and modified # (from torch to paddle) from here: # https://github.com/MIC-DKFZ/nnUNet # Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved. # # 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 numpy as np from copy import deepcopy default_3D_augmentation_params = { "selected_data_channels": None, "selected_seg_channels": None, "do_elastic": True, "elastic_deform_alpha": (0., 900.), "elastic_deform_sigma": (9., 13.), "p_eldef": 0.2, "do_scaling": True, "scale_range": (0.85, 1.25), "independent_scale_factor_for_each_axis": False, "p_independent_scale_per_axis": 1, "p_scale": 0.2, "do_rotation": True, "rotation_x": (-15. / 360 * 2. * np.pi, 15. / 360 * 2. * np.pi), "rotation_y": (-15. / 360 * 2. * np.pi, 15. / 360 * 2. * np.pi), "rotation_z": (-15. / 360 * 2. * np.pi, 15. / 360 * 2. * np.pi), "rotation_p_per_axis": 1, "p_rot": 0.2, "random_crop": False, "random_crop_dist_to_border": None, "do_gamma": True, "gamma_retain_stats": True, "gamma_range": (0.7, 1.5), "p_gamma": 0.3, "do_mirror": True, "mirror_axes": (0, 1, 2), "dummy_2D": False, "mask_was_used_for_normalization": None, "border_mode_data": "constant", "all_segmentation_labels": None, "move_last_seg_chanel_to_data": False, "cascade_do_cascade_augmentations": False, "cascade_random_binary_transform_p": 0.4, "cascade_random_binary_transform_p_per_label": 1, "cascade_random_binary_transform_size": (1, 8), "cascade_remove_conn_comp_p": 0.2, "cascade_remove_conn_comp_max_size_percent_threshold": 0.15, "cascade_remove_conn_comp_fill_with_other_class_p": 0.0, "do_additive_brightness": False, "additive_brightness_p_per_sample": 0.15, "additive_brightness_p_per_channel": 0.5, "additive_brightness_mu": 0.0, "additive_brightness_sigma": 0.1, "num_threads": 8, "num_cached_per_thread": 1, } default_2D_augmentation_params = deepcopy(default_3D_augmentation_params) default_2D_augmentation_params["elastic_deform_alpha"] = (0., 200.) default_2D_augmentation_params["elastic_deform_sigma"] = (9., 13.) default_2D_augmentation_params["rotation_x"] = (-180. / 360 * 2. * np.pi, 180. / 360 * 2. * np.pi) default_2D_augmentation_params["rotation_y"] = (-0. / 360 * 2. * np.pi, 0. / 360 * 2. * np.pi) default_2D_augmentation_params["rotation_z"] = (-0. / 360 * 2. * np.pi, 0. / 360 * 2. * np.pi) default_2D_augmentation_params["dummy_2D"] = False default_2D_augmentation_params["mirror_axes"] = (0, 1)