code: def transform(self, X=None, y=None):
          
          # unpack zoom range
          rotation = self.rotation
  
          # Rotation about X axis
          theta = math.pi / 180 * rotation
          rotation_matrix = np.array([[np.cos(theta), -np.sin(theta), 0],
                                      [np.sin(theta),  np.cos(theta), 0]])
  
          self.tx.set_parameters(rotation_matrix)
          if self.lazy or X is None:
              return self.tx
          else:
              return self.tx.apply_to_image(X, reference=self.reference)
docs: Transform an image using an Affine transform with the given
          rotation parameters.   Return the transform if X=None.
  
          Arguments
          ---------
          X : ANTsImage
              Image to transform
  
          y : ANTsImage (optional)
              Another image to transform
  
          Returns
          -------
          ANTsImage if y is None, else a tuple of ANTsImage types
  
          Examples
          --------
          >>> import ants
          >>> img = ants.image_read(ants.get_data('r16'))
          >>> tx = ants.contrib.Rotate2D(rotation=(10,-5,12))
          >>> img2 = tx.transform(img)