Rerender all derived images from the original.
        If optmization settings or expected sizes changed,
        they will be used for the new rendering.
437240
def rerender(self):
        '''
        
        '''
        with self.fs.open(self.original, 'rb') as f_img:
            img = io.BytesIO(f_img.read())  # Store the image in memory to avoid overwritting
        self.save(img, filename=self.filename, bbox=self.bbox, overwrite=True)
559426
def redo(self):
        """"""
        if not self.gui_up:
            return

        self.clear_mask()

        image = self.fitsimage.get_image()
        if image is None:
            return

        n_obj = len(self._maskobjs)
        self.logger.debug('Displaying {0} masks'.format(n_obj))
        if n_obj == 0:
            return

        # Display info table
        self.recreate_toc()

        # Draw on canvas
        self.masktag = self.canvas.add(self.dc.CompoundObject(*self._maskobjs))
        self.fitsimage.redraw()
292428
def makeRenderer(rdrid, dp, refresh=False):
    """"""
    try:
        return available_renderers[rdrid][0](dp, refresh=refresh)
    except:
        print("""Error creating renderer %s for %s:""" % (rdrid, dp.fullpath))
        traceback.print_exc()
        return DefaultRenderer(dp)
490837
def redo(self, *args):
        """"""
        if not self.gui_up:
            return

        mod_only = self.w.modified_only.get_state()
        treedict = Bunch.caselessDict()
        self.treeview.clear()
        self.w.status.set_text('')

        channel = self.fv.get_channel(self.chname)
        if channel is None:
            return

        # Only list modified images for saving. Scanning Datasrc is enough.
        if mod_only:
            all_keys = channel.datasrc.keys(sort='alpha')

        # List all images in the channel.
        else:
            all_keys = channel.get_image_names()

        # Extract info for listing and saving
        for key in all_keys:
            iminfo = channel.get_image_info(key)
            path = iminfo.get('path')
            idx = iminfo.get('idx')
            t = iminfo.get('time_modified')

            if path is None:  # Special handling for generated buffer, eg mosaic
                infile = key
                is_fits = True
            else:
                infile = os.path.basename(path)
                infile_ext = os.path.splitext(path)[1]
                infile_ext = infile_ext.lower()
                is_fits = False

                if 'fit' in infile_ext:
                    is_fits = True

            # Only list FITS files unless it is Ginga generated buffer
            if not is_fits:
                continue

            # Only list modified buffers
            if mod_only and t is None:
                continue

            # More than one ext modified, append to existing entry
            if infile in treedict:
                if t is not None:
                    treedict[infile].extlist.add(idx)
                    elist = sorted(treedict[infile].extlist)
                    treedict[infile].MODEXT = ';'.join(
                        map(self._format_extname, elist))

            # Add new entry
            else:
                if t is None:
                    s = ''
                    extlist = set()
                else:
                    s = self._format_extname(idx)
                    extlist = set([idx])
                treedict[infile] = Bunch.Bunch(
                    IMAGE=infile, MODEXT=s, extlist=extlist, path=path)

        self.treeview.set_tree(treedict)

        # Resize column widths
        n_rows = len(treedict)
        if n_rows == 0:
            self.w.status.set_text('Nothing available for saving')
        elif n_rows < self.settings.get('max_rows_for_col_resize', 5000):
            self.treeview.set_optimal_column_widths()
            self.logger.debug('Resized columns for {0} row(s)'.format(n_rows))
609188
def render(self, context):
        self.prepare(context)
        "  "
        if getattr(settings, 'DOUBLE_RENDER', False) and self.can_double_render:
            if 'SECOND_RENDER' not in context:
                return self.double_render()
        key = self.get_cache_key()
        if key:
            rend = cache.get(key)
            if rend is None:
                rend = self._render(context)
                cache.set(key, rend, core_settings.CACHE_TIMEOUT)
        else:
            rend = self._render(context)
        return rend
