def _getAllSeries(self):
		startt = time.time()
		self.seriestree = []
		if self.params['mrcnames'] is not None:
			mrcfileroot = self.params['mrcnames'].split(",")
			if self.params['sessionname'] is not None:
				images = apDatabase.getSpecificImagesFromSession(mrcfileroot, self.params['sessionname'])
			else:
				images = apDatabase.getSpecificImagesFromDB(mrcfileroot)
		elif self.params['sessionname'] is not None:
			if self.params['preset'] is not None:
				images = apDatabase.getImagesFromDB(self.params['sessionname'], self.params['preset'])
			else:
				self.seriestree = apDatabase.getAllTiltSeriesFromSessionName(self.params['sessionname'])
		else:
			if self.params['mrcnames'] is not None:
				apDisplay.printMsg("MRC List: "+str(len(self.params['mrcnames']))+" : "+str(self.params['mrcnames']))
			apDisplay.printMsg("Session: "+str(self.params['sessionname'])+" : "+str(self.params['preset']))
			apDisplay.printError("no files specified")
		# Only use finished tilt series
		if len(self.seriestree) > 0:
			indices_to_pop = []
			for tiltseriesdata in self.seriestree:
				if not apDatabase.getTiltSeriesDoneStatus(tiltseriesdata):
					indices_to_pop.append(self.seriestree.index(tiltseriesdata))
			indices_to_pop.sort()
			indices_to_pop.reverse()
			for index in indices_to_pop:	
				self.seriestree.pop(index)
		else:
			for image in images:
				tiltseriesdata = image['tilt series']
				if tiltseriesdata and tiltseriesdata not in self.seriestree and apDatabase.getTiltSeriesDoneStatus(tiltseriesdata):
					self.seriestree.append(tiltseriesdata)
		precount = len(self.seriestree)
		apDisplay.printMsg("Found "+str(precount)+" tilt series in "+apDisplay.timeString(time.time()-startt))

		### REMOVE PROCESSED IMAGES
		apDisplay.printMsg("Remove processed series")
		self._removeProcessedSeries()

		### SET SERIES ORDER
		if self.params['reverse'] is True:
			apDisplay.printMsg("Process series new to old")
		else:
			# by default series are new to old
			apDisplay.printMsg("Process series old to new")
			self.seriestree.sort(self._reverseSortSeriesTree)

		### LIMIT NUMBER
		if self.params['limit'] is not None:
			lim = self.params['limit']
			if len(self.seriestree) > lim:
				apDisplay.printMsg("Limiting number of series to "+str(lim))
				self.seriestree = self.seriestree[:lim]
		self.stats['seriescount'] = len(self.seriestree)
Esempio n. 2
0
    def _getAllImages(self):
        startt = time.time()
        if self.params['mrcnames'] is not None:
            mrcfileroot = self.params['mrcnames'].split(",")
            if self.params['sessionname'] is not None:
                self.imgtree = apDatabase.getSpecificImagesFromSession(
                    mrcfileroot, self.params['sessionname'])
            else:
                self.imgtree = apDatabase.getSpecificImagesFromDB(mrcfileroot)
        elif self.params['sessionname'] is not None:
            if self.params['preset'] is not None:
                self.imgtree = apDatabase.getImagesFromDB(
                    self.params['sessionname'], self.params['preset'])
            else:
                self.imgtree = apDatabase.getAllImagesFromDB(
                    self.params['sessionname'])
        else:
            if self.params['mrcnames'] is not None:
                apDisplay.printMsg("MRC List: " +
                                   str(len(self.params['mrcnames'])) + " : " +
                                   str(self.params['mrcnames']))
            apDisplay.printMsg("Session: " + str(self.params['sessionname']) +
                               " : " + str(self.params['preset']))
            apDisplay.printError("no files specified")
        precount = len(self.imgtree)
        apDisplay.printMsg("Found " + str(precount) + " images in " +
                           apDisplay.timeString(time.time() - startt))

        ### REMOVE PROCESSED IMAGES
        apDisplay.printMsg("Remove processed images")
        self._removeProcessedImages()

        ### SET IMAGE ORDER
        if self.params['shuffle'] is True:
            self.imgtree = self._shuffleTree(self.imgtree)
            apDisplay.printMsg("Process images shuffled")
        elif self.params['reverse'] is True:
            apDisplay.printMsg("Process images new to old")
        else:
            # by default images are new to old
            apDisplay.printMsg("Process images old to new")
            self.imgtree.sort(self._reverseSortImgTree)

        ### LIMIT NUMBER
        if self.params['limit'] is not None:
            lim = self.params['limit']
            if len(self.imgtree) > lim:
                apDisplay.printMsg("Limiting number of images to " + str(lim))
                self.imgtree = self.imgtree[:lim]
        if len(self.imgtree) > 0:
            self.params['apix'] = apDatabase.getPixelSize(self.imgtree[0])
        self.stats['imagecount'] = len(self.imgtree)
        def _getAllImages(self):
                startt = time.time()
                if self.params['mrcnames'] is not None:
                        mrcfileroot = self.params['mrcnames'].split(",")
                        if self.params['sessionname'] is not None:
                                self.imgtree = apDatabase.getSpecificImagesFromSession(mrcfileroot, self.params['sessionname'])
                        else:
                                self.imgtree = apDatabase.getSpecificImagesFromDB(mrcfileroot)
                elif self.params['sessionname'] is not None:
                        if self.params['preset'] is not None:
                                self.imgtree = apDatabase.getImagesFromDB(self.params['sessionname'], self.params['preset'])
                        else:
                                self.imgtree = apDatabase.getAllImagesFromDB(self.params['sessionname'])
                else:
                        if self.params['mrcnames'] is not None:
                                apDisplay.printMsg("MRC List: "+str(len(self.params['mrcnames']))+" : "+str(self.params['mrcnames']))
                        apDisplay.printMsg("Session: "+str(self.params['sessionname'])+" : "+str(self.params['preset']))
                        apDisplay.printError("no files specified")
                precount = len(self.imgtree)
                apDisplay.printMsg("Found "+str(precount)+" images in "+apDisplay.timeString(time.time()-startt))

                ### REMOVE PROCESSED IMAGES
                apDisplay.printMsg("Remove processed images")
                self._removeProcessedImages()

                ### SET IMAGE ORDER
                if self.params['shuffle'] is True:
                        self.imgtree = self._shuffleTree(self.imgtree)
                        apDisplay.printMsg("Process images shuffled")
                elif self.params['reverse'] is True:
                        apDisplay.printMsg("Process images new to old")
                else:
                        # by default images are new to old
                        apDisplay.printMsg("Process images old to new")
                        self.imgtree.sort(self._reverseSortImgTree)

                ### LIMIT NUMBER
                if self.params['limit'] is not None:
                        lim = self.params['limit']
                        if len(self.imgtree) > lim:
                                apDisplay.printMsg("Limiting number of images to "+str(lim))
                                self.imgtree = self.imgtree[:lim]
                if len(self.imgtree) > 0:
                        self.params['apix'] = apDatabase.getPixelSize(self.imgtree[0])
                self.stats['imagecount'] = len(self.imgtree)