def annoCubeOffsets ( self, ch, dataids, resolution, remapid=False ):
   
    [ xcubedim, ycubedim, zcubedim ] = cubedim = self.datasetcfg.cubedim [ resolution ] 

    # if cutout is below resolution, get a smaller cube and scaleup
    if ch.getResolution() > resolution:
      effectiveres = ch.getResolution() 
    else:
      effectiveres = resolution
    
    zidxs = set()
    for did in dataids:
      zidxs |= set ( self.annoIdx.getIndex(ch, did, effectiveres))

    for zidx in zidxs:

      # get the cube and mask out the non annoid values
      cb = self.getCube(ch, zidx, effectiveres) 
      if not remapid:
        cb.data = ocplib.filter_ctype_OMP ( cb.data, dataids )
      else: 
        cb.data = ocplib.filter_ctype_OMP ( cb.data, dataids )
        # KL TODO
        vec_func = np.vectorize ( lambda x: np.uint32(remapid) if x != 0 else np.uint32(0) ) 
        cb.data = vec_func ( cb.data )

      # zoom the data if not at the right resolution and translate the zindex to the upper resolution
      (xoff,yoff,zoff) = ocplib.MortonXYZ ( zidx )
      offset = (xoff*xcubedim, yoff*ycubedim, zoff*zcubedim)

      # if we're zooming, so be it
      if resolution < effectiveres:
        cb.zoomData ( effectiveres-resolution )
        offset = (offset[0]*(2**(effectiveres-resolution)),offset[1]*(2**(effectiveres-resolution)),offset[2])

      # add any exceptions
      # Get exceptions if this DB supports it
      if ch.getExceptions() == EXCEPTION_TRUE:
        for exid in dataids:
          exceptions = self.getExceptions(ch, zidx, effectiveres, exid) 
          if exceptions != []:
            if resolution < effectiveres:
                exceptions = self.zoomVoxels ( exceptions, effectiveres-resolution )
            # write as a loop first, then figure out how to optimize 
            # exceptions are stored relative to cube offset
            for e in exceptions:
              if not remapid:
                cb.data[e[2],e[1],e[0]]=exid
              else:
                cb.data[e[2],e[1],e[0]]=remapid

      yield (offset,cb.data)

  #
  # getAnnotation:  
  #    Look up an annotation, switch on what kind it is, build an HDF5 file and
  #     return it.
an iterable on the offsets and cubes for an annotation
dataset/ETHPy150Open neurodata/ndstore/ocpca/ocpcadb.py/OCPCADB.annoCubeOffsets