def createOutputStep(self):
        from convert import readSetOfClasses3D
        numberOfClasses = self.numberOfRef
        imgSet = self.inputParticles.get()
        volumes = self._createSetOfVolumes()
        volumes.setSamplingRate(imgSet.getSamplingRate())
        
        fileparList = []
        volumeList = []
        
        for ref in range(1, numberOfClasses + 1):
            vol = Volume()
            filepar = self._getBaseName('output_par_class', iter=self._getLastIter(), ref=ref)
            volFn = self._getFileName('iter_vol_class', iter=self._getLastIter(), ref=ref)
            vol.setFileName(volFn)
            volumes.append(vol)
            fileparList.append(filepar)
            volumeList.append(volFn)
        
        classes = self._createSetOfClasses3D(imgSet)
        readSetOfClasses3D(classes, fileparList, volumeList)
        
        # Define the outputs and relations
        self._defineOutputs(outputClasses=classes)
        self._defineOutputs(outputVolumes=volumes)
        #TODO: save alignment

        self._defineSourceRelation(imgSet, classes)
        self._defineSourceRelation(self.input3DReference.get(), classes)
        self._defineSourceRelation(imgSet, volumes)
        self._defineSourceRelation(self.input3DReference.get(), volumes)
Exemple #2
0
    def _getIterClasses(self, it, clean=False):
        """ Return the file with the classes for this iteration.
        If the file doesn't exists, it will be created. 
        """
        from convert import readSetOfClasses3D
        
        dataClasses = self.protocol._getFileName('classes_scipion', iter=it)
        
        if clean:
            cleanPath(dataClasses)
        
        if not exists(dataClasses):
            fileparList = []
            volumeList = []
            for ref in self._refsList:
                filepar = self.protocol._getFileName('output_par_class', iter=it, ref=ref)
                volFn = self.protocol._getFileName('iter_vol_class', iter=it, ref=ref)
                fileparList.append(filepar)
                volumeList.append(volFn)
            
            clsSet = em.SetOfClasses3D(filename=dataClasses)
            clsSet.setImages(self.inputParticles.get())
            readSetOfClasses3D(clsSet, fileparList, volumeList)
            clsSet.write()
            clsSet.close()

        return dataClasses