Retrieve or compose an image for the specified fringe.
979221
protected BufferedImage getTileImage (BufferedImage img,
        FringeConfiguration.FringeTileSetRecord tsr, int baseset, int index, int hashValue,
        Map<Long, BufferedImage> masks)
        throws NoSuchTileSetException
    {
        int fringeset = tsr.fringe_tsid;
        TileSet fset = _tmgr.getTileSet(fringeset);
        if (!tsr.mask) {
            // oh good, this is easy
            Tile stamp = fset.getTile(index);
            return stampTileImage(stamp, img, stamp.getWidth(), stamp.getHeight());
        }

        // otherwise, it's a mask..
        Long maskkey = Long.valueOf((((long)baseset) << 32) + (fringeset << 16) + index);
        BufferedImage mask = masks.get(maskkey);
        if (mask == null) {
            BufferedImage fsrc = _tmgr.getTileSet(fringeset).getRawTileImage(index);
            BufferedImage bsrc = _tmgr.getTileSet(baseset).getRawTileImage(0);
            mask = ImageUtil.composeMaskedImage(_imgr, fsrc, bsrc);
            masks.put(maskkey, mask);
        }

        return stampTileImage(mask, img, mask.getWidth(null), mask.getHeight(null));
    }
1129577
def oneImageNLF(img, img2=None, signal=None):
    '''
    
    '''
    x, y, weights, signal = calcNLF(img, img2, signal)
    _, fn, _ = _evaluate(x, y, weights)
    return fn, signal
813302
def retrieve(collector, image, artifact, **kwargs):
    """"""
    if artifact in (None, "", NotSpecified):
        raise BadOption("Please specify what to retrieve using the artifact option")

    if collector.configuration["harpoon"].tag is not NotSpecified:
        image.tag = collector.configuration["harpoon"].tag

    # make sure the image is built
    if os.environ.get("NO_BUILD") is None:
        Builder().make_image(image, collector.configuration["images"])

    content = {
          "conf": image
        , "docker_api": collector.configuration["harpoon"].docker_api
        , "images": collector.configuration["images"]
        , "image": image.image_name_with_tag
        , "path": artifact
        }

    # Get us our gold!
    with ContextBuilder().the_context(content) as fle:
        shutil.copyfile(fle.name, os.environ.get("FILENAME", "./retrieved.tar.gz"))
99078
def scanimage_artist_metadata(artist):
    """"""
    try:
        return json.loads(artist)
    except ValueError as exc:
        log.warning('scanimage_artist_metadata: %s: %s',
                    exc.__class__.__name__, exc)
1039390
def getProfileImage(self, name):
        
        for p in self.persons:
            if 'pseudo' in self.persons[p]:
                if name == self.persons[p]['pseudo']:
                    image_id = self.persons[p]['face']['id']
                    key = self.persons[p]['face']['key']
                    return self.getCameraPicture(image_id, key)
        return None, None
566426
def image(self):
        """"""
        events = self.event_table
        skycoord = SkyCoord(events['GLON'], events['GLAT'], unit='deg', frame='galactic')
        pixcoord = PixCoord.from_sky(skycoord=skycoord, wcs=self.wcs)

        shape = self.config['shape']
        bins = [np.arange(shape[0] + 1), np.arange(shape[1] + 1)]
        sample = np.vstack((pixcoord.y, pixcoord.x)).T
        data, _ = np.histogramdd(sample=sample, bins=bins)
        data = data.astype('float32')

        header = self.wcs.to_header()
        return fits.ImageHDU(data=data, header=header, name='image')
176721
def load(self, f):
        """"""
        SUPPORTED_COLOR_TYPES = (COLOR_TYPE_TRUECOLOR, COLOR_TYPE_TRUECOLOR_WITH_ALPHA)
        SAMPLES_PER_PIXEL = { COLOR_TYPE_TRUECOLOR: 3,
                              COLOR_TYPE_TRUECOLOR_WITH_ALPHA: 4 }

        assert f.read(8) == SIGNATURE

        chunks = iter(self.chunks(f))
        header = next(chunks)
        assert header[0] == b'IHDR'

        (width, height, bit_depth, color_type, compression,
         filter_type, interlace) = struct.unpack(b"!2I5B", header[1])

        if bit_depth != 8:
            raise ValueError('Unsupported PNG format (bit depth={}; must be 8)'.format(bit_depth))
        if compression != 0:
            raise ValueError('Unsupported PNG format (compression={}; must be 0)'.format(compression))
        if filter_type != 0:
            raise ValueError('Unsupported PNG format (filter_type={}; must be 0)'.format(filter_type))
        if interlace != 0:
            raise ValueError('Unsupported PNG format (interlace={}; must be 0)'.format(interlace))
        if color_type not in SUPPORTED_COLOR_TYPES:
            raise ValueError('Unsupported PNG format (color_type={}; must one of {})'.format(SUPPORTED_COLOR_TYPES))

        self.width = width
        self.height = height
        self.canvas = bytearray(self.bgcolor * width * height)
        bytes_per_pixel = SAMPLES_PER_PIXEL[color_type]
        bytes_per_row = bytes_per_pixel * width
        bytes_per_rgba_row = SAMPLES_PER_PIXEL[COLOR_TYPE_TRUECOLOR_WITH_ALPHA] * width
        bytes_per_scanline = bytes_per_row + 1

        # Python 2 requires the encode for struct.unpack
        scanline_fmt = ('!%dB' % bytes_per_scanline).encode('ascii')

        reader = ByteReader(chunks)

        old_row = None
        cursor = 0
        for row in range(height):
            scanline = reader.read(bytes_per_scanline)
            unpacked = list(struct.unpack(scanline_fmt, scanline))
            old_row = self.defilter(unpacked[1:], old_row, unpacked[0], bpp=bytes_per_pixel)
            rgba_row = old_row if color_type == COLOR_TYPE_TRUECOLOR_WITH_ALPHA else rgb2rgba(old_row)
            self.canvas[cursor:cursor + bytes_per_rgba_row] = rgba_row
            cursor += bytes_per_rgba_row
