def getTile ( self, webargs ):
    """Either fetch the file from mocpcache or load a new region into mocpcache by cutout"""

    # parse the web args
    self.token, tileszstr, self.channel, resstr, xtilestr, ytilestr, zslicestr, color, brightnessstr, rest = webargs.split('/',9)

    # load the database
    self.loadDB ( )

    with closing ( ocpcaproj.OCPCAProjectsDB() ) as projdb:
      self.proj = projdb.loadProject ( self.token )

    with closing ( ocpcadb.OCPCADB(self.proj) ) as self.db:

      # convert args to ints
      xtile = int(xtilestr)
      ytile = int(ytilestr)
      res = int(resstr)
      # modify the zslice to the offset
      zslice = int(zslicestr)-self.proj.datasetcfg.slicerange[0]
      self.tilesz = int(tileszstr)
      brightness = float(brightnessstr)

      # memcache key
      mckey = self.buildKey(res,xtile,ytile,zslice,color,brightness)

      # do something to sanitize the webargs??
      # if tile is in mocpcache, return it
      tile = self.mc.get(mckey)
      if tile != None:
        fobj = cStringIO.StringIO(tile)
      # load a slab into CATMAID
      else:
        img=self.cacheMiss(res,xtile,ytile,zslice,color,brightness)
        fobj = cStringIO.StringIO ( )
        img.save ( fobj, "PNG" )
        self.mc.set(mckey,fobj.getvalue())

      fobj.seek(0)
      return fobj
dataset/ETHPy150Open neurodata/ndstore/django/catmaid/deprecated/colorcatmaid.py/ColorCatmaid.getTile/original