-
Notifications
You must be signed in to change notification settings - Fork 0
/
manual.tex
3704 lines (3193 loc) · 159 KB
/
manual.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
\documentclass[]{report}
% Define page
\usepackage[top=1in, bottom=1in, left=1in, right=1in]{geometry}
\linespread{1.1}
% For math
\usepackage{amsmath,amsthm,amssymb}
\usepackage{bm}
% For figures
\usepackage{graphicx,subfigure,psfrag,epsfig}
\usepackage{pifont}% for symbol cross
\graphicspath{{images/}}
% Url's and clickable pdf
\usepackage[dvips,breaklinks,bookmarks,bookmarksnumbered]{hyperref}
\hypersetup{
pdftitle={elastix, the manual},
pdfauthor={Stefan Klein and Marius Staring},
colorlinks={true}, % false: boxed links; true: colored links
linkcolor=red, % color of internal links
citecolor=green, % color of links to bibliography
filecolor=magenta, % color of file links
urlcolor=cyan % color of external links
}
\usepackage{url,breakurl}
\usepackage{natbib}
\usepackage{ctable}
% Definitions
\newcommand{\elastix}{\texttt{elastix}}
\newcommand{\transformix}{\texttt{transformix}}
\newcommand{\etal}{\emph{et al.}}
\newcommand{\vx}{\bm{x}}
\newcommand{\vxt}[1][]{\bm{\widetilde x}_{#1}}
\newcommand{\vu}{\bm{u}}
\newcommand{\vux}{\bm{u}(\bm{x})}
\newcommand{\vmu}{\bm{\mu}}
\newcommand{\vT}{\bm{T}}
\newcommand{\vTm}{\bm{T}_{\vmu}}
\newcommand{\vTmx}{\bm{T}_{\vmu}(\bm{x})}
\newcommand{\CC}{\mathcal{C}}
\newcommand{\Ncal}{\mathcal{N}}
\newcommand{\Sim}{\mathcal{S}}
\newcommand{\Pen}{\mathcal{P}}
\newcommand{\D}[2]{\frac{\partial #1}{\partial #2}}
\newcommand{\Dd}[3]{\frac{\partial^2 #1}{\partial #2 \partial #3}}
% see page474 latex manual:
\newcommand\relphantom[1]{\mathrel{\phantom{#1}}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
\title{\includegraphics[width=8cm]{elastixLogo.eps}\\\vspace{1cm}the manual\vspace{1cm}}
\author{Stefan Klein and Marius Staring}
%\date{}
\maketitle
\setcounter{page}{1} \pagenumbering{roman} \tableofcontents
%\newpage
%\listoffigures
%\newpage
%\listoftables
\newpage
\pagenumbering{arabic} \setcounter{page}{1}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% main text
\chapter{Introduction}\label{chp:Introduction}
This manual describes a software package for image registration:
\elastix. The software consists of a collection of algorithms that
are commonly used to solve medical image registration problems. A
large part of the code is based on the Insight Toolkit (ITK). The
modular design of \elastix\ allows users to quickly test and
compare different registration methods for their specific
applications. The command-line interface simplifies the processing
of large amounts of data sets, using scripting.
\section{Outline of this manual}
In Chapter~\ref{chp:Registration} quite an extensive introduction to
some general theory of image registration is given. Also, the
different components of which a registration method consists, are
treated. In Chapter~\ref{chp:elastix}, \elastix\ is described and
its usage is explained. Chapter~\ref{chp:transformix} is dedicated
to \transformix, a program accompanying \elastix. A tutorial is
given in Chapter~\ref{chp:Tutorial}, including many recommendations
based on the authors' experiences. More advanced registration topics
are covered in Chapter \ref{chp:advanced}. The final chapter
provides more details for those interested in the setup of the
source code, gives information on how to implement your own
additions to \elastix, and describes the use of \elastix\ as a
library instead of a command line program. In the Appendices
\ref{chp:ExampleParam} and \ref{chp:ExampleTransformParam} example
(transform) parameter files are given. Appendix \ref{chp:License}
contains the software license and disclaimer under which \elastix\
is currently distributed.
%Chapter~\ref{chp:develop} provides more details about the source code
%and explains how to create extensions of \elastix.
\section{Quick start}
\begin{itemize}
\item Download \elastix\ from \url{https://github.com/SuperElastix/elastix/releases}.
See Section \ref{sec:elastix:install} for details about the
installation. Do not forget to check the \elastix\ GitHub Discussions,
which is the main forum for questions and announcements.
\item Read some basics about the program at
\url{https://elastix.dev} and in this manual.
\item Try the example of usage. It can be found in the \emph{About}
section of the website. If you don't get the example running at your
computer take a look at the FAQ in the general section:
\begin{quote}
\url{https://github.com/SuperElastix/elastix/wiki/FAQ}
\end{quote}
\item Read the complete manual if you are the type of person that
first wants to know.
\item Get started with your own application. If you need more information
at this point you can now start reading the manual. You can find more
information on tuning the parameters in Chapter \ref{chp:Tutorial}. A
list of all available parameters can be found at
\url{https://elastix.dev/doxygen/pages.html}. Also take a look at
the \emph{parameter file database} at
\url{https://github.com/SuperElastix/elastix/wiki}, for many example parameter
files.
\item When you are stuck, don't miss the tutorial in Chapter
\ref{chp:Tutorial} of this manual. Also, take a look at the FAQ again
for some common problems.
\item When you are still stuck, do not hesitate to submit your question to the elastix GitHub Discussions.
In general, you will soon get an answer.
\url{https://github.com/SuperElastix/elastix/discussions}.
\end{itemize}
\section{Acknowledgements}
The first version of this manual has been written while the authors
worked at the Image Sciences Institute (ISI,
\url{http://www.isi.uu.nl}), Utrecht, The Netherlands. We thank the
users of \elastix, whose questions and remarks helped improving the
usability and documentation of \elastix. Specifically, we want to
thank the following people for proofreading (parts of) this manual
when we constructed a first version: Josien Pluim, Keelin Murphy,
Martijn van der Bom, Sascha M\"{u}nzing, Jeroen de Bresser, Bram van
Ginneken, Kajo van der Marel, Adri\"{e}nne Mendrik (in no specific
order). Over the years several users have contributed their work as
new components in \elastix, see the website for a list.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\chapter{Image registration}\label{chp:Registration}
This chapter introduces primary registration concepts that are at
the base of \elastix. More advanced registration topics are covered
in Chapter \ref{chp:advanced}.
Image registration is an important tool in the field of medical
imaging. In many clinical situations several images of a patient are
made in order to analyse the patient's situation. These images are
acquired with, for example, X-ray scanners, Magnetic Resonance
Imaging (MRI) scanners, Computed Tomography (CT) scanners, and
Ultrasound scanners, which provide knowledge about the anatomy of
the subject. Combination of patient data, mono- or multi-modal,
often yields additional clinical information not apparent in the
separate images. For this purpose, the spatial relation between the
images has to be found. Image registration is the task of finding a
spatial one-to-one mapping from voxels in one image to voxels in the
other image, see Figure \ref{fig:concept}. Good reviews on the
subject are given in
\citet{MaintzEA98,LesterEA99,HillEA01,Hajnal01,Zit03:Image,
Modersitzki04:Numerical}, and more recently \cite{Sotiras2013}.
The following section introduces the mathematical formulation of
the registration process and gives an overview of the components
of which a general registration method consists. After that, in
Sections~\ref{sec:comp:metric}-\ref{sec:comp:multiresolution},
each component is discussed in more detail. For each component,
the name used by \elastix\ is given, in \texttt{typewriter} style.
In Section~\ref{sec:evaluation}, methods to evaluate the
registration results are discussed.
\section{Registration framework}\label{sec:framework}
\begin{figure}[tb]
\centering
\includegraphics[width=8cm]{ImageRegistrationConcept.eps}
\caption{Image registration is the task of finding a spatial
transformation mapping one image to another. Left is the fixed image
and right the moving image. Adopted from
\citet{ITKSoftwareGuideSecondEdition}.} \label{fig:concept}
\end{figure}
Two images are involved in the registration process. One image, the
\emph{moving image} $I_M(\vx)$, is deformed to fit the other image,
the \emph{fixed image} $I_F(\vx)$. The fixed and moving image are of
dimension $d$ and are each defined on their own spatial domain:
$\Omega_F \subset \mathbb{R}^d$ and $\Omega_M \subset \mathbb{R}^d$,
respectively. Registration is the problem of finding a
\emph{displacement} $\vux$ that makes $I_M(\vx + \vux)$ spatially
aligned to $I_F(\vx)$. An equivalent formulation is to say that
registration is the problem of finding a \emph{transformation}
$\vT(\vx) = \vx + \vux $ that makes $I_M(\vT(\vx))$ spatially
aligned to $I_F(\vx)$. The transformation is defined as a mapping
from the fixed image to the moving image, i.e. $\vT: \Omega_F
\subset \mathbb{R}^d \rightarrow \Omega_M \subset \mathbb{R}^d$. The
quality of alignment is defined by a distance or similarity measure
$\Sim$, such as the sum of squared differences (SSD), the
correlation ratio, or the mutual information (MI) measure. Because
this problem is ill-posed for nonrigid transformations $\vT$, a
regularisation or penalty term $\Pen$ is often introduced that
constrains $\vT$.
Commonly, the registration problem is formulated as an optimisation
problem in which the cost function $\mathcal{C}$ is minimised w.r.t.
$\vT$:
\begin{align}
\hat \vT &= \arg \min_{\vT} \CC (\vT; I_F,I_M), \qquad \text{with} \label{eq:registration1}\\
\CC(\vT; I_F,I_M) &= -\Sim(\vT; I_F,I_M) + \gamma
\Pen(\vT),\label{eq:registration2}
\end{align}
where $\gamma$ weighs similarity against regularity. To solve the above
minimisation problem, there are basically two approaches: parametric and
nonparametric. The reader is referred to \cite{Fis04:Unified} for an overview
on nonparametric methods, which are not discussed in this manual. The \elastix\
software is based on the parametric approach. In parametric methods, the number
of possible transformations is limited by introducing a parametrization (model)
of the transformation. The original optimisation problem thus becomes:
\begin{align}
\hat\vTm &= \arg \min_{\vTm}
\CC(\vTm ; I_F,I_M), \label{eq:towardsparametric}
\end{align}
where the subscript $\vmu$ indicates that the transform has been
parameterised. The vector $\vmu$ contains the values of the
``transformation parameters''. For example, when the
transformation is modelled as a 2D rigid transformation, the
parameter vector $\vmu$ contains one rotation angle and the
translations in $x$ and $y$ direction. We may write Equation
(\ref{eq:towardsparametric}) also as:
\begin{align}
\hat\vmu &= \arg \min_{\vmu} \CC(\vmu; I_F,I_M).
\label{eq:parametric}
\end{align}
From this equation it becomes clear that the original problem
(\ref{eq:registration1}) has been simplified. Instead of optimising
over a ``space of functions $\vT$'', we now optimise over the
elements of $\vmu$. Examples of other transformation models are given
in Section~\ref{sec:comp:transform}.
\begin{figure}[tb]
\centering
\includegraphics[width=\textwidth]{images/registrationcomponents.eps}
\caption{The basic registration components.}
\label{fig:registrationcomponents}
\end{figure}
Figure~\ref{fig:registrationcomponents} shows the general components
of a parametric registration algorithm in a block scheme. The scheme
is a slightly extended version of the scheme introduced in
\cite{ITKSoftwareGuideSecondEdition}. Several components can be
recognised from Equations
(\ref{eq:registration1})-(\ref{eq:parametric}); some will be
introduced later. First of all, we have the images. The concept of
an image needs to be defined. This is done in
Section~\ref{sec:comp:image}. Then we have the cost function $\CC$,
or ``metric'', which defines the quality of alignment. As mentioned
earlier, the cost function consists of a similarity measure $\Sim$
and a regularisation term $\Pen$. The regularisation term $\Pen$ is
not discussed in this chapter, but in Chapter \ref{chp:advanced}.
The similarity measure $\Sim$ is discussed in
Section~\ref{sec:comp:metric}. The definition of the similarity
measure introduces the sampler component, which is treated in
Section~\ref{sec:comp:sampler}. Some examples of transformation
models $\vT_{\vmu}$ are given in Section~\ref{sec:comp:transform}.
The optimisation procedure to actually solve the problem
(\ref{eq:parametric}) is explained in Section
\ref{sec:comp:optimiser}. During the optimisation, the value
$I_M(\vT_{\vmu}(\vx))$ is evaluated at non-voxel positions, for
which intensity interpolation is needed. Choices for the
interpolator are described in Section \ref{sec:comp:interpolator}.
Another thing, not immediately clear from Equations
(\ref{eq:registration1})-(\ref{eq:parametric}), is the use of
multi-resolution strategies to speed-up registration, and to make it
more robust, see Section \ref{sec:comp:multiresolution}.
\section{Images}\label{sec:comp:image}
Since image registration is all about images, we have to be
careful with what is meant by an image. We adopt the notion of an
image from the Insight Toolkit \citep[p.
40]{ITKSoftwareGuideSecondEdition}:
\begin{quote}
Additional information about the images is considered mandatory.
In particular the information associated with the physical spacing
between pixels and the position of the image in space with respect
to some world coordinate system are extremely important. Image
origin and spacing are fundamental to many applications.
Registration, for example, is performed in physical coordinates.
Improperly defined spacing and origins will result in inconsistent
results in such processes. Medical images with no spatial
information should not be used for medical diagnosis, image
analysis, feature extraction, assisted radiation therapy or image
guided surgery. In other words, medical images lacking spatial
information are not only useless but also hazardous.
Figure \ref{fig:image} illustrates the main geometrical concepts
associated with the itk::Image. In this figure, circles are used
to represent the centre of pixels. The value of the pixel is
assumed to exist as a Dirac Delta Function located at the pixel
centre. Pixel spacing is measured between the pixel centres and
can be different along each dimension. The image origin is
associated with the coordinates of the first pixel in the image. A
pixel is considered to be the rectangular region surrounding the
pixel centre holding the data value. This can be viewed as the
Voronoi region of the image grid, as illustrated in the right side
of the figure. Linear interpolation of image values is performed
inside the Delaunay region whose corners are pixel centres.
\end{quote}
\begin{figure}[tb]
\centering
\includegraphics[width=12cm]{ImageOriginAndSpacing.eps}
\caption{Geometrical concepts associated with the ITK image.
Adopted from \citet{ITKSoftwareGuideSecondEdition}.}
\label{fig:image}
\end{figure}
Therefore, you should take care that you use an image format that is
able to store the relevant information (e.g. \texttt{mhd}, DICOM).
Some image formats, like \texttt{bmp}, do not store the origin and
spacing. This may cause serious problems! Note that \elastix\
supports all file formats that are supported by the ITK
(\url{https://itk.org/Wiki/ITK/File_Formats}).
Up to \elastix\ version 4.2, the image orientation (direction cosines) was not
yet fully supported in \elastix. From \elastix\ 4.3, image orientation is fully
supported, but can be disabled for backward compatibility reasons.
\section{Metrics}\label{sec:comp:metric}
Several choices for the similarity measure can be found in the
literature. Some common choices are described below. Between brackets
the name of the metric in \elastix\ is given:
\begin{description}
\item[Mean Squared Difference (MSD):] (\texttt{AdvancedMeanSquares})
The MSD is defined as:
\begin{align}
\mathrm{MSD}(\vmu;I_F,I_M) &= \frac{1}{|\Omega_F|}
\sum\limits_{\vx_i \in \Omega_F} \left( I_F(\vx_i) -
I_M(\vT_{\vmu}(\vx_i)) \right)^2,\label{eq:ssd}
\end{align}
with $\Omega_F$ the domain of the fixed image $I_F$, and
$|\Omega_F|$ the number of voxels. Given a transformation $\vT$,
this measure can easily be implemented by looping over the voxels
in the fixed image, taking $I_F(\vx_i)$, calculating
$I_M(\vT_{\vmu}(\vx_i))$ by interpolation, and adding the squared
difference to the sum.
\item[Normalised Correlation Coefficient (NCC):]
(\texttt{AdvancedNormalizedCorrelation}) The NCC is defined as:
\begin{align}
\mathrm{NCC}(\vmu;I_F,I_M) &= \frac{ \sum\limits_{\vx_i \in \Omega_F}
\left( I_F(\vx_i) - \overline{I_F} \right) \left( I_M(\vTm(\vx_i)) -
\overline{I_M} \right) }{ \sqrt{\sum\limits_{\vx_i \in \Omega_F}
\left( I_F(\vx_i) - \overline{I_F} \right)^2 \sum\limits_{\vx_i \in
\Omega_F} \left( I_M(\vTm(\vx_i)) - \overline{I_M} \right)^2}
},\label{eq:ncc}
\end{align}
with the average grey-values
$\overline{I_F}=\frac{1}{|\Omega_F|}\sum\limits_{\vx_i \in
\Omega_F} I_F(\vx_i)$ and
$\overline{I_M}=\frac{1}{|\Omega_F|}\sum\limits_{\vx_i \in
\Omega_F} I_M(\vT_{\vmu}(\vx_i))$.
\item[Mutual Information (MI):] (\texttt{AdvancedMattesMutualInformation})
For MI \citep{MaesEA97,ViolaEA97,MattesEA03} we use a definition
given by \citet{ThevenazEA00a}:
\begin{align}
\mathrm{MI}(\vmu; I_F, I_M) &=
\sum\limits_{m\in L_M} \sum\limits_{f\in L_F}
p(f,m;\vmu) \log_2
\left( \frac{ p(f,m;\vmu) }{ p_F(f) p_M(m;\vmu) }
\right),\label{eq:MI}
\end{align}
where $L_F$ and $L_M$ are sets of regularly spaced intensity bin
centres, $p$ is the discrete joint probability, and $p_F$ and
$p_M$ are the marginal discrete probabilities of the fixed and
moving image, obtained by summing $p$ over $m$ and $f$,
respectively. The joint probabilities are estimated using B-spline
Parzen windows:
\begin{align}
\begin{split}
p(f,m;\vmu) &= \frac{1}{|\Omega_F|} \sum\limits_{\vx_i \in \Omega_F}
w_F( f/\sigma_F - I_F(\vx_i)/\sigma_F ) \\
&\relphantom{=}\times w_M( m/\sigma_M - I_M(\vTm(\vx_i))/\sigma_M ),
\end{split} \label{eq:histogram}
\end{align}
where $w_F$ and $w_M$ represent the fixed and moving B-spline
Parzen windows. The scaling constants $\sigma_F$ and $\sigma_M$
must equal the intensity bin widths defined by $L_F$ and $L_M$.
These follow directly from the grey-value ranges of $I_F$ and
$I_M$ and the user-specified number of histogram bins $|L_F|$ and
$|L_M|$.
\item[Normalized Mutual Information (NMI):]
(\texttt{NormalizedMutualInformation})\\ NMI is defined by
$\mathrm{NMI} = ( H(I_F) + H(I_M) ) / H(I_F,I_M)$, with $H$
denoting entropy. This expression can be compared to the
definition of MI in terms of $H$: $\mathrm{MI} = H(I_F) + H(I_M) -
H(I_F,I_M)$. Again, with the joint probabilities defined by
\ref{eq:histogram} (using B-spline Parzen windows), NMI can be
written as:
\begin{align}
\mathrm{NMI}(\vmu; I_F, I_M) &=
\frac{\sum\limits_{f\in L_F} p_F(f)
\log_2 p_F(f) + \sum\limits_{m\in L_M} p_M(m;\vmu) \log_2 p_M(m;\vmu)}
{ \sum\limits_{m\in L_M} \sum\limits_{f\in L_F}
p(f,m;\vmu) \log_2 p(f,m;\vmu)} \nonumber \\ \nonumber \\
&= \frac{\sum\limits_{m\in L_M} \sum\limits_{f\in L_F} p(f,m;\vmu) \log_2
\left( p_F(f) p_M(m;\vmu) \right)}{ \sum\limits_{m\in L_M} \sum\limits_{f\in L_F}
p(f,m;\vmu) \log_2 p(f,m;\vmu) }. \label{eq:NMI}
\end{align}
\item[Kappa Statistic (KS):] (\texttt{AdvancedKappaStatistic})
KS is defined as:
\begin{align}
\mathrm{KS}(\vmu;I_F,I_M) &= \frac{ 2 \sum\limits_{\vx_i \in
\Omega_F} \mathbf{1}_{I_F(\vx_i) = f, I_M(\vT_{\vmu}(\vx_i)) =
f}}{\sum\limits_{\vx_i \in \Omega_F} \mathbf{1}_{I_F(\vx_i) = f} +
\mathbf{1}_{I_M(\vT_{\vmu}(\vx_i)) = f}}, \label{eq:KS}
\end{align}
where $\mathbf{1}$ is the indicator function, and $f$ a user-defined
foreground value that defaults to 1.
\end{description}
The MSD measure is a measure that is only suited for two images with
an equal intensity distribution, i.e. for images from the same
modality. NCC is less strict, it assumes a linear relation between
the intensity values of the fixed and moving image, and can
therefore be used more often. The MI measure is even more general:
only a relation between the probability distributions of the
intensities of the fixed and moving image is assumed. For MI it is
well-known that it is suited not only for mono-modal, but also for
multi-modal image pairs. This measure is often a good choice for
image registration. The NMI measure is, just like MI, suitable for
mono- and multi-modality registration. \cite{Stu99:NMI} seems to
indicate better performance than MI in some cases. (Note that in
\elastix\ we optimized MI for performance, which we did not do for
NMI.) The KS measure is specifically meant to register binary images
(segmentations). It measures the ``overlap'' of the segmentations.
\section{Image samplers}\label{sec:comp:sampler}
In Equations (\ref{eq:ssd})-(\ref{eq:histogram}) we observe a loop
over the fixed image: $\sum_{\vx_i \in \Omega_F}$. Until now, we
assumed that the loop goes over \emph{all} voxels of the fixed
image. In general, this is not necessary. A subset may suffice
\citep{ThevenazEA00a,KleinEA07}. The subset may be selected in
different ways: random, on a grid, etc. The sampler component
represents this process.
The following samplers are often used:
\begin{description}
\item[Full:] (\texttt{Full}) A full sampler simply selects all voxel coordinates $\vx_i$ of the
fixed image.
\item[Grid:] (\texttt{Grid}) The grid sampler defines a regular grid on the fixed
image and selects the coordinates $\vx_i$ on the grid. Effectively,
the grid sampler thus downsamples the fixed image (not preceded by
smoothing). The size of the grid (or equivalently, the downsampling
factor, which is the original fixed image size divided by the grid
size) is a user input.
\item[Random:] (\texttt{Random}) A random sampler randomly selects a user-specified number of
voxels from the fixed image, whose coordinates form $\vx_i$. Every
voxel has equal chance to be selected. A sample is not necessarily
selected only once.
\item[Random Coordinate:] (\texttt{RandomCoordinate}) A random coordinate sampler is similar
to a random sampler. It also randomly selects a user-specified number
of coordinates $\vx_i$. However, the random coordinate sampler is not
limited to voxel positions. Coordinates \emph{between} voxels can
also be selected. The grey-value $I_F(\vx_i)$ at those locations must
of course be obtained by interpolation.
\end{description}
While at first sight the full sampler seems the most obvious
choice, in practice it is not always used, because of its
computational costs in large images. The random samplers are
especially useful in combination with a stochastic optimisation
method \citep{KleinEA07}. See also
Section~\ref{sec:comp:optimiser}. The use of the random coordinate
sampler makes the cost function $\CC$ a more smooth function of
$\vmu$, which makes the optimisation problem (\ref{eq:parametric})
easier to solve. This has been shown in \cite{The08:Halton}.
\section{Interpolators}\label{sec:comp:interpolator}
As stated previously, during the optimisation the value $I_M(\vTmx)$
is evaluated at non-voxel positions, for which intensity
interpolation is needed. Several methods for interpolation exist,
varying in quality and speed. Some examples are given in Figure
\ref{fig:interpolation}.
\begin{description}
\item[Nearest neighbour:] (\texttt{NearestNeighborInterpolator}) This is the most simple technique, low in
quality, requiring little resources. The intensity of the voxel
nearest in distance is returned.
\item[Linear:] (\texttt{LinearInterpolator}) The returned value is a weighted
average of the surrounding voxels, with the distance to each voxel
taken as weight.
\item[$N$-th order B-spline:] (\texttt{BSplineInterpolator} or
\texttt{BSplineInterpolatorFloat} for a memory efficient version)
The higher the order, the better the quality, but also requiring
more computation time. In fact, nearest neighbour ($N=0$) and
linear interpolation ($N=1$) also fall in this category. See
\citet{Unser99} for more details.
\end{description}
During registration a first-order B-spline interpolation, i.e. linear
interpolation, often gives satisfactory results. It is a good
trade-off between quality and speed. To generate the final result,
i.e. the deformed result of the registration, a higher-order
interpolation is usually required, for which we recommend $N=3$. The
final result is generated in \elastix\ by a so-called
\texttt{ResampleInterpolator}. Any one of the above can be used, but
you need to prepend the name with \texttt{Final}, for example:
\texttt{FinalLinearInterpolator}.
\begin{figure}[tb]
\centering
\subfigure[]{\includegraphics[width=2.5cm]{nn.eps}}\label{sfig:interpolation:nn}
\subfigure[]{\includegraphics[width=2.5cm]{linear.eps}}\label{sfig:interpolation:lin}
\subfigure[]{\includegraphics[width=2.5cm]{bs2.eps}}\label{sfig:interpolation:bs2}
\subfigure[]{\includegraphics[width=2.5cm]{bs3.eps}}\label{sfig:interpolation:bs3}
\subfigure[]{\includegraphics[width=2.5cm]{bs5.eps}}\label{sfig:interpolation:bs5}
\caption{Interpolation. (a) nearest neighbour, (b) linear, (c)
B-spline $N=2$, (d) B-spline $N=3$, (e) B-spline $N=5$.}
\label{fig:interpolation}
\end{figure}
\section{Transforms}\label{sec:comp:transform}
A frequent confusion about the transformation is its direction. In \elastix\
the transformation is defined as a \textbf{coordinate mapping from the fixed
image domain to the moving image domain}: $\vT: \Omega_F \subset \mathbb{R}^d
\rightarrow \Omega_M \subset \mathbb{R}^d$. The confusion usually stems from
the phrase: ``the moving image is deformed to fit the fixed image''. Although
one can speak about image registration like this, such a phrase is not meant to
reflect mathematical underlyings: one deforms the moving image, but the
transformation is still defined from fixed to moving image. The reason for this
becomes clear when trying to compute the deformed moving image (the
registration result) $I_M(\vTmx)$ (this process is frequently called
\emph{resampling}). If the transformation would be defined from moving to fixed
image, not all voxels in the fixed image domain would be mapped to (e.g. in
case of a scaling), and holes would occur in the deformed moving image. With
the transformation defined as it is, resampling is quite simple: loop over all
voxels $\vx$ in the fixed image domain $\Omega_F$, compute its mapped position
$\bm{y} = \vTmx$, interpolate the moving image at $\bm{y}$, and fill in this
value at $\vx$ in the output image.
The transformation model used for $\vT_{\vmu}$ determines what type of
deformations between the fixed and moving image you can handle. In order of
increasing flexibility, these are the translation, the rigid, the similarity,
the affine, the nonrigid B-spline and the nonrigid thin-plate spline like
transformations.
\begin{description}
\item[Translation:] (\texttt{TranslationTransform}) The translation is defined as:
\begin{align}
\vTmx &= \vx + \bm{t},
\end{align}
with $\bm{t}$ the translation vector. The parameter vector is
simply defined by $\vmu=\bm{t}$.
\item[Rigid:] (\texttt{EulerTransform}) A rigid transformation is defined as:
\begin{align}
\vTmx &= R (\vx - \bm{c}) + \bm{t} + \bm{c},
\end{align}
with the matrix $R$ a rotation matrix (i.e. orthonormal and
proper), $\bm{c}$ the centre of rotation, and $\bm{t}$ translation
again. The image is treated as a rigid body, which can translate
and rotate, but cannot be scaled/stretched. The rotation matrix is
parameterised by the Euler angles (one in 2D, three in 3D). The
parameter vector $\vmu$ consists of the Euler angles (in rad) and
the translation vector. In 2D, this gives a vector of length 3:
$\vmu = (\theta_z, t_x, t_y)^T$, where $\theta_z$ denotes the
rotation around the axis normal to the image. In 3D, this gives a
vector of length 6: $\vmu = (\theta_x, \theta_y, \theta_z, t_x,
t_y, t_z)^T$. The centre of rotation is not part of $\vmu$; it is
a fixed setting, usually the centre of the image.
\item[Similarity:] (\texttt{SimilarityTransform}) A similarity transformation is defined as
\begin{align}
\vTmx &= s \bm{R} (\vx - \bm{c}) + \bm{t} + \bm{c},
\end{align}
with $s$ a scalar and $\bm{R}$ a rotation matrix. This means that the image
is treated as an object, which can translate, rotate, and scale
isotropically. The rotation matrix is parameterised by an angle in 2D, and
by a so-called ``versor'' in 3D (Euler angles could have been used as
well). The parameter vector $\vmu$ consists of the angle/versor, the
translation vector, and the isotropic scaling factor. In 2D, this gives a
vector of length 4: $\vmu = (s, \theta_z, t_x, t_y)^T$. In 3D, this gives a
vector of length 7: $\vmu = (q_1, q_2, q_3, t_x, t_y, t_z, s)^T$, where
$q_1$, $q_2$, and $q_3$ are the elements of the versor. There are few cases
when you need this transform.
\item[Affine:] (\texttt{AffineTransform}) An affine transformation is defined as:
\begin{align}
\vTmx &= \bm{A} (\vx - \bm{c}) + \bm{t} + \bm{c},
\end{align}
where the matrix $\bm{A}$ has no restrictions. This means that the
image can be translated, rotated, scaled, and sheared. The parameter
vector $\vmu$ is formed by the matrix elements $a_{ij}$ and the
translation vector. In 2D, this gives a vector of length 6:
$\vmu=(a_{11}, a_{12}, a_{21}, a_{22}, t_x, t_y)^T$. In 3D, this
gives a vector of length 12.
We also have implemented another flavor of the affine
transformation, with identical meaning, but using another
parametrization. Instead of having $\vmu$ formed by the matrix
elements + translation, it is formed by $d$ rotations, $d$ shear
factors, $d$ scales, and $d$ translations. The definition reads:
\begin{align}
\vTmx &= \bm{R} \bm{G} \bm{S} (\vx - \bm{c}) + \bm{t} + \bm{c},
\end{align}
with $\bm{R}$, $\bm{G}$ and $\bm{S}$ the rotation, shear and scaling
matrix, respectively. It can be selected using
\texttt{AffineDTITransform}, as it was first made with DTI imaging
in mind, although it can be used anywhere else as well. It has 7
parameters in 2D and 12 parameters in 3D.
\item[B-splines:] (\texttt{BSplineTransform}) For the category of non-rigid
transformations, B-splines \citep{RueckertEA99} are often used as a
parameterisation:
\begin{align}
\vTmx = \vx + \sum_{\vx_k \in \Ncal_{\vx}} \bm{p}_k
\bm{\beta}^3\left( \frac{\vx - \vx_k}{\bm{\sigma}}
\right),\label{eq:bspline}
\end{align}
with $\vx_k$ the control points, $\bm{\beta}^3(x)$ the cubic
multidimensional B-spline polynomial \citep{Unser99}, $\bm{p}_k$ the
B-spline coefficient vectors (loosely speaking, the control point
displacements), $\bm{\sigma}$ the B-spline control point spacing, and
$\Ncal_{\vx}$ the set of all control points within the compact support of
the B-spline at $\vx$. The control points $\vx_k$ are defined on a regular
grid, overlayed on the fixed image. In this context we talk about `the
control point grid that is put on the fixed image', and about `control
points that are moved around'. Note that $\vTm(\vx_k)\neq \vx_k +
\bm{p}_k$, a common misunderstanding. Calling $\bm{p}_k$ the control point
displacements is, therefore, actually somewhat misleading. Also note that
the control point grid is entirely unrelated to the grid used by the Grid
image sampler, see Section~\ref{sec:comp:sampler}.
The control point grid is defined by the amount of space between the
control points $\bm{\sigma} = (\sigma_1, \ldots, \sigma_d)$ (with
$d$ the image dimension), which can be different for each direction.
B-splines have local support ($|\Ncal_{\vx}|$ is small), which means
that the transformation of a point can be computed from only a
couple of surrounding control points. This is beneficial both for
modelling local transformations, and for fast computation. The
parameters $\vmu$ are formed by the B-spline coefficients
$\bm{p}_k$. The number of control points $\bm{P} = (P_1, \ldots,
P_d)$ determines the number of parameters $M$, by $M = ( P_1 \times
\ldots \times P_d ) \times d$. $P_i$ in turn is determined by the
image size $\bm{s}$ and the B-spline grid spacing, i.e. $P_i \approx
s_i / \sigma_i$ (where we use $\approx$ since some additional
control points are placed just outside the image). For 3D images, $M
\approx 10000$ parameters is not an unusual case, and $M$ can easily
grow to $10^5 - 10^6$. The parameter vector (for 2D images) is
composed as follows: $\vmu = (p_{1x}, p_{2x}, \ldots, p_{P_1},
p_{1y}, p_{2y}, \ldots, p_{P_2} )^T$.
\item[Thin-plate splines:] (\texttt{SplineKernelTransform}) Thin-plate
splines are another well-known representation for nonrigid
transformations. The thin-plate spline is an instance of the more
general class of kernel-based transforms \cite{Davis97,Brooks07}. The
transformation is based on a set of $K$ corresponding landmarks in the
fixed and moving image: $\vx_k^{\mathrm{fix}}$ and
$\vx_k^{\mathrm{mov}}, k = 1, \ldots, K$, respectively. The
transformation is expressed as a sum of an affine component and a
nonrigid component:
\begin{align}
\vTmx = \vx + A \vx + \bm{t} + \sum_{\vx_k^{\mathrm{fix}}} \bm{c}_k
\bm{G}(\vx - \vx_k^{\mathrm{fix}}),\label{eq:splinekernel}
\end{align}
where $\bm{G}(\bm{r})$ is a basis function and $\bm{c}_k$ are the
coefficients corresponding to each landmark. The coefficients
$\bm{c}_k$ and the elements of $\bm{A}$ and $\bm{t}$ are computed
from the landmark displacements $\bm{d}_k = \vx_k^{\mathrm{mov}} -
\vx_k^{\mathrm{fix}}$. The specific choice of basis function
$\bm{G}(\bm{r})$ determines the ``physical behaviour''. The most
often used choice of $\bm{G}(\bm{r})$ leads to the thin-plate
spline, but another useful alternative is the elastic-body spline
\cite{Davis97}. The spline kernel transforms are often less
efficient than the B-splines (because they lack the compact support
property of the B-splines), but in \elastix\ they allow for more
flexibility in placing the control points $\vx_k^{\mathrm{fix}}$.
The moving landmarks form the parameter vector $\vmu$. Both landmark
sets are needed to define a transformation. Note that in order to
perform a registration, only the fixed landmark positions are given
by the user; the moving landmarks are initialized to equal the fixed
landmarks, corresponding to the identity transformation, and are
subsequently optimized. The parameter vector is (for 2D images)
composed as follows: $\vmu = (x_{1x}^{\mathrm{mov}},
x_{1y}^{\mathrm{mov}}, x_{2x}^{\mathrm{mov}}, x_{2y}^{\mathrm{mov}},
\ldots, x_{Kx}^{\mathrm{mov}}, x_{Ky}^{\mathrm{mov}} )^T$. Note the
difference in ordering of $\vmu$ compared to the B-splines
transform.
\end{description}
\begin{figure}[tb]
\centering
% was fixed.eps, moving.eps, deformed.eps
\subfigure[fixed]{\includegraphics[width=4.5cm,height=4.5cm]{transformexample_fixed.eps}}\label{sfig:transformexample:a}
\subfigure[moving]{\includegraphics[width=4.5cm,height=4.5cm]{transformexample_orig.eps}}\label{sfig:transformexample:b}
\subfigure[translation]{\includegraphics[width=4.5cm,height=4.5cm]{transformexample_tran.eps}}\label{sfig:transformexample:c}
\subfigure[rigid]{\includegraphics[width=4.5cm,height=4.5cm]{transformexample_rig.eps}}\label{sfig:transformexample:d}
\subfigure[affine]{\includegraphics[width=4.5cm,height=4.5cm]{transformexample_aff.eps}}\label{sfig:transformexample:e}
\subfigure[B-spline]{\includegraphics[width=4.5cm,height=4.5cm]{transformexample_bsp.eps}}\label{sfig:transformexample:f}
\caption{Different transformations. (a) the fixed image, (b) the
moving image with a grid overlayed, (c) the deformed moving image
$I_M(\vTmx)$ with a translation transformation, (d) a rigid
transformation, (e) an affine transformation, and (f) a B-spline
transformation. The deformed moving image nicely resembles the
fixed image $I_F(\vx)$ using the B-spline transformation. The
overlay grids give an indication of the deformations imposed on
the moving image. NB: the overlayed grid in (f) is NOT the
B-spline control point grid, since that one is defined on the
fixed image!} \label{fig:transformexample}
\end{figure}
See Figure \ref{fig:transformexample} for an illustration of different
transforms. Choose the transformation that fits your needs: only choose a
nonrigid transformation if you expect that the underlying problem contains
local deformations, choose a rigid transformation if you only need to
compensate for differences in pose. To initialise a nonrigid registration
problem, perform a rigid or affine one first. The result of the initial rigid
or affine registration $\vT_{\hat\vmu_0}$ is combined with a nonrigid
transformation $\vTm^\mathrm{NR}$ in one of the following two ways:
\begin{align}
\text{addition: }\quad & \vTmx = \vTm^\mathrm{NR}(\vx) + \vT_{\hat\vmu_0}(\vx) - \vx\label{eq:addition} \\
\text{composition: }\quad & \vTmx = \vTm^\mathrm{NR}\left( \vT_{\hat\vmu_0}(\vx) \right)
= ( \vTm^\mathrm{NR} \circ
\vT_{\hat\vmu_0})(\vx)\label{eq:composition}
\end{align}
The latter method is in general to be preferred, because it makes
several postregistration analysis tasks somewhat more
straightforward.
%// iets over scales?
\section{Optimisers}\label{sec:comp:optimiser}
\begin{figure}[tb]
\centering
% was: Gradient_descent.eps
\includegraphics[width=0.8\textwidth]{gd_example.eps}
\caption{Iterative optimisation. Example for registration with a
translation transformation model. The arrows indicate the steps
$a_k \bm{d}_k$ taken in the direction of the optimum, which is the
minimum of the cost function.} \label{fig:optimisation}
\end{figure}
To solve the optimisation problem (\ref{eq:parametric}), i.e. to
obtain the optimal transformation parameter vector $\hat\vmu$,
commonly an iterative optimisation strategy is employed:
\begin{align}
\vmu_{k+1} &= \vmu_k + a_k \bm{d}_k, \quad k = 0, 1, 2, \cdots,
\end{align}
with $\bm{d}_k$ the `search direction' at iteration $k$, $a_k$ a
scalar gain factor controlling the step size along the search
direction. The optimisation process is illustrated in Figure
\ref{fig:optimisation}. \citet{KleinEA07} give an overview of
various optimisation routines the literature offers. Examples are
quasi-Newton (QN), nonlinear conjugate gradient (NCG), gradient
descent (GD), and Robbins-Monro (RM). Gradient descent and
Robbins-Monro are discussed below. For details on other
optimisation methods we refer to \citep{KleinEA07,NocedalEA99}.
\begin{description}
\item[Gradient descent (GD):] (\texttt{StandardGradientDescent}
or \texttt{RegularStepGradientDescent}) Gradient descent optimisation
methods take the search direction as the negative gradient of the
cost function:
\begin{align}
\vmu_{k+1} &= \vmu_k - a_k \bm{g}(\vmu_k),\label{eq:gd}
\end{align}
with $\bm{g}(\vmu_k) = \partial \mathcal{C} / \partial \vmu$
evaluated at the current position $\vmu_k$. Several choices exist for
the gain factor $a_k$. It can for example be determined by a line
search or by using a predefined function of $k$.
\item[Robbins-Monro (RM):]
(\texttt{StandardGradientDescent} or
\texttt{FiniteDifferenceGradientDescent}) The RM optimisation
method replaces the calculation of the derivative of the cost
function $\bm{g}(\vmu_k)$ by an approximation
$\widetilde{\bm{g}}_k$.
\begin{align}
\vmu_{k+1} &= \vmu_k - a_k \widetilde{\bm{g}}_k,\label{eq:RM}
\end{align}
The approximation is potentially faster to compute, but might
deteriorate convergence properties of the GD scheme, since every
iteration an approximation error $\bm{g}(\vmu_k) -
\widetilde{\bm{g}}_k$ is made. \citet{KleinEA07} showed that using
only a small random subset of voxels (\mbox{$\approx 2000$}) from
the fixed image accelerates registration significantly, without
compromising registration accuracy. The \texttt{Random} or
\texttt{RandomCoordinate} samplers, described in
Section~\ref{sec:comp:sampler}, are examples of samplers that pick
voxels randomly. It is important that a new subset of fixed image
voxels is selected every iteration $k$, so that the approximation
error has zero mean. The RM method is usually combined with $a_k$ as
a predefined decaying function of $k$:
\begin{align}
a_k &= \frac{a}{(k+A)^{\alpha}},\label{eq:gain}
\end{align}
where $a > 0$, $A \ge 1$, and $0 \le \alpha \le 1$ are
user-defined constants. In our experience, a reasonable choice is
$\alpha \approx 0.6$ and $A$ approximately 10\% of the
user-defined maximum number of iterations, or less. The choice of
the overall gain, $a$, depends on the expected ranges of $\vmu$
and $\bm{g}$ and is thus problem-specific. In our experience, the
registration result is not very sensitive to small perturbations
of these parameters. Section~\ref{sec:optimizertuning} gives some
more advice.
\end{description}
Note that GD and RM are in fact very similar. Running RM with a Full sampler
(see Section~\ref{sec:comp:sampler}), instead of a Random sampler, is
equivalent to performing GD. We recommend the use of RM over GD, since it is so
much faster, without compromising on accuracy. In that case, the parameter $a$
is the parameter that is to be tuned for your application. A more advanced
version of the \texttt{StandardGradientDescent} is the
\texttt{AdaptiveStochasticGradientDescent}, which requires less parameters to
be set and tends to be more robust \cite{Klein09}.
Other optimisers available in \elastix\ are: \texttt{FullSearch},
\texttt{ConjugateGradient}, \texttt{ConjugateGradientFRPR},
\texttt{QuasiNewtonLBFGS}, \texttt{RSGDEachParameterApart},
\texttt{SimultaneousPerturbation}, \texttt{CMAEvolutionStrategy}.
\section{Multi-resolution}\label{sec:comp:multiresolution}
For a good overview of multi-resolution strategies see
\citet{LesterEA99}. Two hierarchical methods are distinguished:
reduction of data complexity, and reduction of transformation
complexity.
\subsection{Data complexity}
It is common to start the registration process using images that have
lower complexity, e.g., images that are smoothed and possibly
downsampled. This increases the chance of successful registration. A
series of images with increasing amount of smoothing is called a
scale space. If the images are not only smoothed, but also
downsampled, the data is not only less complex, but the \emph{amount}
of data is actually reduced. In that case, we talk about a
``pyramid''. However, confusingly, the word pyramid is used by us
also to refer to a scale space. Several scale spaces or pyramids are
found in the literature, amongst others Gaussian and Laplacian
pyramids, morphological scale space, and spline and wavelet pyramids.
The Gaussian pyramid is the most common one. In \elastix\ we have:
\begin{description}
\item[Gaussian pyramid:] (\texttt{FixedRecursiveImagePyramid} and
\texttt{MovingRecursiveImagePyramid}) Applies smoothing and
down-sampling.
\item[Gaussian scale space:] (\texttt{FixedSmoothingImagePyramid} and
\texttt{MovingSmoothingImagePyramid}) Applies smoothing and
\emph{no} down-sampling.
\item[Shrinking pyramid:] (\texttt{FixedShrinkingImagePyramid} and
\texttt{MovingShrinkingImagePyramid}) Applies \emph{no} smoothing,
but only down-sampling.
\end{description}
Figure~\ref{fig:multiresolution} shows the Gaussian pyramid with and
without downsampling. In combination with a Full sampler (see
Section~\ref{sec:comp:sampler}), using a pyramid with downsampling
will save a lot of time in the first resolution levels, because the
image contains much fewer voxels. In combination with a Random
sampler, or RandomCoordinate, the downsampling step is not necessary,
since the random samplers select a user-defined number of samples
anyway, independent of the image size.
\begin{figure}[tb]
\centering \subfigure[resolution
0]{\includegraphics[width=3cm]{moving_pd.R0d.eps}}
\subfigure[resolution
1]{\includegraphics[width=3cm]{moving_pd.R1d.eps}}
\subfigure[resolution
2]{\includegraphics[width=3cm]{moving_pd.R2d.eps}}
\subfigure[original]{\includegraphics[width=3cm]{moving_pd.128.eps}} \\
\subfigure[resolution
0]{\includegraphics[width=3cm]{moving_pd.R0.eps}}
\subfigure[resolution
1]{\includegraphics[width=3cm]{moving_pd.R1.eps}}
\subfigure[resolution
2]{\includegraphics[width=3cm]{moving_pd.R2.eps}}
\subfigure[original]{\includegraphics[width=3cm]{moving_pd.128.eps}}
\caption{Two multi-resolution strategies using a Gaussian pyramid
($\sigma = 8.0, 4.0, 2.0$ voxels). The first row shows
multi-resolution with down-sampling
(\texttt{FixedRecursiveImagePyramid}), the second row without
(\texttt{FixedSmoothingImagePyramid}). Note that in the first row,
for each dimension, the image size is halved every resolution, but
that the voxel size increases with a factor 2, so physically the
images are of the same size every resolution.}
\label{fig:multiresolution}
\end{figure}
\subsection{Transformation complexity}
The second multiresolution strategy is to start the registration
with fewer degrees of freedom for the transformation model. The
degrees of freedom of the transformation equals the length (number
of elements) of the parameter vector $\vmu$.
An example of this was already mentioned in Section~\ref{sec:comp:transform}:
the use of a rigid transformation prior to nonrigid (B-spline) registration. We
may even use a three-level strategy: first rigid, then affine, then nonrigid
B-spline.
Another example is to increase the number of degrees of freedom
within the transformation model. With a B-spline transformation,
it is often good practice to start registration with a coarse
control point grid, only capable of modelling coarse deformations.
In subsequent resolutions the B-spline grid is gradually refined,
thereby introducing the capability to match smaller structures.
See Section~\ref{sec:transformtuning}.
\section{Evaluating registration}\label{sec:evaluation}
How do you verify that your registration was successful? This is a
difficult problem. In general, you don't know for each voxel where
it should map to. Here are some hints:
\begin{itemize}
\item The deformed moving image $I_M(\vT_{\vmu}(\vx))$ should
look similar to the fixed image $I_F(\vx)$. So, compare images side
by side in a viewer. You can also display the two images on top of
each other with a checkerboard view or a dragable cross. Besides
looking similar, also check that the deformed moving image has the
same texture as the moving image. Sudden blurred areas in the
deformed image may indicate that the deformation at that region is
too large.
\item For mono-modal image data you can inspect the difference
image. Perfect registration would result in a difference image
without any edges, just noise.
\item Compute the overlap of segmented anatomical structures
after registration. The better the overlap, the better the
registration. Note that this requires you to (manually) segment
structures in your data. To measure overlap, commonly the Dice
similarity coefficient (DSC) is used:
\begin{equation}
\mathrm{DSC}(X,Y) = \frac{2 |X \cap Y|}{|X|+|Y|},
\end{equation}
where $X$ and $Y$ represent the binary label images, and $|\cdot|$
denotes the number of voxels that equal 1. A higher DSC indicates a
better correspondence. A value of 1 indicates perfect overlap, a
value of 0 means no overlap at all. Also the Tannimoto coefficient
(TC) is used often. It is related to the DSC by
$\mathrm{DSC}=2\mathrm{TC}/(\mathrm{TC}+1)$. See also
\cite{Cru06:Generalized}. It is important to realise that the
surface-volume ratio of the segmented structures influences the
overlap values you typically get \citep{Roh04:Evaluation}. A value
of $\mathrm{DSC}=0.8$ would be very good for the overlap of complex
vessel structures. For large spherical objects though, an overlap
$<0.9$ is in general not very good. What is good enough depends of
course on your application.
\item Compute the distance after registration between points that
you know correspond. You can obtain corresponding points by manually
clicking them in the fixed and the moving image. A less
time-consuming option is the semi-automated approach of Murphy
\etal\ \cite{Murphy08}, which is designed for finding corresponding
points in the lung. Ideally, the registration has found the same
correspondence as the ground truth.
\item Inspect the deformation field by looking at the determinant of