code: def apply(self, method, *args, **kwargs):
          
          data = method(self.data, *args, **kwargs)
          return type(self)(data.astype(self.type), self.frame)
docs: Create a new image by applying a function to this image's data.
  
          Parameters
          ----------
          method : :obj:`function`
              A function to call on the data. This takes in a ndarray
              as its first argument and optionally takes other arguments.
              It should return a modified data ndarray.
  
          args : arguments
              Additional args for method.
  
          kwargs : keyword arguments
              Additional keyword arguments for method.
  
          Returns
          -------
          :obj:`Image`
              A new Image of the same type with new data generated by calling
              method on the current image's data.