def METHOD_NAME(self, data):
    """
    Update the window with the new image (the window is resize to have the image
    at ratio 1:1)
    data (numpy.ndarray): an 2D array containing the image (can be 3D if in RGB)
    """
    if data.ndim == 3 and 3 in data.shape: # RGB
        rgb = img.ensureYXC(data)
    elif numpy.prod(data.shape) == 1:  # single point => show text
        text = "%g" % (data.flat[0],)
        logging.info("Data value is: %s", text)
        # Create a big enough white space (30x200 px) of BGRA format
        rgb = numpy.empty((30, 200, 4), dtype=numpy.uint8)
        rgb.fill(255)
        # Get a Cairo context for that image
        surface = cairo.ImageSurface.create_for_data(
            rgb, cairo.FORMAT_ARGB32, rgb.shape[1], rgb.shape[0])
        ctx = cairo.Context(surface)
        # Draw a black text of 20 px high
        ctx.set_source_rgb(0, 0, 0)
        ctx.select_font_face("Sans", cairo.FONT_SLANT_NORMAL)
        ctx.set_font_size(20)
        ctx.move_to(5, 20)
        ctx.show_text(text)
        del ctx  # ensure the context is flushed
    elif numpy.prod(data.shape) == data.shape[-1]: # 1D image => bar plot
        # TODO: add "(plot)" to the window title
        # Create a simple bar plot of X x 400 px
        lenx = data.shape[-1]
        if lenx > MAX_WIDTH:
            binning = lenx // MAX_WIDTH
            data = data[..., 0::binning]
            logging.debug("Compressed data from %d to %d elements", lenx, data.shape[-1])
            lenx = data.shape[-1]
        leny = 400
        miny = min(0, data.min())
        maxy = data.max()
        diffy = maxy - miny
        if diffy == 0:
            diffy = 1
        logging.info("Plot data from %s to %s", miny, maxy)
        rgb = numpy.zeros((leny, lenx, 3), dtype=numpy.uint8)
        for i, v in numpy.ndenumerate(data):
            # TODO: have the base at 0, instead of miny, so that negative values are columns going down
            h = leny - int(((v - miny) * leny) / diffy)
            rgb[h:-1, i[-1], :] = 255
    else: # Greyscale (hopefully)
        mn, mx, mnp, mxp = ndimage.extrema(data)
        logging.info("Image data from %s to %s", mn, mx)
        rgb = img.DataArray2RGB(data) # auto brightness/contrast
    self.app.img = NDImage2wxImage(rgb)
    disp_size = wx.Display(0).GetGeometry().GetSize()
    if disp_size[0] < rgb.shape[1] or disp_size[1] < rgb.shape[0]:
        asp_ratio = rgb.shape[1] / rgb.shape[0]
        if disp_size[0] / disp_size[1] < asp_ratio:
            self.app.magn = disp_size[0] / rgb.shape[1]
        else:
            self.app.magn = disp_size[1] / rgb.shape[0]
        self.app.img.Rescale(rgb.shape[1] * self.app.magn,
                             rgb.shape[0] * self.app.magn,
                             rgb.shape[2])
    else:
        self.app.magn = 1
    wx.CallAfter(self.app.update_view)