def getLocations ( self, ch, entityid, res ):

    # get the size of the image and cube
    resolution = int(res)
    
    #scale to project resolution
    if ch.getResolution() > resolution:
      effectiveres = ch.getResolution() 
    else:
      effectiveres = resolution


    voxlist = []
    
    zidxs = self.annoIdx.getIndex(ch,entityid,resolution)

    for zidx in zidxs:

      cb = self.getCube(ch, zidx,effectiveres) 

      # mask out the entries that do not match the annotation id
      # KL TODO
      vec_func = np.vectorize ( lambda x: entityid if x == entityid else 0 )
      annodata = vec_func ( cb.data )
    
      # where are the entries
      offsets = np.nonzero ( annodata ) 
      voxels = np.array(zip(offsets[2], offsets[1], offsets[0]), dtype=np.uint32)

      # Get cube offset information
      [x,y,z] = ocplib.MortonXYZ(zidx)
      xoffset = x * self.datasetcfg.cubedim[resolution][0] + self.datasetcfg.offset[resolution][0] 
      yoffset = y * self.datasetcfg.cubedim[resolution][1] + self.datasetcfg.offset[resolution][1]
      zoffset = z * self.datasetcfg.cubedim[resolution][2] + self.datasetcfg.offset[resolution][2]

      # Now add the exception voxels
      if ch.getExceptions() ==  EXCEPTION_TRUE:
        exceptions = self.getExceptions( ch, zidx, resolution, entityid ) 
        if exceptions != []:
          voxels = np.append ( voxels.flatten(), exceptions.flatten())
          voxels = voxels.reshape(len(voxels)/3,3)

      # Change the voxels back to image address space
      [ voxlist.append([a+xoffset, b+yoffset, c+zoffset]) for (a,b,c) in voxels ] 

    # zoom out the voxels if necessary 
    if effectiveres > resolution:
      voxlist = self.zoomVoxels ( voxlist, effectiveres-resolution )

    return voxlist
dataset/ETHPy150Open neurodata/ndstore/ocpca/ocpcadb.py/OCPCADB.getLocations/original