Exemple #1
0
	def apply(self):
		self._overedge['size'].set(self.ove_szSpinbox.get())
		self._overedge['ecolor'].set(self.ove_ecCombobox.get())
		self._overedge['fcolor'].set(self.ove_fcCombobox.get())
		self._overskel['size'].set(self.ovs_szSpinbox.get())
		self._overskel['ecolor'].set(self.ovs_ecCombobox.get())
		self._overskel['fcolor'].set(self.ovs_fcCombobox.get())
		self._overlabel['size'].set(self.ovl_szSpinbox.get())
		self._overlabel['ecolor'].set(self.ovl_ecCombobox.get())
		self._overfit['lwidth'].set(self.ovf_lwSpinbox.get())
		self._overfit['color'].set(self.ovf_lcCombobox.get())

		MainDisplay.show_overlay(self)
		try: ROIdisplay.show_roi(self)
		except AttributeError: pass
		ImageOverlay.setstate_cpanel(self)
Exemple #2
0
	def keepdelsel_roi(self, keep):

		if keep == 0:
			ROImanager.deldata_inroi(self)
			list_del = self.roiListbox.curselection()
		elif keep == 1:
			ROImanager.keepdata_inroi(self)
			list_del = [item for item in np.arange(self.roiListbox.size())
						if item not in self.roiListbox.curselection()]

		ROIdisplay.noshow_roi(self)

		for item in sorted(list_del, reverse=True):
			del self._roipath[item]
			del self._roilabel[item]

		for n, item in enumerate(self._roilabel):
			item.set_text(str(n+1))

		MainDisplay.show_overlay(self)

		ROIdisplay.show_roi(self)
		ROImanager.update_roiList(self)
Exemple #3
0
	def create_window(self):

		try: self.rt_Window.destroy()
		except AttributeError: pass

		self.rt_Window = tk.Toplevel(self)
		self.rt_Window.title('ROI Manager Tracking')
		#self.rt_Window.geometry('240x350-80+50')
		self.rt_Window.resizable(0,1)
		self.rt_Window.protocol('WM_DELETE_WINDOW',
								lambda: ROImanager.close(self))

		self.rt_Window.columnconfigure(0, weight = 1)
		self.rt_Window.rowconfigure(1, weight = 1)

		self.rt_drawFrame = ttk.Frame(self.rt_Window)
		self.roicircleButton = ttk.Button(self.rt_drawFrame,
										text = 'Circle',
										style = 'SunkableButton.TButton',
										command = lambda: ROImanager.draw_circle(self))
		self.roirectButton = ttk.Button(self.rt_drawFrame,
										text = 'Rectangle',
										style = 'SunkableButton.TButton',
										command = lambda: ROImanager.draw_rectangle(self))
		self.roipolyButton = ttk.Button(self.rt_drawFrame,
										text = 'Polygon')

		self.rt_middleFrame = ttk.Frame(self.rt_Window)
		self.rt_middleFrame.rowconfigure(0, weight = 1)
		self.rt_middleFrame.columnconfigure([0,1], weight = 1)
		self.roilistFrame = ttk.LabelFrame(self.rt_middleFrame,
									text = 'ROIs')
		self.roilistFrame.rowconfigure(0, weight = 1)

		self.roiListbox = tk.Listbox(self.roilistFrame,
									width = 15, selectmode = 'extended')
		self.roiListbox.bind('<<ListboxSelect>>',
										lambda event, arg = self:
													ROIdisplay.draw_selec(self, event))
		self.roilistScrollbar = ttk.Scrollbar(self.roilistFrame)
		self.roilistScrollbar.config(command = self.roiListbox.yview)
		self.roiListbox.config(yscrollcommand = self.roilistScrollbar.set)

		self.rt_manageFrame = ttk.Frame(self.rt_middleFrame)
		self.roiselectallButton = ttk.Button(self.rt_manageFrame,
											text = 'Select All',
											command = lambda: ROImanager.selectall_roiList(self))
		self.roiclearallButton = ttk.Button(self.rt_manageFrame,
											text = 'Clear All',
											command = lambda: ROImanager.clearall_roiList(self))
		self.roideleteallButton = ttk.Button(self.rt_manageFrame,
											text = 'Delete All',
											command = lambda: ROImanager.keepdelall_roi(self, 0))
		self.roikeepallButton = ttk.Button(self.rt_manageFrame,
											text = 'Keep All',
											command = lambda: ROImanager.keepdelall_roi(self, 1))
		self.roideleteselecButton = ttk.Button(self.rt_manageFrame,
											text = 'Delete Selection',
											command = lambda: ROImanager.keepdelsel_roi(self, 0))
		self.roikeepselecButton = ttk.Button(self.rt_manageFrame,
											text = 'Keep Selection',
											command = lambda: ROImanager.keepdelsel_roi(self,1))

		self.rt_bottomFrame = ttk.Frame(self.rt_Window)
		self.rt_bottomFrame.columnconfigure([0,1], weight = 1)
		self.roioptionsButton = ttk.Button(self.rt_bottomFrame,
										text = 'Options',
										command = lambda: ROImanager.create_options(self))
		self.roicloseButton = ttk.Button(self.rt_bottomFrame,
										text = 'Close',
										command = lambda: ROImanager.close(self))


		self.rt_drawFrame.grid(row = 0, column = 0,
										sticky = 'nsew')
		self.roicircleButton.grid(row = 0, column = 0,
										sticky = 'nsew', padx = 2, pady = 10)
		self.roirectButton.grid(row = 0, column = 1,
										sticky = 'nsew', padx = 2, pady = 10)
		self.roipolyButton.grid(row = 0, column = 2,
										sticky = 'nsew', padx = 2, pady = 10)

		self.rt_middleFrame.grid(row = 1, column = 0, sticky = 'nsew')

		self.roilistFrame.grid(row = 0, column = 0,
									sticky = 'ns')
		self.roiListbox.grid(row = 0, column = 0, sticky = 'ns')
		self.roilistScrollbar.grid(row = 0, column = 1, sticky = 'ns')

		self.rt_manageFrame.grid(row = 0, column = 1,
										sticky = 'nsew')
		self.roiselectallButton.grid(row = 0, column = 0, sticky = 'nsew',
										pady = 2, padx = 2)
		self.roiclearallButton.grid(row = 1, column = 0, sticky = 'nsew',
										pady = 2, padx = 2)
		self.roideleteallButton.grid(row = 2, column = 0, sticky = 'nsew',
										pady = 2, padx = 2)
		self.roikeepallButton.grid(row = 3, column = 0, sticky = 'nsew',
										pady = 2, padx = 2)
		self.roideleteselecButton.grid(row = 4, column = 0, sticky = 'nsew',
										pady = 2, padx = 2)
		self.roikeepselecButton.grid(row = 5, column = 0, sticky = 'nsew',
										pady = 2, padx = 2)

		self.rt_bottomFrame.grid(row = 2, column = 0,
										sticky = 'nsew')
		self.roioptionsButton.grid(row = 0, column = 0,
										sticky = 'nsew', padx = 10, pady = 10)
		self.roicloseButton.grid(row = 0, column = 1,
										sticky = 'nsew', padx = 10, pady = 10)

		try:
			self._roipath[-1]
			ROImanager.setstate_roi(self)
			ROIdisplay.show_roi(self)
			ROImanager.update_roiList(self)
		except AttributeError:
			ROImanager.setstate_noroi(self)