1 description "3 slicers and a 3D view"
2 author "jpr@creatis.insa-lyon.fr"
5 // To show how easy it is to add smthing
6 // =====================================
17 include wxvtk/boxes/bbSimpleSlicer
21 new LayoutLine upright
23 new LayoutLine downleft
24 new LayoutSplit downright
25 set downright.Proportion 85
27 connect upright.Widget main.Widget1
28 connect upleft.Widget main.Widget2
29 connect downleft.Widget main.Widget3
30 connect downright.Widget main.Widget4
32 # Use new box (choose the way you want to select images)
33 # -----------------------------------------------------
35 new ImagesReader chooser
37 new ConcatImages reader
38 connect chooser.Out reader.In
40 // Normally (?) the following lines {== BEGIN == / ==END ==}
41 // are now useless; let here as a reminder/example
42 // Don't remove them . JPRx
44 // ==== BEGIN ======================================================
46 # Dummy way to get only the first image from the chooser
47 # ------------------------------------------------------
49 new ImagesReader chooser
51 new GetVectorVtkImageDataElement reader
53 connect chooser.Out reader.In
56 # Here loads 'hola.mhd'
57 # ---------------------
59 # Don't forget to comment out the following 2 lines
60 # If you want to check someting else.
63 include vtk/boxes/bbLoadHola
67 # uncomment next lines to have a file selector
68 # --------------------------------------------
70 new FileSelector openFileDialog
71 new ImageReader reader
72 connect openFileDialog.Out reader.In
75 # uncomment next lines to use a vtkgdcmReader
76 # -------------------------------------
78 new FileSelector openFileDialog
79 new GetInfoGdcmReader reader
80 connect openFileDialog.Out reader.In
83 # uncomment next lines to use Gimmick
84 # -----------------------------------
90 # uncomment next lines to Read a MHD file (and nothing else !)
91 # ------------------------------------------------------------
93 new FileSelector openFileDialog
94 set openFileDialog.Wildcard "(*.mhd)|*.mhd"
95 new MetaImageReader reader
96 connect openFileDialog.Out reader.In
99 # uncomment the following lines to read a 3D images stack
100 # (only if file name order is meaningfull)
101 # -------------------------------------------------------
103 // To choose the directory
104 new DirectorySelector ds
105 // To get the image names into a vector
106 new FilesFromDirectory fd
107 // To read all the files, as a bbitk::ImagePointer
108 new ImageSeriesReader reader
109 // user choosen directory as input
111 set fd.Recursive false
112 // list of files as input
113 #print "Files found in $ds.Out$\n
114 connect fd.Out reader.FileNames
117 # uncomment the following lines to read a 3D images stack
118 # (if the directory contains a 'XCoherent" Serie)
119 # -------------------------------------------------------
121 // To choose the directory
122 new DirectorySelector ds
123 // To get the image names into a vector
124 new FilesFromDirectory fd
125 // user choosen directory as input
127 // order the files, computes an accurate ZSpacing
128 new GetXCoherentInfoGdcmReader reader
129 connect fd.Out reader.In
132 # uncomment the following lines to read a 3D images stack
133 # (with DICOMDirReader)
134 # -------------------------------------------------------
136 include itk/boxes/bbDICOMDirReader
137 // To choose the directory
138 new DirectorySelector ds
139 new DICOMDirReader reader
140 connect ds.Out reader.In
143 // ==== END ======================================================
145 // We need that to set Sliders sizes
147 #Get image dimensions, ...
148 new ImageProperties mc
149 connect reader.Out mc.In
151 #Get number of column (X)
152 new GetVectorIntElement gveX
153 connect mc.Size gveX.In
156 #Get number of rows (Y)
157 new GetVectorIntElement gveY
158 connect mc.Size gveY.In
161 #Get number of planes (Z)
162 new GetVectorIntElement gveZ
163 connect mc.Size gveZ.In
165 //print "Dim Z $gveZ.Out"
167 #Compute the number of the 'middle' slice on X axis
169 connect gveX.Out div0.In1
172 #Compute the number of the 'middle' slice on Y axis
174 connect gveY.Out div1.In1
177 #Compute the number of the 'middle' slice on Z axis
179 connect gveZ.Out div2.In1
183 new SimpleSlicer viewerUL
184 connect reader.Out viewerUL.In
185 connect viewerUL.Widget upleft.Widget1
186 #initial slice is the middle one
187 connect div0.Out viewerUL.Slice
188 #Slider size is the number of planes
189 connect gveX.Out viewerUL.SliderSize
190 set viewerUL.SliderReactiveOnTrack 1
191 set viewerUL.Orientation 0
192 set viewerUL.SliderOrientation H
193 set viewerUL.SliderTitle "Planes YZ"
196 new SimpleSlicer viewerUR
197 connect reader.Out viewerUR.In
198 connect viewerUR.Widget upright.Widget1
199 #initial slice is the middle one
200 connect div1.Out viewerUR.Slice
201 #Slider size is the number of planes
202 connect gveY.Out viewerUR.SliderSize
203 set viewerUR.SliderReactiveOnTrack 1
204 set viewerUR.SliderOrientation H
205 set viewerUR.Orientation 1
206 set viewerUR.SliderTitle "Planes XZ"
209 new SimpleSlicer viewerTD
210 connect reader.Out viewerTD.In
211 connect viewerTD.Widget downleft.Widget1
212 #initial slice is the middle one
213 connect div2.Out viewerTD.Slice
214 #Slider size is the number of planes
215 connect gveZ.Out viewerTD.SliderSize
216 set viewerTD.SliderReactiveOnTrack 1
217 set viewerTD.SliderOrientation H
218 set viewerTD.Orientation 2
219 set viewerTD.SliderTitle "Planes XY"
223 new ImagePlanes planes
224 connect reader.Out planes.In
227 connect planes.PlaneX viewer.Obs1
228 connect planes.PlaneY viewer.Obs2
229 connect planes.PlaneZ viewer.Obs3
232 set chkbox.Title "Interpolate Pixels (in '2D' images)"
234 connect chkbox.BoxChange viewerUL.BoxExecute
235 connect chkbox.BoxChange viewerUR.BoxExecute
236 connect chkbox.BoxChange viewerTD.BoxExecute
238 connect viewer.Widget downright.Widget1
239 connect chkbox.Widget downright.Widget2
241 connect chkbox.Out viewerUL.Interpolate
242 connect chkbox.Out viewerUR.Interpolate
243 connect chkbox.Out viewerTD.Interpolate
245 set main.WinTitle "demoViewing1"