def METHOD_NAME(render_window, as_vtk=False, ignore_alpha=False, scale=1):
    """Extract the image from the render window as an array.
    Parameters
    ----------
    render_window : vtk.vtkRenderWindow
        The render window to extract the image from.
    as_vtk : bool, default: False
        If set to True, the image will be returned as a VTK object.
    ignore_alpha : bool, default: False
        If set to True, the image will be returned in RGB format,
        otherwise, it will be returned in RGBA format.
    scale : int, default: 1
        The scaling factor of the extracted image. The default value is 1
        which means that no scaling is applied.
    Returns
    -------
    ndarray | vtk.vtkImageData
        The image as an array or as a VTK object depending on the ``as_vtk`` parameter.
    """
    off = not render_window.GetInteractor().GetEnableRender()
    if off:
        render_window.GetInteractor().EnableRenderOn()
    imfilter = _vtk.vtkWindowToImageFilter()
    imfilter.SetInput(render_window)
    imfilter.SetScale(scale)
    imfilter.FixBoundaryOn()
    imfilter.ReadFrontBufferOff()
    imfilter.ShouldRerenderOff()
    if ignore_alpha:
        imfilter.SetInputBufferTypeToRGB()
    else:
        imfilter.SetInputBufferTypeToRGBA()
    imfilter.ReadFrontBufferOn()
    data = run_image_filter(imfilter)
    if off:
        # Critical for Trame and other offscreen tools
        render_window.GetInteractor().EnableRenderOff()
    if as_vtk:
        return wrap_image_array(data)
    return data