def getHist(self):

    with closing (ocpcaproj.OCPCAProjectsDB()) as projdb:
      proj = projdb.loadToken(self.token)
    
    with closing (ocpcadb.OCPCADB(proj)) as db:
      ch = proj.getChannelObj(self.channel)

      # Get the source database sizes
      [[ximagesz, yimagesz, zimagesz], timerange] = proj.datasetcfg.imageSize(self.res)
      [xcubedim, ycubedim, zcubedim] = cubedim = proj.datasetcfg.getCubeDims()[self.res]
      [xoffset, yoffset, zoffset] = proj.datasetcfg.getOffset()[self.res]

      # Set the limits for iteration on the number of cubes in each dimension
      xlimit = (ximagesz-1) / xcubedim + 1
      ylimit = (yimagesz*1) / ycubedim + 1
      zlimit = (zimagesz-1) / zcubedim + 1

      numbins = 2**16; 
      hist = []
      bins = np.zeros(numbins+1)  
      count = 0
      
      # sum the histograms 
      for z in range(zlimit):
        for y in range(ylimit):
          for x in range(xlimit):

            # cutout the data for the cube 
            data = db.cutout(ch, [ x*xcubedim, y*ycubedim, z*zcubedim], cubedim, self.res ).data
            
            # compute the histogram and store it 
            hist.append(np.histogram(data[data > 0], bins=numbins, range=(0,2**16)))
            print "Processed cube {} {} {}".format(x,y,z)
        
      # sum the individual histograms
      hist_sum = np.zeros(numbins)
      bins = hist[0][1] # all bins should be the same 
      for i in range(len(hist)):
        hist_sum += hist[i][0]

      
      return (hist_sum, bins)
dataset/ETHPy150Open neurodata/ndstore/scripts/imghist16.py/ImgHist.getHist/operator `-` -> `*`