def show(self, form): protocol = form.protocol params = self._getParameters(protocol) _value = params['value'] _label = params['label'] # form.setParamFromVar('inputMicrographs') # update selected input micrographs provider = self._getProvider(protocol) if provider is not None: args = { 'unit': UNIT_PIXEL, 'downsample': _value[0], 'lf': _value[1], 'hf': _value[2], 'showInAngstroms': True } d = CtfDownsampleDialog(form.root, provider, **args) if d.resultYes(): form.setVar(_label[0], d.getDownsample()) form.setVar(_label[1], d.getLowFreq()) form.setVar(_label[2], d.getHighFreq()) else: dialog.showWarning("Empty input", "Select elements first", form.root)
def show(self, form, *args): protocol = form.protocol provider = self._getProvider(protocol) installErrors = Plugin.validateInstallation() if installErrors: dialog.showError("SPIDER not properly installed.", "\n".join(installErrors), form.root) return if provider is not None: d = SpiderFilterDialog(form.root, provider, protocolParent=protocol) if d.resultYes(): if protocol.filterType <= FILTER_FERMI: form.setVar('filterRadius', d.getRadius()) else: form.setVar('lowFreq', d.getLowFreq()) form.setVar('highFreq', d.getHighFreq()) if protocol.filterType == FILTER_FERMI: form.setVar('temperature', d.getTemperature()) else: dialog.showWarning("Input particles", "Select particles first", form.root)
def show(self, form, *params): prot = form.protocol acquisitionInfo = prot.loadAcquisitionInfo() if prot.importFilePath: if exists(prot.importFilePath): if acquisitionInfo: msg = '' for k, v in acquisitionInfo.iteritems(): msg += '%s = %s\n' % (k, v) msg += '\n*Do you want to use detected acquisition values?*' response = dialog.askYesNo("Import acquisition", msg, form.root) if response: for k, v in acquisitionInfo.iteritems(): form.setVar(k, v) else: dialog.showWarning("Import failed", "Could not import acquisition info.", form.root) else: dialog.showError( "Input error", "*Import file doesn't exist.*\nFile:\n%s" % prot.importFilePath, form.root) else: dialog.showError("Input error", "Select import file first", form.root)
def show(self, form): protocol = form.protocol provider = self._getProvider(protocol) params = self._getParameters(protocol) if provider is not None: args = { 'mode': params['mode'], 'lowFreq': params['value'][1], 'highFreq': params['value'][0], 'unit': UNIT_ANGSTROM } args['showDecay'] = False d = emwiz.BandPassFilterDialog(form.root, provider, **args) if d.resultYes(): form.setVar('lowPass', d.getHighFreq()) form.setVar('highPass', d.getLowFreq()) else: dialog.showWarning("Input micrographs", "Select micrographs first", form.root)
def show(self, form): protocol = form.protocol provider = self._getProvider(protocol) if provider is not None: d = BsoftFilterDialog(form.root, provider, protocolParent=protocol) else: dialog.showWarning("Input particles", "Select particles first", form.root)
def show(self, form): protocol = form.protocol provider = self._getProvider(protocol) if protocol.inputImage.get(): d = CustomMaskDialog(form.root, provider, protocolParent=protocol) if d.resultYes(): for varName in CUSTOMMASK_VARS.iterkeys(): form.setVar(varName, d.getVarValue(varName)) else: dialog.showWarning("Input error", "Select the input image first", form.root)
def show(self, form, *args): protocol = form.protocol provider = self._getProvider(protocol) if protocol.inputImage.get(): d = CustomMaskDialog(form.root, provider, protocolParent=protocol) if d.resultYes(): for varName in CUSTOMMASK_VARS: form.setVar(varName, d.getVarValue(varName)) else: dialog.showWarning("Input error", "Select the input image first", form.root)
def show(self, form, value, label, units=UNIT_PIXEL): protocol = form.protocol provider = self._getProvider(protocol) if provider is not None: d = MaskPreviewDialog(form.root, provider, maskRadius=value, unit=units) if d.resultYes(): self.setVar(form, label, d.getRadius()) else: dialog.showWarning("Empty input", "Select elements first", form.root)
def show(self, form, value, label, units=UNIT_PIXEL): protocol = form.protocol provider = self._getProvider(protocol) if provider is not None: args = {'unit': units, 'downsample': value} d = DownsampleDialog(form.root, provider, **args) if d.resultYes(): form.setVar(label, d.getDownsample()) else: dialog.showWarning("Empty input", "Select elements first", form.root)
def show(self, form, value, label, units=UNIT_PIXEL_FOURIER): protocol = form.protocol provider = self._getProvider(protocol) if provider is not None: args = {'freqSigma': value, 'unit': units} d = GaussianFilterDialog(form.root, provider, **args) if d.resultYes(): form.setVar(label, d.getFreqSigma()) else: dialog.showWarning("Empty input", "Select elements first", form.root)
def show(self, form, value, label, units=UNIT_PIXEL): protocol = form.protocol provider = self._getProvider(protocol) if provider is not None: args = {'unit': units, 'downsample': value } d = DownsampleDialog(form.root, provider, **args) if d.resultYes(): form.setVar(label, d.getDownsample()) else: dialog.showWarning("Empty input", "Select elements first", form.root)
def show(self, form, value, label, units=UNIT_PIXEL_FOURIER): protocol = form.protocol provider = self._getProvider(protocol) if provider is not None: args = {'freqSigma': value, 'unit': units } d = GaussianFilterDialog(form.root, provider, **args) if d.resultYes(): form.setVar(label, d.getFreqSigma()) else: dialog.showWarning("Empty input", "Select elements first", form.root)
def show(self, form, value, label, units=UNIT_PIXEL): protocol = form.protocol provider = self._getProvider(protocol) if provider is not None: d = MaskRadiiPreviewDialog(form.root, provider, innerRadius=value[0], outerRadius=value[1], unit=units) if d.resultYes(): form.setVar(label[0], d.getRadius(d.radiusSliderIn)) form.setVar(label[1], d.getRadius(d.radiusSliderOut)) else: dialog.showWarning("Empty input", "Select elements first", form.root)
def show(self, form, value, label, units=UNIT_PIXEL): protocol = form.protocol # form.setParamFromVar('inputMicrographs') # update selected input micrographs provider = self._getProvider(protocol) if provider is not None: args = {'unit': units, 'lf': value[0], 'hf': value[1]} d = CtfDialog(form.root, provider, **args) if d.resultYes(): form.setVar(label[0], d.getLowFreq()) form.setVar(label[1], d.getHighFreq()) else: dialog.showWarning("Empty input", "Select elements first", form.root)
def show(self, form): self.prot = form.protocol self.form = form emptyInput = ((not self.prot.inputVolume.get().hasValue()) or (self.prot.useSplitVolume == True and not self.prot.splitVolume.get().hasValue())) if emptyInput: dialog.showWarning("Empty input", "Select input volume(s) first", self.form.root) else: d = PreWhiteningDialog(self.form, os.getcwd()) if d.resultYes(): print "result: ", d.getElbowValue(), d.getRampValue() form.setVar('prewhitenAng', d.getElbowValue()) form.setVar('prewhitenRamp', d.getRampValue())
def show(self, form, value, label, units=UNIT_PIXEL): protocol = form.protocol # form.setParamFromVar('inputMicrographs') # update selected input micrographs provider = self._getProvider(protocol) if provider is not None: args = {'unit': units, 'lf': value[0], 'hf': value[1] } d = CtfDialog(form.root, provider, **args) if d.resultYes(): form.setVar(label[0], d.getLowFreq()) form.setVar(label[1], d.getHighFreq()) else: dialog.showWarning("Empty input", "Select elements first", form.root)
def show(self, form): protocol = form.protocol provider = self._getProvider(protocol) if provider is not None: d = SpiderFilterDialog(form.root, provider, protocolParent=protocol) if d.resultYes(): if protocol.filterType <= FILTER_SPACE_REAL: form.setVar('filterRadius', d.getRadius()) else: form.setVar('lowFreq', d.getLowFreq()) form.setVar('highFreq', d.getHighFreq()) if protocol.filterType == FILTER_FERMI: form.setVar('temperature', d.getTemperature()) else: dialog.showWarning("Input particles", "Select particles first", form.root)
def show(self, form): self.prot = form.protocol self.form = form if not self.prot.useSplitVolume: emptyInput = self.prot.inputVolume.get() is None else: emptyInput = (self.prot.volumeHalf1.get() is None or self.prot.volumeHalf2.get() is None) if emptyInput: dialog.showWarning("Empty input", "Select input volume(s) first", self.form.root) else: d = PreWhiteningDialog(self.form, os.getcwd()) if d.resultYes(): print "result: ", d.getElbowValue(), d.getRampValue() form.setVar('prewhitenAng', d.getElbowValue()) form.setVar('prewhitenRamp', d.getRampValue())
def show(self, form, value, label, units=emcts.UNIT_PIXEL): protocol = form.protocol provider = self._getProvider(protocol) if provider is not None: d = MaskPreviewDialog(form.root, provider, maskRadius=value, unit=units) if d.resultYes(): if units == emcts.UNIT_ANGSTROM: value = round(d.getRadiusAngstroms( d.radiusSlider)) # Must be an integer else: value = d.getRadius(d.radiusSlider) self.setVar(form, label, value) else: dialog.showWarning("Empty input", "Select elements first", form.root)
def show(self, form, *args): params = self._getParameters(form.protocol) value = params['value'] label = params['label'] protocol = form.protocol provider = self._getProvider(protocol) if provider is not None: d = MaskRadiiPreviewDialog(form.root, provider, innerRadius=value[0], outerRadius=value[1], unit=UNIT_PIXEL) if d.resultYes(): form.setVar(label[0], int(d.getRadius(d.radiusSliderIn))) form.setVar(label[1], int(d.getRadius(d.radiusSliderOut))) else: dialog.showWarning("Empty input", "Select elements first", form.root)
def show(self, form): protocol = form.protocol provider = self._getProvider(protocol) if provider is not None: d = SpiderFilterDialog(form.root, provider, protocolParent=protocol) if d.resultYes(): if protocol.filterType <= FILTER_FERMI: form.setVar('filterRadius', d.getRadius()) else: form.setVar('lowFreq', d.getLowFreq()) form.setVar('highFreq', d.getHighFreq()) if protocol.filterType == FILTER_FERMI: form.setVar('temperature', d.getTemperature()) else: dialog.showWarning("Input particles", "Select particles first", form.root)
def show(self, form): protocol = form.protocol params = self._getParameters(protocol) _value = params['value'] _label = params['label'] pix = params['pix'] provider = self._getProvider(protocol) if provider is not None: args = {'unit': UNIT_ANGSTROM, 'lf': "%0.2f" % (pix/_value[0]), 'hf': "%0.2f" % (pix/_value[1]) } d = CtfDialog(form.root, provider, **args) if d.resultYes(): form.setVar(_label[0], "%0.2f" % (pix/d.getLowFreq())) form.setVar(_label[1], "%0.2f" % (pix/d.getHighFreq())) else: dialog.showWarning("Empty input", "Select elements first", form.root)
def show(self, form): params = self._getParameters(form.protocol) protocol = form.protocol provider = self._getProvider(protocol) if provider is not None: args = {'mode': params['mode'], 'highFreq': params['value'], 'unit': UNIT_ANGSTROM } args['showLowFreq'] = False args['showDecay'] = False d = BandPassFilterDialog(form.root, provider, **args) if d.resultYes(): form.setVar('resolution', d.samplingRate/d.getHighFreq()) else: dialog.showWarning("Input volumes", "Select volumes first", form.root)
def show(self, form, value, label, mode, unit=UNIT_PIXEL, **args): protocol = form.protocol provider = self._getProvider(protocol) if provider is not None: self.mode = mode args.update({'mode': self.mode, 'unit': unit}) if self.mode == FILTER_LOW_PASS: args['showLowFreq'] = False args['highFreq'] = value[1] args['freqDecay'] = value[2] elif self.mode == FILTER_HIGH_PASS: args['showHighFreq'] = False args['lowFreq'] = value[0] args['freqDecay'] = value[2] elif self.mode == FILTER_BAND_PASS: args['lowFreq'] = value[0] args['highFreq'] = value[1] args['freqDecay'] = value[2] else: raise Exception("Unknown mode '%s'" % self.mode) d = BandPassFilterDialog(form.root, provider, **args) if d.resultYes(): def setFormValue(flag, value, index): if args.get(flag, True): if unit == UNIT_ANGSTROM: value = d.samplingRate / (value) form.setVar(label[index], value) setFormValue('showLowFreq', d.getLowFreq(), 0) setFormValue('showHighFreq', d.getHighFreq(), 1) setFormValue('showDecay', d.getFreqDecay(), 2) else: dialog.showWarning("Empty input", "Select elements first", form.root)
def show(self, form, *params): prot = form.protocol acquisitionInfo = prot.loadAcquisitionInfo() if prot.importFilePath: if exists(prot.importFilePath): if acquisitionInfo: msg = '' for k, v in acquisitionInfo.iteritems(): msg += '%s = %s\n' % (k, v) msg += '\n*Do you want to use detected acquisition values?*' response = dialog.askYesNo("Import acquisition", msg, form.root) if response: for k, v in acquisitionInfo.iteritems(): form.setVar(k, v) else: dialog.showWarning("Import failed", "Could not import acquisition info.", form.root) else: dialog.showError("Input error", "*Import file doesn't exist.*\nFile:\n%s" % prot.importFilePath, form.root) else: dialog.showError("Input error", "Select import file first", form.root)
def show(self, form, value, label, mode, unit=UNIT_PIXEL, **args): protocol = form.protocol provider = self._getProvider(protocol) if provider is not None: self.mode = mode args.update({'mode': self.mode, 'unit': unit}) if self.mode == FILTER_LOW_PASS: args['showLowFreq'] = False args['highFreq'] = value[1] args['freqDecay'] = value[2] elif self.mode == FILTER_HIGH_PASS: args['showHighFreq'] = False args ['lowFreq'] = value[0] args ['freqDecay'] = value[2] elif self.mode == FILTER_BAND_PASS: args['lowFreq'] = value[0] args['highFreq'] = value[1] args['freqDecay'] = value[2] else: raise Exception("Unknown mode '%s'" % self.mode) d = BandPassFilterDialog(form.root, provider, **args) if d.resultYes(): def setFormValue(flag, value, index): if args.get(flag, True): if unit == UNIT_ANGSTROM: value = d.samplingRate / (value) form.setVar(label[index], value) setFormValue('showLowFreq', d.getLowFreq(), 0) setFormValue('showHighFreq', d.getHighFreq(), 1) setFormValue('showDecay', d.getFreqDecay(), 2) else: dialog.showWarning("Empty input", "Select elements first", form.root)
def show(self, form): protocol = form.protocol provider = self._getProvider(protocol) params = self._getParameters(protocol) if provider is not None: args = {'mode': params['mode'], 'lowFreq': params['value'][1], 'highFreq': params['value'][0], 'unit': UNIT_ANGSTROM } args['showDecay'] = False d = emwiz.BandPassFilterDialog(form.root, provider, **args) if d.resultYes(): form.setVar('lowPass', d.getHighFreq()) form.setVar('highPass', d.getLowFreq()) else: dialog.showWarning("Input micrographs", "Select micrographs first", form.root)
def show(self, form): protocol = form.protocol params = self._getParameters(protocol) _value = params['value'] _label = params['label'] # form.setParamFromVar('inputMicrographs') # update selected input micrographs provider = self._getProvider(protocol) if provider is not None: args = {'unit': UNIT_PIXEL, 'downsample': _value[0], 'lf': _value[1], 'hf': _value[2] } d = CtfDownsampleDialog(form.root, provider, **args) if d.resultYes(): form.setVar(_label[0], d.getDownsample()) form.setVar(_label[1], d.getLowFreq()) form.setVar(_label[2], d.getHighFreq()) else: dialog.showWarning("Empty input", "Select elements first", form.root)
def show(self, form): protocol = form.protocol params = self._getParameters(protocol) _value = params['value'] _label = params['label'] pix = params['pix'] provider = self._getProvider(protocol) if provider is not None: args = { 'unit': UNIT_ANGSTROM, 'lf': "%0.2f" % (pix / _value[0]), 'hf': "%0.2f" % (pix / _value[1]) } d = CtfDialog(form.root, provider, **args) if d.resultYes(): form.setVar(_label[0], "%0.2f" % (pix / d.getLowFreq())) form.setVar(_label[1], "%0.2f" % (pix / d.getHighFreq())) else: dialog.showWarning("Empty input", "Select elements first", form.root)
def show(self, form): params = self._getParameters(form.protocol) protocol = form.protocol provider = self._getProvider(protocol) if provider is not None: args = { 'mode': params['mode'], 'highFreq': params['value'], 'unit': UNIT_ANGSTROM } args['showLowFreq'] = False args['showDecay'] = False d = BandPassFilterDialog(form.root, provider, **args) if d.resultYes(): form.setVar('resolution', d.samplingRate / d.getHighFreq()) else: dialog.showWarning("Input volumes", "Select volumes first", form.root)