/
MRI-Phantom.py
361 lines (351 loc) · 18.4 KB
/
MRI-Phantom.py
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
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'MRI-Phantom.ui'
#
# Created by: PyQt5 UI code generator 5.12
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
MainWindow.setObjectName("MainWindow")
MainWindow.resize(929, 900)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(MainWindow.sizePolicy().hasHeightForWidth())
MainWindow.setSizePolicy(sizePolicy)
MainWindow.setStyleSheet("")
MainWindow.setDocumentMode(False)
self.centralwidget = QtWidgets.QWidget(MainWindow)
self.centralwidget.setStyleSheet("")
self.centralwidget.setObjectName("centralwidget")
self.horizontalLayout_3 = QtWidgets.QHBoxLayout(self.centralwidget)
self.horizontalLayout_3.setObjectName("horizontalLayout_3")
self.tabWidget = QtWidgets.QTabWidget(self.centralwidget)
self.tabWidget.setObjectName("tabWidget")
self.tab = QtWidgets.QWidget()
self.tab.setMaximumSize(QtCore.QSize(907, 807))
self.tab.setStyleSheet("")
self.tab.setObjectName("tab")
self.horizontalLayout = QtWidgets.QHBoxLayout(self.tab)
self.horizontalLayout.setObjectName("horizontalLayout")
spacerItem = QtWidgets.QSpacerItem(10, 10, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Minimum)
self.horizontalLayout.addItem(spacerItem)
self.gridLayout = QtWidgets.QGridLayout()
self.gridLayout.setObjectName("gridLayout")
self.gridLayout_4 = QtWidgets.QGridLayout()
self.gridLayout_4.setObjectName("gridLayout_4")
self.verticalLayout = QtWidgets.QVBoxLayout()
self.verticalLayout.setObjectName("verticalLayout")
self.gridLayout_4.addLayout(self.verticalLayout, 0, 0, 1, 1)
self.gridLayout.addLayout(self.gridLayout_4, 0, 0, 1, 1)
self.gridLayout_2 = QtWidgets.QGridLayout()
self.gridLayout_2.setObjectName("gridLayout_2")
spacerItem1 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
self.gridLayout_2.addItem(spacerItem1, 9, 0, 1, 1)
self.b_t1 = QtWidgets.QPushButton(self.tab)
self.b_t1.setStyleSheet("background-color: rgb(238, 238, 236);\n"
"color: rgb(238, 238, 236);\n"
"font: 75 11pt \"URW Bookman L\";")
self.b_t1.setObjectName("b_t1")
self.gridLayout_2.addWidget(self.b_t1, 1, 0, 1, 1)
self.b_t2 = QtWidgets.QPushButton(self.tab)
self.b_t2.setStyleSheet("background-color: rgb(238, 238, 236);\n"
"color: rgb(238, 238, 236);\n"
"font: 75 11pt \"URW Bookman L\";")
self.b_t2.setObjectName("b_t2")
self.gridLayout_2.addWidget(self.b_t2, 2, 0, 1, 1)
self.b_k = QtWidgets.QPushButton(self.tab)
self.b_k.setStyleSheet("font: 75 11pt \"URW Bookman L\";\n"
"background-color: rgb(238, 238, 236);\n"
"color: rgb(238, 238, 236);")
self.b_k.setObjectName("b_k")
self.gridLayout_2.addWidget(self.b_k, 3, 0, 1, 1)
self.b_theta = QtWidgets.QPushButton(self.tab)
self.b_theta.setStyleSheet("background-color: rgb(238, 238, 236);\n"
"color: rgb(238, 238, 236);\n"
"font: 75 11pt \"URW Bookman L\";")
self.b_theta.setObjectName("b_theta")
self.gridLayout_2.addWidget(self.b_theta, 5, 0, 1, 1)
self.b_tr = QtWidgets.QPushButton(self.tab)
self.b_tr.setStyleSheet("background-color: rgb(238, 238, 236);\n"
"color: rgb(238, 238, 236);\n"
"font: 75 11pt \"URW Bookman L\";")
self.b_tr.setObjectName("b_tr")
self.gridLayout_2.addWidget(self.b_tr, 7, 0, 1, 1)
self.b_te = QtWidgets.QPushButton(self.tab)
self.b_te.setStyleSheet("background-color: rgb(238, 238, 236);\n"
"color: rgb(238, 238, 236);\n"
"font: 75 11pt \"URW Bookman L\";")
self.b_te.setObjectName("b_te")
self.gridLayout_2.addWidget(self.b_te, 6, 0, 1, 1)
self.b_reset = QtWidgets.QPushButton(self.tab)
self.b_reset.setStyleSheet("background-color: rgb(238, 238, 236);\n"
"color: rgb(238, 238, 236);\n"
"font: 75 11pt \"URW Bookman L\";")
self.b_reset.setObjectName("b_reset")
self.gridLayout_2.addWidget(self.b_reset, 8, 0, 1, 1)
self.cb = QtWidgets.QComboBox(self.tab)
self.cb.setStyleSheet("background-color: rgb(32, 74, 135);\n"
"\n"
"color: rgb(238, 238, 236);\n"
"font: 75 11pt \"URW Bookman L\";")
self.cb.setObjectName("cb")
self.cb.addItem("")
self.cb.addItem("")
self.cb.addItem("")
self.cb.addItem("")
self.cb.addItem("")
self.cb.addItem("")
self.cb.addItem("")
self.cb.addItem("")
self.cb.addItem("")
self.gridLayout_2.addWidget(self.cb, 0, 0, 1, 1)
self.gridLayout.addLayout(self.gridLayout_2, 0, 3, 1, 1)
self.gridLayout_8 = QtWidgets.QGridLayout()
self.gridLayout_8.setObjectName("gridLayout_8")
self.l5 = QtWidgets.QLabel(self.tab)
self.l5.setMinimumSize(QtCore.QSize(128, 128))
self.l5.setFrameShape(QtWidgets.QFrame.Box)
self.l5.setText("")
self.l5.setScaledContents(True)
self.l5.setObjectName("l5")
self.gridLayout_8.addWidget(self.l5, 10, 1, 1, 1)
self.lineEdit_4 = QtWidgets.QLineEdit(self.tab)
font = QtGui.QFont()
font.setFamily("MathJax_AMS")
font.setPointSize(18)
self.lineEdit_4.setFont(font)
self.lineEdit_4.setStyleSheet("color:rgb(52, 101, 164);\n"
"background-color: rgb(252, 233, 79);")
self.lineEdit_4.setObjectName("lineEdit_4")
self.gridLayout_8.addWidget(self.lineEdit_4, 0, 0, 1, 2)
self.lineEdit_3 = QtWidgets.QLineEdit(self.tab)
font = QtGui.QFont()
font.setFamily("MathJax_AMS")
font.setPointSize(12)
self.lineEdit_3.setFont(font)
self.lineEdit_3.setStyleSheet("color: rgb(52, 101, 164);\n"
"background-color: rgb(252, 233, 79);")
self.lineEdit_3.setReadOnly(True)
self.lineEdit_3.setObjectName("lineEdit_3")
self.gridLayout_8.addWidget(self.lineEdit_3, 5, 1, 1, 1)
self.l3 = QtWidgets.QLabel(self.tab)
self.l3.setMinimumSize(QtCore.QSize(128, 128))
self.l3.setFrameShape(QtWidgets.QFrame.Box)
self.l3.setText("")
self.l3.setScaledContents(True)
self.l3.setObjectName("l3")
self.gridLayout_8.addWidget(self.l3, 4, 1, 1, 1)
self.lineEdit_2 = QtWidgets.QLineEdit(self.tab)
font = QtGui.QFont()
font.setFamily("MathJax_AMS")
font.setPointSize(12)
self.lineEdit_2.setFont(font)
self.lineEdit_2.setStyleSheet("background-color: rgb(252, 233, 79);\n"
"color: rgb(52, 101, 164);")
self.lineEdit_2.setReadOnly(True)
self.lineEdit_2.setObjectName("lineEdit_2")
self.gridLayout_8.addWidget(self.lineEdit_2, 5, 0, 1, 1)
spacerItem2 = QtWidgets.QSpacerItem(10, 0, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed)
self.gridLayout_8.addItem(spacerItem2, 2, 0, 1, 1)
self.l2 = QtWidgets.QLabel(self.tab)
self.l2.setMinimumSize(QtCore.QSize(128, 128))
self.l2.setFrameShape(QtWidgets.QFrame.Box)
self.l2.setText("")
self.l2.setScaledContents(True)
self.l2.setObjectName("l2")
self.gridLayout_8.addWidget(self.l2, 4, 0, 1, 1)
self.lineEdit = QtWidgets.QLineEdit(self.tab)
font = QtGui.QFont()
font.setFamily("MathJax_AMS")
font.setPointSize(12)
self.lineEdit.setFont(font)
self.lineEdit.setStyleSheet("color: rgb(52, 101, 164);\n"
"background-color: rgb(252, 233, 79);")
self.lineEdit.setReadOnly(True)
self.lineEdit.setObjectName("lineEdit")
self.gridLayout_8.addWidget(self.lineEdit, 3, 1, 1, 1)
self.l4 = QtWidgets.QLabel(self.tab)
self.l4.setMinimumSize(QtCore.QSize(128, 128))
self.l4.setFrameShape(QtWidgets.QFrame.Box)
self.l4.setText("")
self.l4.setScaledContents(True)
self.l4.setObjectName("l4")
self.gridLayout_8.addWidget(self.l4, 10, 0, 1, 1)
self.lineEdit_5 = QtWidgets.QLineEdit(self.tab)
palette = QtGui.QPalette()
brush = QtGui.QBrush(QtGui.QColor(52, 101, 164))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.WindowText, brush)
brush = QtGui.QBrush(QtGui.QColor(252, 233, 79))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Button, brush)
brush = QtGui.QBrush(QtGui.QColor(52, 101, 164))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Text, brush)
brush = QtGui.QBrush(QtGui.QColor(52, 101, 164))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.ButtonText, brush)
brush = QtGui.QBrush(QtGui.QColor(252, 233, 79))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Base, brush)
brush = QtGui.QBrush(QtGui.QColor(252, 233, 79))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Window, brush)
brush = QtGui.QBrush(QtGui.QColor(52, 101, 164))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Link, brush)
brush = QtGui.QBrush(QtGui.QColor(52, 101, 164))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.WindowText, brush)
brush = QtGui.QBrush(QtGui.QColor(252, 233, 79))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Button, brush)
brush = QtGui.QBrush(QtGui.QColor(52, 101, 164))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Text, brush)
brush = QtGui.QBrush(QtGui.QColor(52, 101, 164))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.ButtonText, brush)
brush = QtGui.QBrush(QtGui.QColor(252, 233, 79))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Base, brush)
brush = QtGui.QBrush(QtGui.QColor(252, 233, 79))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Window, brush)
brush = QtGui.QBrush(QtGui.QColor(52, 101, 164))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Link, brush)
brush = QtGui.QBrush(QtGui.QColor(52, 101, 164))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.WindowText, brush)
brush = QtGui.QBrush(QtGui.QColor(252, 233, 79))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Button, brush)
brush = QtGui.QBrush(QtGui.QColor(52, 101, 164))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Text, brush)
brush = QtGui.QBrush(QtGui.QColor(52, 101, 164))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.ButtonText, brush)
brush = QtGui.QBrush(QtGui.QColor(252, 233, 79))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Base, brush)
brush = QtGui.QBrush(QtGui.QColor(252, 233, 79))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Window, brush)
brush = QtGui.QBrush(QtGui.QColor(52, 101, 164))
brush.setStyle(QtCore.Qt.SolidPattern)
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Link, brush)
self.lineEdit_5.setPalette(palette)
font = QtGui.QFont()
font.setFamily("MathJax_AMS")
font.setPointSize(12)
font.setBold(False)
font.setWeight(50)
self.lineEdit_5.setFont(font)
self.lineEdit_5.setStyleSheet("\n"
"background-color: rgb(186, 189, 182);\n"
"color: rgb(52, 101, 164);\n"
"background-color: rgb(252, 233, 79);")
self.lineEdit_5.setReadOnly(True)
self.lineEdit_5.setObjectName("lineEdit_5")
self.gridLayout_8.addWidget(self.lineEdit_5, 3, 0, 1, 1)
self.gridLayout_5 = QtWidgets.QGridLayout()
self.gridLayout_5.setObjectName("gridLayout_5")
self.l1 = QtWidgets.QLabel(self.tab)
self.l1.setMinimumSize(QtCore.QSize(128, 128))
self.l1.setMaximumSize(QtCore.QSize(1080, 1080))
self.l1.setFrameShape(QtWidgets.QFrame.Box)
self.l1.setText("")
self.l1.setScaledContents(True)
self.l1.setObjectName("l1")
self.gridLayout_5.addWidget(self.l1, 0, 1, 1, 1)
spacerItem3 = QtWidgets.QSpacerItem(92, 20, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Minimum)
self.gridLayout_5.addItem(spacerItem3, 0, 2, 1, 1)
spacerItem4 = QtWidgets.QSpacerItem(92, 20, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Minimum)
self.gridLayout_5.addItem(spacerItem4, 0, 0, 1, 1)
self.gridLayout_8.addLayout(self.gridLayout_5, 1, 0, 1, 2)
self.gridLayout.addLayout(self.gridLayout_8, 0, 1, 1, 1)
spacerItem5 = QtWidgets.QSpacerItem(100, 10, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Minimum)
self.gridLayout.addItem(spacerItem5, 0, 2, 1, 1)
self.horizontalLayout.addLayout(self.gridLayout)
self.tabWidget.addTab(self.tab, "")
self.tab_2 = QtWidgets.QWidget()
self.tab_2.setObjectName("tab_2")
self.horizontalLayout_2 = QtWidgets.QHBoxLayout(self.tab_2)
self.horizontalLayout_2.setObjectName("horizontalLayout_2")
self.gridLayout_3 = QtWidgets.QGridLayout()
self.gridLayout_3.setObjectName("gridLayout_3")
self.graphicsView_4 = PlotWidget(self.tab_2)
self.graphicsView_4.setObjectName("graphicsView_4")
self.gridLayout_3.addWidget(self.graphicsView_4, 2, 2, 1, 1)
self.graphicsView_2 = PlotWidget(self.tab_2)
self.graphicsView_2.setObjectName("graphicsView_2")
self.gridLayout_3.addWidget(self.graphicsView_2, 2, 0, 1, 1)
spacerItem6 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Preferred)
self.gridLayout_3.addItem(spacerItem6, 1, 0, 1, 1)
self.graphicsView = PlotWidget(self.tab_2)
self.graphicsView.setObjectName("graphicsView")
self.gridLayout_3.addWidget(self.graphicsView, 0, 0, 1, 1)
spacerItem7 = QtWidgets.QSpacerItem(20, 10, QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Minimum)
self.gridLayout_3.addItem(spacerItem7, 0, 1, 1, 1)
self.graphicsView_3 = PlotWidget(self.tab_2)
self.graphicsView_3.setObjectName("graphicsView_3")
self.gridLayout_3.addWidget(self.graphicsView_3, 0, 2, 1, 1)
self.horizontalLayout_2.addLayout(self.gridLayout_3)
self.tabWidget.addTab(self.tab_2, "")
self.horizontalLayout_3.addWidget(self.tabWidget)
MainWindow.setCentralWidget(self.centralwidget)
self.menubar = QtWidgets.QMenuBar(MainWindow)
self.menubar.setGeometry(QtCore.QRect(0, 0, 929, 22))
self.menubar.setObjectName("menubar")
MainWindow.setMenuBar(self.menubar)
self.statusbar = QtWidgets.QStatusBar(MainWindow)
self.statusbar.setObjectName("statusbar")
MainWindow.setStatusBar(self.statusbar)
self.retranslateUi(MainWindow)
self.tabWidget.setCurrentIndex(0)
self.b_t1.clicked.connect(self.l2.show)
self.b_t2.clicked.connect(self.l3.show)
self.b_k.clicked.connect(self.l4.show)
self.b_t1.clicked.connect(self.l2.show)
self.cb.activated['QString'].connect(self.b_t1.toggle)
QtCore.QMetaObject.connectSlotsByName(MainWindow)
def retranslateUi(self, MainWindow):
_translate = QtCore.QCoreApplication.translate
MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow"))
self.b_t1.setText(_translate("MainWindow", "T1 Weighted"))
self.b_t2.setText(_translate("MainWindow", "T2 Weighted"))
self.b_k.setText(_translate("MainWindow", "K-Space"))
self.b_theta.setText(_translate("MainWindow", "Theta"))
self.b_tr.setText(_translate("MainWindow", "TR"))
self.b_te.setText(_translate("MainWindow", "TE"))
self.b_reset.setText(_translate("MainWindow", "Reset"))
self.cb.setItemText(0, _translate("MainWindow", "Select Phantom"))
self.cb.setItemText(1, _translate("MainWindow", "Shepp-Logan phantom (10 ellipses)"))
self.cb.setItemText(2, _translate("MainWindow", "Piecewise-Smooth Shepp-Logan phantom"))
self.cb.setItemText(3, _translate("MainWindow", "phantom with vertical ellipses"))
self.cb.setItemText(4, _translate("MainWindow", "1 cone"))
self.cb.setItemText(5, _translate("MainWindow", "1 rectangular"))
self.cb.setItemText(6, _translate("MainWindow", "composite of 6 gaussians + 1 parabola"))
self.cb.setItemText(7, _translate("MainWindow", "composite - rectangles and ellipses "))
self.cb.setItemText(8, _translate("MainWindow", "rectangles, \'resolution\' phantom"))
self.lineEdit_4.setText(_translate("MainWindow", " Phantom"))
self.lineEdit_3.setText(_translate("MainWindow", " costructed Image"))
self.lineEdit_2.setText(_translate("MainWindow", " K-Space"))
self.lineEdit.setText(_translate("MainWindow", " T2 Weighted"))
self.lineEdit_5.setText(_translate("MainWindow", " T1 Weighted"))
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab), _translate("MainWindow", "Tab 1"))
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_2), _translate("MainWindow", "Tab 2"))
from pyqtgraph import PlotWidget
import background_rc
if __name__ == "__main__":
import sys
app = QtWidgets.QApplication(sys.argv)
MainWindow = QtWidgets.QMainWindow()
ui = Ui_MainWindow()
ui.setupUi(MainWindow)
MainWindow.show()
sys.exit(app.exec_())