docstr: Cut off the invalid area
docstr_tok: ["Cut","off","the","invalid","area"]
code: def __drop_invalid_range__(self, volume, label=None):
      """
      Cut off the invalid area
      """
      zero_value = volume[0, 0, 0]
      non_zeros_idx = np.where(volume != zero_value)
  
      [max_z, max_h, max_w] = np.max(np.array(non_zeros_idx), axis=1)
      [min_z, min_h, min_w] = np.min(np.array(non_zeros_idx), axis=1)
  
      if label is not None:
          return (
              volume[min_z:max_z, min_h:max_h, min_w:max_w],
              label[min_z:max_z, min_h:max_h, min_w:max_w],
          )
      else:
          return volume[min_z:max_z, min_h:max_h, min_w:max_w]
  
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 5 for calling the BrainS18Dataset obj's underlying member method code with example usage: obj.__drop_invalid_range__(volume, label) and returns: volume,  label, volume