%======================================================================% % Filename: Article.tex % Project: Insight Journal Article - Generalised Image Fusion Toolkit (GIFT) % Author: Daniel Mueller [d.mueller@qut.edu.au] %----------------------------------------------------------------------% % Description: % This artcile is for the Insight Journal, MICCAI Open Source Workshop. % It describes the implementation and use of an improved tracking-based % algorithm for segmenting severely calcified coronary arteries in 3D % MS-CTA. %======================================================================% \documentclass{InsightArticle} %\usepackage{times} %Font %\usepackage{newcent} %Font %\usepackage{pslatex} %Font %\usepackage{lmodern} %Font %\usepackage{palatino} %Font %\usepackage{bookman} %Font \usepackage{amsfonts} %Maths fonts \usepackage{amssymb} %Maths symbols \usepackage{listing} %Used for list of listings \usepackage{listings} %List program code source \usepackage{subfigure} %For subfigures \usepackage[dvips]{graphicx} %Graphics \usepackage[dvips, %Allow urls bookmarks, bookmarksopen, bookmarksnumbered, backref, colorlinks, linkcolor={blue}, citecolor={blue}, urlcolor={blue}]{hyperref} %Set default font %\renewcommand{\familydefault}{\rmdefault} %Roman \renewcommand{\familydefault}{\sfdefault} %Sans serif %\renewcommand{\familydefault}{\ttdefault} %Typewriter %Add images path \graphicspath{{images/}} %Code definitions \def\code#1{\small\texttt{#1}} %Create indent for description \newenvironment{indentdescription} {\list{}{\leftmargin \leftmargin}% \item\relax} {\endlist} %Create conditional to include or exclude figures %(saves time during debug compilation). \newif\ifincludefigs \includefigstrue %======================================================================% % F r o n t M a t t e r % %======================================================================% % The title should be descriptive enough for people to be able to find % the relevant document. \title{The Generalised Image Fusion Toolkit (GIFT)} % Increment the release number whenever significant changes are made. % The author and/or editor can define 'significant' however they like. \release{1.0} % Name and affiliation \author{Daniel Mueller$^{\scriptscriptstyle\textsf{1}}$} \authoraddress{$^{\textsf{1}}$Queensland University of Technology, Brisbane, Australia} %\author{Daniel Mueller$^{\scriptscriptstyle\textsf{1}}$, Peter O'Shea$^{\scriptscriptstyle\textsf{1}}$, %{\small{and}} Anthony Maeder$^{\scriptscriptstyle\textsf{2}}$} %\authoraddress{ $^{\textsf{1}}$Queensland University of Technology, Brisbane, Australia \\ % $^{\textsf{2}}$e-Health Research Centre, CSIRO ICT Centre, Brisbane, Australia} % Set custom header style \pagestyle{fancy} \fancyhead{} % clear all header fields \fancyhead[L]{\textsf{ The Generalised Image Fusion Toolkit (GIFT) }} \fancyhead[R]{\textsf{\thepage}} \fancyfoot{} % clear all footer fields % Document \begin{document} %Setup listing environment \definecolor{listcomment}{rgb}{0.0,0.5,0.0} \definecolor{listkeyword}{rgb}{0.0,0.0,0.5} \definecolor{listbackground}{gray}{0.965} \lstset{frame = tb, framerule = 0.25pt, float, fontadjust, backgroundcolor={\color{listbackground}}, basicstyle = {\ttfamily\scriptsize}, keywordstyle = {\ttfamily\color{listkeyword}\textbf}, identifierstyle = {\ttfamily}, commentstyle = {\ttfamily\color{listcomment}\textit}, stringstyle = {\ttfamily}, showstringspaces = false, showtabs = false, numbers = left, tabsize = 2, language=[ISO]C++, floatplacement=!h } % Show the title \maketitle % Make the title page header/footer empty \thispagestyle{empty} \ifhtml \chapter*{Front Matter\label{front}} \fi %======================================================================% % A b s t r a c t % %======================================================================% \begin{abstract} \noindent Image fusion provides a mechanism to combine multiple images into a single representation to aid human visual perception and image processing tasks. Such algorithms endeavour to create a \emph{fused} image containing the salient information from each source image, without introducing artefacts or inconsistencies. % Image fusion is applicable for numerous fields including: defence systems, remote sensing and geoscience, robotics and industrial engineering, and medical imaging. In the medical imaging domain, image fusion may aid diagnosis and surgical planning tasks requiring the segmentation, feature extraction, and/or visualisation of \emph{multi-modal} datasets. This paper discusses the implementation of a image fusion toolkit built upon the Insight Toolkit (ITK). Based on an existing architecture \cite{Piella2002a, Piella2003a}, the proposed framework (GIFT) offers a `plug-and-play' environment for the construction of n-D multi-scale image fusion methods. % We give a brief overview of the toolkit design and demonstrate how to construct image fusion algorithms from low-level components (such as multi-scale methods and feature generators). A number of worked examples for medical applications are presented in \ref{sec:Examples}, including quadrature mirror filter discrete wavelet transform (QMF DWT) image fusion. % \\ \\ \keyword{image fusion, multi-modal, wavelet, ITK} \end{abstract} %======================================================================% % M a i n M a t t e r % %======================================================================% %\tableofcontents %----------------------------------------------------------------------% % Section %----------------------------------------------------------------------% \section{Introduction} Image fusion algorithms seek to combine multiple input images into a single representation. Such algorithms have numerous applications including the segmentation, feature extraction, and/or visualisation of \emph{multi-modal} medical images. This paper presents an open-source toolkit for multi-scale image fusion and aims to be the start of a central repository for fusion algorithm implementations. The Generalised Image Fusion Toolkit (GIFT) currently implements quadrature mirror filter discrete wavelet transform (QMF DWT) multi-scale fusion algorithms. GIFT is build upon the Insight Toolkit (ITK) - an an open-source software system able to perform a range of registration and segmentation algorithms in two- or three-dimensions \cite{Yoo2002a}. Continuing the concept of generic programming advocated by ITK, GIFT has a flexible design allowing for the easy addition of new components and the processing of both 2-D and 3-D images. This paper is organised into a number of different sections. The first section discusses general image fusion concepts in order to provide a brief introduction into image fusion. The next section discusses the design and currently implemented components of GIFT. Following this we give a brief of list of instructions for getting started using the toolkit. Finally we discuss the areas of current and future development. Two examples are walked through in considerable detail in \ref{sec:Examples}. %----------------------------------------------------------------------% % Section %----------------------------------------------------------------------% \section{Concepts} Multi-sensor fusion is the task of combining data from multiple input sensors, which can facilitate analysis not possible from a single sensor alone \cite{Hall2004a}. Image fusion is a specialisation of multi-sensor fusion in which the input and output signals are images. Multi-sensor fusion has been organised into a hierarchy of increasing abstract tasks \cite{Hall2001a}: \begin{indentdescription} \begin{description} \item[Signal-level] is the lowest form of multi-sensor fusion. At this level multiple raw input signals are fused into a single output signal. For \emph{image} fusion, the signal-level is known as `pixel-level'. \item[Feature-level] fusion operates on feature vectors extracted from either the input signals themselves or the output of the signal-level fusion stage. \item[Decision-level] fusion generates probabilistic decision information obtained from processing the results from lower levels. \end{description} \end{indentdescription} The general goal of image fusion is to combine a set of input images to generate a single output image which (a) preserves the salient information from each input image, (b) suppresses noise and irrelevant parts of inputs images, and (c) does not generate distortions, artefacts, or inconsistencies in the fused output \cite{Lewis2004a}. % A wide variety of algorithms have been proposed to implement these tenets. These algorithms can be grouped into the following categories: \begin{indentdescription} \begin{description} \item[Arithmetic] image fusion is a simple and efficient scheme, which unfortunately suffers from loss of contrast due to the destructive nature of superposition. This type of fusion applies a weight ($w_n$) to each input image ($i_n$) and then arithmetically combines these to form the output image ($f$), as shown below: \begin{equation} f(\vec{x}) = w_1 i_1(\vec{x}) + w_2 i_2(\vec{x}) + \ldots + w_n i_n(\vec{x}) \end{equation} Most commonly the weights are chosen to give an averaging effect (ie. $w_n = 1/n$). Another approach is to compute the weights via principal component analysis (PCA) - the weights are set as the eigenvector components corresponding to the largest eigenvalue computed after `unfolding-backfolding' the image matrix \cite{Geladi1996a}. \item[Colour space] fusion represents data using different colour channels, exploiting the ability of the human visual system distinguish three colour channels. The simplest approach maps each input to a single channel in the chosen colour space (eg. RGB, HSV, YUV, CIELAB, etc). As briefly discussed in \cite{Piella2002a}, the obvious challenge with this approach is to create meaningful mappings from input to channel. Within the medical imaging domain this form of fusion is most commonly used for structural-functional images (eg. CT-PET fusion). \item[Multi-scale] image fusion is a biologically-inspired method which fuses images at different spatial resolutions. Similar to the human visual system, this fusion approach operates by firstly decomposing the input images into a resolution pyramid of numerous \emph{levels}. Each level contains one or more \emph{bands} representing orientation or detail/approximation information. Following this decomposition, the fusion now takes place between the corresponding coefficients or \emph{samples} in each band. The fused pyramid is then reconstructed to form the final fused output image. \figurename~\ref{fig:MultiScaleFusionFlowDiagram} depicts this process. \item[Other] methods also exist including: neural network, statistical \emph{a priori} models, and optimization based approaches. \end{description} \end{indentdescription} \ifincludefigs \begin{figure}[htb] \centering \includegraphics[width=0.70\textwidth]{MultiscaleFusionFlowDiagram.eps} \caption{Multi-scale fusion flow diagram for two input images.} \label{fig:MultiScaleFusionFlowDiagram} \end{figure} \fi Currently GIFT is concerned with pixel-level multi-scale image fusion. However, the modular design allows for the future inclusion of new pixel-level and feature-level operations. For the interested reader, a number of other image fusion toolkits are available as detailed below: \begin{indentdescription} \begin{description} \item[MATIFUS: a MAtlab Toolbox for Image FUSion:] by G. Piella \cite[Appendix A]{Piella2003c}. \item[Image Fusion Toolbox for Matlab:] by O. Rockinger \cite{Rockinger1999a}. \item[The Image Fusion Toolkit for Matlab:] by E. Canga \cite{Canga2003a} \end{description} \end{indentdescription} The main benefits of GIFT over these existing toolkits are it's open-source nature, extensibility, `plug-and-play' architecture, and generic implementation (ie. the same code operates for both 2-D and 3-D images). Moreover, GIFT is easily integrated with ITK's rich set of registration methods - an essential first step for image fusion. %----------------------------------------------------------------------% % Section %----------------------------------------------------------------------% \section{Design} \subsection{Architecture} The architectural design of GIFT is inspired by existing work undertaken by G. Piella \cite{Piella2002a,Piella2003a}. The main difference is that GIFT has generalised the concepts of \emph{activity measure}, \emph{match measure}, and \emph{region-based measures} into a single generic concept termed \emph{\bfseries feature generators}. There are four (4) major components within a GIFT pipeline: \begin{indentdescription} \begin{description} \item[Multi-scale method:] This is method for deconstructing and reconstructing into a scale-space image pyramid. \item[Feature generators:] Any number of feature generators can be added to the fusion pipeline. These generators are responsible for processing the multi-level multi-band images to extract `features' used to guide the fusion process. The output of a feature generator is termed a \emph{feature-map}. \item[Weight generators:] Weight generators are responsible for taking multiple feature-maps and creating \emph{weight-maps}. The resultant weight-maps indicate which parts of each level-band image will contribute to the final fused output. \item[Weight combiner:] The weight combiner is responsible for collapsing the input image pyramids into a single output pyramid. \end{description} \end{indentdescription} The GIFT pipeline is depicted in \figurename~\ref{fig:giftArchitecture}. Please note that while two multi-scale method boxes are shown, only one multi-scale method is set for the fusion pipeline. Multiple feature generators can be specified, and must be linked to the weight generator responsible for processing the feature. Only one weight combiner is specified for the pipeline. Theoretically multiple n-D input images can be fused using this pipeline, however testing has only focused on 2-D and 3-D images. \ifincludefigs \begin{figure}[htb] \centering \includegraphics[width=0.95\textwidth]{giftArchitecture.eps} \caption{Generalised Image Fusion Toolkit (GIFT) architecture diagram.} \label{fig:giftArchitecture} \end{figure} \fi \subsection{Components} \subsubsection{Multi-scale Multi-level Image Filter} At the heart of GIFT is the \code{gift::MultilevelMultibandImageFilter}. This subclass of \code{itk::ImageToImageFilter} encapsulates the concept of an input/output image pyramid (a set of images representing multiple levels and bands). All filters within GIFT (excluding \code{gift::ImageFusionFilter}) inherit from \code{gift::MultilevelMultibandImageFilter}. This common base adds functionality for easily accessing inputs and/or outputs consisting of multi-level, multi-band image pyramids. The inputs/outputs are indexed as shown in \figurename~\ref{fig:MultilevelMultibandImageFilter}, and can be accessed either via their index (as normal) or using an image-level-band 3-tuple (eg. image=2, level=0, band=1). \ifincludefigs \begin{figure}[htb] \centering \includegraphics[width=0.75\textwidth]{MultilevelMultibandImageFilter.eps} \caption{\code{gift::MultilevelMultibandImageFilter} allows access to inputs/outputs using a level-band tuple, as well using the index.} \label{fig:MultilevelMultibandImageFilter} \end{figure} \fi \subsubsection{Multi-scale Methods} Obviously, multi-scale image filters derive from \code{gift::MultilevelMultibandImageFilter}. For deconstruction, these filters input 1 image and output an array of images accessible via a level-band tuple. For reconstruction the number of inputs and outputs are reversed. The number of images in a band is method-defined, and the number of levels is user-defined. Image fusion techniques have used a number of different multi-scale methods including: the laplacian pyramid \cite{Burt1983a}, QMF DWT \cite{Li1995a,Nikolov1999a}, shift-invariant DWT (SIWT) \cite{Rockinger1997a,Rockinger1999a}, dual-tree continuous wavelet transform (DT-CWT) \cite{Nikolov2001a, Lewis2004a}, morphological pyramids \cite{Matsopoulos1994a,Mukhopadhyay2001a}, and others. Currently GIFT has only implemented one multi-scale method - quadrature mirror filter discrete wavelet transformation (QMF DWT). This method is encapsulated by the \code{gift::QmfWaveletImageFilter}. Further details regarding this filter can be found in \ref{sec:Examples}. More multi-scale methods are in development and once completed will easily drop into the GIFT architecture. \subsubsection{Feature Generators} Feature generators operate on the outputs of the multi-scale method and extract relevant `features' which can guide the fusion process. The feature generators within GIFT can operate at the pixel-level or feature-level. Currently only pixel-level generators have been implemented, however a number of feature-level generators are under development. The most fundamental feature is the value of the image coefficient or sample itself. The \code{gift::SampleActivity} feature generator provides subsequent weight generators access to this feature. Another common feature is the absolute value of the sample, which is provided by the \code{gift::AbsSampleActivity}. To ensure consistency, it is common to compute a measure of activity for a small window centred at each pixel (eg. $3 \times 3$ or $5 \times 5$ windows are common for 2-D images). GIFT provides facilities for this form of activity computing through the \code{gift::MaximumWindowSampleActivity} and \code{gift::MedianWindowSampleActivity}, which find either the maximum or median within the window respectively. %TODO: Activity measures % ContrastWindowSampleActivity (see Piella2002a pp.27 eq.3.3) % WindowSquaredSampleActivity (see Piella2002a pp.31) % DirectiveContrastActivity (see Piella2002a pp.32) %TODO: Match measures % NormalisedWindowMatch (see Piella2002a pp.31 eq.3.15) % NormalisedWindowCorrelationMatch (see Piella2002a pp.28 eq.3.5) %TODO: Region measures % CombinedMorphologicalSpectralRegion (see Lewis2004a) % PyramidLinkingRegion (see Piella2002a) % Other region-based fusion (see http://www.ece.lehigh.edu/SPCRL/IF/image_fusion.htm) % (Also see Z. Li, Z. Jing, G. Liu, S. Sun, and H. Leung, "A region-based image fusion algorithm using multiresolution segmentation," in Proceedings of Intelligent Transportation Systems, IEEE, 2003). \subsubsection{Weight Generators} Weight generators combine multiple feature-maps into a single weight-map for each input level-band image. A weight-map indicates the proportion of contribution each level-band image makes to the final fused output. Weight generators typically apply some sort of logic, threshold, and/or arithmetic operation to the feature-maps. For activity-based features (ie. sample, absolute value sample, and window-based features) the simplest approach is to choose the maximum feature from across the input images. For example, the weight generator looks at the feature value for level=1, band=2 in all input images and produces a weight-map with $1.0$ for the level-band image with the maximum value and $0.0$ for all other inputs. This functionality is commonly termed `select max' and is implemented by \code{gift::SelectMaximumFeature}. Alternatively we may wish to favour one input over the others, so in this case we would always select the feature from the given input. This functionality is handled by the \code{gift::SelectFeature}. Finally, we can simply take the average of all features, which is implemented by the \code{gift::AverageFeature} filter. %TODO: Thresholding match weight generator %ThresholdMatchWithActivitySimilarity (see Piella2002a pp.29) The application of weight generators typically depends on the \emph{type} of band image. For example, detail images are best handled with a `select max' approach (recall that in the case of QMF DWT, detail images contain sparse high-frequency information). On the other hand, approximation images contain more compact information and an averaging approach is common practice. GIFT provides a mechanism to override the weight generator for specific level-band images. The default generator is specified via \code{gift::ImageFusionFilter::SetDefaultWeightGenerator(.)} and specific generators can be overridden using \code{gift::ImageFusionFilter::OverrideWeightGenerator(.)}. \subsubsection{Weight Combiners} The weight combiner has the ultimate responsiblity for collapsing the weight-maps into a single image pyramid. At the moment only one weight combiner exists within GIFT - \code{gift::LinearWeightCombiner}. This class generates the final level-band image by applying a \emph{linear} weighted operation to each input level-band image using weights from each weight-map. %----------------------------------------------------------------------% % Section %----------------------------------------------------------------------% \newpage \section{Using GIFT} To get starting using GIFT please follow the below directions: \begin{enumerate} \item Download ITK 2.4.1 or higher from \href{http://www.itk.org}{http://www.itk.org}. \item Download GIFT from the \href{http://www.insight-journal.org}{Insight Journal}. \item Download CMake 2.2.3 or higher from \href{http://www.cmake.org}{http://www.cmake.org}. \item Configure and compile ITK using CMake (see the \href{http://www.itk.org/CourseWare/Training/GettingStarted-I.pdf}{ITK Getting Started Manual} for help). \item Configure GIFT using CMake (follow the same procedure for ITK). Point CMake to the top-level folder and ensure all build variables are correct. Make sure the \code{ITK\_DIR} variable is set - if ITK was not automatically found by the build system you will need to manually set this variable. \item Open the generated project file in your favourite compiler and select \code{Build Solution} (or similar). Ensure that you compile GIFT with the same configuration (ie. debug or release) as you did ITK. \item Experiment with the provided examples or create your own image fusion algorithm using \code{gift::ImageFusionFilter}. A number of test images can be found in the \code{Testing/Data/Input} directory, and further images are available from \href{http://www.imagefusion.org}{http://www.imagefusion.org}. \end{enumerate} Two worked examples are presented in \ref{sec:Examples} and some other examples are included with the toolkit source-code. %----------------------------------------------------------------------% % Section %----------------------------------------------------------------------% \section{Future Work} GIFT currently only implements basic image fusion algorithms. However, it is designed for the easy addition of new components which can be `plugged' into the \code{gift:ImageFusionFilter}. In particular, the following components are being considered for development: \begin{description} \item[Multi-scale methods:] Laplacian and morphological image pyramid methods can be implemented in a similar fashion as QMF DWT. \item[Activity-based feature generators:] a number of useful activity measures have been reported in literature, including a directive contrast activity measure \cite{Pu2000a} and a windowed-squared activity measure \cite[pp.31]{Piella2002a}. These pixel-level methods could be easily added as feature generators. \item[Region-based feature generators:] a number of interesting region-based fusion methods have been explored in current literature \cite{Piella2002a,Li2003a,Lewis2004a,Nikolov2004a}. These feature-level methods could be added as feature generators. \end{description} Another important area of development is image fusion \emph{metrics}. A number of objective comparison metrics have been investigated in literature and it would be fitting to see these added to GIFT. Some of these include the root mean square error (RMSE) between a ``ground-truth'' image and the fused image \cite{Zheng2004a}, the RMSE between the input images and the fused image \cite{Mukhopadhyay2001a}, image entropy \cite{Zheng2004a}, mutual information \cite{Qu2002a}, spatial frequency \cite{Zheng2004a,Zheng2006a}, edge strength and orientation \cite{Petrovic2006a}, and the image quality index (IQI) \cite{Toet2003a,Piella2003b}. %TODO: Look into metric at http://www.ece.lehigh.edu/SPCRL/IF/image_fusion.htm There are also a number of smaller areas needing attention. Currently \code{gift:ImageFusionFilter} does not support progress accumulation, which would be useful seeing some fusion algorithms can take significant computation time (especially for 3-D input images). Finally, there is a known bug with \code{gift::QmfWaveletImageFilter}: if \code{Update()} is not explicitly called, the reconstructed output image has the wrong dimensions (see \code{Examples/MultiscaleMethods/giftExampleMultiscaleQmfWavelet.cxx} for further details). %----------------------------------------------------------------------% % Conclusions %----------------------------------------------------------------------% \section{Conclusions} We have presented the design and initial implementation of GIFT - the Generalised Image Fusion Toolkit. Construction of simple n-D image fusion schemes using QMF DWT is possible using the toolkit. New components can be easily added to enable the implementation of other image fusion algorithms. A number of examples using the toolkit are discussed in \ref{sec:Examples}. %======================================================================% % A p p e n d e x % %======================================================================% \appendix %----------------------------------------------------------------------% % Examples %----------------------------------------------------------------------% \newpage \section{Examples} \label{sec:Examples} \removeappendixname \subsection{QMF Wavelet Analysis} The source code for this example can be found in\\ \code{Examples/MultiscaleMethods/giftExampleMultiscaleQmfWavelet.cxx}. The following example shows the usage of \code{gift::QmfWaveletImageFilter}. This particular filter performs QMF wavelet decomposition or reconstruction on the given input image(s) using a user-specified biorthogonal (bior) filter kernel. \code{gift::QmfWaveletImageFilter} is a subclass of \code{gift::MultilevelMultibandImageFilter} and has a user configurable number of levels. This filter has $2^{dims}$ bands per level - the first band is a decimated approximation image and the remaining bands are detail images for each direction. The number of inputs and outputs is dependent on the mode of operation: deconstruction or reconstruction. In deconstruction mode, the filter takes $1$ input image and outputs $levels \times bands \times 2^{dims}$ output images. In reconstruction mode, the number of inputs and outputs are swapped. To use the \code{gift::QmfWaveletImageFilter} the first step is to include the relevant headers: \begin{center} \lstinputlisting[linerange={40-41}]{../Examples/MultiscaleMethods/giftExampleMultiscaleQmfWavelet.cxx} \end{center} We now setup the internal image type, making sure we use a real pixel type (either \code{float} or \code{double}) and remembering \code{itk:ImageFileReader} will cast the input image to the specified internal type. The number of dimensions has been tested for 2-D and 3-D images, however this example is compiled for 2-D images. \begin{center} \lstinputlisting[linerange={73-74,76-77}]% {../Examples/MultiscaleMethods/giftExampleMultiscaleQmfWavelet.cxx} \end{center} The \code{gift::QmfWaveletImageFilter} takes the filter kernel coefficients as a template argument. A number of biorthogonal filter kernels are defined in \code{gift::BiorthogonalWaveletOperator}. We define the wavelet kernels and filter as such: \begin{center} \lstinputlisting[linerange={88-91}]% {../Examples/MultiscaleMethods/giftExampleMultiscaleQmfWavelet.cxx} \end{center} We now create the operator by specifying the desired bior kernel: \begin{center} \lstinputlisting[linerange={99-100}]% {../Examples/MultiscaleMethods/giftExampleMultiscaleQmfWavelet.cxx} \end{center} The available kernels are found in \code{Source/giftBiorthogonalWaveletOperator.h}: \begin{center} \lstinputlisting[linerange={51-65}]% {../Source/giftBiorthogonalWaveletOperator.h} \end{center} We now create and setup a filter for deconstruction, \begin{center} \lstinputlisting[linerange={103-103,105-107}]% {../Examples/MultiscaleMethods/giftExampleMultiscaleQmfWavelet.cxx} \end{center} and a filter for reconstruction (note that \code{NumberOfLevels} is a command line argument). \begin{center} \lstinputlisting[linerange={113-113,115-117}]% {../Examples/MultiscaleMethods/giftExampleMultiscaleQmfWavelet.cxx} \end{center} In this particular example we simply want to deconstruct the input image, save these deconstructed images, and reconstruct the output image (to confirm the input and output are the same). To achieve this we loop over \code{filterWaveletDeconstruct} outputs, construct the output filename using string replace functions, write the intermediate outputs, and attach them to the inputs of \code{filterWaveletReconstruct}. \begin{center} \lstinputlisting[linerange={122-131,138-140,142-149,156-156}]% {../Examples/MultiscaleMethods/giftExampleMultiscaleQmfWavelet.cxx} \end{center} Finally we update \code{filterWaveletReconstruct} and write the final reconstructed image: \begin{center} \lstinputlisting[linerange={158-158,165-165,170-172,174-181}]% {../Examples/MultiscaleMethods/giftExampleMultiscaleQmfWavelet.cxx} \end{center} Some results from the example are shown in \figurename~\ref{fig:ExampleQmfWaveletCtheadTwoLevels}. \ifincludefigs \def\exampleimagesize{40mm} \def\exampleimagesizehalf{20mm} \def\exampleimagesizequarter{10mm} \begin{figure}[htb] \centering \subfigure[Input ($A_0$)]{% \includegraphics[height=\exampleimagesize,bb=0 0 256 256]% {../Testing/Data/Input/cthead1.png}} \\ \subfigure[$A_1^0$]{% \includegraphics[height=\exampleimagesizehalf,bb=0 0 128 128]% {../Testing/Data/Baseline/giftTestQmfWavelet_cthead1_00.png}} \subfigure[$D_1^1$]{% \includegraphics[height=\exampleimagesizehalf,bb=0 0 128 128]% {../Testing/Data/Baseline/giftTestQmfWavelet_cthead1_01.png}} \subfigure[$D_1^2$]{% \includegraphics[height=\exampleimagesizehalf,bb=0 0 128 128]% {../Testing/Data/Baseline/giftTestQmfWavelet_cthead1_02.png}} \subfigure[$D_1^3$]{% \includegraphics[height=\exampleimagesizehalf,bb=0 0 128 128]% {../Testing/Data/Baseline/giftTestQmfWavelet_cthead1_03.png}} \hspace{4mm} \subfigure[$A_2^0$]{% \includegraphics[height=\exampleimagesizequarter,bb=0 0 64 64]% {../Testing/Data/Baseline/giftTestQmfWavelet_cthead1_04.png}} \subfigure[$D_2^1$]{% \includegraphics[height=\exampleimagesizequarter,bb=0 0 64 64]% {../Testing/Data/Baseline/giftTestQmfWavelet_cthead1_05.png}} \subfigure[$D_2^2$]{% \includegraphics[height=\exampleimagesizequarter,bb=0 0 64 64]% {../Testing/Data/Baseline/giftTestQmfWavelet_cthead1_06.png}} \subfigure[$D_2^3$]{% \includegraphics[height=\exampleimagesizequarter,bb=0 0 64 64]% {../Testing/Data/Baseline/giftTestQmfWavelet_cthead1_07.png}} \\ \subfigure[Reconstructed output]{% \includegraphics[height=\exampleimagesize,bb=0 0 256 256]% {../Testing/Data/Baseline/giftTestQmfWavelet_cthead1.png}} \caption{Output from \code{Examples/MultiscaleMethods/giftExampleMultiscaleQmfWavelet.cxx} with input=\code{cthead1.png} and \code{NumberOfLevels}=$2$.} \label{fig:ExampleQmfWaveletCtheadTwoLevels} \end{figure} \fi \newpage \subsection{3-D Image Fusion for Multi-modal Visualisation} The source code for this example can be found in\\ \code{Examples/Fusion/giftExampleFusionQmfWavelet1.cxx}. The following example shows the usage of \code{gift::ImageFusionFilter}. To setup the filter we must set the multi-scale method, any feature generators, any weight generators, and a weight combiner. In this example we use a `select max' approach for detail level-band images, and an average approach for approximation level-band images. We use open-source data from the NLM Image Data Collection Project\footnote{\href{http://nova.nlm.nih.gov/Mayo/NLMDATA/Brain/LargeAVM/}{http://nova.nlm.nih.gov/Mayo/NLMDATA/Brain/LargeAVM/}}. \code{giftExampleRegistration} is used to perform rigid registration of the two volumes, and invoked using: \begin{verbatim} giftExampleRegistration Testing/Data/Input/P2_MRA_RESCALE.mhd Testing/Data/Input/P2_MRI_T1_PRE_RESCALE.mhd Testing/Data/Input/P2_T1_PRE_REGISTERED.mhd \end{verbatim} with final values as below: \begin{verbatim} Result = versor X = -0.00731512 versor Y = -0.000214034 versor Z = -0.0250347 Translation X = 23.5739 Translation Y = 18.397 Translation Z = 22.1149 Iterations = 51 Metric value = 86.6556 Matrix = 0.998746 0.0500554 -6.1659e-005 -0.0500491 0.99864 0.014636 0.000794185 -0.0146145 0.999893 Offset = [18.9281, 22.3807, 23.4384] \end{verbatim} Following the preparation of the input images, the first step in the fusion process is to create a multi-scale method, in this case \code{gift::QmfWaveletImageFilter}: \begin{center} \lstinputlisting[linerange={109-111,114-118}]% {../Examples/Fusion/giftExampleFusionQmfWavelet1.cxx} \end{center} \newpage This example then creates two feature generators: \begin{center} \lstinputlisting[linerange={121-128}]% {../Examples/Fusion/giftExampleFusionQmfWavelet1.cxx} \end{center} and two weight generators: \begin{center} \lstinputlisting[linerange={131-138}]% {../Examples/Fusion/giftExampleFusionQmfWavelet1.cxx} \end{center} We now link the weight generators to the appropriate feature generators. In this case each weight generator uses the output of only one feature generator, however a weight generator could use more than one. \begin{center} \lstinputlisting[linerange={141-144}]% {../Examples/Fusion/giftExampleFusionQmfWavelet1.cxx} \end{center} A \code{gift::LinearWeightCombiner} is created as follows: \begin{center} \lstinputlisting[linerange={147-149}]% {../Examples/Fusion/giftExampleFusionQmfWavelet1.cxx} \end{center} The only task remaining is to plug these components into the \code{gift::ImageFusionFilter}: \begin{center} \lstinputlisting[linerange={152-169}]% {../Examples/Fusion/giftExampleFusionQmfWavelet1.cxx} \end{center} Note the following lines which allow us to override the weight generator for the approximation images in the deconstructed image pyramids: \begin{center} \lstinputlisting[linerange={163-164}]% {../Examples/Fusion/giftExampleFusionQmfWavelet1.cxx} \end{center} Some results from the example are shown in \figurename~\ref{fig:ExampleQmfWaveletWaveletFusion1_NLM_P2}. \ifincludefigs \begin{figure}[htb] \centering \subfigure[MRA]{% \includegraphics[width=50mm,bb=0 0 256 256]{NLM_P2_S40_MRA.png}} \hspace{2.5mm} \subfigure[Pre-contrast T1]{% \includegraphics[width=50mm,bb=0 0 256 256]{NLM_P2_S40_T1_PRE.png}} \\ \subfigure[Arithmetic Fusion]{% \includegraphics[width=50mm,bb=0 0 256 256]{NLM_P2_S40_ARITHMETIC.png}} \hspace{2.5mm} \subfigure[QMF DWT Fusion]{% \includegraphics[width=50mm,bb=0 0 256 256]{NLM_P2_S40_FUSED.png}} \caption{Slice 40 from the output of \code{Examples/Fusion/giftExampleQmfWaveletFusion1.cxx} with input P2\_MRA\_RESCALE\_WL.mhd and P2\_T1\_PRE\_REGISTERED\_WL.mhd. Notice in the fused output that both the vessels (from MRA) and the grey-matter (from pre-contrast T1) are visible. Also note the loss of contrast in the arithmetic fusion output compared to the QMF DWT fusion output. For the approximation band images we used the weight generator \code{gift::AverageFeature}, and for the detail band images we used \code{gift::SelectMaximumFeature}. The \code{Bior\_3\_5} filter kernel was selected for QMF wavelet decomposition with \code{NumberOfLevels}=2.} \label{fig:ExampleQmfWaveletWaveletFusion1_NLM_P2} \end{figure} \fi %======================================================================% % B i b l i o g r a p h y % %======================================================================% \newpage \bibliographystyle{plain} \bibliography{article} \end{document}