def transform(self, X=None, y=None):
        """
        Transform an image using an Affine transform with the given
        zoom 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.Zoom2D(zoom=(0.8,0.8,0.8))
        >>> img2 = tx.transform(img)
        """
        # unpack zoom range
        zoom_x, zoom_y= self.zoom

        self.params = (zoom_x, zoom_y)
        zoom_matrix = np.array([[zoom_x, 0, 0],
                                [0, zoom_y, 0]])
        self.tx.set_parameters(zoom_matrix)
        if self.lazy or X is None:
            return self.tx
        else:
            return self.tx.apply_to_image(X, reference=self.reference)
Transform an image using an Affine transform with the given
        zoom 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.Zoom2D(zoom=(0.8,0.8,0.8))
        >>> img2 = tx.transform(img)