class_docstr: generate randomised rotation matrix for data augmentation
class_docstr_tok: ["generate","randomised","rotation","matrix","for","data","augmentation"]
code: def _randomise_transformation_3d(self):
      angle_x = 0.0
      angle_y = 0.0
      angle_z = 0.0
      if self.min_angle is None and self.max_angle is None:
          # generate transformation
          if len(self.rotation_angle_x) >= 2:
              angle_x = (
                  np.random.uniform(
                      self.rotation_angle_x[0], self.rotation_angle_x[1]
                  )
                  * np.pi
                  / 180.0
              )
  
          if len(self.rotation_angle_y) >= 2:
              angle_y = (
                  np.random.uniform(
                      self.rotation_angle_y[0], self.rotation_angle_y[1]
                  )
                  * np.pi
                  / 180.0
              )
  
          if len(self.rotation_angle_z) >= 2:
              angle_z = (
                  np.random.uniform(
                      self.rotation_angle_z[0], self.rotation_angle_z[1]
                  )
                  * np.pi
                  / 180.0
              )
      else:
          # generate transformation
          angle_x = (
              np.random.uniform(self.min_angle, self.max_angle)
              * np.pi
              / 180.0
          )
          angle_y = (
              np.random.uniform(self.min_angle, self.max_angle)
              * np.pi
              / 180.0
          )
          angle_z = (
              np.random.uniform(self.min_angle, self.max_angle)
              * np.pi
              / 180.0
          )
  
      transform_x = np.array(
          [
              [np.cos(angle_x), -np.sin(angle_x), 0.0],
              [np.sin(angle_x), np.cos(angle_x), 0.0],
              [0.0, 0.0, 1.0],
          ]
      )
      transform_y = np.array(
          [
              [np.cos(angle_y), 0.0, np.sin(angle_y)],
              [0.0, 1.0, 0.0],
              [-np.sin(angle_y), 0.0, np.cos(angle_y)],
          ]
      )
      transform_z = np.array(
          [
              [1.0, 0.0, 0.0],
              [0.0, np.cos(angle_z), -np.sin(angle_z)],
              [0.0, np.sin(angle_z), np.cos(angle_z)],
          ]
      )
      transform = np.dot(transform_z, np.dot(transform_x, transform_y))
      self._transform = transform
  
file_path: NiftyNet/niftynet/layer/rand_rotation.py
imports: from __future__ import absolute_import, print_function
  import numpy
  import scipy.ndimage
  from niftynet.layer.base_layer import RandomisedLayer
label_desc: Use image node_id 5 for calling the RandomRotationLayer obj's underlying member method code with example usage: obj._randomise_transformation_3d() without return types