[med-svn] [mia] 01/03: Imported Upstream version 2.2.5

Gert Wollny gert-guest at moszumanska.debian.org
Tue Sep 29 18:58:32 UTC 2015


This is an automated email from the git hooks/post-receive script.

gert-guest pushed a commit to branch master
in repository mia.

commit 643942fa08ab08569bfcb9453dcd43bb4b024d15
Author: Gert Wollny <gw.fossdev at gmail.com>
Date:   Tue Sep 29 19:56:59 2015 +0200

    Imported Upstream version 2.2.5
---
 CMakeLists.txt                   |   6 +-
 ChangeLog                        |  17 +
 doc/definitions.tex              |  38 --
 doc/idl.tex                      | 130 -------
 doc/make-xml.sh                  |  18 +
 doc/matlab.tex                   | 103 ------
 doc/miawritprogram.py            |  17 +
 doc/programing.tex               | 726 ---------------------------------------
 doc/running.tex                  |  70 ----
 doc/userguide.tex                | 336 ------------------
 mia/2d/test_fullcost.cc          |  18 +-
 mia/3d/datafield.hh              |   2 +
 mia/3d/matrix.hh                 |   3 +-
 mia/3d/test_fullcost.cc          |  24 +-
 mia/core/cmdlineparser.cc        |   2 +-
 mia/core/cmdstringoption.cc      |   2 +-
 mia/core/cmeans.cc               |   6 +-
 mia/core/cmeans.hh               |   2 +-
 mia/core/cmeansinit/static.cc    |   4 +-
 mia/core/handler.cxx             |   6 +-
 mia/core/handler.hh              |   2 +-
 mia/core/handlerbase.cc          |  12 +-
 mia/core/handlerbase.hh          |   6 +-
 mia/core/nccsum.hh               |   2 +-
 mia/core/optparam.cc             |   2 +-
 mia/core/parameter.cxx           |   2 +-
 mia/core/parameter.hh            |   5 +-
 mia/core/test_pixeltype.cc       |   2 +-
 mia/core/test_xmlinterface.cc    |   8 +-
 mia/core/xmlinterface.cc         |  12 +-
 mia/core/xmlinterface.hh         |   8 +-
 mia/mesh/filter/addscale.cc      |   2 +-
 scripts/remove-small-blobs.sh    |  61 ++++
 src/2dstack-cmeans-presegment.cc |  13 +-
 src/fluid2d/CMakeLists.txt       |   1 +
 src/fluid3d/CMakeLists.txt       |   2 +-
 src/isosurface/CMakeLists.txt    |   2 +
 37 files changed, 205 insertions(+), 1467 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 007becf..3cb98eb 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -52,9 +52,9 @@ SET(VENDOR "Gert Wollny")
 SET(PACKAGE_NAME "mia")
 SET(MAJOR_VERSION 2)
 SET(MINOR_VERSION 2)
-SET(MICRO_VERSION 4)
-SET(INTERFACE_AGE 0)
-SET(BINARY_AGE    0)
+SET(MICRO_VERSION 5)
+SET(INTERFACE_AGE 1)
+SET(BINARY_AGE    1)
 
 #
 #SET(CMAKE_BUILD_WITH_INSTALL_RPATH 1)
diff --git a/ChangeLog b/ChangeLog
index afb849c..f53e0fe 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+2.2.5 
+   
+   Bug Fixes: 
+   
+    * Fix SSE2 alignment bugs on 32 bit x86 
+    * Correct test to use BOOST_CHECK_CLOSE for floating point numbers 
+    * Fix a series of Coverity reported bugs 
+      - Change the CXMLElement to track ist children 
+      - fix past-end access in histograms 
+      - check for empty histogram in new CMeans implementation 
+    * Correct explicite instanciation of 3diterator, clang++ needed this
+
+    Other fixes
+
+    * Remove outdate documentation files 
+    * Correct licenses
+
 2.2.4
 
   New features:
