]> Creatis software - bbtk.git/blob - packages/vtk/bbs/old/exampleGaussianSmooth.bbs
Feature #1774
[bbtk.git] / packages / vtk / bbs / old / exampleGaussianSmooth.bbs
1 # ---------------------------------------------------------------------
2 #
3 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
4 #                        pour la SantÈ)
5 # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
6 # Previous Authors : Laurent Guigues, Jean-Pierre Roux
7 # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
8 #
9 #  This software is governed by the CeCILL-B license under French law and
10 #  abiding by the rules of distribution of free software. You can  use,
11 #  modify and/ or redistribute the software under the terms of the CeCILL-B
12 #  license as circulated by CEA, CNRS and INRIA at the following URL
13 #  http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
14 #  or in the file LICENSE.txt.
15 #
16 #  As a counterpart to the access to the source code and  rights to copy,
17 #  modify and redistribute granted by the license, users are provided only
18 #  with a limited warranty  and the software's author,  the holder of the
19 #  economic rights,  and the successive licensors  have only  limited
20 #  liability.
21 #
22 #  The fact that you are presently reading this means that you have had
23 #  knowledge of the CeCILL-B license and that you accept its terms.
24 # ------------------------------------------------------------------------ */
25
26
27 print "=== GaussianSmooth box example ==="
28 description "GaussianSmooth box example.  Screenshot : <img src=ExampleGaussianSmooth.JPG></img>"
29 author "eduardo.davila at creatis.insa-lyon.fr"
30 category "example"
31
32 include std
33 include vtk
34 include wx
35 include itk
36 include itkvtk
37 include wxvtk
38
39 new MetaImageReader reader 
40 include  std/boxes/bbPrependPackageDataPath.bbs 
41 new PrependPackageDataPath prependDatapath 
42   set prependDatapath.In "vtk/hola.mhd" 
43   connect prependDatapath.Out reader.In 
44
45 #---------------------------------------------------------------------
46
47 new Slider slider
48   set slider.Title "Slice"
49   set slider.Max        190
50   set slider.In         10
51   
52 #---------------------------------------------------------------------
53
54 new Viewer2D viewer2DImageOriginal
55   connect reader.Out                    viewer2DImageOriginal.In
56   connect slider.Out                    viewer2DImageOriginal.Slice
57   connect slider.BoxChange              viewer2DImageOriginal.BoxExecute
58     
59 #---------------------------------------------------------------------
60
61 new BinaryThresholdImageFilter threshold
62   set threshold.LowerThreshold 1000
63   set threshold.UpperThreshold 5000
64   set threshold.InsideValue 255
65   set threshold.OutsideValue 0
66   connect reader.Out threshold.In
67
68 new Viewer2D viewer2DImageSegmented
69   connect threshold.Out                 viewer2DImageSegmented.In
70   connect slider.Out                    viewer2DImageSegmented.Slice
71   connect slider.BoxChange              viewer2DImageSegmented.BoxExecute
72
73 #---------------------------------------------------------------------
74
75 new ImageGaussianSmooth smooth
76   connect threshold.Out smooth.In
77   set smooth.StdDevX  1
78   set smooth.StdDevY  1
79   set smooth.StdDevZ  1
80
81 new Viewer2D viewer2DImageSmooth
82   connect smooth.Out                    viewer2DImageSmooth.In
83   connect slider.Out                    viewer2DImageSmooth.Slice
84   connect slider.BoxChange              viewer2DImageSmooth.BoxExecute
85
86 #---------------------------------------------------------------------
87
88 new LayoutLine upLayout
89   set upLayout.Orientation H
90   connect viewer2DImageOriginal.Widget          upLayout.Widget1
91   connect viewer2DImageSegmented.Widget         upLayout.Widget2
92   connect viewer2DImageSmooth.Widget            upLayout.Widget3
93
94
95 #---------------------------------------------------------------------
96
97 new Viewer3D  viewernvImagethreshold3D
98 #  set viewernvImagethreshold3D.nTypeView "5" 
99
100 new IsoSurfaceExtractor  isoextractorthreshold
101   connect threshold.Out isoextractorthreshold.In
102   set isoextractorthreshold.Opacity 1
103   set isoextractorthreshold.Isovalue 128
104   connect viewernvImagethreshold3D.Renderer             isoextractorthreshold.Renderer
105
106
107 #---------------------------------------------------------------------
108 new Viewer3D  viewernvImageSmooth3D
109 #  set viewernvImageSmooth3D.nTypeView "5" 
110
111 new IsoSurfaceExtractor  isoextractorsmooth
112   connect smooth.Out isoextractorsmooth.In
113   set isoextractorsmooth.Opacity 1
114   set isoextractorsmooth.Isovalue 128
115   connect viewernvImageSmooth3D.Renderer                isoextractorsmooth.Renderer
116
117
118 #---------------------------------------------------------------------
119
120 new LayoutLine downLayout
121   set downLayout.Orientation H
122   connect viewernvImagethreshold3D.Widget               downLayout.Widget1
123   connect viewernvImageSmooth3D.Widget          downLayout.Widget2
124
125 #---------------------------------------------------------------------
126 new LayoutSplit splitDown
127   connect upLayout.Widget               splitDown.Widget1
128   connect downLayout.Widget             splitDown.Widget2
129
130 #---------------------------------------------------------------------
131 new LayoutSplit mainSplit
132   connect slider.Widget         mainSplit.Widget1
133   connect splitDown.Widget      mainSplit.Widget2
134
135
136
137 exec isoextractorthreshold
138 exec isoextractorsmooth
139 exec mainSplit