900c1622963b590ab9c0fc2de53232077eb124f8
[ctsim.git] / doc / ctsim-textui.tex
1 \chapter{The Command Line Interface}\label{ctsimtext}\index{ctsimtext}%
2 \setheader{{\it CHAPTER \thechapter}}{}{}{\ctsimheadtitle}{}{{\it CHAPTER \thechapter}}%
3 \ctsimfooter%
4
5 \ctsimtext\ is a master shell for all of the command-line utilities. The
6 command-line utilities can perform most of the functions of the graphical
7 shell. These command-line utilities are especially appropriate for use on
8 systems without graphical capability, batch files, and parallel processing
9 with a Beowulf-type computer cluster.
10
11 \usage \ctsimtext\ can be invoked via three different
12 methods.
13 \begin{enumerate}\itemsep=3pt
14 \item \ctsimtext\ can executed without any parameters. In that case,
15 \ctsimtext\ offers a command-line to enter the function-names and
16 their parameters. The output of the command is displayed. Further
17 commands may be given to \ctsimtext. The shell is exited by the
18 \texttt{quit} command. \ctsimtext\ uses the
19 \urlref{readline}{http://www.gnu.org} library on UNIX and Linux platforms
20 to provide command history processing.
21
22 \item \ctsimtext\ can also be called to
23 execute a single command. This is especially useful for batch
24 files containing multiple \ctsimtext\ commands. This is invoked by
25 calling\\ \texttt{ctsimtext function-name parameters...}.
26
27 \item Using operating systems that support soft or hard linking of
28 files (such as UNIX and Linux), the executable file \ctsimtext\ can
29 be linked to the function names. This is automatically done by
30 the installation file for Linux. Thus, to use \ctsimtext\ with the
31 function name \texttt{pjrec}, the below command can be executed:\\
32 \texttt{pjrec parameters...} \\
33 as a shortcut rather than the equivalent command \\
34 \texttt{ctsimtext pjrec parameters...}
35
36 \end{enumerate}
37
38 \section{Parallel Processing}
39 \ctsimtext\ can be used to spread it's processing over a cluster. Specifically,
40 \ctsimtext\ supports the \urlref{LAM}{http://www.mpi.nd.edu/lam} version of
41 the MPI environment. On platforms with LAM installed, a parallel version of
42 \ctsimtext\ is created. The name of this program is \texttt{ctsimtext-lam}.
43 The functions that take advantage of the parallel processing are
44 \texttt{phm2if}, \texttt{phm2pj}, \texttt{pjrec}.
45
46 This parallel processing version has been tested with excellent results on
47 a 16-CPU \urlref{Beowulf}{http://www.beowulf.org} cluster.
48
49
50 \section{if1}\label{if1}\index{if1}%
51 Performs math functions on a single image. The commands works with
52 both real and complex valued images.
53
54 \usage
55 \texttt{if1 input-filename output-filename [options...]}
56
57 \textbf{Options}
58 \begin{twocollist}
59   \twocolitem{\doublehyphen{invert}}{Negate pixel values.}
60   \twocolitem{\doublehyphen{log}}{Take natural logrithm of pixel values.}
61   \twocolitem{\doublehyphen{exp}}{Take natural exponent of pixel values.}
62   \twocolitem{\doublehyphen{sqr}}{Take square of pixel values.}
63   \twocolitem{\doublehyphen{sqrt}}{Take square root of pixel values.}
64 \end{twocollist}
65
66 \section{if2}\label{if2}\index{if2}%
67 Performs math functions on a two images. The command works with both
68 real and complex valued images.
69
70 \usage
71 \texttt{if2 input-filename1 input-filename2 output-filename [options...]}
72
73 \textbf{Options}
74 \begin{twocollist}
75   \twocolitem{\doublehyphen{add}}{Add the two images.}
76   \twocolitem{\doublehyphen{sub}}{Subtract the two images.}
77   \twocolitem{\doublehyphen{multiply}}{Multiply the two images.}
78   \twocolitem{\doublehyphen{divide}}{Divide the two images.}
79   \twocolitem{\doublehyphen{comp}}{Statistically compare the two images.}
80   \twocolitem{\doublehyphen{column-plot n}}{Plot the values of a particular column.}
81   \twocolitem{\doublehyphen{row-plot n}}{Plot the values of a particular row.}
82 \end{twocollist}
83
84 \section{ifexport}\label{ifexport}\index{ifexport}%
85 Export an image file to a standard graphics file.
86
87 \usage
88 \texttt{ifexport input-filename output-filename -\,-format }\emph{graphic-format} \texttt{ [options...]}
89
90 \textbf{Options}
91 \begin{twocollist}
92   \twocolitem{\doublehyphen{format}}{
93   \begin{itemize}\itemsep=0pt
94     \item \texttt{pgm} - Portable graymap format.
95     \item \texttt{pgmasc} - ASCII PGM format.
96     \item \texttt{png} - Portable network graphics format.
97     \item \texttt{png16} - 16-bit PNG format.
98   \end{itemize}}
99   \twocolitem{\doublehyphen{center}}{Set center of intensity window.
100   \begin{itemize}\itemsep=0pt
101     \item \texttt{median}
102     \item \texttt{mode}
103     \item \texttt{mean}
104   \end{itemize}}
105   \twocolitem{\doublehyphen{auto}}{Set half-width of intensity window as a multiple of the standard deviation.
106   \begin{itemize}\itemsep=0pt
107      \item \texttt{full}
108      \item \texttt{std0.1}
109      \item \texttt{std0.5}
110      \item \texttt{std1}
111      \item \texttt{std2}
112      \item \texttt{std3}
113   \end{itemize}}
114   \twocolitem{\doublehyphen{scale}}{Set size of output image. A value of
115   \texttt{1} is default and creates an output image the same size as the input image.}
116   \twocolitem{\doublehyphen{min}}{Set the minimum intensity value.}
117   \twocolitem{\doublehyphen{max}}{Set the maximum intensity value.}
118 \end{twocollist}
119
120 \section{ifinfo}\label{ifinfo}\index{ifinfo}%
121
122 Displays information about an imagefile.
123
124 \usage
125 \texttt{ifinfo input-filename [options...]}
126
127 \textbf{Options}
128 \begin{twocollist}
129   \twocolitem{\doublehyphen{labels}}{Display history labels.}
130   \twocolitem{\doublehyphen{no-labels}}{Suppress history labels.}
131   \twocolitem{\doublehyphen{stats}}{Display image statistics.}
132   \twocolitem{\doublehyphen{no-stats}}{Suppress image statistics.}
133 \end{twocollist}
134
135 \section{phm2pj}\label{phm2pj}\index{phm2pj}%
136 Simulates collection of X-rays data (projections) around a phantom object.
137
138 \usage
139 \texttt{phm2pj projection-filename number-detectors number-views [options...]}
140
141 \begin{twocollist}
142 \twocolitem{\doublehyphen{phantom}}{Select a standard phantom.
143 \begin{itemize}\itemsep=0pt
144 \item \texttt{herman}
145 \item \texttt{shepp-logan}
146 \item \texttt{unit-pulse}
147 \end{itemize}
148 }
149 \twocolitem{\doublehyphen{phmfile}}{Reads a user-created phantom file.}
150
151 \twocolitem{\doublehyphen{geometry}}{Sets the scanner geometry. Valid values are:
152   \begin{itemize}\itemsep=0pt
153     \item \texttt{parallel}
154     \item \texttt{equiangular}
155     \item \texttt{equilinear}
156   \end{itemize}
157 }
158
159 \twocolitem{\doublehyphen{nray}}{ Number of samples per each detector}
160
161 \twocolitem{\doublehyphen{rotangle}}{The rotation angle as a multiple of pi.
162 For parallel geometries use a rotation angle of \texttt{1} and for equilinear and equiangular
163 geometries use a rotation angle of \texttt{2}. The default is to use to
164 appropriate rotation angle based on the geometry.}
165
166 \twocolitem{\doublehyphen{view-ratio}}{Sets the field of view as a ratio of the diameter of the phantom.
167     For normal scanning, the default value of \texttt{1.0} is optimal.}
168
169 \twocolitem{\doublehyphen{scan-ratio}}{Sets the length of scanning as a ratio of the view diameter.
170     For normal scanning, the default value of \texttt{1.0} is optimal.}
171
172 \twocolitem{\doublehyphen{focal-length}}{Sets the distance between the radiation source
173  and the center of the object as a ratio of the radius of the object.
174    For parallel geometries, a value of \texttt{1.0} is optimal. For other
175     geometries, this should be at least \texttt{2.0} to avoid artifacts.}
176 \end{twocollist}
177
178
179 \section{phm2if}\label{phm2if}\index{phm2if}%
180 Converts a geometric phantom object into an imagefile.
181
182 \usage
183 \texttt{phm2if phantom-filename image-filename [options...]}
184
185 \textbf{Options}
186 \begin{twocollist}
187   \twocolitem{\doublehyphen{nsamples}}{Number of samples in x \& y directions per pixel}
188   \twocolitem{\doublehyphen{view-ratio}}{Sets the view ration. For normal scanning,
189   the default value of \texttt{1.0} is optimal.}
190 \end{twocollist}
191
192 \section{pj2if}\label{pj2if}\index{pj2if}%
193 Convert a projection file into an imagefile.
194
195 \usage
196 \texttt{pj2if projection-filename image-filename x-size y-size [options...]}
197
198 \textbf{Options}
199 \begin{twocollist}
200 \twocolitem{\doublehyphen{dump}}{Print all projection data to the console.}
201 \end{twocollist}
202
203 \section{pjinfo}\label{pjinfo}\index{pjinfo}%
204 Displays information about a projection file.
205
206 \usage
207 \texttt{pjinfo projection-filename [options...]}
208
209 \textbf{Options}
210 \begin{twocollist}
211   \twocolitem{\doublehyphen{binaryheader}}{Dump the binary header to the standard output.
212   This option is only used when manually creating a composite projection file from
213   several different projection files.}
214   \twocolitem{\doublehyphen{binaryview}}{Dump binary view data to the standard output.
215   This option is only used when manually creating a composite projection file from
216   several different projection files.}
217   \twocolitem{\doublehyphen{startview}}{Sets starting view to display. Default is \texttt{0}.}
218   \twocolitem{\doublehyphen{endview}}{Sets ending view to display. Default is the last view.}
219   \twocolitem{\doublehyphen{dump}}{Print all projection data to the console.}
220 \end{twocollist}
221
222 \section{pjrec}\label{pjrec}\index{pjrec}%
223 Reconstructs the interior of an object from a projection file.
224
225 \usage
226 \texttt{pjrec projection-filename image-filename image-cols image-rows [options...]}
227
228 \textbf{Options}
229
230 \begin{twocollist}
231 \twocolitemruled{\textbf{Parameter}}{\textbf{Options}}
232 \twocolitem{\doublehyphen{filter}}{Selects which filter to apply to
233 each projection. To properly reconstruct an image, this filter
234 should be multiplied by the absolute value of distance from zero
235 frequency.
236 \begin{itemize}\itemsep=0pt
237 \item \texttt{abs\_bandlimit}
238 \item \texttt{abs\_cosine}
239 \item \texttt{abs\_hamming}
240 \end{itemize}
241 } \twocolitem{\doublehyphen{filter-parameter}}{Sets the alpha level
242 for Hamming window. At setting of \texttt{0.54}, this equals
243 the Hanning window.}
244
245 \twocolitem{\doublehyphen{filter-method}}{Selects the filtering
246 method. For large numbers of detectors, \texttt{rfftw} is optimal.
247 For smaller numbers of detectors, \texttt{convolution} might be a
248 bit faster.
249 \begin{itemize}\itemsep=0pt
250 \item \texttt{convolution}
251 \item \texttt{fourier} - Uses simple Fourier transform.
252 \item \texttt{fourier-table} - Optimizes Fourier transform by precalculating trigometric functions.
253 \item \texttt{fftw} - Uses complex-valued Fourier transform with the \emph{fftw} library.
254 \item \texttt{rfftw} - Uses optimized real/half-complex Fourier transform.
255 \end{itemize}
256 }
257 \end{twocollist}
258
259 \begin{twocollist}
260 \twocolitem{\doublehyphen{filter-generation}}{Selects the filter
261 generation. With convolution, \texttt{direct} is the proper method
262 to select. With any of the frequency methods,
263 \texttt{inverse-fourier} is the best method.
264 \begin{itemize}\itemsep=0pt
265 \item \texttt{direct}
266 \item \texttt{inverse-fourier}
267 \end{itemize}
268 }
269
270 \twocolitem{\doublehyphen{interpolation}}{Interpolation technique.
271 \texttt{cubic} is optimal when the
272 data is smooth. Smooth data is obtained by taking many projections and/or
273 using a smoothing filter. In the absence of smooth data, \texttt{linear} gives better results and
274 is many times faster than cubic interpolation.
275
276 \begin{itemize}\itemsep=0pt
277 \item \texttt{nearest}
278 \item \texttt{linear}
279 \item \texttt{cubic}
280 \end{itemize}
281 }
282
283 \twocolitem{\doublehyphen{backprojection}}{Selects the
284 backprojection technique. A setting of \texttt{idiff} is optimal.
285 \begin{itemize}\itemsep=0pt
286 \item \texttt{trig} - Use trigometric functions at each image point.
287 \item \texttt{table} - Use precalculated trigometric tables.
288 \item \texttt{diff} - Use difference method to iterate within image.
289 \item \texttt{idiff} - Use integer iteration math.
290 \end{itemize}
291 }
292
293 \twocolitem{\doublehyphen{zeropad}}{Zeropad factor. A setting of
294 \texttt{1} is optimal whereas a zeropad of \texttt{0} performs no zeropadding.}
295
296 \end{twocollist}