911374
public BaseTile getFringeTile (MisoSceneModel scene, int col, int row,
        Map<FringeTile, WeakReference<FringeTile>> fringes, Map<Long, BufferedImage> masks)
    {
        // get the tileset id of the base tile we are considering
        int underset = adjustTileSetId(scene.getBaseTileId(col, row) >> 16);

        // start with a clean temporary fringer map
        _fringers.clear();
        boolean passable = true;

        // walk through our influence tiles
        for (int y = row - 1, maxy = row + 2; y < maxy; y++) {
            for (int x = col - 1, maxx = col + 2; x < maxx; x++) {
                // we sensibly do not consider ourselves
                if ((x == col) && (y == row)) {
                    continue;
                }

                // determine the tileset for this tile
                int btid = scene.getBaseTileId(x, y);
                int baseset = adjustTileSetId((btid <= 0) ?
                    scene.getDefaultBaseTileSet() : (btid >> 16));

                // determine if it fringes on our tile
                int pri = _fringeconf.fringesOn(baseset, underset);
                if (pri == -1) {
                    continue;
                }

                FringerRec fringer = (FringerRec)_fringers.get(baseset);
                if (fringer == null) {
                    fringer = new FringerRec(baseset, pri);
                    _fringers.put(baseset, fringer);
                }

                // now turn on the appropriate fringebits
                fringer.bits |= FLAGMATRIX[y - row + 1][x - col + 1];

                // See if a tile that fringes on us kills our passability,
                // but don't count the default base tile against us, as
                // we allow users to splash in the water.
                if (passable && (btid > 0)) {
                    try {
                        BaseTile bt = (BaseTile)_tmgr.getTile(btid);
                        passable = bt.isPassable();
                    } catch (NoSuchTileSetException nstse) {
                        log.warning("Autofringer couldn't find a base set while attempting to " +
                            "figure passability", nstse);
                    }
                }
            }
        }

        // if nothing fringed, we're done
        int numfringers = _fringers.size();
        if (numfringers == 0) {
            return null;
        }

        // otherwise compose a FringeTile from the specified fringes
        FringerRec[] frecs = new FringerRec[numfringers];
        for (int ii = 0, pp = 0; ii < 16; ii++) {
            FringerRec rec = (FringerRec)_fringers.getValue(ii);
            if (rec != null) {
                frecs[pp++] = rec;
            }
        }

        return composeFringeTile(frecs, fringes, TileUtil.getTileHash(col, row), passable, masks);
    }
641773
def _grab_raw_image(self):
        
        m = self.ale.getScreenRGB()
        return m.reshape((self.height, self.width, 3))
649061
def getImageObject(url, referrer, session, max_content_bytes=MaxImageBytes):
    """"""
    return urlopen(url, session, referrer=referrer, max_content_bytes=max_content_bytes, stream=True)
1023818
public Mirage getMirage (ImageKey key, Rectangle bounds)
    {
        return getMirage(key, bounds, null);
    }
393219
def img(self):
        ''''''
        SlipThumbnail.img(self)

        if self.rotation:
            # rotate the image
            mat = cv2.getRotationMatrix2D((self.height//2, self.width//2), -self.rotation, 1.0)
            self._rotated = cv2.warpAffine(self._img, mat, (self.height, self.width))
        else:
            self._rotated = self._img
        return self._rotated
784659
def get_qpimage_raw(self, idx=0):
        """"""
        # Load experimental data
        with SingleTifHolo._get_tif(self.path) as tf:
            holo = tf.pages[0].asarray()
        meta_data = copy.copy(self.meta_data)
        qpi = qpimage.QPImage(data=(holo),
                              which_data="hologram",
                              meta_data=meta_data,
                              holo_kw=self.holo_kw,
                              h5dtype=self.as_type)
        # set identifier
        qpi["identifier"] = self.get_identifier()
        qpi["time"] = self.get_time()
        return qpi
640785
def image(size = :small, fallback = true)
      image = object&.image&.url(size)
      return image if image.present?

      h.image_url('integral/defaults/no_image_available.jpg') if fallback
    end
130021
def image_absoulte_path(self, url, image):
        """"""
        if not re.match(re_http, image):
            topimage = urljoin(url, image)
            return topimage
        return image
1183063
def _getProcessedImage(self):
        """"""
        if self.imageDisp is None:
            self.imageDisp = self.image
            self.levelMin, self.levelMax = self._quickLevels(
                self.imageDisp)
            #list( map(float, self._quickLevels(self.imageDisp)))
        return self.imageDisp
364587
def load_image_from_disk(img_spec):
    """"""

    if isinstance(img_spec, str):
        if pexists(realpath(img_spec)):
            hdr = nib.load(img_spec)
            # trying to stick to an orientation
            hdr = nib.as_closest_canonical(hdr)
            img = hdr.get_data()
        else:
            raise IOError('Given path to image does not exist!')
    elif isinstance(img_spec, np.ndarray):
        img = img_spec
    else:
        raise ValueError('Invalid input specified! '
                         'Input either a path to image data, or provide 3d Matrix directly.')

    return img