コード例 #1
0
ファイル: spike_remove.py プロジェクト: lazem/odemis
    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()
コード例 #2
0
ファイル: merge_RGB.py プロジェクト: effting/odemis
    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 = {}