def rotate_ccw_about_centre(self, theta, degrees=True, retain_shape=False,
                                cval=0.0, round='round', order=1,
                                return_transform=False):
        r"""
        Return a copy of this image, rotated counter-clockwise about its centre.

        Note that the `retain_shape` argument defines the shape of the rotated
        image. If ``retain_shape=True``, then the shape of the rotated image
        will be the same as the one of current image, so some regions will
        probably be cropped. If ``retain_shape=False``, then the returned image
        has the correct size so that the whole area of the current image is
        included.

        Parameters
        ----------
        theta : `float`
            The angle of rotation about the centre.
        degrees : `bool`, optional
            If ``True``, `theta` is interpreted in degrees. If ``False``,
            ``theta`` is interpreted as radians.
        retain_shape : `bool`, optional
            If ``True``, then the shape of the rotated image will be the same as
            the one of current image, so some regions will probably be cropped.
            If ``False``, then the returned image has the correct size so that
            the whole area of the current image is included.
        cval : `float`, optional
            The value to be set outside the rotated image boundaries.
        round : ``{'ceil', 'floor', 'round'}``, optional
            Rounding function to be applied to floating point shapes. This is
            only used in case ``retain_shape=True``.
        order : `int`, optional
            The order of interpolation. The order has to be in the range
            ``[0,5]``. This is only used in case ``retain_shape=True``.

            ========= ====================
            Order     Interpolation
            ========= ====================
            0         Nearest-neighbor
            1         Bi-linear *(default)*
            2         Bi-quadratic
            3         Bi-cubic
            4         Bi-quartic
            5         Bi-quintic
            ========= ====================

        return_transform : `bool`, optional
            If ``True``, then the :map:`Transform` object that was used to
            perform the rotation is also returned.

        Returns
        -------
        rotated_image : ``type(self)``
            The rotated image.
        transform : :map:`Transform`
            The transform that was used. It only applies if
            `return_transform` is ``True``.

        Raises
        ------
        ValueError
            Image rotation is presently only supported on 2D images
        """
        if self.n_dims != 2:
            raise ValueError('Image rotation is presently only supported on '
                             '2D images')

        if retain_shape:
            # Rotate the image about its centre
            trans = rotate_ccw_about_centre(self, theta, degrees=degrees)
            # Output image's shape must be the same as the original one
            shape = self.shape
        else:
            # Get image's bounding box coordinates
            bbox = bounding_box((0, 0), [self.shape[0] - 1, self.shape[1] - 1])
            # Translate to origin and rotate counter-clockwise
            trans = Translation(-self.centre(),
                                skip_checks=True).compose_before(
                Rotation.init_from_2d_ccw_angle(theta, degrees=degrees))
            rotated_bbox = trans.apply(bbox)
            # Create new translation so that min bbox values go to 0
            t = Translation(-rotated_bbox.bounds()[0])
            trans.compose_before_inplace(t)
            rotated_bbox = trans.apply(bbox)
            # Output image's shape is the range of the rotated bounding box
            # while respecting the users rounding preference.
            shape = round_image_shape(rotated_bbox.range() + 1, round)

        # Warp image
        return self.warp_to_shape(
            shape, trans.pseudoinverse(), order=order, warp_landmarks=True,
            cval=cval, return_transform=return_transform)
dataset/ETHPy150Open menpo/menpo/menpo/image/base.py/Image.rotate_ccw_about_centre/original