%
% 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}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%  hyperref should be the last package to be loaded.
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage[dvips,
bookmarks,
bookmarksopen,
backref,
colorlinks,linkcolor={blue},citecolor={blue},urlcolor={blue},
]{hyperref}
% to be able to use options in graphics
\usepackage{graphicx}
% for pseudo code
\usepackage{listings}
% subfigures
\usepackage{subfigure}


%  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{Some extra image logical operations}

% 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{Richard Beare}
\authoraddress{Richard.Beare@ieee.org}

\begin{document}
\maketitle

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


\begin{abstract}
\noindent
% The abstract should be a paragraph or two long, and describe the
% scope of the document.
Logic operations such as $I > J$, where I and J are images are useful
when generating masks. This submission includes $==$, $>$, $>=$, $<$
and $<=$ filters based on the existing logic filters. This is a very
minor submission - there may already be easy ways of performing the
logic operations defined by these filters, but I couldn't find them.
\end{abstract}

\tableofcontents

\section{Introduction}
This submission is hardly worth describing. It consists of filters for
pixelwise equality and comparison operations of images, which I
couldn't see any other direct ways of achieving in ITK. Please
indicate in your comments if I've missed something. The implentation
is copied directly from the the other logic filters, such as {\em
itkAndImageFilter} and is therefore threaded.

\section{Using the new filters}
The new filters are: {\em itkEqualImageFilter}, {\em
itkGreaterEqualImageFilter}, {\em itkGreaterImageFilter}, {\em
itkLessEqualImageFilter}, {\em itkLessImageFilter}. Usage is identical
to other logic filters and is illustrated in the test function - {\em check.cxx}
included in the archive.

\begin{verbatim}
  const int dim = 2;
  
  typedef unsigned char PType;
  typedef itk::Image< PType, dim > IType;

  typedef itk::ImageFileReader< IType > ReaderType;
  ReaderType::Pointer reader = ReaderType::New();
  reader->SetFileName( argv[1] );

  typedef itk::SmoothingRecursiveGaussianImageFilter<IType, IType> SmoothType;
  SmoothType::Pointer smoother = SmoothType::New();

  smoother->SetInput(reader->GetOutput());
  smoother->SetSigma(1);

  typedef itk::EqualImageFilter<IType, IType, IType> EqType;
  typedef itk::GreaterImageFilter<IType, IType, IType> GTType;
  typedef itk::GreaterEqualImageFilter<IType, IType, IType> GTEqType;
  typedef itk::LessImageFilter<IType, IType, IType> LTType;
  typedef itk::LessEqualImageFilter<IType, IType, IType> LTEqType;

  EqType::Pointer eq = EqType::New();
  GTType::Pointer gt = GTType::New();
  GTEqType::Pointer gte = GTEqType::New();
  LTType::Pointer lt = LTType::New();
  LTEqType::Pointer lte = LTEqType::New();


  eq->SetInput(reader->GetOutput());
  gt->SetInput(reader->GetOutput());
  gte->SetInput(reader->GetOutput());
  lt->SetInput(reader->GetOutput());
  lte->SetInput(reader->GetOutput());

  eq->SetInput2(smoother->GetOutput());
  gt->SetInput2(smoother->GetOutput());
  gte->SetInput2(smoother->GetOutput());
  lt->SetInput2(smoother->GetOutput());
  lte->SetInput2(smoother->GetOutput());

  


  typedef itk::ImageFileWriter< IType > WriterType;
  WriterType::Pointer writer = WriterType::New();
  writer->SetInput( eq->GetOutput() );
  writer->SetFileName( argv[2] );
  writer->Update();

  writer->SetInput( gt->GetOutput() );
  writer->SetFileName( argv[3] );
  writer->Update();

  writer->SetInput( gte->GetOutput() );
  writer->SetFileName( argv[4] );
  writer->Update();

  writer->SetInput( lt->GetOutput() );
  writer->SetFileName( argv[5] );
  writer->Update();

  writer->SetInput( lte->GetOutput() );
  writer->SetFileName( argv[6] );
  writer->Update();

\end{verbatim}


\appendix



\bibliographystyle{plain}
\bibliography{InsightJournal}
\nocite{ITKSoftwareGuide}

\end{document}

