def registerCoords(self, coordsDir): count = self.getOutputsSize() suffix = str(count + 1) if count > 0 else "" outputName = "outputCoordinates" + suffix from pyworkflow.em.packages.xmipp3 import readSetOfCoordinates inputset = self.getInputMicrographs() outputset = self._createSetOfCoordinates( inputset, suffix=suffix ) # micrographs are the input set if protocol is not finished readSetOfCoordinates(coordsDir, outputset.getMicrographs(), outputset) summary = self.getSummary(outputset) outputset.setObjComment(summary) outputs = {outputName: outputset} self._defineOutputs(**outputs) self._defineSourceRelation(self.inputMicrographs, outputset) self._store()
def registerCoords(self, coordsDir): """ This methods is usually inherited from all Pickers and it is used from the Java picking GUI to register a new SetOfCoordinates when the user click on +Particles button. """ suffix = self.__getOutputSuffix() outputName = self.OUTPUT_PREFIX + suffix from pyworkflow.em.packages.xmipp3 import readSetOfCoordinates inputset = self.getInputMicrographs() outputset = self._createSetOfCoordinates(inputset, suffix=suffix)#micrographs are the input set if protocol is not finished readSetOfCoordinates(coordsDir, outputset.getMicrographs(), outputset) summary = self.getSummary(outputset) outputset.setObjComment(summary) outputs = {outputName: outputset} self._defineOutputs(**outputs) self._defineSourceRelation(self.inputMicrographs, outputset) self._store()
def registerCoords(self, coordsDir): """ This methods is usually inherited from all Pickers and it is used from the Java picking GUI to register a new SetOfCoordinates when the user click on +Particles button. """ suffix = self.__getOutputSuffix() outputName = self.OUTPUT_PREFIX + suffix from pyworkflow.em.packages.xmipp3 import readSetOfCoordinates inputset = self.getInputMicrographs() # micrographs are the input set if protocol is not finished outputset = self._createSetOfCoordinates(inputset, suffix=suffix) readSetOfCoordinates(coordsDir, outputset.getMicrographs(), outputset) summary = self.getSummary(outputset) outputset.setObjComment(summary) outputs = {outputName: outputset} self._defineOutputs(**outputs) self._defineSourceRelation(self.inputMicrographs, outputset) self._store()
def registerCoords(self, args): from pyworkflow.em.packages.xmipp3 import readSetOfCoordinates, readAnglesFromMicrographs extradir = self._getExtraPath() count = self.getOutputsSize() suffix = str(count + 1) if count > 0 else '' inputset = self.inputMicrographsTiltedPair.get() uSet = inputset.getUntilted() tSet = inputset.getTilted() outputName = 'outputCoordinatesTiltPair' + suffix uSuffix = 'Untilted' + suffix tSuffix = 'Tilted' + suffix # Create Untilted and Tilted SetOfCoordinates uCoordSet = self._createSetOfCoordinates(uSet, suffix=uSuffix) readSetOfCoordinates(extradir, uSet, uCoordSet) uCoordSet.write() tCoordSet = self._createSetOfCoordinates(tSet, suffix=tSuffix) readSetOfCoordinates(extradir, tSet, tCoordSet) tCoordSet.write() # Read Angles from input micrographs micsFn = self._getPath('input_micrographs.xmd') setAngles = self._createSetOfAngles(suffix=suffix) readAnglesFromMicrographs(micsFn, setAngles) setAngles.write() # Create CoordinatesTiltPair object outputset = CoordinatesTiltPair(filename=self._getPath('coordinates_pairs%s.sqlite' % suffix)) outputset.setTilted(tCoordSet) outputset.setUntilted(uCoordSet) outputset.setAngles(setAngles) outputset.setMicsPair(inputset) for coordU, coordT in izip(uCoordSet, tCoordSet): outputset.append(TiltPair(coordU, coordT)) summary = self.getSummary(outputset) outputset.setObjComment(summary) outputs = {outputName: outputset} self._defineOutputs(**outputs) self._defineSourceRelation(inputset, outputset) self._store()
def _importFromFolderStep(self): """ This function will copy Xmipp .pos files for simulating a particle picking run...this is only for testing purposes. """ for f in getFiles(self.importFolder.get()): copyFile(f, self._getExtraPath()) extradir = self._getExtraPath() inputset = self.inputMicrographsTiltedPair.get() uSet = inputset.getUntilted() tSet = inputset.getTilted() # Create Untilted and Tilted SetOfCoordinates uCoordSet = self._createSetOfCoordinates(uSet, suffix='Untilted') readSetOfCoordinates(extradir, uSet, uCoordSet) uCoordSet.write() tCoordSet = self._createSetOfCoordinates(tSet, suffix='Tilted') readSetOfCoordinates(extradir, tSet, tCoordSet) tCoordSet.write() # Read Angles from faked input micrographs micsFn = self._getExtraPath('input_micrographs.xmd') setAngles = self._createSetOfAngles() readAnglesFromMicrographs(micsFn, setAngles) setAngles.write() # Create CoordinatesTiltPair object outputset = CoordinatesTiltPair(filename=self._getPath('coordinates_pairs.sqlite')) outputset.setTilted(tCoordSet) outputset.setUntilted(uCoordSet) outputset.setAngles(setAngles) outputset.setMicsPair(inputset) outputset.setObjComment(self.getSummary(outputset)) for coordU, coordT in izip(uCoordSet, tCoordSet): outputset.append(TiltPair(coordU, coordT)) self._defineOutputs(outputCoordinatesTiltPair=outputset) self._defineSourceRelation(inputset, outputset)
def registerCoords(self, coordsDir): """ This method is usually inherited by all Pickers and it is used from the Java picking GUI to register a new SetOfCoordinates when the user click on +Particles button. """ suffix = self.__getOutputSuffix() outputName = self.OUTPUT_PREFIX + suffix from pyworkflow.em.packages.xmipp3 import readSetOfCoordinates inputset = self.getInputMicrographs() # micrographs are the input set if protocol is not finished outputset = self._createSetOfCoordinates(inputset, suffix=suffix) readSetOfCoordinates(coordsDir, outputset.getMicrographs(), outputset) summary = self.getSummary(outputset) outputset.setObjComment(summary) outputs = {outputName: outputset} self._defineOutputs(**outputs) # Using a pointer to define the relations is more robust to scheduling # and id changes between the protocol run.db and the main project # database. The pointer defined below points to the outputset object self._defineSourceRelation(self.getInputMicrographsPointer(), Pointer(value=self, extended=outputName)) self._store()