def start(self):
        apDisplay.printMsg("Getting box files")
        boxfiles = self.getBoxFiles()

        apDisplay.printMsg("Getting image data from database")
        imgtree = apDatabase.getSpecificImagesFromDB(boxfiles)
        if imgtree[0]['session']['name'] != self.sessiondata['name']:
            apDisplay.printError("Session and Image do not match " +
                                 imgtree[0]['filename'])

        ### insert params for manual picking
        rundata = self.insertManualParams()

        # upload Particles
        for imgdata in imgtree:
            ### check session
            if imgdata['session']['name'] != self.sessiondata['name']:
                apDisplay.printError("Session and Image do not match " +
                                     imgdata['filename'])

            peaktree = self.boxFileToPeakTree(imgdata)
            apParticle.insertParticlePeaks(peaktree,
                                           imgdata,
                                           self.params['runname'],
                                           msg=True)
Example #2
0
    def start(self):
        imgfilename2peaklist = self.readFileToPeakTree()
        imglist = imgfilename2peaklist.keys()

        apDisplay.printMsg("Getting image data from database")
        imgtree = apDatabase.getSpecificImagesFromDB(imglist, self.sessiondata)
        if imgtree[0]['session']['name'] != self.sessiondata['name']:
            apDisplay.printError("Session and Image do not match " +
                                 imgtree[0]['filename'])

        ### insert params for manual picking
        rundata = self.insertManualParams()

        # upload Particles
        for imgdata in imgtree:
            ### check session
            if imgdata['session']['name'] != self.sessiondata['name']:
                apDisplay.printError("Session and Image do not match " +
                                     imgdata['filename'])

            peaktree = imgfilename2peaklist[imgdata['filename']]
            apDisplay.printMsg(
                "%d particles for image %s" %
                (len(peaktree), apDisplay.short(imgdata['filename'])))
            if self.params['commit'] is True:
                apParticle.insertParticlePeaks(peaktree,
                                               imgdata,
                                               self.params['runname'],
                                               msg=True)
Example #3
0
    def getParticles(self, zprojimagedata):
        '''
                start Etomo
                insert particles
                '''
        os.chdir(self.params['fulltomodir'])
        proc = subprocess.Popen("etomo --fg %s.edf" % (self.seriesname),
                                shell=True)
        proc.wait()
        xrange = apImod.getSubTomoBoundary(self.params['fulltomodir'],
                                           self.seriesname, 'x')
        if not len(xrange):
            apDisplay.printError(
                'Subtomogram coordinate not generated, can not commit to database.'
            )

        # get subtomogram center from edf log
        xmin, xmax = apImod.getSubTomoBoundary(self.params['fulltomodir'],
                                               self.seriesname, 'x')
        ymin, ymax = apImod.getSubTomoBoundary(self.params['fulltomodir'],
                                               self.seriesname, 'y')
        xcenter = self.fullbin * (xmin + xmax) / 2
        ycenter = self.fullbin * (ymin + ymax) / 2
        peaktree = [{'xcoord': xcenter, 'ycoord': ycenter, 'peakarea': 1}]
        # Use the same selection run name for all subtomogram centers
        selectionrunname = zprojimagedata['session']['name'] + '_subtomo'
        self.insertCenterSelectionRunData(zprojimagedata['session'],
                                          selectionrunname)
        apParticle.insertParticlePeaks(peaktree, zprojimagedata,
                                       selectionrunname)
        particles = apParticle.getParticlesForImageFromRunName(
            zprojimagedata, selectionrunname)
        return [particles[0]]
def makeParticleFromContour(imagedata,tracerundata,label='_trace'):
        contours = getContoursFromImageTraceRun(imagedata,tracerundata)
        peaktree = []
        for contourdata in contours:
                points = getContourPointsFromContour(contourdata)
                center = polygon.getPolygonCenter(points)
                peakdict = {'xcoord':center[0],'ycoord':center[1],'label':label,'peakarea':1}
                peaktree.append(peakdict)
        apParticle.insertParticlePeaks(peaktree, imagedata, tracerundata['name'], False)
        def loopCommitToDatabase(self, imgdata):
                ### commit the run
                sessiondata = imgdata['session']
                rundata = self.commitRunToDatabase(sessiondata, True)

                ### commit custom picker specific params
                value = self.commitToDatabase(imgdata, rundata)

                ### commit the particles
                apParticle.insertParticlePeaks(self.peaktree, imgdata, 
                        runname=self.params['runname'], msg=(not self.params['background']))

                ### commit defocal pairs
                if self.params['defocpair'] is True:
                        apDefocalPairs.insertShift(imgdata, self.sibling, self.shiftpeak)

                return value
