Skip to content

Commit 0f9dc2a

Browse files
committed
Add coded for Tutorial 04. Code Style, Method Groups & Ultrasound Sequence Viewer
1 parent a18b64c commit 0f9dc2a

File tree

14 files changed

+773
-0
lines changed

14 files changed

+773
-0
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
_Figures/
33

44

5+
99__Test__ToBeReduced/
6+
7+
58

69
# PyCharm Files
710
.idea/
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# <a href="./../" style="text-decoration:none">3D Slicer Extension Tutorial: Step by Step</a>
2+
3+
4+
15
## <a href="./" style="text-decoration:none">Step 02: Interact, Debug & Pipeline</a>
26

37
<img src="sl_02__Summary.png" alt="isolated" width="1080"/>
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# <a href="./../" style="text-decoration:none">3D Slicer Extension Tutorial: Step by Step</a>
2+
3+
4+
15
## <a href="./" style="text-decoration:none">Step 03: Developer Foci, Neat Blanks & GUI Hello World</a>
26

37
<img src="sl_03__Summary.png" alt="isolated" width="1080"/>
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
cmake_minimum_required(VERSION 3.16.3...3.19.7 FATAL_ERROR)
2+
3+
project(SL_Tutorials)
4+
5+
#-----------------------------------------------------------------------------
6+
# Extension meta-information
7+
set(EXTENSION_HOMEPAGE "https://www.slicer.org/wiki/Documentation/Nightly/Extensions/SL_Tutorials")
8+
set(EXTENSION_CATEGORY "Tutorials")
9+
set(EXTENSION_CONTRIBUTORS "Sen Li (ETS)")
10+
set(EXTENSION_DESCRIPTION "This is a series of tutorial for 3D Slicer Extension module development.")
11+
set(EXTENSION_ICONURL "https://www.example.com/Slicer/Extensions/SL_Tutorials.png")
12+
set(EXTENSION_SCREENSHOTURLS "https://www.example.com/Slicer/Extensions/SL_Tutorials/Screenshots/1.png")
13+
set(EXTENSION_DEPENDS "NA") # Specified as a list or "NA" if no dependencies
14+
15+
#-----------------------------------------------------------------------------
16+
# Extension dependencies
17+
find_package(Slicer REQUIRED)
18+
include(${Slicer_USE_FILE})
19+
20+
#-----------------------------------------------------------------------------
21+
# Extension modules
22+
add_subdirectory(sl__US_SeqViewer)
23+
## NEXT_MODULE
24+
25+
#-----------------------------------------------------------------------------
26+
include(${Slicer_EXTENSION_GENERATE_CONFIG})
27+
include(${Slicer_EXTENSION_CPACK})
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# <a href="./../" style="text-decoration:none">3D Slicer Extension Tutorial: Step by Step</a>
2+
3+
4+
5+
## <a href="./" style="text-decoration:none">Step 04: Index SequenceBrowser</a>
6+
7+
<img src="sl_04__Summary.png" alt="isolated" width="1080"/>
Loading
Loading
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#-----------------------------------------------------------------------------
2+
set(MODULE_NAME sl__US_SeqViewer)
3+
4+
#-----------------------------------------------------------------------------
5+
set(MODULE_PYTHON_SCRIPTS
6+
${MODULE_NAME}.py
7+
)
8+
9+
set(MODULE_PYTHON_RESOURCES
10+
Resources/Icons/${MODULE_NAME}.png
11+
Resources/UI/${MODULE_NAME}.ui
12+
)
13+
14+
#-----------------------------------------------------------------------------
15+
slicerMacroBuildScriptedModule(
16+
NAME ${MODULE_NAME}
17+
SCRIPTS ${MODULE_PYTHON_SCRIPTS}
18+
RESOURCES ${MODULE_PYTHON_RESOURCES}
19+
WITH_GENERIC_TESTS
20+
)
21+
22+
#-----------------------------------------------------------------------------
23+
if(BUILD_TESTING)
24+
25+
# Register the unittest subclass in the main script as a ctest.
26+
# Note that the test will also be available at runtime.
27+
slicer_add_python_unittest(SCRIPT ${MODULE_NAME}.py)
28+
29+
# Additional build-time testing
30+
add_subdirectory(Testing)
31+
endif()
Lines changed: 179 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,179 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<ui version="4.0">
3+
<class>sl__US_SeqViewer</class>
4+
<widget class="qMRMLWidget" name="sl__US_SeqViewer">
5+
<property name="geometry">
6+
<rect>
7+
<x>0</x>
8+
<y>0</y>
9+
<width>485</width>
10+
<height>556</height>
11+
</rect>
12+
</property>
13+
<layout class="QVBoxLayout" name="verticalLayout">
14+
<item>
15+
<widget class="QLabel" name="label_Module">
16+
<property name="font">
17+
<font>
18+
<pointsize>14</pointsize>
19+
<weight>75</weight>
20+
<bold>true</bold>
21+
</font>
22+
</property>
23+
<property name="text">
24+
<string>Ultrasound Sequence Viewer</string>
25+
</property>
26+
</widget>
27+
</item>
28+
<item>
29+
<spacer name="verticalSpacer_8">
30+
<property name="orientation">
31+
<enum>Qt::Vertical</enum>
32+
</property>
33+
<property name="sizeType">
34+
<enum>QSizePolicy::Fixed</enum>
35+
</property>
36+
<property name="sizeHint" stdset="0">
37+
<size>
38+
<width>20</width>
39+
<height>10</height>
40+
</size>
41+
</property>
42+
</spacer>
43+
</item>
44+
<item>
45+
<layout class="QFormLayout" name="formLayout_SequenceBrowser">
46+
<item row="0" column="0">
47+
<widget class="QLabel" name="label_SequenceBrowser">
48+
<property name="text">
49+
<string>Sequence browser:</string>
50+
</property>
51+
</widget>
52+
</item>
53+
<item row="0" column="1">
54+
<widget class="qMRMLNodeComboBox" name="sequenceSelector">
55+
<property name="nodeTypes">
56+
<stringlist>
57+
<string>vtkMRMLSequenceBrowserNode</string>
58+
</stringlist>
59+
</property>
60+
<property name="showChildNodeTypes">
61+
<bool>false</bool>
62+
</property>
63+
<property name="addEnabled">
64+
<bool>false</bool>
65+
</property>
66+
<property name="removeEnabled">
67+
<bool>false</bool>
68+
</property>
69+
<property name="selectNodeUponCreation">
70+
<bool>true</bool>
71+
</property>
72+
</widget>
73+
</item>
74+
</layout>
75+
</item>
76+
<item>
77+
<layout class="QGridLayout" name="gridLayout_FrameSlider">
78+
<item row="1" column="2">
79+
<widget class="QLabel" name="label_FrameIndex">
80+
<property name="text">
81+
<string>N/A</string>
82+
</property>
83+
</widget>
84+
</item>
85+
<item row="1" column="1">
86+
<widget class="QSlider" name="slider_SeqFrame">
87+
<property name="sizePolicy">
88+
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
89+
<horstretch>0</horstretch>
90+
<verstretch>0</verstretch>
91+
</sizepolicy>
92+
</property>
93+
<property name="minimum">
94+
<number>1</number>
95+
</property>
96+
<property name="maximum">
97+
<number>99</number>
98+
</property>
99+
<property name="sliderPosition">
100+
<number>50</number>
101+
</property>
102+
<property name="orientation">
103+
<enum>Qt::Horizontal</enum>
104+
</property>
105+
</widget>
106+
</item>
107+
<item row="1" column="0">
108+
<widget class="QLabel" name="labelIndicator_Frame">
109+
<property name="text">
110+
<string>FrameIndex (from 1): </string>
111+
</property>
112+
</widget>
113+
</item>
114+
</layout>
115+
</item>
116+
<item>
117+
<spacer name="verticalSpacer">
118+
<property name="orientation">
119+
<enum>Qt::Vertical</enum>
120+
</property>
121+
<property name="sizeHint" stdset="0">
122+
<size>
123+
<width>20</width>
124+
<height>40</height>
125+
</size>
126+
</property>
127+
</spacer>
128+
</item>
129+
</layout>
130+
</widget>
131+
<customwidgets>
132+
<customwidget>
133+
<class>qMRMLNodeComboBox</class>
134+
<extends>QWidget</extends>
135+
<header>qMRMLNodeComboBox.h</header>
136+
</customwidget>
137+
<customwidget>
138+
<class>qMRMLWidget</class>
139+
<extends>QWidget</extends>
140+
<header>qMRMLWidget.h</header>
141+
<container>1</container>
142+
</customwidget>
143+
</customwidgets>
144+
<resources/>
145+
<connections>
146+
<connection>
147+
<sender>sl__US_SeqViewer</sender>
148+
<signal>mrmlSceneChanged(vtkMRMLScene*)</signal>
149+
<receiver>sequenceSelector</receiver>
150+
<slot>setMRMLScene(vtkMRMLScene*)</slot>
151+
<hints>
152+
<hint type="sourcelabel">
153+
<x>289</x>
154+
<y>439</y>
155+
</hint>
156+
<hint type="destinationlabel">
157+
<x>338</x>
158+
<y>19</y>
159+
</hint>
160+
</hints>
161+
</connection>
162+
<connection>
163+
<sender>slider_SeqFrame</sender>
164+
<signal>valueChanged(int)</signal>
165+
<receiver>label_FrameIndex</receiver>
166+
<slot>setNum(int)</slot>
167+
<hints>
168+
<hint type="sourcelabel">
169+
<x>333</x>
170+
<y>45</y>
171+
</hint>
172+
<hint type="destinationlabel">
173+
<x>559</x>
174+
<y>45</y>
175+
</hint>
176+
</hints>
177+
</connection>
178+
</connections>
179+
</ui>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
add_subdirectory(Python)
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
2+
#slicer_add_python_unittest(SCRIPT ${MODULE_NAME}ModuleTest.py)

0 commit comments

Comments
 (0)