def __init__(self, parent, browser, image_container, region_names): Module.__init__(self, parent, browser) self._imagecontainer = image_container self._image_dict = {} self._display_images = {} self._rgb_images = {} palettes = self.import_palettes() self.object_region_changed.connect(browser.on_object_region_changed) layout = QBoxLayout(QBoxLayout.TopToBottom, self) layout.setContentsMargins(5, 5, 5, 5) frame_channels = QGroupBox('Channels', self) layout_channels = QBoxLayout(QBoxLayout.TopToBottom, frame_channels) layout_channels.setContentsMargins(10, 12, 7, 10) frame_enhance = QGroupBox('Image Enhancement', self) layout_enhance = QBoxLayout(QBoxLayout.TopToBottom, frame_enhance) layout_enhance.setContentsMargins(5, 10, 5, 5) frame_objects = QGroupBox('Objects', self) layout_objects = QBoxLayout(QBoxLayout.TopToBottom, frame_objects) layout_objects.setContentsMargins(5, 10, 5, 5) frame_display = QGroupBox('Display', self) layout_display = QBoxLayout(QBoxLayout.TopToBottom, frame_display) layout_display.setContentsMargins(5, 10, 5, 5) layout.addSpacing(15) layout.addWidget(frame_channels) layout.addSpacing(7) layout.addWidget(frame_enhance) layout.addSpacing(7) layout.addWidget(frame_display) layout.addSpacing(7) layout.addWidget(frame_objects) layout.addStretch(1) self._channels = OrderedDict() channel_names = sorted(self._imagecontainer.channels) for idx, channel_name in enumerate(channel_names): widget = ChannelItem(channel_name, idx, palettes, self) layout_channels.addWidget(widget) self._channels[channel_name] = widget widget.channel_changed.connect(self.on_channel_changed) self._enhancement = EnhancementFrame(channel_names, frame_enhance) self._enhancement.values_changed.connect(self.on_display_changed) layout_enhance.addWidget(self._enhancement) display = ObjectsFrame(browser, region_names, frame_objects) self.browser.update_regions.connect(display.update_regionbox) display.object_region_changed.connect(self.on_object_region_changed) layout_objects.addWidget(display) display = DisplayFrame(browser, frame_display) layout_display.addWidget(display)
def __init__(self, parent, browser, image_container, region_names): Module.__init__(self, parent, browser) self._imagecontainer = image_container self._image_dict = {} self._display_images = {} self._rgb_images = {} palettes = self.import_palettes() self.object_region_changed.connect(browser.on_object_region_changed) layout = QBoxLayout(QBoxLayout.TopToBottom, self) layout.setContentsMargins(5, 5, 5, 5) frame_channels = QGroupBox("Channels", self) layout_channels = QBoxLayout(QBoxLayout.TopToBottom, frame_channels) layout_channels.setContentsMargins(10, 12, 7, 10) frame_enhance = QGroupBox("Image Enhancement", self) layout_enhance = QBoxLayout(QBoxLayout.TopToBottom, frame_enhance) layout_enhance.setContentsMargins(5, 10, 5, 5) frame_objects = QGroupBox("Objects", self) layout_objects = QBoxLayout(QBoxLayout.TopToBottom, frame_objects) layout_objects.setContentsMargins(5, 10, 5, 5) frame_display = QGroupBox("Display", self) layout_display = QBoxLayout(QBoxLayout.TopToBottom, frame_display) layout_display.setContentsMargins(5, 10, 5, 5) layout.addSpacing(15) layout.addWidget(frame_channels) layout.addSpacing(7) layout.addWidget(frame_enhance) layout.addSpacing(7) layout.addWidget(frame_display) layout.addSpacing(7) layout.addWidget(frame_objects) layout.addStretch(1) self._channels = OrderedDict() channel_names = sorted(self._imagecontainer.channels) for idx, channel_name in enumerate(channel_names): widget = ChannelItem(channel_name, idx, palettes, self) layout_channels.addWidget(widget) self._channels[channel_name] = widget widget.channel_changed.connect(self.on_channel_changed) self._enhancement = EnhancementFrame(channel_names, frame_enhance) self._enhancement.values_changed.connect(self.on_display_changed) layout_enhance.addWidget(self._enhancement) display = ObjectsFrame(browser, region_names, frame_objects) self.browser.update_regions.connect(display.update_regionbox) display.object_region_changed.connect(self.on_object_region_changed) layout_objects.addWidget(display) display = DisplayFrame(browser, frame_display) layout_display.addWidget(display)
def __init__(self, parent, browser, imagecontainer): Module.__init__(self, parent, browser) self._imagecontainer = imagecontainer frame_info = QGroupBox('Plate Information', self) layout = QGridLayout(frame_info) # frame_info.setStyleSheet('QLabel { font-size: 10px }') self._label_info = QLabel(frame_info) layout.addWidget(self._label_info, 0, 0, 0, 0, Qt.AlignCenter | Qt.AlignHCenter) splitter = QSplitter(Qt.Vertical, self) splitter.setMinimumWidth(40) layout = QBoxLayout(QBoxLayout.TopToBottom, self) layout.setContentsMargins(5, 5, 5, 5) layout.addWidget(splitter) grp1 = QGroupBox('Plates', splitter) grp2 = QGroupBox('Positions', splitter) splitter.addWidget(grp1) splitter.addWidget(grp2) layout = QGridLayout(grp1) layout.setContentsMargins(5, 10, 5, 5) table = QTableWidget(grp1) table.setEditTriggers(QTableWidget.NoEditTriggers) table.setSelectionMode(QTableWidget.SingleSelection) table.setSelectionBehavior(QTableWidget.SelectRows) table.setAlternatingRowColors(True) # table.setStyleSheet('font-size: 10px;') table.currentItemChanged.connect(self._on_plate_changed) self._table_plate = table layout.addWidget(table, 0, 0) self._update_plate_table() layout = QGridLayout(grp2) layout.setContentsMargins(5, 10, 5, 5) table = QTableWidget(grp2) table.setEditTriggers(QTableWidget.NoEditTriggers) table.setSelectionMode(QTableWidget.SingleSelection) table.setSelectionBehavior(QTableWidget.SelectRows) table.setAlternatingRowColors(True) # table.setStyleSheet('font-size: 10px;') table.currentItemChanged.connect(self._on_position_changed) self._table_position = table layout.addWidget(table, 0, 0) if self._imagecontainer.has_timelapse: grp3 = QGroupBox('Time', splitter) splitter.addWidget(grp3) layout = QGridLayout(grp3) layout.setContentsMargins(5, 10, 5, 5) table = QTableWidget(grp3) table.setEditTriggers(QTableWidget.NoEditTriggers) table.setSelectionMode(QTableWidget.SingleSelection) table.setSelectionBehavior(QTableWidget.SelectRows) table.setAlternatingRowColors(True) # table.setStyleSheet('font-size: 10px;') table.currentItemChanged.connect(self._on_time_changed) self._table_time = table layout.addWidget(table, 0, 0) splitter.addWidget(frame_info)
def __init__(self, parent, browser, settings, imagecontainer): Module.__init__(self, parent, browser) self._current_class = None self._detect_objects = False self._current_scene_items = set() self._settings = settings self._imagecontainer = imagecontainer self._annotations = Annotations() self._object_items = {} splitter = QSplitter(Qt.Vertical, self) grp_box = QGroupBox('Classes', splitter) layout = QBoxLayout(QBoxLayout.TopToBottom, grp_box) layout.setContentsMargins(5, 10, 5, 5) class_table = QTableWidget(grp_box) class_table.setEditTriggers(QTableWidget.NoEditTriggers) class_table.setSelectionMode(QTableWidget.SingleSelection) class_table.setSelectionBehavior(QTableWidget.SelectRows) #class_table.setSortingEnabled(True) class_table.setColumnCount(4) class_table.setHorizontalHeaderLabels(['Name', 'Label', 'Color', 'Samples', ]) class_table.resizeColumnsToContents() class_table.currentItemChanged.connect(self._on_class_changed) class_table.setStyleSheet('font-size: 10px;') layout.addWidget(class_table) self._class_table = class_table frame2 = QFrame(grp_box) layout2 = QBoxLayout(QBoxLayout.LeftToRight, frame2) layout2.setContentsMargins(0,0,0,0) self._import_class_definitions_btn = QPushButton('Import class definitions') layout2.addWidget(self._import_class_definitions_btn) self._import_class_definitions_btn.clicked.connect(self._on_import_class_definitions) layout.addWidget(frame2) frame2 = QFrame(grp_box) layout2 = QBoxLayout(QBoxLayout.LeftToRight, frame2) layout2.setContentsMargins(0,0,0,0) self._class_sbox = QSpinBox(frame2) self._class_color_btn = ColorButton(None, frame2) self._class_sbox.setRange(0, 1000) self._class_text = QLineEdit(frame2) layout2.addWidget(self._class_color_btn) layout2.addWidget(self._class_sbox) layout2.addWidget(self._class_text) layout.addWidget(frame2) frame2 = QFrame(grp_box) layout2 = QBoxLayout(QBoxLayout.LeftToRight, frame2) layout2.setContentsMargins(0,0,0,0) btn = QPushButton('Apply', frame2) btn.clicked.connect(self._on_class_apply) layout2.addWidget(btn) btn = QPushButton('Add', frame2) btn.clicked.connect(self._on_class_add) layout2.addWidget(btn) btn = QPushButton('Remove', frame2) btn.clicked.connect(self._on_class_remove) layout2.addWidget(btn) layout.addWidget(frame2) splitter.addWidget(grp_box) grp_box = QGroupBox('Annotations', splitter) layout = QBoxLayout(QBoxLayout.TopToBottom, grp_box) layout.setContentsMargins(5, 10, 5, 5) ann_table = QTableWidget(grp_box) ann_table.setEditTriggers(QTableWidget.NoEditTriggers) ann_table.setSelectionMode(QTableWidget.SingleSelection) ann_table.setSelectionBehavior(QTableWidget.SelectRows) #ann_table.setSortingEnabled(True) column_names = ['Position', 'Frame', 'Samples'] if self._imagecontainer.has_multiple_plates: column_names = ['Plate'] + column_names ann_table.setColumnCount(len(column_names)) ann_table.setHorizontalHeaderLabels(column_names) ann_table.resizeColumnsToContents() ann_table.currentItemChanged.connect(self._on_anntable_changed) ann_table.setStyleSheet('font-size: 10px;') layout.addWidget(ann_table) self._ann_table = ann_table splitter.addWidget(grp_box) frame = QFrame(grp_box) layout_frame = QBoxLayout(QBoxLayout.LeftToRight, frame) layout_frame.setContentsMargins(0, 0, 0, 0) btn = QPushButton('New', frame) btn.clicked.connect(self._on_new_classifier) layout_frame.addWidget(btn) #layout_frame.addSpacing(5) btn = QPushButton('Open', frame) btn.clicked.connect(self._on_open_classifier) layout_frame.addWidget(btn) btn = QPushButton('Save', frame) btn.clicked.connect(self._on_save_classifier) layout_frame.addWidget(btn) #layout_frame.addSpacing(5) btn = QPushButton('Save as', frame) btn.pressed.connect(self._on_saveas_classifier) layout_frame.addWidget(btn) layout.addWidget(frame) layout = QBoxLayout(QBoxLayout.TopToBottom, self) layout.setContentsMargins(5, 5, 5, 5) layout.addWidget(splitter) self._learner = self._init_new_classifier() self._action_grp = QActionGroup(browser) class_fct = lambda id: lambda : self._on_shortcut_class_selected(id) for x in range(1,11): action = browser.create_action( 'Select Class Label %d' % x, shortcut=QKeySequence(str(x) if x < 10 else '0'), slot=class_fct(x)) self._action_grp.addAction(action) browser.addAction(action) browser.coordinates_changed.connect(self._on_coordinates_changed) browser.show_objects_toggled.connect(self._on_show_objects) browser.show_contours_toggled.connect(self._on_show_contours_toggled)
def __init__(self, parent, browser, imagecontainer): Module.__init__(self, parent, browser) self._imagecontainer = imagecontainer frame_info = QGroupBox('Plate Information', self) layout = QGridLayout(frame_info) frame_info.setStyleSheet('QLabel { font-size: 10px }') self._label_info = QLabel(frame_info) layout.addWidget(self._label_info, 0, 0, 0, 0, Qt.AlignCenter | Qt.AlignHCenter) splitter = QSplitter(Qt.Vertical, self) splitter.setMinimumWidth(40) layout = QBoxLayout(QBoxLayout.TopToBottom, self) layout.setContentsMargins(5, 5, 5, 5) layout.addWidget(splitter) grp1 = QGroupBox('Plates', splitter) grp2 = QGroupBox('Positions', splitter) splitter.addWidget(grp1) splitter.addWidget(grp2) layout = QGridLayout(grp1) layout.setContentsMargins(5, 10, 5, 5) table = QTableWidget(grp1) table.setEditTriggers(QTableWidget.NoEditTriggers) table.setSelectionMode(QTableWidget.SingleSelection) table.setSelectionBehavior(QTableWidget.SelectRows) table.setAlternatingRowColors(True) table.setStyleSheet('font-size: 10px;') table.currentItemChanged.connect(self._on_plate_changed) self._table_plate = table layout.addWidget(table, 0, 0) self._update_plate_table() layout = QGridLayout(grp2) layout.setContentsMargins(5, 10, 5, 5) table = QTableWidget(grp2) table.setEditTriggers(QTableWidget.NoEditTriggers) table.setSelectionMode(QTableWidget.SingleSelection) table.setSelectionBehavior(QTableWidget.SelectRows) table.setAlternatingRowColors(True) table.setStyleSheet('font-size: 10px;') table.currentItemChanged.connect(self._on_position_changed) self._table_position = table layout.addWidget(table, 0, 0) if self._imagecontainer.has_timelapse: grp3 = QGroupBox('Time', splitter) splitter.addWidget(grp3) layout = QGridLayout(grp3) layout.setContentsMargins(5, 10, 5, 5) table = QTableWidget(grp3) table.setEditTriggers(QTableWidget.NoEditTriggers) table.setSelectionMode(QTableWidget.SingleSelection) table.setSelectionBehavior(QTableWidget.SelectRows) table.setAlternatingRowColors(True) table.setStyleSheet('font-size: 10px;') table.currentItemChanged.connect(self._on_time_changed) self._table_time = table layout.addWidget(table, 0, 0) splitter.addWidget(frame_info)