r498: 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 \begin{figure}
111 $$\image{5cm;0cm}{scangeometry.eps}$$
112 \caption{Phantom Geometry}
113 \end{figure}
114 The maximum of the phantom length and height is used to define the square
115 that completely surrounds the phantom. Let 
116 \latexonly{$P_l$}\latexignore{\emph{Pl}}
117 be the width and height of this square. The diameter of this boundary box, 
118 \latexonly{$P_d$,}\latexignore{\emph{Pd},}
119 is then
120 \latexignore{\\$$\emph{Pl x sqrt(2)}$$\\}
121 \latexonly{$$P_d = P_l \sqrt{2}$$}
122 CT scanners actually collect projections around a circle rather than a
123 square. The diameter of this circle is also the diameter of the boundary
124 square
125 \latexonly{$P_d$.}\latexignore{\emph{Pd}.}
126 These relationships are diagrammed in figure 2.1.
127
128 \subsubsection{View Diameter}
129 The \emph{view diameter} is the area that is being processed during scanning of phantoms as
130 well as during rasterization of phantoms. By default, the \emph{view diameter}
131 is set equal to the \emph{phantom diameter}. It may be useful, especially for 
132 experimental reasons, to process an area larger (and maybe even smaller) than
133 the phantom. Thus, during rasterization or during projections, \ctsim\ will
134 ask for a \emph{view diameter ratio},
135 \latexonly{$V_{dR}$.}\latexignore{\emph{VdR}.}
136 The \emph{view diameter} is then set as
137 \latexonly{$$V_d = P_d V_{dR}$$}\latexignore{\\$$\emph{Vd = Pd x VdR}$$}
138
139 By using a 
140 \latexonly{$V_{dR}$}\latexignore{\emph{VdR}}
141 less than 1, \ctsim\ will allow
142 for a \emph{view diameter} less than 
143 \emph{phantom diameter}.
144 This will lead to significant artifacts. Physically, this would
145 be impossible and is analagous to inserting an object into the CT
146 scanner that is larger than the scanner itself!
147
148 \subsubsection{Scan Diameter}
149 By default, the entire \emph{view diameter} is scanned. For experimental
150 purposes, it may be desirable to scan an area either larger or smaller than
151 the \emph{view diameter}. Thus, the concept of \emph{scan diameter}
152 \latexonly{$S_{dR}$}\latexignore{\emph{SdR}}
153 is born. The scan diameter
154 \latexonly{$S_d$}\latexignore{\emph{Sd}}
155 is defined as
156 \latexonly{$$S_d = V_d S_{dR}$$}\latexignore{\\$$\emph{Sd = Vd x SdR}$$\\}
157 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
158 can plan on significant artifacts.
159
160 \subsubsection{Focal Length}
161 The \emph{focal length},
162 \latexonly{$F_l$,}\latexignore{\emph{Fl},}
163 is the distance of the X-ray source to the center of
164 the phantom. The focal length is set as a ratio,
165 \latexonly{$F_{lR}$,}\latexignore{\emph{FlR},}
166 of the view radius. Focal length is
167 calculated as
168 \latexonly{$$F_l = F_{lR} (V_d / 2)$$}\latexignore{\\$$\emph{Fl = FlR x (Vd / 2)}$$}
169
170 For parallel geometry scanning, the focal length doesn't matter. However, 
171 divergent geometry scanning (equilinear and equiangular), the \emph{focal
172 length ratio} should be set at \texttt{2} or more to avoid artifacts. 
173
174 \subsection{Parallel Geometry}\label{geometryparallel}\index{Concepts,Scanner,Geometries,Parallel}
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.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 \emph{fan beam angle} needs 
201 to be calculated. For real-world CT scanners, this is fixed at the
202 time of manufacture. \ctsim, however, calculates the \emph{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 2.3.
208 \begin{figure}
209 \image{10cm;0cm}{alphacalc.eps}
210 \caption{Calculation of $\alpha$}
211 \end{figure}
212
213 Empiric testing with \ctsim\ shows that for very large \emph{fan beam angles},
214 greater than approximately 
215 \latexonly{$120^{\circ}$,}\latexignore{120 degrees,}
216 there are significant artifacts. The primary way to manage the
217 \emph{fan beam angle} is by varying the \emph{focal length} since the
218 \emph{scan diameter} by the size of the phantom.
219
220 \subsubsection{Detector Array Size}
221 In general, you do not need to be concerned with the detector array
222 size. It is automatically calculated by \ctsim.  The size of the
223 detector array depends upon the \emph{focal length} and the 
224 \emph{scan diameter}. In general, increasing the \emph{focal length}
225 decreases the size of the detector array and increasing the \emph{scan
226 diameter} increases the detector array size.
227
228 For equiangular geometry, the detectors are spaced around a
229 circle covering an angular distance of 
230 \latexonly{$\alpha$.}\latexignore{\emph{alpha}.}
231 The dotted circle in
232 figure 2.4 indicates the positions of the detectors in this case. 
233
234 For equilinear geometry, the detectors are space along a straight
235 line. The length of the line depends upon 
236 \latexonly{$\alpha$}\latexignore{\emph{alpha}}
237 and the \emph{focal length}. It is calculated as
238 \latexonly{$$\mathrm{detLengh} = 4\,F_l \tan (\alpha / 2)$$}
239 \latexignore{\\$$\emph{detLength} = 4 x Fl x tan(alpha/2)$$\\}
240 An example of the this geometry is in figure 2.5.
241
242 \subsubsection{Examples of Geometry Settings}
243 Consider increasing the focal length ratio to two leaving the
244 field of view ratio as 1,  as in  Figure 4.  Now the detectors array is
245 denser, and the real field of view is closer to that specified, but note
246 again that the field of view is not used. Instead, the focal length is
247 used to give a distance from the centre of the phantom to the source, and
248 the detector array is adjusted to give an angular coverage to include the
249 whole phantom.
250 \begin{figure}
251 \image{10cm;0cm}{ctsimfig4.eps}
252 \caption{Equilinear and equiangluar geometry when focal length ratio = 2
253 and the field of view ratio = 1.}
254 \end{figure}
255 \begin{figure}
256 \image{10cm;0cm}{ctsimfig5.eps}
257 \caption{Equilinear and equiangluar geometry when focal length ratio = 4.}
258 \end{figure}
259
260
261
262 \section{Reconstruction}\label{conceptreconstruction}\index{Concepts,Reconstruction}%
263 \subsection{Overview}
264 \subsection{Direct Inverse Fourier}
265 This method is not currently implemented in \ctsim, however it is
266 planned for a future release. This method does not give results as
267 accurate as filtered backprojection. The difference is due primarily
268 because interpolation occurs in the frequency domain rather than the
269 spatial domain.
270
271 \subsection{Filtered Backprojection}
272 The technique is comprised of two sequential steps:
273 filtering projections and then backprojecting the filtered projections. Though
274 these two steps are sequential, each view position can be processed individually.
275 This parallelism is exploited in the MPI versions of \ctsim\ where the data from
276 all the views are spread about amongst all of the processors. This has been testing
277 in a 16-CPU cluster with good results.
278
279 \subsubsection{Filter projections}
280 The projections for a single view have their frequency data multipled by
281 a filter of $|w|$. \ctsim\ permits four different ways to accomplish this
282 filtering. Two of the methods use convolution of the projection data with the
283 inverse fourier transform of $|w|$. The other two methods perform an fourier
284 transform of the projection data and multiply that by the $|w|$ filter and
285 then perform an inverse fourier transform.
286
287 Though multiplying by $|w|$ gives the sharpest reconstructions, in practice, superior results are obtained by mutiplying the $|w|$ filter by
288 another filter that attenuates the higher frequencies. \ctsim\ has multiple
289 filters for this purpose.
290
291 \subsubsection{Backprojection of filtered projections}
292 Backprojection is the process of ``smearing'' the filtered projections over
293 the reconstructing image.
294