-
Notifications
You must be signed in to change notification settings - Fork 11
/
archiveCodeSnippetsSV2.html
240 lines (179 loc) · 9.95 KB
/
archiveCodeSnippetsSV2.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<title>SimVascular Docs</title>
<link href="css/bootstrap.css" rel="stylesheet" type="text/css" />
<link href="css/shop-item.css" rel="stylesheet" type="text/css" />
<link href="css/codestyle.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" href="font-awesome-4.1.0/css/font-awesome.min.css">
<link rel="stylesheet" href="https://code.ionicframework.com/ionicons/1.5.2/css/ionicons.min.css">
<link rel="shortcut icon" href="img/favicon.ico">
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<!-- Navigation -->
<nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
<div class="container">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-main-collapse">
<i class="fa fa-bars" id="barIcon"></i>
</button>
<a class="navbar-brand" id="brandName" href="index.html">
<img src="img/svlogo/svLogoSmallText.png" alt="...">
</a>
<a class="navbar-brand page-scroll">
2.0
</a>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse navbar-right navbar-main-collapse">
<ul class="nav navbar-nav">
<!-- USER GUIDES -->
<li>
<a href="#" id="dropdownMenu1" data-toggle="dropdown">
<b><span class="fa fa-user"></span> User Guides </b>
</a>
<ul class="dropdown-menu" role="menu" aria-labelledby="dropdownMenu1">
<li role="presentation"><a role="menuitem" tabindex="-1" href="archiveInstallationSV2.html"><b><span class="fa fa-sign-in fa-rotate-90"></span> Installation</b></a></li>
<li role="presentation" class="divider"></li>
<li role="presentation"><a role="menuitem" tabindex="-1" href="archiveQuickGuideSV2.html"><b><span class="icon ion-ios7-bolt"></span> Quick Guide</b></a></li>
<li role="presentation" class="divider"></li>
<li role="presentation"><a role="menuitem" tabindex="-1" href="archiveImageGuideSV2.html"><b><span class="icon ion-settings"></span> Image Visualization</b></a></li>
<li role="presentation"><a role="menuitem" tabindex="-1" href="archiveModelGuideSV2.html"><b><span class="icon ion-settings"></span> Modeling</b></a></li>
<li role="presentation"><a role="menuitem" tabindex="-1" href="archiveMeshingSV2.html"><b><span class="icon ion-ios7-keypad"></span> Meshing</b></a></li>
<li role="presentation"><a role="menuitem" tabindex="-1" href="archiveFlowSolverSV2.html"><b><span class="icon ion-play"></span> Simulation</b></a></li>
<li role="presentation" class="divider"></li>
<li role="presentation"><a role="menuitem" tabindex="-1" href="archiveCodeSnippetsSV2.html"><b><span class="icon ion-play"></span> Code Snippets</b></a></li>
</ul>
</li>
<!-- Latest version -->
<li>
<a href="docsQuickGuide.html" id="dropdownMenu1" >
<b>Back To Lastest Version</b>
</a>
</li>
<!-- <li><a href="docsQuickGuide.html" id="btnQuickGuide"><b><span class="icon ion-ios7-bolt"></span> Quick Guide</b></a></li>
<li><a href="docsModelGuide.html" id="btnModelGuide"><b><span class="icon ion-settings"></span> Modeling</b></a></li>
<li><a href="docsMeshing.html" id="btnMeshing"><b><span class="icon ion-ios7-keypad"></span> Meshing</b></a></li>
<li><a href="docsPresolver.html" id="btnPresolver"><b><span class="icon ion-log-in"></span> svPre</b></a></li>
<li><a href="docsFlowSolver.html" id="btnFlowSolver"><b><span class="icon ion-play"></span> svSolver</b></a></li>
<li><a href="docsRefs.html" id="btnRefs"><b><span class="icon ion-document-text"></span> References</b></a></li>
<li><a href="clinicalCase1.html" id="btnRefs"><b>Case Studies</b></a></li> -->
</ul>
</div>
<!-- /.navbar-collapse -->
</div>
<!-- /.container -->
</nav>
<!-- Page Content -->
<!--Nav Bar -->
<div class="row">
<div class="col-xs-1 col-sm-1 hidden-md hidden-lg">
</div>
<!-- ONE COLUMN OF SPACE -->
<nav class="hidden-xs hidden-sm col-md-2 col-lg-2 bs-docs-sidebar">
<ul id="sidebar" class="nav nav-stacked fixed manCodeSnippetsSV2"> <!--Nav Bar -->
<p><h3>Code Snippets</h3></p>
<li><a href="#main">Introduction</a></li>
<li><a href="#loadimage">Load image data from console</a></li>
<li><a href="#polytovolume">Polydata to image data</a></li>
<li><a href="#restoregroups">Restore groups <br>for segmentation</a>
<li><a href="#writemetaimage">Write *.mha image</a>
<li><a href="#writemodeltovolume">Write model to volume</a>
</ul>
</nav>
<!--Main Content -->
<div class="col-xs-10 col-sm-10 col-md-9 col-lg-9" id="manualContent">
<!-- ACTUAL CONTENT -->
<div class="manCodeSnippetsSV2"> <section id="main" class="group"><h2>tcl Code Snippets</h2>
<p>Common tcl console scripts are listed in this section. They can be extremely useful to create macros in SimVascular or to quickly perform sequences of operations without having to interact with the GUI. </p>
</section>
<section id="loadimage" class="group"><h4>Load image and path programatically</h4>
<p>This script shows how to import VTI image data and segmentation paths using the SimVascular console. </p>
<pre class="highlight tcl"><code><span class="k">set</span> home <span class="nv">$env</span><span class="p">(</span>HOME<span class="p">)</span> # you can use the home variable.
<span class="k">global</span> gImageVol
<span class="k">set</span> gImageVol<span class="p">(</span>xml_filename<span class="p">)</span> <span class="s2">"</span><span class="nv">$home</span><span class="s2">/path/to/vti/sample_data-cm.vti"</span>
createPREOPloadsaveLoadVol
<span class="k">global</span> gFilenames
<span class="k">set</span> gFilenames<span class="p">(</span>path_file<span class="p">)</span> <span class="s2">"</span><span class="nv">$home</span><span class="s2">/path/to/pathsfile/0110_0001-cm.paths"</span>
guiFNMloadHandPaths
</code></pre>
<hr>
<p><br></p>
</section>
<section id="polytovolume" class="group"><h4>Convert arbitrary polydata to volume</h4>
<p>This macro convert arbitrary polydata to volume data. </p>
<pre class="highlight tcl"><code>seg_convertPdtoVolume pdName volName
</code></pre>
<hr>
<p><br></p>
</section>
<section id="restoregroups" class="group"><h4>Restore loaded groups to segmentations for manipulation</h4>
<p>This macro puts 2D lofted segmentations back into the segmentation window so you can view them in the 2d windows.
Use at your own risk, it the paths have moved, then it may fail.</p>
<pre class="highlight tcl"><code>group_restorePreopSegs groupName
</code></pre>
<hr>
<p><br></p>
</section>
<section id="writemetaimage" class="group"><h4>Write a meta image volume</h4>
<p>You can export any volume to a meta image volume file *.mha.
For example, <code>volume_image</code> contains the current loaded image volume</p>
<pre class="highlight tcl"><code>seg_writeVolumeMha volume_image <span class="s2">"filename.mha"</span>
</code></pre>
<hr>
<p><br></p>
</section>
<section id="writemodeltovolume" class="group"><h4>Write current loaded model to volume (must be displayed)</h4>
<pre class="highlight tcl"><code>seg_convertModeltoVolume volName
seg_writeVolumeMha volName <span class="s2">"filename.mha"</span>
</code></pre>
<hr>
<p><br></p>
</section>
</div>
</div>
</div>
<!-- /.container -->
<nav class="navbar navbar-default navbar-fixed-bottom">
<div class="container-fluid text-center">
<ul class="nav navbar-nav">
<li><a>Copyright © SimVascular Development Team - 2017</a></li>
</ul>
</div>
<!-- /.container -->
</nav>
<script src="js/jquery-1.11.0.js" type="text/javascript"></script><script src="js/bootstrap.min.js" type="text/javascript"></script>
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]}
});
$('body').scrollspy({
target: '.bs-docs-sidebar',
offset: 40
});
</script>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-55333921-1', 'auto');
ga('send', 'pageview');
</script>
<script type="text/javascript"
src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
</script>
</body>
</html>