class_docstr: Static predictor for nnunet.
class_docstr_tok: ["Static","predictor","for","nnunet","."]
code: def _internal_predict_3D_3Dconv_tiled(
      self,
      x: np.ndarray,
      step_size: float,
      do_mirroring: bool,
      mirror_axes: tuple,
      patch_size: tuple,
      regions_class_order: tuple,
      use_gaussian: bool,
      pad_border_mode: str,
      pad_kwargs: dict,
      verbose: bool,
  ) -> Tuple[np.ndarray, np.ndarray]:
      assert len(x.shape) == 4, "x must be (c, x, y, z)"
      assert (
          patch_size is not None
      ), "patch_size cannot be None for tiled prediction"
  
      data, slicer = pad_nd_image(
          x, patch_size, pad_border_mode, pad_kwargs, True, None
      )
      data_shape = data.shape
  
      steps = self._compute_steps_for_sliding_window(
          patch_size, data_shape[1:], step_size
      )
      num_tiles = len(steps[0]) * len(steps[1]) * len(steps[2])
  
      if verbose:
          print("step_size:", step_size)
          print("do mirror:", do_mirroring)
          print("data shape:", data_shape)
          print("patch size:", patch_size)
          print("steps (x, y, and z):", steps)
          print("number of tiles:", num_tiles)
  
      if use_gaussian and num_tiles > 1:
          if self._gaussian_3d is None or not all(
              [
                  i == j
                  for i, j in zip(
                      patch_size, self._patch_size_for_gaussian_3d
                  )
              ]
          ):
              gaussian_importance_map = self._get_gaussian(
                  patch_size, sigma_scale=1.0 / 8
              )
  
              self._gaussian_3d = gaussian_importance_map
              self._patch_size_for_gaussian_3d = patch_size
              if verbose:
                  print("computing Gaussian done")
          else:
              if verbose:
                  print("using precomputed Gaussian")
              gaussian_importance_map = self._gaussian_3d
  
      else:
          gaussian_importance_map = None
  
      if use_gaussian and num_tiles > 1:
          add_for_nb_of_preds = self._gaussian_3d
      else:
          add_for_nb_of_preds = np.ones(patch_size, dtype=np.float32)
      aggregated_results = np.zeros(
          [self.num_classes] + list(data.shape[1:]), dtype=np.float32
      )
      aggregated_nb_of_predictions = np.zeros(
          [self.num_classes] + list(data.shape[1:]), dtype=np.float32
      )
  
      for x in steps[0]:
          lb_x = x
          ub_x = x + patch_size[0]
          for y in steps[1]:
              lb_y = y
              ub_y = y + patch_size[1]
              for z in steps[2]:
                  lb_z = z
                  ub_z = z + patch_size[2]
  
                  predicted_patch = (
                      self._internal_maybe_mirror_and_pred_3D(
                          data[
                              None, :, lb_x:ub_x, lb_y:ub_y, lb_z:ub_z
                          ],
                          mirror_axes,
                          do_mirroring,
                          gaussian_importance_map,
                      )[0]
                  )
  
                  predicted_patch = predicted_patch
                  aggregated_results[
                      :, lb_x:ub_x, lb_y:ub_y, lb_z:ub_z
                  ] += predicted_patch
                  aggregated_nb_of_predictions[
                      :, lb_x:ub_x, lb_y:ub_y, lb_z:ub_z
                  ] += add_for_nb_of_preds
  
      slicer = tuple(
          [
              slice(0, aggregated_results.shape[i])
              for i in range(
                  len(aggregated_results.shape) - (len(slicer) - 1)
              )
          ]
          + slicer[1:]
      )
      aggregated_results = aggregated_results[slicer]
      aggregated_nb_of_predictions = aggregated_nb_of_predictions[
          slicer
      ]
      aggregated_results /= aggregated_nb_of_predictions
  
      del aggregated_nb_of_predictions
      if regions_class_order is None:
          predicted_segmentation = aggregated_results.argmax(0)
      else:
          class_probabilities_here = aggregated_results
          predicted_segmentation = np.zeros(
              class_probabilities_here.shape[1:], dtype=np.float32
          )
          for i, c in enumerate(regions_class_order):
              predicted_segmentation[
                  class_probabilities_here[i] > 0.5
              ] = c
  
      if verbose:
          print("prediction done")
      return predicted_segmentation, aggregated_results
  
imports: import pickle
  import numpy
  from functools import partial
  from typing import Tuple, List, Union
  from scipy.ndimage.filters import gaussian_filter
  from paddle.inference import create_predictor, PrecisionType
  from paddle.inference import Config
  from tools.preprocess_utils import GenericPreprocessor, PreprocessorFor2D
  from nnunet.utils.utils import no_op, pad_nd_image
  from nnunet.transforms import default_2D_augmentation_params, default_3D_augmentation_params
label_desc: Use image node_id 6 for calling the StaticBasePredictor obj's underlying member method code with example usage: obj._internal_predict_3D_3Dconv_tiled(x, step_size, do_mirroring, mirror_axes, patch_size, regions_class_order, use_gaussian, pad_border_mode, pad_kwargs, verbose) and returns: predicted_segmentation,  aggregated_results