'Return the result of ROI.getArrayRegion() masked by the elliptical shape
of the ROI. Regions outside the ellipse are set to 0.'

def getArrayRegion(self, arr, img=None, axes=(0, 1), **kwds):

    arr = ROI.getArrayRegion(self, arr, img, axes, **kwds)
    if ((arr is None) or (arr.shape[axes[0]] == 0) or (arr.shape[axes[1]] == 0)):
        return arr
    w = arr.shape[axes[0]]
    h = arr.shape[axes[1]]
    mask = np.fromfunction((lambda x, y: (((((((x + 0.5) / (w / 2.0)) - 1) ** 2) + ((((y + 0.5) / (h / 2.0)) - 1) ** 2)) ** 0.5) < 1)), (w, h))
    if (axes[0] > axes[1]):
        mask = mask.T
    shape = [(n if (i in axes) else 1) for (i, n) in enumerate(arr.shape)]
    mask = mask.reshape(shape)
    return (arr * mask)