690033
def render(self, rect, data):
        """"""
        size = self.get_minimum_size(data)

        # Find how much extra space we have.
        extra_width = rect.w - size.x
        extra_height = rect.h - size.y

        # Distribute the extra space into the correct rows and columns.
        if self.scaling_col is None or not 0 <= self.scaling_col < self.cols:
            width_per_col = extra_width / float(self.cols)
            col_widths = [
                width + width_per_col
                for width in self.col_widths
                ]
        else:
            col_widths = self.col_widths[:]
            col_widths[self.scaling_col] += extra_width

        if self.scaling_row is None or not 0 <= self.scaling_row < self.rows:
            height_per_row = extra_height / float(self.rows)
            row_heights = [
                height + height_per_row
                for height in self.row_heights
                ]
        else:
            row_heights = self.row_heights[:]
            row_heights[self.scaling_row] += extra_height

        # Find the (start, end) positions of each row and column.
        col_xs = []
        last_x = rect.left + self.outside_margin
        for width in col_widths:
            col_xs.append((last_x, last_x + width))
            last_x += width + self.margin
        row_ys = []
        last_y = rect.top - self.outside_margin
        for height in row_heights:
            row_ys.append((last_y, last_y - height))
            last_y -= height + self.margin

        # Now we can loop over the elements and have them rendered.
        for col, row, cols, rows, element in self.elements:
            x_start = col_xs[col][0]
            y_start = row_ys[row][0]
            x_end = col_xs[col+cols-1][1]
            y_end = row_ys[row+rows-1][1]
            element.render(datatypes.Rectangle(
                x_start, y_end, x_end-x_start, y_start-y_end
                ), data)

        # And finally we can draw the rules
        def _get_value(array, index, sign):
            """Returns the value of the index in the given array, where
            the array (like col_xs and row_ys), consists of start-end pairs
            of values."""
            if index <= 0:
                # Special case, it is the start of the first range
                return array[0][0]-self.outside_margin*sign
            elif index >= len(array):
                # Special case, it is the end of the last range
                return array[-1][1]+self.outside_margin*sign
            else:
                # Otherwise it is the blend of a start and end.
                return (array[index-1][1] + array[index][0])*0.5

        for start_col, start_row, end_col, end_row, width, color in self.rules:
            x_start = _get_value(col_xs, start_col, 1)
            y_start = _get_value(row_ys, start_row, -1)
            x_end = _get_value(col_xs, end_col, 1)
            y_end = _get_value(row_ys, end_row, -1)
            data['output'].line(
                x_start, y_start, x_end, y_end,
                stroke=color,
                stroke_width=width
                )
546319
protected void recreateLedImages(final int SIZE) {
        if (ledImageOff != null) {
            ledImageOff.flush();
        }
        ledImageOff = create_LED_Image(SIZE, 0, model.getLedColor());

        if (ledImageOn != null) {
            ledImageOn.flush();
        }
        ledImageOn = create_LED_Image(SIZE, 1, model.getLedColor());
    }
890715
def redo(self, channel, image):
        """"""
        chname = channel.name
        if image is None:
            # shouldn't happen, but let's play it safe
            return

        imname = image.get('name', 'none')
        iminfo = channel.get_image_info(imname)
        timestamp = iminfo.time_modified

        if timestamp is None:
            reason = iminfo.get('reason_modified', None)
            if reason is not None:
                self.fv.show_error(
                    "{0} invoked 'modified' callback to ChangeHistory with a "
                    "reason but without a timestamp. The plugin invoking the "
                    "callback is no longer be compatible with Ginga. "
                    "Please contact plugin developer to update the plugin "
                    "to use self.fv.update_image_info() like Mosaic "
                    "plugin.".format(imname))

            # Image somehow lost its history
            self.remove_image_info_cb(self.fv, channel, iminfo)
            return

        self.add_entry(chname, iminfo)
568633
def refresh(self):
        
        for cbar in self.colorbars:
            cbar.draw_all()
        self.canvas.draw()
256867
def redo(self, channel, image):
        """"""
        self._image = None  # Skip cache checking in set_header()
        info = channel.extdata._header_info

        self.set_header(info, image)
37937
def redo(self, channel, image):
        """"""
        self.logger.debug("image set")
        chname = channel.name

        # get old highlighted thumbs for this channel -- will be
        # an empty set or one thumbkey
        old_highlight = channel.extdata.thumbs_old_highlight

        # calculate new highlight thumbkeys -- again, an empty set
        # or one thumbkey
        if image is not None:
            thumbkey = self._get_thumb_key(chname, image)
            new_highlight = set([thumbkey])
        else:
            # no image has the focus
            new_highlight = set([])

        # TODO: already calculated thumbkey, use simpler test
        if not self.have_thumbnail(channel.fitsimage, image):
            # No memory of this thumbnail, so regenerate it
            self._add_image(self.fv, chname, image)

        self.logger.debug("highlighting")
        # Only highlights active image in the current channel
        if self.highlight_tracks_keyboard_focus:
            self.update_highlights(self._tkf_highlight, new_highlight)
            self._tkf_highlight = new_highlight

        # Highlight all active images in all channels
        else:
            self.update_highlights(old_highlight, new_highlight)
            channel.extdata.thumbs_old_highlight = new_highlight
788175
def redraw_map(self):
        ''''''
        state = self.state

        view_same = (self.last_view and self.map_img and self.last_view == self.current_view())

        if view_same and not state.need_redraw:
            return

        # get the new map
        self.map_img = state.mt.area_to_image(state.lat, state.lon,
                                              state.width, state.height, state.ground_width)
        if state.brightness != 1.0:
            cv.ConvertScale(self.map_img, self.map_img, scale=state.brightness)


        # find display bounding box
        (lat2,lon2) = self.coordinates(state.width-1, state.height-1)
        bounds = (lat2, state.lon, state.lat-lat2, lon2-state.lon)

        # get the image
        img = cv.CloneImage(self.map_img)

        # possibly draw a grid
        if state.grid:
            SlipGrid('grid', layer=3, linewidth=1, colour=(255,255,0)).draw(img, self.pixmapper, bounds)

        # draw layer objects
        keys = state.layers.keys()
        keys.sort()
        for k in keys:
            self.draw_objects(state.layers[k], bounds, img)

        # draw information objects
        for key in state.info:
            state.info[key].draw(state.panel, state.panel.information)

        # display the image
        self.img = wx.EmptyImage(state.width,state.height)
        self.img.SetData(img.tostring())
        self.imagePanel.set_image(self.img)

        self.update_position()

        self.mainSizer.Fit(self)
        self.Refresh()
        self.last_view = self.current_view()
        self.SetFocus()
        state.need_redraw = False
