-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathRSS_GUI_layout.py
More file actions
347 lines (295 loc) · 17.1 KB
/
RSS_GUI_layout.py
File metadata and controls
347 lines (295 loc) · 17.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
#
# GUI module generated by PAGE version 8.0
# in conjunction with Tcl version 8.6
# Oct 03, 2024 02:43:13 PM EDT platform: Linux
import sys
import tkinter as tk
import tkinter.ttk as ttk
from tkinter.constants import *
import os.path
_location = os.path.dirname(__file__)
import RSS_GUI_main
_bgcolor = '#d9d9d9'
_fgcolor = '#000000'
_tabfg1 = 'black'
_tabfg2 = 'white'
_bgmode = 'light'
_tabbg1 = '#d9d9d9'
_tabbg2 = 'gray40'
class MainWin:
def __init__(self, top=None):
'''This class configures and populates the toplevel window.
top is the toplevel containing window.'''
h = 600
w = 800
top.geometry("650x580+632+71")
top.minsize(1, 1)
top.maxsize(1905, 1050)
top.resizable(1, 1)
top.title("RSS-tool")
self.top = top
self.selectedButton = tk.IntVar()
self.LF_label = tk.Label(self.top)
self.LF_label.place(x=0.033*w, y=0.717*h, height=29, width=154)
self.LF_label.configure(activebackground="#d9d9d9")
self.LF_label.configure(anchor='w')
self.LF_label.configure(compound='left')
self.LF_label.configure(font="-family {nimbus sans l} -size 9")
self.LF_label.configure(text='''Low Frequency''')
self.LF_scale = tk.Scale(self.top, from_=0.0, to=100.0, resolution=1.0)
self.LF_scale.place(x=0.033*w, y=0.75*h, height=0.067*h
, width=0.308*w)
self.LF_scale.configure(activebackground="#d9d9d9")
self.LF_scale.configure(command=RSS_GUI_main.LF_silde)
self.LF_scale.configure(font="-family {nimbus sans l} -size 9")
self.LF_scale.configure(length="184")
self.LF_scale.configure(orient="horizontal")
self.LF_scale.configure(showvalue="0")
self.LF_scale.configure(troughcolor="#c4c4c4")
self.HF_entry = tk.Entry(self.top)
self.HF_entry.place(x=0.35*w, y=0.868*h, height=29, width=0.095*w)
self.HF_entry.configure(background="white")
self.HF_entry.configure(font="-family {nimbus mono l} -size 12")
self.HF_entry.configure(selectbackground="#d9d9d9")
self.HF_entry.configure(state='readonly')
self.LF_entry = tk.Entry(self.top)
self.LF_entry.place(x=0.35*w, y=0.75*h, height=29, width=0.095*w)
self.LF_entry.configure(background="white")
self.LF_entry.configure(font="-family {nimbus mono l} -size 12")
self.LF_entry.configure(selectbackground="#d9d9d9")
self.LF_entry.configure(state='readonly')
self.Sigma_label = tk.Label(self.top)
self.Sigma_label.place(x=0.033*w, y=0.6*h, height=19, width=60)
self.Sigma_label.configure(activebackground="#d9d9d9")
self.Sigma_label.configure(anchor='w')
self.Sigma_label.configure(compound='left')
self.Sigma_label.configure(font="-family {nimbus sans l} -size 9")
self.Sigma_label.configure(text='''Sigma:''')
self.Sigma_entry = tk.Entry(self.top)
self.Sigma_entry.place(x=0.033*w, y=0.628*h, height=29, width=0.09*w)
self.Sigma_entry.configure(background="white")
self.Sigma_entry.configure(font="-family {nimbus mono l} -size 12")
self.Sigma_entry.configure(selectbackground="#d9d9d9")
self.Seed_button = tk.Button(self.top)
self.Seed_button.place(x=0.14*w, y=0.628*h, height=29, width=50)
self.Seed_button.configure(activebackground="#d9d9d9")
self.Seed_button.configure(command=RSS_GUI_main.Seed_button_click)
self.Seed_button.configure(cursor="fleur")
self.Seed_button.configure(font="-family {nimbus sans l} -size 9")
self.Seed_button.configure(text='''Seed''')
self.View_label = tk.Label(self.top)
self.View_label.place(x=0.388*w, y=0.005*h, height=19, width=79)
self.View_label.configure(activebackground="#d9d9d9")
self.View_label.configure(anchor='w')
self.View_label.configure(compound='left')
self.View_label.configure(font="-family {nimbus sans l} -size 9 -weight bold")
self.View_label.configure(text='''View:''')
self.Metrics_listbox = tk.Listbox(self.top)
self.Metrics_listbox.place(x=0.388*w, y=0.233*h, height=0.267*h, width=0.389*w)
self.Metrics_listbox.configure(background="white")
self.Metrics_listbox.configure(font="-family {nimbus mono l} -size 11")
self.Metrics_listbox.configure(selectbackground="#d9d9d9")
self.Metrics_label = tk.Label(self.top)
self.Metrics_label.place(x=0.388*w, y=0.2*h, height=19, width=200)
self.Metrics_label.configure(activebackground="#d9d9d9")
self.Metrics_label.configure(anchor='w')
self.Metrics_label.configure(compound='left')
self.Metrics_label.configure(font="-family {nimbus sans l} -size 9 -weight bold")
self.Metrics_label.configure(text='''Segmentation metrics:''')
self.ViewName_label = tk.Label(self.top)
self.ViewName_label.place(x=0.018*w, y=0.5*h, height=19, width=276)
self.ViewName_label.configure(activebackground="#d9d9d9")
self.ViewName_label.configure(font="-family {nimbus sans l} -size 10 -weight bold")
self.ViewName_label.configure(text='''SynSeg #''')
self.HF_label = tk.Label(self.top)
self.HF_label.place(x=0.033*w, y=0.833*h, height=29, width=154)
self.HF_label.configure(activebackground="#d9d9d9")
self.HF_label.configure(anchor='w')
self.HF_label.configure(compound='left')
self.HF_label.configure(font="-family {nimbus sans l} -size 9")
self.HF_label.configure(text='''High Frequency''')
self.HF_scale = tk.Scale(self.top, from_=0.0, to=100.0, resolution=1.0)
self.HF_scale.place(x=0.033*w, y=0.867*h, height=0.067*h, width=0.308*w)
self.HF_scale.configure(activebackground="#d9d9d9")
self.HF_scale.configure(command=RSS_GUI_main.HF_silde)
self.HF_scale.configure(font="-family {nimbus sans l} -size 9")
self.HF_scale.configure(length="184")
self.HF_scale.configure(orient="horizontal")
self.HF_scale.configure(showvalue="0")
self.HF_scale.configure(troughcolor="#c4c4c4")
self.Main_img = tk.Canvas(self.top)
# self.Main_img.place(relx=0.0, rely=0.0, relheight=0.5, relwidth=0.375)
self.Main_img.place(x=0.0, y=0.0, height=300, width=300)
self.Main_img.configure(borderwidth="2")
self.Main_img.configure(relief="ridge")
self.Main_img.configure(selectbackground="#d9d9d9")
self.LoadImg_button = tk.Button(self.top)
self.LoadImg_button.place(x=0.113*w, y=0.53*h, height=29, width=133)
self.LoadImg_button.configure(activebackground="#d9d9d9")
self.LoadImg_button.configure(command=RSS_GUI_main.LoadImg_click)
self.LoadImg_button.configure(font="-family {nimbus sans l} -size 9")
self.LoadImg_button.configure(text='''Load new image''')
self.Gen1_button = tk.Button(self.top)
self.Gen1_button.place(x=0.225*w, y=0.628*h, height=29, width=80)
self.Gen1_button.configure(activebackground="#d9d9d9")
self.Gen1_button.configure(command=RSS_GUI_main.Gen1_button_click)
self.Gen1_button.configure(cursor="fleur")
self.Gen1_button.configure(font="-family {nimbus sans l} -size 9")
self.Gen1_button.configure(text='''Gen 1''')
self.GenN_button = tk.Button(self.top)
self.GenN_button.place(x=0.346*w, y=0.628*h, height=29, width=80)
self.GenN_button.configure(activebackground="#d9d9d9")
self.GenN_button.configure(command=RSS_GUI_main.GenN_button_click)
self.GenN_button.configure(cursor="fleur")
self.GenN_button.configure(text='''Gen N''')
self.Overlay_view_radiobutton = tk.Radiobutton(self.top)
self.Overlay_view_radiobutton.place(x=0.388*w, y=0.135*h, height=0.048*h, width=0.2*w)
self.Overlay_view_radiobutton.configure(activebackground="#d9d9d9")
self.Overlay_view_radiobutton.configure(compound='left')
self.Overlay_view_radiobutton.configure(font="-family {nimbus sans l} -size 9")
self.Overlay_view_radiobutton.configure(indicatoron="0")
self.Overlay_view_radiobutton.configure(justify='left')
self.Overlay_view_radiobutton.configure(text='''Synthetic Contour Overlay''')
self.Overlay_view_radiobutton.configure(variable=self.selectedButton)
self.Input_view_radiobutton = tk.Radiobutton(self.top)
self.Input_view_radiobutton.place(x=0.388*w, y=0.035*h, height=0.048*h, width=0.2*w)
self.Input_view_radiobutton.configure(activebackground="#d9d9d9")
self.Input_view_radiobutton.configure(compound='left')
self.Input_view_radiobutton.configure(font="-family {nimbus sans l} -size 9")
self.Input_view_radiobutton.configure(indicatoron="0")
self.Input_view_radiobutton.configure(justify='left')
self.Input_view_radiobutton.configure(text='''Original Segmentation''')
self.Input_view_radiobutton.configure(variable=self.selectedButton)
self.Syn_view_radiobutton = tk.Radiobutton(self.top)
self.Syn_view_radiobutton.place(x=0.388*w, y=0.085*h, height=0.048*h, width=0.2*w)
self.Syn_view_radiobutton.configure(activebackground="#d9d9d9")
self.Syn_view_radiobutton.configure(compound='left')
self.Syn_view_radiobutton.configure(font="-family {nimbus sans l} -size 9")
self.Syn_view_radiobutton.configure(indicatoron="0")
self.Syn_view_radiobutton.configure(justify='left')
self.Syn_view_radiobutton.configure(text='''Synthetic Segmentation''')
self.Syn_view_radiobutton.configure(variable=self.selectedButton)
self.SynSegPivot_button = tk.Button(self.top)
self.SynSegPivot_button.place(x=0.613*w, y=0.083*h, height=29
, width=133)
self.SynSegPivot_button.configure(activebackground="#d9d9d9")
self.SynSegPivot_button.configure(command=RSS_GUI_main.SynSegPivot_button_click)
self.SynSegPivot_button.configure(font="-family {nimbus sans l} -size 9")
self.SynSegPivot_button.configure(text='''Metric Statistics''')
self.DispASynSeg_button = tk.Button(self.top)
self.DispASynSeg_button.place(x=0.613*w, y=0.033*h, height=29
, width=133)
self.DispASynSeg_button.configure(command=RSS_GUI_main.DispASynSeg_button_click)
self.DispASynSeg_button.configure(activebackground="#d9d9d9")
self.DispASynSeg_button.configure(font="-family {nimbus sans l} -size 9")
self.DispASynSeg_button.configure(text='''Display A SynSeg''')
self.DispFusion_button = tk.Button(self.top)
self.DispFusion_button.place(x=0.613*w, y=0.133*h, height=29
, width=133)
self.DispFusion_button.configure(activebackground="#d9d9d9")
self.DispFusion_button.configure(command=RSS_GUI_main.DispFusion_button_click)
self.DispFusion_button.configure(font="-family {nimbus sans l} -size 9")
self.DispFusion_button.configure(text='''Display Fused Seg''')
self.SelectMode_TCheckbutton = ttk.Checkbutton(self.top)
self.SelectMode_TCheckbutton.place(x=0.538*w, y=0.533*h, width=0.146*w, height=19)
self.SelectMode_TCheckbutton.configure(command=RSS_GUI_main.SelectMode_Click)
self.SelectMode_TCheckbutton.configure(text='''Selection Mode''')
self.SelectMode_TCheckbutton.configure(compound='left')
self.Label2 = tk.Label(self.top)
self.Label2.place(x=0.488*w, y=0.6338*h, height=26, width=44)
self.Label2.configure(activebackground="#d9d9d9")
self.Label2.configure(anchor='w')
self.Label2.configure(compound='left')
self.Label2.configure(font="-family {nimbus sans l} -size 9")
self.Label2.configure(text='''From:''')
self.Label3 = tk.Label(self.top)
self.Label3.place(x=0.65*w, y=0.633*h, height=23, width=29)
self.Label3.configure(activebackground="#d9d9d9")
self.Label3.configure(anchor='w')
self.Label3.configure(compound='left')
self.Label3.configure(font="-family {nimbus sans l} -size 9")
self.Label3.configure(text='''To:''')
self.SelectFrom_entry = tk.Entry(self.top)
self.SelectFrom_entry.place(x=0.535*w, y=0.638*h, height=19, width=0.07*w)
self.SelectFrom_entry.configure(background="white")
self.SelectFrom_entry.configure(font="-family {nimbus mono l} -size 9")
self.SelectFrom_entry.configure(selectbackground="#d9d9d9")
self.SelectTo_entry = tk.Entry(self.top)
self.SelectTo_entry.place(x=0.68*w, y=0.638*h, height=19, width=0.07*w)
self.SelectTo_entry.configure(background="white")
self.SelectTo_entry.configure(font="-family {nimbus mono l} -size 9")
self.SelectTo_entry.configure(selectbackground="#d9d9d9")
self.Label1 = tk.Label(self.top)
self.Label1.place(x=0.525*w, y=0.583*h, height=23, width=52)
self.Label1.configure(activebackground="#d9d9d9")
self.Label1.configure(anchor='w')
self.Label1.configure(compound='left')
self.Label1.configure(cursor="fleur")
self.Label1.configure(font="-family {nimbus sans l} -size 9")
self.Label1.configure(text='''Criterion''')
self.Label4 = tk.Label(self.top)
self.Label4.place(x=0.538*w, y=0.733*h, height=19, width=116)
self.Label4.configure(activebackground="#d9d9d9")
self.Label4.configure(anchor='w')
self.Label4.configure(compound='left')
self.Label4.configure(font="-family {nimbus sans l} -size 9 -weight bold")
self.Label4.configure(text='''Batch processing''')
self.Criterion_TCombobox = ttk.Combobox(self.top)
self.Criterion_TCombobox.place(x=0.6*w, y=0.588*h, height=0.028*h, width=0.111*w)
self.value_list = ['DICE','JAC','HD','MSI',]
self.Criterion_TCombobox.configure(values=self.value_list)
self.Criterion_TCombobox.configure(font="-family {nimbus sans l} -size 9")
self.Criterion_TCombobox.configure(state='readonly')
self.Criterion_TCombobox.configure(background="#ffffff")
self.UserSyn_button = tk.Button(self.top)
self.UserSyn_button.place(x=0.5*w, y=0.783*h, height=29, width=200)
self.UserSyn_button.configure(activebackground="#d9d9d9")
self.UserSyn_button.configure(command=RSS_GUI_main.UserSyn_button_click)
self.UserSyn_button.configure(text='''UserSyn: Gen N from user inputs''')
self.UserFusion_button = tk.Button(self.top)
self.UserFusion_button.place(x=0.5*w, y=0.867*h, height=29, width=200)
self.UserFusion_button.configure(activebackground="#d9d9d9")
self.UserFusion_button.configure(command=RSS_GUI_main.UserFusion_button_click)
self.UserFusion_button.configure(cursor="fleur")
self.UserFusion_button.configure(text='''UserFusion''')
def fusion_popup(self, event, *args, **kwargs):
self.Fusion_popupmenu = tk.Menu(self.top, tearoff=0)
self.Fusion_popupmenu.configure(background=_bgcolor)
self.Fusion_popupmenu.configure(foreground=_fgcolor)
self.Fusion_popupmenu.configure(font="-family {nimbus sans l} -size 9")
self.Fusion_popupmenu.add_command(command=RSS_GUI_main.show_res_seg
,compound='left', font="-family {nimbus sans l} -size 9"
,label='Show Restored(Mean) Seg')
self.Fusion_popupmenu.add_command(command=RSS_GUI_main.show_mv_seg
,compound='left', font="-family {nimbus sans l} -size 9"
,label='Show MV-fused Seg')
self.Fusion_popupmenu.add_command(command=RSS_GUI_main.show_staple_seg
,compound='left', font="-family {nimbus sans l} -size 9"
,label='Show STAPLE-fused Seg')
self.Fusion_popupmenu.add_command(command=RSS_GUI_main.show_tesd_seg
,compound='left', font="TkMenuFont", label='Show TESD-fused Seg')
self.Fusion_popupmenu.tk_popup(event.x_root, event.y_root)
def pivot_popup(self, event, *args, **kwargs):
self.SynSegPivot_popupmenu = tk.Menu(self.top, tearoff=0)
self.SynSegPivot_popupmenu.configure(background=_bgcolor)
self.SynSegPivot_popupmenu.configure(foreground=_fgcolor)
self.SynSegPivot_popupmenu.configure(font="-family {nimbus sans l} -size 9")
self.SynSegPivot_popupmenu.add_command(command=RSS_GUI_main.plot_dice
,compound='left', font="-family {nimbus sans l} -size 9"
,label='Dice-Sørensen coefficient')
self.SynSegPivot_popupmenu.add_command(command=RSS_GUI_main.plot_jac
,compound='left', font="-family {nimbus sans l} -size 9"
,label='Jaccard index')
self.SynSegPivot_popupmenu.add_command(command=RSS_GUI_main.plot_hd
,compound='left', font="-family {nimbus sans l} -size 9"
,label='Hausdorff distance')
self.SynSegPivot_popupmenu.add_command(command=RSS_GUI_main.plot_msi
,compound='left', font="-family {nimbus sans l} -size 9"
,label='Medical similarity index (MSI)')
self.SynSegPivot_popupmenu.tk_popup(event.x_root, event.y_root)
def start_up():
RSS_GUI_main.main()
if __name__ == '__main__':
RSS_GUI_main.main()