-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhow_to_create_a_python_plugin_for_mitk.html
491 lines (453 loc) · 30.1 KB
/
how_to_create_a_python_plugin_for_mitk.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
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
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
<!DOCTYPE html>
<html lang="en-US">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="author" content="Luis Javier Salvatierra" />
<meta name="copyright" content="Luis Javier Salvatierra" />
<meta name="description" content="A manual on how to create a simple Python plugin for MITK.
" />
<meta name="twitter:creator" content="@neuritabcc">
<meta property="og:type" content="article" />
<meta name="twitter:card" content="summary">
<meta name="keywords" content="MITK, python, MITK, python, " />
<meta property="og:title" content="How to create a Python plugin for MITK "/>
<meta property="og:url" content="https://neurita.github.io/how_to_create_a_python_plugin_for_mitk" />
<meta property="og:description" content="A manual on how to create a simple Python plugin for MITK." />
<meta property="og:site_name" content="Neurita" />
<meta property="og:article:author" content="Luis Javier Salvatierra" />
<meta property="og:article:published_time" content="2015-08-20T00:00:00+02:00" />
<meta property="" content="2015-09-02T00:00:00+02:00" />
<meta name="twitter:title" content="How to create a Python plugin for MITK ">
<meta name="twitter:description" content="A manual on how to create a simple Python plugin for MITK.">
<meta property="og:image" content="./theme/images/neurita_logo.png" />
<meta name="twitter:image" content="./theme/images/neurita_logo.png" >
<title>How to create a Python plugin for MITK · Neurita
</title>
<link href="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/css/bootstrap-combined.min.css" rel="stylesheet">
<link href="//netdna.bootstrapcdn.com/font-awesome/4.0.1/css/font-awesome.css" rel="stylesheet">
<link rel="stylesheet" href="https://neurita.github.io/theme/webassets-external/c4691ff2412e3e4a3e2905a3cd54d29d_pygments.css">
<link rel="stylesheet" href="https://neurita.github.io/theme/webassets-external/537ed18c24387a34b4028fb051b3ee7c_tipuesearch.css">
<link rel="stylesheet" href="https://neurita.github.io/theme/webassets-external/dce14d39c12bd8c36875e686907cf0a6_elegant.css">
<link rel="stylesheet" href="https://neurita.github.io/theme/webassets-external/1bf0b805e60393cbb326e80cf8efc4f4_custom.css">
<link rel="shortcut icon" href="https://neurita.github.io/theme/images/favicon.ico" type="image/x-icon" type="image/png" />
<link rel="icon" href="https://neurita.github.io/theme/images/apple-touch-icon-152x152.png" type="image/png" />
<link rel="apple-touch-icon" href="https://neurita.github.io/theme/images/apple-touch-icon.png" type="image/png" />
<link rel="apple-touch-icon" sizes="57x57" href="https://neurita.github.io/theme/images/apple-touch-icon-57x57.png" type="image/png" />
<link rel="apple-touch-icon" sizes="72x72" href="https://neurita.github.io/theme/images/apple-touch-icon-72x72.png" type="image/png" />
<link rel="apple-touch-icon" sizes="76x76" href="https://neurita.github.io/theme/images/apple-touch-icon-76x76.png" type="image/png" />
<link rel="apple-touch-icon" sizes="114x114" href="https://neurita.github.io/theme/images/apple-touch-icon-114x114.png" type="image/png" />
<link rel="apple-touch-icon" sizes="120x120" href="https://neurita.github.io/theme/images/apple-touch-icon-120x120.png" type="image/png" />
<link rel="apple-touch-icon" sizes="144x144" href="https://neurita.github.io/theme/images/apple-touch-icon-144x144.png" type="image/png" />
<link rel="apple-touch-icon" sizes="152x152" href="https://neurita.github.io/theme/images/apple-touch-icon-152x152.png" type="image/png" />
<link href="https://neurita.github.io/feeds/all.atom.xml" type="application/atom+xml" rel="alternate" title="Neurita - Full Atom Feed" />
<link href="https://neurita.github.io/feeds/all.rss.xml" type="application/rss+xml" rel="alternate" title="Neurita - Full RSS Feed" />
</head>
<body>
<div id="content-sans-footer">
<div class="navbar navbar-static-top">
<div class="navbar-inner">
<div class="container-fluid">
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<a class="brand" href="https://neurita.github.io/"><span class=site-name><span style="color:blue;">Neurita</span></span></a>
<div class="nav-collapse collapse">
<ul class="nav pull-right top-menu">
<li ><a href="https://neurita.github.io">Home</a></li>
<li ><a href="https://neurita.github.io/categories.html">Categories</a></li>
<li ><a href="https://neurita.github.io/tags.html">Tags</a></li>
<li ><a href="https://neurita.github.io/archives.html">Archives</a></li>
<li><form class="navbar-search" action="https://neurita.github.io/search.html" onsubmit="return validateForm(this.elements['q'].value);"> <input type="text" class="search-query" placeholder="Search" name="q" id="tipue_search_input"></form></li>
</ul>
</div>
</div>
</div>
</div>
<div class="container-fluid">
<div class="row-fluid">
<div class="span1"></div>
<div class="span10">
<article>
<div class="row-fluid">
<header class="page-header span10 offset2">
<h1><a href="https://neurita.github.io/how_to_create_a_python_plugin_for_mitk"> How to create a Python plugin for <span class="caps">MITK</span> </a></h1>
</header>
</div>
<div class="row-fluid">
<div class="span2 table-of-content">
<nav>
<h4>Contents</h4>
<div class="toc">
<ul>
<li><a href="#plugins-examples">Plugins examples</a></li>
<li><a href="#creating-a-mitk-plugin">Creating a <span class="caps">MITK</span> plugin</a></li>
<li><a href="#creating-a-mitk-plugin_1">Creating a <span class="caps">MITK</span> plugin</a><ul>
<li><a href="#modify-your-plugin">Modify your plugin</a></li>
<li><a href="#embed-python-in-the-new-plugin">Embed Python in the new plugin</a><ul>
<li><a href="#interact-with-mitk-python-service">Interact with <a href="http://docs.mitk.org/2015.05/classmitk_1_1PythonService.html" target="_blank">Mitk Python Service</a>.</a></li>
</ul>
</li>
<li><a href="#build-mitk-with-your-new-plugin">Build <span class="caps">MITK</span> with your new plugin</a></li>
</ul>
</li>
<li><a href="#creating-a-mitk-project">Creating a <span class="caps">MITK</span> project</a><ul>
<li><a href="#modify-your-projectplugin">Modify your project/plugin</a></li>
<li><a href="#build-your-new-project">Build your new project</a></li>
</ul>
</li>
<li><a href="#test-it">Test it!</a></li>
</ul>
</div>
</nav>
</div>
<div class="span8 article-content">
<h2 id="plugins-examples">Plugins examples<a class="headerlink" href="#plugins-examples" title="Permanent link">¶</a></h2>
<ul>
<li><a href="https://github.com/ljsalvatierra/mitk-plugins" target="_blank"><span class="caps">MITK</span> plugins</a>.</li>
<li><a href="https://github.com/ljsalvatierra/mitk-projects" target="_blank"><span class="caps">MITK</span> projects</a>.</li>
</ul>
<h2 id="creating-a-mitk-plugin">Creating a <span class="caps">MITK</span> plugin<a class="headerlink" href="#creating-a-mitk-plugin" title="Permanent link">¶</a></h2>
<ul>
<li>
<p>For more information, go to <a href="http://docs.mitk.org/2015.05/NewPluginPage.html" target="_blank"><code>MitkPluginGenerator</code></a>.</p>
</li>
<li>
<p>There are two ways of accomplish the same result.:</p>
</li>
<li>
<p><a href="#creating-a-mitk-plugin">Creating a <span class="caps">MITK</span> plugin</a>.:</p>
</li>
</ul>
<div class="highlight"><pre><span></span>$ ./MitkPluginGenerator --plugin-symbolic-name org.mycompany.myplugin --view-name <span class="s2">"My View"</span>
</pre></div>
<ul>
<li><a href="#creating-a-mitk-project">Creating a <span class="caps">MITK</span> project</a> (recommended).:</li>
</ul>
<div class="highlight"><pre><span></span>$ ./MitkPluginGenerator --plugin-symbolic-name org.mycompany.myplugin --view-name <span class="s2">"My View"</span> <span class="se">\</span>
--project-name <span class="s2">"MyProject"</span> --project-app-name <span class="s2">"MyApp"</span>
</pre></div>
<p>It is recommended to take the second approach because you only have to build <span class="caps">MITK</span> once.
With the first approach you would have to rebuild <span class="caps">MITK</span> every time you make a change to
your plugin/s, instead, with the second approach, each time you make a change to your plugin,
you only have to compile your project.</p>
<h2 id="creating-a-mitk-plugin_1">Creating a <span class="caps">MITK</span> plugin<a class="headerlink" href="#creating-a-mitk-plugin_1" title="Permanent link">¶</a></h2>
<div class="highlight"><pre><span></span>$ /path/to/MITK-build/bin/MitkPluginGenerator -h
$ /path/to/MITK-build/bin/MitkPluginGenerator --out-dir /output/directory <span class="se">\</span>
--vendor Plugin_vendor_name --view-name <span class="s2">"My View"</span> --plugin-symbolic-name org.mycompany.myplugin
$ <span class="nb">cd</span> /output/directory <span class="o">&&</span> ls
org.mycompany.myplugin
$ <span class="nb">cd</span> org.mycompany.myplugin <span class="o">&&</span> ls
CMakeLists.txt documentation files.cmake manifest_headers.cmake plugin.xml resources src
</pre></div>
<ul>
<li>Modify <span class="caps">MITK</span> to build with the new plugin.:</li>
</ul>
<div class="highlight"><pre><span></span>$ cp -r ../org.mycompany.myplugin /path/to/MITK/Plugins <span class="o">&&</span> <span class="nb">cd</span> /path/to/MITK/Plugins
$ vim PluginList.cmake
<span class="c1"># Add your plugin with the flag 'ON'.</span>
</pre></div>
<div class="highlight"><pre><span></span><span class="nb">set</span><span class="p">(</span><span class="s">MITK_PLUGINS</span>
<span class="s">org.mycompany.myplugin:ON</span>
<span class="s">org.blueberry.core.runtime:ON</span>
<span class="s">...</span>
</pre></div>
<ul>
<li>Set a new <span class="caps">CTK</span> Plugin in <code>CMakeLists.txt</code>.:</li>
</ul>
<div class="highlight"><pre><span></span>$ <span class="nb">cd</span> /path/to/MITK
$ vim CMakeLists.txt
<span class="c1"># Search the string 'set(re_ctkplugin'</span>
/set<span class="o">(</span>re_ctkplugin
</pre></div>
<ul>
<li>Modify it to look like this.:</li>
</ul>
<div class="highlight"><pre><span></span><span class="c"># Specify which plug-ins belong to this project</span>
<span class="nb">macro</span><span class="p">(</span><span class="s">GetMyTargetLibraries</span> <span class="s">all_target_libraries</span> <span class="s">varname</span><span class="p">)</span>
<span class="nb">set</span><span class="p">(</span><span class="s">re_ctkplugin_mitk</span> <span class="s2">"^org_mitk_[a-zA-Z0-9_]+$"</span><span class="p">)</span>
<span class="nb">set</span><span class="p">(</span><span class="s">re_ctkplugin_bb</span> <span class="s2">"^org_blueberry_[a-zA-Z0-9_]+$"</span><span class="p">)</span>
<span class="nb">set</span><span class="p">(</span><span class="s">re_ctkplugin_mycompany</span> <span class="s2">"^org_mycompany_[a-zA-Z0-9_]+$"</span><span class="p">)</span>
<span class="nb">set</span><span class="p">(</span><span class="s">_tmp_list</span><span class="p">)</span>
<span class="nb">list</span><span class="p">(</span><span class="s">APPEND</span> <span class="s">_tmp_list</span> <span class="o">${</span><span class="nv">all_target_libraries</span><span class="o">}</span><span class="p">)</span>
<span class="nb">ctkMacroListFilter</span><span class="p">(</span><span class="s">_tmp_list</span> <span class="s">re_ctkplugin_mitk</span> <span class="s">re_ctkplugin_bb</span> <span class="s">re_ctkplugin_mycompany</span> <span class="s">OUTPUT_VARIABLE</span> <span class="o">${</span><span class="nv">varname</span><span class="o">}</span><span class="p">)</span>
<span class="nb">endmacro</span><span class="p">()</span>
</pre></div>
<div class="highlight"><pre><span></span>`set(re_ctkplugin_`**`mycompany "^org_mycompany_[a-zA-Z0-9_]+$"`**`)`
`ctkMacroListFilter(_tmp_list re_ctkplugin_mitk re_ctkplugin_bb `**`re_ctkplugin_mycompany`**` OUTPUT_VARIABLE <span class="cp">${</span><span class="n">varname</span><span class="cp">}</span>)`
</pre></div>
<h3 id="modify-your-plugin">Modify your plugin<a class="headerlink" href="#modify-your-plugin" title="Permanent link">¶</a></h3>
<ul>
<li>Add Python module dependency to the plugin <code>CMakeLists.txt</code>.</li>
</ul>
<div class="highlight"><pre><span></span><span class="nb">mitk_create_plugin</span><span class="p">(</span>
<span class="s">EXPORT_DIRECTIVE</span> <span class="s">EXAMPLE_EXPORT</span>
<span class="s">EXPORTED_INCLUDE_SUFFIXES</span> <span class="s">src</span>
<span class="s">MODULE_DEPENDS</span> <span class="s">MitkQtWidgetsExt</span> <span class="s">MitkPython</span>
<span class="p">)</span>
</pre></div>
<h3 id="embed-python-in-the-new-plugin">Embed Python in the new plugin<a class="headerlink" href="#embed-python-in-the-new-plugin" title="Permanent link">¶</a></h3>
<h4 id="interact-with-mitk-python-service">Interact with <a href="http://docs.mitk.org/2015.05/classmitk_1_1PythonService.html" target="_blank">Mitk Python Service</a>.<a class="headerlink" href="#interact-with-mitk-python-service" title="Permanent link">¶</a></h4>
<p>When we create a plugin with <code>MitkPluginGenerator</code> the default view contains a button <code>Do something</code>. Each time we press that button, it calls the function <code>DoImageProcessing()</code> that prints a message in the console/terminal.</p>
<div class="highlight"><pre><span></span><span class="c1">// MyView.cpp</span>
<span class="p">...</span>
<span class="c1">// Add the Python Service header</span>
<span class="cp">#include</span> <span class="cpf"><mitkPythonService.h></span><span class="cp"></span>
<span class="p">...</span>
<span class="c1">// If you followed the instructions then you have the default plugin</span>
<span class="c1">// with this function</span>
<span class="kt">void</span> <span class="n">MyView</span><span class="o">::</span><span class="n">DoImageProcessing</span><span class="p">()</span>
<span class="p">{</span>
<span class="n">QList</span><span class="o"><</span><span class="n">mitk</span><span class="o">::</span><span class="n">DataNode</span><span class="o">::</span><span class="n">Pointer</span><span class="o">></span> <span class="n">nodes</span> <span class="o">=</span> <span class="k">this</span><span class="o">-></span><span class="n">GetDataManagerSelection</span><span class="p">();</span>
<span class="k">if</span> <span class="p">(</span><span class="n">nodes</span><span class="p">.</span><span class="n">empty</span><span class="p">())</span> <span class="k">return</span><span class="p">;</span>
<span class="n">mitk</span><span class="o">::</span><span class="n">DataNode</span><span class="o">*</span> <span class="n">node</span> <span class="o">=</span> <span class="n">nodes</span><span class="p">.</span><span class="n">front</span><span class="p">();</span>
<span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="n">node</span><span class="p">)</span>
<span class="p">{</span>
<span class="c1">// Nothing selected. Inform the user and return</span>
<span class="n">QMessageBox</span><span class="o">::</span><span class="n">information</span><span class="p">(</span> <span class="nb">NULL</span><span class="p">,</span> <span class="s">"Template"</span><span class="p">,</span> <span class="s">"Please load and select an image before starting image processing."</span><span class="p">);</span>
<span class="k">return</span><span class="p">;</span>
<span class="p">}</span>
<span class="p">...</span>
</pre></div>
<ul>
<li>Add this two line example to the end of the function <code>DoImageProcessing()</code>.:</li>
</ul>
<div class="highlight"><pre><span></span> <span class="p">...</span>
<span class="n">message</span> <span class="o"><<</span> <span class="s">"."</span><span class="p">;</span>
<span class="c1">//MITK_INFO << message.str();</span>
<span class="c1">// Each time we press that button will print `Hello World!` in the console/terminal</span>
<span class="c1">// First we interact with mitkPythonService and execute a simple Python function.</span>
<span class="n">itk</span><span class="o">::</span><span class="n">SmartPointer</span><span class="o"><</span><span class="n">mitk</span><span class="o">::</span><span class="n">PythonService</span><span class="o">></span> <span class="n">_PythonService</span><span class="p">(</span><span class="k">new</span> <span class="n">mitk</span><span class="o">::</span><span class="n">PythonService</span><span class="p">());</span>
<span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="n">result</span> <span class="o">=</span> <span class="n">_PythonService</span><span class="o">-></span><span class="n">Execute</span><span class="p">(</span> <span class="s">"print ('Hello World!')"</span><span class="p">,</span> <span class="n">mitk</span><span class="o">::</span><span class="n">IPythonService</span><span class="o">::</span><span class="n">SINGLE_LINE_COMMAND</span> <span class="p">);</span>
<span class="n">message</span> <span class="o"><<</span> <span class="s">"</span><span class="se">\n</span><span class="s">"</span><span class="p">;</span>
<span class="n">message</span> <span class="o"><<</span> <span class="n">result</span> <span class="o"><<</span> <span class="s">"</span><span class="se">\n</span><span class="s">"</span><span class="p">;</span>
<span class="n">MITK_INFO</span> <span class="o"><<</span> <span class="n">message</span><span class="p">.</span><span class="n">str</span><span class="p">();</span>
<span class="p">...</span>
</pre></div>
<h3 id="build-mitk-with-your-new-plugin">Build <span class="caps">MITK</span> with your new plugin<a class="headerlink" href="#build-mitk-with-your-new-plugin" title="Permanent link">¶</a></h3>
<div class="highlight"><pre><span></span>$ <span class="nb">cd</span> /path/to/MITK-build <span class="c1">#Clean directory</span>
$ ccmake ../MITK
<span class="c1"># Build with the option MITK_USE_PYTHON enabled.</span>
<span class="c1"># Configure and enable the option MITK_USE_SYSTEM_PYTHON</span>
<span class="c1"># Configure and toggle the advance view.</span>
<span class="c1"># Modify the Python path, library path and debug path, to use Python2.7 instead of Python3.4 or Python3.4m.</span>
<span class="c1"># Configure again and generate.</span>
$ make
<span class="c1"># The last command will take several hours.</span>
</pre></div>
<h2 id="creating-a-mitk-project">Creating a <span class="caps">MITK</span> project<a class="headerlink" href="#creating-a-mitk-project" title="Permanent link">¶</a></h2>
<div class="highlight"><pre><span></span>$ mkdir MITK-projects <span class="o">&&</span> <span class="nb">cd</span> MITK-projects
$ /path/to/MitkPluginGenerator -h
$ /path/to/MitkPluginGenerator --plugin-symbolic-name org.mycompany.myplugin <span class="se">\</span>
--view-name <span class="s2">"My View"</span> --project-name <span class="s2">"MyProject"</span> --project-app-name <span class="s2">"MyApp"</span>
$ <span class="nb">cd</span> MyProject <span class="o">&&</span> ls
Apps build CMake CMakeExternals CMakeLists.txt LICENSE.txt Plugins SuperBuild.cmake
</pre></div>
<h3 id="modify-your-projectplugin">Modify your project/plugin<a class="headerlink" href="#modify-your-projectplugin" title="Permanent link">¶</a></h3>
<div class="highlight"><pre><span></span>$ <span class="nb">cd</span> Plugins/org.mycompany.myplugin/src/internal <span class="o">&&</span> ls
org_mycompany_myplugin_Activator.cpp org_mycompany_myplugin_Activator.h MyViewControls.ui MyView.cpp MyView.h
$ vim MyView.cpp
</pre></div>
<ul>
<li>
<p><a href="#embed-python-in-the-new-plugin">Embed Python in the new plugin</a>. This part is shared between the two approaches.</p>
</li>
<li>
<p>Add Python module dependency to the plugin <code>CMakeLists.txt</code>.</p>
</li>
</ul>
<div class="highlight"><pre><span></span>$ vim /path/to/MyProject/Plugins/org.mycompany.myplugin/CMakeLists.txt
</pre></div>
<div class="highlight"><pre><span></span><span class="nb">project</span><span class="p">(</span><span class="s">org_mycompany_myplugin</span><span class="p">)</span>
<span class="nb">mitk_create_plugin</span><span class="p">(</span>
<span class="s">EXPORT_DIRECTIVE</span> <span class="s">MYPLUGIN_EXPORT</span>
<span class="s">EXPORTED_INCLUDE_SUFFIXES</span> <span class="s">src</span>
<span class="s">MODULE_DEPENDS</span> <span class="s">MitkQtWidgetsExt</span> <span class="s">MitkPython</span>
<span class="p">)</span>
</pre></div>
<h3 id="build-your-new-project">Build your new project<a class="headerlink" href="#build-your-new-project" title="Permanent link">¶</a></h3>
<div class="highlight"><pre><span></span>$ <span class="nb">cd</span> /path/to/MyProject
$ mkdir build <span class="o">&&</span> <span class="nb">cd</span> build
$ ccmake ..
</pre></div>
<p><img alt="Mitk Project" src="images/MITK_project_001.png"/></p>
<p><code>Press 't' to toggle advanced mode and specify the EXTERNAL_MITK_DIR</code></p>
<p><img alt="Mitk Project" src="images/MITK_project_002.png"/></p>
<p><code>Configure and look if there are any modules left</code></p>
<ul>
<li>For example.:<ul>
<li>MITK_BUILD_ALL_PLUGINS <span class="caps">ON</span></li>
<li>MITK_VTK_DIR /path/to/<span class="caps">MITK</span>-build/ep/share/vtk-6.2</li>
<li>MITK_OpenCV_DIR /path/to/<span class="caps">MITK</span>-build/ep/src/OpenCV-build</li>
<li>…</li>
</ul>
</li>
</ul>
<h2 id="test-it">Test it!<a class="headerlink" href="#test-it" title="Permanent link">¶</a></h2>
<ul>
<li>Open the <code>MitkWorkbench</code>:</li>
</ul>
<div class="highlight"><pre><span></span>$ /path/to/MITK-build/bin/MitkWorkbench
</pre></div>
<ul>
<li>Or open your Project Launcher:</li>
</ul>
<div class="highlight"><pre><span></span>$ /path/to/MyProject/build/MyProject-build/bin/MyApp
</pre></div>
<ul>
<li>Open your plugin view:</li>
</ul>
<p><img alt="Mitk Plugin" src="images/MITK_plugin_001.png"/></p>
<ul>
<li>Open a new image to be able to press the button <code>Do something</code>:</li>
</ul>
<p><img alt="Mitk Plugin" src="images/MITK_plugin_002.png"/></p>
<ul>
<li>You should see this when pressing the button <code>Do something</code>:</li>
</ul>
<p><img alt="Mitk Plugin" src="images/MITK_plugin_003.png"/></p>
<section>
<p id="post-share-links">
Like this post? Share on:
<a href="http://twitter.com/home?status=b'How%20to%20create%20a%20Python%20plugin%20for%20MITK%20https%3A//neurita.github.io/how_to_create_a_python_plugin_for_mitk'" target="_blank" title="Share on Twitter"><i class="fa fa-twitter share-post-links"></i></a>
<a href="http://www.facebook.com/sharer/sharer.php?s=100&p%5Burl%5D=https%3A//neurita.github.io/how_to_create_a_python_plugin_for_mitk" target="_blank" title="Share on Facebook"><i class="fa fa-facebook share-post-links"></i></a>
<a href="https://plus.google.com/share?url=https%3A//neurita.github.io/how_to_create_a_python_plugin_for_mitk" target="_blank" title="Share on Google Plus"><i class="fa fa-google-plus share-post-links"></i></a>
<a href="mailto:?subject=How%20to%20create%20a%20Python%20plugin%20for%20MITK&body=https%3A//neurita.github.io/how_to_create_a_python_plugin_for_mitk" target="_blank" title="Share via Email"><i class="fa fa-envelope share-post-links"></i></a>
</p>
</section>
<section>
<p id="comment-message">So what do you think? Did I miss something? Is any part unclear? Leave your comments below. </p>
<div class="accordion" id="accordion2">
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle disqus-comment-count" data-toggle="collapse" data-parent="#accordion2"
href="https://neurita.github.io/how_to_create_a_python_plugin_for_mitk#disqus_thread">
Comments
</a>
</div>
<div id="disqus_thread" class="accordion-body collapse">
<div class="accordion-inner">
<div class="comments">
<div id="disqus_thread"></div>
<script type="text/javascript">
var disqus_shortname = 'neurita';
var disqus_identifier = 'https://neurita.github.io/how_to_create_a_python_plugin_for_mitk';
var disqus_url = 'https://neurita.github.io/how_to_create_a_python_plugin_for_mitk';
(function() {
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
})();
</script>
<noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
<a href="http://disqus.com" class="dsq-brlink">comments powered by <span class="logo-disqus">Disqus</span></a>
</div>
</div>
</div>
</div>
</div>
</section>
<hr/>
<aside>
<nav>
<ul class="articles-timeline">
<li class="previous-article">« <a href="https://neurita.github.io/how_to_compile_mitk_on_docker" title="Previous: How to compile MITK on Docker">How to compile MITK on Docker</a></li>
<li class="next-article"><a href="https://neurita.github.io/how_to_interact_with_mitk_images_from_python" title="Next: How to interact with MITK images from Python">How to interact with MITK images from Python</a> »</li>
</ul>
</nav>
</aside>
</div>
<section>
<div class="span2" style="float:right;font-size:0.9em;">
<h4>Author</h4>
<div class="last-updated">Luis Javier Salvatierra</div> <h4>Published</h4>
<time pubdate="pubdate" datetime="2015-08-20T00:00:00+02:00">Aug 20, 2015</time>
<h4>Last Updated</h4>
<time datetime="2015-09-02T00:00:00+02:00">Sep 2, 2015</time>
<h4>Category</h4>
<a class="category-link" href="https://neurita.github.io/categories.html#mitk-python-ref">MITK, python</a>
<h4>Tags</h4>
<ul class="list-of-tags tags-in-article">
<li><a href="https://neurita.github.io/tags.html#mitk-ref">MITK
<span>4</span>
</a></li>
<li><a href="https://neurita.github.io/tags.html#python-ref">python
<span>2</span>
</a></li>
</ul>
<h4>Stay in Touch</h4>
<a href="http://twitter.com/neuritabcc" title="My Twitter Profile" class="sidebar-social-links" target="_blank">
<i class="fa fa-twitter sidebar-social-links"></i></a>
<a href="http://github.com/neurita" title="My Github Profile" class="sidebar-social-links" target="_blank">
<i class="fa fa-github sidebar-social-links"></i></a>
<a href="mailto:[email protected]" title="My Email Address" class="sidebar-social-links" target="_blank">
<i class="fa fa-envelope sidebar-social-links"></i></a>
</div>
</section>
</div>
</article>
</div>
<div class="span1"></div>
</div>
</div>
<div id="push"></div>
</div>
<footer>
<div id="footer">
<ul class="footer-content">
<li class="elegant-license"><span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">This blog</span> by <a xmlns:cc="http://creativecommons.org/ns#" href="http://www.neurita.com" property="cc:attributionName" rel="cc:attributionURL">Neurita developers</a> is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/deed.en_US">Creative Commons Attribution-ShareAlike 3.0 Unported License</a>.</li>
<li class="elegant-power">Powered by <a href="http://getpelican.com/" title="Pelican Home Page">Pelican</a>. Theme: <a href="http://oncrashreboot.com/pelican-elegant" title="Theme Elegant Home Page">Elegant</a> by <a href="http://oncrashreboot.com" title="Talha Mansoor Home Page">Talha Mansoor</a></li>
</ul>
</div>
</footer> <script src="http://code.jquery.com/jquery.min.js"></script>
<script src="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/js/bootstrap.min.js"></script>
<script>
function validateForm(query)
{
return (query.length > 0);
}
</script>
<script type="text/javascript">
var disqus_shortname = 'neurita';
(function () {
var s = document.createElement('script'); s.async = true;
s.type = 'text/javascript';
s.src = '//' + disqus_shortname + '.disqus.com/count.js';
(document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s);
}());
</script>
<script language="javascript" type="text/javascript">
function uncollapse() {
if (window.location.hash.match(/^#comment-\d+$/)) {
$('#disqus_thread').collapse('show');
}
}
</script>
<script type="text/javascript" language="JavaScript">
uncollapse();
window.onhashchange=function(){
if (window.location.hash.match(/^#comment-\d+$/))
window.location.reload(true);
}
</script>
<script>
$('#disqus_thread').on('shown', function () {
var link = document.getElementsByClassName('accordion-toggle');
var old_innerHTML = link[0].innerHTML;
$(link[0]).fadeOut(500, function() {
$(this).text('Click here to hide comments').fadeIn(500);
});
$('#disqus_thread').on('hidden', function () {
$(link[0]).fadeOut(500, function() {
$(this).text(old_innerHTML).fadeIn(500);
});
})
})
</script>
</body>
<!-- Theme: Elegant built for Pelican
License : http://oncrashreboot.com/pelican-elegant -->
</html>