Exemplo n.º 1
0
    def loopProcessImage(self, imgdata):
        """
		Over-writes the particleLoop processImage and uses the appionLoop processImage
		"""
        #GET THE TILT PAIR
        tiltdata = apTiltPair.getTiltPair(imgdata)
        if tiltdata is None:
            return

        ### process images
        procimgpath = os.path.join(self.params['rundir'],
                                   imgdata['filename'] + '.dwn.mrc')
        if not os.path.isfile(procimgpath):
            apDisplay.printMsg("processing mrc for first image")
            apFindEM.processAndSaveImage(imgdata, params=self.params)
        procimg1 = apImage.mrcToArray(procimgpath, msg=False)

        procimgpath = os.path.join(self.params['rundir'],
                                   tiltdata['filename'] + '.dwn.mrc')
        if not os.path.isfile(procimgpath):
            apDisplay.printMsg("processing mrc for second image")
            apFindEM.processAndSaveImage(tiltdata, params=self.params)
        procimg2 = apImage.mrcToArray(procimgpath, msg=False)

        #RUN THE ALIGNER GUI
        result = self.runTiltAligner(imgdata, tiltdata)
        if self.badprocess is True:
            return
        numpeaks = len(self.peaktree1)
        #apDisplay.printMsg("Found "+str(numpeaks)+" particles for "+apDisplay.shortenImageName(imgdata['filename']))
        self.stats['lastpeaks'] = numpeaks

        ### mask the images
        procimg1, procimg2 = apTiltTransform.maskOverlapRegion(
            procimg1, procimg2, self.data)

        #CREATE PEAK JPEG
        if self.threadJpeg is True:
            threading.Thread(target=apPeaks.createTiltedPeakJpeg,
                             args=(imgdata, tiltdata, self.peaktree1,
                                   self.peaktree2, self.params, procimg1,
                                   procimg2)).start()
        else:
            apPeaks.createTiltedPeakJpeg(imgdata, tiltdata, self.peaktree1,
                                         self.peaktree2, self.params, procimg1,
                                         procimg2)

        #EXTRA DONE DICT CALL
        self._writeDoneDict(tiltdata['filename'])
	def loopProcessImage(self, imgdata):
		"""
		Over-writes the particleLoop processImage and uses the appionLoop processImage
		"""
		#GET THE TILT PAIR
		tiltdata = apTiltPair.getTiltPair(imgdata)
		if tiltdata is None:
			return

		### process images
		procimgpath = os.path.join(self.params['rundir'], imgdata['filename']+'.dwn.mrc')
		if not os.path.isfile(procimgpath):
			apDisplay.printMsg("processing mrc for first image")
			apFindEM.processAndSaveImage(imgdata, params=self.params)
		procimg1 = apImage.mrcToArray(procimgpath, msg=False)

		procimgpath = os.path.join(self.params['rundir'], tiltdata['filename']+'.dwn.mrc')
		if not os.path.isfile(procimgpath):
			apDisplay.printMsg("processing mrc for second image")
			apFindEM.processAndSaveImage(tiltdata, params=self.params)
		procimg2 = apImage.mrcToArray(procimgpath, msg=False)

		#RUN THE ALIGNER GUI
		result = self.runTiltAligner(imgdata, tiltdata)
		if self.badprocess is True:
			return
		numpeaks = len(self.peaktree1)
		#apDisplay.printMsg("Found "+str(numpeaks)+" particles for "+apDisplay.shortenImageName(imgdata['filename']))
		self.stats['lastpeaks'] = numpeaks

		### mask the images
		procimg1, procimg2 = apTiltTransform.maskOverlapRegion(procimg1, procimg2, self.data)

		#CREATE PEAK JPEG
		if self.threadJpeg is True:
			threading.Thread(target=apPeaks.createTiltedPeakJpeg, args=(imgdata, tiltdata, self.peaktree1,
				self.peaktree2, self.params, procimg1, procimg2)).start()
		else:
			apPeaks.createTiltedPeakJpeg(imgdata, tiltdata, self.peaktree1, self.peaktree2, self.params,
				procimg1, procimg2)

		#EXTRA DONE DICT CALL
		self._writeDoneDict(tiltdata['filename'])