1151e0e211a57bc2f6e656f77a857b87905f26eb
[ctsim.git] / doc / ctsim-gui.tex
1 \chapter{The Graphical User Interface}\label{ctsim}\index{ctsim}%
2 \setheader{{\it CHAPTER \thechapter}}{}{}{\ctsimheadtitle}{}{{\it CHAPTER \thechapter}}%
3 \ctsimfooter%
4
5
6 \section{Overview}\index{Graphical shell}
7 \ctsim\ is the graphical shell for the CTSim project. This shell uses
8 the \urlref{wxWindows}{http://www.wxwindows.org} library for
9 cross-platform compatibility. The graphical shell is compatible
10 with Microsoft Windows, \urlref{GTK}{http://www.gtk.org}, and
11 \urlref{Motif}{http://www.openmotif.org} graphical environments.
12
13 \usage \texttt{ctsim [files to open...]}
14
15 You can invoke \ctsim\ by itself on the command line, or include
16 any number of files that you want \ctsim\ to
17 automatically open. \ctsim\ can open projection files, image
18 files, phantom files, and plot files.
19
20
21 \section{File Types}\index{File types}
22
23 \subsection{Phantom}
24 Besides loading phantom files from the disk, the Herman and
25 Shepp-Logan phantoms are built-in to \ctsim. Phantom files can be
26 read and stored on the disk. Phantom files are stored in a simple
27 ASCII format. A text editor is required to
28 create and edit these files.
29
30 \subsection{Image}
31 Image files are 2-dimensional files that store 4-byte floating
32 point values. Images files can be either real or complex valued.
33 Typically, all images are real except for images that have been
34 processed by Fourier transforms. As you might expect,
35 complex-valued images are twice the size of real-valued images
36 since both a real and imaginary component need to be store. When
37 complex-valued images are viewed on the screen, only the real
38 component is displayed.
39
40 Images files can also store any number of text labels. \ctsim\ uses
41 these labels for storing history information regarding
42 the creation and modifications of images.
43
44 \subsection{Projection}
45 Projection files are created from phantom files during the
46 projection process. Numerous options are available for the
47 creation of the these files. The files are stored in a binary
48 format with cross-platform compatibility on little and big endian
49 architectures.
50
51 \subsection{Plot}
52 Plot files are created by \ctsim\ during analysis of image files.
53 They can be read and stored on the disk. They are stored as ASCII
54 files for easy cross-platform support and editing.
55
56 \section{Global Menu Commands}
57 These global commands are present on the menus of all windows.
58
59 \subsection{File - Create Phantom}\label{IDH_DLG_PHANTOM}\index{Dialog!Create phantom}
60 This command brings up a dialog box showing the phantoms that are preprogrammed
61 into \ctsim. After selecting one of these phantoms, the new window with that
62 phantom will be generated. The preprogrammed phantoms are:
63
64 \begin{twocollist}
65 \twocolitem{\textbf{Herman}}{The Herman head phantom\cite{HERMAN80}}
66 \twocolitem{\textbf{Shepp-Logan}}{The head phantom of Shepp \& Logan\cite{SHEPP74}}
67 \twocolitem{\textbf{Unit pulse}}{A phantom that has a value of \texttt{1} for the
68 center of the phantom and \texttt{0} everywhere else.}
69 \end{twocollist}
70
71 \subsection{File - Create Filter}\label{IDH_DLG_FILTER}\index{Dialog!Create filter}
72 This command brings up a dialog box showing the pre-programmed filters
73 of \ctsim. This command will create a 2-dimensional image of the selected filter.
74 The center of the filter is at the center of the image.
75
76 These filters can be created in their natural frequency domain or in their spatial domain.
77
78 \begin{twocollist}
79 \twocolitem{\textbf{Filter}}{Selects the filter to generate.}
80 \twocolitem{\textbf{Domain}}{Selects either the \texttt{Frequency} or \texttt{Spatial} domains. The filters have the
81 frequency domain as their natural domain.}
82 \twocolitem{\textbf{X Size}}{Number of columns in the output image.}
83 \twocolitem{\textbf{Y Size}}{Number of rows in the output image.}
84 \twocolitem{\textbf{Hamming Parameter}}{Sets the parameter for the Hamming filter.}
85 \twocolitem{\textbf{Bandwidth}}{Sets the bandwidth of the filter.}
86 \twocolitem{\textbf{Axis (input) Scale}}{Sets the scale for the filter input. By default, the input to the filter is
87 the distance in pixels from the center of the image. By changing this value, one can set a scale the input to the filter.
88 For example, if the output image is \texttt{101} pixels and thus the center of the image is at \texttt{(50,50)}, then a pixel
89 lying at point \texttt{100,50} would be 50 units from the center of the filter. By applying an \texttt{Axis scale} of
90 \texttt{0.1}, then that point would be scaled to 5 units from the center of the filter.}
91 \twocolitem{\textbf{Filter (output) Scale}}{Multiplies the output of the filter by this amount. By default, the filter has a maximum
92 value of \texttt{1}.}
93 \end{twocollist}
94
95 \subsection{File - Preferences}\label{IDH_DLG_PREFERENCES}\index{Dialog!Preferences}
96 This command displays a dialog box that allows users to control
97 the behavior of \ctsim. These options are saved across \ctsim\ sessions.
98 Under Microsoft Windows environments, they are stored in the registry.
99 On UNIX and Linux environments, they are stored in the user's home
100 directory with the filename of \texttt{.ctsim}.
101
102 \begin{twocollist}
103 \twocolitem{\textbf{Advanced options}}{By default, this is turned off in new installations.
104 These advanced options are not required for normal simulations. When \texttt{Advanced
105 Options} is set, \ctsim\ will display more options during scanning of phantoms and
106 the reconstruction of projections.}
107
108 \twocolitem{\textbf{Ask before deleting new documents}}{By default, this is turned on in
109 new installations. With this option set, \ctsim\ will ask before closing
110 documents that have been modified or never saved on disk. By turning off
111 this option, \ctsim\ will never ask if you want to save a file -- you'll
112 be responsible for saving any files that you create.}
113
114 \end{twocollist}
115
116 \subsection{File - Open}
117 This command opens a file section dialog box. Of special consideration
118 is the \texttt{File Type} combo box on the bottom of the dialog. You need
119 to set the \texttt{File Type} combo box to to the type of file that you wish to open.
120
121 \subsection{File - Save}
122 This command saves the contents of the active window. If the window hasn't
123 been named, a dialog box will open asking for the file name to use.
124
125 \subsection{File - Close}
126 As one would expect, this closes the active window.
127
128 \subsection{File - Save As}
129 Allows the saving of the contents of a window to any filename.
130
131 \subsection{Help - Contents}
132 This command displays the online help.
133
134 \subsection{Help - About}
135 This command shows the version number of \ctsim.
136
137
138 \section{Phantom Menus}
139
140 \subsection{Properties}
141 Displays the properties of a phantom which includes:
142
143 \begin{itemize}\itemsep=0pt
144 \item Overall dimensions of a phantom
145 \item A list of all component phantom elements
146 \end{itemize}
147
148 \subsection{Rasterize Dialog}\label{IDH_DLG_RASTERIZE}\index{Dialog!Rasterize}
149 This creates an image file from a phantom. Technically, it
150 converts the phantom from a vector (infinite resolution) object
151 into a 2-dimension array of floating-point pixels. The parameters
152 to set are:
153
154 \begin{twocollist}
155 \twocolitem{\textbf{X size}}{Number of columns in image file}
156 \twocolitem{\textbf{Y size}}{Number of rows in image file}
157 \twocolitem{\textbf{Samples per pixel}}{Numbers of samples taken
158 per pixel in both the x and y directions. For example, if the
159 \texttt{Samples per pixel} is set to \texttt{3}, then for every
160 pixel in the image file 9 samples \latexonly{($3\times3$)}\latexignore{(3 x 3)}
161 are averaged.}
162 \end{twocollist}
163
164 \subsection{Projection Dialog}\label{IDH_DLG_PROJECTIONS}\index{Dialog!Projections}
165 This creates a projection file from a phantom. The options
166 available when collecting projections are:
167
168 \begin{twocollist}
169 \twocolitem{\textbf{Geometry}}{Selects the scanner geometry.
170   \begin{itemize}\itemsep=0pt
171     \item \texttt{Parallel}
172     \item \texttt{Equiangular}
173     \item \texttt{Equilinear}
174   \end{itemize}}
175 \twocolitem{\textbf{Number of detectors}}{Sets the number of
176 detectors in the detector array.}
177
178 \twocolitem{\textbf{Number of views}}{Sets the number of views
179 collected}
180
181 \twocolitem{\textbf{Samples per detector}}{Sets the number of
182 samples collected for each detector}
183
184 \twocolitem{\textbf{View Ratio}}{Sets the field of view as a ratio
185 of the diameter of the phantom.  For normal scanning, use a value of
186 \texttt{1.0}.}
187
188 \twocolitem{\textbf{Scan Ratio}}{Sets the length of scanning as a
189 ratio of the view diameter. For normal scanning, use a value of \texttt{1.0}.}
190
191 \twocolitem{\textbf{Focal length ratio}}{Sets the distance between the
192 radiation source and the center of the phantom as a
193 ratio of the radius of the phantom. For parallel geometries, a value
194 of \texttt{1.0} is optimal. For other
195 geometries, this should be at least \texttt{2.0} to avoid artifacts.}
196 \end{twocollist}
197
198 \textbf{Advanced Options}
199
200 \begin{twocollist}
201 \twocolitem{\textbf{Rotation Angle}}{Sets the rotation amount as a
202 multiple of \latexonly{$\pi$.}\latexignore{pi.} For parallel geometries use a rotation angle of \texttt{1}
203 and for equilinear and equiangular geometries use a rotation angle
204 of \texttt{2}. Using any other rotation angle will lead to artifacts.}
205 \end{twocollist}
206
207
208
209 \section{Image Menus}
210 \subsection{File - Properties}
211 Properties of image files include
212 \begin{itemize}\itemsep=0pt
213   \item Whether the image is real or complex valued
214   \item Numeric statistics (minimum, maximum, mean, median, mode, and standard deviation)
215   \item History labels (text descriptions of the processing for this image)
216 \end{itemize}
217
218 \subsection{File - Export}\label{IDH_DLG_EXPORT}\index{Image!Export}
219 This command allows for exporting image files to a standard
220 graphics file format. This is helpful when you want to take an
221 image and import it into another application. The current
222 \helprefn{intensity scale}{intensityscale} is used when exporting
223 the file. The supported graphic formats are:
224
225 \begin{twocollist}
226 \twocolitem{\textbf{PNG}}{Portable Network Graphics format. This uses 8-bits or
227 256 shades of gray.}
228 \twocolitem{\textbf{PNG-16}}{This is a 16-bit version of PNG which allows for
229 65536 shades of gray.}
230 \twocolitem{\textbf{PGM}}{Portable Graymap format. This is a common format used on
231 UNIX systems.}
232 \twocolitem{\textbf{PGM}}{ASCII version of PGM.}
233 \end{twocollist}
234
235
236 \subsection{View}\label{intensityscale}\index{Intensity Scale}
237 These commands are used change the intensity scale for viewing the image.
238 These commands do not change the image data. When the minimum intensity is
239 set, then the color pure black is assigned to that image intensity. Similarly,
240 when the maximum intensity is set, the the color pure white is assigned to that
241 image value.
242
243 Changing the intensity scale is useful when examining different image features.
244 In clinical medicine, the intensity scale is often changed to examine bone
245 (high intensity) verses soft-tissue (medium intensity) features.
246
247 \subsubsection{Set}\label{IDH_DLG_MINMAX}
248 This command displays a dialog box that allows you to set the lower
249 and upper intensities to display.
250
251 \subsubsection{Auto}\label{IDH_DLG_AUTOSCALE}
252 This command displays a dialog box that allows \ctsim\ to automatically
253 make an intensity scale. The parameters that \ctsim\ needs to make this
254 automatic scale are:
255
256 \begin{twocollist}
257 \twocolitem{\textbf{Center}}{This sets the center of the intensity scale. Currently,
258 \ctsim\ allows you to use either the mean, mode, or median of the image
259 as the center of the intensity scale.}
260
261 \twocolitem{\textbf{Width}}{This sets the half-width of the intensity scale. The width
262 is specified as a ratio of the standard deviation.}
263 \end{twocollist}
264
265 As an example, if \texttt{median} is selected as the center and
266 \texttt{0.5} is selected as the width, the the minimum intensity will
267 be \latexonly{$median - 0.5 \times standardDeviation$}\latexignore{\emph{median - 0.5 x standardDeviation}}
268 and the maximum will be \latexonly{$median + 0.5 \times standardDeviation$.}\latexignore{\emph{
269 median + 0.5 x standardDeviation}.}
270
271 \subsubsection{Full}
272 This command resets the intensity scale to the full scale of the image.
273
274 \subsection{Image}
275 These commands create a new image based upon the current image,
276 and for some commands, also upon a comparison image.
277
278 \subsubsection{Add, Subtract, Multiply, Divide}
279 These are simple arithmetic operations. \ctsim\ will display a dialog
280 box showing all of the currently opened image files that are the
281 same size as the active image. After the selection of a compatible image,
282 \ctsim\ will perform the arithmetic operation on the two images and
283 make a new result image.
284
285 \subsubsection{Image Size}
286 This command will generate a new image based on the current image. The new
287 image can be scaled to any size. A dialog
288 appears asking for the size of the new image. Bilinear interpolation
289 is used when calculating the new image.
290
291 \subsubsection{3-D Conversion}
292 Generates a 3-dimensional view of the current phantom. This view can be
293 rotated in three dimensions. The left and right arrow control the z-axis
294 rotation, the up and down arrows control the x-axis rotation. The y-axis
295 rotation is controlled by the \texttt{T} and \texttt{Y} keys. Other options
296 are presented on the \texttt{View} menu and include:
297
298 \begin{itemize}
299 \item Surface plot versus wireframe plot.
300 \item Smooth shading versus flat shading.
301 \item Lighting on or off.
302 \item Color scale on or off.
303 \end{itemize}
304
305 \subsection{Filter}\index{Image filter}
306 These commands filter and modify the image
307
308 \subsubsection{Arithmetic}
309 These commands operate on the image on a pixel-by-pixel basis. The commands
310 support both real and complex-valued images. The available arithmetic commards are:
311
312 \begin{twocollist}
313   \twocolitem{\textbf{Invert}}{Negate pixel values.}
314   \twocolitem{\textbf{Log}}{Take natural logrithm of pixel values.}
315   \twocolitem{\textbf{Exp}}{Take natural exponent of pixel values.}
316   \twocolitem{\textbf{Square}}{Take square of pixel values.}
317   \twocolitem{\textbf{Square root}}{Take square root of pixel values.}
318 \end{twocollist}
319
320
321 \subsubsection{Frequency Based}
322 This commands allow the Fourier and inverse Fourier transformations of
323 images. By default, the transformations will automatically convert
324 images between Fourier to natural orders as expected. For example, \texttt{2-D FFT}
325 will transform the points into natural order after the Fourier transform.
326 Similarly the inverse, \texttt{2-D IFFT}, will reorder the points from
327 natural order to Fourier order before applying the inverse Fourier transformation.
328
329 As you would expect, images that undergo frequency filtering will be complex-valued
330 images. Normally, only the real component is shown by \ctsim. However, \ctsim\ does
331 have options for converting a complex-valued image into a real-valued image via
332 the \texttt{Magnitude} and \texttt{Phase} filtering commands.
333
334 \subsection{Analyze}
335 These commands are used for analyzing an image.
336
337 \subsubsection{Plotting}
338 The commands plot rows and columns of images. There are also commands
339 that perform FFT and IFFT transformations prior to plotting.
340
341 \subsubsection{Image Comparison}\label{IDH_DLG_COMPARISON}\index{Image!Comparison}
342 This command performs statistical comparisons between two images. An option
343 also exists for generating a difference image from the two input images.
344
345 There are also commands for comparison plotting of rows and columns from two images.
346  This is quite helpful when comparing a phantom to a reconstruction.
347
348 \section{Projection Menus}
349
350 \subsection{File - Properties}
351 The displayed properties include:
352
353 \begin{itemize}
354 \item Number of detectors in the projections
355 \item Number of views
356 \item The variables used when generating the projections from the phantom
357 \end{itemize}
358
359 \subsection{Process - Convert Polar Dialog}\label{IDH_DLG_POLAR}\index{Polar conversion}
360 Creates an image file with the polar conversion of the projection data. The options to set are:
361
362 \begin{twocollist}
363 \twocolitem{\textbf{xsize}}{Number of columns in output image.}
364 \twocolitem{\textbf{ysize}}{Number of rows in output image.}
365 \twocolitem{\textbf{interpolation}}{Selects the interpolation method.
366 Currently, the \texttt{bilinear} option provides the highest
367 quality interpolation.}
368 \end{twocollist}
369
370 \subsection{Process - Convert FFT Polar Dialog}
371 The parameters for this option are the same as \helprefn{Convert
372 Polar Dialog}{convertpolardialog}. For this command, though, the
373 projections are Fourier transformed prior to conversion to polar
374 image.
375
376 \subsection{Reconstruct - Filtered Backprojection Dialog}\label{IDH_DLG_RECONSTRUCTION}\index{Dialog!Reconstruction}
377 This dialog sets the parameters for reconstructing an image from projections
378 using the Filtered Backprojection technique.
379
380
381 \begin{twocollist}
382 \twocolitem{\textbf{Filter}}{Selects which filter to apply to each
383 projection. To properly reconstruct an image, this filter should
384 be consist of the the absolute value of distance from zero
385 frequency optionally multiplied by a smoothing filter. The optimal
386 filters to use are:
387 \begin{itemize}\itemsep=0pt
388 \item \texttt{abs\_bandlimit}
389 \item \texttt{abs\_cosine}
390 \item \texttt{abs\_hamming}
391 \end{itemize}
392 } \twocolitem{\textbf{Hamming parameter}}{Sets the alpha level for
393 Hamming   window. At setting of 0.54, this equals the Hanning
394 window.}
395
396 \twocolitem{\textbf{Filter Method}}{Selects the filtering method.
397 For large numbers of detectors, \texttt{rfftw} is optimal. For
398 smaller numbers of detectors, \texttt{convolution} might be a bit
399 faster.
400 \begin{itemize}\itemsep=0pt
401 \item \texttt{convolution}
402 \item \texttt{fourier} - Uses simple Fourier transform.
403 \item \texttt{fourier-table} - Optimizes Fourier transform by precalculating trigometric functions.
404 \item \texttt{fftw} - Uses complex-valued Fourier transform with the \emph{fftw} library.
405 \item \texttt{rfftw} - Uses optimized real/half-complex Fourier transform.
406 \end{itemize}
407 }
408
409 \twocolitem{\textbf{Interpolation}}{Interpolation technique.
410 \texttt{cubic} is optimal when the
411 data is smooth. Smooth data is obtained by taking many projections and/or
412 using a smoothing filter. In the absence of smooth data, \texttt{linear} gives better results and
413 is many times faster than cubic interpolation.
414
415 \begin{itemize}\itemsep=0pt
416 \item nearest
417 \item linear
418 \item cubic
419 \end{itemize}
420 }
421 \end{twocollist}
422
423 \textbf{Advanced Options}
424
425 These options are only visible if \emph{Advanced Options} has been
426 selected in the \texttt{File - Preferences} dialog. These parameters
427 default to optimal settings and don't need to be adjusted except
428 by expert users.
429
430 \begin{twocollist}
431 \twocolitem{\textbf{Backprojection}}{Selects the backprojection
432 technique. A setting of \texttt{idiff} is optimal.
433 \begin{itemize}\itemsep=0pt
434 \item \texttt{trig} - Use trigometric functions at each image point.
435 \item \texttt{table} - Use precalculated trigometric tables.
436 \item \texttt{diff} - Use difference method to iterate within image.
437 \item \texttt{idiff} - Use integer iteration math.
438 \end{itemize}
439 }
440
441 \twocolitem{\textbf{Filter Generation}}{Selects the filter
442 generation. With convolution, \texttt{direct} is the proper method
443 to select. With any of the frequency methods,
444 \texttt{inverse-fourier} is the best method.
445 \begin{itemize}\itemsep=0pt
446 \item \texttt{direct}
447 \item \texttt{inverse-fourier}
448 \end{itemize}
449 }
450
451 \twocolitem{\textbf{Zeropad}}{Zeropad factor when using
452 frequency-based filtering. A setting of \texttt{1} is optimal whereas
453 a setting of \texttt{0} disables zero padding.}
454
455 \end{twocollist}
456
457 \section{Plot Menus}
458 \subsection{File - Properties}
459 The displayed properties include:
460
461 \begin{itemize}\itemsep=0pt
462 \item the number of curves in the plot and the number of points per curve.
463 \item the EZPlot commands used to format the plot are displayed.
464 \item history labels from the originating image(s) and the plot function
465 \end{itemize}
466
467 \subsection{View Menu}
468 These commands set the scaling for the y-axis. They are analogous
469 to the options used for setting the intensity scale for images.
470
471 \subsubsection{Set}
472 This command sets the upper and lower limits for the y-axis.
473
474 \subsubsection{Auto}
475 This command automatically sets the upper and lower limits for the
476 y-axis. Please refer to the \texttt{View - Auto} documentation for
477 image files for the details.
478
479 \subsubsection{Full}
480 The command resets the upper and lower limits of the y-axis to the
481 minimum and maximum values of the curves.