r500: 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 \subsection{Parallel Geometry}\label{geometryparallel}\index{Concepts,Scanner,Geometries,Parallel}
185
186 As mentioned above, the focal length is not used in this simple
187 geometry. The detector array is set to
188 be the same size as the \emph{scan diameter}. 
189 For optimal scanning in this geometry, the \emph{scan diameter} should
190 be equal to the \emph{phantom diameter}. This is accomplished by using
191 the default values of \texttt{1} for the \emph{view diameter ratio} and
192 the \emph{scan diameter ratio}. If values of less than \texttt{1} are
193 used for these two variables, significant distortions will occur.
194
195 \subsection{Divergent Geometries}\label{geometrydivergent}\index{Concepts,Scanner,Geometries,Divergent}
196 \subsubsection{Overview}
197 Next consider the case of equilinear (second generation) and equiangular
198 (third, fourth, and fifth generation) geometries. In these cases,
199 the x-ray beams diverge from a single source to a detector array.
200 In the equilinear mode, a single
201 source produces a fan beam which is read by a linear array of detectors.  If
202 the detectors occupy an arc of a circle, then the geometry is equiangular.
203 See figure 2.2.
204 \begin{figure}
205 \image{10cm;0cm}{divergent.eps}
206 \caption{Equilinear and equiangular geometries.}
207 \end{figure}
208
209 \subsubsection{Fan Beam Angle}
210 For these divergent beam geometries, the \emph{fan beam angle} needs 
211 to be calculated. For real-world CT scanners, this is fixed at the
212 time of manufacture. \ctsim, however, calculates the \emph{fan beam angle},
213 \latexonly{$\alpha$,}\latexignore{\emph{alpha},} 
214 from the diameter of the \emph{scan diameter} and the \emph{focal length}
215 \latexignore{\\$$\emph{alpha = 2 x asin ( (Sd / 2) / F)}$$\\}
216 \latexonly{$$\alpha = 2 \sin^{-1} ((s_d / 2) / f)$$}
217 This is illustrated in figure 2.3.
218 \begin{figure}
219 \image{10cm;0cm}{alphacalc.eps}
220 \caption{Calculation of $\alpha$}
221 \end{figure}
222
223 Empiric testing with \ctsim\ shows that for very large \emph{fan beam angles},
224 greater than approximately 
225 \latexonly{$120^{\circ}$,}\latexignore{120 degrees,}
226 there are significant artifacts. The primary way to manage the
227 \emph{fan beam angle} is by varying the \emph{focal length} since the
228 \emph{scan diameter} by the size of the phantom.
229
230 \subsubsection{Detector Array Size}
231 In general, you do not need to be concerned with the detector array
232 size. It is automatically calculated by \ctsim.  The size of the
233 detector array depends upon the \emph{focal length} and the 
234 \emph{scan diameter}. In general, increasing the \emph{focal length}
235 decreases the size of the detector array and increasing the \emph{scan
236 diameter} increases the detector array size.
237
238 For equiangular geometry, the detectors are spaced around a
239 circle covering an angular distance of 
240 \latexonly{$\alpha$.}\latexignore{\emph{alpha}.}
241 The dotted circle in
242 \begin{figure}
243 \image{10cm;0cm}{equiangular.eps}
244 \caption{Equiangluar geometry}
245 \end{figure}
246 figure 2.4 indicates the positions of the detectors in this case. 
247
248 For equilinear geometry, the detectors are space along a straight
249 line. The length of the line depends upon 
250 \latexonly{$\alpha$}\latexignore{\emph{alpha}}
251 and the \emph{focal length}. It is calculated as
252 \latexonly{$$\mathrm{detLengh} = 4\,f \tan (\alpha / 2)$$}
253 \latexignore{\\$$\emph{detLength} = 4 x F x tan(alpha/2)$$\\}
254 \begin{figure}
255 \image{10cm;0cm}{equilinear.eps}
256 \caption{Equilinear geometry}
257 \end{figure}
258 An example of the this geometry is in figure 2.5.
259
260 \subsubsection{Examples of Geometry Settings}
261 Consider increasing the focal length ratio to two leaving the
262 field of view ratio as 1,  as in  Figure 4.  Now the detectors array is
263 denser, and the real field of view is closer to that specified, but note
264 again that the field of view is not used. Instead, the focal length is
265 used to give a distance from the center of the phantom to the source, and
266 the detector array is adjusted to give an angular coverage to include the
267 whole phantom.
268
269
270
271 \section{Reconstruction}\label{conceptreconstruction}\index{Concepts,Reconstruction}%
272 \subsection{Overview}
273 \subsection{Direct Inverse Fourier}
274 This method is not currently implemented in \ctsim, however it is
275 planned for a future release. This method does not give results as
276 accurate as filtered backprojection. The difference is due primarily
277 because interpolation occurs in the frequency domain rather than the
278 spatial domain.
279
280 \subsection{Filtered Backprojection}
281 The technique is comprised of two sequential steps:
282 filtering projections and then backprojecting the filtered projections. Though
283 these two steps are sequential, each view position can be processed individually.
284 This parallelism is exploited in the MPI versions of \ctsim\ where the data from
285 all the views are spread about amongst all of the processors. This has been testing
286 in a 16-CPU cluster with good results.
287
288 \subsubsection{Filter projections}
289 The projections for a single view have their frequency data multipled by
290 a filter of $|w|$. \ctsim\ permits four different ways to accomplish this
291 filtering. Two of the methods use convolution of the projection data with the
292 inverse Fourier transform of $|w|$. The other two methods perform an Fourier
293 transform of the projection data and multiply that by the $|w|$ filter and
294 then perform an inverse fourier transform.
295
296 Though multiplying by $|w|$ gives the sharpest reconstructions, in practice, superior results are obtained by mutiplying the $|w|$ filter by
297 another filter that attenuates the higher frequencies. \ctsim\ has multiple
298 filters for this purpose.
299
300 \subsubsection{Backprojection of filtered projections}
301 Backprojection is the process of ``smearing'' the filtered projections over
302 the reconstructing image. Various levels of interpolation can be specified.
303 In general, the trade-off is between quality and execution time.
304