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