1 # ---------------------------------------------------------------------
3 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
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
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.
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
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 # ------------------------------------------------------------------------ */
26 description "3 slicers and a 3D view"
27 author "jpr@creatis.insa-lyon.fr"
28 category "example, tool"
30 // To show how easy it is to add smthing
31 // =====================================
42 include wxvtk/boxes/bbSimpleSlicer
46 new LayoutLine upright
48 new LayoutLine downleft
49 new LayoutSplit downright
50 set downright.Proportion 85
52 connect upright.Widget main.Widget1
53 connect upleft.Widget main.Widget2
54 connect downleft.Widget main.Widget3
55 connect downright.Widget main.Widget4
57 # Use new box (choose the way you want to select images)
58 # -----------------------------------------------------
60 new ImagesChooserDialogBox chooser
62 # Concatenate all the supposed-to-be consistent 2D images into a single vtkImageData
63 # WARNING : File names alphabetical order is suposed to be meaningful ...
65 new ConcatImages reader
66 connect chooser.Out reader.In
68 // Normally (?) the following lines {== BEGIN == / ==END ==}
69 // are now useless; let here as a reminder/example
70 // Don't remove them . JPRx
72 // ==== BEGIN ======================================================
75 # Dummy way to get only the first image from the chooser
76 # ------------------------------------------------------
78 new ImagesChooserDialogBox chooser
80 new GetVectorVtkImageDataElement reader
82 connect chooser.Out reader.In
85 # Here loads 'hola.mhd'
86 # ---------------------
88 # Don't forget to comment out the following 2 lines
89 # If you want to check someting else.
92 include vtk/boxes/bbLoadHola
96 # uncomment next lines to have a file selector
97 # --------------------------------------------
99 new FileSelector openFileDialog
100 new ImageReader reader
101 connect openFileDialog.Out reader.In
104 # uncomment next lines to use a vtkgdcmReader
105 # -------------------------------------
107 new FileSelector openFileDialog
108 new GetInfoGdcmReader reader
109 connect openFileDialog.Out reader.In
112 # uncomment next lines to use Gimmick
113 # -----------------------------------
119 # uncomment next lines to Read a MHD file (and nothing else !)
120 # ------------------------------------------------------------
122 new FileSelector openFileDialog
123 set openFileDialog.Wildcard "(*.mhd)|*.mhd"
124 new MetaImageReader reader
125 connect openFileDialog.Out reader.In
128 # uncomment the following lines to read a 3D images stack
129 # (only if file name order is meaningfull)
130 # -------------------------------------------------------
132 // To choose the directory
133 new DirectorySelector ds
134 // To get the image names into a vector
135 new FilesFromDirectory fd
136 // To read all the files, as a bbitk::ImagePointer
137 new ImageSeriesReader reader
138 // user choosen directory as input
140 set fd.Recursive false
141 // list of files as input
142 #print "Files found in $ds.Out$\n
143 connect fd.Out reader.FileNames
146 # uncomment the following lines to read a 3D images stack
147 # (if the directory contains a 'XCoherent" Serie)
148 # -------------------------------------------------------
150 // To choose the directory
151 new DirectorySelector ds
152 // To get the image names into a vector
153 new FilesFromDirectory fd
154 // user choosen directory as input
156 // order the files, computes an accurate ZSpacing
157 new GetXCoherentInfoGdcmReader reader
158 connect fd.Out reader.In
161 # uncomment the following lines to read a 3D images stack
162 # (with DICOMDirReader)
163 # -------------------------------------------------------
165 include itk/boxes/bbDICOMDirReader
166 // To choose the directory
167 new DirectorySelector ds
168 new DICOMDirReader reader
169 connect ds.Out reader.In
172 // ==== END ======================================================
174 // We need that to set Sliders sizes
176 #Get image dimensions, ...
177 new ImageProperties mc
178 connect reader.Out mc.In
180 #Get number of column (X)
181 new GetVectorIntElement gveX
182 connect mc.Size gveX.In
185 #Get number of rows (Y)
186 new GetVectorIntElement gveY
187 connect mc.Size gveY.In
190 #Get number of planes (Z)
191 new GetVectorIntElement gveZ
192 connect mc.Size gveZ.In
194 //print "Dim Z $gveZ.Out"
196 #Compute the number of the 'middle' slice on X axis
198 connect gveX.Out div0.In1
201 #Compute the number of the 'middle' slice on Y axis
203 connect gveY.Out div1.In1
206 #Compute the number of the 'middle' slice on Z axis
208 connect gveZ.Out div2.In1
212 new SimpleSlicer viewerUL
213 connect reader.Out viewerUL.In
214 connect viewerUL.Widget upleft.Widget1
215 #initial slice is the middle one
216 connect div0.Out viewerUL.Slice
217 #Slider size is the number of planes
218 connect gveX.Out viewerUL.SliderSize
219 set viewerUL.SliderReactiveOnTrack 1
220 set viewerUL.Orientation 0
221 set viewerUL.SliderOrientation H
222 set viewerUL.SliderTitle "Planes YZ"
225 new SimpleSlicer viewerUR
226 connect reader.Out viewerUR.In
227 connect viewerUR.Widget upright.Widget1
228 #initial slice is the middle one
229 connect div1.Out viewerUR.Slice
230 #Slider size is the number of planes
231 connect gveY.Out viewerUR.SliderSize
232 set viewerUR.SliderReactiveOnTrack 1
233 set viewerUR.SliderOrientation H
234 set viewerUR.Orientation 1
235 set viewerUR.SliderTitle "Planes XZ"
238 new SimpleSlicer viewerTD
239 connect reader.Out viewerTD.In
240 connect viewerTD.Widget downleft.Widget1
241 #initial slice is the middle one
242 connect div2.Out viewerTD.Slice
243 #Slider size is the number of planes
244 connect gveZ.Out viewerTD.SliderSize
245 set viewerTD.SliderReactiveOnTrack 1
246 set viewerTD.SliderOrientation H
247 set viewerTD.Orientation 2
248 set viewerTD.SliderTitle "Planes XY"
252 new ImagePlanes planes
253 connect reader.Out planes.In
256 connect planes.PlaneX viewer.Obs1
257 connect planes.PlaneY viewer.Obs2
258 connect planes.PlaneZ viewer.Obs3
261 set chkbox.Title "Interpolate Pixels (in '2D' images)"
263 connect chkbox.BoxChange viewerUL.BoxExecute
264 connect chkbox.BoxChange viewerUR.BoxExecute
265 connect chkbox.BoxChange viewerTD.BoxExecute
267 connect viewer.Widget downright.Widget1
268 connect chkbox.Widget downright.Widget2
270 connect chkbox.Out viewerUL.Interpolate
271 connect chkbox.Out viewerUR.Interpolate
272 connect chkbox.Out viewerTD.Interpolate
274 set main.WinTitle "demoViewing1"