Returns pixel centers.
        See documentation for the GDAL function GetGeoTransform for details.
553881
def projection_to_raster_coords(self, lat, lon):
        
        r_px_py = np.array([1, lon, lat])
        tg = inv(np.array([[1, 0, 0], self.geotransform[0:3], self.geotransform[3:6]]))
        return np.inner(tg, r_px_py)[1:]
1231002
def most_free_pixel(self):
        
        dist_tf = self.to_distance_im()
        max_px = np.where(dist_tf == np.max(dist_tf))
        free_pixel = np.array([max_px[0][0], max_px[1][0]])
        return free_pixel
49187
@Override
	public Matrix4d getGeometicCenterTransformation() {
		run();

		Matrix4d geometricCentered = new Matrix4d(reverseTransformationMatrix);
		geometricCentered.setTranslation(new Vector3d(getGeometricCenter()));

		return geometricCentered;
	}
812406
def pixel(self, x, y, color=None):
        """"""
        if self.rotation == 1:
            x, y = y, x
            x = self.width - x - 1
        if self.rotation == 2:
            x = self.width - x - 1
            y = self.height - y - 1
        if self.rotation == 3:
            x, y = y, x
            y = self.height - y - 1

        if x < 0 or x >= self.width or y < 0 or y >= self.height:
            return None
        if color is None:
            return self.format.get_pixel(self, x, y)
        self.format.set_pixel(self, x, y, color)
        return None
692898
def pixel(self, coord_x, coord_y):
        # type: (int, int) -> Pixel
        

        try:
            return self.pixels[coord_y][coord_x]  # type: ignore
        except IndexError:
            raise ScreenShotError(
                "Pixel location ({}, {}) is out of range.".format(coord_x, coord_y)
            )
783430
def getBitmapFromRect(self, x, y, w, h):
        
        min_x, min_y, screen_width, screen_height = self._getVirtualScreenRect()
        img = self._getVirtualScreenBitmap() # TODO
        # Limit the coordinates to the virtual screen
        # Then offset so 0,0 is the top left corner of the image
        # (Top left of virtual screen could be negative)
        x1 = min(max(min_x, x), min_x+screen_width) - min_x
        y1 = min(max(min_y, y), min_y+screen_height) - min_y
        x2 = min(max(min_x, x+w), min_x+screen_width) - min_x
        y2 = min(max(min_y, y+h), min_y+screen_height) - min_y
        return numpy.array(img.crop((x1, y1, x2, y2)))
903802
def get_pixel_indices(self, lats, lons):
        
        theta = np.radians(90. - lats)
        phi = np.radians(lons)
        return hp.ang2pix(self.nside, theta, phi, self.nest)
1209996
def get_geotiff_area_def(filename, crs):
    """"""
    from osgeo import gdal
    from pyresample.geometry import AreaDefinition
    from pyresample.utils import proj4_str_to_dict
    fid = gdal.Open(filename)
    geo_transform = fid.GetGeoTransform()
    pcs_id = fid.GetProjection().split('"')[1]
    min_x = geo_transform[0]
    max_y = geo_transform[3]
    x_size = fid.RasterXSize
    y_size = fid.RasterYSize
    max_x = min_x + geo_transform[1] * x_size
    min_y = max_y + geo_transform[5] * y_size
    area_extent = [min_x, min_y, max_x, max_y]
    area_def = AreaDefinition('geotiff_area', pcs_id, pcs_id,
                              proj4_str_to_dict(crs),
                              x_size, y_size, area_extent)
    return area_def
1291180
function getRenderedCenter(target, renderedDimensions){
  let pos = target.renderedPosition();
  let dimensions = renderedDimensions(target);
  let offsetX = dimensions.w / 2;
  let offsetY = dimensions.h / 2;

  return {
    x : (pos.x - offsetX),
    y : (pos.y - offsetY)
  };
}
588540
def _get_spatial_bounds(self):
        """""" 
        # This should be a MultiRasterIO method
        with rasterio.open(self._mrio._get_template_for_given_resolution(self._mrio.dst_res, "path")) as src_layer:
            pass # later we need src_layer for src_layer.window_transform(win)
        win_transform = src_layer.window_transform(self._window)
        bounds = rasterio.windows.bounds(window=self._window,
                                         transform=win_transform,
                                         height=0, width=0)
        return bounds
