-
Notifications
You must be signed in to change notification settings - Fork 2
/
UltrasoundTrainingSystem.py
172 lines (136 loc) · 5.39 KB
/
UltrasoundTrainingSystem.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
import os
import unittest
import vtk, qt, ctk, slicer
import logging
from Guidelet import GuideletLoadable, GuideletLogic, GuideletTest, GuideletWidget
from Guidelet import Guidelet
#
# UltrasoundTrainingSystem
#
class UltrasoundTrainingSystem(GuideletLoadable):
"""Uses GuideletLoadable class, available at:
"""
def __init__(self, parent):
GuideletLoadable.__init__(self, parent)
self.parent.title = "US Simulation Navigation"
self.parent.categories = ["IGT"]
self.parent.dependencies = []
self.parent.contributors = ["Carlos Luque (ULPGC), Csaba Pinter (Queen's)"]
self.parent.helpText = """
US simulations
"""
self.parent.acknowledgementText = """
NAMIC
""" # replace with organization, grant and thanks.
#
# UltrasoundTrainingSystemWidget
#
class UltrasoundTrainingSystemWidget(GuideletWidget):
def __init__(self, parent = None):
GuideletWidget.__init__(self, parent)
def setup(self):
GuideletWidget.setup(self)
def addLauncherWidgets(self):
GuideletWidget.addLauncherWidgets(self)
def createGuideletInstance(self):
return UltrasoundTrainingSystemGuidelet(None, self.guideletLogic, self.selectedConfigurationName)
def createGuideletLogic(self):
return UltrasoundTrainingSystemLogic()
#
# UltrasoundTrainingSystemLogic
#
class UltrasoundTrainingSystemLogic(GuideletLogic):
"""Uses GuideletLogic base class, available at:
""" #TODO add path
def __init__(self, parent = None):
GuideletLogic.__init__(self, parent)
#
# UltrasoundTrainingSystemTest
#
class UltrasoundTrainingSystemTest(GuideletTest):
"""This is the test case for your scripted module.
"""
def runTest(self):
"""Run as few or as many tests as needed here.
"""
GuideletTest.runTest(self)
#
# UltrasoundTrainingSystemGuidelet
#
class UltrasoundTrainingSystemGuidelet(Guidelet):
VIEW_US_SIMULATOR_TRAINING = unicode("Ultrasound Simulator Training")
def __init__(self, parent, logic, configurationName='Default'):
Guidelet.__init__(self, parent, logic, configurationName)
logging.debug('UltrasoundTrainingSystemGuidelet.__init__')
self.logic.addValuesToDefaultConfiguration()
# Set default layout name to the simulator training layout
self.defaultLayoutName = self.VIEW_US_SIMULATOR_TRAINING
# Set up main frame
self.sliceletDockWidget.setObjectName('UltrasoundTrainingSystemPanel')
self.sliceletDockWidget.setWindowTitle('UltrasoundTrainingSystem')
self.mainWindow.setWindowTitle('UltrasoundTrainingSystem')
self.selectView(self.VIEW_US_SIMULATOR_TRAINING)
def __del__(self):
self.preCleanup()
# Clean up when slicelet is closed
def preCleanup(self):
Guidelet.preCleanup(self)
logging.debug('precleanup')
def setupAdvancedPanel(self):
Guidelet.setupAdvancedPanel(self)
self.registerCustomLayouts()
def registerCustomLayouts(self):
customLayout = (
"<layout type=\"horizontal\">"
"<item>"
"<view class=\"vtkMRMLSliceNode\" singletontag=\"Red\">"
" <property name=\"orientation\" action=\"default\">Axial</property>"
" <property name=\"viewlabel\" action=\"default\">R</property>"
" <property name=\"viewcolor\" action=\"default\">#F34A33</property>"
"</view>"
"</item>"
"<item>"
"<layout type=\"vertical\">"
"<item>"
"<view class=\"vtkMRMLViewNode\" singletontag=\"1\">"
"<property name=\"viewlabel\" action=\"default\">1</property>"
"</view>"
"</item>"
"<item>"
"<view class=\"vtkMRMLViewNode\" singletontag=\"2\">"
"<property name=\"viewlabel\" action=\"default\">2</property>"
"</view>"
"</item>"
"</layout>"
"</item>"
"</layout>")
self.registerLayout(self.VIEW_US_SIMULATOR_TRAINING, 525, customLayout, self.delayedFitAndHideUltrasoundSliceIn3dView)
def createFeaturePanels(self):
# Create GUI panels.
logging.debug('UltrasoundTrainingSystem.createFeaturePanels()')
self.LoadSceneCollapsibleButton = ctk.ctkCollapsibleButton()
self.SetupLoadSceneCollapsibleButton()
featurePanelList = Guidelet.createFeaturePanels(self)
featurePanelList[len(featurePanelList):] = [self.LoadSceneCollapsibleButton]
return featurePanelList
def setupConnections(self):
logging.debug('UltrasoundTrainingSystem.setupConnections()')
Guidelet.setupConnections(self)
self.LoadSceneButton.connect('clicked()', self.openLoadSceneDialog)
def disconnect(self): #TODO: see connect
logging.debug('UltrasoundTrainingSystem.disconnect()')
Guidelet.disconnect(self)
def SetupLoadSceneCollapsibleButton(self):
logging.debug('SetupLoadSceneCollapsibleButton')
self.LoadSceneCollapsibleButton.setProperty('collapsedHeight', 20)
self.LoadSceneCollapsibleButton.text = 'Scene'
self.sliceletPanelLayout.addWidget(self.LoadSceneCollapsibleButton)
self.LoadSceneLayout = qt.QFormLayout(self.LoadSceneCollapsibleButton)
self.LoadSceneLayout.setContentsMargins(12, 4, 4, 4)
self.LoadSceneLayout.setSpacing(4)
self.LoadSceneButton = qt.QPushButton('Load Scene')
self.LoadSceneLayout.addRow(self.LoadSceneButton)
def openLoadSceneDialog(self):
slicer.app.ioManager().openLoadSceneDialog()
self.layoutManager.setLayout(self.one2Ddual3dCustomLayoutId)
self.setupConnectorNode() # checking