diff --git a/doc/definitions.tex b/doc/definitions.tex
deleted file mode 100644
index b7985a9..0000000
--- a/doc/definitions.tex
+++ /dev/null
@@ -1,38 +0,0 @@
-
-\newcommand{\vx}{\ensuremath{\mathbf{x}} }
-\newcommand{\vv}{\ensuremath{\mathbf{x}} }
-\newcommand{\vu}{\ensuremath{\mathbf{u}} }
-\newcommand{\n}{\ensuremath{\mathbf{n}} }
-\newcommand{\R}{\ensuremath{\mathbb{R}} }
-\newcommand{\curl}[1]{\nabla \times #1} % for curl
-\newcommand{\sa}[1]{\hyperref[#1]{#1}}
-\newcommand{\ventry}[1]{\begin{sideways}#1\end{sideways}}
-
-
-\newcommand\optiontable[1]{\begin{tabularx}{\linewidth}{llcX}\hline #1 \end{tabularx}}
-
-\newcommand\cmdgroup[1]{\multicolumn{4}{l}{\bf #1}\\\hline}
-\newcommand\cmdopt[4]{\texttt{-{}-#1} & \ifthenelse{\equal{#2}{}}{}{\texttt{-#2}} & #3 & #4 \\\hline}
-
-\newcommand\optinset{\cmdopt{in-file}{i}{string}{input segmentation set}}
-\newcommand\optoutset{\cmdopt{out-file}{o}{string}{output segmentation set}}
-
-
-\newcommand\optinfile{\cmdopt{in-file}{i}{string}{input file name}}
-\newcommand\optreffile{\cmdopt{ref-file}{r}{string}{reference image file name}}
-\newcommand\optoutfile{\cmdopt{out-file}{o}{string}{output file name}}
-\newcommand\optoutbase{\cmdopt{out-base}{o}{string}{output file name base - a number and the type suffix 
-    will be added automatically}}
-\newcommand\opttypetwod{\cmdopt{type}{t}{string}{output image file type (Table \ref{tab:fileformats})}}
-\newcommand\opttypetwodb{\cmdopt{type}{t}{string}{output image file type (Table \ref{tab:fileformats})}}
-\newcommand\opttypethreed{\cmdopt{type}{t}{string}{output image file type (Table \ref{tab:fileformats})}}
-\newcommand\optrepn{\cmdopt{repn}{r}{string}{output pixel type (Table \ref{tab:pixform}), 
-                                             must be supported by the output file type (Table \ref{tab:fileformats})}}
-\newcommand\opthelpplugin{\cmdopt{help-plugins}{}{}{print out all plugins and a short description}}
-
-\newcommand\plugtabstart{\begin{tabular}{|p{0.1\columnwidth}|p{0.1\columnwidth}|p{0.5\columnwidth}|p{0.1\columnwidth}|}\hline
-Name & Type & Description & Default \\\hline\hline} 
-\newcommand\plugtabend{\hline\end{tabular}}
-
-\newcommand\miamex{{\tt miamex} }
-\newcommand{\tw}[1]{{\tt #1}}
diff --git a/doc/idl.tex b/doc/idl.tex
deleted file mode 100644
index 7aae815..0000000
--- a/doc/idl.tex
+++ /dev/null
@@ -1,130 +0,0 @@
-\section{IDL Interface User Guide}
-
-If MIA is installed into \tw{<MIA-ROOT>} add \tw{<MIA-ROOT>/lib/mia-2.0/plugins/idl} to the \tw{IDL\_DLM} search path. 
-After doing so, IDL needs to be restarted. 
-
-\subsection{Supported Functions}
-
-All available functions of the MIA library are imported into IDL by using the DLM interface provided. 
-Calling 
-
-\lstset{language=bash}
-\begin{lstlisting}
-FUNCTION test_echo
-in = 10
-out = 20
-;---------------------------------------------------------
-out = MIA_ECHO(in)
-;---------------------------------------------------------
-IF ( in NE out ) THEN RETURN, 0
-RETURN, 1
-END
-\end{lstlisting}
-
-\noindent 
-Supported functions are  \tw{MIA\_ECHO}, \tw{MIA\_DEBUG}, \tw{MIA\_DEFORM2D}, \tw{MIA\_DEFORM3D}, \tw{MIA\_FILTER2D}, \tw{MIA\_FILTER3D}, \tw{MIA\_NRREG2D}, 
-  \tw{MIA\_NRREG3D}, and \tw{MIA\_READ2DIMAGE}. 
-
-\section{Function description}
-
-\subsubsection*{Set debug level}
-
-\begin{description}
-\item [Function:] MIA\_DEBUG
-\item [Description:] set the verbosity of the run algorithm.
-\item [Parameters:] verbosity given as string: fatal, error, fail, warning, message, debug (if mia is build without -DNDEBUG)
-\item [Example:] Set debug level to 'message'
-\begin{lstlisting}
-  dummy = MIA_DEBUG('message')
-\end{lstlisting}
-\end{description}
-
-
-\subsubsection*{Test function}
-
-\begin{description}
-\item [Function:] MIA\_ECHO
-\item [Description:] returns the input parameter
-\item [Parameters:] an abitrary parameter 
-\item [Example:] Echo the number 10 
-\begin{lstlisting}
-  result = MIA_ECHO(10)
-\end{lstlisting}
-\end{description}
-
-\subsubsection*{2D/3D image filters}
-
-\begin{description}
-\item [Function:] MIA\_FILTER2D, MIA\_FILTER2D
-\item [Description:] An 2D/3D image filter as described in section \ref{sec:2dfilters} and \ref{sec:3dfilters}, respectively.
-\item [Parameters:] filter, image
-\item [Example:] Filtering an 2D image \tw{image} with a median filter of width 3 and store the result in \tw{filtered}.
-\begin{lstlisting}
-  filtered = MIA_FILTER2D('median:w=3', image)
-\end{lstlisting}
-\end{description}
-
-\subsubsection*{2D/3D non-rigid image registration}
-
-\begin{description}
-\item [Function:] MIA\_NRREG2D, MIA\_NRREG3D
-\item [Description:] An 2D or 3D image registration algorithm, fluid dynamics and elastic
-\item [Parameters:] src, ref, method, soriter, cost, epsilon, startsize, niter
-
-\begin{tabular}{ll}
-src & source (floating) image \\
-ref & reference image \\
-model & registration model (navier|naviera)\\
-timestep & timestep (direct|fluid) \\
-cost & cost function \\
-epsilon & registration stopping criterion \\
-startsize & multigrid start size \\
-niter & number of external iterations  \\
-\end{tabular}
-\item [Example:] running a fluid synamic registration of a pair of 2D images, src and ref, using the sum of 
-  squared differences as criterion. The call is executed like follows:
-\begin{lstlisting}
-deform_field = MIA_NRREG2D(src, ref, 'naviera:iter=40', 'fluid', 'ssd', 0.001, 16, 100)
-\end{lstlisting}
-\end{description}
-
-\subsubsection*{2D/3D image deformation}
-
-\begin{description}
-\item [Function:] MIA\_DEFORM2D, MIA\_DEFORM3D
-\item [Description:] An 2D or 3D image deformation, Given a deformation field $\vu$ the deformed image is
-   evaulated from the source image $S(\vx)$ according to $D(\vx) := S(\vx - \vu(\vx))$. 
-\item [Parameters:] src, field, interp
-\item [Returns:] the deformed image
-
-\begin{tabular}{ll}
-src & source image  to be deformed \\
-field & deformation field $\vu$ \\
-interp & interpolator: nn (neares neighbor), tri (bi/tri-linear), bspline3, bspline4, bspline5, omoms3\\
-\end{tabular}
-\item [Example 1:] deforming a 3d image by using an input field and the tri-linear interpolator
-\begin{lstlisting}
-    defo = MIA_DEFORM3D(src_img, field, 'bspline3')
-\end{lstlisting}
-\end{description}
-
-
-\subsubsection*{2D image reader}
-
-\begin{description}
-\item [Function:] MIA\_READ2DIMAGE
-\item [Description:] Uses the interface of the MIA library to load an image
-\item [Parameters:] name
-\item [Returns:] the image
-
-\begin{tabular}{ll}
-name  & file name of the image to be loaded \\
-\end{tabular}
-\item [Example 1:] loading a ``BMP'' file 
-\begin{lstlisting}
-    image = MIA_READ2DIMAGE('image.bmp')
-\end{lstlisting}
-\end{description}
-
-
-
diff --git a/doc/make-xml.sh b/doc/make-xml.sh
index a0becad..f7614d7 100644
--- a/doc/make-xml.sh
+++ b/doc/make-xml.sh
@@ -1,4 +1,22 @@
 #!/bin/sh 
+#
+# Copyright (c) Leipzig, Madrid 1999-2015 Gert Wollny
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+#
+
 
 name="$1"
 EXE_PREFIX="$2"
diff --git a/doc/matlab.tex b/doc/matlab.tex
deleted file mode 100644
index 0a4641b..0000000
--- a/doc/matlab.tex
+++ /dev/null
@@ -1,103 +0,0 @@
-\section{Matlab Interface User Guide}
-
-If MIA is installed into \tw{<MIA-ROOT>} add \tw{<MIA-ROOT>/lib/mia-2.0/plugins/matlab} to the MATLAB search path. 
- 
-
-\subsection{Supported Functions}
-
-All calls to the MIA library are directed through the \miamex function.
-The first parameter to \miamex is a command string that describes the requested function, further parameters follow according to the command.
-As an example, a random 2D image is filtered by a Gaussian 2D filter of filter parameter 3 wich results in a filter width of 7:
-
-\lstset{language=matlab}
-\begin{lstlisting}
-image = rand(256, 128) 
-filtered_image = miamex('filter2d', 'gauss:w=3',  image) 
-\end{lstlisting}
-
-\noindent 
-Supported commands are  \tw{debug},  \tw{deform2d}, \tw{deform3d}, \tw{filter2d}, \tw{filter3d}, \tw{reg2d}, \tw{reg3d}. 
-For convenience, a set of functions is defined as MATLAB functions:  \tw{miadeform2d}, \tw{miareg2d}, \tw{miadeform3d},  and \tw{miareg3d}. 
-
-
-\subsection{Image Filters}
-
-\subsubsection*{Set debug level}
-
-\begin{description}
-\item [Command:] debug
-\item [Description:] set the verbosity of the run algorithm.\footnote{%
-	It seems for some reason, on MS Windows this is not output properly. 
-}
-\item [Parameters:] verbosity: fatal, error, fail, warning, message, (debug)
-\item [Example:] Set debug level to 'message'
-\begin{lstlisting}
-  miamex('debug', 'message')
-\end{lstlisting}
-\end{description}
-
-\subsubsection*{2D/3D image filters}
-
-\begin{description}
-\item [Command:] filter2d, filter 3d
-\item [Description:] An 2D/3D image filter as described in section \ref{sec:2dfilters} and \ref{sec:3dfilters}, respectively.
-\item [Parameters:] filter, image
-\item [Example:] Filtering an 2D image \tw{image} with a median filter of width 3 and store the result in \tw{filtered}.
-\begin{lstlisting}
-  filtered = miamex('filter2d', 'median:w=3', image)
-\end{lstlisting}
-\end{description}
-
-\subsubsection*{2D/3D non-rigid image registration}
-
-\begin{description}
-\item [Command:] reg2d, reg3d
-\item [Convenience:] miareg2d, miareg3d
-\item [Description:] An 2D or 3D image registration algorithm, fluid dynamics and elastic
-\item [Parameters:] src, ref, method, soriter, cost, epsilon, startsize, niter
-
-\begin{tabular}{ll}
-src & source (floating) image \\
-ref & reference image \\
-soriter & number of iterations for solver \\
-cost & cost function \\
-epsilon & registration stopping criterion \\
-startsize & multigrid start size \\
-niter & number of external iterations  \\
-\end{tabular}
-\item [Example:] running a fluid synamic registration of a pair of 2D images, src and reference, using the sum of 
-  squared differences as criterion. The call is executed by using the convenience fucnction
-\begin{lstlisting}
-deform_field = miareg2d(src, ref, 'fluid', 20, 'ssd', 0.001, 16, 100)
-\end{lstlisting}
-\end{description}
-
-\subsubsection*{2D/3D image deformation}
-
-\begin{description}
-\item [Command:] deform2d, deform3d
-\item [Convenience:] miadeform2d, miadeform3d
-\item [Description:] An 2D or 3D image deformation, Given a deformation field $\vu$ the deformed image is
-   evaulated from the source image $S(\vx)$ according to $D(\vx) := S(\vx - \vu(\vx))$. 
-\item [Parameters:] src, field, interp
-\item [Returns:] the deformed image
-
-\begin{tabular}{ll}
-src & source image  to be deformed \\
-field & deformation field $\vu$ \\
-interp & interpolator: nn (neares neighbor), tri (bi/tri-linear), bspline3, bspline4, bspline5, omoms3\\
-\end{tabular}
-\item [Example 1:] deforming a 3d image by using an input field and the tri-linear interpolator
-\begin{lstlisting}
-deform_image = miamex('deform3d', image3d, field3d, 'tri')
-\end{lstlisting}
-\item [Example 2:] deforming a 2d image by using an input field and the convenience function
-\begin{lstlisting}
-deform_image = miadeform2d(image2d, field2d)
-\end{lstlisting}
-\end{description}
-
-
-
-
-
diff --git a/doc/miawritprogram.py b/doc/miawritprogram.py
index 7166a74..42a87c4 100644
--- a/doc/miawritprogram.py
+++ b/doc/miawritprogram.py
@@ -1,3 +1,20 @@
+# Copyright (c) Leipzig, Madrid 1999-2015 Gert Wollny
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+#
+
 from lxml import etree
 import re
 
diff --git a/doc/programing.tex b/doc/programing.tex
deleted file mode 100644
index 67b95aa..0000000
--- a/doc/programing.tex
+++ /dev/null
@@ -1,726 +0,0 @@
-\documentclass[english, 10pt, a4paper,headsepline,openany]{scrbook}
-\usepackage[T1]{fontenc}
-\usepackage[latin1]{inputenc}
-\usepackage[left=2cm,right=1cm,top=2cm,bottom=2cm,twoside]{geometry}
-\usepackage{array}
-\usepackage{amsmath}
-\usepackage{amssymb}
-\usepackage[numbers]{natbib}
-\usepackage{listings}
-\usepackage{color}
-\usepackage{graphics}
-\usepackage{nonfloat}
-\usepackage{babel}
-\usepackage[colorlinks,linkcolor=blue]{hyperref}
-\usepackage{multirow}
-\usepackage{ifthen}
-\usepackage{tabularx}
-\usepackage{rotating}
-\usepackage{float}
-\usepackage{colortbl}
-\newcommand{\has}{\cellcolor[gray]{0.5}}
-
-\floatstyle{ruled}
-\newfloat{listing}{tbp}{lop}[section]
-
-
-
-\include{version}
-\include{definitions}
-
-%\makeatletter
-\definecolor{listinggray}{gray}{0.9}
-\lstset{backgroundcolor=\color{listinggray}}
-
-
-\makeatother
-
-
-\title{MIA Programming Guide}
-
-\begin{document}
-\lstset{numbers=left, numberstyle=\small, numbersep=5pt}
-
-This part of the MIA guide decribes, how to use the interfaces provided to write your own software,
-  how to extend the the functionallity of MIA without touchting its core, and, finally, how to 
-  extend the core funcionallity MIA itself.
-\begin{itemize}
-\item In chapter \ref{ch:simple} an example is provided, that describes how to scan the command line, load an image, 
-  run some given filters on it and store the image. 
-\item Chapter \ref{ch:images} focuses images on writing an image filter that can handle various different 
-   gray scale pixel formats.
-\item Chapter \ref{ch:io} decribes how to teach MIA to read and write additional image formats. 
-\item Chapter \ref{ch:addpluginstype} gives an insight how to create a new class of plug-ins.
-\end{itemize}
-
-Note, that the code examples make use of C++0x features like the {\bf auto} for automatic 
-  type deduction and \emph{lambda} expressions. 
-
-\chapter{A simple program}
-\label{ch:simple}
-
-This chapter will teach you how to use the MIA-tools to scan command line parameters, read and store images, 
-  create filters opbejcts from plug-ins and apply filter chains to the images. 
-In summary, the program described here is the \texttt{mia-2dimagefilter} from \texttt{src/2dimagefilter.cc}. 
-
-For convenience the full source code is printed in the listning below, and we will go through it line by line. 
-\lstset{language=c++,basicstyle=\small,numberstyle=\small}
-\begin{lstlisting}
-#include <mia/core.hh>
-#include <mia/2d.hh>
-
-NS_MIA_USE;
-using namespace std;
-
-static const char *program_info = 
-	"This program is used to filter and convert gray scale images.\n"
-	"Basic usage:\n"
-	"  mia-2dimagefilter -i <input image> -o <output image> [<plugin>] ...\n"; 
-
-int do_main( int argc, const char *argv[] )
-{
-
-	string in_filename;
-	string out_filename;
-	string out_type;
-
-	const auto& filter_plugins = C2DFilterPluginHandler::instance();
-	const auto& imageio = C2DImageIOPluginHandler::instance();
-
-	CCmdOptionList options(program_info);
-	options.add(make_opt( in_filename, "in-file", 'i', 
-                "input image(s) to be filtered", CCmdOption::required));
-	options.add(make_opt( out_filename, "out-file", 'o',
-		"output image(s) that have been filtered", CCmdOption::required));
-	options.add(make_opt( out_type, imageio.get_set(), "type", 't',
-		"output file type (override suffix)"));
-	options.add(g_help_optiongroup, 
-	        make_help_opt( "help-plugins", 0,
-		   "give some help about the filter plugins", 
-	  	   new TPluginHandlerHelpCallback<C2DFilterPluginHandler>));
-	
-	if (options.parse(argc, argv) != CCmdOptionList::hr_no)
-		return EXIT_SUCCESS; 
-	auto filter_chain = options.get_remaining();
-
-	if ( filter_chain.empty() )
-		cvwarn() << "no filters given, just copy\n";
-
-	std::vector<C2DFilterPlugin::ProductPtr> filters(filter_chain.size());
-	transform(filter_chain.begin(), filter_chain.end(), filters.begin(),
-		  [&filter_plugins](const char * name) {
-			  auto filter =  filter_plugins.produce(name); 
-			  if (!filter) {
-				  THROW(invalid_argument, "Filter '" << name << "' not found"); 
-			  }
-			  return filter; 
-		  }
-		); 
-		
-	auto in_image_list = imageio.load(in_filename);
-	if (!in_image_list || in_image_list->empty()) {
-		THROW(invalid_argument, "No images found in " << in_filename); 
-	}
-	
-	for (auto f = filters.begin(); f != filters.end(); ++f) {
-		cvmsg() << "Run filter: " << (*f)->get_init_string() << "\n";
-		transform(in_image_list->begin(), in_image_list->end(), in_image_list->begin(),
-			  [f](const P2DImage& img){return  (*f)->filter(*img);}); 
-	}
-	
-	if ( !imageio.save(out_type, out_filename, *in_image_list) ){
-		THROW(runtime_error, "Unable to save result to " << out_filename);
-	};
-	return EXIT_SUCCESS;
-
-}
-
-int main( int argc, const char *argv[] )
-{
-	try {
-		return do_main(argc, argv);
-	}
-	catch (const runtime_error &e){
-		cerr << argv[0] << " runtime: " << e.what() << endl;
-	}
-	catch (const invalid_argument &e){
-		cerr << argv[0] << " error: " << e.what() << endl;
-	}
-	catch (const exception& e){
-		cerr << argv[0] << " error: " << e.what() << endl;
-	}
-	catch (...){
-		cerr << argv[0] << " unknown exception" << endl;
-	}
-
-	return EXIT_FAILURE;
-}
-\end{lstlisting}  
-
-\begin{description}
-\item [1:] For option parsing include the core of the MIA library. 
-\item [2:] For 2D image handling pull in the apropriate declaration. 
-\item [4,5:] Using the MIA and STD to save some typing.\footnote{%
-For further reading on when it is okay to use the using statement please consulte \citet{sutter05coding}}
-\item [7-10:] Define the header for the help output. 
-\item [12-74:] The body of the true main function. 
-    To reduce intentions resultin from the global try-catch statement, this body is put into an extra function. 
-\item [15-17:]
-    Declare some variables, that are needed for the command line parsing, namely the input and output file names, 
-    the output file format (if not given the file format is deducted from the output file name), and a flag 
-    see if the user requests some help on the supported filter plugins. 
-    The values given to these variables will be the default values for the options. 
-     As an exception, boolean values are always default to ``false''. 
-\item [19,20:] Define some short cuts for the plugin handlers.
-\item [22-32:] Define the options for this program using the variables given above. 
-    Silently, in the background are some more options available, that deal with common tasks, such as printing out the general
-      help, printing out copyright information, and verbosity level of the output. 
-    See chapter \ref{ch:prog} for details. 
-\item [34-36:] Parse the command line and check if a help option was used. 
-     For this program, the remaining command line parameters describe the filters to be applied. 
-     A command line like 
-     \lstset{language=bash,numbers=none}
-     \begin{lstlisting}
-eva-2dimagefilter -i input.png -o output.png \
-    downscale:bx=2,by=2 bandpass:min=20,max=200
-    \end{lstlisting}
-      will be parsed like follows:
-      \begin{itemize}
-      \item  \texttt{in\_filename} = ``input.png''
-      \item  \texttt{out\_filename} = ``output.png''
-      \item  \texttt{filter\_chain} = (downscale:bx=2,by=2, bandpass:min=20,max=200)
-      \end{itemize}
-
-\item [38-39:] Print out some warning if no filters were given. 
-
-\item [41-50:] Create the filter chain by using the filter descriptions from the command line. 
-       If the creation of one filter fails, an \texttt{invalid\_argument} exception is thrown, 
-        which will terminate the  program with an error message. 
-\item [52-55:] Load the image(s) from the input file. 
-       If no input image is found, throw an \texttt{invalid\_argument} exception that will terminate 
-         the program with an error message. 
-\item [57-61:] Apply the filters to all input images replacing the input images. 
-       Since the images are all wrapped into shared pointers, no memory leaks will be introduced by this code. 
-\item [63-65:] Save the filtered image(s) in the output file. If not successfull throw an exception.
-\item [67:] Terminate the program with the return value indicating success.
-\item [71-90:] The body of the main function that encapsulates the real functionallity into a try 
-      catch block that is used to report error messages. 
-\end{description}
-
-\chapter{Basic operations on Images}
-
-\label{ch:images}
-
-In the following, the basic handling of images is described. 
-All the examples will use 2D images. 
-If not otherwise noted, 3D images are handled likewise - you only need to change 2D to 3D in the 
-  class and function names. 
-
-\section{Creating, copying, loading, and storing images}
-
-The images supported in MIA  may contain different pixel types, e.g. 1-bit, 8-bit, 16-bit, or float valued ones. 
-MIA uses shared pointers \texttt{P2DImage} to \texttt{C2DImage}, respectively,  to hold images. 
-However, in order to account for the pixel type, at creation time a derivative class of the used pixel 
-   type needs to be specified. 
-In order to create an 16-bit image with unsigned pixel values with a given \texttt{size}, use:
-
-\lstset{numbers=none}
-\begin{lstlisting}
-P2DImage image = P2DImage(new C2DUSImage(size)); 
-\end{lstlisting}
-
-All images may store meta-data that hold information that may be irrelevant to image processig 
-  but should be preserves to keep track of the image processing. 
-This data is stored in an attribute list that is actually the base class for the image classes. 
-Attributes can be of an abitrary type but only a certain subset of attribute types is predefined. 
-
-Adding an attribute to an image is done like this: 
-\begin{lstlisting}
-PAttribute attr(new CDoubleAttribute(1.2));  
-image->set_attribute("key", attr);
-\end{lstlisting}
-
-Since most of the time attributes that are bound to a certain key are of a specific type, 
-  translater functions exists that enable passing a string to the set\_attribute function,  
-  and the translater will take care of creating the proper attribute type. 
-\begin{lstlisting}
-image->set_attribute("key", "1.2");
-\end{lstlisting}
-
-
-In order to copy all the meta-data of anothe image at creation time, one may give the reference image 
-  as additional parameter to the constructor.
-
-\begin{lstlisting}
-P2DImage new_image = P2DImage(new C2DUSImage(size, *image));
-\end{lstlisting}
- 
-In order to copy an image with all its meta-data the image class provides the clone function: 
-\begin{lstlisting}
-P2DImage image_copy = image->clone();
-\end{lstlisting}
-
-Of course all images can also be loaded and stored to files. 
-Two options are provided to load and store images: 
-  The generic approach uses the \texttt{load} and \texttt{write} methods of the according image IO 
-    plugin handler. 
-  Since some image formats support storing more than one image frame these methods 
-    handle lists of images. 
-For instance to load all images from a file \texttt{images.tiff} do 
-\begin{lstlisting}
-	auto images = C2DImageIOPluginHandler::instance().load("images.tiff");
-\end{lstlisting}
-In this case images is a \texttt{std::vector<P2DImage>} and you can access the actual images by 
-  using the functions provided by this template. 
-In order to store a series of images to a file \texttt{output.tiff} just call 
-\begin{lstlisting}
-	bool success  = C2DImageIOPluginHandler::instance().save("output.tiff", images);
-\end{lstlisting}
-
-
-If you want to load or store just one image per file, then convenicence functions exists, 
-   that take care of the handling packing and unpacking the image into and from lists. 
-If a file contains more then one frame, with these functions only the first image will be loaded. 
-In this case loading the image from \texttt{image.png} boils down to calling 
-\begin{lstlisting}
-        P2DImage image = load_image2d("image.png"); 
-\end{lstlisting}
-Note, however, that \texttt{load\_image2d} will throw a \texttt{runtime\_exception} of no image 
-  could be loaded. 
-
-Saving an image is done by 
-\begin{lstlisting}
-        bool success = save_image2d("image.png", image); 
-\end{lstlisting}
-
-
-\section{About Image Filters}
-\label{sec:filter}
-
-In order to access the image data, its pixel type needs to be known. 
-Of course it is possible to use the \texttt{get\_type} method of the \texttt{C2DImage} class and use
-  a switch statement in order to cast to the appropriate derived class. 
-However, since this needs to be done very often, MIA provides various template functions to handle 
-  this conversion.
-These functions are defined in \texttt{<mia/core/filter.hh>} and examples of its use are given below. 
-
-\subsection{The single image filter}
-
-The simples of all filter functions takes exactly one image as input and returns the filterde image. 
-The filter function is defined as: 
-
-\lstset{numbers=left,firstnumber=auto}
-\begin{lstlisting}{FilterExample}
-template <typename Filter, typename Image>
-static typename Filter::result_type filter(const Filter& f, const Image& b)
-\end{lstlisting}
-
-In the current implementation of MIA, \texttt{Image} will be either \texttt{C2DImage} or \texttt{C3DImage}. 
-\texttt{Filter} is a functor class that must provied the a type \texttt{result\_type} and an 
-  operator \texttt{()}.
-The most basic declaration of such a filter that takes a 2D image as input and has a 2D image as 
-   output would look like 
-\begin{lstlisting}{FilterExample}
-class CSimpleFilter {
-public: 
-  typedef mia::P2DImage result_type; 
-  
-  template <typename T> 
-  result_type operator()(const T2DImage<T>& image) const; 
-}
-\end{lstlisting}
-
-Note, that the operator () is templated with respect to the image pixel type and that its parameter image 
-  and the operator itself is defined as constant. 
-This means, logically a filter should acts as a function whose result only depends on the input image 
-(and possible parameters passed to a non-trivial constructor). 
-
-In listing \ref{list:filterthreshold} you can find the complete declaration and definition of a filter 
-  that runs a thresholding operation by setting all pixels in the image below the given threshold to zero 
-  and all values above or equal to one. 
-The output will be a bit valued image. 
-
-\begin{listing}
-\begin{lstlisting}{ThresholdFilterExample}
-#include <algorithm>
-class C2DTreshholdFilter {
-public: 
-  typedef mia::P2DImage result_type; 
-  
-  C2DTreshholdFilter(double threshold); 
-
-  template <typename T> 
-  result_type operator()(const T2DImage<T>& image) const; 
-private:
-  double m_threshold; 
-}
-
-C2DTreshholdFilter::C2DTreshholdFilter(double threshold):
-  m_threshold(threshold)
-{
-}
-
-template <typename T> 
-typename C2DTreshholdFilter::result_type 
-operator()(const T2DImage<T>& image) const
-{
-  auto r = new C2DBitImage(image.get_size(), image); 
-  P2DImage result(r); 
-  std::transform(image.begin(), image.end(), r->begin(), 
-                 [m_threshold](T x){return x >= m_threshold;});
-  return  result; 
-}
-\end{lstlisting}
-\caption{\label{list:filterthreshold}Thresholding filter}
-\end{listing}
-
-
-To call such a filter in order to process an image \texttt{image} of type \texttt{C2DImage} 
-   the following code is used: 
-\begin{lstlisting}
-  C2DTreshholdFilter filter(thresh); 
-  auto filtered = mia::filter(filter, image); 
-\end{lstlisting}
-
-
-  
-\subsection{Pixel Type Dependant Filtering}
-\label{sec:ptdf}
-
-In some cases, filters may be defined only for certain input pixel types, or one wants to apply 
-   the filter differently depending of the actual pixel type. 
-In these cases (partial) template specialization should be used. 
-
-E.g. in the above example, using the thresh-holding filter on a bit-valued image doesn't make much sense. 
-Therefore, we would like to report an error, if the filter is invoked with an bit valued image. 
-This can be done  by additionally implementing a specialisation of the 
-  operator () of \texttt{C2DTreshholdFilter}: 
-\emph{I think another indirection is needed here ...}
-\begin{lstlisting}{ThresholdFilterExample}
-template <>
-C2DTreshholdFilter::result_type C2DTreshholdFilter::operator(const C2DBitImage& image)const 
-{
-  throw invalid_argument("C2DTreshholdFilter can not be used on bit-valued images"); 
-}
-\end{lstlisting}
- 
-The compiler will take care of the rest, and if the user provides a bit valued image the 
-  above exception will be thrown. 
-For a further introduction into (partial) template specialization see, e.g.  
-  \citet{vandevoorde05}.
-
-Also note, that the implementation of \texttt{std::vector<bool>} uses bit field to represenet entries 
-  and it is, therefore, often necessary to provide specializations to filters for this type.  
-
-
-\section{Extending MIA}
-\label{ch:extending}
-
-One of the primary reasons for the plug-in based design of the library was to make it easy to extend 
-  the funcionality of the library without altering the core libraries.
-
-
-
-
-\subsection{Adding a Plugin to store/load data in a new file format}
-\label{sec:newfilehandler}
-
-In the following, adding support fo a new 2D image file format is described. 
-The base class defining the interface for 2D Image IO is \texttt{C2DImageIOPlugin} and it is 
-  declared in the the header file \texttt{<mia/2d/2dimageio.hh>}. 
-In order to implement the new IO file format, four abstract virtual functions have to be implemented: 
-\begin{itemize}  
-\item {\tt do\_add\_suffixes}: Adds the standard suffixes for this file format to the plugin handlers suffic map. 
-\item {\tt do\_load}: Implements loading data from the file. 
-\item {\tt do\_save}: Implements storing data to the file. 
-\item {\tt do\_get\_descr}: Returns a string with a short description of the plugin.
-\end{itemize}  
-In addition, a constructor has to be defined, in order to name the format. 
-
-The following example code is taken from the Windows BMP iamge format IO plugin which resides in the MIA source tree in \texttt{mia/2d/io/bmp.cc}.
-First, the plugin class is declared as a specification of the general 2D plugin class: 
-
-\begin{lstlisting}{BMPIO}
-#include <mia/2d/2dimageio.hh>
-NS_BEGIN(BMPIO)
-NS_MIA_USE
-
-class CBMP2DImageIO: public C2DImageIOPlugin {
-public:
-  CBMP2DImageIO();
-private: 
-  void do_add_suffixes(multimap<string, string>& map) const;
-  PData do_load(const string& fname) const;
-  bool do_save(const string& fname, const Data& data) const;
-  const string do_get_descr() const; 
-};
-\end{lstlisting}
-
-\noindent 
-The constructor of the plugin takes care of two things: initialise the plug-in with its apropriate name and set the supported pixel formats. 
-
-\begin{lstlisting}{BMPIO}
-CBMP2DImageIO::CBMP2DImageIO():
-	C2DImageIOPlugin("bmp")
-{
-	add_supported_type(it_ushort);
-	add_supported_type(it_ubyte); 
-	add_supported_type(it_bit);
-}
-\end{lstlisting}
-
-\noindent 
-Since at construction time, nothing is known about the plugin handler, 
-  the setup of the suffix-fileformat map has to be done in an extra function: 
-\begin{lstlisting}{BMPIO}
-void CBMP2DImageIO::do_add_suffixes(multimap<string, string>& map) const
-{
-	map.insert(pair<string,string>(".bmp", get_name())); 
-	map.insert(pair<string,string>(".BMP", get_name())); 
-}
-\end{lstlisting}
-
-\noindent 
-The next function just gives a plain text description of the plug-in, that might be used when printing out help. 
-\begin{lstlisting}{BMPIO}
-const string  CBMP2DImageIO::do_get_descr()const
-{
-	return string("BMP 2D-image input/output support");
-}
-\end{lstlisting}
-
-\noindent 
-Since some file types (like, e.g. TIFF) provide their own routines for opening the file, this file open code 
-  needs to be added here.
-After creating the result image vector, format specific code follows to load the image data that is then returned. 
-\begin{lstlisting}{BMPIO}
-CBMP2DImageIO::PData CBMP2DImageIO::do_load(string const& filename)const
-{
-  int read = 0; 
-  CInputFile f(filename);
-  if (!f)
-    return PData(); 
-
-  PData result = PData(new C2DImageVector()); 
-
- 
-  // File format specific implementation follows
-  //  ...
-	
-  return result; 
-}
-\end{lstlisting}
-
-\noindent 
-In the save function, again the file needs to be opened/created for output, because this might be format specific. 
-Saving the image data requires a translation of the pixel type that is best provided by a filter 
-  function (see Section \ref{sec:filter}) here given by the CImageSaver class.
-\begin{lstlisting}{BMPIO}
-bool CBMP2DImageIO::do_save(string const& filename, const C2DImageVector& data) const
-{
-	cvdebug() << "CBMP2DImageIO::save begin\n"; 
-	
-	COutputFile f(filename);
-	if (!f) {
-		cverr() << "CBMP2DImageIO::save:unable to open output file:" << filename << "\n"; 
-		return false; 
-	}
-		
-	CImageSaver saver(f); 
-	
-	for (C2DImageVector::const_iterator iimg = data.begin(); iimg != data.end(); ++iimg)
-		filter(saver, **iimg); 
-	
-	cvdebug() << "CBMP2DImageIO::save end\n"; 
-	return true; 
-}
-\end{lstlisting}
-
-\noindent 
-Finally, the plugin interface function needs to be defined. 
-This functions needs to be declared \texttt{extern ``C''} to avoid the C++ name mangeling that is compiler dependend. 
-Depending on the target platform and compiler, some additional decoration might be necessary that is set elsewhere 
-  through the \texttt{EXPORT} define.
-\begin{lstlisting}{BMPIO}
-extern "C" EXPORT CPluginBase *get_plugin_interface()
-{
-		return new CBMP2DImageIO;
-}
-\end{lstlisting}
-
-\noindent 
-Above code skeleton provides the basis for all IO plugins. 
-For further reading, please turn to the source code in the respective ``io'' directories.
-
-\subsection{Writing a Factory Plugin}
-\label{ch:filterplugin}
-
-Most plug-ins in MIA are factory plug-ins, that provide an interface to create objects from certain 
-  parameters that are usually given as strings. 
-As an example we will describe a 2D filter plug-in that evaluates the mean intensity of a 
-  pixel neighbourhood, called \texttt{mean}. 
-
-All factory plug-ins are created using three files: \texttt{test\_plugin.cc}, \texttt{plugin.cc}, 
-  and \texttt{plugin.hh}. 
-
-These files are dedicated to 
-\begin{description}
-\item [test\_plugin.cc:] The unit-tests for the plug-in. 
-\item [plugin.hh:] declarations of the filter and plug-in classes. 
-\item [plugin.cc:] implementation of the filter and plug-in classes. 
-\end{description}
-
-MIA targets at a software development method that results in reliable software, and therefore,  
- for each plug-in unit-tests should be provided that ensure that the plug-in works as expected. 
-
-In the following we assume that the newly created plugin will reside in \texttt{mia/2d/filter}. 
-for the filter and the plug-in the interface is usually already defined completely by the according base-class
- and only the blanks need to be filled in - which means the pure virtual methods must be 
-  overridden and implemented.
-Accordingly, the header file \texttt{mean.hh} looks like follows: 
-
-First, include the required header
-\lstset{numbers=left,firstnumber=auto}
-\begin{lstlisting}{MeanFilterHeader}
-#include <mia/2d/2dfilter.hh>
-\end{lstlisting}
-and start the namespace for the filter: 
-\begin{lstlisting}{MeanFilterHeader}
-NS_BEGIN( mean_2dimage_filter)
-\end{lstlisting}
-It is best to put the code of each plug-in into its own, unique name space in oder to avoid 
-  name collisions that may result into the wrong code being executed - an error that is quite 
-  difficult to pin-point since it is very unexpected. 
-Since the programs all access the plug-ins through the interface of the according base class this 
-  separation of plug-in code into unique name-spaces doesn't put an additioal burden on the library consumers. 
-
-
-Then follows the declaration of the actual filter: 
-\begin{lstlisting}{MeanFilterHeader}
-class C2DMean : public mia::C2DFilter {
-public:
-	C2DMean(int hw);
-
-	template <class T>
-	typename C2DMean::result_type operator () (const mia::T2DImage<T>& data) const;
-private:
-	virtual mia::P2DImage do_filter(const mia::C2DImage& image) const;
-
-	int m_hw;
-};
-\end{lstlisting}
-As one can see, \texttt{C2DMean} is derived from \texttt{mia::C2DFilter}, which is the base class 
-  for all 2D filters.  
-Line three declares the constructor and line eight the filter function that will call 
-  \texttt{mia::filter}.
-Unfortunatly, in C++ it is not possible to declare and define virtual template methods. 
-Therefore, \texttt{do\_filter} has to be implemented within the actual filter that will 
-  be used as parameter to \texttt{mia::filter} to run the \texttt{operator ()} according 
-  to the pixel type the input image carries. 
-The actual filter operator \texttt{operator ()} is declared as public function to simplify 
-  the access permissions within \texttt{mia::filter}. 
-
-The actual plug-in class is then declared like follows: 
-\begin{lstlisting}{MeanFilterHeader}
-class C2DFilterPluginFactory: public mia::C2DFilterPlugin {
-public:
-	C2DFilterPluginFactory();
-private:
-	virtual mia::C2DFilterPlugin::ProductPtr do_create()const;
-	virtual const std::string do_get_descr()const;
-	int m_hw;
-};
-\end{lstlisting}
-
-The implementation of the filter is then very streightforward: 
-\begin{lstlisting}{MeanFilterCode}
-
-\end{lstlisting}
-
-
-
-
-
-In the case of a mean filter, the test would look like this: 
-
-First include the test framework and the header belonging to the actual filter: 
-\lstset{numbers=left,firstnumber=auto}
-\begin{lstlisting}{MeanFilterExample}
-#include <mia/internal/autotest.hh>
-#include <mia/2d/filter/mean.hh>
-\end{lstlisting}
-
-\noindent
-Then we add the required {\bf using} statements to save us some typing
-\begin{lstlisting}{MeanFilterExample}
-NS_MIA_USE
-using namespace std;
-using namespace ::boost;
-using namespace ::boost::unit_test;
-using namespace mean_2dimage_filter;
-\end{lstlisting}
-
-Finally, we implement the test itself: 
-\begin{lstlisting}{MeanFilterExample}
-BOOST_AUTO_TEST_CASE( test_2dfilter_mean )
-{
-	const size_t size_x = 7;
-	const size_t size_y = 5;
-
-	const int src[size_y][size_x] =
-		{{ 0, 1, 2, 3, 2, 3, 5},
-		 { 2, 5, 2, 3, 5, 3, 2},
-		 { 1, 2, 7, 6, 4, 2, 1},
-		 { 3, 4, 4, 3, 4, 3, 2},
-		 { 1, 3, 2, 4, 5, 6, 2}};
-
-	// "hand filtered" w = 1 -> 3x3 using zero boundary conditions 
-        //
-	const float src_ref[size_y][size_x] =
-        {{ 2.0/1.0,  2.0/1.0, 8.0/3.0, 17.0/6.0, 19.0/6.0, 10.0/3.0, 13.0/4.0},
-         {11.0/6.0, 22.0/9.0,31.0/9.0, 34.0/9.0, 31.0/9.0,  3.0/1.0,  8.0/3.0},
-         {17.0/6.0, 10.0/3.0, 4.0/1.0, 38.0/9.0, 11.0/3.0, 26.0/9.0, 13.0/6.0},
-         { 7.0/3.0,  3.0/1.0,35.0/9.0, 13.0/3.0, 37.0/9.0, 29.0/9.0,  8.0/3.0},
-         {11.0/4.0, 17.0/6.0,10.0/3.0, 11.0/3.0, 25.0/6.0, 11.0/3.0, 13.0/4.0}}; 
-
-	C2DBounds size(size_x, size_y);
-
-	C2DFImage *src_img = new C2DFImage(size);
-	for (size_t y = 0; y < size_y; ++y)
-		for (size_t x = 0; x < size_x; ++x)
-			(*src_img)(x,y) = src[y][x];
-
-	C2DMean mean(1);
-
-	P2DImage src_wrap(src_img);
-
-	P2DImage res_wrap = mean.filter(*src_wrap);
-
-	C2DFImage* res_img = dynamic_cast<C2DFImage*>(res_wrap.get());
-	BOOST_REQUIRE(res_img);
-	BOOST_REQUIRE(res_img->get_size() == src_img->get_size());
-
-
-	for (size_t y = 0; y < size_y; ++y)
-		for (size_t x = 0; x < size_x; ++x)
-			BOOST_CHECK_EQUAL((*res_img)(x,y), src_ref[y][x]);
-}
-\end{lstlisting}
-
-
-
-
-
-
-
-\subsection{Adding a new general plugin type}
-\label{ch:addpluginstype}
-
-\subsection{Adding new data types}
-\label{sec:adddatatypeio}
-
-
-\bibliographystyle{plainnat}
-\cleardoublepage\addcontentsline{toc}{chapter}{\bibname}
-\bibliography{userguide}
-\end{document}
\ No newline at end of file
diff --git a/doc/running.tex b/doc/running.tex
deleted file mode 100644
index 5846afe..0000000
--- a/doc/running.tex
+++ /dev/null
@@ -1,70 +0,0 @@
-\section{Command Line Tools}
-
-All programs in MIA are available as command line tools. 
-
-\subsection{Converting raw data to images and volumes}
-
-MIA doen't support the processing of raw data files. 
-Instead it provides the tools to convert such data to certain file formats that carry size and data type information. 
-Two command are provided: \texttt{mia-raw2image} for conversion of 2D data and \texttt{mia-raw2volume} for conversion of 3D data. 
-Some storage formats also may provide information about pixel/voxel size. 
-
-To convert a raw 2D array of size 120x130 of double floating point values (64 bit) , stored as big endian, and 
-  with a pixel size of $2.0 x 2.0$ units to a PNG image, the following command may be issued: 
-\lstset{language=bash}
-\begin{lstlisting}
-mia-raw2image -i input.raw --big-endian -o output.png -r double \
-	-s <120,130> -f <2.0,2.0> 
-\end{lstlisting}
-
-\noindent 
-In order to convert a raw 256x256x128 3D data array of unsingned short values (16 bit), given as low endian, with a voxel size of $1.0 x 1.0 x 2.0$ 
-  to the VISTA file format issue the following command: 
-\begin{lstlisting}
-mia-raw2volume -i input.raw  -o output.v -r ushort \
-	-s <256,256,128> -f <1.0,1.0,2.0>
-\end{lstlisting}
-
-\noindent 
-The number of supported image file formats depends on the compiled in support - see chapter \ref{ch:prog} for details. 
-
-\subsection{Filtering images}
-
-MIA provides a set of standard 2D and 3D filters. 
-These filters can easily combined  to a filter chain. 
-For example in order to filter a 2D image \texttt{image.png} first with a Gaussian 
-  of the order 3 (filter width = 2 * 3 + 1), and then with a 
-  median least square filter of the order 2, issue the command 
-\begin{lstlisting}
-mia-2dimagefilter -i image.png -o filtered.png gauss:w=3 mlv:w=2
-\end{lstlisting}
-
-Morphological operations, line erosion, dilation, open, and close are currently only supported for 3D images. 
-To apply an openin operation to a volume data set \texttt{volume.v}, by using a filled sphere of radius 3 as structuring element, 
-  call: 
-\begin{lstlisting}
-mia-2dimagefilter -i volume.v -o morphed.v open:shape=[sphere:r=3]
-\end{lstlisting}
-
-\subsection{Non-linear image registration and deformation}
-
-MIA implements fluid dynamic and linear elastic registration by minimising a voxel based measure. 
-As a result a vector field is evaluated that describes a probable course of change the given input images and the appllied registration model. 
-
-For a non-linear fluid dynamics based registration of the floating image \texttt{source.v} to the reference image \texttt{reference.v}, by using the 
- adaptive solver algorithm \cite{wollny02comput} with a maximum of 40 iterations and a multi-grid start size of 16x16x16, call 
-
-\begin{lstlisting}
-mia-3dnrreg -i source.v -r reference.v -m naviera:iter=40 -m 16 -o field.v 
-\end{lstlisting}
-
-\noindent 
-In order to apply the deformation to an input image, using the omoms3 interpolation filter, do 
-\begin{lstlisting}
-mia-3ddeform -i source.v -t field.v -o deformed.v -p omoms3
-\end{lstlisting}
-
-
-
-
-
diff --git a/doc/userguide.tex b/doc/userguide.tex
deleted file mode 100644
index 45e673a..0000000
--- a/doc/userguide.tex
+++ /dev/null
@@ -1,336 +0,0 @@
-
-\documentclass[english, 10pt, a4paper,headsepline,openany]{book}
-\usepackage[T1]{fontenc}
-\usepackage[latin1]{inputenc}
-\usepackage[left=2cm,right=1cm,top=2cm,bottom=2cm,twoside]{geometry}
-\usepackage{array}
-\usepackage{amsmath}
-\usepackage{amssymb}
-\usepackage[numbers]{natbib}
-\usepackage{listings}
-\usepackage{color}
-\usepackage{graphics}
-\usepackage{nonfloat}
-\usepackage{babel}
-\usepackage[colorlinks,linkcolor=blue]{hyperref}
-\usepackage{multirow}
-\usepackage{ifthen}
-\usepackage{tabularx}
-\usepackage{rotating}
-\usepackage{colortbl}
-\newcommand{\has}{\cellcolor[gray]{0.5}X}
-
-\include{version}
-\include{definitions}
-
-%\makeatletter
-\definecolor{listinggray}{gray}{0.9}
-\lstset{backgroundcolor=\color{listinggray}}
-
-
-\makeatother
-
-\begin{document}
-
-\vfill{}
-\title{MIA User Guide \\Software Version: \miaversion}
-\vfill{}
-
-
-\author{Gert Wollny}
-
-\maketitle
-
-\section*{Preface}
-
-This is the \emph{MIA User Reference}. 
-In this document you will find descriptions for all the programs and plug-ins currently included in the 
-  MIA software package. 
-This document is maintained by Gert Wollny <gw.fossdev at gmail.com>. 
-Additions, hints, modifications, and corrections are welcome. 
-
-\section*{License}
-
-Copyright (c) Leipzig, Madrid 1999-2011, Gert Wollny <gw.fossdev at gmail.com>
-Permission is granted to copy, distribute and/or modify this document under the terms of the 
-  GNU Free Documentation License, Version 1.1 or any later version published by the 
-  Free Software Foundation; with no Invariant Sections, 
-  with no Front-Cover Texts and with no Back-Cover Texts. 
-A copy of the license is available at http://www.gnu.org/copyleft/fdl.html
-
-\section*{Changes}
-
-\begin{center}
-\begin{tabular}{cc}
-\hline 
-Date  & Description\\
-\hline
-\hline 
-01/09/2011 & Second Public Release  \\
-01/10/2007 & First Public Release  \\
-01/03/2007 & Second Beta \\
-13/06/2007 & First Beta  \\
-\hline
-\end{tabular}
-\end{center}
-
-\tableofcontents{}
-
-\pagestyle{headings}
-
-
-\chapter{Introduction}
-
-MIA is a library and a collection of command line programs for gray scale image processing. 
-It's main focus is on research in image processing.
-For that reason some of the programs are of a rather experimental nature and partially 
-   duplicate funcionality. 
-Nevertheless, the funcionality that is provided by the libraries and plug-ins is developed 
-  using \emph{test driven development} to ensure reproducability of the results.
- 
-
-
-\section{Installation}
-
-MIA has been tested on GNU/Linux (x86,amd64) but should be installable on any Posix compatible platform. 
-
-
-\subsection{UNIX, Linux, Mac OS X} 
-
-In order to use MIA, on these platforms the software is best installed from source code. 
-To do so, your software environment has to meet the following pre-requisites: 
-
-\begin{enumerate}
-\item You need a ANSI-compatible C++ compiler that supports some features of the C++2011 standard 
-        -- GNU g++ ($\ge 4.5$) \url{http://gcc.gnu.org} is known to work. 
-\item Intel Threading Building Blocks for Open Source ($\ge 3.0$) \url{http://threadingbuildingblocks.org/} 
-\item CMake \url{http://www.cmake.org}
-\item The BOOST >= 1.46.1 \url{http://www.boost.org} library
-\item gsl The GNU Scientific Library \url{http://www.gnu.org/software/gsl/}
-\item A library that provides the CBLAS interface, e.g. ATLAS \url{http://math-atlas.sourceforge.net/}.
-\item The Intel Threading Building Blocks \url{http://threadingbuildingblocks.org/}
-\end{enumerate}
-
-\noindent 
-Additionally, packages listed in Table \ref{tab:external} add to the functionallity of the software, 
-   if available and enabled.
-
-\begin{table}[h]
-\caption{\label{tab:external}Supported external packages}
-\begin{tabularx}{\linewidth}{lX}
-\hline 
-{\bf Package } & {\bf Additional information} \\
-\hline 
-\hline 
-{ OpenEXR } & A HDR Image Library that supports 32 bit and floating point valued 
-                 images \url{http://www.openexr.org} \\
-\hline 
-{ TIFF } & The Tagged Image File Format \url{http://www.remotesensing.org/libtiff/libtiff.html} \\
-\hline 
-{ PNG } & Portable Network Graphics \url{http://www.libpng.org} \\
-\hline 
-{ DCMTK } & DICOM image IO (partial support) \url{http://dicom.offis.de/dcmtk} \\
-\hline 
-{ nlopt } & Nonlinear optimizers library  \url{http://ab-initio.mit.edu/wiki/index.php/NLopt} \\
-\hline 
-{ it++ } & Signal processing library \url{http://itpp.sourceforge.net}  \\
-\hline 
-{ xml++ } & Input/output of XML files, support for certain segmentation features \url{http://libxmlplusplus.sourceforge.net/} \\
-\hline 
-{ fftw } & Fast Fourier Transformation \url{http://www.fftw.org}  \\
-\hline 
-\end{tabularx}
-\end{table}
-
-If all of the above pre-requisites are met, the installation of MIA boils down to:
-
-\lstset{language=bash}
-\begin{lstlisting}
-  tar -zxvf mia-2.0.X.tgz
-  mkdir build
-  cd build
-  cmake -DCMAKE_INSTALL_PREFIX=<path to install> ../mia-2.0.X
-  make
-  make install
-\end{lstlisting}
-In order to test some of the components, you may run ``make test''. 
-
-\subsection{MS Windows} 
-
-Currently broken, may work with cygwin. 
-
-\subsection{Creating the documentation} 
-
-In order to create the documentation, a working installation of Doxygen \url{http://www.doxygen.org/}, 
-  LaTeX \url{http://www.latex-project.org/}, and Python \url{http://www.python.org/} is required. 
-
-With these pre-requisites, the documentation, including this document and the library reference, 
-  can be build after configuring the build environment of MIA as given above by running: 
-\lstset{language=bash}
-\begin{lstlisting}
-  cd build/doc 
-  make doc 
-\end{lstlisting}
- 
-The equivalent of this document is created as \emph{userguide.pdf}. 
-
-\chapter{User Reference}
-
-
-In its essence, MIA is a collection of command line programs and supporting plug-ins. 
-
-
-\section{Image and pixel formats}
-
-The MIA library operates exclusively on gray scale and binary images. 
-The supported pixel formats are given in Table \ref{tab:pixform}. 
-
-\begin{table}[h]
-\caption{\label{tab:pixform}Supported pixel formats}
-\begin{tabular}{lrr}
-Short name & C data type & size in bit \\
-\hline 
-\hline 
-bit    & bool          & 1  \\
-\hline 
-sbyte  & signed char   & 8  \\ 
-\hline 
-ubyte  & unsigned char & 8  \\ 
-\hline 
-sshort & signed short  & 16 \\
-\hline 
-ushort & unsigned short& 16 \\
-\hline 
-sint   & signed int    & 32 \\
-\hline 
-uint   & unsigned int  & 32 \\
-\hline 
-float  & float         & 32 \\
-\hline 
-double & double        & 64 \\
-\hline 
-\end{tabular}
-\end{table}
-
-The supported file formats depend, in part, on the external libraries that were enabled during build time. 
-Table \ref{tab:fileformats} lists all file formats can can be enabled. 
-
-\begin{table}[h]
-\caption{\label{tab:fileformats}Supported image file formats}
-\begin{tabular}{lll|c|c|c|c|c|c|c|c|c|c}
-          &     &  & \multicolumn{9}{c|}{\bf Supported pixel types} & \\
-
-{\bf Format}    &  {\bf Extension }    &  {\bf Depends} & \ventry{bit} & \ventry{sbyte} & \ventry{ubyte} & \ventry{sshort} 
-                                             & \ventry{ushort} & \ventry{sint} & \ventry{uint} & \ventry{float} 
-                                             & \ventry{double} & \ventry{multi-}-\ventry{record} \\
-\hline 
-\hline 
-\multicolumn{3}{l}{\bf 2D image files types} & \multicolumn{9}{l}{} & \\
-\hline 
-Windows bitmap            & bmp &            & \has &    &\has &    &\has &    &    &   &   &   \\
-\hline 
-Internal storage          & @   &            &\has& \has&\has &\has &\has &\has &\has &\has&\has&   \\
-\hline 
-DICOM                     & dcm & dcmtk      &   &    &    &\has &    &    &    &   &   &   \\
-\hline 
-OpenExr                   & exr & openexr    &   &    &    &    &    &    &\has &\has&   &\has\\
-\hline 
-Portable Network Graphics & png & libpng     &\has&    &\has &    &\has &    &    &   &   &   \\
-\hline 
-Raw data (output)         & raw &            &\has&\has &\has &\has &\has &\has &\has &\has&\has&   \\
-\hline 
-Tagged Image File Format  & tif, tiff & tiff &\has&    &\has &    &\has &    &    &   &   &\has\\
-\hline 
-Vista file format         & v   &            &\has&\has &\has &\has &    &\has &    &\has&\has&\has\\
-\hline 
-\multicolumn{3}{l}{\bf 3D image files types} & \multicolumn{9}{l}{} &\\
-\hline 
-Analyze                   & hdr+img  &       &   &    &\has &\has &    &\has &    &\has&\has&\has\\
-\hline 
-DICOM (as series of files)& dcm & dcmtk      &   &    &    &\has &    &    &    &   &   &   \\
-\hline 
-INRIA 3D File format      &     &            &   &\has &\has &\has &\has &\has &\has &\has&\has&   \\
-\hline 
-Internal storage          & @   &            &\has& \has&\has &\has &\has &\has &\has &\has&\has&   \\
-\hline 
-Sun TAAC Image File Format& vff &            &   &    &\has &\has &    &    &    &   &   &   \\
-\hline 
-Vista file format         & v   &            &\has&\has &\has &\has &    &\has &    &\has&\has&\has\\
-\hline 
-\end{tabular}
-\end{table}
-
-
-
-%\include{running}
-
-\chapter{Programs}
-\label{ch:prog}
-
-\lstset{language={}}
-
-This chapter lists all the software tools provided by mia. 
-The descriptions follow a designated pattern: 
-
-\subsection*{The command line program name}
-\begin{description}
-\item [Description:]A description of the program
-\item [Options:] list of options
-
-\noindent 
-\optiontable{
-long name & short name & value type & description of the parameter \\
-\hline
-}
-
-\noindent 
-If no value type is given, then the option is a flag that defaults to \emph{false} and accepts no 
-     further value. 
-All programs support the following options: 
-
-\optiontable{
-\cmdopt{help}{h}{}{Print out some help}
-\cmdopt{usage}{?}{}{Print out a short help}
-\cmdopt{version}{v}{}{Print out version information}
-\cmdopt{copyright}{}{}{Print out copyright information}
-\cmdopt{verbose}{V}{string}{set the verbosity of the output out of (debug, message, warning, fail, error, fatal)}
-}
-
-\item [Example:] Example how to run the program 
-
-\item [Remarks:] additional notes
-\item [See also:] Cross reference to related programs. 
-\end{description}
-
-For all programs, the \texttt{-{}-help} option will print out additional information, like which parameters 
-  are required and what are the default values (if set).
-Note, when other options are set alongside the \texttt{-{}-help} option, then for these options, the given value 
-  will be shown as default and the \emph{required} tag will not be shown.
-When a program is called with two (or more) conflicting options then one option takes automatically 
-  precedence as it is documented. 
-
-\subsection*{An additional note for setting command line options}
-
-Option values that belong to one option \emph{must not} contain whitespace characters, otherwise, 
-  the command line parser will seperate the parts. 
-As an alternative, the command line parameter may be protected by quotes or double quotes. 
-Note, however, when you give free parameters by using ``?'' or ``*'' to use the shell expansion to indicate 
-  more then one file, quoting the parameter will inhibit parameter expansion, and internally, all programs 
-  take the letters ``?'' and ``*'' literal. 
-Also note, that some options require the use of the charaters ``<'' and ``>''. 
-Since these letters are also interpreted by the shell, the parameters using these characters must be 
-  protected by quotes.
-
-\include{programs}
-
-\chapter{Plug-ins}
-\label{ch:plugins}
-
-In this chapter the plug-ins are described that are provided by the library.
-\include{plugins}
-
-\bibliographystyle{plainnat}
-\cleardoublepage\addcontentsline{toc}{chapter}{\bibname}
-\bibliography{userguide}
-
-\end{document}
diff --git a/mia/2d/test_fullcost.cc b/mia/2d/test_fullcost.cc
index f4a8c18..a0e0ab7 100644
--- a/mia/2d/test_fullcost.cc
+++ b/mia/2d/test_fullcost.cc
@@ -90,10 +90,10 @@ BOOST_AUTO_TEST_CASE( test_fullcost )
 	CDoubleVector gradient(t.degrees_of_freedom()); 
 	c.set_size(t.get_size()); 
 	
-	BOOST_CHECK_EQUAL(c.evaluate(t,gradient), 0.5 * mcost);
+	BOOST_CHECK_CLOSE(c.evaluate(t,gradient), 0.5 * mcost, 0.01);
 
-	BOOST_CHECK_EQUAL(gradient[0], 0.5 * mgx);
-	BOOST_CHECK_EQUAL(gradient[1], 0.5 * mgy);
+	BOOST_CHECK_CLOSE(gradient[0], 0.5 * mgx, 0.01);
+	BOOST_CHECK_CLOSE(gradient[1], 0.5 * mgy, 0.01);
 }
 
 BOOST_AUTO_TEST_CASE( test_multicost ) 
@@ -117,10 +117,10 @@ BOOST_AUTO_TEST_CASE( test_multicost )
 	CDoubleVector gradient(t.degrees_of_freedom(), true); 
 	costs.set_size(t.get_size()); 
 	
-	BOOST_CHECK_EQUAL(costs.evaluate(t,gradient), 0.5 * mcost1 + 0.2 * mcost2);
+	BOOST_CHECK_CLOSE(costs.evaluate(t,gradient), 0.5 * mcost1 + 0.2 * mcost2, 0.1);
 
-	BOOST_CHECK_EQUAL(gradient[0], 0.5 * mgx1 + 0.2 * mgx2);
-	BOOST_CHECK_EQUAL(gradient[1], 0.5 * mgy1 + 0.2 * mgy2);
+	BOOST_CHECK_CLOSE(gradient[0], 0.5 * mgx1 + 0.2 * mgx2, 0.1);
+	BOOST_CHECK_CLOSE(gradient[1], 0.5 * mgy1 + 0.2 * mgy2, 0.1);
 }
 
 BOOST_AUTO_TEST_CASE( test_multicost2 ) 
@@ -145,10 +145,10 @@ BOOST_AUTO_TEST_CASE( test_multicost2 )
 	CDoubleVector gradient(t.degrees_of_freedom()); 
 	costs.set_size(t.get_size()); 
 	
-	BOOST_CHECK_EQUAL(costs.evaluate(t,gradient), 0.5 * mcost1 + 0.2 * mcost2);
+	BOOST_CHECK_CLOSE(costs.evaluate(t,gradient), 0.5 * mcost1 + 0.2 * mcost2, 0.1);
 
-	BOOST_CHECK_EQUAL(gradient[0], 0.5 * mgx1 + 0.2 * mgx2);
-	BOOST_CHECK_EQUAL(gradient[1], 0.5 * mgy1 + 0.2 * mgy2);
+	BOOST_CHECK_CLOSE(gradient[0], 0.5 * mgx1 + 0.2 * mgx2, 0.1);
+	BOOST_CHECK_CLOSE(gradient[1], 0.5 * mgy1 + 0.2 * mgy2, 0.1);
 }
 
 
diff --git a/mia/3d/datafield.hh b/mia/3d/datafield.hh
index 501a076..da1ecdf 100644
--- a/mia/3d/datafield.hh
+++ b/mia/3d/datafield.hh
@@ -46,6 +46,7 @@ NS_MIA_BEGIN
 	extern template class  EXPORT_3D range2d_iterator<std::vector<TYPE>::iterator>; \
 	extern template class  EXPORT_3D range2d_iterator<std::vector<TYPE>::const_iterator>;
 
+
 DECLARE_EXTERN_ITERATORS(double);
 DECLARE_EXTERN_ITERATORS(float);
 DECLARE_EXTERN_ITERATORS(unsigned int);
@@ -54,6 +55,7 @@ DECLARE_EXTERN_ITERATORS(short);
 DECLARE_EXTERN_ITERATORS(unsigned short);
 DECLARE_EXTERN_ITERATORS(unsigned char );
 DECLARE_EXTERN_ITERATORS(signed char);
+DECLARE_EXTERN_ITERATORS(bool);
 
 #ifdef LONG_64BIT
 DECLARE_EXTERN_ITERATORS(signed long);
diff --git a/mia/3d/matrix.hh b/mia/3d/matrix.hh
index 3d91901..cd9b5e1 100644
--- a/mia/3d/matrix.hh
+++ b/mia/3d/matrix.hh
@@ -160,7 +160,8 @@ template <typename I>
 T3DMatrix<T>::T3DMatrix(const T3DMatrix<I>& o):
 	T3DVector<T3DVector<T> >(T3DVector<T>(o.x), 
 				 T3DVector<T>(o.y), 
-				 T3DVector<T>(o.z))
+				 T3DVector<T>(o.z)),
+	m_ev_type(0)
 {
 }
 
diff --git a/mia/3d/test_fullcost.cc b/mia/3d/test_fullcost.cc
index c411488..261bff5 100644
--- a/mia/3d/test_fullcost.cc
+++ b/mia/3d/test_fullcost.cc
@@ -95,12 +95,12 @@ BOOST_AUTO_TEST_CASE( test_fullcost )
 	CDoubleVector gradient(t.degrees_of_freedom()); 
 	c.set_size(t.get_size()); 
 	
-	BOOST_CHECK_EQUAL(c.evaluate(t,gradient), 0.5 * mcost);
+	BOOST_CHECK_CLOSE(c.evaluate(t,gradient), 0.5 * mcost, 0.01);
 
-	BOOST_CHECK_EQUAL(gradient[0], 0.5 * mgx);
-	BOOST_CHECK_EQUAL(gradient[1], 0.5 * mgy);
+	BOOST_CHECK_CLOSE(gradient[0], 0.5 * mgx, 0.01);
+	BOOST_CHECK_CLOSE(gradient[1], 0.5 * mgy, 0.01);
 
-	BOOST_CHECK_EQUAL(gradient[2], 0.5 * mgz);
+	BOOST_CHECK_CLOSE(gradient[2], 0.5 * mgz, 0.01);
 }
 
 BOOST_AUTO_TEST_CASE( test_multicost ) 
@@ -126,11 +126,11 @@ BOOST_AUTO_TEST_CASE( test_multicost )
 	CDoubleVector gradient(t.degrees_of_freedom()); 
 	costs.set_size(t.get_size()); 
 	
-	BOOST_CHECK_EQUAL(costs.evaluate(t,gradient), 0.5 * mcost1 + 0.2 * mcost2);
+	BOOST_CHECK_CLOSE(costs.evaluate(t,gradient), 0.5 * mcost1 + 0.2 * mcost2, 0.1);
 
-	BOOST_CHECK_EQUAL(gradient[0], 0.5 * mgx1 + 0.2 * mgx2);
-	BOOST_CHECK_EQUAL(gradient[1], 0.5 * mgy1 + 0.2 * mgy2);
-	BOOST_CHECK_EQUAL(gradient[2], 0.5 * mgz1 + 0.2 * mgz2);
+	BOOST_CHECK_CLOSE(gradient[0], 0.5 * mgx1 + 0.2 * mgx2, 0.1);
+	BOOST_CHECK_CLOSE(gradient[1], 0.5 * mgy1 + 0.2 * mgy2, 0.1);
+	BOOST_CHECK_CLOSE(gradient[2], 0.5 * mgz1 + 0.2 * mgz2, 0.1);
 }
 
 
@@ -160,11 +160,11 @@ BOOST_AUTO_TEST_CASE( test_multicost2 )
 	CDoubleVector gradient(t.degrees_of_freedom(), true); 
 	costs.set_size(t.get_size()); 
 	
-	BOOST_CHECK_EQUAL(costs.evaluate(t,gradient), 0.5 * mcost1 + 0.2 * mcost2);
+	BOOST_CHECK_CLOSE(costs.evaluate(t,gradient), 0.5 * mcost1 + 0.2 * mcost2, 0.1);
 
-	BOOST_CHECK_EQUAL(gradient[0], 0.5 * mgx1 + 0.2 * mgx2);
-	BOOST_CHECK_EQUAL(gradient[1], 0.5 * mgy1 + 0.2 * mgy2);
-	BOOST_CHECK_EQUAL(gradient[2], 0.5 * mgz1 + 0.2 * mgz2);
+	BOOST_CHECK_CLOSE(gradient[0], 0.5 * mgx1 + 0.2 * mgx2, 0.1);
+	BOOST_CHECK_CLOSE(gradient[1], 0.5 * mgy1 + 0.2 * mgy2, 0.1);
+	BOOST_CHECK_CLOSE(gradient[2], 0.5 * mgz1 + 0.2 * mgz2, 0.1);
 }
 
 
diff --git a/mia/core/cmdlineparser.cc b/mia/core/cmdlineparser.cc
index 77bc443..ce39a49 100644
--- a/mia/core/cmdlineparser.cc
+++ b/mia/core/cmdlineparser.cc
@@ -374,7 +374,7 @@ void CCmdOptionListData::print_help_xml(const char *name_help, const CPluginHand
 	basic_usage->set_child_text(usage_text.str()); 
 
 	for (auto h = handler_help_map.begin(); h != handler_help_map.end(); ++h)
-		h->second->get_xml_help(nodeRoot);
+		h->second->get_xml_help(*nodeRoot);
 	
 	auto example = nodeRoot->add_child("Example");
 	example->set_child_text(m_program_example_descr); 
diff --git a/mia/core/cmdstringoption.cc b/mia/core/cmdstringoption.cc
index b72fc24..ce2dc30 100644
--- a/mia/core/cmdstringoption.cc
+++ b/mia/core/cmdstringoption.cc
@@ -68,7 +68,7 @@ void CCmdStringOption::do_get_long_help_xml(std::ostream& os, CXMLElement& paren
 {
 	if (m_plugin_hint) {
 		m_plugin_hint->add_dependend_handlers(handler_map); 
-		m_plugin_hint->get_string_help_description_xml(os, &parent); 
+		m_plugin_hint->get_string_help_description_xml(os, parent); 
 	}else
 		parent.set_attribute("type", __type_descr<string>::value);
 }
diff --git a/mia/core/cmeans.cc b/mia/core/cmeans.cc
index 61bf889..e486157 100644
--- a/mia/core/cmeans.cc
+++ b/mia/core/cmeans.cc
@@ -90,6 +90,10 @@ CMeans::SparseProbmap CMeans::run(const SparseHistogram& histogram,  DVector& cl
 	for(auto h: histogram)
 		n += h.second;
 
+	if (n == 0) {
+		throw create_exception<invalid_argument>("CMeans::run: the provided histogram was empty"); 
+	}
+	
 	double normalizer = 1.0/n; 
 
 	transform(histogram.begin(), histogram.end(), nhist.begin(),
@@ -224,7 +228,7 @@ CMeans::SparseProbmap CMeansImpl::run(const CMeans::NormalizedHistogram& nh, CMe
 }
 
 
-// the class that has only the size as a paramater
+// the class that has only the size as a parameter
 CMeansInitializerSizedPlugin::CMeansInitializerSizedPlugin(const char *name):
         CMeansInitializerPlugin(name)
 {
diff --git a/mia/core/cmeans.hh b/mia/core/cmeans.hh
index 0b2ebac..01b7bd2 100644
--- a/mia/core/cmeans.hh
+++ b/mia/core/cmeans.hh
@@ -103,7 +103,7 @@ private:
 
 typedef TFactory<CMeans::Initializer> CMeansInitializerPlugin;
 
-// the class that has only the size as a paramater
+// the class that has only the size as a parameter
 class EXPORT_CORE CMeansInitializerSizedPlugin : public CMeansInitializerPlugin {
 public: 
         CMeansInitializerSizedPlugin(const char *name);
diff --git a/mia/core/cmeansinit/static.cc b/mia/core/cmeansinit/static.cc
index 0a95903..b1d3816 100644
--- a/mia/core/cmeansinit/static.cc
+++ b/mia/core/cmeansinit/static.cc
@@ -29,7 +29,7 @@ CEqualInitializer::CEqualInitializer(size_t nclasses):m_nclasses(nclasses)
 {
 }
 
-CMeans::DVector CEqualInitializer::run(const CMeans::NormalizedHistogram& nh) const
+CMeans::DVector CEqualInitializer::run(const CMeans::NormalizedHistogram& MIA_PARAM_UNUSED(nh)) const
 {
         CMeans::DVector result(m_nclasses);
 
@@ -44,7 +44,7 @@ CPredefinedInitializer::CPredefinedInitializer(const CMeans::DVector& init):m_in
         // should check that this is in normalized range ? 
 }
 
-CMeans::DVector CPredefinedInitializer::run(const CMeans::NormalizedHistogram& nh) const
+CMeans::DVector CPredefinedInitializer::run(const CMeans::NormalizedHistogram& MIA_PARAM_UNUSED(nh)) const
 {
         
         
diff --git a/mia/core/handler.cxx b/mia/core/handler.cxx
index 7997e97..135fcb3 100644
--- a/mia/core/handler.cxx
+++ b/mia/core/handler.cxx
@@ -264,11 +264,11 @@ void TPluginHandler<I>::do_print_help(std::ostream& os) const
 }
 
 template <typename I>
-void TPluginHandler<I>::do_get_xml_help(CXMLElement *handlerRoot) const
+void TPluginHandler<I>::do_get_xml_help(CXMLElement& handlerRoot) const
 {
-	handlerRoot->set_child_text(m_help);
+	handlerRoot.set_child_text(m_help);
 	for (auto i = begin(); i != end(); ++i) {
-		auto* pluginRoot = handlerRoot->add_child("plugin");
+		auto pluginRoot = handlerRoot.add_child("plugin");
 		pluginRoot->set_attribute("name", i->first);
 		i->second->get_help_xml(*pluginRoot); 
 	}
diff --git a/mia/core/handler.hh b/mia/core/handler.hh
index 13f5f2e..ae9cf20 100644
--- a/mia/core/handler.hh
+++ b/mia/core/handler.hh
@@ -136,7 +136,7 @@ private:
 
 	virtual void do_print_short_help(std::ostream& os) const; 
 	virtual void do_print_help(std::ostream& os) const; 
-	virtual void do_get_xml_help(CXMLElement *root) const; 	
+	virtual void do_get_xml_help(CXMLElement& root) const; 	
 
 	static const char * const m_help; 
 
diff --git a/mia/core/handlerbase.cc b/mia/core/handlerbase.cc
index fb4b0d3..c2d6374 100644
--- a/mia/core/handlerbase.cc
+++ b/mia/core/handlerbase.cc
@@ -47,11 +47,11 @@ void CPluginHandlerBase::print_help(std::ostream& os) const
 	do_print_help(os); 
 }
 
-void CPluginHandlerBase::get_xml_help(CXMLElement *root) const
+void CPluginHandlerBase::get_xml_help(CXMLElement& root) const
 {
-	CXMLElement* handlerRoot = root->add_child("handler");
+	auto handlerRoot = root.add_child("handler");
 	handlerRoot->set_attribute("name", get_descriptor());
-	do_get_xml_help(handlerRoot); 
+	do_get_xml_help(*handlerRoot); 
 }
 
 const std::string& CPluginHandlerBase::get_descriptor() const
@@ -69,12 +69,12 @@ void CPluginHandlerBase::add_dependend_handlers(HandlerHelpMap& handler_map) con
 	do_add_dependend_handlers(handler_map);
 }
 
-void CPluginHandlerBase::get_string_help_description_xml(std::ostream& os, CXMLElement *parent) const
+void CPluginHandlerBase::get_string_help_description_xml(std::ostream& os, CXMLElement& parent) const
 {
 	auto type = get_handler_type_string_and_help(os); 
-	auto factory = parent->add_child(type.c_str());
+	auto factory = parent.add_child(type.c_str());
 	factory->set_attribute("name", get_descriptor());
-	parent->set_attribute("type", type);
+	parent.set_attribute("type", type);
 }
 
 std::string CPluginHandlerBase::get_handler_type_string_and_help(std::ostream& MIA_PARAM_UNUSED(os)) const
diff --git a/mia/core/handlerbase.hh b/mia/core/handlerbase.hh
index 1075aeb..9745633 100644
--- a/mia/core/handlerbase.hh
+++ b/mia/core/handlerbase.hh
@@ -92,7 +92,7 @@ class EXPORT_CORE CPluginHandlerBase  {
 	   Add the help for all plug-ins to the xml tree 
 	   \param root toot element the documentation is added to 
 	 */
-	void get_xml_help(CXMLElement *root) const; 
+	void get_xml_help(CXMLElement& root) const; 
 
 	/// \returns the plug-in handler descriptor
 	const std::string& get_descriptor() const; 
@@ -108,7 +108,7 @@ class EXPORT_CORE CPluginHandlerBase  {
 	   @param os stream to write additional descriptions to. 
 	   @param root the parent node the information is added to 
 	*/
-	void get_string_help_description_xml(std::ostream& os, CXMLElement *root) const; 
+	void get_string_help_description_xml(std::ostream& os, CXMLElement& root) const; 
 	
 	
 	/**
@@ -128,7 +128,7 @@ private:
 	
 	virtual void do_print_short_help(std::ostream& os) const = 0; 
 	virtual void do_print_help(std::ostream& os) const = 0; 
-	virtual void do_get_xml_help(CXMLElement *root) const = 0; 
+	virtual void do_get_xml_help(CXMLElement& root) const = 0; 
 	virtual void do_add_dependend_handlers(HandlerHelpMap& handler_map) const = 0;  
 	virtual std::string get_handler_type_string_and_help(std::ostream& os) const; 
 	virtual std::string do_get_handler_type_string() const; 
diff --git a/mia/core/nccsum.hh b/mia/core/nccsum.hh
index d7e6b3e..91bc562 100644
--- a/mia/core/nccsum.hh
+++ b/mia/core/nccsum.hh
@@ -64,7 +64,7 @@ class EXPORT_CORE NCCSums {
 public: 
 	NCCSums():m_sumab(0.0), m_n(0.0) {
                 double zero[2] = {0.0, 0.0}; 
-                m_sum = _mm_load_pd(zero); 
+                m_sum = _mm_loadu_pd(zero); 
                 m_sum2 = m_sum; 
         }
         
diff --git a/mia/core/optparam.cc b/mia/core/optparam.cc
index 312f038..95510cc 100644
--- a/mia/core/optparam.cc
+++ b/mia/core/optparam.cc
@@ -94,7 +94,7 @@ void CParamList::get_help_xml(CXMLElement& root)const
 	TRACE_FUNCTION; 
 	for( auto i = m_params.begin();i != m_params.end(); ++i ) {
 		cvdebug()<< "   param '" << i->first << "'\n"; 
-		CXMLElement *p = root.add_child("param"); 
+		auto p = root.add_child("param"); 
 		p->set_attribute("name", i->first); 
 		i->second->get_help_xml(*p); 
 	}
diff --git a/mia/core/parameter.cxx b/mia/core/parameter.cxx
index 83884a3..aff4b43 100644
--- a/mia/core/parameter.cxx
+++ b/mia/core/parameter.cxx
@@ -58,7 +58,7 @@ struct __dispatch_parameter_do_set {
 		if (std::numeric_limits<T>::is_integer && !std::numeric_limits<T>::is_signed) {
 			std::string::size_type startpos = str_value.find_first_not_of(" \t");
 			if (startpos  == std::string::npos) {
-				throw create_exception<std::invalid_argument>("Trying to set a paramater from an string "
+				throw create_exception<std::invalid_argument>("Trying to set a parameter from an string "
 									      "that is comprised of whitespaces only"); 
 			}
 			if (str_value[startpos] == '-') {
diff --git a/mia/core/parameter.hh b/mia/core/parameter.hh
index 286f944..2b81961 100644
--- a/mia/core/parameter.hh
+++ b/mia/core/parameter.hh
@@ -4,8 +4,7 @@
  * Copyright (c) Leipzig, Madrid 1999-2015 Gert Wollny
  *
  * MIA is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Pub
-lic License as published by
+ * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 3 of the License, or
  * (at your option) any later version.
  *
@@ -333,7 +332,7 @@ CParameter *make_oci_param(T& value, S1 lower_bound, S2 upper_bound,bool require
 
 /**
    \ingroup cmdline
-   \brief Dictionary paramater
+   \brief Dictionary parameter
 
    The (templated) parameter that takes its value froma restricted Dictionary.
    \tparam the enumerate that is used by the dictionary 
diff --git a/mia/core/test_pixeltype.cc b/mia/core/test_pixeltype.cc
index 9b946b5..d1f6243 100644
--- a/mia/core/test_pixeltype.cc
+++ b/mia/core/test_pixeltype.cc
@@ -37,7 +37,7 @@ BOOST_AUTO_TEST_CASE( test_pixeltype_translation )
 	BOOST_CHECK(CPixelTypeDict.get_name_set().size() == 12);
 	BOOST_CHECK(it_none == 11);
 #else
-	BOOST_CHECK(CPixelTypeDict.get_name_set().size() == 9);
+	BOOST_CHECK(CPixelTypeDict.get_name_set().size() == 10);
 	BOOST_CHECK(it_none == 9);
 #endif
 
diff --git a/mia/core/test_xmlinterface.cc b/mia/core/test_xmlinterface.cc
index 127eca1..e0197b6 100644
--- a/mia/core/test_xmlinterface.cc
+++ b/mia/core/test_xmlinterface.cc
@@ -30,13 +30,13 @@ BOOST_AUTO_TEST_CASE( test_nested_xml_doc_string )
         
         auto root_node = doc.create_root_node("root");
  
-        CXMLElement* child1 = root_node->add_child("child1");
+        auto child1 = root_node->add_child("child1");
         child1->set_attribute("attribute1", "1");
         child1->set_attribute("attribute2", "2");
 	child1->set_attribute("attribute2", "2");
         child1->set_child_text("Some <text>&");
 
-        CXMLElement* child2 = root_node->add_child("child2");
+        auto child2 = root_node->add_child("child2");
         child2->set_attribute("attribute21", "3");
         child2->set_attribute("attribute22", "4");
 
@@ -62,11 +62,11 @@ BOOST_AUTO_TEST_CASE( test_simple_xml_doc_string )
         
         auto root_node = doc.create_root_node("root");
  
-        CXMLElement* child1 = root_node->add_child("child1");
+        auto child1 = root_node->add_child("child1");
         child1->set_attribute("attribute1", "1");
         child1->set_attribute("attribute2", "2");
 
-        CXMLElement* child2 = child1->add_child("child2");
+        auto child2 = child1->add_child("child2");
         child2->set_attribute("attribute21", "3");
         child2->set_attribute("attribute22", "4");
 
diff --git a/mia/core/xmlinterface.cc b/mia/core/xmlinterface.cc
index 94ecc9f..48e53e3 100644
--- a/mia/core/xmlinterface.cc
+++ b/mia/core/xmlinterface.cc
@@ -29,12 +29,15 @@ NS_MIA_BEGIN
 
 using std::string;
 using std::stringstream; 
+using std::make_shared; 
+using std::vector; 
 
 struct CXMLElementImpl {
         CXMLElementImpl(const char *name);
         ~CXMLElementImpl();
         
         xmlNodePtr element;
+	vector<CXMLElement::Pointer> children; 
 }; 
 
 CXMLElementImpl::CXMLElementImpl(const char *name)
@@ -61,9 +64,10 @@ CXMLElement::~CXMLElement()
 }
 
 
-CXMLElement* CXMLElement::add_child(const char *name)
+CXMLElement::Pointer CXMLElement::add_child(const char *name)
 {
-        CXMLElement *result = new CXMLElement(name);
+        Pointer result = make_shared<CXMLElement>(name);
+	impl->children.push_back(result); 
         xmlAddChild(impl->element, result->impl->element); 
         return result; 
 }
@@ -120,9 +124,9 @@ CXMLDocument::~CXMLDocument()
 }
 
 	
-CXMLElement* CXMLDocument::create_root_node(const char *name)
+CXMLElement::Pointer CXMLDocument::create_root_node(const char *name)
 {
-        CXMLElement *result = new CXMLElement(name);
+        auto result = make_shared<CXMLElement>(name);
         xmlDocSetRootElement(impl->doc, result->impl->element);
         return result; 
 }
diff --git a/mia/core/xmlinterface.hh b/mia/core/xmlinterface.hh
index c8933d3..a3d9633 100644
--- a/mia/core/xmlinterface.hh
+++ b/mia/core/xmlinterface.hh
@@ -39,6 +39,8 @@ NS_MIA_BEGIN
 
 class EXPORT_CORE CXMLElement {
 public:
+	typedef std::shared_ptr<CXMLElement> Pointer; 
+
 	CXMLElement(const char *name);
 	~CXMLElement(); 
 	
@@ -46,8 +48,10 @@ public:
 	CXMLElement(const CXMLElement& orig) = delete;
 	CXMLElement& operator = (const CXMLElement& orig) = delete;
 
+
+
 	
-	CXMLElement* add_child(const char *name);
+	CXMLElement::Pointer add_child(const char *name);
 	void set_attribute(const char *name, const std::string& value);
 	void set_child_text(const std::string& value);
 private:
@@ -66,7 +70,7 @@ public:
 	CXMLDocument& operator = (const CXMLDocument& other) = delete;
 		
 	
-	CXMLElement* create_root_node(const char *);
+	CXMLElement::Pointer create_root_node(const char *);
 	std::string write_to_string_formatted() const;
 
 private:
diff --git a/mia/mesh/filter/addscale.cc b/mia/mesh/filter/addscale.cc
index f6809d1..cacd415 100644
--- a/mia/mesh/filter/addscale.cc
+++ b/mia/mesh/filter/addscale.cc
@@ -65,7 +65,7 @@ CAddScaleMeshFilterPlugin::CAddScaleMeshFilterPlugin():
 	CMeshFilterPlugin("addscale")
 {
 	add_parameter("img", make_param(m_image_filename, true, 
-					"3DImage that containes the scale values as a volume image."));
+					"3DImage that contains the scale values as a volume image."));
 }
 
 mia::CMeshFilter *CAddScaleMeshFilterPlugin::do_create()const
diff --git a/scripts/remove-small-blobs.sh b/scripts/remove-small-blobs.sh
new file mode 100644
index 0000000..0d625fb
--- /dev/null
+++ b/scripts/remove-small-blobs.sh
@@ -0,0 +1,61 @@
+#!/bin/bash 
+#
+#
+# This file is part of MIA - a toolbox for medical image analysis 
+# Copyright (c) Leipzig, Madrid 1999-2015 Gert Wollny
+#
+# MIA is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, see <http://www.gnu.org/licenses/>.
+#
+
+
+# $1 input path 
+# $2 output path
+# $3 temp path
+
+temp_dir=/tmp/remove-small-blobs/
+
+
+in_images="$1"
+out_images="$2"
+thresh=$3
+
+mkdir -p $temp_dir
+
+
+number_pattern=$(mia-filenumber-pattern "$1")
+
+# label the images 
+mia-2dstackfilter -i "$in_images" -t v -o "$temp_dir/labeled" "label:map=$temp_dir/labelmap.txt" 
+
+#relabel joined labels 
+mia-2dimagefilterstack -i "$temp_dir/labeled${number_pattern}.v" -o $temp_dir/relabeled -t v \
+                        "relabel:map=$temp_dir/labelmap.txt"
+
+# evaluate the histogram
+mia-multihist -i "$temp_dir/relabeled${number_pattern}.v" -o "$temp_dir/labelcount.txt"
+
+
+# this can be done with awk
+echo "MiaLabelmap" > "$temp_dir/labelbinarizationmap.txt"
+awk -v thresh=$thresh <"$temp_dir/labelcount.txt" >> "$temp_dir/labelbinarizationmap.txt" '{if ($2 > thresh){ print $1 " 1"}else{ print $1 " 0"} }'
+
+mia-create-labelbinarization -i "$temp_dir/labelcount.txt" -o "$temp_dir/labelbinarizationmap.txt" \
+                             --thresh ${min_blobsize}
+
+mia-2dimagefilterstack -i "$temp_dir/relabeled${number_pattern}.v" -o "$out_images" \
+                       "relabel:map=$temp_dir/labelbinarizationmap.txt" binarize:min=1
+
+rm -rf $temp_dir
+
+
diff --git a/src/2dstack-cmeans-presegment.cc b/src/2dstack-cmeans-presegment.cc
index de24823..3dd5122 100644
--- a/src/2dstack-cmeans-presegment.cc
+++ b/src/2dstack-cmeans-presegment.cc
@@ -223,6 +223,7 @@ void FGetFlowImages::add_flows(C2DFImage& flow, int label, const T2DImage<T>& im
 	auto ii = image.begin();
 	auto ie = image.end();
 
+	// here two signed-unsigned comparisong warnings are issued that should be silenced. 
 	while (ii != ie) {
 		if (*ii <= m_low_end)  {
 			if (m_low_label == label)
@@ -355,6 +356,12 @@ int do_main( int argc, char *argv[] )
 		ni += ii->second;
                 ++ii; 
         }
+
+	if (ii == chistogram.end()) {
+		// should be impossible but just be on the save side
+		throw create_exception<invalid_argument>("The provided histogram thresh ", histogram_thresh,
+							 " results in an empty histogram, select a lower value"); 
+	}
 	
 	size_t ne = 0; 
 	auto ie = chistogram.end() - 1;
@@ -382,10 +389,14 @@ int do_main( int argc, char *argv[] )
 			outstr << ipv.first << " " << ipv.second << "\n"; 
 		}
 	}
+
+	if (class_centers.size() > 65535) {
+		throw create_exception<runtime_error>("This code only allows 65535 classes, initializer created ",  class_centers.size()); 
+	}
 	
 	// created the labeled images
 	FGetFlowImages  get_flow_images(pmap, ii->first, 0, ie->first, class_centers.size(),
-					{class_centers.size()-1}, {1}, flow_prob_thresh, flow_scale);
+					{static_cast<int>(class_centers.size()-1)}, {1}, flow_prob_thresh, flow_scale);
 	
 	P2DFilter maxflow = produce_2dimage_filter("maxflow:sink-flow=sink.@,source-flow=source.@"); 
 	
diff --git a/src/fluid2d/CMakeLists.txt b/src/fluid2d/CMakeLists.txt
index e4962d8..99f345a 100644
--- a/src/fluid2d/CMakeLists.txt
+++ b/src/fluid2d/CMakeLists.txt
@@ -20,6 +20,7 @@ SET(fluid2d_SOURCES main.cc vfluid.cc elast.cc helpers.cc)
 
 ADD_EXECUTABLE(mia-2dfluid ${fluid2d_SOURCES})
 TARGET_LINK_LIBRARIES(mia-2dfluid mia2d)
+ADD_DEPENDENCIES(mia-2dfluid plugin_test_links)
 MIA_EXE_CREATE_DOCU_AND_INTERFACE(mia 2dfluid)
 
 INSTALL(TARGETS mia-2dfluid RUNTIME DESTINATION "bin")
diff --git a/src/fluid3d/CMakeLists.txt b/src/fluid3d/CMakeLists.txt
index cfee179..2b6487a 100644
--- a/src/fluid3d/CMakeLists.txt
+++ b/src/fluid3d/CMakeLists.txt
@@ -27,7 +27,7 @@ ADD_DEFINITIONS(-DVSTREAM_DOMAIN=\"fluid3d\")
 ADD_EXECUTABLE(mia-3dfluid ${fluid3d_SOURCES})
 TARGET_LINK_LIBRARIES(mia-3dfluid mia3d)
 INSTALL(TARGETS mia-3dfluid RUNTIME DESTINATION "bin")
-
+ADD_DEPENDENCIES(mia-3dfluid plugin_test_links)
 MIA_EXE_CREATE_DOCU_AND_INTERFACE(mia 3dfluid)
 
 
diff --git a/src/isosurface/CMakeLists.txt b/src/isosurface/CMakeLists.txt
index de416b2..1ed6682 100644
--- a/src/isosurface/CMakeLists.txt
+++ b/src/isosurface/CMakeLists.txt
@@ -38,11 +38,13 @@ IF(GTS_FOUND)
 
   # add the ISO-surface programs 
   ADD_EXECUTABLE(mia-3disosurface-from-volume iso.cc)
+  ADD_DEPENDENCIES(mia-3disosurface-from-volume plugin_test_links)
   MIA_EXE_CREATE_DOCU_AND_INTERFACE(mia 3disosurface-from-volume)
   TARGET_LINK_LIBRARIES(mia-3disosurface-from-volume miagts)
   INSTALL(TARGETS mia-3disosurface-from-volume RUNTIME DESTINATION "bin")
 
   ADD_EXECUTABLE(mia-3disosurface-from-stack iso_from_slices.cc)
+  ADD_DEPENDENCIES(mia-3disosurface-from-stack plugin_test_links)
   MIA_EXE_CREATE_DOCU_AND_INTERFACE(mia 3disosurface-from-stack)
   TARGET_LINK_LIBRARIES(mia-3disosurface-from-stack miagts)
   INSTALL(TARGETS mia-3disosurface-from-stack RUNTIME DESTINATION "bin")

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/mia.git



More information about the debian-med-commit mailing list