def parallelingest(self, zslab, resolution):
   
    # extract parameters for iteration
    numxtiles = self.proj.datasetcfg.imagesz[resolution][0]/self.tilesz
    numytiles = self.proj.datasetcfg.imagesz[resolution][1]/self.tilesz

    zstart = self.proj.datasetcfg.slicerange[0]
    zend = self.proj.datasetcfg.slicerange[1]
    # slices per ingest group
    zslices = self.proj.datasetcfg.cubedim[resolution][2]

    print zslab, zslab*zslices, resolution, multiprocessing.current_process()

    # Ingest in database aligned slabs in the z dimension for each zslab
    
    # over all tiles in that slice
    for ytile in range(numytiles):
      for xtile in range(numxtiles):
        
        # RBTODO need to generalize to other project types
        cuboid = np.zeros ( [zslices,self.tilesz,self.tilesz], dtype=np.uint8 )

        # over each slice
        for zslice in range(zslices):
          
          #if we are at the end of the space, quit
          if zslab*zslices+zstart+zslice > zend:
            break
          
          filename = '{}/{}/{}/{}/{}.jpg'.format(self.prefix,resolution,zslab*zslices+zslice+zstart,ytile,xtile)
          try:
            # add tile to stack
            tileimage = Image.open ( filename, 'r' )
            cuboid [zslice,:,:] = np.asarray ( tileimage )
          except __HOLE__, e:
            print "Failed to open file %s" % (e) 
          # Writing the missing image-files and not raising an error. Look at missing_files in the same directory 
            f = open('missing_files','a')
            f.write(filename+'\n')
            f.close()
            #raise
        # here we have continuous cuboid, let's upload it to the database
        #print "Starting commit",zslab*zslices,multiprocessing.current_process()
        #continue
        corner = [ xtile*self.tilesz, ytile*self.tilesz, zslab*zslices ]
        self.db.writeImageCuboid ( corner, resolution, cuboid) 
        if(zslice%64==0):
          self.db.commit()
dataset/ETHPy150Open neurodata/ndstore/ingest/catmaid/catmaid_parallel_kunal.py/CatmaidIngester.parallelingest