def start(self): # Check the acquisition tab is open, and a CL-intensity stream is available ct = self.main_app.main_data.tab.value cls = self._get_cl_intensity() if ct.name != "sparc_acqui" or not cls: logging.info("Failed to start RGB CL intensity stream") dlg = wx.MessageDialog( self.main_app.main_frame, "No CL-intensity stream is currently open.\n" "You need to open a CL intensity stream " "and set the acquisition parameters.\n", caption="RGB CL intensity", style=wx.OK | wx.ICON_WARNING) dlg.ShowModal() dlg.Destroy() return self._pause_streams() # immediately switch optical path, to save time self.main_app.main_data.opm.setPath(cls) # non-blocking # Get survey stream too self._survey_s = self._get_sem_survey() self._cl_int_s = cls self._update_exp_dur() # Create a window dlg = AcquisitionDialog( self, "RGB CL intensity acquisition", "Acquires a RGB CL-intensity image\n" "Specify the relevant settings and start the acquisition\n") self.filename.value = self._get_new_filename() dlg.addSettings(self, conf=self.vaconf) dlg.addButton("Close") dlg.addButton("Acquire", self.acquire, face_colour='blue') # Show the window, and wait until the acquisition is over ans = dlg.ShowModal() # The window is closed if ans == 0: logging.debug("RGB CL intensity acquisition cancelled") elif ans == 1: logging.debug("RGB CL intensity acquisition completed") else: logging.warning("Unknown return code %d", ans) # Make sure we don't hold reference to the streams forever self._survey_s = None self._cl_int_s = None dlg.Destroy()
def start(self): if self.main_app.main_data.tab.value.name != "sparc_acqui": box = wx.MessageDialog( self.main_app.main_frame, "AR spectral acquisition must be done from the acquisition tab.", "AR spectral acquisition not possible", wx.OK | wx.ICON_STOP) box.ShowModal() box.Destroy() return # get region and dwelltime for drift correction self._ARspectral_s.dcRegion.value = self._tab_data.driftCorrector.roi.value self._ARspectral_s.dcDwellTime.value = self._tab_data.driftCorrector.dwellTime.value # Update the grating position to its current position self.grating.value = self.sgrh.position.value["grating"] # get survey self._survey_s = self._get_sem_survey() # For ROI: roi = self._tab_data.semStream.roi.value if roi == UNDEFINED_ROI: roi = (0, 0, 1, 1) self.roi.value = roi logging.debug("ROA = %s", self.roi.value) self._update_exp_dur() self._update_res() self._update_cam_res() # Create a window dlg = AcquisitionDialog( self, "AR Spectral acquisition", "Acquires a hyperspectral AR CL image\n" "Specify the relevant settings and start the acquisition\n") self.filename.value = self._get_new_filename() dlg.addSettings(self, conf=self.vaconf) dlg.addButton("Close") dlg.addButton("Acquire", self.acquire, face_colour='blue') # Show the window, and wait until the acquisition is over ans = dlg.ShowModal() # The window is closed if ans == 0: logging.info("AR spectral acquisition cancelled") elif ans == 1: logging.info("AR spectral acquisition completed") else: logging.debug("Unknown return code %d", ans) dlg.Destroy()
def start(self): # Error message if not in acquisition tab + spot mode ct = self.main_app.main_data.tab.value if (ct.name != "sparc_acqui" or ct.tab_data_model.tool.value != TOOL_SPOT or None in ct.tab_data_model.spotPosition.value): logging.info( "Failed to start monochromator scan as no spot is selected") dlg = wx.MessageDialog( self.main_app.main_frame, "No spot is currently selected.\n" "You need to select the point where the spectrum will be " "acquired with monochromator scan.\n", caption="Monochromator scan", style=wx.OK | wx.ICON_WARNING) dlg.ShowModal() dlg.Destroy() return self._survey_s = self._get_sem_survey() self._update_exp_dur() # Create a window dlg = AcquisitionDialog( self, "Monochromator scan acquisition", "Acquires a spectrum using the monochomator while scanning over " "multiple wavelengths.\n\n" "Specify the settings and start the acquisition.") self.filename.value = self._get_new_filename() dlg.addSettings(self, conf=self.vaconf) dlg.addButton("Close") dlg.addButton("Acquire", self.acquire, face_colour='blue') # Show the window, and wait until the acquisition is over ans = dlg.ShowModal() # Save the current folder conf = get_acqui_conf() conf.last_path = os.path.dirname(self.filename.value) # The window is closed if ans == 0: logging.info("Monochromator scan acquisition cancelled") elif ans == 1: logging.info("Monochromator scan acquisition completed") else: logging.debug("Unknown return code %d", ans) dlg.Destroy()
def start(self): """ Called when the menu entry is selected """ dlg = AcquisitionDialog(self, "SECOM user simulator", "Simulates typical actions of a SECOM user.") dlg.addButton("FM search", self._sim_fluo_search, face_colour='blue') dlg.addButton("Stop", self._stop_sim) dlg.ShowModal() # Blocks until the user closes the window # make sure the simulation is stopped self._should_stop.set() if dlg: # If dlg hasn't been destroyed yet dlg.Destroy()
def start(self): dlg = AcquisitionDialog(self, "Remove spikes from CL data", text="Change the threshold value to determine the sensitivity of the spike removal") self._dlg = dlg self.tab_data = self.main_app.main_data.tab.value.tab_data_model # don't allow adding/removing streams dlg.streambar_controller.to_static_mode() for stream in self.tab_data.streams.value: #there must be a better way to do this if isinstance(stream, SpectrumStream): # Check the stream is really _spectrum_ data, CTYX or TYX are not supported raw_shape = stream.raw[0].shape # CTZYX if numpy.prod(raw_shape[1:3]) > 1: # T * Z logging.info("Skipping stream %s of shape %s, as it not a simple spectral stream", stream.name, raw_shape) continue dlg.addStream(stream) self._spec_stream = stream break # Only one stream handled else: # if no spectral data is present spike removal cannot be done (for now) box = wx.MessageDialog(self.main_app.main_frame, "No spectral stream is present, so it's not possible to correct the data", "No spectral stream", wx.OK | wx.ICON_STOP) box.ShowModal() box.Destroy() return wx.CallAfter(dlg.viewport_l.canvas.fit_view_to_content) # async, to call after the stream is added dlg.addSettings(self, conf=self.vaconf) # TODO: add a 'reset' button dlg.addButton("Close") dlg.addButton("Correct", self.correct_data, face_colour='red') dlg.addButton("Save", self.save, face_colour='blue') self._update_save_button() # It'll be called _after_ the button is added dlg.Size = (1000, 600) # Make it big enough to fit the view and the stream panel dlg.ShowModal() # The end self._spec_stream = None # drop reference dlg.Close() self._dlg = None if dlg: # If dlg hasn't been destroyed yet dlg.Destroy()
def start(self): """ Called when the menu entry is selected """ main_data = self.main_app.main_data # Stop the streams tab_data = main_data.tab.value.tab_data_model for s in tab_data.streams.value: s.should_update.value = False self.filename.value = self._get_new_filename() self._update_exp_dur() # Special CCD settings to get values as photon counting if model.hasVA(self.ccd, "countConvert"): self.ccd.countConvert.value = 2 # photons dlg = AcquisitionDialog( self, "Super-resolution acquisition", "Acquires a series of shortly exposed images, " "and store them in sequence.\n" "Note, the advanced settings are only applied " "after restarting the stream.") dlg.addStream(self._stream) dlg.addSettings(self, self.vaconf) dlg.addButton("Close") dlg.addButton("Acquire", self.acquire, face_colour='blue') dlg.Maximize() ans = dlg.ShowModal() # Make sure the stream is not playing anymore and CCD is back to normal self._stream.should_update.value = False if model.hasVA(self.ccd, "countConvert"): try: self.ccd.countConvert.value = 0 # normal except Exception: logging.exception("Failed to set back count convert mode") if ans == 0: logging.info("Acquisition cancelled") elif ans == 1: logging.info("Acquisition completed") else: logging.warning("Got unknown return code %s", ans) dlg.Destroy()
def start(self): # get region and dwelltime for drift correction self._correlator_s.dcRegion.value = self._acqui_tab.driftCorrector.roi.value self._correlator_s.dcDwellTime.value = self._acqui_tab.driftCorrector.dwellTime.value # get survey self._survey_s = self._get_sem_survey() # For ROI: roi = self._acqui_tab.semStream.roi.value if roi == UNDEFINED_ROI: roi = (0, 0, 1, 1) self.roi.value = roi logging.debug("ROA = %s", self.roi.value) self._update_exp_dur() self._update_res() # Create a window dlg = AcquisitionDialog( self, "Time correlator acquisition", "Acquires a scan using the time correlator\n" "Specify the relevant settings and start the acquisition\n") self.filename.value = self._get_new_filename() dlg.addSettings(self, conf=self.vaconf) dlg.addButton("Close") dlg.addButton("Acquire", self.acquire, face_colour='blue') # Show the window, and wait until the acquisition is over ans = dlg.ShowModal() # The window is closed if ans == 0: logging.info("Correlator acquisition cancelled") elif ans == 1: logging.info("Correlator acquisition completed") else: logging.debug("Unknown return code %d", ans) dlg.Destroy()
def start(self): self.filename.value = self._get_new_filename() self._update_stepsize() dlg = AcquisitionDialog( self, "CL acquisition", "Acquires a CCD image for each e-beam spot.\n") dlg.addSettings(self, self.vaconf) # dlg.addStream(self._get_sem_survey) # TODO: add survey + ROI selection tool dlg.addButton("Cancel") dlg.addButton("Acquire", self._acquire, face_colour='blue') ans = dlg.ShowModal() if ans == 0: logging.info("Acquisition cancelled") elif ans == 1: logging.info("Acquisition completed") else: logging.warning("Got unknown return code %s", ans) dlg.Destroy()
def start(self): """ Called when the menu entry is selected """ main_data = self.main_app.main_data # Stop the streams tab_data = main_data.tab.value.tab_data_model for s in tab_data.streams.value: s.should_update.value = False self.filename.value = self._get_new_filename() self.dwellTime.value = main_data.ebeam.dwellTime.value self._update_exp_dur() if main_data.cld: # If the cl-detector is present => configure the optical path (just to speed-up) main_data.opm.setPath("cli") dlg = AcquisitionDialog( self, "Averaged acquisition", "Acquires the SEM and CL intensity streams multiple times, \n" "as defined by the 'accumulations' setting, \n" "and store the average value.") dlg.addSettings(self, self.vaconf) dlg.addButton("Close") dlg.addButton("Acquire", self.acquire, face_colour='blue') ans = dlg.ShowModal() if ans == 0: logging.info("Acquisition cancelled") elif ans == 1: logging.info("Acquisition completed") else: logging.warning("Got unknown return code %s", ans) dlg.Destroy()
def start(self): dlg = AcquisitionDialog( self, "Merging channels to RGB image", text="Insert 3 R, G, B files so that they are assigned the tints \n" "and are merged to an RGB image.") # remove the play overlay from the viewport dlg.viewport_l.canvas.remove_view_overlay( dlg.viewport_l.canvas.play_overlay) self._dlg = dlg dlg.addStream(None) dlg.Size = (1000, 600) dlg.addSettings(self, self.vaconf) dlg.addButton("Cancel", None) dlg.addButton("Add", self._updateViewer, face_colour='blue') dlg.pnl_gauge.Hide() dlg.ShowModal() # Blocks until the window is closed # Destroy the dialog and reset the VAs and subscribers dlg.Destroy() self.filenameR.value = " " self.filenameG.value = " " self.filenameB.value = " " self.redShiftX.value = 0 self.redShiftY.value = 0 self.greenShiftX.value = 0 self.greenShiftY.value = 0 self.blueShiftX.value = 0 self.blueShiftY.value = 0 self.cropBottom.value = 0 self._subscribers = [] self._dlg = None self._raw_orig = {}
def start(self): # Fail if the live tab is not selected tab = self.main_app.main_data.tab.value if tab.name not in ("secom_live", "sparc_acqui"): box = wx.MessageDialog( self.main_app.main_frame, "Timelapse acquisition must be done from the acquisition stream.", "Timelapse acquisition not possible", wx.OK | wx.ICON_STOP) box.ShowModal() box.Destroy() return # On SPARC, fail if no ROI selected try: if tab.tab_data_model.semStream.roi.value == UNDEFINED_ROI: box = wx.MessageDialog( self.main_app.main_frame, "You need to select a region of acquisition.", "Timelapse acquisition not possible", wx.OK | wx.ICON_STOP) box.ShowModal() box.Destroy() return except AttributeError: pass # Not a SPARC # Stop the stream(s) playing to not interfere with the acquisition tab.streambar_controller.pauseStreams() self.filename.value = self._get_new_filename() dlg = AcquisitionDialog( self, "Timelapse acquisition", "The same streams will be acquired multiple times, defined by the 'number of acquisitions'.\n" "The time separating each acquisition is defined by the 'period'.\n" ) self._dlg = dlg dlg.addSettings(self, self.vaconf) ss = self._get_live_streams(tab.tab_data_model) for s in ss: if isinstance( s, (ARStream, SpectrumStream, MonochromatorSettingsStream)): # TODO: instead of hard-coding the list, a way to detect the type # of live image? logging.info( "Not showing stream %s, for which the live image is not spatial", s) dlg.addStream(s, index=None) else: dlg.addStream(s) dlg.addButton("Cancel") dlg.addButton("Acquire", self.acquire, face_colour='blue') # Force to re-check the minimum period time self.period.value = self.period.value # Update acq time when streams are added/removed dlg.view.stream_tree.flat.subscribe(self._update_exp_dur, init=True) dlg.hidden_view.stream_tree.flat.subscribe(self._update_exp_dur, init=True) # TODO: update the acquisition time whenever a setting changes # TODO: disable "acquire" button if no stream selected # TODO: also display the repetition and axis settings for the SPARC streams. ans = dlg.ShowModal() if ans == 0: logging.info("Acquisition cancelled") elif ans == 1: logging.info("Acquisition completed") else: logging.warning("Got unknown return code %s", ans) dlg.view.stream_tree.flat.unsubscribe(self._update_exp_dur) dlg.Destroy()
def start(self): """ Displays the plugin window. """ self._update_filename() str_ctrl = self.main_app.main_data.tab.value.streambar_controller str_ctrl.pauseStreams() dlg = AcquisitionDialog( self, "CL acquisition", "Acquires a CCD image for each e-beam spot.\n") self._dlg = dlg self._survey_stream = self._get_sem_survey() dlg.SetSize((1500, 1000)) # Hack to force the canvas to have a region of acquisition (ROA) and anchor region (drift) overlay. dlg._dmodel.tool.choices = { TOOL_NONE, TOOL_ROA, TOOL_RO_ANCHOR, } dlg._dmodel.roa = self._secom_cl_stream.roi # region of acquisition selected (x_tl, y_tl, x_br, y_br) dlg._dmodel.fovComp = self.main_data.ebeam # size (x, y) of sem image for given magnification dlg._dmodel.driftCorrector = self._driftCorrector dlg.viewport_l.canvas.view = None dlg.viewport_l.canvas.setView(dlg.view, dlg._dmodel) dlg.viewport_r.canvas.allowed_modes = {} dlg.viewport_r.canvas.view = None dlg.viewport_r.canvas.setView(dlg.view_r, dlg._dmodel) self.repetition = self._secom_cl_stream.repetition # ebeam positions to acquire self.repetition.subscribe(self._on_rep, init=True) self.pixelSize = self._secom_cl_stream.pixelSize # pixel size per ebeam pos self.roi_margin = self._secom_cl_stream.roi_margin self.period = self._driftCorrector.period # time between to drift corrections self.tool = dlg._dmodel.tool # tools to select ROA and anchor region for drift correction self._driftCorrector.roi.subscribe(self._on_dc_roi, init=True) # subscribe to update estimated acquisition time self.repetition.subscribe(self._update_exp_dur, init=True) self.period.subscribe(self._update_exp_dur) self._driftCorrector.roi.subscribe(self._update_exp_dur) dlg.addSettings(self, self.vaconf) dlg.addStream(self._survey_stream) dlg.addStream(self._optical_stream) dlg.addButton("Cancel") dlg.addButton("Acquire", self._acquire, face_colour='blue') ans = dlg.ShowModal() if ans == 0: logging.info("Acquisition cancelled") elif ans == 1: logging.info("Acquisition completed") else: logging.warning("Got unknown return code %s", ans) self._dlg = None self._survey_stream = None dlg.Destroy()
def start(self): # Fail if the live tab is not selected tab = self.main_app.main_data.tab.value if tab.name not in ("secom_live", "sparc_acqui", "cryosecom-localization"): box = wx.MessageDialog(self.main_app.main_frame, "ZStack acquisition must be done from the acquisition stream.", "ZStack acquisition not possible", wx.OK | wx.ICON_STOP) box.ShowModal() box.Destroy() return # On SPARC, fail if no ROI selected if hasattr(tab.tab_data_model, "roa") and tab.tab_data_model.roa.value == UNDEFINED_ROI: box = wx.MessageDialog(self.main_app.main_frame, "You need to select a region of acquisition.", "Z stack acquisition not possible", wx.OK | wx.ICON_STOP) box.ShowModal() box.Destroy() return # Stop the stream(s) playing to not interfere with the acquisition tab.streambar_controller.pauseStreams() self.filename.value = self._get_new_filename() dlg = AcquisitionDialog(self, "Z Stack acquisition", "The same streams will be acquired multiple times at different Z positions, defined starting from Z start, with a step size.\n") self._dlg = dlg dlg.addSettings(self, self.vaconf) ss = self._get_live_streams(tab.tab_data_model) for s in ss: if isinstance(s, (ARStream, SpectrumStream, MonochromatorSettingsStream)): # TODO: instead of hard-coding the list, a way to detect the type # of live image? logging.info("Not showing stream %s, for which the live image is not spatial", s) dlg.addStream(s, index=None) else: dlg.addStream(s) dlg.addButton("Cancel") dlg.addButton("Acquire", self.acquire, face_colour='blue') # Connect zstart with the actual focus position self.zstart.subscribe(self._on_zstart) self.focus.position.subscribe(self._on_focus_pos, init=True) # Update acq time when streams are added/removed dlg.view.stream_tree.flat.subscribe(self._update_exp_dur, init=True) dlg.hidden_view.stream_tree.flat.subscribe(self._update_exp_dur, init=True) # TODO: update the acquisition time whenever a setting changes # TODO: disable "acquire" button if no stream selected # TODO: also display the repetition and axis settings for the SPARC streams. ans = dlg.ShowModal() if ans == 0: logging.info("Acquisition cancelled") elif ans == 1: logging.info("Acquisition completed") else: logging.warning("Got unknown return code %s", ans) self.focus.position.unsubscribe(self._on_focus_pos) self.zstart.unsubscribe(self._on_zstart) # Don't hold references self._acq_streams = None if dlg: # If dlg hasn't been destroyed yet dlg.Destroy()
def show_dlg(self): # TODO: if there is a chamber, only allow if there is vacuum # Fail if the live tab is not selected self._tab = self.main_app.main_data.tab.value if self._tab.name not in ("secom_live", "sparc_acqui"): box = wx.MessageDialog( self.main_app.main_frame, "Tiled acquisition must be done from the acquisition tab.", "Tiled acquisition not possible", wx.OK | wx.ICON_STOP) box.ShowModal() box.Destroy() return self._tab.streambar_controller.pauseStreams() # If no ROI is selected, select entire area try: if self._tab.tab_data_model.semStream.roi.value == UNDEFINED_ROI: self._tab.tab_data_model.semStream.roi.value = (0, 0, 1, 1) except AttributeError: pass # Not a SPARC # Disable drift correction (on SPARC) if hasattr(self._tab.tab_data_model, "driftCorrector"): self._tab.tab_data_model.driftCorrector.roi.value = UNDEFINED_ROI ss = self._get_live_streams() self.filename.value = self._get_new_filename() dlg = AcquisitionDialog( self, "Tiled acquisition", "Acquire a large area by acquiring the streams multiple " "times over a grid.") self._dlg = dlg # don't allow adding/removing streams self._dlg.streambar_controller.to_static_mode() dlg.addSettings(self, self.vaconf) for s in ss: if isinstance( s, (ARStream, SpectrumStream, MonochromatorSettingsStream)): # TODO: instead of hard-coding the list, a way to detect the type # of live image? logging.info( "Not showing stream %s, for which the live image is not spatial", s) dlg.addStream(s, index=None) else: dlg.addStream(s, index=0) dlg.addButton("Cancel") dlg.addButton("Acquire", self.acquire, face_colour='blue') # Update acq time and area when streams are added/removed. Add stream settings # to subscribed vas. dlg.view.stream_tree.flat.subscribe(self._update_exp_dur, init=True) dlg.view.stream_tree.flat.subscribe(self._update_total_area, init=True) dlg.view.stream_tree.flat.subscribe(self._on_streams_change, init=True) # Default fineAlign to True if it's possible # Use live streams to make the decision since visible streams might not be initialized yet # TODO: the visibility of the streams seems to be reset when the plugin is started, # a stream that is invisible in the main panel becomes visible. This should be fixed. if self._can_fine_align(ss): self.fineAlign.value = True self._ovrl_stream = self._create_overlay_stream(ss) # This looks tautologic, but actually, it forces the setter to check the # value is within range, and will automatically reduce it if necessary. self.nx.value = self.nx.value self.ny.value = self.ny.value self._memory_check() # TODO: disable "acquire" button if no stream selected. ans = dlg.ShowModal() if ans == 0 or ans == wx.ID_CANCEL: logging.info("Tiled acquisition cancelled") self.ft.cancel() elif ans == 1: logging.info("Tiled acquisition completed") else: logging.warning("Got unknown return code %s", ans) # Don't hold references self._unsubscribe_vas() dlg.Destroy() self._dlg = None
def start(self): dlg = AcquisitionDialog( self, "Manually change the alignment", text="Change the translation, rotation, and pixel size " "of any stream. The display is immediately updated, " "but you need to save the file (as a snapshot) for " "the changes to be permanent.") self._dlg = dlg vah = VAHolder() vah._subscribers = [] vaconf = OrderedDict() tab_data = self.main_app.main_data.tab.value.tab_data_model if not tab_data.streams.value: box = wx.MessageDialog( self.main_app.main_frame, "No stream is present, so it's not possible to modify the alignment.", "No stream", wx.OK | wx.ICON_STOP) box.ShowModal() box.Destroy() return for i, stream in enumerate(tab_data.streams.value): dlg.addStream(stream) # Add 5 VAs for each stream, to modify the overlay metadata poscor = stream.raw[0].metadata.get(model.MD_POS_COR, (0, 0)) rotation = stream.raw[0].metadata.get(model.MD_ROTATION_COR, 0) scalecor = stream.raw[0].metadata.get(model.MD_PIXEL_SIZE_COR, (1, 1)) shear = stream.raw[0].metadata.get(model.MD_SHEAR_COR, 0) vatransx = model.FloatContinuous(-poscor[0], range=(-10e-6, 10e-6), unit="m") vatransy = model.FloatContinuous(-poscor[1], range=(-10e-6, 10e-6), unit="m") varot = model.FloatContinuous(rotation, range=(-math.pi, math.pi), unit="rad") vascalex = model.FloatContinuous(scalecor[0], range=(0.5, 1.5)) vascaley = model.FloatContinuous(scalecor[1], range=(0.5, 1.5)) vashear = model.FloatContinuous(shear, range=(-1, 1)) # Add the VAs to the holder, and to the vaconf mainly to force the order setattr(vah, "%dTransX" % i, vatransx) setattr(vah, "%dTransY" % i, vatransy) setattr(vah, "%dRotation" % i, varot) setattr(vah, "%dScaleX" % i, vascalex) setattr(vah, "%dScaleY" % i, vascaley) setattr(vah, "%dShear" % i, vashear) vaconf["%dTransX" % i] = { "label": "%s trans X" % stream.name.value } vaconf["%dTransY" % i] = { "label": "%s trans Y" % stream.name.value } vaconf["%dRotation" % i] = { "label": "%s rotation" % stream.name.value } vaconf["%dScaleX" % i] = { "label": "%s scale X" % stream.name.value } vaconf["%dScaleY" % i] = { "label": "%s scale Y" % stream.name.value } vaconf["%dShear" % i] = {"label": "%s shear" % stream.name.value} # Create listeners with information of the stream and dimension va_on_transx = functools.partial(self._on_trans, stream, 0) va_on_transy = functools.partial(self._on_trans, stream, 1) va_on_rotation = functools.partial(self._on_rotation, stream) va_on_scalex = functools.partial(self._on_scale, stream, 0) va_on_scaley = functools.partial(self._on_scale, stream, 1) va_on_shear = functools.partial(self._on_shear, stream) # We hold a reference to the listeners to prevent automatic subscription vah._subscribers.append(va_on_transx) vah._subscribers.append(va_on_transy) vah._subscribers.append(va_on_rotation) vah._subscribers.append(va_on_scalex) vah._subscribers.append(va_on_scaley) vah._subscribers.append(va_on_shear) vatransx.subscribe(va_on_transx) vatransy.subscribe(va_on_transy) varot.subscribe(va_on_rotation) vascalex.subscribe(va_on_scalex) vascaley.subscribe(va_on_scaley) vashear.subscribe(va_on_shear) dlg.addSettings(vah, vaconf) # TODO: add a 'reset' button dlg.addButton("Done", None, face_colour='blue') dlg.ShowModal() # The end dlg.Destroy() vah._subscribers = [] self._dlg = None
def start(self): # Check the acquisition tab is open, and a CL-intensity stream is available ct = self.main_app.main_data.tab.value if ct.name == "sparc_acqui": cls = self._get_cl_intensity() else: cls = None if not cls: logging.info("Failed to start RGB CL intensity stream") dlg = wx.MessageDialog(self.main_app.main_frame, "No CL-intensity stream is currently open.\n" "You need to open a CL intensity stream " "and set the acquisition parameters.\n", caption="RGB CL intensity", style=wx.OK | wx.ICON_WARNING) dlg.ShowModal() dlg.Destroy() return # Normally, since Odemis v3.1, all CLSettingsStreams on systems with a cl-filter # have a "local axis" as a VA "axisFilter". assert any(hasattr(s, "axisFilter") for s in cls.streams) self._pause_streams() self._read_config() # Restore filter values from the config file # immediately switch optical path, to save time self.main_app.main_data.opm.setPath(cls) # non-blocking # Get survey stream too self._survey_s = self._get_sem_survey() self._cl_int_s = cls self._update_exp_dur() # Create a window dlg = AcquisitionDialog(self, "RGB CL intensity acquisition", "Acquires a RGB CL-intensity image\n" "Specify the relevant settings and start the acquisition\n" ) self.filename.value = self._get_new_filename() dlg.addSettings(self, conf=self.vaconf) dlg.addButton("Close") dlg.addButton("Acquire", self.acquire, face_colour='blue') # Show the window, and wait until the acquisition is over ans = dlg.ShowModal() # The window is closed if ans == 0: logging.debug("RGB CL intensity acquisition cancelled") elif ans == 1: logging.debug("RGB CL intensity acquisition completed") else: logging.warning("Unknown return code %d", ans) self._write_config() # Store the filter values to restore them on next time # Make sure we don't hold reference to the streams forever self._survey_s = None self._cl_int_s = None dlg.Destroy()