def getObjectView(self, filename, **kwargs): """ This is a wrapper around the ObjectView constructor, just to avoid passing the project and protocol, since both are know here in the ProtocolViewer. """ # We can not import em globally from pyworkflow.em import ObjectView return ObjectView(self._project, self.protocol.strId(), filename, **kwargs)
def objectView(self, filenameOrObject, **kwargs): """ This is a wrapper around the ObjectView constructor, just to avoid passing the project and protocol, since both are know here in the ProtocolViewer. Params: filenameOrObject: This parameter can be either a filename or an object that has 'getFileName' method. **kwargs: Can receive extra keyword-arguments that will be passed to the ObjectView constructor """ # We can not import em globally from pyworkflow.em import ObjectView fn = None if isinstance(filenameOrObject, basestring): # If the input is a string filename, we should take the object id # from the protocol. This assumes that self.protocol have been # previously set fn = filenameOrObject strId = self.getProtocolId() elif isinstance(filenameOrObject, Object): if filenameOrObject.getObjId() is None: strId = self.getProtocolId() else: strId = filenameOrObject.strId() if hasattr(filenameOrObject, 'getLocation'): # In this case fn will be a location tuple that will be # correctly handled by the showj DataView fn = filenameOrObject.getLocation() elif hasattr(filenameOrObject, 'getFileName'): # If the input is an object, we can take the id from it fn = filenameOrObject.getFileName() if fn is None: raise Exception("Incorrect input object, it should be 'string' or " "'Object' (with 'getLocation' or 'getFileName' " "methods).") return ObjectView(self._project, strId, fn, **kwargs)
def createScipionPartView(self, partSet, viewParams={}): from pyworkflow.em import ObjectView inputParticlesId = self.protocol.inputParticles.get().strId() filename = partSet.getFileName() labels = 'enabled id _size _filename _transform._matrix' viewParams = { showj.ORDER: labels, showj.VISIBLE: labels, showj.RENDER: '_filename', 'labels': 'id', } return ObjectView( self._project, self.protocol.strId(), filename, other=inputParticlesId, # env=self._env, viewParams=viewParams)
def viewVolumesSqlite(self, volumes): path = self.protocol._getExtraPath('viewer_volumes.sqlite') samplingRate = self.protocol.inputParticles.get().getSamplingRate() self.createVolumesSqlite(volumes, path, samplingRate) return [ObjectView(self._project, self.protocol.strId(), path)]