r497: 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 the standard phantoms used in the CT literature (the Herman
25 and the Shepp-Logan) can be constructed.  In fact
26 \ctsim\ provides a shortcut to construct those phantoms for you.  It also
27 allows you to write a file in which the composition of your own phantom is
28 described.
29
30 The types of phantom elements and their definitions are taken from Herman's 1980
31 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 item 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
49 \subsection{Phantom Elements}\label{phantomelements}\index{Concepts,Phantoms,Elements}
50
51 \subsubsection{ellipse}
52 Ellipses use dx and dy to define the semi-major and semi-minor axis lengths,
53 with the centre of the ellipse at cx and cy.  Of note, the commonly used
54 phantom described by Shepp and Logan\cite{SHEPP74} uses only ellipses.
55
56 \subsubsection{rectangle}
57 Rectangles use
58 cx  and cy to define the position of the centre of the rectangle with respect
59 to the origin.  dx and dy  are the half-width and half-height of the
60 rectangle.
61
62 \subsubsection{triangle}
63 Triangles are drawn with the centre of the base at cx,cy, with a base
64 width of 2*dx in x direction, and a height of dy.  Rotations are then
65 applied about the origin.
66
67 \subsubsection{sector}
68 It appears that dx and dy
69 define the end points of a radius of the sector, from which the radius and
70 the angle of the two arms of the sector are calculated.  But then
71 orientation and centering of the sector don't make much sense yet.
72
73 \subsubsection{segment}
74 Segments are the segments of a circle between a chord and the
75 perimeter of the circle.  This also isn't clear to me, but it appears that
76 perhaps the distance from chord to circle perimeter, and circle radius is
77 defined by dx and dy. Chord is always horizontal through the origin, then
78 translated and then rotated (???).
79
80 \subsection{Phantom Size}
81 Also note that the overall dimensions of the phantom are increased by 1\%
82 above the specified sizes to avoid clipping due to round-off errors.  
83 So, if the phantom is defined as
84 a rectangle of size 0.1 by 0.1, the actual phantom has extent 0.101
85 in each direction.
86
87 \section{Scanner}\label{conceptscanner}\index{Concepts,Scanner}%
88 \subsection{Sizes}
89 Understanding the scanning geometry is the most complicated aspect
90 of using \ctsim. For our real-world CT simulators, this is actually
91 quite simple. The geometry is fixed by the manufacturer during
92 the construction of the scanner and can not be changed. 
93 \ctsim, being a very flexible simulator,
94 gives tremendous options is setting up the geometry for a scan.
95
96 In general, the geometry for a scan all starts from the size of the
97 phantom being scanned. This is because \ctsim\ allows for statistical
98 comparisons between the original phantom image and it's reconstructions.
99 Since CT scanners scan a circular area, the first important
100 variable is the diameter of the circle surround the phantom, or the 
101 \emph{phantom diameter}. Remember, as mentioned above, the
102 phantom dimensions are also padded by 1\%.
103
104 The other important geometry variables for scanning objects are 
105 the \emph{view diameter}, \emph{scan diameter}, and \emph{focal length}.
106 These variables are all input into \ctsim\ in terms of ratios rather than
107 absolute values.
108
109 \subsubsection{Phantom Diameter}
110 The maximum of the phantom length and height is used to define the square
111 that completely surrounds the phantom. Let 
112 \latexonly{$P_l$}\latexignore{\emph{Pl}}
113 be the width and height of this square. The diameter of this boundary box, 
114 \latexonly{$P_d$,}\latexignore{\emph{Pd},}
115 is then
116 \latexignore{\\$$\emph{Pl x sqrt(2)}$$\\}
117 \latexonly{$$P_d = P_l \sqrt{2}$$}
118 CT scanners actually collect projections around a circle rather than a
119 square. The diameter of this circle is also the diameter of the boundary
120 square
121 \latexonly{$P_d$.}\latexignore{\emph{Pd}.}
122 These relationships are diagrammed in figure 1.
123
124 \subsubsection{View Diameter}
125 The \emph{view diameter} is the area that is being processed during scanning of phantoms as
126 well as during rasterization of phantoms. By default, the \emph{view diameter}
127 is set equal to the \emph{phantom diameter}. It may be useful, especially for 
128 experimental reasons, to process an area larger (and maybe even smaller) than
129 the phantom. Thus, during rasterization or during projections, \ctsim\ will
130 ask for a \emph{view diameter ratio},
131 \latexonly{$V_{dR}$.}\latexignore{\emph{VdR}.}
132 The \emph{view diameter} is then set as
133 \latexonly{$$V_d = P_d V_{dR}$$}\latexignore{\\$$\emph{Vd = Pd x VdR}$$}
134
135 By using a 
136 \latexonly{$V_{dR}$}\latexignore{\emph{VdR}}
137 less than 1, \ctsim\ will allow
138 for a \emph{view diameter} less than 
139 \emph{phantom diameter}.
140 This will lead to significant artifacts. Physically, this would
141 be impossible and is analagous to inserting an object into the CT
142 scanner that is larger than the scanner itself!
143
144 \subsubsection{Scan Diameter}
145 By default, the entire \emph{view diameter} is scanned. For experimental
146 purposes, it may be desirable to scan an area either larger or smaller than
147 the \emph{view diameter}. Thus, the concept of \emph{scan diameter}
148 \latexonly{$S_{dR}$}\latexignore{\emph{SdR}}
149 is born. The scan diameter
150 \latexonly{$S_d$}\latexignore{\emph{Sd}}
151 is defined as
152 \latexonly{$$S_d = V_d S_{dR}$$}\latexignore{\\$$\emph{Sd = Vd x SdR}$$\\}
153 By default and for all ordinary scanning, the \emph{scan diameter ratio} is to \texttt{1}. If the \emph{scan diameter ratio} is less than \texttt{1}, you
154 can plan on significant artifacts.
155
156 \subsubsection{Focal Length}
157 The \emph{focal length},
158 \latexonly{$F_l$,}\latexignore{\emph{Fl},}
159 is the distance of the X-ray source to the center of
160 the phantom. The focal length is set as a ratio,
161 \latexonly{$F_{lR}$,}\latexignore{\emph{FlR},}
162 of the view radius. Focal length is
163 calculated as
164 \latexonly{$$F_l = F_{lR} (V_d / 2)$$}\latexignore{\\$$\emph{Fl = FlR x (Vd / 2)}$$}
165
166 For parallel geometry scanning, the focal length doesn't matter. However, 
167 divergent geometry scanning (equilinear and equiangular), the \emph{focal
168 length ratio} should be set at \texttt{2} or more to avoid artifacts. 
169
170 \subsection{Parallel Geometry}\label{geometryparallel}\index{Concepts,Scanner,Geometries,Parallel}
171 \begin{figure}
172 \image{10cm;0cm}{ctsimfig1.eps}
173 \caption{Geometry used for a 1st generation, parallel beam CT scanner}\label{fistgenfig}
174 \end{figure}
175
176 As mentioned above, the focal length is not used in this simple
177 geometry. The detector array is set to
178 be the same size as the \emph{scan diameter}. 
179 For optimal scanning in this geometry, the \emph{scan diameter} should
180 be equal to the \emph{phantom diameter}. This is accomplished by using
181 the default values of \texttt{1} for the \emph{view diameter ratio} and
182 the \emph{scan diameter ratio}. If values of less than \texttt{1} are
183 used for these two variables, significant distortions will occur.
184
185 \subsection{Divergent Geometries}\label{geometrydivergent}\index{Concepts,Scanner,Geometries,Divergent}
186 \subsubsection{Overview}
187 Next consider the case of equilinear (second generation) and equiangular
188 (third, fourth, and fifth generation) geometries. In these cases,
189 the x-ray beams diverge from a single source to a detector array.
190 In the equilinear mode, a single
191 source produces a fan beam which is read by a linear array of detectors.  If
192 the detectors occupy an arc of a circle, then the geometry is equiangular.
193 See figure 2.
194 \begin{figure}
195 \image{10cm;0cm}{ctsimfig2.eps}
196 \caption{Equilinear and equiangular geometries.}
197 \end{figure}
198
199 \subsubsection{Fan Beam Angle}
200 For these divergent beam geometries, the angle of the fan beam needs 
201 to be calculated. For real-world CT scanners, this is fixed at the
202 time of manufacture. \ctsim\, however, calculates the fan beam angle,
203 \latexonly{$\alpha$,}\latexignore{\emph{alpha},} 
204 from the diameter of the \emph{scan diameter} and the \emph{focal length}
205 \latexignore{\\$$\emph{alpha = 2 x asin ( (Sd / 2) / F_l)}$$\\}
206 \latexonly{$$\alpha = 2 \sin^{-1} ((S_d / 2) / F_l)$$}
207 This is illustrated in figure 3.
208 \begin{figure}
209 \image{10cm;0cm}{alphacalc.eps}
210 \caption{Calculation of $\alpha$}
211 \end{figure}
212
213 If this quantity is less than or equal to zero, then at least for some
214 projections  the source is inside the phantom.  Perhaps a figure will help at
215 this point. Consider first the case where $f_{vR} = f_{lR} =1 $, figure 3. The
216 square in the figure bounds the phantom and has sides $l_p$.  For this case
217 then,
218 \latexonly{$$f_l=\sqrt{2}l_p/2 = l_p/\sqrt{2}$$,
219 $$f_v = \sqrt{2}l_p$$,
220 and
221 $$d_{hs} = {l_p}/{2}$$.
222 Then
223 $$\mathrm{dFocalPastPhm} = ({l_p}/{2}) (\sqrt{2}-1)$$
224 }
225 \begin{figure}
226 \image{5cm;0cm}{ctsimfig3.eps}
227 \caption{Equilinear and equiangluar geometry when focal length ratio =
228 field of view ratio = 1.}
229 \end{figure}
230 The angle $\alpha$ is now defined as shown in figure 3, and the detector
231 length is adjusted to subtend the angle $2\alpha$ as shown.  Note that the
232 size of the detector array may have changed and the field of view is not
233 used.
234 For a circular array of detectors, the detectors are spaced around a
235 circle covering an angular distance of $2\alpha$.  The dotted circle in
236 figure 3 indicates the positions of the detectors in this case. Note that
237 detectors at the ends of the range would not be illuminated by the source.
238
239 Now, consider increasing the focal length ratio to two leaving the
240 field of view ratio as 1,  as in  Figure 4.  Now the detectors array is
241 denser, and the real field of view is closer to that specified, but note
242 again that the field of view is not used. Instead, the focal length is
243 used to give a distance from the centre of the phantom to the source, and
244 the detector array is adjusted to give an angular coverage to include the
245 whole phantom.
246 \begin{figure}
247 \image{10cm;0cm}{ctsimfig4.eps}
248 \caption{Equilinear and equiangluar geometry when focal length ratio = 2
249 and the field of view ratio = 1.}
250 \end{figure}
251 \begin{figure}
252 \image{10cm;0cm}{ctsimfig5.eps}
253 \caption{Equilinear and equiangluar geometry when focal length ratio = 4.}
254 \end{figure}
255
256 \section{Reconstruction}\label{conceptreconstruction}\index{Concepts,Reconstruction}%
257 \subsection{Overview}
258 \subsection{Direct Inverse Fourier}
259 This method is not currently implemented in \ctsim, however it is
260 planned for a future release. This method does not give results as
261 accurate as filtered backprojection. The difference is due primarily
262 because interpolation occurs in the frequency domain rather than the
263 spatial domain.
264
265 \subsection{Filtered Backprojection}
266 The technique is comprised of two sequential steps:
267 filtering projections and then backprojecting the filtered projections. Though
268 these two steps are sequential, each view position can be processed individually.
269 This parallelism is exploited in the MPI versions of \ctsim\ where the data from
270 all the views are spread about amongst all of the processors. This has been testing
271 in a 16-CPU cluster with good results.
272
273 \subsubsection{Filter projections}
274 The projections for a single view have their frequency data multipled by
275 a filter of $|w|$. \ctsim\ permits four different ways to accomplish this
276 filtering. Two of the methods use convolution of the projection data with the
277 inverse fourier transform of $|w|$. The other two methods perform an fourier
278 transform of the projection data and multiply that by the $|w|$ filter and
279 then perform an inverse fourier transform.
280
281 Though multiplying by $|w|$ gives the sharpest reconstructions, in practice, superior results are obtained by mutiplying the $|w|$ filter by
282 another filter that attenuates the higher frequencies. \ctsim\ has multiple
283 filters for this purpose.
284
285 \subsubsection{Backprojection of filtered projections}
286 Backprojection is the process of ``smearing'' the filtered projections over
287 the reconstructing image.
288