]> Creatis software - bbtk.git/blob - packages/demo/bbs/appli/demoViewing1.bbs
Feature #1774
[bbtk.git] / packages / demo / bbs / appli / demoViewing1.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 description "3 slicers and a 3D view"
27 author "jpr@creatis.insa-lyon.fr"
28 category "demo"
29
30 // To show how easy it is to add smthing
31 // =====================================
32
33 load vtk
34 include wxvtk
35 load std
36 load itk
37 include vtk
38 include wx
39 load itkvtk
40 load gdcmvtk
41
42 include wxvtk/boxes/bbSimpleSlicer
43
44 new LayoutX4 main
45
46 new LayoutLine  upright
47 new LayoutLine  upleft
48 new LayoutLine  downleft
49 new LayoutSplit downright
50    set downright.Proportion 85
51
52 connect upright.Widget   main.Widget1
53 connect upleft.Widget    main.Widget2
54 connect downleft.Widget  main.Widget3
55 connect downright.Widget main.Widget4
56
57 # Here loads 'hola.mhd'
58 # ---------------------
59
60 include vtk/boxes/bbLoadHola
61 new LoadHola reader
62
63 # Have a look at exampleViewing1.1.bbs
64 # If you want to know how to read different images.
65
66 // We need that to set Sliders sizes
67
68 #Get image dimensions, ...
69 new ImageProperties mc
70    connect reader.Out mc.In
71
72 #Get number of column (X)
73 new GetVectorIntElement gveX
74    connect mc.Size gveX.In
75    set gveX.I 0
76
77 #Get number of rows (Y)
78 new GetVectorIntElement gveY
79    connect mc.Size gveY.In
80    set gveY.I 1
81
82 #Get number of planes  (Z)
83 new GetVectorIntElement gveZ
84    connect mc.Size gveZ.In
85    set gveZ.I 2
86 //print "Dim Z $gveZ.Out"
87
88 #Compute the number of the 'middle' slice on X axis
89 new Div div0
90   connect   gveX.Out div0.In1
91   set div0.In2 2
92
93 #Compute the number of the 'middle' slice on Y axis
94 new Div div1
95   connect   gveY.Out div1.In1
96   set div1.In2 2
97
98 #Compute the number of the 'middle' slice on Z axis
99 new Div div2
100   connect   gveZ.Out div2.In1
101   set div2.In2 2
102
103 // For X axis
104 new SimpleSlicer viewerUL
105   connect reader.Out viewerUL.In
106   connect viewerUL.Widget upleft.Widget1
107   #initial slice is the middle one
108   connect div0.Out viewerUL.Slice
109   #Slider size is the number of planes
110   connect  gveX.Out viewerUL.SliderSize
111   set viewerUL.SliderReactiveOnTrack 1
112   set viewerUL.Orientation 0
113   set viewerUL.SliderOrientation H
114   set viewerUL.SliderTitle "Planes YZ"
115
116 // For Y axis
117 new SimpleSlicer viewerUR
118   connect reader.Out viewerUR.In
119   connect viewerUR.Widget upright.Widget1
120   #initial slice is the middle one
121   connect div1.Out viewerUR.Slice
122   #Slider size is the number of planes
123   connect  gveY.Out viewerUR.SliderSize
124   set viewerUR.SliderReactiveOnTrack 1
125   set viewerUR.SliderOrientation H
126   set viewerUR.Orientation 1
127   set viewerUR.SliderTitle "Planes XZ"
128
129 // For Z axis
130 new SimpleSlicer viewerTD
131   connect reader.Out viewerTD.In
132   connect viewerTD.Widget downleft.Widget1
133   #initial slice is the middle one
134   connect div2.Out viewerTD.Slice
135   #Slider size is the number of planes
136   connect  gveZ.Out viewerTD.SliderSize
137   set viewerTD.SliderReactiveOnTrack 1
138   set viewerTD.SliderOrientation H
139   set viewerTD.Orientation 2
140   set viewerTD.SliderTitle "Planes XY"
141
142 //For 3D Viewer
143
144 new ImagePlanes planes
145   connect reader.Out planes.In
146
147 new Viewer3D viewer
148   connect planes.PlaneX viewer.Obs1
149   connect planes.PlaneY viewer.Obs2
150   connect planes.PlaneZ viewer.Obs3
151
152 new CheckBox   chkbox
153   set chkbox.Title "Interpolate Pixels (in '2D' images)"
154   set chkbox.In 1
155   connect chkbox.BoxChange   viewerUL.BoxExecute
156   connect chkbox.BoxChange   viewerUR.BoxExecute
157   connect chkbox.BoxChange   viewerTD.BoxExecute
158
159   connect viewer.Widget downright.Widget1
160   connect chkbox.Widget downright.Widget2
161
162   connect chkbox.Out viewerUL.Interpolate
163   connect chkbox.Out viewerUR.Interpolate
164   connect chkbox.Out viewerTD.Interpolate
165
166 set main.WinTitle "demoViewing1"
167 exec main
168 exec viewerTD