%
% Complete documentation on the extended LaTeX markup used for Insight
% documentation is available in ``Documenting Insight'', which is part
% of the standard documentation for Insight.  It may be found online
% at:
%
%     http://www.itk.org/

\documentclass{InsightArticle}

\usepackage[dvipdfm]{graphicx}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%  hyperref should be the last package to be loaded.
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage[dvipdfm,
bookmarks,
bookmarksopen,
backref,
colorlinks,linkcolor={blue},citecolor={blue},urlcolor={blue},
]{hyperref}


%  This is a template for Papers to the Insight Journal. 
%  It is comparable to a technical report format.

% The title should be descriptive enough for people to be able to find
% the relevant document. 
\title{Class for Serial Transformations}

% Increment the release number whenever significant changes are made.
% The author and/or editor can define 'significant' however they like.
\release{0.00}

% At minimum, give your name and an email address.  You can include a
% snail-mail address if you like.
\author{Torsten Rohlfing$^{1}$}
\authoraddress{$^{1}$Neuroscience Program, SRI International, Menlo Park, CA}

\begin{document}


\ifpdf
\else
   %
   % Commands for including Graphics when using latex
   % 
   \DeclareGraphicsExtensions{.eps,.jpg,.gif,.tiff,.bmp,.png}
   \DeclareGraphicsRule{.jpg}{eps}{.jpg.bb}{`convert #1 eps:-}
   \DeclareGraphicsRule{.gif}{eps}{.gif.bb}{`convert #1 eps:-}
   \DeclareGraphicsRule{.tiff}{eps}{.tiff.bb}{`convert #1 eps:-}
   \DeclareGraphicsRule{.bmp}{eps}{.bmp.bb}{`convert #1 eps:-}
   \DeclareGraphicsRule{.png}{eps}{.png.bb}{`convert #1 eps:-}
\fi


\maketitle


\ifhtml
\chapter*{Front Matter\label{front}}
\fi


% The abstract should be a paragraph or two long, and describe the
% scope of the document.
\begin{abstract}
\noindent
This paper describes a simple class for serial transformations, i.e., the
concatenation of other transformations. This can be used for
\doxygen{ResampleImageFilter}.
\end{abstract}

\tableofcontents

\section{Design Goals}

The purpose of this class is to provide a transparent way of concatenating
multiple coordinate transformations for use in
\doxygen{ResampleImageFilter}. As such, the class itself implements the
necessary components of the interface \doxygen{Transform} class interface.

\section{Example}

First, let us declare the dimension of the coordinate space and the type of
the component transformation.
\small
\begin{verbatim}
  const unsigned int SpaceDimension = 2;
  typedef double CoordinateRepType;

  typedef itk::CenteredSimilarity2DTransform< CoordinateRepType > SimilarityTransformType;
  itk::TransformFactory<SimilarityTransformType>::RegisterTransform();
\end{verbatim}
\normalsize

Next, declare the serial transformation. Note that only coordinate space
dimension and scalar coordinate data type are template arguments to the serial
transformation, but {\em not\/} the type of the component transformations
(which is arbitrary).
\small
\begin{verbatim}
  typedef itk::SerialTransform<CoordinateRepType,ImageDimension> SerialTransformType;
  typedef SerialTransformType::TransformType TransformType;
  SerialTransformType::Pointer serialTransform = SerialTransformType::New();
\end{verbatim}
\normalsize

Now we shall read all transformations given on the command line:
\small
\begin{verbatim}
  typedef itk::TransformFileReader TransformReaderType;
  typedef TransformReaderType::TransformListType TransformListType;

  for ( int i = argcTransformList; i < argc; ++i )
    {
    TransformReaderType::Pointer transformReader = TransformReaderType::New();  
    transformReader->SetFileName( argv[i] );
    transformReader->Update();
    
    TransformReaderType::TransformListType* tlist = transformReader->GetTransformList();

    TransformReaderType::TransformListType::iterator it = tlist->begin();
    while ( it != tlist.end() )
      {
      serialTransform->AddTransform( (*it).GetPointer() );
      ++it;
      }
    }
\end{verbatim}
\normalsize
And finally set the transformation in the resample filter, just like we would
any ``ordinary'' transformation:
\small
\begin{verbatim}
  typedef itk::ResampleImageFilter<ReadImageType, WriteImageType> ResampleFilterType;
  ResampleFilterType::Pointer resample = ResampleFilterType::New();
  resample->SetTransform( serialTransform );
\end{verbatim}
\normalsize

\section{Limitations}

The current implementation has the following limitations:
\begin{enumerate}
\item The class does not provide access to the parameter vectors of its
components. Therefore, the serial transformation cannot be optimized in the
ITK registration framework.

\item Input and output vectors of all component transformations must have the
same dimension. It may of course be desirable to concatenate transformations
for which this is not the case, e.g., an affine 3-D transformation followed by
a 3-D to 2-D projection and a 2-D rigid transformation. This is not currently
supported.

\item Input and output vectors of all component transformations must have the
same scalar data type.
\end{enumerate}

\section*{Acknowledgments}

Work on this class was funded by the National Institutes on Alcohol Abuse and
Alcoholism through the Integrative Neuroscience Initiative on Alcoholism
(INIA) under Grant No. AA013521 (PI: A. Pfefferbaum).

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%  Insert the bibliography using BibTeX
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%\bibliographystyle{plain}
%%\bibliography{InsightJournal}


\end{document}

