code: def get_patch_size(
      final_patch_size, rot_x, rot_y, rot_z, scale_range
  ):
      if isinstance(rot_x, (tuple, list)):
          rot_x = max(np.abs(rot_x))
      if isinstance(rot_y, (tuple, list)):
          rot_y = max(np.abs(rot_y))
      if isinstance(rot_z, (tuple, list)):
          rot_z = max(np.abs(rot_z))
      rot_x = min(90 / 360 * 2.0 * np.pi, rot_x)
      rot_y = min(90 / 360 * 2.0 * np.pi, rot_y)
      rot_z = min(90 / 360 * 2.0 * np.pi, rot_z)
  
      coords = np.array(final_patch_size)
      final_shape = np.copy(coords)
      if len(coords) == 3:
          final_shape = np.max(
              np.vstack(
                  (
                      np.abs(rotate_coords_3d(coords, rot_x, 0, 0)),
                      final_shape,
                  )
              ),
              0,
          )
          final_shape = np.max(
              np.vstack(
                  (
                      np.abs(rotate_coords_3d(coords, 0, rot_y, 0)),
                      final_shape,
                  )
              ),
              0,
          )
          final_shape = np.max(
              np.vstack(
                  (
                      np.abs(rotate_coords_3d(coords, 0, 0, rot_z)),
                      final_shape,
                  )
              ),
              0,
          )
      elif len(coords) == 2:
          final_shape = np.max(
              np.vstack(
                  (np.abs(rotate_coords_2d(coords, rot_x)), final_shape)
              ),
              0,
          )
      final_shape /= min(scale_range)
      return final_shape.astype(int)
  
imports: import os
  import pickle
  import glob
  import json
  import numpy
  from multiprocessing import Pool
  from collections import OrderedDict
  from sklearn.model_selection import KFold
  from typing import List
  from medicalseg.datasets import MedicalDataset
  from medicalseg.cvlibs import manager
  from nnunet.transforms import get_moreDA_augmentation, default_2D_augmentation_params, default_3D_augmentation_params
  from nnunet.transforms import rotate_coords_3d, rotate_coords_2d, NumpyToTensor
  from .dataloader import DataLoader2D, DataLoader3D
  from tools.preprocess_utils import verify_dataset_integrity, convert_to_decathlon, crop, ExperimentPlanner2D_v21, ExperimentPlanner3D_v21, DatasetAnalyzer
label_desc: Use image node_id 3 for calling a global function with example usage: get_patch_size(final_patch_size, rot_x, rot_y, rot_z, scale_range) and returns: final_shape