511776
def raster_to_projection_coords(self, pixel_x, pixel_y):
        
        h_px_py = np.array([1, pixel_x, pixel_y])
        gt = np.array([[1, 0, 0], self.geotransform[0:3], self.geotransform[3:6]])
        arr = np.inner(gt, h_px_py)
        return arr[2], arr[1]
608799
def center_nonzero(self):
        
        # get the center of the nonzero pixels
        nonzero_px = np.where(self._data != 0.0)
        nonzero_px = np.c_[nonzero_px[0], nonzero_px[1]]
        mean_px = np.mean(nonzero_px, axis=0)
        center_px = (np.array(self.shape) / 2.0)[:2]
        diff_px = center_px - mean_px

        # transform image
        nonzero_px_tf = nonzero_px + diff_px
        nonzero_px_tf[:, 0] = np.max(
            np.c_[np.zeros(nonzero_px_tf[:, 0].shape), nonzero_px_tf[:, 0]], axis=1)
        nonzero_px_tf[:, 0] = np.min(np.c_[(
            self.height - 1) * np.ones(nonzero_px_tf[:, 0].shape), nonzero_px_tf[:, 0]], axis=1)
        nonzero_px_tf[:, 1] = np.max(
            np.c_[np.zeros(nonzero_px_tf[:, 1].shape), nonzero_px_tf[:, 1]], axis=1)
        nonzero_px_tf[:, 1] = np.min(np.c_[(
            self.width - 1) * np.ones(nonzero_px_tf[:, 1].shape), nonzero_px_tf[:, 1]], axis=1)
        nonzero_px = nonzero_px.astype(np.uint16)
        nonzero_px_tf = nonzero_px_tf.astype(np.uint16)
        shifted_data = np.zeros(self.shape)
        shifted_data[nonzero_px_tf[:, 0], nonzero_px_tf[:, 1],
                     :] = self.data[nonzero_px[:, 0], nonzero_px[:, 1]].reshape(-1, self.channels)

        return type(self)(
            shifted_data.astype(
                self.data.dtype), frame=self._frame), diff_px
1119480
def _load_GeoTransform(self):
        """"""
        def load_lon():
            return arange(ds.RasterXSize)*b[1]+b[0]

        def load_lat():
            return arange(ds.RasterYSize)*b[5]+b[3]
        ds = self.ds
        b = self.ds.GetGeoTransform()  # bbox, interval
        if with_dask:
            lat = Array(
                {('lat', 0): (load_lat,)}, 'lat', (self.ds.RasterYSize,),
                shape=(self.ds.RasterYSize,), dtype=float)
            lon = Array(
                {('lon', 0): (load_lon,)}, 'lon', (self.ds.RasterXSize,),
                shape=(self.ds.RasterXSize,), dtype=float)
        else:
            lat = load_lat()
            lon = load_lon()
        return Variable(('lat',), lat), Variable(('lon',), lon)
1119568
function () {
        // Rect before any transform
        var rawRect = this.getBoundingRect();
        var cx = rawRect.x + rawRect.width / 2;
        var cy = rawRect.y + rawRect.height / 2;

        return [cx, cy];
    }
884559
def get_adjusted_border_positions(self):
        
        nw_x, nw_y = self._rect[0]
        se_x, se_y = self._rect[1]

        nw_x += self._distance_to_border
        nw_y += self._distance_to_border
        se_x -= self._distance_to_border
        se_y -= self._distance_to_border

        return nw_x, nw_y, se_x, se_y
1033086
def center_image(self, no_reset=True):
        
        try:
            xy_mn, xy_mx = self.get_limits()
            data_x = float(xy_mn[0] + xy_mx[0]) / 2.0
            data_y = float(xy_mn[1] + xy_mx[1]) / 2.0

        except ImageViewNoDataError:
            # No data, so try to get center of any plotted objects
            canvas = self.get_canvas()
            try:
                data_x, data_y = canvas.get_center_pt()[:2]

            except Exception as e:
                self.logger.error("Can't compute center point: %s" % (str(e)))
                return

        self.panset_xy(data_x, data_y, no_reset=no_reset)

        if self.t_['autocenter'] == 'once':
            self.t_.set(autocenter='off')
363227
def getTileOrigin(self, tileX, tileY, level):
        '''
        
        '''
        pixelX, pixelY = self.convertTileXYToPixelXY(tileX, tileY)
        lng, lat = self.convertPixelXYToLngLat(pixelX, pixelY, level)
        return (lat, lng)