def getBoundingBox ( self, ch, annids, res ):
    """Return a corner and dimension of the bounding box for an annotation using the index"""
  
    # get the size of the image and cube
    resolution = int(res)

    # determine the resolution for project information
    if ch.getResolution() > resolution:
      effectiveres = ch.getResolution() 
      scaling = 2**(effectiveres-resolution)
    else:
      effectiveres = resolution
      scaling=1

    # all boxes in the indexes
    zidxs=[]
    for annid in annids:
      zidxs = itertools.chain(zidxs,self.annoIdx.getIndex(ch, annid, effectiveres))
    
    # convert to xyz coordinates
    try:
      xyzvals = np.array ( [ ocplib.MortonXYZ(zidx) for zidx in zidxs ], dtype=np.uint32 )
    # if there's nothing in the chain, the array creation will fail
    except:
      return None, None

    cubedim = self.datasetcfg.cubedim [ resolution ] 

    # find the corners
    xmin = min(xyzvals[:,0]) * cubedim[0] * scaling
    xmax = (max(xyzvals[:,0])+1) * cubedim[0] * scaling
    ymin = min(xyzvals[:,1]) * cubedim[1] * scaling
    ymax = (max(xyzvals[:,1])+1) * cubedim[1] * scaling
    zmin = min(xyzvals[:,2]) * cubedim[2]
    zmax = (max(xyzvals[:,2])+1) * cubedim[2]

    corner = [ xmin, ymin, zmin ]
    dim = [ xmax-xmin, ymax-ymin, zmax-zmin ]

    return (corner,dim)
dataset/ETHPy150Open neurodata/ndstore/ocpca/ocpcadb.py/OCPCADB.getBoundingBox/original