예제 #1
0
def runCreateOutputStep(self):
    ''' Create standard output results_images, result_classes'''
    #creating results files
    imgSet = self.inputParticles.get()
    lastIter = self.numberOfIterations.get()
    if self.numberOfReferences != 1:
        inDocfile = self._getFileName('docfileInputAnglesIters', iter=lastIter)
        ClassFnTemplate = '%(rootDir)s/reconstruction_Ref3D_%(ref)03d.vol'
        
        allExpImagesinDocfile = xmipp.FileName()
        all_exp_images="all_exp_images"
        allExpImagesinDocfile.compose(all_exp_images, inDocfile)
        
        dataClasses = self._getFileName('sqliteClasses')
        
        createClassesFromImages(imgSet, str(allExpImagesinDocfile), dataClasses, 
                                SetOfClasses3D, xmipp.MDL_REF3D, ClassFnTemplate, lastIter)
        
        classes = self._createSetOfClasses3D(imgSet)
        clsSet = SetOfClasses3D(dataClasses)
        classes.appendFromClasses(clsSet)
        
        volumes = self._createSetOfVolumes()
        volumes.setSamplingRate(imgSet.getSamplingRate())
        
        for refN in self.allRefs():
            volFn = self._getFileName('reconstructedFileNamesIters', iter=lastIter, ref=refN)
            vol = Volume()
            vol.setFileName(volFn)
            volumes.append(vol)
    
        self._defineOutputs(outputVolumes=volumes)
        self._defineOutputs(outputClasses=classes)
        self._defineSourceRelation(self.inputParticles, volumes)
        self._defineSourceRelation(self.inputParticles, classes)
        self._defineSourceRelation(self.input3DReferences, volumes)
        self._defineSourceRelation(self.input3DReferences, classes)
    else:
        volFn = self._getFileName('reconstructedFileNamesIters',
                                  iter=lastIter, ref=1)
        halfMap1 = self._getFileName('reconstructedFileNamesItersSplit1',
                                     iter=lastIter, ref=1)
        halfMap2 = self._getFileName('reconstructedFileNamesItersSplit2',
                                     iter=lastIter, ref=1)

        vol = Volume()
        vol.setFileName(volFn)
        vol.setSamplingRate(imgSet.getSamplingRate())
        vol.setHalfMaps([halfMap1, halfMap2])
        self._defineOutputs(outputVolume=vol)
        self._defineSourceRelation(self.inputParticles, vol)
        self._defineSourceRelation(self.input3DReferences, vol)
        
        #create set of images
        imgSetOut = self._createSetOfParticles("_iter_%03d" %lastIter)
        self._fillParticlesFromIter(imgSetOut, lastIter)
        
        self._defineOutputs(outputParticles=imgSetOut)
        self._defineSourceRelation(self.inputParticles, imgSetOut)
        self._defineSourceRelation(self.input3DReferences, imgSetOut)
