81dbf42b2da366baf1252f0b94369996c0d71fe4
[ctsim.git] / doc / ctsim-concepts.tex
1 \chapter{Concepts}\index{Concepts}%
2 \setheader{{\it CHAPTER \thechapter}}{}{}{}{}{{\it CHAPTER \thechapter}}%
3 \setfooter{\thepage}{}{}{}{}{\thepage}%
4
5 \section{Overview}\label{conceptoverview}\index{Concepts,Overview}%
6 The operation of \ctsim\ begins with the phantom object.  A phantom
7 object consists of geometric elements.  A scanner is specified and the
8 projection data simulated.  Finally that projection data can be
9 reconstructed using various user controlled algorithms producing an
10 image of the phantom object. This reconstruction can then be
11 statistically compared to the original phantom object.
12
13 In order to use \ctsim\ effectively, some knowledge of how \ctsim\ works
14 and the approach taken is required. \ctsim\ deals with a variety of
15 object, but the two objects we need to be concerned with are the
16 \emph{phantom} and the \emph{scanner}.
17
18 \section{Phantoms}\label{conceptphantom}\index{Concepts,Phantoms}%
19 \subsection{Overview}\label{phantomoverview}\index{Concepts,Phantoms,Overview}%
20
21 \ctsim\ uses geometrical objects to
22 describe the object being scanned. A phantom is composed a one or more
23 phantom elements. These elements are simple geometric shapes,
24 specifically, rectangles, triangles, ellipses, sectors and segments.
25 With these elements, standard phantoms used in the CT literature can
26 be constructed.  In fact, \ctsim\ provides a shortcut to load the
27 published phantoms of Herman and Shepp-Logan.  \ctsim\ also reads text
28 files of user-defined phantoms.
29
30 The types of phantom elements and their definitions are taken with
31 permission from G.T. Herman's 1980 book\cite{HERMAN80}.
32
33 \subsection{Phantom File}\label{phantomfile}\index{Concepts,Phantoms,File}
34 Each line in the text file describes an element of the
35 phantom.  Each line contains seven entries, in the following form:
36 \begin{verbatim}
37 element-type cx cy dx dy r a
38 \end{verbatim}
39 The first entry defines the type of the element, one of
40 \rtfsp\texttt{rectangle}, \texttt{}, \texttt{triangle},
41 \rtfsp\texttt{sector}, or \texttt{segment}. \texttt{cx},
42 \rtfsp\texttt{cy}, \texttt{dx} and \texttt{dy} have different
43 meanings depending on the element type.
44
45 \rtfsp\texttt{r} is the rotation applied to the object in degrees
46 counterclockwise, and \texttt{a} is the X-ray attenuation
47 coefficient of the object. Where objects overlap, the attenuations
48 of the overlapped objects are summed.
49
50
51 \subsection{Phantom Elements}\label{phantomelements}\index{Concepts,Phantoms,Elements}
52
53 \subsubsection{ellipse}
54 Ellipses use \texttt{dx} and \texttt{dy} to define the semi-major and
55 semi-minor axis lengths, with the center of the ellipse at \texttt{cx}
56 and \texttt{cy}.  Of note, the commonly used phantom described by
57 Shepp and Logan\cite{SHEPP74} uses only ellipses.
58
59 \subsubsection{rectangle}
60 Rectangles use \texttt{cx} and \texttt{cy} to define the position of
61 the center of the rectangle with respect to the origin.  \texttt{dx}
62 and \texttt{dy} are the half-width and half-height of the rectangle.
63
64 \subsubsection{triangle}
65 Triangles are drawn with the center of the base at \texttt{(cx,cy)},
66 with a base half-width of \texttt{dx} and a height of \texttt{dy}.
67 Rotations are then applied about the center of the base.
68
69 \subsubsection{segment}
70 Segments are complex. They are the portion of an circle between a
71 chord and the perimeter of the circle.  \texttt{dy} sets the radius of
72 the circle. Segments start with the center of the chord located at
73 \texttt{(0,0)} and the chord horizontal. The half-width of the chord
74 is set by \texttt{dx}.  The portion of an circle lying below the chord
75 is then added. The imaginary center of this circle is located at
76 \texttt{(0,-dy)}. The segment is then rotated by \texttt{r} and then
77 translated by \texttt{cx,cy}.
78
79 \subsubsection{sector}
80 Sectors are the like a ``pie slice'' from a circle. The radius of the
81 circle is set by \texttt{dy}. Sectors are
82 defined similarly to segments. In this case, though, a chord is not
83 drawn.  Instead, the lines are drawn from the origin of the circle
84 \texttt{(0,-dy)} to the points \texttt{(-dx,0)} and \texttt{(dx,0)}.
85 The perimeter of the circle is then draw between those two points
86 below the x-axis. The sector is then rotated and translated the same
87 as a segment.
88
89 \subsection{Phantom Size}
90 The overall dimensions of the phantom are increased by 1\% above the
91 specified sizes to avoid clipping due to round-off errors from
92 sampling the polygons of the phantom elements.  So, if the phantom is
93 defined as a rectangle of size 0.1 by 0.1, the actual phantom has
94 extent 0.101 in each direction.
95
96 \section{Scanner}\label{conceptscanner}\index{Concepts,Scanner}%
97 \subsection{Dimensions}
98 Understanding the scanning geometry is the most complicated aspect of
99 using \ctsim. For real-world CT simulators, this is actually quite
100 simple. The geometry is fixed by the manufacturer during the
101 construction of the scanner and can not be changed. Conversely,
102 real-world CT scanners can only take objects up to a fixed size.
103
104 \ctsim, being a very flexible simulator,
105 gives tremendous options in setting up the geometry for a scan.
106
107 In general, the geometry for a scan all starts from the size of the
108 phantom being scanned. This is because \ctsim\ allows for statistical
109 comparisons between the original phantom image and it's reconstructions.
110 Since CT scanners scan a circular area, the first important
111 variable is the diameter of the circle surround the phantom, or the
112 \emph{phantom diameter}. Remember, as mentioned above, the
113 phantom dimensions are also padded by 1\%.
114
115 The other important geometry variables for scanning objects are the
116 \emph{view ratio}, \emph{scan ratio}, and \emph{focal length ratio}.
117 These variables are all input into \ctsim\ in terms of ratios rather
118 than absolute values.
119
120 \subsubsection{Phantom Diameter}
121 \begin{figure}
122 $$\image{5cm;0cm}{scangeometry.eps}$$
123 \caption{Phantom Geometry}
124 \end{figure}
125 The phantom diameter is automatically calculated by \ctsim\ from the
126 phantom definition. The maximum of the phantom length and height is
127 used to define the square that completely surrounds the phantom. Let
128 \latexonly{$p_l$}\latexignore{\emph{Pl}}
129 be the width and height of this square. The diameter of this boundary box,
130 \latexonly{$p_d$,}\latexignore{\emph{Pd},}
131 \rtfsp is then
132 \latexignore{\\$$\emph{Pl x sqrt(2)}$$\\}
133 \latexonly{$$p_d = p_l \sqrt{2}$$}
134 CT scanners actually collect projections around a circle rather than a
135 square. The diameter of this circle is also the diameter of the boundary
136 square
137 \latexonly{$p_d$.}\latexignore{\rtfsp\emph{Pd}.}
138 These relationships are diagrammed in figure 2.1.
139
140 \subsubsection{View Diameter}
141 The \emph{view diameter} is the area that is being processed during scanning of phantoms as
142 well as during rasterization of phantoms. By default, the \emph{view diameter}
143 \rtfsp is set equal to the \emph{phantom diameter}. It may be useful, especially for
144 experimental reasons, to process an area larger (and maybe even smaller) than
145 the phantom. Thus, during rasterization or during projections, \ctsim\ will
146 ask for a \emph{view ratio},
147 \latexonly{$v_r$.}\latexignore{\rtfsp \emph{VR}.}
148 The \emph{view diameter} is then set as
149 \latexonly{$$v_d = p_d v_r$$}\latexignore{\\$$\emph{Vd = Pd x VR}$$}
150
151 By using a
152 \latexonly{$v_r$}\latexignore{\emph{VR}}
153 less than 1, \ctsim\ will allow
154 for a \emph{view diameter} less than
155 \emph{phantom diameter}.
156 This will lead to significant artifacts. Physically, this would
157 be impossible and is analagous to inserting an object into the CT
158 scanner that is larger than the scanner itself!
159
160 \subsubsection{Scan Diameter}
161 By default, the entire \emph{view diameter} is scanned. For experimental
162 purposes, it may be desirable to scan an area either larger or smaller than
163 the \emph{view diameter}. Thus, the concept of \emph{scan ratio}
164 \latexonly{$s_r$}\latexignore{\emph{SR}}
165 is born. The scan diameter
166 \latexonly{$s_d$}\latexignore{\emph{Sd}}
167 is the diameter over which x-rays are collected and is defined as
168 \latexonly{$$s_d = v_d s_r$$}\latexignore{\\$$\emph{Sd = Vd x SR}$$\\}
169 By default and for all ordinary scanning, the \emph{scan ratio} is to
170 \texttt{1}. If the \emph{scan ratio} is less than \texttt{1},
171 you can expect significant artifacts.
172
173 \subsubsection{Focal Length}
174 The \emph{focal length},
175 \latexonly{$f$,}\latexignore{\emph{F},}
176 is the distance of the X-ray source to the center of
177 the phantom. The focal length is set as a ratio,
178 \latexonly{$f_r$,}\latexignore{\emph{FR},}
179 of the view radius. Focal length is
180 calculated as
181 \latexonly{$$f = (v_d / 2) f_r$$}\latexignore{\\$$\emph{F = (Vd / 2) x FR}$$}
182
183 For parallel geometry scanning, the focal length doesn't matter. However,
184 divergent geometry scanning (equilinear and equiangular), the \emph{focal
185 length ratio} should be set at \texttt{2} or more to avoid artifacts.
186
187
188 \subsection{Parallel Geometry}\label{geometryparallel}\index{Concepts,Scanner,Geometries,Parallel}
189
190 As mentioned above, the focal length is not used in this simple
191 geometry. The detector array is set to be the same size as the
192 \emph{scan diameter}.  For optimal scanning in this geometry, the
193 \emph{scan diameter} should be equal to the \emph{phantom
194 diameter}. This is accomplished by using the default values of
195 \texttt{1} for the \emph{view ratio} and the \emph{scan ratio}. If
196 values of less than \texttt{1} are used for these two variables,
197 significant distortions will occur.
198
199
200 \subsection{Divergent Geometries}\label{geometrydivergent}\index{Concepts,Scanner,Geometries,Divergent}
201 \subsubsection{Overview}
202 Next consider the case of equilinear (second generation) and equiangular
203 (third, fourth, and fifth generation) geometries. In these cases,
204 the x-ray beams diverge from a single source to a detector array.
205 In the equilinear mode, a single
206 source produces a fan beam which is read by a linear array of detectors.  If
207 the detectors occupy an arc of a circle, then the geometry is equiangular.
208 See figure 2.2.
209 \begin{figure}
210 \image{10cm;0cm}{divergent.eps}
211 \caption{Equilinear and equiangular geometries.}
212 \end{figure}
213
214
215 \subsubsection{Fan Beam Angle}
216 For these divergent beam geometries, the \emph{fan beam angle} needs
217 to be calculated. For real-world CT scanners, this is fixed at the
218 time of manufacture. \ctsim, however, calculates the \emph{fan beam angle},
219 $\alpha$ from the \emph{scan diameter} and the \emph{focal length}
220 \latexignore{\\$$\emph{alpha = 2 x asin ( (Sd / 2) / f)}$$\\}
221 \latexonly{\begin{equation}\label{alphacalc}\alpha = 2 \sin^{-1} ((s_d / 2) / f)\end{equation}}
222 This is illustrated in figure 2.3.
223 \begin{figure}
224 \image{10cm;0cm}{alphacalc.eps}
225 \caption{Calculation of $\alpha$}
226 \end{figure}
227
228
229 Empiric testing with \ctsim\ shows that for very large \emph{fan beam angles},
230 greater than approximately
231 \latexonly{$120^\circ$,}\latexignore{120 degrees,}
232 there are significant artifacts. The primary way to manage the
233 \emph{fan beam angle} is by varying the \emph{focal length} since the
234 \emph{scan diameter} by the size of the phantom.
235
236 To illustrate, the \emph{scan diameter} can be defined as
237 \latexonly{$$s_d = s_r v_r p_d$$}\latexignore{\\$$Sd = Sr x Vr x Pd$$\\}
238
239 Further, $f$ can be defined as
240 \latexonly{$$f = f_r (v_r p_d / 2)$$}
241 Plugging these equations into
242 \latexignore{the above equation,}\latexonly{equation~\ref{alphacalc},}
243 We have,
244 \latexonly{
245 \begin{eqnarray}
246 \alpha &= 2\,\sin^{-1} \frac{s_r v_r p_d / 2}{f_r v_r (p_d / 2)} \nonumber \\
247 &= 2\,\sin^{-1} (s_r / f_r)
248 \end{eqnarray}
249 }
250
251 Since in normal scanning $s_r = 1$, $\alpha$ depends only upon the \emph{focal length ratio}.
252
253 \subsubsection{Detector Array Size}
254 In general, you do not need to be concerned with the detector array
255 size. It is automatically calculated by \ctsim.
256
257 For parallel geometry, the detector length is equal to the scan
258 diameter.
259
260 For divergent beam geometrys, the size of the
261 detector array also depends upon the \emph{focal length}.
262 Increasing the \emph{focal length}
263 decreases the size of the detector array while increasing the \emph{scan
264 diameter} increases the detector array size.
265
266 For equiangular geometry, the detectors are spaced around a
267 circle covering an angular distance of
268 \latexonly{$\alpha$.}\latexignore{\emph{alpha}.}
269 The dotted circle in
270 \begin{figure}
271 \image{10cm;0cm}{equiangular.eps}
272 \caption{Equiangluar geometry}
273 \end{figure}
274 figure 2.4 indicates the positions of the detectors in this case.
275
276 For equilinear geometry, the detectors are space along a straight
277 line. The length of the line depends upon
278 \latexonly{$\alpha$}\latexignore{\emph{alpha}}
279 and the \emph{focal length}. It is calculated as
280 \latexonly{$$\mathrm{detLengh} = 4\,f \tan (\alpha / 2)$$}
281 \latexignore{\\$$\emph{detLength} = 4 x F x tan(alpha/2)$$\\}
282 \begin{figure}
283 \image{10cm;0cm}{equilinear.eps}
284 \caption{Equilinear geometry}
285 \end{figure}
286 An example of the this geometry is in figure 2.5.
287
288
289 \subsubsection{Examples of Geometry Settings}
290
291
292 \section{Reconstruction}\label{conceptreconstruction}\index{Concepts,Reconstruction}%
293 \subsection{Overview}
294 \subsection{Direct Inverse Fourier}
295 This method is not currently implemented in \ctsim, however it is
296 planned for a future release. This method does not give results as
297 accurate as filtered backprojection. The difference is due primarily
298 because interpolation occurs in the frequency domain rather than the
299 spatial domain.
300
301 \subsection{Filtered Backprojection}
302 The technique is comprised of two sequential steps:
303 filtering projections and then backprojecting the filtered projections. Though
304 these two steps are sequential, each view position can be processed individually.
305
306 \subsubsection{Multiple Computer Processing}
307 This parallelism is exploited in the MPI versions of \ctsim\ where the
308 data from all the views are spread about amongst all of the
309 processors. This has been testing in a 16-CPU cluster with good
310 results.
311
312 \subsubsection{Filter projections}
313 The projections for a single view have their frequency data multipled by
314 a filter of $|w|$. \ctsim\ permits four different ways to accomplish this
315 filtering.
316
317 Two of the methods use convolution of the projection data with the
318 inverse Fourier transform of $|w|$. The other two methods perform an Fourier
319 transform of the projection data and multiply that by the $|w|$ filter and
320 then perform an inverse fourier transform.
321
322 Though multiplying by $|w|$ gives the sharpest reconstructions, in
323 practice, superior results are obtained by mutiplying the $|w|$ filter
324 by another filter that attenuates the higher frequencies. \ctsim\ has
325 multiple filters for this purpose.
326
327 \subsubsection{Backprojection of filtered projections}
328 Backprojection is the process of ``smearing'' the filtered projections
329 over the reconstructing image. Various levels of interpolation can be
330 specified.  In general, the trade-off is between quality and execution
331 time.