71251
public void apply() {
		// see if the distortion class needs to be created again
		if( distorter == null ) {
			Class typeOut = output.getImageType().getImageClass();
			switch( input.getImageType().getFamily() ) {
				case GRAY:
					distorter = FactoryDistort.distortSB(cached, (InterpolatePixelS)interp, typeOut);
					break;

				case PLANAR:
					distorter = FactoryDistort.distortPL(cached, (InterpolatePixelS)interp, typeOut);
					break;

				case INTERLEAVED:
					distorter = FactoryDistort.distortIL(cached, (InterpolatePixelMB) interp, output.getImageType());
					break;

				default:
					throw new IllegalArgumentException("Unsupported image type");
			}
		}
		distorter.setModel(outputToInput);

		distorter.apply(input,output);
	}
409399
private void swapImages() {
		ImagePyramid<Image> tempP;

		tempP = currentImage;
		currentImage = previousImage;
		previousImage = tempP;

		Derivative[] tempD;

		tempD = previousDerivX;
		previousDerivX = currentDerivX;
		currentDerivX = tempD;

		tempD = previousDerivY;
		previousDerivY = currentDerivY;
		currentDerivY = tempD;
	}
656673
def render():
    ''''''
    from udata.core.organization.models import Organization
    from udata.core.post.models import Post
    from udata.core.reuse.models import Reuse
    from udata.core.user.models import User

    header('Rendering images')

    count = Counter()
    total = Counter()

    organizations = Organization.objects(logo__exists=True)
    total['orgs'] = organizations.count()
    log.info('Processing {0} organizations logos'.format(total['orgs']))
    for org in organizations:
        count['orgs'] += render_or_skip(org, 'logo')

    users = User.objects(avatar__exists=True)
    total['users'] = users.count()
    log.info('Processing {0} user avatars'.format(total['users']))
    for user in users:
        count['users'] += render_or_skip(user, 'avatar')

    posts = Post.objects(image__exists=True)
    total['posts'] = posts.count()
    log.info('Processing {0} post images'.format(total['posts']))
    for post in posts:
        count['posts'] += render_or_skip(post, 'image')

    reuses = Reuse.objects(image__exists=True)
    total['reuses'] = reuses.count()
    log.info('Processing {0} reuse images'.format(total['reuses']))
    for reuse in reuses:
        count['reuses'] += render_or_skip(reuse, 'image')

    log.info('''Summary:
    Organization logos: {count[orgs]}/{total[orgs]}
    User avatars: {count[users]}/{total[users]}
    Post images: {count[posts]}/{total[posts]}
    Reuse images: {count[reuses]}/{total[reuses]}
    '''.format(count=count, total=total))
    success('Images rendered')
1206937
def render_image2(self, rgbobj, dst_x, dst_y):
        
        self.logger.debug("redraw surface")
        if self.figure is None:
            return

        ## left, bottom, width, height = self.ax_img.bbox.bounds
        ## self._imgwin_wd, self._imgwin_ht = width, height

        # Grab the RGB array for the current image and place it in the
        # matplotlib figure axis
        arr = self.getwin_array(order=self.rgb_order, dtype=np.uint8)

        # Get the data extents
        x0, y0 = 0, 0
        y1, x1 = arr.shape[:2]
        flipx, flipy, swapxy = self.get_transforms()
        if swapxy:
            x0, x1, y0, y1 = y0, y1, x0, x1

        extent = (x0, x1, y1, y0)
        self.logger.debug("extent=%s" % (str(extent)))

        # Calculate aspect ratio
        aspect = self.calculate_aspect(arr.shape, extent)

        if self.mpimage is None:
            img = self.ax_img.imshow(arr, interpolation='none',
                                     origin="upper",
                                     vmin=0, vmax=255,
                                     extent=extent,
                                     aspect=aspect)
            self.mpimage = img

        else:
            self.mpimage.set_data(arr)
            self.ax_img.set_aspect(aspect)
            self.mpimage.set_extent(extent)
746393
public void redraw(){
        mItemCount = getShouldDrawCount();
        mPreviousSelectedIndicator = null;
        for(View i:mIndicators){
            removeView(i);
        }


        for(int i =0 ;i< mItemCount; i++){
            ImageView indicator = new ImageView(mContext);
            indicator.setImageDrawable(mUnselectedDrawable);
            indicator.setPadding((int)mUnSelectedPadding_Left,
                    (int)mUnSelectedPadding_Top,
                    (int)mUnSelectedPadding_Right,
                    (int)mUnSelectedPadding_Bottom);
            addView(indicator);
            mIndicators.add(indicator);
        }
        setItemAsSelected(mPreviousSelectedPosition);
    }