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