code: def __random_center_crop__(self, data, label):
      from random import random
  
      """
          Random crop
          """
      target_indexs = np.where(label > 0)
      [img_d, img_h, img_w] = data.shape
      [max_D, max_H, max_W] = np.max(np.array(target_indexs), axis=1)
      [min_D, min_H, min_W] = np.min(np.array(target_indexs), axis=1)
      [target_depth, target_height, target_width] = np.array(
          [max_D, max_H, max_W]
      ) - np.array([min_D, min_H, min_W])
      Z_min = int((min_D - target_depth * 1.0 / 2) * random())
      Y_min = int((min_H - target_height * 1.0 / 2) * random())
      X_min = int((min_W - target_width * 1.0 / 2) * random())
  
      Z_max = int(
          img_d
          - ((img_d - (max_D + target_depth * 1.0 / 2)) * random())
      )
      Y_max = int(
          img_h
          - ((img_h - (max_H + target_height * 1.0 / 2)) * random())
      )
      X_max = int(
          img_w
          - ((img_w - (max_W + target_width * 1.0 / 2)) * random())
      )
  
      Z_min = np.max([0, Z_min])
      Y_min = np.max([0, Y_min])
      X_min = np.max([0, X_min])
  
      Z_max = np.min([img_d, Z_max])
      Y_max = np.min([img_h, Y_max])
      X_max = np.min([img_w, X_max])
  
      Z_min = int(Z_min)
      Y_min = int(Y_min)
      X_min = int(X_min)
  
      Z_max = int(Z_max)
      Y_max = int(Y_max)
      X_max = int(X_max)
  
      return (
          data[Z_min:Z_max, Y_min:Y_max, X_min:X_max],
          label[Z_min:Z_max, Y_min:Y_max, X_min:X_max],
      )
  
file_path: MedicalNet/datasets/brains18.py
imports: import math
  import os
  import random
  import numpy
  from torch.utils.data import Dataset
  import nibabel
  from scipy import ndimage
label_desc: Use image node_id 6 for calling the BrainS18Dataset obj's underlying member method code with example usage: obj.__random_center_crop__(data, label) and returns: data,  label