Example #6
0
	def loopCommitToDatabase(self, imgdata):
		### commit the run
		sessiondata = imgdata['session']
		rundata = self.commitRunToDatabase(sessiondata, True)

		### commit custom picker specific params
		value = self.commitToDatabase(imgdata, rundata)

		### commit the particles
		apParticle.insertParticlePeaks(self.peaktree, imgdata, 
			runname=self.params['runname'], msg=(not self.params['background']))

		### commit defocal pairs
		if self.params['defocpair'] is True:
			apDefocalPairs.insertShift(imgdata, self.sibling, self.shiftpeak)

		return value
	def start(self):
		apDisplay.printMsg("Getting box files")
		boxfiles = self.getBoxFiles()

		apDisplay.printMsg("Getting image data from database")
		imgtree = apDatabase.getSpecificImagesFromDB(boxfiles)
		if imgtree[0]['session']['name'] != self.sessiondata['name']:
			apDisplay.printError("Session and Image do not match "+imgtree[0]['filename'])	

		### insert params for manual picking
		rundata = self.insertManualParams()

		# upload Particles
		for imgdata in imgtree:
			### check session
			if imgdata['session']['name'] != self.sessiondata['name']:
				apDisplay.printError("Session and Image do not match "+imgdata['filename'])	

			peaktree = self.boxFileToPeakTree(imgdata)
			apParticle.insertParticlePeaks(peaktree, imgdata, self.params['runname'], msg=True)
        def start(self):
                imgfilename2peaklist = self.readFileToPeakTree()
                imglist = imgfilename2peaklist.keys()

                apDisplay.printMsg("Getting image data from database")
                imgtree = apDatabase.getSpecificImagesFromDB(imglist, self.sessiondata)
                if imgtree[0]['session']['name'] != self.sessiondata['name']:
                        apDisplay.printError("Session and Image do not match "+imgtree[0]['filename'])  

                ### insert params for manual picking
                rundata = self.insertManualParams()

                # upload Particles
                for imgdata in imgtree:
                        ### check session
                        if imgdata['session']['name'] != self.sessiondata['name']:
                                apDisplay.printError("Session and Image do not match "+imgdata['filename'])     

                        peaktree = imgfilename2peaklist[imgdata['filename']]
                        apDisplay.printMsg("%d particles for image %s"
                                %(len(peaktree), apDisplay.short(imgdata['filename'])))
                        if self.params['commit'] is True:
                                apParticle.insertParticlePeaks(peaktree, imgdata, self.params['runname'], msg=True)
	def getParticles(self,zprojimagedata):
		'''
		start Etomo
		insert particles
		'''
		os.chdir(self.params['fulltomodir'])
		proc = subprocess.Popen("etomo --fg %s.edf" % (self.seriesname), shell=True)
		proc.wait()
		xrange = apImod.getSubTomoBoundary(self.params['fulltomodir'],self.seriesname,'x')
		if not len(xrange):
			apDisplay.printError('Subtomogram coordinate not generated, can not commit to database.')

		# get subtomogram center from edf log
		xmin,xmax = apImod.getSubTomoBoundary(self.params['fulltomodir'],self.seriesname,'x')
		ymin,ymax = apImod.getSubTomoBoundary(self.params['fulltomodir'],self.seriesname,'y')
		xcenter = self.fullbin * (xmin+xmax) / 2
		ycenter = self.fullbin * (ymin+ymax) / 2
		peaktree = [{'xcoord':xcenter,'ycoord':ycenter,'peakarea':1}]
		# Use the same selection run name for all subtomogram centers
		selectionrunname = zprojimagedata['session']['name']+'_subtomo'
		self.insertCenterSelectionRunData(zprojimagedata['session'],selectionrunname)
		apParticle.insertParticlePeaks(peaktree, zprojimagedata, selectionrunname)
		particles = apParticle.getParticlesForImageFromRunName(zprojimagedata,selectionrunname)
		return [particles[0]]