def ingest( self ):

    NAME = [ "Grayscale" ]

    # for each channel
    for x in range(self.channel):
     
      # label by RGB Channel
      self.label ( x+1, NAME[x] )

      # for each slice
      for sl in range(self.startslice , self.endslice+1, self.batchsz):
      
        imarray = np.zeros ( [self.batchsz,self._yimgsz,self._ximgsz], dtype=np.uint16 )

        for b in range ( self.batchsz ):

          if ( sl + b < self.endslice ):

            # raw data
            #filenm = '{}{}_{:0>4}.tif'.format(self.path, self.token.strip('Affine'), sl+b)
            filenm = '{}allenAtlasPadded{:0>4}.tif'.format(self.path,  sl+b)

            # load the image and check the dimension
            try:
              print "Opening filename: " + filenm
              imgdata = cv2.imread(filenm, -1)
              #img = Image.open(filenm, 'r')
              #imgdata = np.asarray ( img )
              #if imgdata == None:
              #    imgdata = np.zeros((self._yimgsz,self._ximgsz))
              imarray[(sl+b-self.startslice)%self.batchsz,0:imgdata.shape[0],0:imgdata.shape[1]] = imgdata
            except __HOLE__, e:
              print e
          
        # ingset any remaining slices
        self.upload( x+1, sl, imarray )
dataset/ETHPy150Open neurodata/ndstore/ingest/raju/rajuchannel.py/RajuIngest.ingest