def createOutputStep(self): lastIter = self.getLastIteration() if lastIter <= 1: return if self.Nvolumes == 1: vol = em.Volume() vol.setLocation( self._getExtraPath('recvol_state1_iter%d.spi' % lastIter)) vol.setSamplingRate(self.inputClasses.get().getSamplingRate()) self._defineOutputs(outputVol=vol) else: vol = self._createSetOfVolumes() vol.setSamplingRate(self.inputClasses.get().getSamplingRate()) fnVolumes = glob( self._getExtraPath('recvol_state*_iter%d.spi') % lastIter) fnVolumes.sort() for fnVolume in fnVolumes: aux = em.Volume() aux.setLocation(fnVolume) vol.append(aux) self._defineOutputs(outputVolumes=vol) self._defineSourceRelation(self.inputClasses, vol)
def createOutputStep(self): lastIter = self._getLastIter() inputSet = self._getInputParticles() # Register output volume volFn = self._getFileName('iter_vol', iter=lastIter) vol = em.Volume() vol.setFileName(volFn) vol.setSamplingRate(inputSet.getSamplingRate()) mapHalf1 = self._getFileName('iter_vol1', iter=lastIter) mapHalf2 = self._getFileName('iter_vol2', iter=lastIter) vol.setHalfMaps([mapHalf1, mapHalf2]) self._defineOutputs(outputVolume=vol) self._defineSourceRelation(self._getInputParticlesPointer(), vol) # Register output Particles with their 3D alignment partSet = self._createSetOfParticles() partSet.copyInfo(inputSet) self._fillDataFromIter(partSet, lastIter) self._defineOutputs(outputParticles=partSet) self._defineTransformRelation(self._getInputParticlesPointer(), partSet) if not self.doContinue: self._defineSourceRelation(self.input3DReference, vol) self._defineSourceRelation(self.input3DReference, partSet)
def createOutputStep(self): vols = [] for vol in self._iterInputVolumes(): outVol = em.Volume() outVol.setLocation(vol.outputName) outVol.setObjLabel(vol.getObjLabel()) outVol.setObjComment(vol.getObjComment()) #set transformation matrix volId = vol.getObjId() fhInputTranMat = self._getExtraPath('transformation-matrix_vol%06d.txt'%volId) transMatFromFile = np.loadtxt(fhInputTranMat) transformationMat = np.reshape(transMatFromFile,(4,4)) transform = em.Transform() transform.setMatrix(transformationMat) outVol.setTransform(transform) vols.append(outVol) if len(vols) > 1: volSet = self._createSetOfVolumes() volSet.setSamplingRate(self.inputReference.get().getSamplingRate()) for vol in vols: volSet.append(vol) outputArgs = {'outputVolumes': volSet} else: vols[0].setSamplingRate(self.inputReference.get().getSamplingRate()) outputArgs = {'outputVolume': vols[0]} self._defineOutputs(**outputArgs) for pointer in self.inputVolumes: self._defineSourceRelation(pointer, outputArgs.values()[0])
def createOutput(self): volume = em.Volume() volume.setSamplingRate(self.sampling.get()) volume.setFileName(self._getVolName()) self._defineOutputs(outputVolume=volume) if self.inputPdbData == self.IMPORT_OBJ: self._defineSourceRelation(self.pdbObj, volume)
def createOutputStep(self): outVolFn = self._getExtraPath("inputVolumeAligned.vol") outVol = em.Volume() outVol.setLocation(outVolFn) #set transformation matrix fhInputTranMat = self._getExtraPath('transformation-matrix.txt') transMatFromFile = np.loadtxt(fhInputTranMat) transformationMat = np.reshape(transMatFromFile, (4, 4)) transform = em.Transform() transform.setMatrix(transformationMat) outVol.setTransform(transform) outVol.setSamplingRate(self.inputVolume.get().getSamplingRate()) outputArgs = {'outputVolume': outVol} self._defineOutputs(**outputArgs) self._defineSourceRelation(self.inputVolume, outVol) #particles.... outParticlesFn = self._getExtraPath('outputParticles.xmd') outputParticles = self._createSetOfParticles() outputParticles.copyInfo(self.inputParticles.get()) outputParticles.setAlignmentProj() readSetOfParticles(outParticlesFn, outputParticles) outputArgs = {'outputParticles': outputParticles} self._defineOutputs(**outputArgs) self._defineSourceRelation(self.inputParticles, outputParticles)
def createOutputStep(self): inputAverages = self.inputAverages.get() imgxdim = inputAverages.getXDim() fnVol = self._getExtraPath("refine.mrc") volxdim, _, _, _ = em.ImageHandler().getDimensions(fnVol) if imgxdim != volxdim: fnVolOut = self._getPath("volume.vol") args3 = "-i %s --dim %d -o %s" % (fnVol, imgxdim, fnVolOut) #TODO maybe change later using Python binding to resize images import pyworkflow.em.packages.xmipp3 as xmipp3 self.runJob("xmipp_image_resize", args3, env=xmipp3.getEnviron()) else: fnVolOut = fnVol vol = em.Volume() vol.setLocation(fnVolOut) vol.setSamplingRate(inputAverages.getSamplingRate()) self._defineOutputs(outputVol=vol) self._defineSourceRelation(self.inputAverages, vol)
def createOutputStep(self): vols = [] for vol in self._iterInputVolumes(): outVol = em.Volume() outVol.setLocation(vol.outputName) outVol.setObjLabel(vol.getObjLabel()) outVol.setObjComment(vol.getObjComment()) vols.append(outVol) if len(vols) > 1: volSet = self._createSetOfVolumes() volSet.setSamplingRate(self.inputReference.get().getSamplingRate()) for vol in vols: volSet.append(vol) outputArgs = {'outputVolumes': volSet} else: vols[0].setSamplingRate(self.inputReference.get().getSamplingRate()) outputArgs = {'outputVolume': vols[0]} self._defineOutputs(**outputArgs) for pointer in self.inputVolumes: self._defineSourceRelation(pointer, outputArgs.values()[0])
def _defineOutputVol(name, fn): vol = em.Volume() vol.copyInfo(self.inputVolume.get()) vol.setLocation(fn) self._defineOutputs(**{name: vol}) self._defineTransformRelation(self.inputVolume, vol)
def createOutputStep(self): vol = em.Volume() vol.setLocation(self._getExtraPath('particles_rec_final.mrc')) vol.setSamplingRate(self.inputClasses.get().getSamplingRate()) self._defineOutputs(outputVol=vol) self._defineSourceRelation(self.inputClasses, vol)