code: def transform(self, X=None, y=None):
          
          # convert to radians and unpack
          shear = [math.pi / 180 * s for s in self.shear]
          shear_x, shear_y = shear
  
          shear_matrix = np.array([[1, shear_x, 0],
                                   [shear_y, 1, 0]])
          self.tx.set_parameters(shear_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
          shear 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.Shear2D(shear=(10,0,0))
          >>> img2_x = tx.transform(img)# x axis stays same
          >>> tx = ants.contrib.Shear2D(shear=(-10,0,0)) # other direction
          >>> img2_x = tx.transform(img)# x axis stays same
          >>> tx = ants.contrib.Shear2D(shear=(0,10,0))
          >>> img2_y = tx.transform(img) # y axis stays same
          >>> tx = ants.contrib.Shear2D(shear=(0,0,10))
          >>> img2_z = tx.transform(img) # z axis stays same
          >>> tx = ants.contrib.Shear2D(shear=(10,10,10))
          >>> img2 = tx.transform(img)