class_docstr: Take a random 2D slice from a 3D image along
  a given axis. This image should not have a 4th channel dim.
  
  :param axis: (int `in {0, 1, 2}`):
      the axis on which to take slices
  
  :param reject_zeros: (bool):
      whether to reject slices that are all zeros
code: def __init__(self, axis=0, reject_zeros=False):
      self.axis = axis
      self.reject_zeros = reject_zeros
  
imports: import os
  import random
  import math
  import numpy
  import torch
label_desc: Use image node_id 1 to create a new Slice2D object  with example: obj = Slice2D(axis, reject_zeros)