예제 #2
0
def runCreateOutputStep(self):
    ''' Create standard output results_images, result_classes'''
    #creating results files
    imgSet = self.inputParticles.get()
    lastIter = self.numberOfIterations.get()
    if self.numberOfReferences != 1:
        inDocfile = self._getFileName('docfileInputAnglesIters', iter=lastIter)
        ClassFnTemplate = '%(rootDir)s/reconstruction_Ref3D_%(ref)03d.vol'
        
        allExpImagesinDocfile = xmipp.FileName()
        all_exp_images="all_exp_images"
        allExpImagesinDocfile.compose(all_exp_images, inDocfile)
        
        dataClasses = self._getFileName('sqliteClasses')
        
        createClassesFromImages(imgSet, str(allExpImagesinDocfile), dataClasses, 
                                SetOfClasses3D, xmipp.MDL_REF3D, ClassFnTemplate, lastIter)
        
        classes = self._createSetOfClasses3D(imgSet)
        clsSet = SetOfClasses3D(dataClasses)
        classes.appendFromClasses(clsSet)
        
        volumes = self._createSetOfVolumes()
        volumes.setSamplingRate(imgSet.getSamplingRate())
        
        for refN in self.allRefs():
            volFn = self._getFileName('reconstructedFileNamesIters', iter=lastIter, ref=refN)
            vol = Volume()
            vol.setFileName(volFn)
            volumes.append(vol)
    
        self._defineOutputs(outputVolumes=volumes)
        self._defineOutputs(outputClasses=classes)
        self._defineSourceRelation(self.inputParticles, volumes)
        self._defineSourceRelation(self.inputParticles, classes)
        self._defineSourceRelation(self.input3DReferences, volumes)
        self._defineSourceRelation(self.input3DReferences, classes)
    else:
        volFn = self._getFileName('reconstructedFileNamesIters',
                                  iter=lastIter, ref=1)
        halfMap1 = self._getFileName('reconstructedFileNamesItersSplit1',
                                     iter=lastIter, ref=1)
        halfMap2 = self._getFileName('reconstructedFileNamesItersSplit2',
                                     iter=lastIter, ref=1)

        vol = Volume()
        vol.setFileName(volFn)
        vol.setSamplingRate(imgSet.getSamplingRate())
        vol.setHalfMaps([halfMap1, halfMap2])
        self._defineOutputs(outputVolume=vol)
        self._defineSourceRelation(self.inputParticles, vol)
        self._defineSourceRelation(self.input3DReferences, vol)
        
        #create set of images
        imgSetOut = self._createSetOfParticles("_iter_%03d" %lastIter)
        self._fillParticlesFromIter(imgSetOut, lastIter)
        
        self._defineOutputs(outputParticles=imgSetOut)
        self._defineSourceRelation(self.inputParticles, imgSetOut)
        self._defineSourceRelation(self.input3DReferences, imgSetOut)
예제 #3
0
def runCreateOutputStep(self):
    import pyworkflow.em.metadata as md
    ''' Create standard output results_images, result_classes'''
    #creating results files
    imgSet = self.inputParticles.get()
    lastIter = self.numberOfIterations.get()
    if self.numberOfReferences != 1:
        inDocfile = self._getFileName('docfileInputAnglesIters', iter=lastIter)
        ClassFnTemplate = '%(rootDir)s/reconstruction_Ref3D_%(ref)03d.vol'
        
        allExpImagesinDocfile = xmipp.FileName()
        all_exp_images="all_exp_images"
        allExpImagesinDocfile.compose(all_exp_images, inDocfile)
        
        dataClasses = self._getFileName('sqliteClasses')
        
        createClassesFromImages(imgSet, str(allExpImagesinDocfile), dataClasses, 
                                SetOfClasses3D, xmipp.MDL_REF3D, ClassFnTemplate, lastIter)
        
        classes = self._createSetOfClasses3D(imgSet)
        clsSet = SetOfClasses3D(dataClasses)
        classes.appendFromClasses(clsSet)
        
        volumes = self._createSetOfVolumes()
        volumes.setSamplingRate(imgSet.getSamplingRate())
        
        for refN in self.allRefs():
            volFn = self._getFileName('reconstructedFileNamesIters', iter=lastIter, ref=refN)
            vol = Volume()
            vol.setFileName(volFn)
            volumes.append(vol)
    
        self._defineOutputs(outputVolumes=volumes)
        self._defineOutputs(outputClasses=classes)
        self._defineSourceRelation(self.inputParticles, volumes)
        self._defineSourceRelation(self.inputParticles, classes)
    else:
        volFn = self._getFileName('reconstructedFileNamesIters', iter=lastIter, ref=1)
        vol = Volume()
        vol.setFileName(volFn)
        vol.setSamplingRate(imgSet.getSamplingRate())
        self._defineOutputs(outputVolume=vol)
        self._defineSourceRelation(self.inputParticles, vol)
        
        #create set of images
        imgSetOut = self._createSetOfParticles()
        imgFn = "all_exp_images@" + self._getFileName('docfileInputAnglesIters', iter=lastIter, ref=1)
        
        imgSetOut.copyInfo(imgSet)
        imgSetOut.setAlignmentProj()
        imgSetOut.copyItems(imgSet,
                            updateItemCallback=self._createItemMatrix,
                            itemDataIterator=md.iterRows(imgFn))
        self._defineOutputs(outputParticles=imgSetOut)
        self._defineSourceRelation(self.inputParticles, imgSetOut)