[med-svn] [mia] 01/05: Imported Upstream version 2.2.4

Gert Wollny gert-guest at moszumanska.debian.org
Mon Sep 7 15:48:00 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 d3f2d7685453463765099df50a6711d495060cfe
Author: Gert Wollny <gw.fossdev at gmail.com>
Date:   Mon Sep 7 00:36:57 2015 +0200

    Imported Upstream version 2.2.4
---
 AUTHORS                                            |  11 -
 CMakeLists.txt                                     |  38 +-
 ChangeLog                                          |  39 ++
 addons/CMakeLists.txt                              |   3 +-
 addons/dicom/CMakeLists.txt                        |   2 +-
 addons/dicom/dcm2d.cc                              |  12 +-
 addons/dicom/dcm2d.hh                              |   2 +-
 addons/dicom/dcm3d.cc                              |  23 +-
 addons/dicom/dcm3d.hh                              |   2 +-
 addons/dicom/dicom4mia.cc                          |   2 +-
 addons/dicom/dicom4mia.hh                          |   2 +-
 addons/dicom/getset.hh                             |   2 +-
 addons/dicom/test_dcm2d.cc                         |   2 +-
 addons/dicom/test_dcm3d.cc                         |   2 +-
 addons/dicom/test_dicom4mia.cc                     |   2 +-
 addons/hdf5/CMakeLists.txt                         |   2 +-
 addons/hdf5/hdf5_3dimage.cc                        |   2 +-
 addons/hdf5/hdf5_3dimage.hh                        |   2 +-
 addons/hdf5/hdf5a_mia.cc                           |   2 +-
 addons/hdf5/hdf5a_mia.hh                           |   2 +-
 addons/hdf5/hdf5mia.cc                             |   2 +-
 addons/hdf5/hdf5mia.hh                             |   2 +-
 addons/hdf5/test_hdf5_3dimage.cc                   |   2 +-
 addons/hdf5/test_hdf5mia.cc                        |   2 +-
 addons/jpg/CMakeLists.txt                          |   2 +-
 addons/jpg/jpeg-common.hh                          |   2 +-
 addons/jpg/jpg-gray.cc                             |   2 +-
 addons/jpg/jpg-rgb.cc                              |   2 +-
 addons/maxflow/2dmaxflow.cc                        | 192 ++++++++
 .../filter/mean.hh => addons/maxflow/2dmaxflow.hh  |  23 +-
 addons/maxflow/CMakeLists.txt                      |  38 ++
 addons/maxflow/test_2dmaxflow.cc                   | 133 +++++
 addons/nifti/CMakeLists.txt                        |   2 +-
 addons/nifti/niftiimage.cc                         |   2 +-
 addons/nifti/niftiimage.hh                         |   2 +-
 addons/nifti/test_niftiimage.cc                    |   2 +-
 addons/nlopt/CMakeLists.txt                        |   2 +-
 addons/nlopt/nlopt.cc                              |  37 +-
 addons/nlopt/nlopt.hh                              |   2 +-
 addons/nlopt/test_nlopt.cc                         |   2 +-
 addons/openexr/2dimgexr.cc                         |   2 +-
 addons/openexr/2dvfexr.cc                          |   2 +-
 addons/openexr/CMakeLists.txt                      |   2 +-
 addons/openexr/test_openexr.cc                     |   6 +-
 addons/png/CMakeLists.txt                          |   2 +-
 addons/png/png-gray.cc                             |   2 +-
 addons/png/png-rgb.cc                              |   2 +-
 addons/tiff/CMakeLists.txt                         |   2 +-
 addons/tiff/tiff.cc                                |   2 +-
 addons/vistaio/2dtrans.cc                          |   2 +-
 addons/vistaio/2dtrans.hh                          |   2 +-
 addons/vistaio/2dvfvistaio.cc                      |   4 +-
 addons/vistaio/2dvistaio.cc                        |   4 +-
 addons/vistaio/2dvistaio.hh                        |   2 +-
 addons/vistaio/3dtrans.cc                          |   2 +-
 addons/vistaio/3dtrans.hh                          |   2 +-
 addons/vistaio/3dvfvistaio.cc                      |   2 +-
 addons/vistaio/3dvistaio.cc                        |   2 +-
 addons/vistaio/3dvistaio.hh                        |   2 +-
 addons/vistaio/CMakeLists.txt                      |   2 +-
 addons/vistaio/test_2dtrans.cc                     |   5 +-
 addons/vistaio/test_2dvistaio.cc                   |   2 +-
 addons/vistaio/test_3dtrans.cc                     |   2 +-
 addons/vistaio/test_3dvistaio.cc                   |   2 +-
 addons/vistaio/test_vista4mia.cc                   |   2 +-
 addons/vistaio/vista4mia.cc                        |   2 +-
 addons/vistaio/vista4mia.hh                        |   2 +-
 addons/vistaio/vistamesh.cc                        |   2 +-
 addons/vtk/CMakeLists.txt                          |  10 +-
 addons/vtk/test_vtkimage.cc                        |   2 +-
 addons/vtk/test_vtkmesh.cc                         |   2 +-
 addons/vtk/test_vtkvf.cc                           |   2 +-
 addons/vtk/vtkimage.cc                             |   2 +-
 addons/vtk/vtkimage.hh                             |   2 +-
 addons/vtk/vtkmesh.cc                              |   2 +-
 addons/vtk/vtkmesh.hh                              |   2 +-
 addons/vtk/vtkvf.cc                                |   2 +-
 addons/vtk/vtkvf.hh                                |   2 +-
 cmake/CMakeLists.txt                               |   2 +-
 cmake/FindDCMTKnew.cmake                           |   2 +-
 cmake/FindFFTW.cmake                               |   2 +-
 cmake/FindOctave.cmake                             |   2 +-
 cmake/FindTBB.cmake                                |   2 +-
 cmake/checkAltivecEnabled.cmake                    |   2 +-
 cmake/checkComplex.cmake                           |   2 +-
 cmake/checkCpp0xAuto.cmake                         |   2 +-
 cmake/checkCpp0xLambda.cmake                       |   2 +-
 cmake/checkITPPBoolseparate.cmake                  |   2 +-
 cmake/checkSSEAttributeVectorCanUseSubscript.cmake |   2 +-
 cmake/checkSSEEnabled.cmake                        |   2 +-
 cmake/macros.cmake                                 |   2 +-
 cmake/package.cmake                                |   2 +-
 cmake/pluginmacro.cmake                            |   2 +-
 config.h.cmake                                     |   2 +
 doc/CMakeLists.txt                                 |   2 +-
 doc/MiaDoctools.cmake                              |   6 +-
 doc/miahelp.xsd                                    |   2 +-
 doc/miamyosegmentset.xsd                           |   2 +-
 doc/miareadxml.py                                  |  60 ++-
 doc/miaxml2man.py                                  |   6 +-
 doc/miaxml2nipype.py                               |   2 +-
 doc/miaxml2sgml.py                                 |   2 +-
 doc/reference.dox.cmake                            |   2 +
 examples/2d/CMakeLists.txt                         |   2 +-
 examples/2d/filter/CMakeLists.txt                  |   2 +-
 examples/2d/filter/simple.cc                       |   2 +-
 examples/2d/filter/simple.hh                       |   2 +-
 examples/2d/filter/test_simple.cc                  |   2 +-
 examples/CMakeLists.txt                            |   2 +-
 examples/mia                                       |   1 -
 gsl++/CMakeLists.txt                               |   2 +-
 gsl++/gsldefines.hh                                |   2 +-
 gsl++/matrix.cc                                    |   2 +-
 gsl++/matrix.hh                                    |   2 +-
 gsl++/multimin.cc                                  |   2 +-
 gsl++/multimin.hh                                  |   2 +-
 gsl++/test_matrix.cc                               |   2 +-
 gsl++/test_multimin.cc                             |   2 +-
 gsl++/test_vector.cc                               |   2 +-
 gsl++/vector.cc                                    |   2 +-
 gsl++/vector.hh                                    |   2 +-
 gsl++/vector_dispatch.hh                           |   2 +-
 gsl++/vector_template.cxx                          |   2 +-
 gsl++/vector_template.hh                           |   2 +-
 gsl++/wavelet.cc                                   |   2 +-
 gsl++/wavelet.hh                                   |   2 +-
 mia.hh                                             |   2 +-
 mia/2d.hh                                          |   2 +-
 mia/2d/CMakeLists.txt                              |   2 +-
 mia/2d/angle.cc                                    |   2 +-
 mia/2d/angle.hh                                    |   2 +-
 mia/2d/boundingbox.cc                              |   2 +-
 mia/2d/boundingbox.hh                              |   2 +-
 mia/2d/combiner/CMakeLists.txt                     |   2 +-
 mia/2d/combiner/ops.cc                             |   2 +-
 mia/2d/combiner/ops.hh                             |   2 +-
 mia/2d/combiner/plugin.hh                          |   2 +-
 mia/2d/combiner/test_ops.cc                        |   2 +-
 mia/2d/correlation_weight.cc                       |   2 +-
 mia/2d/correlation_weight.hh                       |   2 +-
 mia/2d/cost.cc                                     |   2 +-
 mia/2d/cost.hh                                     |   2 +-
 mia/2d/cost/CMakeLists.txt                         |   2 +-
 mia/2d/cost/gncc.cc                                | 177 +++++++
 mia/2d/cost/{ncc.hh => gncc.hh}                    |  27 +-
 mia/2d/cost/lncc.cc                                |   6 +-
 mia/2d/cost/lncc.hh                                |   2 +-
 mia/2d/cost/lsd.cc                                 |   2 +-
 mia/2d/cost/lsd.hh                                 |   2 +-
 mia/2d/cost/mi.cc                                  |   2 +-
 mia/2d/cost/mi.hh                                  |   2 +-
 mia/2d/cost/ncc.cc                                 |   2 +-
 mia/2d/cost/ncc.hh                                 |   2 +-
 mia/2d/cost/ngf.cc                                 |   2 +-
 mia/2d/cost/ngf.hh                                 |   2 +-
 mia/2d/cost/ssd-automask.cc                        |   2 +-
 mia/2d/cost/ssd-automask.hh                        |   2 +-
 mia/2d/cost/ssd.cc                                 |   2 +-
 mia/2d/cost/ssd.hh                                 |   2 +-
 mia/2d/cost/ssd2.cc                                |   2 +-
 mia/2d/cost/ssd2.hh                                |   2 +-
 mia/2d/cost/ssddf.cc                               |   2 +-
 mia/2d/cost/test_divcurl.cc                        |   2 +-
 mia/2d/cost/{test_ncc.cc => test_gncc.cc}          |  13 +-
 mia/2d/cost/test_lncc.cc                           |   2 +-
 mia/2d/cost/test_lsd.cc                            |   2 +-
 mia/2d/cost/test_mi.cc                             |   2 +-
 mia/2d/cost/test_ncc.cc                            |   2 +-
 mia/2d/cost/test_ngf.cc                            |   2 +-
 mia/2d/cost/test_ssd-automask.cc                   |   2 +-
 mia/2d/cost/test_ssd.cc                            |   2 +-
 mia/2d/cost/test_ssd2.cc                           |   2 +-
 mia/2d/creator.cc                                  |   2 +-
 mia/2d/creator.hh                                  |   2 +-
 mia/2d/creator/CMakeLists.txt                      |   2 +-
 mia/2d/creator/circle.cc                           |   6 +-
 mia/2d/cstkernel.cc                                |   2 +-
 mia/2d/cstkernel.hh                                |   2 +-
 mia/2d/datafield.cc                                |   8 +-
 mia/2d/datafield.cxx                               |   2 +-
 mia/2d/datafield.hh                                |   8 +-
 mia/2d/defines2d.hh                                |   2 +-
 mia/2d/deformer.hh                                 |   2 +-
 mia/2d/distance.cc                                 |   2 +-
 mia/2d/distance.hh                                 |   2 +-
 mia/2d/distances.cc                                |   2 +-
 mia/2d/fft/CMakeLists.txt                          |   4 +-
 mia/2d/fftkernel.cc                                |   2 +-
 mia/2d/fftkernel.hh                                |   2 +-
 mia/2d/filter.cc                                   |   2 +-
 mia/2d/filter.hh                                   |   2 +-
 mia/2d/filter/CMakeLists.txt                       |   2 +-
 mia/2d/filter/adaptmed.cc                          |   5 +-
 mia/2d/filter/adaptmed.hh                          |   2 +-
 mia/2d/filter/admean.cc                            |   5 +-
 mia/2d/filter/admean.hh                            |   2 +-
 mia/2d/filter/aniso.cc                             |  12 +-
 mia/2d/filter/aniso.hh                             |   2 +-
 mia/2d/filter/bandpass.cc                          |   2 +-
 mia/2d/filter/bandpass.hh                          |   2 +-
 mia/2d/filter/binarize.cc                          |   2 +-
 mia/2d/filter/binarize.hh                          |   2 +-
 mia/2d/filter/classmap.cc                          |   2 +-
 mia/2d/filter/combiner.cc                          |   2 +-
 mia/2d/filter/combiner.hh                          |   2 +-
 mia/2d/filter/convert.cc                           |   2 +-
 mia/2d/filter/convert.hh                           |   2 +-
 mia/2d/filter/crop.cc                              |   5 +-
 mia/2d/filter/crop.hh                              |   8 +-
 mia/2d/filter/cst.cc                               |   2 +-
 mia/2d/filter/cst.hh                               |   2 +-
 mia/2d/filter/distance.cc                          |   2 +-
 mia/2d/filter/distance.hh                          |   2 +-
 mia/2d/filter/downscale.cc                         |  10 +-
 mia/2d/filter/downscale.hh                         |   2 +-
 mia/2d/filter/fft.cc                               |   2 +-
 mia/2d/filter/fft.hh                               |   2 +-
 mia/2d/filter/frequency.cc                         |   2 +-
 mia/2d/filter/gradnorm.cc                          |   2 +-
 mia/2d/filter/gradnorm.hh                          |   2 +-
 mia/2d/filter/harmmean.cc                          |   2 +-
 mia/2d/filter/ianiso.cc                            |   2 +-
 mia/2d/filter/invert.cc                            |   2 +-
 mia/2d/filter/invert.hh                            |   2 +-
 mia/2d/filter/kmeans.cc                            |   5 +-
 mia/2d/filter/kmeans.hh                            |   2 +-
 mia/2d/filter/kuwahara.cc                          |   2 +-
 mia/2d/filter/label.cc                             |   2 +-
 mia/2d/filter/label.hh                             |   2 +-
 mia/2d/filter/labelmap.cc                          |  76 +--
 mia/2d/filter/labelmap.hh                          |  31 +-
 mia/2d/filter/labelscale.cc                        |   2 +-
 mia/2d/filter/labelscale.hh                        |   2 +-
 mia/2d/filter/lnfft.cc                             |   2 +-
 mia/2d/filter/load.cc                              |   2 +-
 mia/2d/filter/load.hh                              |   2 +-
 mia/2d/filter/mask.cc                              |   2 +-
 mia/2d/filter/mask.hh                              |   2 +-
 mia/2d/filter/mean.cc                              |   4 +-
 mia/2d/filter/mean.hh                              |   2 +-
 mia/2d/filter/median.cc                            |   8 +-
 mia/2d/filter/median.hh                            |   2 +-
 mia/2d/filter/midpoint.cc                          |   2 +-
 mia/2d/filter/mlv.cc                               |   4 +-
 mia/2d/filter/mlv.hh                               |   2 +-
 mia/2d/filter/morphological.cc                     |   2 +-
 mia/2d/filter/morphological.hh                     |   2 +-
 mia/2d/filter/ngfnorm.cc                           |   2 +-
 mia/2d/filter/ngfnorm.hh                           |   2 +-
 mia/2d/filter/noise.cc                             |   2 +-
 mia/2d/filter/noise.hh                             |   2 +-
 mia/2d/filter/regiongrow.cc                        |   2 +-
 mia/2d/filter/regiongrow.hh                        |   2 +-
 mia/2d/filter/rgg.cc                               |   2 +-
 mia/2d/filter/scale.cc                             |   8 +-
 mia/2d/filter/scale.hh                             |   2 +-
 mia/2d/filter/seededwatershed.cc                   |   2 +-
 mia/2d/filter/seededwatershed.hh                   |   2 +-
 mia/2d/filter/selectbig.cc                         |   2 +-
 mia/2d/filter/selectbig.hh                         |   2 +-
 mia/2d/filter/sepconv.cc                           |  44 +-
 mia/2d/filter/sepconv.hh                           |  20 +-
 mia/2d/filter/shaped_mean.cc                       |   2 +-
 mia/2d/filter/shaped_mean.hh                       |   2 +-
 mia/2d/filter/sortlabel.cc                         |   2 +-
 mia/2d/filter/sortlabel.hh                         |   2 +-
 mia/2d/filter/tee.cc                               |   2 +-
 mia/2d/filter/tee.hh                               |   2 +-
 mia/2d/filter/test_adaptmed.cc                     |   2 +-
 mia/2d/filter/test_admean.cc                       |   2 +-
 mia/2d/filter/test_aniso.cc                        |   2 +-
 mia/2d/filter/test_bandpass.cc                     |   2 +-
 mia/2d/filter/test_binarize.cc                     |   2 +-
 mia/2d/filter/test_combiner.cc                     |   2 +-
 mia/2d/filter/test_convert.cc                      |   2 +-
 mia/2d/filter/test_crop.cc                         |   3 +-
 mia/2d/filter/test_cst.cc                          |   2 +-
 mia/2d/filter/test_distance.cc                     |   2 +-
 mia/2d/filter/test_downscale.cc                    |   2 +-
 mia/2d/filter/test_fft.cc                          |   2 +-
 mia/2d/filter/test_gradnorm.cc                     |   2 +-
 mia/2d/filter/test_invert.cc                       |   2 +-
 mia/2d/filter/test_kmeans.cc                       |   2 +-
 mia/2d/filter/test_label.cc                        |   6 +-
 mia/2d/filter/test_labelmap.cc                     |   3 +-
 mia/2d/filter/test_labelscale.cc                   |   2 +-
 mia/2d/filter/test_load.cc                         |   2 +-
 mia/2d/filter/test_mask.cc                         |   2 +-
 mia/2d/filter/test_mean.cc                         |   2 +-
 mia/2d/filter/test_median.cc                       |   2 +-
 mia/2d/filter/test_mlv.cc                          |   2 +-
 mia/2d/filter/test_morphological.cc                |   2 +-
 mia/2d/filter/test_ngfnorm.cc                      |   2 +-
 mia/2d/filter/test_noise.cc                        |   2 +-
 mia/2d/filter/test_regiongrow.cc                   |   2 +-
 mia/2d/filter/test_scale.cc                        |   2 +-
 mia/2d/filter/test_seededwatershed.cc              |   2 +-
 mia/2d/filter/test_selectbig.cc                    |   2 +-
 mia/2d/filter/test_sepconv.cc                      |  74 ++-
 mia/2d/filter/test_shaped_mean.cc                  |   2 +-
 mia/2d/filter/test_sortlabel.cc                    |   2 +-
 mia/2d/filter/test_tee.cc                          |   2 +-
 mia/2d/filter/test_thinning.cc                     |   2 +-
 mia/2d/filter/test_thresh.cc                       |   2 +-
 mia/2d/filter/test_transform.cc                    |   2 +-
 mia/2d/filter/test_watershed.cc                    |   2 +-
 mia/2d/filter/thinning.cc                          |  10 +-
 mia/2d/filter/thinning.hh                          |   2 +-
 mia/2d/filter/thresh.cc                            |   8 +-
 mia/2d/filter/thresh.hh                            |   2 +-
 mia/2d/filter/transform.cc                         |   2 +-
 mia/2d/filter/transform.hh                         |   2 +-
 mia/2d/filter/variation.cc                         |   2 +-
 mia/2d/filter/watershed.cc                         |   2 +-
 mia/2d/filter/watershed.hh                         |   2 +-
 mia/2d/filter/wmean.cc                             |   2 +-
 mia/2d/filter/ws.cc                                |   2 +-
 mia/2d/filterchain.cc                              |   2 +-
 mia/2d/filterchain.hh                              |   2 +-
 mia/2d/filtertest.cc                               |  12 +-
 mia/2d/filtertest.hh                               |   2 +-
 mia/2d/fullcost.cc                                 |   2 +-
 mia/2d/fullcost.hh                                 |   2 +-
 mia/2d/fullcost/CMakeLists.txt                     |   2 +-
 mia/2d/fullcost/image.cc                           |   2 +-
 mia/2d/fullcost/image.hh                           |   2 +-
 mia/2d/fullcost/label.cc                           |  10 +-
 mia/2d/fullcost/label.hh                           |   2 +-
 mia/2d/fullcost/maskedimage.cc                     |   2 +-
 mia/2d/fullcost/maskedimage.hh                     |   2 +-
 mia/2d/fullcost/test_image.cc                      |   2 +-
 mia/2d/fullcost/test_label.cc                      |   4 +-
 mia/2d/fullcost/test_maskedimage.cc                |   2 +-
 mia/2d/fuzzyclustersolver_cg.cc                    |   2 +-
 mia/2d/fuzzyclustersolver_cg.hh                    |   2 +-
 mia/2d/fuzzyclustersolver_sor.cc                   |   2 +-
 mia/2d/fuzzyclustersolver_sor.hh                   |   2 +-
 mia/2d/fuzzyseg.cc                                 |   2 +-
 mia/2d/fuzzyseg.hh                                 |   2 +-
 mia/2d/ground_truth_evaluator.cc                   |   2 +-
 mia/2d/ground_truth_evaluator.hh                   |   2 +-
 mia/2d/groundtruthproblem.cc                       |   2 +-
 mia/2d/groundtruthproblem.hh                       |   2 +-
 mia/2d/ica.cc                                      |   2 +-
 mia/2d/ica.hh                                      |   2 +-
 mia/2d/image.cc                                    |  24 +-
 mia/2d/image.hh                                    |  41 +-
 mia/2d/imageio.cc                                  |   2 +-
 mia/2d/imageio.hh                                  |   2 +-
 mia/2d/imageiotest.cc                              |   2 +-
 mia/2d/imageiotest.hh                              |   2 +-
 mia/2d/imagetest.cc                                |   2 +-
 mia/2d/imagetest.hh                                |   2 +-
 mia/2d/interpolator.cc                             |   2 +-
 mia/2d/interpolator.cxx                            |   2 +-
 mia/2d/interpolator.hh                             |   2 +-
 mia/2d/io/CMakeLists.txt                           |   2 +-
 mia/2d/io/bmp.cc                                   |   2 +-
 mia/2d/io/raw.cc                                   |   2 +-
 mia/2d/io/test_xml.cc                              |   2 +-
 mia/2d/io/xml.cc                                   |   2 +-
 mia/2d/io/xml.hh                                   |   2 +-
 mia/2d/iterator.cxx                                |   2 +-
 mia/2d/iterator.hh                                 |   2 +-
 mia/2d/kernel/CMakeLists.txt                       |   2 +-
 mia/2d/kernel/curv.cc                              |   2 +-
 mia/2d/maskedcost.cc                               |   2 +-
 mia/2d/maskedcost.hh                               |   2 +-
 mia/2d/maskedcost/CMakeLists.txt                   |   2 +-
 mia/2d/maskedcost/lncc.cc                          |   6 +-
 mia/2d/maskedcost/lncc.hh                          |   2 +-
 mia/2d/maskedcost/mi.cc                            |   2 +-
 mia/2d/maskedcost/mi.hh                            |   2 +-
 mia/2d/maskedcost/ncc.cc                           |   2 +-
 mia/2d/maskedcost/ncc.hh                           |   2 +-
 mia/2d/maskedcost/ssd.cc                           |   2 +-
 mia/2d/maskedcost/ssd.hh                           |   2 +-
 mia/2d/maskedcost/test_lncc.cc                     |   2 +-
 mia/2d/maskedcost/test_mi.cc                       |   2 +-
 mia/2d/maskedcost/test_ncc.cc                      |   2 +-
 mia/2d/maskedcost/test_ssd.cc                      |   2 +-
 mia/2d/matrix.hh                                   |   2 +-
 mia/2d/model.cc                                    |   2 +-
 mia/2d/model.hh                                    |   2 +-
 mia/2d/model/CMakeLists.txt                        |   2 +-
 mia/2d/model/identity.cc                           |   2 +-
 mia/2d/model/identity.hh                           |   2 +-
 mia/2d/model/navier.cc                             |  18 +-
 mia/2d/model/navier.hh                             |   2 +-
 mia/2d/model/naviera.cc                            |  17 +-
 mia/2d/model/naviera.hh                            |   2 +-
 mia/2d/model/test_identity.cc                      |   2 +-
 mia/2d/model/test_navier.cc                        |   2 +-
 mia/2d/model/test_naviera.cc                       |   2 +-
 mia/2d/modelsolverreg.cc                           |   2 +-
 mia/2d/modelsolverreg.hh                           |   2 +-
 mia/2d/morphshape.cc                               |   2 +-
 mia/2d/morphshape.hh                               |   2 +-
 mia/2d/multicost.cc                                |   2 +-
 mia/2d/multicost.hh                                |   2 +-
 mia/2d/nfg.cc                                      |   2 +-
 mia/2d/nfg.hh                                      |   2 +-
 mia/2d/nonrigidregister.cc                         |   2 +-
 mia/2d/nonrigidregister.hh                         |   2 +-
 mia/2d/perfusion.cc                                |   2 +-
 mia/2d/perfusion.hh                                |   2 +-
 mia/2d/polygon.cc                                  |   2 +-
 mia/2d/polygon.hh                                  |   2 +-
 mia/2d/ppmatrix.cc                                 |  12 +-
 mia/2d/ppmatrix.hh                                 |   2 +-
 mia/2d/register.cc                                 |   2 +-
 mia/2d/register.hh                                 |   2 +-
 mia/2d/rgbimageio.cc                               |   2 +-
 mia/2d/rgbimageio.hh                               |   2 +-
 mia/2d/rgbio/CMakeLists.txt                        |   2 +-
 mia/2d/rgbio/bmp.cc                                |   2 +-
 mia/2d/rigidregister.cc                            |   2 +-
 mia/2d/rigidregister.hh                            |   2 +-
 mia/2d/segframe.cc                                 |  30 +-
 mia/2d/segframe.hh                                 |   2 +-
 mia/2d/segpoint.cc                                 |   2 +-
 mia/2d/segpoint.hh                                 |  29 +-
 mia/2d/segsection.cc                               |   4 +-
 mia/2d/segsection.hh                               |   2 +-
 mia/2d/segset.cc                                   |   2 +-
 mia/2d/segset.hh                                   |   2 +-
 mia/2d/segsetwithimages.cc                         |   2 +-
 mia/2d/segsetwithimages.hh                         |   2 +-
 mia/2d/segstar.cc                                  |   2 +-
 mia/2d/segstar.hh                                  |   2 +-
 mia/2d/shape.cc                                    |   2 +-
 mia/2d/shape.hh                                    |   2 +-
 mia/2d/shapes/CMakeLists.txt                       |   2 +-
 mia/2d/shapes/basic_shapes.cc                      |   2 +-
 mia/2d/shapes/basic_shapes.hh                      |   2 +-
 mia/2d/shapes/rect.cc                              |   8 +-
 mia/2d/shapes/rect.hh                              |   2 +-
 mia/2d/shapes/sphere.cc                            |   4 +-
 mia/2d/shapes/sphere.hh                            |   2 +-
 mia/2d/shapes/test_basic_shapes.cc                 |   2 +-
 mia/2d/shapes/test_rect.cc                         |   2 +-
 mia/2d/shapes/test_sphere.cc                       |   2 +-
 mia/2d/similarity_profile.cc                       |   2 +-
 mia/2d/similarity_profile.hh                       |   2 +-
 mia/2d/sparse_image_solver.cc                      |   2 +-
 mia/2d/sparse_image_solver.hh                      |   2 +-
 mia/2d/splinepenalty/CMakeLists.txt                |   2 +-
 mia/2d/splinepenalty/divcurl.cc                    |   8 +-
 mia/2d/splinepenalty/divcurl.hh                    |   2 +-
 mia/2d/splinepenalty/test_divcurl.cc               |   2 +-
 mia/2d/splinetransformpenalty.cc                   |   8 +-
 mia/2d/splinetransformpenalty.hh                   |   2 +-
 mia/2d/test_2d.cc                                  |   2 +-
 mia/2d/test_angle.cc                               |   2 +-
 mia/2d/test_boundingbox.cc                         |   2 +-
 mia/2d/test_combiner.cc                            |   6 +-
 mia/2d/test_correlation_weight.cc                  |   5 +-
 mia/2d/test_cost.cc                                |   2 +-
 mia/2d/test_datafield.cc                           |   2 +-
 mia/2d/test_distance.cc                            |   2 +-
 mia/2d/test_divcurlmatrix.cc                       |   2 +-
 mia/2d/test_filter.cc                              |  13 +-
 mia/2d/test_filter_cast.cc                         |   2 +-
 mia/2d/test_fullcost.cc                            |  14 +-
 mia/2d/test_fullcost_mi_spline.cc                  |   2 +-
 mia/2d/test_groundtruthproblem.cc                  |   2 +-
 mia/2d/test_ica.cc                                 |   2 +-
 mia/2d/test_image.cc                               |   2 +-
 mia/2d/test_imagecostbase.cc                       |   2 +-
 mia/2d/test_imageio.cc                             |   2 +-
 mia/2d/test_interpol.cc                            |   2 +-
 mia/2d/test_iterator.cc                            |   2 +-
 mia/2d/test_matrix.cc                              |   2 +-
 mia/2d/test_modelsolverreg.cc                      |   2 +-
 mia/2d/test_morphshape.cc                          |   2 +-
 mia/2d/test_nfg.cc                                 |   2 +-
 mia/2d/test_nonrigidregister.cc                    |   2 +-
 mia/2d/test_oldnewintegrate.cc                     |   2 +-
 mia/2d/test_param.cc                               |   2 +-
 mia/2d/test_perfusion.cc                           |   2 +-
 mia/2d/test_polygon.cc                             |   2 +-
 mia/2d/test_ppmatrix.cc                            |   2 +-
 mia/2d/test_register.cc                            |   2 +-
 mia/2d/test_regplugins.cc                          |   2 +-
 mia/2d/test_rigidregister.cc                       |   2 +-
 mia/2d/test_segframe.cc                            |   2 +-
 mia/2d/test_segmentation.cc                        |   2 +-
 mia/2d/test_segpoint.cc                            |   2 +-
 mia/2d/test_shape.cc                               |   2 +-
 mia/2d/test_similarity_profile.cc                  |   2 +-
 mia/2d/test_sparse_image_solver.cc                 |   2 +-
 mia/2d/test_splinetransformpenalty.cc              |   2 +-
 mia/2d/test_trackpoint.cc                          |   2 +-
 mia/2d/test_transform.cc                           |   6 +-
 mia/2d/test_transformfactory.cc                    |   2 +-
 mia/2d/test_transio.cc                             |   2 +-
 mia/2d/test_vector.cc                              |   2 +-
 mia/2d/test_vectorfield_interpolator.cc            |   2 +-
 mia/2d/test_vfio.cc                                |   2 +-
 mia/2d/timestep.cc                                 |  13 +-
 mia/2d/timestep.hh                                 |   3 +-
 mia/2d/timestep/CMakeLists.txt                     |   2 +-
 mia/2d/timestep/direct.cc                          |   2 +-
 mia/2d/timestep/direct.hh                          |   2 +-
 mia/2d/timestep/fluid.cc                           |   2 +-
 mia/2d/timestep/fluid.hh                           |   2 +-
 mia/2d/timestep/test_direct.cc                     |   2 +-
 mia/2d/timestep/test_fluid.cc                      |   2 +-
 mia/2d/trackpoint.cc                               |   2 +-
 mia/2d/trackpoint.hh                               |   2 +-
 mia/2d/trait.hh                                    |   2 +-
 mia/2d/transform.cc                                |   2 +-
 mia/2d/transform.hh                                |   2 +-
 mia/2d/transform/CMakeLists.txt                    |   2 +-
 mia/2d/transform/affine.cc                         |   2 +-
 mia/2d/transform/affine.hh                         |   2 +-
 mia/2d/transform/rigid.cc                          |   2 +-
 mia/2d/transform/rigid.hh                          |   2 +-
 mia/2d/transform/rotation.cc                       |   2 +-
 mia/2d/transform/rotation.hh                       |   2 +-
 mia/2d/transform/spline.cc                         |   6 +-
 mia/2d/transform/spline.hh                         |   2 +-
 mia/2d/transform/test_affine.cc                    |   2 +-
 mia/2d/transform/test_nonlinear.cc                 |   2 +-
 mia/2d/transform/test_rigid.cc                     |   2 +-
 mia/2d/transform/test_rotation.cc                  |   2 +-
 mia/2d/transform/test_spline.cc                    |   2 +-
 mia/2d/transform/test_translate.cc                 |   2 +-
 mia/2d/transform/test_vectorfield.cc               |   2 +-
 mia/2d/transform/translate.cc                      |   2 +-
 mia/2d/transform/translate.hh                      |   2 +-
 mia/2d/transform/vectorfield.cc                    |   2 +-
 mia/2d/transform/vectorfield.hh                    |   2 +-
 mia/2d/transformfactory.cc                         |   2 +-
 mia/2d/transformfactory.hh                         |   2 +-
 mia/2d/transformio.cc                              |   6 +-
 mia/2d/transformio.hh                              |   2 +-
 mia/2d/transformmock.cc                            |   2 +-
 mia/2d/transformmock.hh                            |   2 +-
 mia/2d/transio/CMakeLists.txt                      |   2 +-
 mia/2d/transio/bbs.cc                              |   2 +-
 mia/2d/transio/pbs.cc                              |   2 +-
 mia/2d/transio/serialization.hh                    |   2 +-
 mia/2d/transio/xml.cc                              |   2 +-
 mia/2d/vector.hh                                   |   2 +-
 mia/2d/vectorfield.cc                              |   2 +-
 mia/2d/vectorfield.hh                              |   2 +-
 mia/2d/vfio.cc                                     |   2 +-
 mia/2d/vfio.hh                                     |   2 +-
 mia/2d/vfiotest.cc                                 |   2 +-
 mia/3d.hh                                          |   2 +-
 mia/3d/2dimagefifofilter.cc                        |   2 +-
 mia/3d/2dimagefifofilter.hh                        |   2 +-
 mia/3d/CMakeLists.txt                              |   5 +-
 mia/3d/affine_matrix.cc                            |   2 +-
 mia/3d/affine_matrix.hh                            |   2 +-
 mia/3d/camera.cc                                   |   2 +-
 mia/3d/camera.hh                                   |   2 +-
 mia/3d/combiner/CMakeLists.txt                     |   2 +-
 mia/3d/combiner/labelxmap.cc                       |   2 +-
 mia/3d/combiner/labelxmap.hh                       |   2 +-
 mia/3d/combiner/ops.cc                             |   4 +-
 mia/3d/combiner/ops.hh                             |   2 +-
 mia/3d/combiner/plugin.hh                          |   2 +-
 mia/3d/combiner/test_labelxmap.cc                  |   2 +-
 mia/3d/combiner/test_ops.cc                        |   2 +-
 mia/3d/cost.cc                                     |   2 +-
 mia/3d/cost.hh                                     |   2 +-
 mia/3d/cost/CMakeLists.txt                         |   2 +-
 mia/3d/cost/lncc.cc                                |   6 +-
 mia/3d/cost/lncc.hh                                |   2 +-
 mia/3d/cost/mi.cc                                  |   2 +-
 mia/3d/cost/mi.hh                                  |   2 +-
 mia/3d/cost/ncc.cc                                 |   2 +-
 mia/3d/cost/ncc.hh                                 |   2 +-
 mia/3d/cost/ngf.cc                                 |   2 +-
 mia/3d/cost/ngf.hh                                 |   2 +-
 mia/3d/cost/ssd-automask.cc                        |   2 +-
 mia/3d/cost/ssd-automask.hh                        |   2 +-
 mia/3d/cost/ssd.cc                                 |   2 +-
 mia/3d/cost/ssd.hh                                 |   2 +-
 mia/3d/cost/test_lncc.cc                           |   2 +-
 mia/3d/cost/test_mi.cc                             |   2 +-
 mia/3d/cost/test_ncc.cc                            |   2 +-
 mia/3d/cost/test_ngf.cc                            |   2 +-
 mia/3d/cost/test_ssd-automask.cc                   |   2 +-
 mia/3d/cost/test_ssd.cc                            |   2 +-
 mia/3d/cost/test_ssdautomask.cc                    |   2 +-
 mia/3d/creator.cc                                  |   2 +-
 mia/3d/creator.hh                                  |   2 +-
 mia/3d/creator/CMakeLists.txt                      |   2 +-
 mia/3d/creator/lattic.cc                           |   8 +-
 mia/3d/creator/lattic.hh                           |   2 +-
 mia/3d/creator/sphere.cc                           |   6 +-
 mia/3d/creator/sphere.hh                           |   2 +-
 mia/3d/creator/test_lattic.cc                      |   2 +-
 mia/3d/creator/test_sphere.cc                      |   2 +-
 mia/3d/critical_point.cc                           |   2 +-
 mia/3d/critical_point.hh                           |   2 +-
 mia/3d/datafield.cc                                |  33 +-
 mia/3d/datafield.cxx                               |  83 +++-
 mia/3d/datafield.hh                                | 122 ++++-
 mia/3d/defines3d.hh                                |   2 +-
 mia/3d/deformer.hh                                 |   2 +-
 mia/3d/distance.cc                                 |   2 +-
 mia/3d/distance.hh                                 |   2 +-
 mia/3d/fifof/CMakeLists.txt                        |   2 +-
 mia/3d/fifof/byslice.cc                            |   2 +-
 mia/3d/fifof/byslice.hh                            |   2 +-
 mia/3d/fifof/gauss.cc                              |   5 +-
 mia/3d/fifof/gauss.hh                              |   2 +-
 mia/3d/fifof/label.cc                              |   2 +-
 mia/3d/fifof/label.hh                              |   2 +-
 mia/3d/fifof/median.cc                             |   5 +-
 mia/3d/fifof/median.hh                             |   2 +-
 mia/3d/fifof/mlv.cc                                |   5 +-
 mia/3d/fifof/mlv.hh                                |   2 +-
 mia/3d/fifof/morphological.cc                      |   2 +-
 mia/3d/fifof/morphological.hh                      |   2 +-
 mia/3d/fifof/regiongrow.cc                         |  12 +-
 mia/3d/fifof/regiongrow.hh                         |   2 +-
 mia/3d/fifof/rgg.cc                                |   2 +-
 mia/3d/fifof/rgg2pass.cc                           |   2 +-
 mia/3d/fifof/test_byslice.cc                       |   2 +-
 mia/3d/fifof/test_gauss.cc                         |   2 +-
 mia/3d/fifof/test_label.cc                         |   2 +-
 mia/3d/fifof/test_median.cc                        |   2 +-
 mia/3d/fifof/test_mlv.cc                           |   2 +-
 mia/3d/fifof/test_morphological.cc                 |   5 +-
 mia/3d/fifof/test_regiongrow.cc                    |   5 +-
 mia/3d/fifotestfixture.cc                          |   2 +-
 mia/3d/fifotestfixture.hh                          |   2 +-
 mia/3d/filter.cc                                   |   2 +-
 mia/3d/filter.hh                                   |   2 +-
 mia/3d/filter/CMakeLists.txt                       |   5 +-
 mia/3d/filter/aniso.cc                             |   2 +-
 mia/3d/filter/bandpass.cc                          |   2 +-
 mia/3d/filter/bandpass.hh                          |   2 +-
 mia/3d/filter/binarize.cc                          |   2 +-
 mia/3d/filter/binarize.hh                          |   2 +-
 mia/3d/filter/combiner.cc                          |   2 +-
 mia/3d/filter/combiner.hh                          |   2 +-
 mia/3d/filter/convert.cc                           |   2 +-
 mia/3d/filter/convert.hh                           |   2 +-
 mia/3d/filter/crop.cc                              |   5 +-
 mia/3d/filter/crop.hh                              |   2 +-
 mia/3d/filter/distance.cc                          |  67 ++-
 mia/3d/filter/distance.hh                          |   2 +-
 mia/3d/filter/downscale.cc                         |  14 +-
 mia/3d/filter/downscale.hh                         |   2 +-
 mia/3d/filter/gradnorm.cc                          |   2 +-
 mia/3d/filter/gradnorm.hh                          |   2 +-
 mia/3d/filter/growmask.cc                          |   6 +-
 mia/3d/filter/growmask.hh                          |   2 +-
 mia/3d/filter/invert.cc                            |   2 +-
 mia/3d/filter/invert.hh                            |   2 +-
 mia/3d/filter/kmeans.cc                            |   5 +-
 mia/3d/filter/kmeans.hh                            |   2 +-
 mia/3d/filter/label.cc                             |   2 +-
 mia/3d/filter/label.hh                             |   2 +-
 mia/3d/filter/{combiner.cc => labelmap.cc}         |  19 +-
 mia/3d/{nonrigidregister.cc => filter/labelmap.hh} |  14 +-
 mia/3d/filter/labelscale.cc                        |   2 +-
 mia/3d/filter/labelscale.hh                        |   2 +-
 mia/3d/filter/load.cc                              |   2 +-
 mia/3d/filter/load.hh                              |   2 +-
 mia/3d/filter/lvdownscale.cc                       |   2 +-
 mia/3d/filter/lvdownscale.hh                       |   2 +-
 mia/3d/filter/mask.cc                              |   2 +-
 mia/3d/filter/mask.hh                              |   2 +-
 mia/3d/filter/mean.cc                              |   6 +-
 mia/3d/filter/mean.hh                              |   2 +-
 mia/3d/filter/median.cc                            |   8 +-
 mia/3d/filter/median.hh                            |   2 +-
 mia/3d/filter/mlv.cc                               |   4 +-
 mia/3d/filter/mlv.hh                               |   2 +-
 mia/3d/filter/morphological.cc                     |   2 +-
 mia/3d/filter/morphological.hh                     |   2 +-
 mia/3d/filter/msnormalizer.cc                      |   4 +-
 mia/3d/filter/msnormalizer.hh                      |   2 +-
 mia/3d/filter/reorient.cc                          | 222 ++++++---
 mia/3d/filter/reorient.hh                          |  20 +-
 mia/3d/filter/resize.cc                            |   2 +-
 mia/3d/filter/resize.hh                            |   2 +-
 mia/3d/filter/scale.cc                             |  26 +-
 mia/3d/filter/scale.hh                             |   2 +-
 mia/3d/filter/seededwatershed.cc                   |   2 +-
 mia/3d/filter/seededwatershed.hh                   |   2 +-
 mia/3d/filter/selectbig.cc                         |   2 +-
 mia/3d/filter/selectbig.hh                         |   2 +-
 mia/3d/filter/sepconv.cc                           |   4 +-
 mia/3d/filter/sepconv.hh                           |   2 +-
 mia/3d/filter/tee.cc                               |   2 +-
 mia/3d/filter/tee.hh                               |   2 +-
 mia/3d/filter/test_bandpass.cc                     |   2 +-
 mia/3d/filter/test_binarize.cc                     |   2 +-
 mia/3d/filter/test_combiner.cc                     |   2 +-
 mia/3d/filter/test_convert.cc                      |   2 +-
 mia/3d/filter/test_crop.cc                         |   4 +-
 mia/3d/filter/test_distance.cc                     |   6 +-
 mia/3d/filter/test_downscale.cc                    |   2 +-
 mia/3d/filter/test_gradnorm.cc                     |   2 +-
 mia/3d/filter/test_growmask.cc                     |   2 +-
 mia/3d/filter/test_invert.cc                       |   2 +-
 mia/3d/filter/test_kmeans.cc                       |   2 +-
 mia/3d/filter/test_label.cc                        |   2 +-
 mia/{2d => 3d}/filter/test_labelmap.cc             |  29 +-
 mia/3d/filter/test_labelscale.cc                   |   2 +-
 mia/3d/filter/test_load.cc                         |   2 +-
 mia/3d/filter/test_lvdownscale.cc                  |   2 +-
 mia/3d/filter/test_mask.cc                         |   2 +-
 mia/3d/filter/test_mean.cc                         |   2 +-
 mia/3d/filter/test_median.cc                       |   2 +-
 mia/3d/filter/test_mlv.cc                          |   2 +-
 mia/3d/filter/test_morphological.cc                |   9 +-
 mia/3d/filter/test_msnormalizer.cc                 |   2 +-
 mia/3d/filter/test_reorient.cc                     |  19 +-
 mia/3d/filter/test_resize.cc                       |   2 +-
 mia/3d/filter/test_scale.cc                        |   2 +-
 mia/3d/filter/test_seededwatershed.cc              |   2 +-
 mia/3d/filter/test_selectbig.cc                    |   2 +-
 mia/3d/filter/test_sepconv.cc                      |   2 +-
 mia/3d/filter/test_tee.cc                          |   2 +-
 mia/3d/filter/test_thinning.cc                     |   2 +-
 mia/3d/filter/test_transform.cc                    |   2 +-
 mia/3d/filter/test_watershed.cc                    |   2 +-
 mia/3d/filter/thinning.cc                          |   2 +-
 mia/3d/filter/thinning.hh                          |   2 +-
 mia/3d/filter/transform.cc                         |   2 +-
 mia/3d/filter/transform.hh                         |   2 +-
 mia/3d/filter/watershed.cc                         |   2 +-
 mia/3d/filter/watershed.hh                         |   2 +-
 mia/3d/fullcost.cc                                 |   2 +-
 mia/3d/fullcost.hh                                 |   2 +-
 mia/3d/fullcost/CMakeLists.txt                     |   2 +-
 mia/3d/fullcost/image.cc                           |   2 +-
 mia/3d/fullcost/image.hh                           |   2 +-
 mia/3d/fullcost/label.cc                           |   4 +-
 mia/3d/fullcost/label.hh                           |   2 +-
 mia/3d/fullcost/maskedimage.cc                     |   2 +-
 mia/3d/fullcost/maskedimage.hh                     |   2 +-
 mia/3d/fullcost/taggedssd.cc                       |   2 +-
 mia/3d/fullcost/taggedssd.hh                       |   2 +-
 mia/3d/fullcost/test_image.cc                      |  12 +-
 mia/3d/fullcost/test_label.cc                      |   2 +-
 mia/3d/fullcost/test_maskedimage.cc                |   2 +-
 mia/3d/fullcost/test_taggedssd.cc                  |   2 +-
 mia/3d/fuzzyclustersolver_cg.cc                    |   2 +-
 mia/3d/fuzzyclustersolver_cg.hh                    |   2 +-
 mia/3d/fuzzyseg.cc                                 |   2 +-
 mia/3d/fuzzyseg.hh                                 |   2 +-
 mia/3d/ica.cc                                      |   2 +-
 mia/3d/ica.hh                                      |   2 +-
 mia/3d/image.cc                                    |   2 +-
 mia/3d/image.hh                                    |   2 +-
 mia/3d/imagecollect.cc                             |   8 +-
 mia/3d/imagecollect.hh                             |   2 +-
 mia/3d/imagedraw.cc                                | 356 ++++++++++++++
 mia/3d/imagedraw.cxx                               |  60 +++
 mia/3d/imagedraw.hh                                | 132 +++++
 mia/3d/imageio.cc                                  |   2 +-
 mia/3d/imageio.hh                                  |   2 +-
 mia/3d/imageiotest.cc                              |   2 +-
 mia/3d/imageiotest.hh                              |   2 +-
 mia/3d/imagetest.cc                                |   2 +-
 mia/3d/imagetest.hh                                |   2 +-
 mia/3d/interpolator.cc                             |   2 +-
 mia/3d/interpolator.cxx                            |   2 +-
 mia/3d/interpolator.hh                             |   2 +-
 mia/3d/io/CMakeLists.txt                           |   2 +-
 mia/3d/io/analyze.cc                               |   2 +-
 mia/3d/io/analyze.hh                               |   2 +-
 mia/3d/io/inria.cc                                 |   2 +-
 mia/3d/io/vff.cc                                   |   2 +-
 mia/3d/iterator.cxx                                |   2 +-
 mia/3d/iterator.hh                                 |   6 +-
 mia/3d/landmark.cc                                 |   4 +-
 mia/3d/landmark.hh                                 |   8 +-
 mia/3d/landmarklist.cc                             |   4 +-
 mia/3d/landmarklist.hh                             |   8 +-
 mia/3d/landmarklistio.cc                           |   2 +-
 mia/3d/landmarklistio.hh                           |   2 +-
 mia/3d/linear_transform.cc                         |   2 +-
 mia/3d/linear_transform.hh                         |   2 +-
 mia/3d/lmio/CMakeLists.txt                         |   2 +-
 mia/3d/lmio/lmx.cc                                 |   6 +-
 mia/3d/maskedcost.cc                               |   2 +-
 mia/3d/maskedcost.hh                               |   2 +-
 mia/3d/maskedcost/CMakeLists.txt                   |   2 +-
 mia/3d/maskedcost/lncc.cc                          |   6 +-
 mia/3d/maskedcost/lncc.hh                          |   2 +-
 mia/3d/maskedcost/mi.cc                            |   2 +-
 mia/3d/maskedcost/mi.hh                            |   2 +-
 mia/3d/maskedcost/ncc.cc                           |   2 +-
 mia/3d/maskedcost/ncc.hh                           |   2 +-
 mia/3d/maskedcost/ssd.cc                           |   2 +-
 mia/3d/maskedcost/ssd.hh                           |   2 +-
 mia/3d/maskedcost/test_lncc.cc                     |   2 +-
 mia/3d/maskedcost/test_mi.cc                       |   2 +-
 mia/3d/maskedcost/test_ncc.cc                      |   2 +-
 mia/3d/maskedcost/test_ssd.cc                      |   2 +-
 mia/3d/matrix.cc                                   | 205 ++++----
 mia/3d/matrix.hh                                   |  34 +-
 mia/3d/model.cc                                    |   2 +-
 mia/3d/model.hh                                    |   2 +-
 mia/3d/multicost.cc                                |   2 +-
 mia/3d/multicost.hh                                |   2 +-
 mia/3d/multireg.cc                                 |   2 +-
 mia/3d/multireg.hh                                 |   2 +-
 mia/3d/nfg.cc                                      |   2 +-
 mia/3d/nfg.hh                                      |   2 +-
 mia/3d/nonrigidregister.cc                         |   2 +-
 mia/3d/nonrigidregister.hh                         |   2 +-
 mia/3d/orientation.cc                              |   6 +-
 mia/3d/orientation.hh                              |   2 +-
 mia/3d/ppmatrix.cc                                 |  14 +-
 mia/3d/ppmatrix.hh                                 |   2 +-
 mia/3d/quaternion.cc                               |   2 +-
 mia/3d/quaternion.hh                               |   2 +-
 mia/3d/reg3d/CMakeLists.txt                        |   2 +-
 mia/3d/reg3d/direct.cc                             |   2 +-
 mia/3d/reg3d/fluid.cc                              |   2 +-
 mia/3d/reg3d/navier.cc                             |  17 +-
 mia/3d/reg3d/naviera.cc                            |  44 +-
 mia/3d/reg3d/navierasse.cc                         |  30 +-
 mia/3d/reg3d/navierpsse.cc                         |  31 +-
 mia/3d/register.cc                                 |   2 +-
 mia/3d/register.hh                                 |   2 +-
 mia/3d/rigidregister.cc                            |   2 +-
 mia/3d/rigidregister.hh                            |   2 +-
 mia/3d/rot.cc                                      |   4 +-
 mia/3d/rot.hh                                      |   2 +-
 mia/3d/shape.cc                                    |   4 +-
 mia/3d/shape.hh                                    |   2 +-
 mia/3d/shapes/CMakeLists.txt                       |   2 +-
 mia/3d/shapes/basic_shapes.cc                      |   2 +-
 mia/3d/shapes/sphere.cc                            |   4 +-
 mia/3d/shapes/sphere.hh                            |   2 +-
 mia/3d/similarity_profile.cc                       |   2 +-
 mia/3d/similarity_profile.hh                       |   2 +-
 mia/3d/splinepenalty/CMakeLists.txt                |   2 +-
 mia/3d/splinepenalty/divcurl.cc                    |   8 +-
 mia/3d/splinepenalty/divcurl.hh                    |   2 +-
 mia/3d/splinepenalty/test_divcurl.cc               |   2 +-
 mia/3d/splinetransformpenalty.cc                   |   8 +-
 mia/3d/splinetransformpenalty.hh                   |   2 +-
 mia/3d/stackdisttrans.cc                           |   2 +-
 mia/3d/stackdisttrans.hh                           |   2 +-
 mia/3d/test_2dimagefifofilter.cc                   |  10 +-
 mia/3d/test_3d.cc                                  |   2 +-
 mia/3d/test_affine_matrix.cc                       |   2 +-
 mia/3d/test_combiner.cc                            |   2 +-
 mia/3d/test_cost.cc                                |   2 +-
 mia/3d/test_datafield.cc                           |  61 ++-
 mia/3d/test_deform.cc                              |   2 +-
 mia/3d/test_distance.cc                            |   2 +-
 mia/3d/test_fullcost.cc                            |  14 +-
 mia/3d/test_ica.cc                                 |   2 +-
 mia/3d/test_image.cc                               |   2 +-
 mia/3d/test_imagecollect.cc                        |   2 +-
 mia/3d/test_imagedraw.cc                           | 546 +++++++++++++++++++++
 mia/3d/test_interpol.cc                            |   2 +-
 mia/3d/test_iterator.cc                            |   2 +-
 mia/3d/test_landmark.cc                            |   2 +-
 mia/3d/test_landmarklistio.cc                      |   2 +-
 mia/3d/test_matrix.cc                              |   2 +-
 mia/3d/test_nfg.cc                                 |   2 +-
 mia/3d/test_nonrigidregister.cc                    |   2 +-
 mia/3d/test_orientation.cc                         |   2 +-
 mia/3d/test_ppmatrix.cc                            |   2 +-
 mia/3d/test_quaternion.cc                          |   2 +-
 mia/3d/test_regplugins.cc                          |   2 +-
 mia/3d/test_rigidregister.cc                       |   2 +-
 mia/3d/test_rot.cc                                 |   2 +-
 mia/3d/test_shape.cc                               |   2 +-
 mia/3d/test_similarity_profile.cc                  |   2 +-
 mia/3d/test_splinetransformpenalty.cc              |   2 +-
 mia/3d/test_stackdisttrans.cc                      |   2 +-
 mia/3d/test_trackpoint.cc                          |   2 +-
 mia/3d/test_transform.cc                           |   2 +-
 mia/3d/test_transformfactory.cc                    |   6 +-
 mia/3d/test_transio.cc                             |  10 +-
 mia/3d/test_vector.cc                              |   2 +-
 mia/3d/test_vectorfield.cc                         |   2 +-
 mia/3d/test_vfio.cc                                |   2 +-
 mia/3d/timestep.cc                                 |   8 +-
 mia/3d/timestep.hh                                 |   2 +-
 mia/3d/trackpoint.cc                               |   2 +-
 mia/3d/trackpoint.hh                               |   2 +-
 mia/3d/trait.hh                                    |   2 +-
 mia/3d/transform.cc                                |   2 +-
 mia/3d/transform.hh                                |   2 +-
 mia/3d/transform/CMakeLists.txt                    |   2 +-
 mia/3d/transform/affine.cc                         |   2 +-
 mia/3d/transform/affine.hh                         |   2 +-
 mia/3d/transform/axisrot.cc                        |   2 +-
 mia/3d/transform/axisrot.hh                        |   2 +-
 mia/3d/transform/raffine.cc                        |   2 +-
 mia/3d/transform/raffine.hh                        |   2 +-
 mia/3d/transform/rigid.cc                          |   2 +-
 mia/3d/transform/rigid.hh                          |   2 +-
 mia/3d/transform/rotation.cc                       |   2 +-
 mia/3d/transform/rotation.hh                       |   2 +-
 mia/3d/transform/rotbend.cc                        |   8 +-
 mia/3d/transform/rotbend.hh                        |   4 +-
 mia/3d/transform/spline.cc                         |   6 +-
 mia/3d/transform/spline.hh                         |   2 +-
 mia/3d/transform/test_affine.cc                    |   2 +-
 mia/3d/transform/test_axisrot.cc                   |   2 +-
 mia/3d/transform/test_nonlinear.cc                 |   2 +-
 mia/3d/transform/test_raffine.cc                   |   2 +-
 mia/3d/transform/test_rigid.cc                     |   2 +-
 mia/3d/transform/test_rotation.cc                  |   2 +-
 mia/3d/transform/test_rotbend.cc                   |   2 +-
 mia/3d/transform/test_spline.cc                    |   2 +-
 mia/3d/transform/test_translate.cc                 |   2 +-
 mia/3d/transform/test_vectorfield.cc               |   2 +-
 mia/3d/transform/translate.cc                      |   2 +-
 mia/3d/transform/translate.hh                      |   2 +-
 mia/3d/transform/vectorfield.cc                    |   5 +-
 mia/3d/transform/vectorfield.hh                    |   2 +-
 mia/3d/transformfactory.cc                         |   2 +-
 mia/3d/transformfactory.hh                         |   2 +-
 mia/3d/transformio.cc                              |   6 +-
 mia/3d/transformio.hh                              |   2 +-
 mia/3d/transformmock.cc                            |   2 +-
 mia/3d/transformmock.hh                            |   2 +-
 mia/3d/transio/CMakeLists.txt                      |   2 +-
 mia/3d/transio/bbs.cc                              |   2 +-
 mia/3d/transio/serialization.hh                    |   2 +-
 mia/3d/transio/xml.cc                              |   2 +-
 mia/3d/valueattributetranslator.hh                 |   2 +-
 mia/3d/vector.hh                                   |   2 +-
 mia/3d/vectorfield.cc                              |   7 +-
 mia/3d/vectorfield.hh                              |  32 +-
 mia/3d/vfio.cc                                     |   2 +-
 mia/3d/vfio.hh                                     |   2 +-
 mia/3d/vfiotest.cc                                 |   2 +-
 mia/3d/vfiotest.hh                                 |   2 +-
 mia/3d/vfregularizer/test_sor.cc                   | 109 ++++
 mia/CMakeLists.txt                                 |   2 +-
 mia/core.hh                                        |   2 +-
 mia/core/CMakeLists.txt                            |  17 +-
 mia/core/attribute_names.cc                        |   2 +-
 mia/core/attribute_names.hh                        |   2 +-
 mia/core/attributes.cc                             |   7 +-
 mia/core/{slopevector.hh => attributes.cxx}        |  31 +-
 mia/core/attributes.hh                             |  19 +-
 mia/core/attributetype.hh                          |   2 +-
 mia/core/bfsv23dispatch.hh                         |  59 ---
 mia/core/boundary_conditions.cc                    |   2 +-
 mia/core/boundary_conditions.hh                    |   2 +-
 mia/core/callback.cc                               |   2 +-
 mia/core/callback.hh                               |   2 +-
 mia/core/cmdbooloption.cc                          |   4 +-
 mia/core/cmdbooloption.hh                          |   4 +-
 mia/core/cmdlineparser.cc                          |  43 +-
 mia/core/cmdlineparser.hh                          |  23 +-
 mia/core/cmdoption.cc                              |   8 +-
 mia/core/cmdoption.hh                              |  10 +-
 mia/core/cmdoptionflags.hh                         |  27 +-
 mia/core/cmdstringoption.cc                        |   4 +-
 mia/core/cmdstringoption.hh                        |   4 +-
 mia/core/cmdtranslateroption.cc                    |  86 ++++
 mia/core/cmdtranslateroption.hh                    |  81 +++
 mia/core/cmeans.cc                                 | 382 ++++++++++++++
 mia/core/cmeans.hh                                 | 137 ++++++
 mia/core/{splinebc => cmeansinit}/CMakeLists.txt   |   6 +-
 mia/core/cmeansinit/kmeans.cc                      | 176 +++++++
 .../imagecollect.hh => core/cmeansinit/kmeans.hh}  |  39 +-
 mia/core/cmeansinit/static.cc                      |  99 ++++
 mia/core/cmeansinit/static.hh                      |  70 +++
 mia/core/cmeansinit/test_kmeans.cc                 |  88 ++++
 mia/core/cmeansinit/test_static.cc                 |  60 +++
 mia/core/combiner.cc                               |   2 +-
 mia/core/combiner.hh                               |   2 +-
 mia/core/cost.cc                                   |   2 +-
 mia/core/cost.cxx                                  |   2 +-
 mia/core/cost.hh                                   |   2 +-
 mia/core/creator.cc                                |   2 +-
 mia/core/creator.hh                                |   2 +-
 mia/core/cstplan.hh                                |   2 +-
 mia/core/datapool.cc                               |   2 +-
 mia/core/datapool.hh                               |   2 +-
 mia/core/defines.hh                                |   2 +-
 mia/core/delayedparameter.hh                       |   2 +-
 mia/core/dictmap.hh                                |   2 +-
 mia/core/distance.cc                               |   2 +-
 mia/core/distance.hh                               |   2 +-
 mia/core/dlloader.cc                               |  32 +-
 mia/core/dlloader.hh                               |   7 +-
 mia/core/dummyhandler.cc                           |   2 +-
 mia/core/dummyhandler.hh                           |   2 +-
 mia/core/errormacro.hh                             |   2 +-
 mia/core/export_handler.hh                         |   2 +-
 mia/core/factory.hh                                |   2 +-
 mia/core/factory_trait.hh                          |   3 +-
 mia/core/fft1d_r2c.cc                              |   2 +-
 mia/core/fft1d_r2c.hh                              |   2 +-
 mia/core/fftslopeclassifier.cc                     |   2 +-
 mia/core/fftslopeclassifier.hh                     |   2 +-
 mia/core/fifofilter.cxx                            |   2 +-
 mia/core/fifofilter.hh                             |   2 +-
 mia/core/file.cc                                   | 175 ++++++-
 mia/core/file.hh                                   |   2 +-
 mia/core/filetools.cc                              |   9 +-
 mia/core/filetools.hh                              |   2 +-
 mia/core/filter.cc                                 |   2 +-
 mia/core/filter.hh                                 |   2 +-
 mia/core/fixedwidthoutput.cc                       |   4 +-
 mia/core/fixedwidthoutput.hh                       |   2 +-
 mia/core/flags.hh                                  |  59 +++
 mia/core/flagstring.cc                             |   2 +-
 mia/core/flagstring.hh                             |   2 +-
 mia/core/fullstats.cc                              |   2 +-
 mia/core/fullstats.hh                              |   2 +-
 mia/core/handler.cxx                               | 214 ++++----
 mia/core/handler.hh                                |  36 +-
 mia/core/handlerbase.cc                            |  17 +-
 mia/core/handlerbase.hh                            |  16 +-
 mia/core/histogram.hh                              |   2 +-
 mia/core/history.cc                                |   2 +-
 mia/core/history.hh                                |   2 +-
 mia/core/ica.cc                                    |   2 +-
 mia/core/ica.hh                                    |   2 +-
 mia/core/ica_template.cxx                          |   2 +-
 mia/core/ica_template.hh                           |   2 +-
 mia/core/import_handler.hh                         |   2 +-
 mia/core/index.cc                                  |   2 +-
 mia/core/index.hh                                  |   2 +-
 mia/core/info.cc                                   |   4 +-
 mia/core/interpolator1d.cc                         |   2 +-
 mia/core/interpolator1d.cxx                        |   2 +-
 mia/core/interpolator1d.hh                         |   2 +-
 mia/core/iodata.cc                                 |   2 +-
 mia/core/iodata.hh                                 |   2 +-
 mia/core/iohandler.cxx                             |  13 +-
 mia/core/iohandler.hh                              |   4 +-
 mia/core/ioplugin.cc                               |   2 +-
 mia/core/ioplugin.cxx                              |   4 +-
 mia/core/ioplugin.hh                               |   4 +-
 mia/core/kmeans.cc                                 |   2 +-
 mia/core/kmeans.hh                                 |   2 +-
 mia/core/labelmap.cc                               |   2 +-
 mia/core/labelmap.hh                               |   2 +-
 mia/core/meanvar.hh                                |   2 +-
 mia/core/minimizer.cc                              |   2 +-
 mia/core/minimizer.hh                              |   2 +-
 mia/core/minimizer/CMakeLists.txt                  |   2 +-
 mia/core/minimizer/gdas.cc                         |  23 +-
 mia/core/minimizer/gdas.hh                         |   2 +-
 mia/core/minimizer/gdsq.cc                         |  26 +-
 mia/core/minimizer/gdsq.hh                         |   2 +-
 mia/core/minimizer/gsl.cc                          |  24 +-
 mia/core/minimizer/gsl.hh                          |   6 +-
 mia/core/minimizer/test_gdas.cc                    |   2 +-
 mia/core/minimizer/test_gdsq.cc                    |   2 +-
 mia/core/minimizer/test_gsl.cc                     |   2 +-
 mia/core/mitestimages.cc                           |   2 +-
 mia/core/mitestimages.hh                           |   2 +-
 mia/core/module.cc                                 |  12 +-
 mia/core/module.hh                                 |   8 +-
 mia/core/msgstream.cc                              |   2 +-
 mia/core/msgstream.hh                              |   2 +-
 mia/core/nccsum.cc                                 |   2 +-
 mia/core/nccsum.hh                                 |   2 +-
 mia/core/noise/CMakeLists.txt                      |   2 +-
 mia/core/noise/gauss.cc                            |  19 +-
 mia/core/noise/gauss.hh                            |   2 +-
 mia/core/noise/test_gauss.cc                       |   2 +-
 mia/core/noise/test_uniform.cc                     |   2 +-
 mia/core/noise/uniform.cc                          |  16 +-
 mia/core/noise/uniform.hh                          |   2 +-
 mia/core/noisegen.cc                               |   2 +-
 mia/core/noisegen.hh                               |   2 +-
 mia/core/optionparser.cc                           |   2 +-
 mia/core/optionparser.hh                           |   2 +-
 mia/core/optparam.cc                               |   6 +-
 mia/core/optparam.hh                               |   6 +-
 mia/core/parameter.cc                              | 152 +++++-
 mia/core/parameter.cxx                             |  58 +--
 mia/core/parameter.hh                              | 188 +++++--
 mia/core/paramoption.cc                            |   4 +-
 mia/core/paramoption.hh                            |   4 +-
 mia/core/paramtranslator.cc                        | 107 ++++
 mia/core/paramtranslator.hh                        |  92 ++++
 mia/core/pixeltype.cc                              |   3 +-
 mia/core/pixeltype.hh                              |   2 +-
 mia/core/plugin_base.cc                            |  86 +---
 mia/core/plugin_base.cxx                           |  13 +-
 mia/core/plugin_base.hh                            |  81 +--
 mia/core/plugin_test.cc                            |   2 +-
 mia/core/probmap.cc                                |   2 +-
 mia/core/probmap.hh                                |   2 +-
 mia/core/product_base.cc                           |   2 +-
 mia/core/product_base.hh                           |   2 +-
 mia/core/productcache.cc                           |   2 +-
 mia/core/productcache.hh                           |   2 +-
 mia/core/property_flags.cc                         |   2 +-
 mia/core/property_flags.hh                         |   2 +-
 mia/core/pwh.cc                                    |   2 +-
 mia/core/pwh.hh                                    |   2 +-
 mia/core/refholder.hh                              |   2 +-
 mia/core/regmodel.cc                               |   2 +-
 mia/core/regmodel.hh                               |   2 +-
 mia/core/revision.cc                               |   2 +-
 mia/core/scaler1d.cc                               |   2 +-
 mia/core/scaler1d.hh                               |   2 +-
 mia/core/searchpath.cc                             | 170 +++++++
 mia/core/{flagstring.hh => searchpath.hh}          |  46 +-
 mia/core/selftestcmdoption.cc                      |   2 +-
 mia/core/selftestcmdoption.hh                      |   2 +-
 mia/core/seriesstats.cc                            |   2 +-
 mia/core/seriesstats.hh                            |   4 +-
 mia/core/shape.cc                                  |   2 +-
 mia/core/shape.cxx                                 |   2 +-
 mia/core/shape.hh                                  |   2 +-
 mia/core/simpson.hh                                |   2 +-
 mia/core/singular_refobj.hh                        |   2 +-
 mia/core/slopeclassifier.cc                        |   2 +-
 mia/core/slopeclassifier.hh                        |   2 +-
 mia/core/slopestatistics.cc                        |   2 +-
 mia/core/slopestatistics.hh                        |   2 +-
 mia/core/slopevector.hh                            |   2 +-
 mia/core/spacial_kernel.cc                         |   4 +-
 mia/core/spacial_kernel.hh                         |   6 +-
 mia/core/spacialkernel/CMakeLists.txt              |   6 +-
 mia/core/spacialkernel/cdiff.cc                    |  64 +++
 mia/core/spacialkernel/{gauss.hh => cdiff.hh}      |  28 +-
 mia/core/spacialkernel/gauss.cc                    |   7 +-
 mia/core/spacialkernel/gauss.hh                    |   6 +-
 .../test_gauss.cc => spacialkernel/test_cdiff.cc}  |  55 +--
 mia/core/spacialkernel/test_gauss.cc               |   2 +-
 mia/core/sparse_solver.hh                          |   2 +-
 mia/core/splinebc/CMakeLists.txt                   |   2 +-
 mia/core/splinebc/bc.cc                            |   2 +-
 mia/core/splinebc/bc.hh                            |   2 +-
 mia/core/splinebc/test_bc.cc                       |   2 +-
 mia/core/splinekernel.cc                           |   2 +-
 mia/core/splinekernel.hh                           |   2 +-
 mia/core/splinekernel/CMakeLists.txt               |   2 +-
 mia/core/splinekernel/bspline.cc                   |  10 +-
 mia/core/splinekernel/bspline.hh                   |   2 +-
 mia/core/splinekernel/test_bspline.cc              |   2 +-
 mia/core/splineparzenmi.cc                         |   2 +-
 mia/core/splineparzenmi.hh                         |   2 +-
 mia/core/sqmin.cc                                  |   2 +-
 mia/core/sqmin.hh                                  |   2 +-
 mia/core/statistics.hh                             |   2 +-
 mia/core/streamredir.cc                            |   2 +-
 mia/core/streamredir.hh                            |   2 +-
 mia/core/svector.hh                                |   2 +-
 mia/core/test_Vector.cc                            |   2 +-
 mia/core/test_attributes.cc                        |   2 +-
 mia/core/test_boundary_conditions.cc               |   2 +-
 mia/core/test_callback.cc                          |   2 +-
 mia/core/test_cmdlineparser.cc                     |  21 +-
 mia/core/test_cmdoptionflags.cc                    |   2 +-
 mia/core/test_cmdtranslatoroption.cc               |  97 ++++
 mia/core/test_cmeans.cc                            | 214 ++++++++
 mia/core/test_core.cc                              |   2 +-
 mia/core/test_cost.cc                              |   2 +-
 mia/core/test_cstplan.cc                           |   2 +-
 mia/core/test_datapool.cc                          |   2 +-
 mia/core/test_delayedparameter.cc                  |   2 +-
 mia/core/test_dictmap.cc                           |   2 +-
 mia/core/test_distance.cc                          |   2 +-
 mia/core/test_factoryoption.cc                     |   4 +-
 mia/core/test_fft1d.cc                             |   2 +-
 mia/core/test_fftslopeclassifier.cc                |   2 +-
 mia/core/test_fifofilter.cc                        |   2 +-
 mia/core/test_filetools.cc                         |   2 +-
 mia/core/test_filter.cc                            |   2 +-
 mia/core/test_fixedwidthoutput.cc                  |   2 +-
 mia/core/test_flagstring.cc                        |   2 +-
 mia/core/test_fullstats.cc                         |   2 +-
 mia/core/test_handler.cc                           |  78 ++-
 mia/core/test_helpers.hh                           |   2 +-
 mia/core/test_histogram.cc                         |   2 +-
 mia/core/test_history.cc                           |   2 +-
 mia/core/test_ica.cc                               |   2 +-
 mia/core/test_index.cc                             |   2 +-
 mia/core/test_interpol.cc                          |   2 +-
 mia/core/test_interpolator1d.cc                    |   2 +-
 mia/core/test_iohandler.cc                         |   7 +-
 mia/core/test_kernels.cc                           |   2 +-
 mia/core/test_kmeans.cc                            |   2 +-
 mia/core/test_labelmap.cc                          |   2 +-
 mia/core/test_meanvar.cc                           |   2 +-
 mia/core/test_minimizer.cc                         |   2 +-
 mia/core/test_nccsum.cc                            |   2 +-
 mia/core/test_noisegen.cc                          |   2 +-
 mia/core/test_optionparser.cc                      |   2 +-
 mia/core/test_optparam.cc                          |  20 +-
 mia/core/test_parameter.cc                         | 144 ++++--
 mia/core/test_parseroutput.cc                      |   2 +-
 mia/core/test_pixeltype.cc                         |   5 +-
 mia/core/test_probmap.cc                           |   2 +-
 mia/core/test_productcache.cc                      |   2 +-
 mia/core/test_property_flags.cc                    |   2 +-
 mia/core/test_pwh.cc                               |   2 +-
 mia/core/test_register.cc                          |   2 +-
 mia/core/test_scaler1d.cc                          |   2 +-
 mia/core/test_seriesstats.cc                       |   2 +-
 mia/core/test_shape.cc                             |   2 +-
 mia/core/test_simpson.cc                           |   2 +-
 mia/core/test_singular_refobj.cc                   |   2 +-
 mia/core/test_slopeclassifier.cc                   |   2 +-
 mia/core/test_slopestatistics.cc                   |   2 +-
 mia/core/test_sparse_solver.cc                     |   2 +-
 mia/core/test_splinekernel.cc                      |   2 +-
 mia/core/test_splineparzenmi.cc                    |   4 +-
 mia/core/test_sqmin.cc                             |   2 +-
 mia/core/test_statistics.cc                        |   2 +-
 mia/core/test_streamredir.cc                       |   2 +-
 mia/core/test_streamvector.cc                      |   2 +-
 mia/core/test_threadedmsg.cc                       |   2 +-
 mia/core/test_tools.cc                             |   2 +-
 mia/core/test_utils.cc                             |   2 +-
 mia/core/test_watch.cc                             |   2 +-
 mia/core/test_waveletslopeclassifier.cc            |   2 +-
 mia/core/test_xmlinterface.cc                      |  88 ++++
 mia/core/testplug/CMakeLists.txt                   |   2 +-
 mia/core/testplug/dummy1.cc                        |   9 +-
 mia/core/testplug/dummy2.cc                        |  11 +-
 mia/core/testplug/lala.cc                          |   2 +-
 mia/core/testplug/lolo.cc                          |   2 +-
 mia/core/testplugin.cc                             |   2 +-
 mia/core/testplugin.hh                             |   2 +-
 mia/core/threadedmsg.cc                            |   2 +-
 mia/core/threadedmsg.hh                            |   2 +-
 mia/core/tools.hh                                  |   2 +-
 mia/core/traits.hh                                 |   2 +-
 mia/core/transformation.hh                         |   2 +-
 mia/core/type_traits.hh                            |   2 +-
 mia/core/typedescr.cc                              |   2 +-
 mia/core/typedescr.hh                              |   2 +-
 mia/core/utils.cc                                  |   2 +-
 mia/core/utils.hh                                  |   2 +-
 mia/core/vector.hh                                 |   2 +-
 mia/core/watch.cc                                  |   2 +-
 mia/core/watch.hh                                  |   2 +-
 mia/core/waveletslopeclassifier.cc                 |  13 +-
 mia/core/waveletslopeclassifier.hh                 |   4 +-
 mia/core/xmlinterface.cc                           | 146 ++++++
 mia/core/xmlinterface.hh                           |  79 +++
 mia/internal/autotest.hh                           |   2 +-
 mia/internal/main.hh                               |  12 +-
 mia/internal/pluginsettest.hh                      |   2 +-
 mia/internal/plugintester.hh                       |   2 +-
 mia/mesh.hh                                        |   2 +-
 mia/mesh/CMakeLists.txt                            |   7 +-
 mia/mesh/clist.hh                                  |   2 +-
 mia/mesh/filter.cc                                 |   2 +-
 mia/mesh/filter.hh                                 |   2 +-
 mia/mesh/filter/CMakeLists.txt                     |   5 +-
 mia/mesh/filter/addscale.cc                        |  87 ++++
 mia/mesh/filter/{vtxsort.hh => addscale.hh}        |  17 +-
 mia/mesh/filter/deltrianglesbynormal.cc            | 160 ++++++
 .../filter/{vtxsort.hh => deltrianglesbynormal.hh} |  18 +-
 mia/mesh/filter/scale.cc                           |   2 +-
 mia/mesh/filter/scale.hh                           |   2 +-
 mia/mesh/filter/selectbig.cc                       | 111 +++++
 mia/mesh/filter/{vtxsort.hh => selectbig.hh}       |  17 +-
 mia/mesh/filter/test_addscale.cc                   |  87 ++++
 mia/mesh/filter/test_deltrianglesbynormal.cc       | 101 ++++
 mia/mesh/filter/test_scale.cc                      |   2 +-
 mia/mesh/filter/test_selectbig.cc                  | 103 ++++
 mia/mesh/filter/test_vtxsort.cc                    |   2 +-
 mia/mesh/filter/vtxsort.cc                         |   2 +-
 mia/mesh/filter/vtxsort.hh                         |   2 +-
 mia/mesh/io/CMakeLists.txt                         |   2 +-
 mia/mesh/io/gts.cc                                 |   2 +-
 mia/mesh/io/off.cc                                 |   2 +-
 mia/mesh/io/ply.cc                                 |   2 +-
 mia/mesh/io/stl.cc                                 |   2 +-
 mia/mesh/test_triangle_neighbourhood.cc            |  74 +++
 mia/mesh/test_triangulate.cc                       |   2 +-
 mia/mesh/triangle_neighbourhood.cc                 |  94 ++++
 .../triangle_neighbourhood.hh}                     |  23 +-
 mia/mesh/triangularMesh.cc                         | 193 ++++++--
 mia/mesh/triangularMesh.hh                         |   6 +-
 mia/mesh/triangulate.hh                            |   2 +-
 mia/template/CMakeLists.txt                        |   4 +-
 mia/template/bandpass.cxx                          |   8 +-
 mia/template/bandpass.hh                           |   3 +-
 mia/template/binarize.cxx                          |   9 +-
 mia/template/binarize.hh                           |   2 +-
 mia/template/combiner.cxx                          |   2 +-
 mia/template/combiner.hh                           |   2 +-
 mia/template/combiner_filter.hh                    |   2 +-
 mia/template/convert.cxx                           |  10 +-
 mia/template/convert.hh                            |   2 +-
 mia/template/cvd_io_trait.hh                       |   2 +-
 mia/template/dimtrait.hh                           |   2 +-
 mia/template/divcurl.cxx                           |   2 +-
 mia/template/divcurl.hh                            |   2 +-
 mia/template/filter_chain.hh                       |   2 +-
 mia/template/filtertest.hh                         |   2 +-
 mia/template/fullcost.cxx                          |   5 +-
 mia/template/fullcost.hh                           |   2 +-
 mia/template/invert.cxx                            |   2 +-
 mia/template/invert.hh                             |   2 +-
 mia/template/labelmap.cxx                          | 110 +++++
 mia/template/{invert.hh => labelmap.hh}            |  46 +-
 mia/template/lsd.hh                                |   2 +-
 mia/template/masked_cost.cxx                       |   2 +-
 mia/template/masked_cost.hh                        |   2 +-
 mia/template/mi.hh                                 |  14 +-
 mia/template/mi_masked.cxx                         |  22 +-
 mia/template/mi_masked.hh                          |   2 +-
 mia/template/multicost.cxx                         |   2 +-
 mia/template/multicost.hh                          |   2 +-
 mia/template/nonrigidregister.cxx                  |  10 +-
 mia/template/nonrigidregister.hh                   |   2 +-
 mia/template/normalize.hh                          |   2 +-
 mia/template/seededwatershed.hh                    |   2 +-
 mia/template/similarity_profile.cxx                |   2 +-
 mia/template/similarity_profile.hh                 |   2 +-
 mia/template/ssd-automask.cxx                      |  15 +-
 mia/template/ssd-automask.hh                       |   2 +-
 mia/template/ssd.hh                                |   8 +-
 mia/template/ssd_masked.cxx                        |   2 +-
 mia/template/ssd_masked.hh                         |   2 +-
 mia/template/trackpoint.cxx                        |   2 +-
 mia/template/trackpoint.hh                         |   2 +-
 mia/template/transformfactory.cxx                  |   2 +-
 mia/template/transformfactory.hh                   |   2 +-
 mia/template/watershed.hh                          |  11 +-
 mia/test/testhelpers.hh                            |   2 +-
 miacore.pc.cmake                                   |   3 +-
 octave/CMakeLists.txt                              |   2 +-
 octave/miaoct.cc                                   |   2 +-
 scripts/brainmask.sh                               |   2 +-
 scripts/extract_boundary.sh                        |   2 +-
 scripts/filter_stack.sh                            |   2 +-
 scripts/segment_stack.sh                           |   2 +-
 src/2davgmasked.cc                                 |   2 +-
 src/2dbinarycombine.cc                             |   2 +-
 src/2dcost.cc                                      |   2 +-
 src/2ddeform.cc                                    |   2 +-
 src/2ddistance.cc                                  |   2 +-
 src/2deval-transformquantity.cc                    |   2 +-
 src/2dforce.cc                                     |   2 +-
 src/2dfuzzysegment.cc                              |   2 +-
 src/2dgrayimage-combine-to-rgb.cc                  |   2 +-
 src/2dgroundtruthreg.cc                            |   2 +-
 src/2dimagecombine-dice.cc                         |   2 +-
 src/2dimagecombiner.cc                             |   2 +-
 src/2dimagecreator.cc                              |   2 +-
 src/2dimagefilter.cc                               |   2 +-
 src/2dimagefilterstack.cc                          |   2 +-
 src/2dimagefullstats.cc                            |   2 +-
 src/2dimageregistration.cc                         |   2 +-
 src/2dimageselect.cc                               |   2 +-
 src/2dimageseries-maximum-intensity-projection.cc  |   2 +-
 src/2dimagestack-cmeans.cc                         | 263 ++++++++++
 src/2dimagestats.cc                                |  52 +-
 src/2dlerp.cc                                      |   2 +-
 src/2dmany2one-nonrigid.cc                         |  12 +-
 src/2dmulti-force.cc                               |   6 +-
 src/2dmulti-nrreg.cc                               |   2 +-
 src/2dmultiimageregistration.cc                    |   4 +-
 src/2dmultiimageto3d.cc                            |   2 +-
 src/2dmultiimagevar.cc                             |   2 +-
 src/2dmyocard-ica.cc                               |   2 +-
 src/2dmyocard-icaseries.cc                         |   5 +-
 src/2dmyocard-segment.cc                           |   3 +-
 src/2dmyocard-upsloap.cc                           |   3 +-
 src/2dmyoica-full.cc                               |   8 +-
 src/2dmyoica-nonrigid-parallel.cc                  |   7 +-
 src/2dmyoica-nonrigid.cc                           |   5 +-
 src/2dmyoica-nonrigid2.cc                          |   5 +-
 src/2dmyoicapgt.cc                                 |   7 +-
 src/2dmyomilles.cc                                 |   5 +-
 src/2dmyoperiodic-nonrigid.cc                      |   2 +-
 src/2dmyopgt-nonrigid.cc                           |   2 +-
 src/2dmyoserial-nonrigid.cc                        |   2 +-
 src/2dmyoseries-compdice.cc                        |   2 +-
 src/2dmyoseries-dice.cc                            |   2 +-
 src/2dmyoset-all2one-nonrigid.cc                   |   6 +-
 src/2dnrreg.cc                                     |   2 +-
 src/2dsegcompare.cc                                |   2 +-
 src/2dseghausdorff.cc                              |   2 +-
 src/2dsegment-ahmed.cc                             |   6 +-
 src/2dsegment-fuzzyw.cc                            |   2 +-
 src/2dsegmentcropbox.cc                            |   4 +-
 src/2dsegseriesstats.cc                            |   2 +-
 src/2dsegshift.cc                                  |   4 +-
 src/2dsegshiftperslice.cc                          |   7 +-
 src/2dseries-mincorr.cc                            |   2 +-
 src/2dseries-sectionmask.cc                        |   2 +-
 src/2dseries-segdistance.cc                        |   2 +-
 src/2dseries2dordermedian.cc                       |   2 +-
 src/2dseries2sets.cc                               |   5 +-
 src/2dseriescorr.cc                                |   2 +-
 src/2dseriesgradMAD.cc                             |   2 +-
 src/2dseriesgradvariation.cc                       |   2 +-
 src/2dserieshausdorff.cc                           |   2 +-
 src/2dseriessmoothgradMAD.cc                       |   2 +-
 src/2dseriestovolume.cc                            |   2 +-
 src/2dstack-cmeans-presegment.cc                   | 433 ++++++++++++++++
 src/2dstackfilter.cc                               |   2 +-
 src/2dto3dimage.cc                                 |   2 +-
 src/2dto3dimageb.cc                                |   2 +-
 src/2dtrackpixelmovement.cc                        |   2 +-
 src/2dtransform.cc                                 |   2 +-
 src/2dtransformation-to-strain.cc                  |   2 +-
 src/3dbinarycombine.cc                             |   2 +-
 src/3dbrainextractT1.cc                            |   2 +-
 src/3dcombine-imageseries.cc                       | 192 ++++++++
 src/3dcombine-mr-segmentations.cc                  |   2 +-
 src/3dcost-translatedgrad.cc                       |   2 +-
 src/3dcost.cc                                      |   2 +-
 src/3dcrispsegment.cc                              |   2 +-
 src/3ddeform.cc                                    |   2 +-
 src/3ddistance-stats.cc                            |   2 +-
 src/3ddistance.cc                                  |   2 +-
 src/3deval-transformquantity.cc                    |   2 +-
 src/3dfield2norm.cc                                |   2 +-
 src/3dforce.cc                                     |   2 +-
 src/3dfuzzysegment.cc                              |   2 +-
 src/3dgetsize.cc                                   |   2 +-
 src/3dgetslice.cc                                  |   2 +-
 src/3dimageaddattributes.cc                        |   2 +-
 src/3dimagecombine.cc                              |   4 +-
 src/3dimagecreator.cc                              |   2 +-
 src/3dimagefilter.cc                               |   2 +-
 src/3dimagefilterstack.cc                          |   2 +-
 src/3dimageselect.cc                               |   2 +-
 src/3dimagestatistics-in-mask.cc                   | 215 ++++++++
 src/3dimagestats.cc                                |   2 +-
 src/3dlandmarks-distances.cc                       |   2 +-
 src/3dlandmarks-transform.cc                       |   2 +-
 src/3dlerp.cc                                      |   2 +-
 src/3dmany2one-nonrigid.cc                         |   2 +-
 src/3dmaskseeded.cc                                |   2 +-
 src/3dmotioncompica-nonrigid.cc                    |   3 +-
 src/3dmulti-nrreg.cc                               |   2 +-
 src/3dnonrigidreg-alt.cc                           |   2 +-
 src/3dnonrigidreg.cc                               |   2 +-
 src/3dnrreg.cc                                     |   2 +-
 src/3dprealign-nonrigid.cc                         |   2 +-
 src/3dpropose-boundingbox.cc                       | 141 ++++++
 src/3drigidreg.cc                                  |   2 +-
 src/3dsegment-ahmed.cc                             |  90 ++--
 src/3dserial-nonrigid.cc                           |   2 +-
 src/3dseries-track-intensity.cc                    |   2 +-
 src/3dtrackpixelmovement.cc                        |   2 +-
 src/3dtransform.cc                                 |   2 +-
 src/3dtransform2vf.cc                              |   2 +-
 src/3dvectorfieldcreate.cc                         |   2 +-
 src/3dvf2transform.cc                              |   2 +-
 src/3dvfcompare.cc                                 |   2 +-
 src/CMakeLists.txt                                 |  10 +-
 src/cmeans.cc                                      |   2 +-
 src/distance-mesh2mask.cc                          |   2 +-
 src/filenumberpattern.cc                           |   2 +-
 src/fluid2d/CMakeLists.txt                         |   2 +-
 src/fluid2d/NR2DMatrix.hh                          |   2 +-
 src/fluid2d/Pixel.hh                               |   2 +-
 src/fluid2d/elast.cc                               |   2 +-
 src/fluid2d/elast.hh                               |   2 +-
 src/fluid2d/helpers.cc                             |   2 +-
 src/fluid2d/helpers.hh                             |   2 +-
 src/fluid2d/main.cc                                |   2 +-
 src/fluid2d/types.hh                               |   2 +-
 src/fluid2d/vfluid.cc                              |   2 +-
 src/fluid2d/vfluid.hh                              |   2 +-
 src/fluid3d/CMakeLists.txt                         |   2 +-
 src/fluid3d/eqn_solver.cc                          |   2 +-
 src/fluid3d/eqn_solver.hh                          |   2 +-
 src/fluid3d/main.cc                                |   2 +-
 src/fluid3d/sor_solver.cc                          |   2 +-
 src/fluid3d/sor_solver.hh                          |   2 +-
 src/fluid3d/typedefs.hh                            |   2 +-
 src/fluid3d/vfluid.cc                              |   2 +-
 src/fluid3d/vfluid.hh                              |   2 +-
 src/isosurface/CMakeLists.txt                      |   2 +-
 src/isosurface/iso.cc                              |   6 +-
 src/isosurface/iso_backend.cc                      |   2 +-
 src/isosurface/iso_from_slices.cc                  |   2 +-
 src/isosurface/mesh_convert.cc                     |   2 +-
 src/labelsort.cc                                   |   2 +-
 src/mesh-deformable-model.cc                       | 296 +++++++++++
 src/mesh-to-maskimage.cc                           | 121 +++++
 src/meshdistance-to-stackmask.cc                   |   2 +-
 src/meshfilter.cc                                  |   2 +-
 src/multihist.cc                                   | 121 ++++-
 src/multiimage-cmeans.cc                           |  90 ++++
 src/myowavelettest.cc                              |   2 +-
 src/plugin-help.cc                                 |   2 +-
 src/raw2image.cc                                   |   2 +-
 src/raw2volume.cc                                  |   2 +-
 src/test_plugins_as_installed.cc                   |  19 +-
 src/wavelettrans.cc                                |   2 +-
 test/CMakeLists.txt                                |   2 +-
 test/test_ioplugins.cc                             |   2 +-
 test/test_minimizer.cc                             |   2 +-
 testdata/CMakeLists.txt                            |   2 +-
 1500 files changed, 11109 insertions(+), 3408 deletions(-)

diff --git a/AUTHORS b/AUTHORS
index 878e64f..d16647e 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -8,17 +8,6 @@ Additional contributions:
   Stefan Burckhardt 
   Carsten Wolters
 
-Most of the "vistaio" code is derived from the Vista Library
- (c) Art Pope, UBC Laboratory for Computational Intelligence
- 
- Permission to use, copy, modify, distribute, and sell this software and its
- documentation for any purpose is hereby granted without fee, provided that
- the above copyright notice appears in all copies and that both that
- copyright notice and this permission notice appear in supporting
- documentation. UBC makes no representations about the suitability of this
- software for any purpose. It is provided "as is" without express or
- implied warranty.
-
 The filter routines for splines and omoms is based on code by
   Philippe Thevenaz http://bigwww.epfl.ch/thevenaz/interpolation/
  
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2d90774..007becf 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,6 +1,6 @@
 #
 # This file is part of MIA - a toolbox for medical image analysis 
-# Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+# 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
@@ -23,8 +23,19 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8.5 FATAL_ERROR)
 if(COMMAND cmake_policy)
   cmake_policy(SET CMP0003 NEW)
   cmake_policy(SET CMP0012 NEW)
+  IF(${CMAKE_VERSION} VERSION_GREATER 3.0.0) 
+    cmake_policy(SET CMP0042 NEW)
+  ENDIF()
 endif(COMMAND cmake_policy)
 
+# This test is added for the Ninja generator, since it 
+# has problems with relinking when installing 
+# 
+STRING(COMPARE EQUAL "${CMAKE_SYSTEM_NAME}" "Linux" SYSTEM_IS_LINUX)
+IF(${SYSTEM_IS_LINUX})
+  SET(CMAKE_EXECUTABLE_FORMAT "ELF")
+ENDIF()
+
 include(FindPkgConfig)
 include(CheckCXXSourceCompiles)
 
@@ -41,9 +52,12 @@ SET(VENDOR "Gert Wollny")
 SET(PACKAGE_NAME "mia")
 SET(MAJOR_VERSION 2)
 SET(MINOR_VERSION 2)
-SET(MICRO_VERSION 3)
+SET(MICRO_VERSION 4)
 SET(INTERFACE_AGE 0)
-SET(BINARY_AGE    3)
+SET(BINARY_AGE    0)
+
+#
+#SET(CMAKE_BUILD_WITH_INSTALL_RPATH 1)
 
 SET(PACKAGE_VERSION "${MAJOR_VERSION}.${MINOR_VERSION}.${MICRO_VERSION}")
 SET(VERSION "${MAJOR_VERSION}.${MINOR_VERSION}")
@@ -88,7 +102,7 @@ IF(UNIX)
     ENDIF(HAS_GNU_CXX0X_FLAG)
   ENDIF(HAS_GNU_CXX11_FLAG)
   
-  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}  ${CXX_11_FLAG}")
+  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}  ${CXX_11_FLAG} -fvisibility=hidden")
 ENDIF(UNIX)
 
 INCLUDE (${CMAKE_CURRENT_SOURCE_DIR}/cmake/checkCpp0xAuto.cmake)
@@ -139,6 +153,8 @@ ELSE(MSVC)
 ENDIF (MSVC)
 
 
+
+
 # Taken from ITK:
 # On Visual Studio 8 MS deprecated C. This removes all 1.276E1265 security
 # warnings
@@ -194,7 +210,7 @@ IF (WIN32)
   SET(BOOST_COMPONENTS  ${BOOST_COMPONENTS} date_time)
 ENDIF(WIN32)
 
-FIND_PACKAGE( Boost 1.46.1 COMPONENTS
+FIND_PACKAGE( Boost 1.50.0 COMPONENTS
   ${BOOST_COMPONENTS}
   REQUIRED)
 
@@ -455,7 +471,7 @@ ENDIF(PYTHONINTERP_FOUND)
 # define plug-in related values and directories and add the test directory link target 
 # 
 
-DEFINE_PLUGIN_NAMES( 1d  "spacialkernel;splinebc;splinekernel" ${PLUGIN_INSTALL_PATH})
+DEFINE_PLUGIN_NAMES( 1d  "cmeans;spacialkernel;splinebc;splinekernel" ${PLUGIN_INSTALL_PATH})
 DEFINE_PLUGIN_NAMES( 2dimage  "combiner;cost;creator;filter;fullcost;io;maskedcost;model;shape;timestep;transform" ${PLUGIN_INSTALL_PATH})
 DEFINE_PLUGIN_NAMES( 2dmyocardsegset "io" ${PLUGIN_INSTALL_PATH})
 DEFINE_PLUGIN_NAMES( 2dsplinepenalty  "transform" ${PLUGIN_INSTALL_PATH})
@@ -480,10 +496,6 @@ IF(BUILD_EXAMPLES)
   ADD_SUBDIRECTORY(examples)
 ENDIF(BUILD_EXAMPLES)
 
-ADD_SUBDIRECTORY(src)
-ADD_SUBDIRECTORY(test)
-ADD_SUBDIRECTORY(doc)
-
 CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/miacore.pc.cmake ${CMAKE_CURRENT_BINARY_DIR}/miacore-${VERSION}.pc)
 CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/mia2d.pc.cmake ${CMAKE_CURRENT_BINARY_DIR}/mia2d-${VERSION}.pc)
 CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/mia2dmyocardperf.pc.cmake 
@@ -510,6 +522,8 @@ GET_PROPERTY(HAVE_TIFF GLOBAL PROPERTY HAVE_TIFF_PROP DEFINED)
 GET_PROPERTY(HAVE_JPG GLOBAL PROPERTY HAVE_JPG_PROP DEFINED)
 GET_PROPERTY(HAVE_NLOPT GLOBAL PROPERTY HAVE_NLOPT_PROP DEFINED)
 
+GET_PROPERTY(HAVE_MAXFLOW GLOBAL PROPERTY HAVE_MAXFLOW_PROP DEFINED)
+
 CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/miaconfig.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/miaconfig.h)
 CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h)
 
@@ -521,3 +535,7 @@ INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/README ${CMAKE_CURRENT_SOURCE_DIR}/COP
 
  
 ADD_CUSTOM_TARGET(dist bash ${CMAKE_SOURCE_DIR}/create_package "${PACKAGE_NAME}" "${PACKAGE_VERSION}" "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}")
+
+ADD_SUBDIRECTORY(src)
+ADD_SUBDIRECTORY(test)
+ADD_SUBDIRECTORY(doc)
diff --git a/ChangeLog b/ChangeLog
index d9bcda2..afb849c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,42 @@
+2.2.4
+
+  New features:
+
+  * Add programs for 
+      - cmeans on sparse input data
+      - combining an abitrary number of images with an comutative operation
+      - estimating a bounding box around the data in an image
+      - applying a deformabale model to a mesh
+      - evaluating statistics in a masked area of an 3d image
+  * Add mesh filters
+      - remove triangles based on normal direction
+      - select largest connected mesh part
+      - add a scale value taken from a 3D image to each vertex
+
+  * enable use of parallel gzip/xz in IO if available 
+  * Add image filters
+      - 3D labelmap filter 
+      - 3D re-orientation filter re-enabled
+      - 2D maxflow/mincut segmentation filter 
+      - 2D sobel filter  
+  
+  * Cleanups
+      - remove eigen3 from public interface 
+      - remove libxml++ from public interface (Closes: #178)
+      - remove boost/filesystem from public interface (Closes: #177)
+      
+  * Coverity fixes 
+  * Implement 2d gradient normalized cross correlation 
+  * Parallize some filter for speedup 
+  * Add new bounded parameter type that replaces ranged parameter 
+  * Add cmeans class with different initializers given by plug-ins 
+  * correct evaluation of normalization filter in nonlinearregistration 
+    (Closes #185) 
+  *  Remove cost name test from s/2dmany-to-one.cc (Related to #186)
+  * Add a 3D to image drawtool
+  * remove time stamp from man pages for reproducible builds
+  * Lots of minor changes and fixes (see git log for details) 
+
 2.2.3
 
   New features:
diff --git a/addons/CMakeLists.txt b/addons/CMakeLists.txt
index e012ccb..4d2f022 100644
--- a/addons/CMakeLists.txt
+++ b/addons/CMakeLists.txt
@@ -1,6 +1,6 @@
 #
 # This file is part of MIA - a toolbox for medical image analysis 
-# Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+# 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
@@ -22,6 +22,7 @@ ADD_SUBDIRECTORY( dicom )
 ADD_SUBDIRECTORY( jpg )
 ADD_SUBDIRECTORY( hdf5 )
 ADD_SUBDIRECTORY( openexr )
+ADD_SUBDIRECTORY( maxflow )
 ADD_SUBDIRECTORY( nifti )
 ADD_SUBDIRECTORY( nlopt )
 ADD_SUBDIRECTORY( png )
diff --git a/addons/dicom/CMakeLists.txt b/addons/dicom/CMakeLists.txt
index 3ad10a8..835100d 100644
--- a/addons/dicom/CMakeLists.txt
+++ b/addons/dicom/CMakeLists.txt
@@ -1,6 +1,6 @@
 #
 # This file is part of MIA - a toolbox for medical image analysis 
-# Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+# 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
diff --git a/addons/dicom/dcm2d.cc b/addons/dicom/dcm2d.cc
index 0743de9..3eaac03 100644
--- a/addons/dicom/dcm2d.cc
+++ b/addons/dicom/dcm2d.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -40,11 +40,11 @@ CDicom2DImageIOPlugin::CDicom2DImageIOPlugin():
 	add_supported_type(it_ushort);
 	add_supported_type(it_sshort);
 
-	TTranslator<float>::register_for("SliceLocation");
-	TTranslator<double>::register_for("AcquisitionTime"); 
-	TTranslator<int>::register_for("SeriesNumber");
-	TTranslator<int>::register_for("AcquisitionNumber");
-	TTranslator<int>::register_for("InstanceNumber");
+	CFloatTranslator::register_for("SliceLocation");
+	CDoubleTranslator::register_for("AcquisitionTime"); 
+	CSITranslator::register_for("SeriesNumber");
+	CSITranslator::register_for("AcquisitionNumber");
+	CSITranslator::register_for("InstanceNumber");
 	CPatientPositionTranslator::register_for(IDPatientPosition);
 	add_suffix(".dcm");
 	add_suffix(".DCM");
diff --git a/addons/dicom/dcm2d.hh b/addons/dicom/dcm2d.hh
index b7264e4..753fdb8 100644
--- a/addons/dicom/dcm2d.hh
+++ b/addons/dicom/dcm2d.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/addons/dicom/dcm3d.cc b/addons/dicom/dcm3d.cc
index 1ecba2a..35a67fe 100644
--- a/addons/dicom/dcm3d.cc
+++ b/addons/dicom/dcm3d.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -32,7 +32,6 @@
 #include <mia/core/file.hh>
 #include <mia/core/filter.hh>
 #include <mia/core/msgstream.hh>
-#include <mia/core/bfsv23dispatch.hh>
 #include <mia/2d/imageio.hh>
 
 NS_BEGIN(IMAGEIO_3D_DICOM)
@@ -49,11 +48,11 @@ CDicom3DImageIOPlugin::CDicom3DImageIOPlugin():
 	add_supported_type(it_ushort);
 	add_supported_type(it_sshort);
 
-	TTranslator<float>::register_for("SliceLocation");
-	TTranslator<double>::register_for("AcquisitionTime"); 
-	TTranslator<int>::register_for("SeriesNumber");
-	TTranslator<int>::register_for("AcquisitionNumber");
-	TTranslator<int>::register_for("InstanceNumber");
+	CFloatTranslator::register_for("SliceLocation");
+	CDoubleTranslator::register_for("AcquisitionTime"); 
+	CSITranslator::register_for("SeriesNumber");
+	CSITranslator::register_for("AcquisitionNumber");
+	CSITranslator::register_for("InstanceNumber");
 	CPatientPositionTranslator::register_for(IDPatientPosition);
 	add_suffix(".dcm");
 	add_suffix(".DCM");
@@ -213,7 +212,7 @@ static void add_images(const string& fname, const string& study_id, vector<P2DIm
 {
 	TRACE_FUNCTION;
 	bfs::path dir(fname);
-	string ext = __bfs_get_extension(dir);
+	string ext = dir.extension().string();
 	dir.remove_filename();
 
 	if (dir.filename().empty())
@@ -231,8 +230,8 @@ static void add_images(const string& fname, const string& study_id, vector<P2DIm
 	bfs::directory_iterator di(dir);
 	bfs::directory_iterator dend;
 	while (di != dend) {
-		if (boost::regex_match(__bfs_get_filename(di->path()), pat_expr) &&
-		    __bfs_get_filename(di->path()) != fname) {
+		if (boost::regex_match(di->path().filename().string(), pat_expr) &&
+		    di->path().filename().string() != fname) {
 			bfs::path f =  di->path();
 			cvdebug() << "read file '" << f << "'\n";
 			CDicomReader reader(f.string().c_str());
@@ -298,8 +297,8 @@ CSliceSaver::CSliceSaver(const string& fname):
 {
 	// filename split the
 	bfs::path fullname(fname);
-	m_extension = __bfs_get_extension(fullname);
-	m_fnamebase = __bfs_get_stem(fullname);
+	m_extension = fullname.extension().string();
+	m_fnamebase = fullname.stem().string();
 }
 
 void CSliceSaver::set_instance(size_t series, size_t slice)
diff --git a/addons/dicom/dcm3d.hh b/addons/dicom/dcm3d.hh
index d0d0ef0..6be85c8 100644
--- a/addons/dicom/dcm3d.hh
+++ b/addons/dicom/dcm3d.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/addons/dicom/dicom4mia.cc b/addons/dicom/dicom4mia.cc
index 7f69eb2..5fad969 100644
--- a/addons/dicom/dicom4mia.cc
+++ b/addons/dicom/dicom4mia.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/addons/dicom/dicom4mia.hh b/addons/dicom/dicom4mia.hh
index 4ff491b..c196917 100644
--- a/addons/dicom/dicom4mia.hh
+++ b/addons/dicom/dicom4mia.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/addons/dicom/getset.hh b/addons/dicom/getset.hh
index 742b6eb..3b3395f 100644
--- a/addons/dicom/getset.hh
+++ b/addons/dicom/getset.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/addons/dicom/test_dcm2d.cc b/addons/dicom/test_dcm2d.cc
index 3f908f0..313cb9b 100644
--- a/addons/dicom/test_dcm2d.cc
+++ b/addons/dicom/test_dcm2d.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/addons/dicom/test_dcm3d.cc b/addons/dicom/test_dcm3d.cc
index d763a90..190a5db 100644
--- a/addons/dicom/test_dcm3d.cc
+++ b/addons/dicom/test_dcm3d.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/addons/dicom/test_dicom4mia.cc b/addons/dicom/test_dicom4mia.cc
index c7ff0e6..f86d606 100644
--- a/addons/dicom/test_dicom4mia.cc
+++ b/addons/dicom/test_dicom4mia.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/addons/hdf5/CMakeLists.txt b/addons/hdf5/CMakeLists.txt
index d5ec769..6e3ec0b 100644
--- a/addons/hdf5/CMakeLists.txt
+++ b/addons/hdf5/CMakeLists.txt
@@ -1,6 +1,6 @@
 #
 # This file is part of MIA - a toolbox for medical image analysis 
-# Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+# 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
diff --git a/addons/hdf5/hdf5_3dimage.cc b/addons/hdf5/hdf5_3dimage.cc
index 65da7d1..bb13aa3 100644
--- a/addons/hdf5/hdf5_3dimage.cc
+++ b/addons/hdf5/hdf5_3dimage.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/addons/hdf5/hdf5_3dimage.hh b/addons/hdf5/hdf5_3dimage.hh
index e7b54a5..ff8f2fa 100644
--- a/addons/hdf5/hdf5_3dimage.hh
+++ b/addons/hdf5/hdf5_3dimage.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/addons/hdf5/hdf5a_mia.cc b/addons/hdf5/hdf5a_mia.cc
index 6a6367a..d85d392 100644
--- a/addons/hdf5/hdf5a_mia.cc
+++ b/addons/hdf5/hdf5a_mia.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/addons/hdf5/hdf5a_mia.hh b/addons/hdf5/hdf5a_mia.hh
index fb1dbd3..d4126b7 100644
--- a/addons/hdf5/hdf5a_mia.hh
+++ b/addons/hdf5/hdf5a_mia.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/addons/hdf5/hdf5mia.cc b/addons/hdf5/hdf5mia.cc
index 1d5dfe4..35be4c5 100644
--- a/addons/hdf5/hdf5mia.cc
+++ b/addons/hdf5/hdf5mia.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/addons/hdf5/hdf5mia.hh b/addons/hdf5/hdf5mia.hh
index 44563d6..5b5c16c 100644
--- a/addons/hdf5/hdf5mia.hh
+++ b/addons/hdf5/hdf5mia.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/addons/hdf5/test_hdf5_3dimage.cc b/addons/hdf5/test_hdf5_3dimage.cc
index e00e373..3d38405 100644
--- a/addons/hdf5/test_hdf5_3dimage.cc
+++ b/addons/hdf5/test_hdf5_3dimage.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/addons/hdf5/test_hdf5mia.cc b/addons/hdf5/test_hdf5mia.cc
index 04989e0..b40183f 100644
--- a/addons/hdf5/test_hdf5mia.cc
+++ b/addons/hdf5/test_hdf5mia.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/addons/jpg/CMakeLists.txt b/addons/jpg/CMakeLists.txt
index 81da4af..4719ca4 100644
--- a/addons/jpg/CMakeLists.txt
+++ b/addons/jpg/CMakeLists.txt
@@ -1,6 +1,6 @@
 #
 # This file is part of MIA - a toolbox for medical image analysis 
-# Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+# 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
diff --git a/addons/jpg/jpeg-common.hh b/addons/jpg/jpeg-common.hh
index 3de0e57..67415b0 100644
--- a/addons/jpg/jpeg-common.hh
+++ b/addons/jpg/jpeg-common.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/addons/jpg/jpg-gray.cc b/addons/jpg/jpg-gray.cc
index d9b97fe..69cfd43 100644
--- a/addons/jpg/jpg-gray.cc
+++ b/addons/jpg/jpg-gray.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/addons/jpg/jpg-rgb.cc b/addons/jpg/jpg-rgb.cc
index 2d9306e..b9d6c53 100644
--- a/addons/jpg/jpg-rgb.cc
+++ b/addons/jpg/jpg-rgb.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/addons/maxflow/2dmaxflow.cc b/addons/maxflow/2dmaxflow.cc
new file mode 100644
index 0000000..ca558e0
--- /dev/null
+++ b/addons/maxflow/2dmaxflow.cc
@@ -0,0 +1,192 @@
+/* -*- mia-c++  -*-
+ *
+ * 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 MIA; if not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <mia/core/filter.hh>
+#include <mia/2d/imageio.hh>
+#include <addons/maxflow/2dmaxflow.hh>
+#include <maxflow.h>
+
+#include <mia/core/msgstream.hh>
+
+NS_BEGIN( maxflow_2dimage_filter)
+
+using namespace mia; 
+using std::string;
+using std::invalid_argument; 
+using std::minmax_element; 
+using maxflow::Graph_FFF;
+
+
+C2DMaxflow::C2DMaxflow(const std::string& sink_flow_imagefile, const std::string& source_flow_imagefile):
+        m_sink_flow_imagefile(sink_flow_imagefile), 
+	m_source_flow_imagefile(source_flow_imagefile)
+{
+
+	
+}
+
+
+C2DFImage load_flow_image(const string& imagefile, const string& type, const C2DBounds& expect_size)
+{
+	auto pimage = load_image2d(imagefile);
+	if (pimage->get_size() != expect_size) {
+		throw create_exception<invalid_argument>("Maxflow: ", type ," flow image '", imagefile,
+							 "' has size (", pimage->get_size(),
+							 "), but expect size (",expect_size, ")");
+	}
+	if (pimage->get_pixel_type() != it_float)
+		throw create_exception<invalid_argument>("Maxflow: ", type ," flow image '", imagefile,
+							 "' is not of type 'float'"); 
+
+	return C2DFImage(static_cast<const C2DFImage&>(*pimage)); 
+}
+
+
+// this needs to become tunable
+
+class FGradToFlow {
+public: 
+	FGradToFlow(float vmin, float vmax)
+	{
+		if (vmax <= vmin) {
+			throw create_exception<invalid_argument>("Maxflow: input image seems to be of one value only"); 
+		}
+
+		m_scale = 1.0/(vmax - vmin); 
+
+	}
+
+	float operator() (float x, float y) const
+	{
+		float delta = (x - y) * m_scale;
+		float v = 1 - delta * delta / 0.9;
+		return v * v; 
+
+	}
+private:
+	float m_scale; 
+};
+
+
+
+template <class T>
+typename C2DMaxflow::result_type C2DMaxflow::operator () (const mia::T2DImage<T>& data) const
+{
+	// load the sink and source flow images
+	// throws if file not available 
+	auto sink = load_flow_image(m_sink_flow_imagefile, "sink", data.get_size());
+	auto source = load_flow_image(m_source_flow_imagefile, "source", data.get_size() );
+	
+	// create the maxflow object
+	Graph_FFF graph(data.size(), 2*data.get_size().size());
+	
+	graph.add_node(data.size());
+
+// add the capacities towards sinks ans sources 
+	int idx = 0;
+	auto isink = sink.begin();
+	auto esink = sink.end(); 
+	auto isource = source.begin();
+
+	while (isink != esink) {
+		if (*isink > 0 || *isource > 0) {
+			graph.add_tweights(idx, *isource, *isink);  
+		}
+		++isink;
+		++isource;
+		++idx; 	
+	}
+
+	// this should become a configurable function 
+	auto minmax_vals  = minmax_element(data.begin(), data.end()); 
+	FGradToFlow grad_to_flow(*minmax_vals.first, *minmax_vals.second); 
+
+	// add the inter-pixel capacities
+	idx = 0;
+	for (unsigned y = 0; y < data.get_size().y; ++y) {
+		for (unsigned x = 0; x < data.get_size().x - 1; ++x, ++idx) {
+			auto xflow = grad_to_flow(data(x,y), data(x+1,y));
+			graph.add_edge(idx,idx +1, xflow, xflow);
+
+		}
+		++idx;
+	}
+	idx = 0; 
+	for (unsigned y = 0; y < data.get_size().y - 1; ++y) {
+		for (unsigned x = 0; x < data.get_size().x; ++x, ++idx) {
+			auto yflow = grad_to_flow(data(x,y), data(x,y+1));
+			graph.add_edge(idx,idx + data.get_size().x, yflow, yflow);	
+		}
+	}
+
+	float flow = graph.maxflow();
+	cvinfo() << "get flow " << flow << "\n"; 
+	
+	C2DBitImage *result = new C2DBitImage(data.get_size(), data);
+
+	idx = 0; 
+	for (auto ir = result->begin(); ir != result->end(); ++ir, ++idx) {
+		*ir = (graph.what_segment(idx) == Graph_FFF::SOURCE); 
+	}
+       
+	return P2DImage(result);
+	
+}
+
+mia::P2DImage C2DMaxflow::do_filter(const mia::C2DImage& image) const
+{
+	return mia::filter(*this, image);  
+}
+
+
+C2DMaxflowFilterPluginFactory::C2DMaxflowFilterPluginFactory():
+	C2DFilterPlugin("maxflow")
+{
+	add_parameter("sink-flow",
+		      new CStringParameter(m_sink_flow_imagefile,
+					   CCmdOptionFlags::required_input, 
+					   "Image of float type to define the per-pixel flow to the sink", 
+					   &C2DImageIOPluginHandler::instance()));
+	add_parameter("source-flow",
+		      new CStringParameter(m_source_flow_imagefile,
+					   CCmdOptionFlags::required_input, 
+					   "Image of float type to define the per-pixel flow to the source", 
+					   &C2DImageIOPluginHandler::instance()));
+}
+
+
+mia::C2DFilter *C2DMaxflowFilterPluginFactory::do_create()const
+{
+	return new C2DMaxflow(m_sink_flow_imagefile, m_source_flow_imagefile);
+}
+
+const std::string C2DMaxflowFilterPluginFactory::do_get_descr()const
+{
+	return "This filter implements the uses the max-flow min-cut algorithm"
+		"for image segmentation"; 
+}
+
+extern "C" EXPORT CPluginBase *get_plugin_interface()
+{
+	return new C2DMaxflowFilterPluginFactory();
+}
+
+
+NS_END
diff --git a/mia/2d/filter/mean.hh b/addons/maxflow/2dmaxflow.hh
similarity index 63%
copy from mia/2d/filter/mean.hh
copy to addons/maxflow/2dmaxflow.hh
index 93273dd..e1d2cec 100644
--- a/mia/2d/filter/mean.hh
+++ b/addons/maxflow/2dmaxflow.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -20,29 +20,30 @@
 
 #include <mia/2d/filter.hh>
 
-NS_BEGIN( mean_2dimage_filter)
+NS_BEGIN( maxflow_2dimage_filter)
 
-
-class C2DMean : public mia::C2DFilter {
+class C2DMaxflow : public mia::C2DFilter {
 public:
-	C2DMean(int hw);
+	C2DMaxflow(const std::string& sink_flow_imagefile, const std::string& source_flow_image_file);
 
 	template <class T>
-	typename C2DMean::result_type operator () (const mia::T2DImage<T>& data) const;
+	typename C2DMaxflow::result_type operator () (const mia::T2DImage<T>& data) const ;
 private:
 	virtual mia::P2DImage do_filter(const mia::C2DImage& image) const;
 
-	int m_hw;
+	std::string m_sink_flow_imagefile;
+	std::string m_source_flow_imagefile; 
 };
 
-
-class C2DMeanFilterPlugin: public mia::C2DFilterPlugin {
+class C2DMaxflowFilterPluginFactory: public mia::C2DFilterPlugin {
 public:
-	C2DMeanFilterPlugin();
+	C2DMaxflowFilterPluginFactory();
 private:
 	virtual mia::C2DFilter *do_create()const;
 	virtual const std::string do_get_descr()const;
-	int m_hw;
+
+	std::string m_sink_flow_imagefile;
+	std::string m_source_flow_imagefile;
 };
 
 NS_END
diff --git a/addons/maxflow/CMakeLists.txt b/addons/maxflow/CMakeLists.txt
new file mode 100644
index 0000000..cf07afd
--- /dev/null
+++ b/addons/maxflow/CMakeLists.txt
@@ -0,0 +1,38 @@
+#
+# 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/>.
+#
+
+OPTION(WITH_MAXFLOW "enable support for maxflow-mincut based filters" ${SEARCH_LIBS_DEFAULT})
+IF(WITH_MAXFLOW)
+  IF(NOT MAXFLOW_LIBRARIES) 
+    PKG_CHECK_MODULES(MAXFLOW maxflow)
+  ENDIF(NOT MAXFLOW_LIBRARIES) 
+
+  IF(MAXFLOW_LIBRARIES)
+    INCLUDE_DIRECTORIES(${MAXFLOW_INCLUDE_DIRS})
+
+    DEFINE_PROPERTY(GLOBAL PROPERTY HAVE_MAXFLOW_PROP BRIEF_DOCS "yeah" FULL_DOCS "yeah")
+    SET(MAXFLOWLIBS mia2d ${MAXFLOW_LIBRARIES})
+    LINK_DIRECTORIES(${MAXFLOW_LIBRARY_DIRS})
+
+    PLUGIN_WITH_TEST_AND_PREFIX2("2dimage" "filter" 2dmaxflow "${MAXFLOWLIBS}")
+  ELSE (MAXFLOW_LIBRARIES)
+    IF(STRICT_DEPENDECIES)
+      MESSAGE(ERROR "Requested library maxflow not found and STRICT_DEPENDECIES given")
+    ENDIF(STRICT_DEPENDECIES)
+  ENDIF(MAXFLOW_LIBRARIES)
+ENDIF(WITH_MAXFLOW)
diff --git a/addons/maxflow/test_2dmaxflow.cc b/addons/maxflow/test_2dmaxflow.cc
new file mode 100644
index 0000000..2526559
--- /dev/null
+++ b/addons/maxflow/test_2dmaxflow.cc
@@ -0,0 +1,133 @@
+/* -*- mia-c++  -*-
+ *
+ * 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 MIA; if not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <mia/internal/plugintester.hh>
+#include <mia/2d/imageio.hh>
+
+#include <addons/maxflow/2dmaxflow.hh>
+
+using namespace std;
+using namespace mia; 
+using maxflow_2dimage_filter::C2DMaxflowFilterPluginFactory; 
+
+BOOST_AUTO_TEST_CASE ( test_2d_simple_maxflow )
+{
+// one source, one sink and a pretty simple 4x4 image
+
+	// sink and source
+
+
+	vector<unsigned char> image = {
+		255, 255, 245, 233,
+		200, 170, 170, 150,
+		20,   30,  40,  30,
+		40,   20,  50,  10
+	};
+
+	vector<bool> expect = {
+		false, false, false, false,
+		false, false, false, false,
+		true, true, true, true, 
+		true, true, true, true
+	};
+	
+	C2DBounds sink(0,0);
+	C2DBounds source(3,3);
+
+	C2DBounds size(4,4);
+
+	C2DUBImage in_image(size, image);
+
+	// define a flow image
+	// max flow = 1
+	// min flow = 0
+
+	C2DFImage *fimage = new C2DFImage(size);
+	(*fimage)(sink) = 16.0f;  
+	P2DImage sink_image(fimage);
+
+	fimage = new C2DFImage(size);
+	(*fimage)(source) = 16.0f; 
+	P2DImage source_image(fimage);
+
+       	auto maxflow = BOOST_TEST_create_from_plugin<C2DMaxflowFilterPluginFactory>("maxflow:source-flow=src.@,sink-flow=sink.@");
+
+	save_image("src.@", source_image);
+	save_image("sink.@", sink_image);
+
+	
+	auto result = maxflow->filter( in_image );
+
+	BOOST_REQUIRE(result);
+	
+	BOOST_CHECK_EQUAL ( result->get_size(), size);
+	BOOST_CHECK_EQUAL ( result->get_pixel_type(), it_bit); 
+
+	auto& bit_result = dynamic_cast<const C2DBitImage&>(*result); 
+	
+	auto iexp = expect.begin(); 
+	for(auto ires = bit_result.begin(); ires != bit_result.end(); ++ires, ++iexp) {
+		
+		BOOST_CHECK_EQUAL(*ires, *iexp); 
+	}
+}
+
+
+BOOST_AUTO_TEST_CASE( test_throw_missing_or_wrong_parameter )
+{
+	C2DUBImage in_image(C2DBounds(4,4));
+	save_image("test.@", in_image); 
+
+	BOOST_CHECK_THROW(BOOST_TEST_create_from_plugin<C2DMaxflowFilterPluginFactory>("maxflow"),
+			  invalid_argument);
+	
+	BOOST_CHECK_THROW(BOOST_TEST_create_from_plugin<C2DMaxflowFilterPluginFactory>("maxflow:sink-flow=test.@"),
+			  invalid_argument); 
+	
+	BOOST_CHECK_THROW(BOOST_TEST_create_from_plugin<C2DMaxflowFilterPluginFactory>("maxflow:source-flow=test.@"),
+			  invalid_argument); 
+
+	auto maxflow = BOOST_TEST_create_from_plugin<C2DMaxflowFilterPluginFactory>("maxflow:source-flow=test.@,sink-flow=test.@");
+
+	// should throw because we don't accept non-float flow images 
+	BOOST_CHECK_THROW(maxflow->filter(in_image), invalid_argument); 
+
+}
+
+BOOST_AUTO_TEST_CASE( test_throw_wrong_sizes )
+{
+	C2DFImage flow_image(C2DBounds(4,4));
+	save_image("test.@", flow_image);
+
+	C2DFImage wrong_image_size(C2DBounds(4,5));
+
+	wrong_image_size(0,0) = 1.0;
+	
+	auto maxflow = BOOST_TEST_create_from_plugin<C2DMaxflowFilterPluginFactory>("maxflow:source-flow=test.@,sink-flow=test.@");
+
+	BOOST_CHECK_THROW(maxflow->filter(wrong_image_size), invalid_argument);	
+
+	C2DFImage flat_image(C2DBounds(4,4));
+
+	BOOST_CHECK_THROW(maxflow->filter(flat_image), invalid_argument);
+	
+	
+}
+
diff --git a/addons/nifti/CMakeLists.txt b/addons/nifti/CMakeLists.txt
index 7ea8dfd..4c78366 100644
--- a/addons/nifti/CMakeLists.txt
+++ b/addons/nifti/CMakeLists.txt
@@ -1,6 +1,6 @@
 #
 # This file is part of MIA - a toolbox for medical image analysis 
-# Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+# 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
diff --git a/addons/nifti/niftiimage.cc b/addons/nifti/niftiimage.cc
index d908d3a..0a11fde 100644
--- a/addons/nifti/niftiimage.cc
+++ b/addons/nifti/niftiimage.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/addons/nifti/niftiimage.hh b/addons/nifti/niftiimage.hh
index 71ac69c..51b220c 100644
--- a/addons/nifti/niftiimage.hh
+++ b/addons/nifti/niftiimage.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/addons/nifti/test_niftiimage.cc b/addons/nifti/test_niftiimage.cc
index 6a2ed1d..0f4821d 100644
--- a/addons/nifti/test_niftiimage.cc
+++ b/addons/nifti/test_niftiimage.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/addons/nlopt/CMakeLists.txt b/addons/nlopt/CMakeLists.txt
index 621e7fb..3dc4844 100644
--- a/addons/nlopt/CMakeLists.txt
+++ b/addons/nlopt/CMakeLists.txt
@@ -1,6 +1,6 @@
 #
 # This file is part of MIA - a toolbox for medical image analysis 
-# Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+# 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
diff --git a/addons/nlopt/nlopt.cc b/addons/nlopt/nlopt.cc
index 9106078..2517f89 100644
--- a/addons/nlopt/nlopt.cc
+++ b/addons/nlopt/nlopt.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -316,33 +316,32 @@ CNLOptMinimizerPlugin::CNLOptMinimizerPlugin():
 						  "local minimization algorithm that may be required for the"
 						  " main minimization algorithm."));
 	
-	add_parameter("stop", new CDoubleParameter(m_options.stopval, -HUGE_VAL, HUGE_VAL, false, 
-				  "Stopping criterion: function value falls below this value")); 
-	add_parameter("xtola", new CDoubleParameter(m_options.abs_xtol, 0.0, HUGE_VAL, false, 
+	add_parameter("stop", make_param(m_options.stopval, false,
+					 "Stopping criterion: function value falls below this value"));
+	
+	add_parameter("xtola", make_lc_param(m_options.abs_xtol, 0.0, false, 
 				  "Stopping criterion: the absolute change of all x-values is below "
 				  " this value")); 
-	add_parameter("xtolr", new CDoubleParameter(m_options.rel_xtol, 0.0, HUGE_VAL, false, 
+	add_parameter("xtolr", make_lc_param(m_options.rel_xtol, 0.0, false, 
 				  "Stopping criterion: the relative change of all x-values is below "
 				  " this value")); 
 
-	add_parameter("ftola", new CDoubleParameter(m_options.abs_ftol, 0.0, HUGE_VAL, false, 
-				  "Stopping criterion: the absolute change of the objective value is below "
-						    " this value")); 
-	add_parameter("ftolr", new CDoubleParameter(m_options.rel_ftol, 0.0, HUGE_VAL, false, 
+	add_parameter("ftola", make_lc_param(m_options.abs_ftol, 0.0, false, 
+					      "Stopping criterion: the absolute change of the objective value is below "
+					      " this value")); 
+	add_parameter("ftolr", make_lc_param(m_options.rel_ftol, 0.0, false, 
 				  "Stopping criterion: the relative change of the objective value is below "
 						    " this value")); 
 
-	add_parameter("maxiter", new CIntParameter(m_options.maxiter, 1, numeric_limits<int>::max(), false, 
-						   "Stopping criterion: the maximum number of iterations")); 
+	add_parameter("maxiter", make_lc_param(m_options.maxiter, 1, false, 
+						"Stopping criterion: the maximum number of iterations")); 
 	
-	add_parameter("step", new CDoubleParameter(m_options.step, 0.0, HUGE_VAL, false, 
-					 "Initial step size for gradient free methods")); 
-
-	add_parameter("lower", new CDoubleParameter(m_options.min_boundary, -HUGE_VAL, HUGE_VAL, false, 
-					 "Lower boundary (equal for all parameters)")); 
-
-	add_parameter("higher", new CDoubleParameter(m_options.max_boundary, -HUGE_VAL, HUGE_VAL, false, 
-					 "Higher boundary (equal for all parameters)")); 
+	add_parameter("step", make_lc_param(m_options.step, 0.0, false, 
+					     "Initial step size for gradient free methods")); 
+	
+	add_parameter("lower", make_param(m_options.min_boundary, false, "Lower boundary (equal for all parameters)")); 
+	
+	add_parameter("higher", make_param(m_options.max_boundary, false, "Higher boundary (equal for all parameters)")); 
 
 }
 	
diff --git a/addons/nlopt/nlopt.hh b/addons/nlopt/nlopt.hh
index 6b1e369..b5a2deb 100644
--- a/addons/nlopt/nlopt.hh
+++ b/addons/nlopt/nlopt.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/addons/nlopt/test_nlopt.cc b/addons/nlopt/test_nlopt.cc
index 47a544d..36e8212 100644
--- a/addons/nlopt/test_nlopt.cc
+++ b/addons/nlopt/test_nlopt.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/addons/openexr/2dimgexr.cc b/addons/openexr/2dimgexr.cc
index 133522c..5b7134a 100644
--- a/addons/openexr/2dimgexr.cc
+++ b/addons/openexr/2dimgexr.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/addons/openexr/2dvfexr.cc b/addons/openexr/2dvfexr.cc
index 935778c..b3543bf 100644
--- a/addons/openexr/2dvfexr.cc
+++ b/addons/openexr/2dvfexr.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/addons/openexr/CMakeLists.txt b/addons/openexr/CMakeLists.txt
index e4e1408..7ce6bcf 100644
--- a/addons/openexr/CMakeLists.txt
+++ b/addons/openexr/CMakeLists.txt
@@ -1,6 +1,6 @@
 #
 # This file is part of MIA - a toolbox for medical image analysis 
-# Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+# 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
diff --git a/addons/openexr/test_openexr.cc b/addons/openexr/test_openexr.cc
index 2b102e5..1c93d78 100644
--- a/addons/openexr/test_openexr.cc
+++ b/addons/openexr/test_openexr.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -37,8 +37,8 @@ struct PathInitFixture {
 
 PathInitFixture::PathInitFixture()
 {
-	CPathNameArray searchpath;
-	searchpath.push_back(bfs::path("."));
+	CPluginSearchpath searchpath(true);
+	searchpath.add(".");
 
 	C2DImageIOPluginHandler::set_search_path(searchpath);
 	C2DVFIOPluginHandler::set_search_path(searchpath);
diff --git a/addons/png/CMakeLists.txt b/addons/png/CMakeLists.txt
index b7c1897..ddc2b75 100644
--- a/addons/png/CMakeLists.txt
+++ b/addons/png/CMakeLists.txt
@@ -1,6 +1,6 @@
 #
 # This file is part of MIA - a toolbox for medical image analysis 
-# Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+# 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
diff --git a/addons/png/png-gray.cc b/addons/png/png-gray.cc
index 6873b7e..d1bac08 100644
--- a/addons/png/png-gray.cc
+++ b/addons/png/png-gray.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/addons/png/png-rgb.cc b/addons/png/png-rgb.cc
index 6352f5a..070045e 100644
--- a/addons/png/png-rgb.cc
+++ b/addons/png/png-rgb.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/addons/tiff/CMakeLists.txt b/addons/tiff/CMakeLists.txt
index 1faafb9..3a69a43 100644
--- a/addons/tiff/CMakeLists.txt
+++ b/addons/tiff/CMakeLists.txt
@@ -1,6 +1,6 @@
 #
 # This file is part of MIA - a toolbox for medical image analysis 
-# Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+# 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
diff --git a/addons/tiff/tiff.cc b/addons/tiff/tiff.cc
index 9ba1957..c487511 100644
--- a/addons/tiff/tiff.cc
+++ b/addons/tiff/tiff.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/addons/vistaio/2dtrans.cc b/addons/vistaio/2dtrans.cc
index 29410e5..1fc2504 100644
--- a/addons/vistaio/2dtrans.cc
+++ b/addons/vistaio/2dtrans.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/addons/vistaio/2dtrans.hh b/addons/vistaio/2dtrans.hh
index 0dfff0c..45b443b 100644
--- a/addons/vistaio/2dtrans.hh
+++ b/addons/vistaio/2dtrans.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/addons/vistaio/2dvfvistaio.cc b/addons/vistaio/2dvfvistaio.cc
index 6ecfffe..8bbfb1e 100644
--- a/addons/vistaio/2dvfvistaio.cc
+++ b/addons/vistaio/2dvfvistaio.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -131,7 +131,7 @@ const string CVista2DVFIOPlugin::do_get_descr() const
 
 extern "C" EXPORT  CPluginBase *get_plugin_interface()
 {
-	TTranslator<C2DFVector>::register_for("pixel");
+	C2DFVectorTranslator::register_for("pixel");
 	return new CVista2DVFIOPlugin();
 }
 
diff --git a/addons/vistaio/2dvistaio.cc b/addons/vistaio/2dvistaio.cc
index 838d7a9..cf906b2 100644
--- a/addons/vistaio/2dvistaio.cc
+++ b/addons/vistaio/2dvistaio.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -202,7 +202,7 @@ const std::string CVista2DImageIOPlugin::do_get_preferred_suffix() const
 
 extern "C" EXPORT  CPluginBase *get_plugin_interface()
 {
-	TTranslator<C2DFVector>::register_for("pixel");
+	C2DFVectorTranslator::register_for("pixel");
 	return new CVista2DImageIOPlugin();
 }
 
diff --git a/addons/vistaio/2dvistaio.hh b/addons/vistaio/2dvistaio.hh
index 23e8759..353093c 100644
--- a/addons/vistaio/2dvistaio.hh
+++ b/addons/vistaio/2dvistaio.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/addons/vistaio/3dtrans.cc b/addons/vistaio/3dtrans.cc
index c1ea240..f661f6b 100644
--- a/addons/vistaio/3dtrans.cc
+++ b/addons/vistaio/3dtrans.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/addons/vistaio/3dtrans.hh b/addons/vistaio/3dtrans.hh
index 4eb30ec..e584880 100644
--- a/addons/vistaio/3dtrans.hh
+++ b/addons/vistaio/3dtrans.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/addons/vistaio/3dvfvistaio.cc b/addons/vistaio/3dvfvistaio.cc
index 43da611..7cdab10 100644
--- a/addons/vistaio/3dvfvistaio.cc
+++ b/addons/vistaio/3dvfvistaio.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/addons/vistaio/3dvistaio.cc b/addons/vistaio/3dvistaio.cc
index f946c8c..b95ed5a 100644
--- a/addons/vistaio/3dvistaio.cc
+++ b/addons/vistaio/3dvistaio.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/addons/vistaio/3dvistaio.hh b/addons/vistaio/3dvistaio.hh
index 855201b..b6eb007 100644
--- a/addons/vistaio/3dvistaio.hh
+++ b/addons/vistaio/3dvistaio.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/addons/vistaio/CMakeLists.txt b/addons/vistaio/CMakeLists.txt
index ae9c655..80c6871 100644
--- a/addons/vistaio/CMakeLists.txt
+++ b/addons/vistaio/CMakeLists.txt
@@ -1,6 +1,6 @@
 #
 # This file is part of MIA - a toolbox for medical image analysis 
-# Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+# 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
diff --git a/addons/vistaio/test_2dtrans.cc b/addons/vistaio/test_2dtrans.cc
index 33834dc..b9dd08d 100644
--- a/addons/vistaio/test_2dtrans.cc
+++ b/addons/vistaio/test_2dtrans.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -29,7 +29,7 @@ using namespace vista_2dtrans_io;
 
 BOOST_AUTO_TEST_CASE(test_simple_io) 
 {
-	C2DTransformationIOPluginHandler::instance(); 
+	auto& io = C2DTransformationIOPluginHandler::instance(); 
 
         C2DBounds size(4,5); 
         auto tf =  produce_2dtransform_factory("affine");
@@ -47,7 +47,6 @@ BOOST_AUTO_TEST_CASE(test_simple_io)
         t->set_attribute(C2DTransformation::input_spacing_attr, PAttribute(new TAttribute<C2DFVector>(C2DFVector(2,3)))); 
         t->set_attribute(C2DTransformation::output_spacing_attr, PAttribute(new TAttribute<C2DFVector>(C2DFVector(1.1f,1)))); 
         
-        C2DVistaTransformationIO io; 
         
         io.save("transform.v2dt", *t); 
         
diff --git a/addons/vistaio/test_2dvistaio.cc b/addons/vistaio/test_2dvistaio.cc
index fb6956a..b461ec8 100644
--- a/addons/vistaio/test_2dvistaio.cc
+++ b/addons/vistaio/test_2dvistaio.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/addons/vistaio/test_3dtrans.cc b/addons/vistaio/test_3dtrans.cc
index fa98c28..aeddbe6 100644
--- a/addons/vistaio/test_3dtrans.cc
+++ b/addons/vistaio/test_3dtrans.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/addons/vistaio/test_3dvistaio.cc b/addons/vistaio/test_3dvistaio.cc
index b58093b..d269a89 100644
--- a/addons/vistaio/test_3dvistaio.cc
+++ b/addons/vistaio/test_3dvistaio.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/addons/vistaio/test_vista4mia.cc b/addons/vistaio/test_vista4mia.cc
index 0a56c4e..ed91f51 100644
--- a/addons/vistaio/test_vista4mia.cc
+++ b/addons/vistaio/test_vista4mia.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/addons/vistaio/vista4mia.cc b/addons/vistaio/vista4mia.cc
index ec3b7f8..20013e7 100644
--- a/addons/vistaio/vista4mia.cc
+++ b/addons/vistaio/vista4mia.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/addons/vistaio/vista4mia.hh b/addons/vistaio/vista4mia.hh
index 7bc6fda..805e624 100644
--- a/addons/vistaio/vista4mia.hh
+++ b/addons/vistaio/vista4mia.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/addons/vistaio/vistamesh.cc b/addons/vistaio/vistamesh.cc
index 7d792bb..0d00fb3 100644
--- a/addons/vistaio/vistamesh.cc
+++ b/addons/vistaio/vistamesh.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/addons/vtk/CMakeLists.txt b/addons/vtk/CMakeLists.txt
index 0fa0176..a8aa65f 100644
--- a/addons/vtk/CMakeLists.txt
+++ b/addons/vtk/CMakeLists.txt
@@ -1,6 +1,6 @@
 #
 # This file is part of MIA - a toolbox for medical image analysis 
-# Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+# 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
@@ -30,9 +30,13 @@ IF(WITH_VTKIO)
     SET(meshio_path ${PLUGIN_INSTALL_PATH}/mesh/io)
     SET(vfio_path "${PLUGIN_INSTALL_PATH}/3dvf/io")
     SET(imageio_path "${PLUGIN_INSTALL_PATH}/3dimage/io")
-    
 
-    SET(SELECTED_VTK_LIBS ${VTK_MODULES_REQUESTED})
+    IF( ${VTK_VERSION_MAJOR} LESS 6 )
+      SET(SELECTED_VTK_LIBS ${VTK_LIBRARIES})
+    ELSE()
+      SET(SELECTED_VTK_LIBS ${VTK_MODULES_REQUESTED})
+    ENDIF()
+    
     SET(VTK_LINK_LIBS_MESH ${SELECTED_VTK_LIBS} miamesh)
     SET(VTK_LINK_LIBS_3D ${SELECTED_VTK_LIBS} mia3d)
 
diff --git a/addons/vtk/test_vtkimage.cc b/addons/vtk/test_vtkimage.cc
index ca29ccf..5e1818d 100644
--- a/addons/vtk/test_vtkimage.cc
+++ b/addons/vtk/test_vtkimage.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/addons/vtk/test_vtkmesh.cc b/addons/vtk/test_vtkmesh.cc
index 5086042..bc6fe62 100644
--- a/addons/vtk/test_vtkmesh.cc
+++ b/addons/vtk/test_vtkmesh.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/addons/vtk/test_vtkvf.cc b/addons/vtk/test_vtkvf.cc
index 77f770d..4b2af70 100644
--- a/addons/vtk/test_vtkvf.cc
+++ b/addons/vtk/test_vtkvf.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/addons/vtk/vtkimage.cc b/addons/vtk/vtkimage.cc
index 76b9ac9..9dbf165 100644
--- a/addons/vtk/vtkimage.cc
+++ b/addons/vtk/vtkimage.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/addons/vtk/vtkimage.hh b/addons/vtk/vtkimage.hh
index cf79c6b..5d4ca67 100644
--- a/addons/vtk/vtkimage.hh
+++ b/addons/vtk/vtkimage.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/addons/vtk/vtkmesh.cc b/addons/vtk/vtkmesh.cc
index 9f7695c..477ed0c 100644
--- a/addons/vtk/vtkmesh.cc
+++ b/addons/vtk/vtkmesh.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/addons/vtk/vtkmesh.hh b/addons/vtk/vtkmesh.hh
index ff8da16..fc2d231 100644
--- a/addons/vtk/vtkmesh.hh
+++ b/addons/vtk/vtkmesh.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/addons/vtk/vtkvf.cc b/addons/vtk/vtkvf.cc
index 9a0c874..1523aa3 100644
--- a/addons/vtk/vtkvf.cc
+++ b/addons/vtk/vtkvf.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/addons/vtk/vtkvf.hh b/addons/vtk/vtkvf.hh
index 16e4ee5..bb619c6 100644
--- a/addons/vtk/vtkvf.hh
+++ b/addons/vtk/vtkvf.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt
index 82a1ce2..1ac41db 100644
--- a/cmake/CMakeLists.txt
+++ b/cmake/CMakeLists.txt
@@ -1,6 +1,6 @@
 #
 # This file is part of MIA - a toolbox for medical image analysis 
-# Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+# 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
diff --git a/cmake/FindDCMTKnew.cmake b/cmake/FindDCMTKnew.cmake
index c12f0c9..e99a700 100644
--- a/cmake/FindDCMTKnew.cmake
+++ b/cmake/FindDCMTKnew.cmake
@@ -1,5 +1,5 @@
 #
-# Copyright (c) Leipzig, Madrid 1999-2012 Gert Wollny
+# 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
diff --git a/cmake/FindFFTW.cmake b/cmake/FindFFTW.cmake
index 3caa07d..6614c53 100644
--- a/cmake/FindFFTW.cmake
+++ b/cmake/FindFFTW.cmake
@@ -1,5 +1,5 @@
 #
-# Copyright (c) Leipzig, Madrid 1999-2011 Gert Wollny
+# 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
diff --git a/cmake/FindOctave.cmake b/cmake/FindOctave.cmake
index fe4e192..0c5adf2 100644
--- a/cmake/FindOctave.cmake
+++ b/cmake/FindOctave.cmake
@@ -1,5 +1,5 @@
 #
-# Copyright (c) Leipzig, Madrid 1999-2011 Gert Wollny
+# 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
diff --git a/cmake/FindTBB.cmake b/cmake/FindTBB.cmake
index 4dab2d6..edd3100 100644
--- a/cmake/FindTBB.cmake
+++ b/cmake/FindTBB.cmake
@@ -1,5 +1,5 @@
 #
-# Copyright (c) Leipzig, Madrid 1999-2012 Gert Wollny
+# 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
diff --git a/cmake/checkAltivecEnabled.cmake b/cmake/checkAltivecEnabled.cmake
index abe67d9..83c0c86 100644
--- a/cmake/checkAltivecEnabled.cmake
+++ b/cmake/checkAltivecEnabled.cmake
@@ -1,5 +1,5 @@
 #
-# Copyright (c) Leipzig, Madrid 1999-2011 Gert Wollny
+# 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
diff --git a/cmake/checkComplex.cmake b/cmake/checkComplex.cmake
index 969989e..da50e4c 100644
--- a/cmake/checkComplex.cmake
+++ b/cmake/checkComplex.cmake
@@ -1,5 +1,5 @@
 #
-# Copyright (c) Leipzig, Madrid 1999-2011 Gert Wollny
+# 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
diff --git a/cmake/checkCpp0xAuto.cmake b/cmake/checkCpp0xAuto.cmake
index 018bcf5..3505ca5 100644
--- a/cmake/checkCpp0xAuto.cmake
+++ b/cmake/checkCpp0xAuto.cmake
@@ -1,5 +1,5 @@
 #
-# Copyright (c) Leipzig, Madrid 1999-2011 Gert Wollny
+# 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
diff --git a/cmake/checkCpp0xLambda.cmake b/cmake/checkCpp0xLambda.cmake
index 4c44bce..348267e 100644
--- a/cmake/checkCpp0xLambda.cmake
+++ b/cmake/checkCpp0xLambda.cmake
@@ -1,5 +1,5 @@
 #
-# Copyright (c) Leipzig, Madrid 1999-2011 Gert Wollny
+# 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
diff --git a/cmake/checkITPPBoolseparate.cmake b/cmake/checkITPPBoolseparate.cmake
index 54a5e1e..8ba6d7b 100644
--- a/cmake/checkITPPBoolseparate.cmake
+++ b/cmake/checkITPPBoolseparate.cmake
@@ -1,5 +1,5 @@
 #
-# Copyright (c) Leipzig, Madrid 1999-2011 Gert Wollny
+# 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
diff --git a/cmake/checkSSEAttributeVectorCanUseSubscript.cmake b/cmake/checkSSEAttributeVectorCanUseSubscript.cmake
index f8710b1..3af4f93 100644
--- a/cmake/checkSSEAttributeVectorCanUseSubscript.cmake
+++ b/cmake/checkSSEAttributeVectorCanUseSubscript.cmake
@@ -1,5 +1,5 @@
 #
-# Copyright (c) Leipzig, Madrid 1999-2011 Gert Wollny
+# 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
diff --git a/cmake/checkSSEEnabled.cmake b/cmake/checkSSEEnabled.cmake
index 4689494..a854c43 100644
--- a/cmake/checkSSEEnabled.cmake
+++ b/cmake/checkSSEEnabled.cmake
@@ -1,5 +1,5 @@
 #
-# Copyright (c) Leipzig, Madrid 1999-2011 Gert Wollny
+# 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
diff --git a/cmake/macros.cmake b/cmake/macros.cmake
index 907a644..ca47b6a 100644
--- a/cmake/macros.cmake
+++ b/cmake/macros.cmake
@@ -1,5 +1,5 @@
 #
-# Copyright (c) Leipzig, Madrid 1999-2011 Gert Wollny
+# 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
diff --git a/cmake/package.cmake b/cmake/package.cmake
index 1d7d337..0d31b66 100644
--- a/cmake/package.cmake
+++ b/cmake/package.cmake
@@ -1,5 +1,5 @@
 #
-# Copyright (c) Leipzig, Madrid 1999-2011 Gert Wollny
+# 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
diff --git a/cmake/pluginmacro.cmake b/cmake/pluginmacro.cmake
index e813bb2..dce519d 100644
--- a/cmake/pluginmacro.cmake
+++ b/cmake/pluginmacro.cmake
@@ -1,5 +1,5 @@
 #
-# Copyright (c) Leipzig, Madrid 1999-2011 Gert Wollny
+# 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
diff --git a/config.h.cmake b/config.h.cmake
index 54a9254..9470ce9 100644
--- a/config.h.cmake
+++ b/config.h.cmake
@@ -34,6 +34,8 @@
 #cmakedefine HAVE_SYS_IOCTL_H 1
 
 
+#cmakedefine HAVE_MAXFLOW 1
+
 #cmakedefine HAVE_DCMTK 1
 #cmakedefine HAVE_VISTAIO 1
 #cmakedefine HAVE_VTK 1
diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt
index 3f7cd58..03b7091 100644
--- a/doc/CMakeLists.txt
+++ b/doc/CMakeLists.txt
@@ -1,6 +1,6 @@
 #
 # This file is part of MIA - a toolbox for medical image analysis 
-# Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+# 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
diff --git a/doc/MiaDoctools.cmake b/doc/MiaDoctools.cmake
index b9e4ca1..332a5fe 100644
--- a/doc/MiaDoctools.cmake
+++ b/doc/MiaDoctools.cmake
@@ -1,6 +1,6 @@
 #
 # This file is part of MIA - a toolbox for medical image analysis 
-# Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+# 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
@@ -29,8 +29,8 @@ MACRO(MIA_PREPARE_AUTODOC prefix)
     SET(MIA_DOCTOOLS_ROOT "${CMAKE_SOURCE_DIR}/doc")
   ENDIF(NOT MIA_DOCTOOLS_ROOT)
   
-  OPTION(MIA_CREATE_MANPAGES "Create the man pages for the executables (Required Python and python-lxml)" OFF)
-  OPTION(MIA_CREATE_NIPYPE_INTERFACES "Create the nipype interfaces for the executables (Required Python,python-lxml, and nipype)" OFF)
+  OPTION(MIA_CREATE_MANPAGES "Create the man pages for the executables (Required Python and python-lxml), Recommended" ON)
+  OPTION(MIA_CREATE_NIPYPE_INTERFACES "Create the nipype interfaces for the executables (Required Python,python-lxml, and nipype), Recommended" ON)
   
   IF(MIA_CREATE_MANPAGES OR MIA_CREATE_NIPYPE)
     
diff --git a/doc/miahelp.xsd b/doc/miahelp.xsd
index da04d30..07c4ce1 100644
--- a/doc/miahelp.xsd
+++ b/doc/miahelp.xsd
@@ -3,7 +3,7 @@
      This is the scheme describing the XML output of the help-xml
      option. 
      
-     Copyright (c) Leipzig, Madrid 1999-2012 Gert Wollny
+     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
diff --git a/doc/miamyosegmentset.xsd b/doc/miamyosegmentset.xsd
index c0a7b5f..d209612 100644
--- a/doc/miamyosegmentset.xsd
+++ b/doc/miamyosegmentset.xsd
@@ -3,7 +3,7 @@
      This is the scheme describing the storing of 
      manual segmentations of the myocardial perfusion series. 
      
-     Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+     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
diff --git a/doc/miareadxml.py b/doc/miareadxml.py
index d700bb4..9be67c5 100644
--- a/doc/miareadxml.py
+++ b/doc/miareadxml.py
@@ -1,5 +1,5 @@
 #
-# Copyright (c) Leipzig, Madrid 1999-2012 Gert Wollny
+# 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
@@ -91,6 +91,7 @@ class CTextNode:
         self.entry = node.tag
         self.flags = set()
         self.text  = ""
+
         if node.text is not None:
             self.text = self.text + node.text
 
@@ -134,6 +135,14 @@ class COption(CTextNode):
 #        self.required = int(node.get("required")) 
         self.default = node.get("default")
         self.type = node.get("type")
+        self.value_range = None
+       
+        for r in node:
+            if r.tag == "range":
+                self.value_range  = "[" + r.get("min") + ', ' + r.get("max") + "]"
+            if r.tag == "bounded":
+                self.value_range  = r.get("min") + ', ' + r.get("max")
+
 
     def print_man(self):
         if len(self.short) > 0:
@@ -149,10 +158,19 @@ class COption(CTextNode):
                         flagstring = f
                     else:
                         flagstring = flagstring + ', ' + f
-            print ".IP \"%s \-\-%s=(%s)\""% (short, self.long, flagstring)
+            if self.value_range is not None: 
+                print ".IP \"%s \-\-%s=(%s); %s in %s\""% (short, self.long, flagstring, self.type, self.value_range)
+            else:
+                if not self.type == "bool":
+                    print ".IP \"%s \-\-%s=(%s); %s\""% (short, self.long, flagstring, self.type)
+                else:
+                    print ".IP \"%s \-\-%s\""% (short, self.long)
         else:
             if not self.type == "bool":
-                print ".IP \"%s \-\-%s=%s\""% (short, self.long, escape_dash(self.default))
+                if self.value_range is not None: 
+                    print ".IP \"%s \-\-%s=%s; %s in %s\""% (short, self.long, escape_dash(self.default), self.type, self.value_range)
+                else:
+                    print ".IP \"%s \-\-%s=%s\""% (short, self.long, escape_dash(self.default))
             else:
                 print ".IP \"%s \-\-%s\""% (short, self.long)
         print escape_dash(self.text), 
@@ -160,7 +178,7 @@ class COption(CTextNode):
 
 
     def do_print_man(self):
-        print "" 
+            print "" 
 
     def write_xml(self, entry):
         # create the terminal text 
@@ -179,11 +197,16 @@ class COption(CTextNode):
                         first=False
                     else:
                         termtext = termtext + ", " + f
-            termtext = termtext + ")"
+            if self.type is not None: 
+                termtext = termtext + "); " + self.type
+            if self.value_range is not None: 
+                termtext = termtext + " in "  + self.value_range
         elif self.type != "bool":
             termtext = termtext + "="
             if len(self.default)>0:
-                termtext = termtext + self.default
+                termtext = termtext + self.default + "; " + self.type
+            if self.value_range is not None: 
+                termtext = termtext + " in "  + self.value_range
             elif self.type == "string":
                 termtext = termtext + "STRING"
 
@@ -410,9 +433,9 @@ class CParam:
             termtext = termtext + ", %s)"
             print termtext % (self.type)
         elif self.required:
-            print "= (required, %s) " % (self.type)
+            print "= (required); %s " % (self.type)
         else:
-            print "= %s (%s) " % (escape_dash(self.default), self.type)
+            print "= %s; %s " % (escape_dash(self.default), self.type)
         print ".RS 2"
         print "%s." % (escape_dash(self.text))
         self.do_print_man()
@@ -457,22 +480,19 @@ class CParam:
 class CRangeParam(CParam):
     def __init__(self, node):
         CParam.__init__(self,node)
-        self.min = None
-        self.max = None
+        self.value_range = None
         
         for r in node:
             if r.tag == "range":
-                self.min = r.get("min")
-                self.max = r.get("max")
-
-    def do_print_man(self):
-        if (self.min is not None) and (self.max is not None):
-            print "in [%s, %s]" % (escape_dash(self.min), escape_dash(self.max))
-        CParam.do_print_man(self)
+                self.type = self.type + " in [" + r.get("min") + ", " + r.get("max") + "]"
+            if r.tag == "bounded":
+                self.type = self.type + " in " + r.get("min") + ", " + r.get("max")
+                
 
     def do_print_xml_help_description(self, row):
         e = etree.SubElement(row, "entry", align="left", valign="top")
-        e.text = self.text + " in [%s, %s]" % (self.min, self.max)
+        e.text = self.text
+
 
 
 class CDictParam(CParam):
@@ -649,9 +669,9 @@ class CPlugin:
                 table = etree.SubElement(node, "informaltable", frame="all", role="pluginparms", pgwide="1")
                 tgroup = etree.SubElement(table, "tgroup", cols="3", colsep="0", rowsep ="0")
                 colspec = etree.SubElement(tgroup, "colspec", colname="c1", colwidth="10%")
-                colspec = etree.SubElement(tgroup, "colspec", colname="c2", colwidth="10%")
+                colspec = etree.SubElement(tgroup, "colspec", colname="c2", colwidth="20%")
                 colspec = etree.SubElement(tgroup, "colspec", colname="c3", colwidth="10%")
-                colspec = etree.SubElement(tgroup, "colspec", colname="c4", colwidth="70%")
+                colspec = etree.SubElement(tgroup, "colspec", colname="c4", colwidth="60%")
                 thead = etree.SubElement(tgroup, "thead")
                 row = etree.SubElement(thead, "row"); 
                 e = etree.SubElement(row, "entry", align="center", valign="top")
diff --git a/doc/miaxml2man.py b/doc/miaxml2man.py
index f194a5a..77132ac 100644
--- a/doc/miaxml2man.py
+++ b/doc/miaxml2man.py
@@ -1,6 +1,6 @@
 #!/usr/bin/env python 
 #
-# Copyright (c) Leipzig, Madrid 1999-2012 Gert Wollny
+# 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
@@ -71,7 +71,7 @@ def clean (text):
 
 def write_man_file(descr):
     name = escape_dash(descr.name)
-    print ".TH %s 1 \"%s\" \"v%s\"  \"USER COMMANDS\"" %(escape_dash(descr.name), get_date_string(), descr.version)
+    print ".TH %s 1 \"v%s\"  \"USER COMMANDS\"" %(escape_dash(descr.name), descr.version)
     print ".SH NAME"
     print name, 
     print "\- %s" % (clean(descr.whatis))
@@ -140,7 +140,7 @@ def write_man_file(descr):
     print clean(descr.author)
     
     print ".SH COPYRIGHT"
-    print """This software is Copyright (c) 1999\(hy2013 Leipzig, Germany and Madrid, Spain.
+    print """This software is Copyright (c) 1999\(hy2015 Leipzig, Germany and Madrid, Spain.
 It comes  with  ABSOLUTELY  NO WARRANTY  and  you  may redistribute it under the terms of the GNU 
 GENERAL PUBLIC LICENSE Version 3 (or later). For more 
 information run the program with the option '\-\-copyright'."""
diff --git a/doc/miaxml2nipype.py b/doc/miaxml2nipype.py
index 35b6ceb..62a8810 100644
--- a/doc/miaxml2nipype.py
+++ b/doc/miaxml2nipype.py
@@ -1,6 +1,6 @@
 #!/usr/bin/env python 
 #
-# Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+# 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
diff --git a/doc/miaxml2sgml.py b/doc/miaxml2sgml.py
index 7e6ddda..ae0edf7 100644
--- a/doc/miaxml2sgml.py
+++ b/doc/miaxml2sgml.py
@@ -1,6 +1,6 @@
 #!/usr/bin/env python 
 #
-# Copyright (c) Leipzig, Madrid 1999-2012 Gert Wollny
+# 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
diff --git a/doc/reference.dox.cmake b/doc/reference.dox.cmake
index a43c94d..e7188f7 100644
--- a/doc/reference.dox.cmake
+++ b/doc/reference.dox.cmake
@@ -152,4 +152,6 @@ DOT_CLEANUP            = YES
 SEARCHENGINE           = NO
 SHOW_NAMESPACES        = NO
 DOT_GRAPH_MAX_NODES    = 100 
+HTML_TIMESTAMP         = NO
+
 
diff --git a/examples/2d/CMakeLists.txt b/examples/2d/CMakeLists.txt
index 782a0a3..5348a19 100644
--- a/examples/2d/CMakeLists.txt
+++ b/examples/2d/CMakeLists.txt
@@ -1,6 +1,6 @@
 #
 # This file is part of MIA - a toolbox for medical image analysis 
-# Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+# 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
diff --git a/examples/2d/filter/CMakeLists.txt b/examples/2d/filter/CMakeLists.txt
index 231e698..6e1eb0e 100644
--- a/examples/2d/filter/CMakeLists.txt
+++ b/examples/2d/filter/CMakeLists.txt
@@ -1,6 +1,6 @@
 #
 # This file is part of MIA - a toolbox for medical image analysis 
-# Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+# 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
diff --git a/examples/2d/filter/simple.cc b/examples/2d/filter/simple.cc
index 68c4a7c..f574787 100644
--- a/examples/2d/filter/simple.cc
+++ b/examples/2d/filter/simple.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/examples/2d/filter/simple.hh b/examples/2d/filter/simple.hh
index 3e05076..9e3e88f 100644
--- a/examples/2d/filter/simple.hh
+++ b/examples/2d/filter/simple.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/examples/2d/filter/test_simple.cc b/examples/2d/filter/test_simple.cc
index d29335f..a24937a 100644
--- a/examples/2d/filter/test_simple.cc
+++ b/examples/2d/filter/test_simple.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt
index a799b0c..28ac07c 100644
--- a/examples/CMakeLists.txt
+++ b/examples/CMakeLists.txt
@@ -1,6 +1,6 @@
 #
 # This file is part of MIA - a toolbox for medical image analysis 
-# Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+# 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
diff --git a/examples/mia b/examples/mia
deleted file mode 120000
index 945c9b4..0000000
--- a/examples/mia
+++ /dev/null
@@ -1 +0,0 @@
-.
\ No newline at end of file
diff --git a/gsl++/CMakeLists.txt b/gsl++/CMakeLists.txt
index d5bdfe8..17cfd64 100644
--- a/gsl++/CMakeLists.txt
+++ b/gsl++/CMakeLists.txt
@@ -1,6 +1,6 @@
 #
 # This file is part of MIA - a toolbox for medical image analysis 
-# Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+# 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
diff --git a/gsl++/gsldefines.hh b/gsl++/gsldefines.hh
index 69600b5..03f7c51 100644
--- a/gsl++/gsldefines.hh
+++ b/gsl++/gsldefines.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/gsl++/matrix.cc b/gsl++/matrix.cc
index 924bde0..16c7c44 100644
--- a/gsl++/matrix.cc
+++ b/gsl++/matrix.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/gsl++/matrix.hh b/gsl++/matrix.hh
index 3053b81..affa811 100644
--- a/gsl++/matrix.hh
+++ b/gsl++/matrix.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/gsl++/multimin.cc b/gsl++/multimin.cc
index fc424e2..71de56b 100644
--- a/gsl++/multimin.cc
+++ b/gsl++/multimin.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/gsl++/multimin.hh b/gsl++/multimin.hh
index 76258b9..772b1c6 100644
--- a/gsl++/multimin.hh
+++ b/gsl++/multimin.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/gsl++/test_matrix.cc b/gsl++/test_matrix.cc
index 062a44a..6eec42e 100644
--- a/gsl++/test_matrix.cc
+++ b/gsl++/test_matrix.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/gsl++/test_multimin.cc b/gsl++/test_multimin.cc
index 390e942..f2ee1e8 100644
--- a/gsl++/test_multimin.cc
+++ b/gsl++/test_multimin.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/gsl++/test_vector.cc b/gsl++/test_vector.cc
index c7c96d9..a00ab40 100644
--- a/gsl++/test_vector.cc
+++ b/gsl++/test_vector.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/gsl++/vector.cc b/gsl++/vector.cc
index 09e0a17..83350f5 100644
--- a/gsl++/vector.cc
+++ b/gsl++/vector.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/gsl++/vector.hh b/gsl++/vector.hh
index b026d40..47dc6aa 100644
--- a/gsl++/vector.hh
+++ b/gsl++/vector.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/gsl++/vector_dispatch.hh b/gsl++/vector_dispatch.hh
index ec81cca..be774db 100644
--- a/gsl++/vector_dispatch.hh
+++ b/gsl++/vector_dispatch.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/gsl++/vector_template.cxx b/gsl++/vector_template.cxx
index 136a168..756b2aa 100644
--- a/gsl++/vector_template.cxx
+++ b/gsl++/vector_template.cxx
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/gsl++/vector_template.hh b/gsl++/vector_template.hh
index 6fe2020..3b7a961 100644
--- a/gsl++/vector_template.hh
+++ b/gsl++/vector_template.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/gsl++/wavelet.cc b/gsl++/wavelet.cc
index c6135d6..49b2873 100644
--- a/gsl++/wavelet.cc
+++ b/gsl++/wavelet.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/gsl++/wavelet.hh b/gsl++/wavelet.hh
index 0887f9e..6943a31 100644
--- a/gsl++/wavelet.hh
+++ b/gsl++/wavelet.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia.hh b/mia.hh
index fde305c..79d06b2 100644
--- a/mia.hh
+++ b/mia.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d.hh b/mia/2d.hh
index 3236a60..fff3e33 100644
--- a/mia/2d.hh
+++ b/mia/2d.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/CMakeLists.txt b/mia/2d/CMakeLists.txt
index 1b3f30c..8e0c43a 100644
--- a/mia/2d/CMakeLists.txt
+++ b/mia/2d/CMakeLists.txt
@@ -1,6 +1,6 @@
 #
 # This file is part of MIA - a toolbox for medical image analysis 
-# Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+# 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
diff --git a/mia/2d/angle.cc b/mia/2d/angle.cc
index 3d0092d..6c65a5d 100644
--- a/mia/2d/angle.cc
+++ b/mia/2d/angle.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/angle.hh b/mia/2d/angle.hh
index 0a075b4..2380c75 100644
--- a/mia/2d/angle.hh
+++ b/mia/2d/angle.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/boundingbox.cc b/mia/2d/boundingbox.cc
index 0b95946..e73e944 100644
--- a/mia/2d/boundingbox.cc
+++ b/mia/2d/boundingbox.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/boundingbox.hh b/mia/2d/boundingbox.hh
index db25c8c..48d2b19 100644
--- a/mia/2d/boundingbox.hh
+++ b/mia/2d/boundingbox.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/combiner/CMakeLists.txt b/mia/2d/combiner/CMakeLists.txt
index 30fcb66..17064f2 100644
--- a/mia/2d/combiner/CMakeLists.txt
+++ b/mia/2d/combiner/CMakeLists.txt
@@ -1,6 +1,6 @@
 #
 # This file is part of MIA - a toolbox for medical image analysis 
-# Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+# 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
diff --git a/mia/2d/combiner/ops.cc b/mia/2d/combiner/ops.cc
index b0997e3..785d23a 100644
--- a/mia/2d/combiner/ops.cc
+++ b/mia/2d/combiner/ops.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/combiner/ops.hh b/mia/2d/combiner/ops.hh
index 1dad524..1cc11c4 100644
--- a/mia/2d/combiner/ops.hh
+++ b/mia/2d/combiner/ops.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/combiner/plugin.hh b/mia/2d/combiner/plugin.hh
index 51bb946..4520fa1 100644
--- a/mia/2d/combiner/plugin.hh
+++ b/mia/2d/combiner/plugin.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/combiner/test_ops.cc b/mia/2d/combiner/test_ops.cc
index 32699d6..07b307b 100644
--- a/mia/2d/combiner/test_ops.cc
+++ b/mia/2d/combiner/test_ops.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/correlation_weight.cc b/mia/2d/correlation_weight.cc
index ae0004a..9021497 100644
--- a/mia/2d/correlation_weight.cc
+++ b/mia/2d/correlation_weight.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/correlation_weight.hh b/mia/2d/correlation_weight.hh
index 18adb2f..87c9eb4 100644
--- a/mia/2d/correlation_weight.hh
+++ b/mia/2d/correlation_weight.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/cost.cc b/mia/2d/cost.cc
index 95bfe9b..972180d 100644
--- a/mia/2d/cost.cc
+++ b/mia/2d/cost.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/cost.hh b/mia/2d/cost.hh
index 8da76ee..9aa6eb3 100644
--- a/mia/2d/cost.hh
+++ b/mia/2d/cost.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/cost/CMakeLists.txt b/mia/2d/cost/CMakeLists.txt
index 92db5b8..f933399 100644
--- a/mia/2d/cost/CMakeLists.txt
+++ b/mia/2d/cost/CMakeLists.txt
@@ -1,6 +1,6 @@
 #
 # This file is part of MIA - a toolbox for medical image analysis 
-# Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+# 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
diff --git a/mia/2d/cost/gncc.cc b/mia/2d/cost/gncc.cc
new file mode 100644
index 0000000..0cb42e2
--- /dev/null
+++ b/mia/2d/cost/gncc.cc
@@ -0,0 +1,177 @@
+/* -*- mia-c++  -*-
+ *
+ * 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 MIA; if not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#include <mia/2d/cost/gncc.hh>
+
+namespace mia_2d_gncc {
+          
+          
+CGNCC2DImageCost::CGNCC2DImageCost():
+{
+	m_convert_to_float = produce_2dimage_filter("convert:repn=float,map=copy");
+	m_sobel_x = produce_2dimage_filter("sobel:dir=x");
+	m_sobel_y = produce_2dimage_filter("sobel:dir=y");
+	
+}
+
+
+class SumNccPart {
+	SumNccPart(const C2DFImage& mov, const C2DFImage& ref); 
+	NCCSums operator ()(const tbb::blocked_range<size_t>& range, const NCCSums& sumacc) const; 
+private: 
+	const C2DFImage& m_mov; 
+	const C2DFImage& m_ref; 
+}; 
+
+SumNccPart::SumNccPart(const C2DFImage& mov, const C2DFImage& ref):
+	m_mov(mov),
+	m_ref(ref)
+{
+}
+	
+	
+NCCSums SumNccPart::operator ()(const tbb::blocked_range<size_t>& range, const NCCSums& sumacc) const
+{
+	for (auto y = range.begin(); y != range.end(); ++y) {
+		auto iref = m_ref.begin_at(0,y);
+		auto eref = m_ref.begin_at(0,y+1);
+		auto imov = m_mov.begin_at(0,y);
+		
+		while (iref != eref) {
+				nccsum.add(*iref, *imov);
+				++imov, ++iref; 
+		}
+		return sum + sumacc; 	
+	}
+}
+
+double CGNCC2DImageCost::do_value(const mia::C2DImage& a,
+				  const mia::C2DImage& MIA_PARAM_UNUSED(b)) const
+{
+	auto float_image = m_convert_to_float->filter(a);
+	auto agx =  m_sobel_x->filter(*float_image);
+	auto agy =  m_sobel_y->filter(*float_image);
+
+	auto& nagx = dynamic_cast<const C2DFImage&>(*agx);
+	auto& nagy = dynamic_cast<const C2DFImage&>(*agy);
+	
+	SumNccPart sum_part_x(nagx, m_grad_x);
+	SumNccPart sum_part_y(nagy, m_grad_y);
+
+	
+	NCCSums sum; 
+	sum = parallel_reduce(tbb::blocked_range<size_t>(0, mov.get_size().y, 1), sum, sum_part_x, 
+			      [](const NCCSums& x, const NCCSums& y){
+				      return x + y;
+			      });
+
+
+	sum = parallel_reduce(tbb::blocked_range<size_t>(0, mov.get_size().y, 1), sum, sum_part_y, 
+			      [](const NCCSums& x, const NCCSums& y){
+				      return x + y;
+			      });
+	
+	return sum.value(); 
+}       
+
+double CGNCC2DImageCost::do_evaluate_force(const mia::C2DImage& a,
+					   const mia::C2DImage& MIA_PARAM_UNUSED(b),
+					   mia::C2DFVectorfield& force) const
+{
+
+	auto float_image = m_convert_to_float->filter(a);
+	auto agx =  m_sobel_x->filter(*float_image);
+	auto agy =  m_sobel_y->filter(*float_image);
+
+	auto& nagx = dynamic_cast<const C2DFImage&>(*agx);
+	auto& nagy = dynamic_cast<const C2DFImage&>(*agy);
+	
+	SumNccPart sum_part_x(nagx, m_grad_x);
+	SumNccPart sum_part_y(nagy, m_grad_y);
+
+	
+	NCCSums sum_x; 
+	sum_x = parallel_reduce(tbb::blocked_range<size_t>(0, mov.get_size().y, 1), sum_x, sum_part_x, 
+			      [](const NCCSums& x, const NCCSums& y){
+				      return x + y;
+			      });
+
+
+	NCCSums sum_y; 
+	sum_y = parallel_reduce(tbb::blocked_range<size_t>(0, mov.get_size().y, 1), sum_y, sum_part_y, 
+			      [](const NCCSums& x, const NCCSums& y){
+				      return x + y;
+				});
+
+	NCCSums sum = sum_x + sum_y; 
+	double retval = sum.value(); 
+	// from here on we evaluate the gradinet 
+
+	auto x_grad_helper = sum_x.get_grad_helper();
+	auto y_grad_helper = sum_y.get_grad_helper();
+
+	auto ddx = get_gradient(nagx);
+	auto ddy = get_gradient(nagy); 
+
+	auto eval_force = [this, &x_grad_helper, &y_grad_helper, &nagx, & nagy, &ddx, &ddy, &force](const tbb::blocked_range<size_t>& range) -> void {
+		for (auto y = range.begin(); y != range.end(); ++y) {
+			int offs = nagx.get_size().x * y; 
+			for (auto x = 0; x < nagx.get_size().x; ++x, ++offs) {
+				auto g = x_grad_helper.second.get_gradient_scale(nagx[offs], m_grad_x[offs]) * ddx[offs];
+				g += y_grad_helper.second.get_gradient_scale(nagy[offs], m_grad_y[offs]) * ddy[offs];
+				force[offs]  = g; 
+			}
+		}
+	}
+
+	parallel_for(tbb::blocked_range<size_t>(0, a.get_size().y, 1), eval_force);
+
+	return retval; 
+}       
+        
+void CGNCC2DImageCost::post_set_reference(const mia::C2DImage& ref)
+{
+	auto float_image = m_convert_to_float->filter(ref);
+	auto agx =  m_sobel_x->filter(*float_image);
+	auto agy =  m_sobel_y->filter(*float_image);
+	
+	m_grad_x = dynamic_cast<const C2DFImage&>(*agx);
+	m_grad_y = dynamic_cast<const C2DFImage&>(*agy);
+}       
+
+CGNCC2DImageCostPlugin::CGNCC2DImageCostPlugin():
+	mia::C2DImageCostPlugin("gncc")
+{
+}
+
+mia::C2DImageCost *CGNCC2DImageCostPlugin::do_create() const
+{
+	return new CGNCC2DImageCost(); 
+}
+
+
+const std::string CGNCC2DImageCostPlugin::do_get_descr() const
+{
+	return "Implementation of the 2D normalized gradient correlation image similarity measures"; 
+}
+
+
+NS_END(NS)
diff --git a/mia/2d/cost/ncc.hh b/mia/2d/cost/gncc.hh
similarity index 69%
copy from mia/2d/cost/ncc.hh
copy to mia/2d/cost/gncc.hh
index d2be379..4fe1aa9 100644
--- a/mia/2d/cost/ncc.hh
+++ b/mia/2d/cost/gncc.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -18,34 +18,39 @@
  *
  */
 
-#ifndef mia_2d_cost_ncc_hh
-#define mia_2d_cost_ncc_hh
 
 #include <mia/2d/cost.hh>
 
-#define NS mia_2d_ncc
+namespace mia_2d_gncc {
 
-NS_BEGIN(NS)
 
-class CNCC2DImageCost: public mia::C2DImageCost {
+class CGNCC2DImageCost: public mia::C2DImageCost {
 public: 	
 	typedef mia::C2DImageCost::Data Data; 
 	typedef mia::C2DImageCost::Force Force; 
 
-	CNCC2DImageCost();
+	CGNCC2DImageCost();
 private: 
 	virtual double do_value(const Data& a, const Data& b) const; 
-	virtual double do_evaluate_force(const Data& a, const Data& b, Force& force) const; 
+	virtual double do_evaluate_force(const Data& a, const Data& b, Force& force) const;
+        virtual void post_set_reference(const Data& ref);
+
+        P2DImage m_convert_to_float; 
+        P2DImage m_sobel_x;
+        P2DImage m_sobel_y;
+        C2DFImage m_grad_x;
+        C2DFImage m_grad_y;
+        
 };
 
-class CNCC2DImageCostPlugin: public mia::C2DImageCostPlugin {
+class CGNCC2DImageCostPlugin: public mia::C2DImageCostPlugin {
 public: 
-	CNCC2DImageCostPlugin();
+	CGNCC2DImageCostPlugin();
 	mia::C2DImageCost *do_create() const;
 private: 
 	const std::string do_get_descr() const; 
 };
 
-NS_END
+}
 
 #endif 
diff --git a/mia/2d/cost/lncc.cc b/mia/2d/cost/lncc.cc
index d90482d..3fd4d0c 100644
--- a/mia/2d/cost/lncc.cc
+++ b/mia/2d/cost/lncc.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -186,8 +186,8 @@ CLNCC2DImageCostPlugin::CLNCC2DImageCostPlugin():
         C2DImageCostPlugin("lncc"), 
 	m_hw(5)
 {
-	this->add_parameter("w", new CUIntParameter(m_hw, 1, 256, false, 
-						    "half width of the window used for evaluating the localized cross correlation")); 
+	this->add_parameter("w", new CUIBoundedParameter(m_hw, EParameterBounds::bf_closed_interval, {1, 256}, false, 
+							 "half width of the window used for evaluating the localized cross correlation")); 
 }
 
 C2DImageCost *CLNCC2DImageCostPlugin::do_create() const
diff --git a/mia/2d/cost/lncc.hh b/mia/2d/cost/lncc.hh
index 0dbf491..c21346d 100644
--- a/mia/2d/cost/lncc.hh
+++ b/mia/2d/cost/lncc.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/cost/lsd.cc b/mia/2d/cost/lsd.cc
index 827ee02..dd2d044 100644
--- a/mia/2d/cost/lsd.cc
+++ b/mia/2d/cost/lsd.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/cost/lsd.hh b/mia/2d/cost/lsd.hh
index 257d4c4..8cbbaaa 100644
--- a/mia/2d/cost/lsd.hh
+++ b/mia/2d/cost/lsd.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/cost/mi.cc b/mia/2d/cost/mi.cc
index 09265ee..8862a4a 100644
--- a/mia/2d/cost/mi.cc
+++ b/mia/2d/cost/mi.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/cost/mi.hh b/mia/2d/cost/mi.hh
index 9c89c44..3f8cefd 100644
--- a/mia/2d/cost/mi.hh
+++ b/mia/2d/cost/mi.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/cost/ncc.cc b/mia/2d/cost/ncc.cc
index 0fba54c..f3edbbc 100644
--- a/mia/2d/cost/ncc.cc
+++ b/mia/2d/cost/ncc.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/cost/ncc.hh b/mia/2d/cost/ncc.hh
index d2be379..4a435a1 100644
--- a/mia/2d/cost/ncc.hh
+++ b/mia/2d/cost/ncc.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/cost/ngf.cc b/mia/2d/cost/ngf.cc
index e7bf5c5..98c1a35 100644
--- a/mia/2d/cost/ngf.cc
+++ b/mia/2d/cost/ngf.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/cost/ngf.hh b/mia/2d/cost/ngf.hh
index e5c70ef..6a8c7cb 100644
--- a/mia/2d/cost/ngf.hh
+++ b/mia/2d/cost/ngf.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/cost/ssd-automask.cc b/mia/2d/cost/ssd-automask.cc
index fb7e642..8950607 100644
--- a/mia/2d/cost/ssd-automask.cc
+++ b/mia/2d/cost/ssd-automask.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/cost/ssd-automask.hh b/mia/2d/cost/ssd-automask.hh
index d325f8a..82fe637 100644
--- a/mia/2d/cost/ssd-automask.hh
+++ b/mia/2d/cost/ssd-automask.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/cost/ssd.cc b/mia/2d/cost/ssd.cc
index 7ec3925..78feec2 100644
--- a/mia/2d/cost/ssd.cc
+++ b/mia/2d/cost/ssd.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/cost/ssd.hh b/mia/2d/cost/ssd.hh
index 1d1e307..caf4468 100644
--- a/mia/2d/cost/ssd.hh
+++ b/mia/2d/cost/ssd.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/cost/ssd2.cc b/mia/2d/cost/ssd2.cc
index d57102d..bcfa27d 100644
--- a/mia/2d/cost/ssd2.cc
+++ b/mia/2d/cost/ssd2.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/cost/ssd2.hh b/mia/2d/cost/ssd2.hh
index f5f11e5..eb8baf5 100644
--- a/mia/2d/cost/ssd2.hh
+++ b/mia/2d/cost/ssd2.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/cost/ssddf.cc b/mia/2d/cost/ssddf.cc
index a2074e2..a942ed9 100644
--- a/mia/2d/cost/ssddf.cc
+++ b/mia/2d/cost/ssddf.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/cost/test_divcurl.cc b/mia/2d/cost/test_divcurl.cc
index 7497e5b..6d7ad82 100644
--- a/mia/2d/cost/test_divcurl.cc
+++ b/mia/2d/cost/test_divcurl.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/cost/test_ncc.cc b/mia/2d/cost/test_gncc.cc
similarity index 94%
copy from mia/2d/cost/test_ncc.cc
copy to mia/2d/cost/test_gncc.cc
index 8bbad0c..6ab0448 100644
--- a/mia/2d/cost/test_ncc.cc
+++ b/mia/2d/cost/test_gncc.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -28,10 +28,10 @@ using namespace mia;
 
 
 
-BOOST_AUTO_TEST_CASE( test_ncc_zero ) 
+BOOST_AUTO_TEST_CASE( test_gncc_zero ) 
 {
         C2DBounds size(4,4); 
-        auto ncc = BOOST_TEST_create_from_plugin<CNCC2DImageCostPlugin>("ncc");
+        auto ncc = BOOST_TEST_create_from_plugin<CNCC2DImageCostPlugin>("gncc");
         
         C2DFImage a(size); 
         C2DFImage b(size); 
@@ -50,14 +50,13 @@ BOOST_AUTO_TEST_CASE( test_ncc_zero )
         BOOST_CHECK_SMALL(ncc->value(b), 1e-7); 
 
         BOOST_CHECK_SMALL(ncc->value(a), 1e-7); 
-        
-        
 }
 
+
 BOOST_AUTO_TEST_CASE( test_ncc_nonzero ) 
 {
         C2DBounds size(4,4); 
-        auto ncc = BOOST_TEST_create_from_plugin<CNCC2DImageCostPlugin>("ncc");
+        auto ncc = BOOST_TEST_create_from_plugin<CNCC2DImageCostPlugin>("gncc");
         
         C2DFImage a(size); 
         C2DFImage b(size); 
@@ -100,5 +99,3 @@ BOOST_AUTO_TEST_CASE( test_ncc_nonzero )
 		++iag; ++ia2; ++ib2; ++iforce;
 	}
 }
-
-
diff --git a/mia/2d/cost/test_lncc.cc b/mia/2d/cost/test_lncc.cc
index 0442c90..8143ae1 100644
--- a/mia/2d/cost/test_lncc.cc
+++ b/mia/2d/cost/test_lncc.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/cost/test_lsd.cc b/mia/2d/cost/test_lsd.cc
index 4d66be6..f184ce0 100644
--- a/mia/2d/cost/test_lsd.cc
+++ b/mia/2d/cost/test_lsd.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/cost/test_mi.cc b/mia/2d/cost/test_mi.cc
index 2cbbed9..cf553b1 100644
--- a/mia/2d/cost/test_mi.cc
+++ b/mia/2d/cost/test_mi.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/cost/test_ncc.cc b/mia/2d/cost/test_ncc.cc
index 8bbad0c..f475d63 100644
--- a/mia/2d/cost/test_ncc.cc
+++ b/mia/2d/cost/test_ncc.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/cost/test_ngf.cc b/mia/2d/cost/test_ngf.cc
index 01c70d2..87a78f6 100644
--- a/mia/2d/cost/test_ngf.cc
+++ b/mia/2d/cost/test_ngf.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/cost/test_ssd-automask.cc b/mia/2d/cost/test_ssd-automask.cc
index ea8121a..367ca88 100644
--- a/mia/2d/cost/test_ssd-automask.cc
+++ b/mia/2d/cost/test_ssd-automask.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/cost/test_ssd.cc b/mia/2d/cost/test_ssd.cc
index 98a69bd..caf602e 100644
--- a/mia/2d/cost/test_ssd.cc
+++ b/mia/2d/cost/test_ssd.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/cost/test_ssd2.cc b/mia/2d/cost/test_ssd2.cc
index ab440e7..3d2d21b 100644
--- a/mia/2d/cost/test_ssd2.cc
+++ b/mia/2d/cost/test_ssd2.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/creator.cc b/mia/2d/creator.cc
index fd98655..4ac1972 100644
--- a/mia/2d/creator.cc
+++ b/mia/2d/creator.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/creator.hh b/mia/2d/creator.hh
index 4dc300c..4ae1e30 100644
--- a/mia/2d/creator.hh
+++ b/mia/2d/creator.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/creator/CMakeLists.txt b/mia/2d/creator/CMakeLists.txt
index 7c2aae3..107b48f 100644
--- a/mia/2d/creator/CMakeLists.txt
+++ b/mia/2d/creator/CMakeLists.txt
@@ -1,6 +1,6 @@
 #
 # This file is part of MIA - a toolbox for medical image analysis 
-# Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+# 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
diff --git a/mia/2d/creator/circle.cc b/mia/2d/creator/circle.cc
index 6855e97..a5c262b 100644
--- a/mia/2d/creator/circle.cc
+++ b/mia/2d/creator/circle.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -130,8 +130,8 @@ C2DCircleCreatorPlugin::C2DCircleCreatorPlugin():
 	m_f(1.0),
 	m_p(2.0)
 {
-	add_parameter("f", new CFloatParameter(m_f, 0, 10, false, "spherical change frequency"));
-	add_parameter("p", new CFloatParameter(m_p, 0.1, 100, false, "spherical shape parameter (2.0 = circle)"));
+	add_parameter("f", make_ci_param(m_f, 0.0f, 10.0f, false, "spherical change frequency"));
+	add_parameter("p", make_ci_param(m_p, 0.1f, 100.0f, false, "spherical shape parameter (2.0 = circle)"));
 }
 
 C2DImageCreator *C2DCircleCreatorPlugin::do_create()const
diff --git a/mia/2d/cstkernel.cc b/mia/2d/cstkernel.cc
index 97e9db7..652663b 100644
--- a/mia/2d/cstkernel.cc
+++ b/mia/2d/cstkernel.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/cstkernel.hh b/mia/2d/cstkernel.hh
index 1c2ea49..2bf5e0f 100644
--- a/mia/2d/cstkernel.hh
+++ b/mia/2d/cstkernel.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/datafield.cc b/mia/2d/datafield.cc
index b2cf4a5..0cd8344 100644
--- a/mia/2d/datafield.cc
+++ b/mia/2d/datafield.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -22,6 +22,7 @@
 #include <mia/2d/datafield.cxx>
 #include <mia/2d/iterator.cxx>
 #include <mia/core/parameter.cxx>
+#include <mia/core/attributes.cxx>
 
 NS_MIA_BEGIN
 
@@ -51,10 +52,11 @@ INSTANCIATE(signed char);
 
 DEFINE_TYPE_DESCR2(C2DBounds, "2dbounds"); 
 DEFINE_TYPE_DESCR2(C2DFVector, "2dfvector"); 
-template class EXPORT_2D  CTParameter<C2DFVector>;
-template class EXPORT_2D  CTParameter<C2DBounds>;
 
 
+template class EXPORT_2D  CTParameter<C2DFVector>;
+template class EXPORT_2D  CTParameter<C2DBounds>;
+template class EXPORT_2D  TTranslator<C2DFVector>; 
 
 NS_MIA_END
 
diff --git a/mia/2d/datafield.cxx b/mia/2d/datafield.cxx
index 19aaf19..ebdde2a 100644
--- a/mia/2d/datafield.cxx
+++ b/mia/2d/datafield.cxx
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/datafield.hh b/mia/2d/datafield.hh
index d414566..80e0cd7 100644
--- a/mia/2d/datafield.hh
+++ b/mia/2d/datafield.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -30,6 +30,7 @@
 #include <mia/2d/vector.hh>
 #include <mia/2d/iterator.hh>
 #include <mia/core/parameter.hh>
+#include <mia/core/attributes.hh>
 #include <mia/core/typedescr.hh>
 #include <miaconfig.h>
 
@@ -334,7 +335,12 @@ typedef  CTParameter<C2DBounds> C2DBoundsParameter;
 /// Parameter type for 2D vector
 typedef CTParameter<C2DFVector> C2DFVectorParameter; 
 
+/// typedef for the C2DFVector to std::string translator 
+typedef TTranslator<C2DFVector> C2DFVectorTranslator;
+
 /// @cond NEVER 
+
+
 DECLARE_TYPE_DESCR(C2DBounds);
 DECLARE_TYPE_DESCR(C2DFVector); 
 /// @endcond
diff --git a/mia/2d/defines2d.hh b/mia/2d/defines2d.hh
index 66f96fa..49d2444 100644
--- a/mia/2d/defines2d.hh
+++ b/mia/2d/defines2d.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/deformer.hh b/mia/2d/deformer.hh
index 793bfed..607ae17 100644
--- a/mia/2d/deformer.hh
+++ b/mia/2d/deformer.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/distance.cc b/mia/2d/distance.cc
index da212b2..79394a0 100644
--- a/mia/2d/distance.cc
+++ b/mia/2d/distance.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/distance.hh b/mia/2d/distance.hh
index ae5dd6e..e80ada5 100644
--- a/mia/2d/distance.hh
+++ b/mia/2d/distance.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/distances.cc b/mia/2d/distances.cc
index 3e06864..b9568e1 100644
--- a/mia/2d/distances.cc
+++ b/mia/2d/distances.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/fft/CMakeLists.txt b/mia/2d/fft/CMakeLists.txt
index b457f31..09aa816 100644
--- a/mia/2d/fft/CMakeLists.txt
+++ b/mia/2d/fft/CMakeLists.txt
@@ -1,5 +1,5 @@
 #
-# Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+# 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
@@ -19,7 +19,7 @@
 #
 #
 # This file is part of MIA - a toolbox for medical image analysis 
-# Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+# 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
diff --git a/mia/2d/fftkernel.cc b/mia/2d/fftkernel.cc
index dba8f3c..6c619cd 100644
--- a/mia/2d/fftkernel.cc
+++ b/mia/2d/fftkernel.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/fftkernel.hh b/mia/2d/fftkernel.hh
index 49c1409..50433fa 100644
--- a/mia/2d/fftkernel.hh
+++ b/mia/2d/fftkernel.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/filter.cc b/mia/2d/filter.cc
index 6ab7bcb..cfc0b3c 100644
--- a/mia/2d/filter.cc
+++ b/mia/2d/filter.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/filter.hh b/mia/2d/filter.hh
index 99a5e7a..c030c51 100644
--- a/mia/2d/filter.hh
+++ b/mia/2d/filter.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/filter/CMakeLists.txt b/mia/2d/filter/CMakeLists.txt
index b16c6b4..9ed3278 100644
--- a/mia/2d/filter/CMakeLists.txt
+++ b/mia/2d/filter/CMakeLists.txt
@@ -1,6 +1,6 @@
 #
 # This file is part of MIA - a toolbox for medical image analysis 
-# Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+# 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
diff --git a/mia/2d/filter/adaptmed.cc b/mia/2d/filter/adaptmed.cc
index 704b9f8..f39d924 100644
--- a/mia/2d/filter/adaptmed.cc
+++ b/mia/2d/filter/adaptmed.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -135,8 +135,7 @@ C2DAdaptMedianImageFilterFactory::C2DAdaptMedianImageFilterFactory():
 	C2DFilterPlugin(plugin_name), 
 	m_hw(2)
 {
-	add_parameter("w", new CIntParameter(m_hw, 0, numeric_limits<int>::max(),
-					     false, "half filter width"));
+	add_parameter("w", make_lc_param(m_hw, 1, false, "half filter width"));
 }
 
 C2DFilter *C2DAdaptMedianImageFilterFactory::do_create()const
diff --git a/mia/2d/filter/adaptmed.hh b/mia/2d/filter/adaptmed.hh
index 256cc15..0c38630 100644
--- a/mia/2d/filter/adaptmed.hh
+++ b/mia/2d/filter/adaptmed.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/filter/admean.cc b/mia/2d/filter/admean.cc
index 29ef545..3f76ed4 100644
--- a/mia/2d/filter/admean.cc
+++ b/mia/2d/filter/admean.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -92,8 +92,7 @@ CAdmean2DImageFilterFactory::CAdmean2DImageFilterFactory() :
 		C2DFilterPlugin ( plugin_name ),
 		m_hwidth ( 1 )
 {
-	add_parameter("w", new CIntParameter(m_hwidth, 0, numeric_limits<int>::max(),
-					     false, "half filter width"));
+	add_parameter("w", make_lc_param(m_hwidth, 1, false, "half filter width"));
 }
 
 C2DFilter *CAdmean2DImageFilterFactory::do_create()const
diff --git a/mia/2d/filter/admean.hh b/mia/2d/filter/admean.hh
index 1f90b50..b205561 100644
--- a/mia/2d/filter/admean.hh
+++ b/mia/2d/filter/admean.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/filter/aniso.cc b/mia/2d/filter/aniso.cc
index bc7c0e8..261408b 100644
--- a/mia/2d/filter/aniso.cc
+++ b/mia/2d/filter/aniso.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -287,13 +287,11 @@ CAnisoDiff2DImageFilterFactory::CAnisoDiff2DImageFilterFactory():
 	TRACE("CAnisoDiff2DImageFilterFactory::CAnisoDiff2DImageFilterFactory()");
 	cvdebug() << "CAnisoDiff2DImageFilterFactory::CAnisoDiff2DImageFilterFactory()\n";
 
-	add_parameter("iter", new CIntParameter(m_maxiter, 1, 10000, false,  "number of iterations"));
-
-	add_parameter("epsilon", new CFloatParameter(m_epsilon,
-						     0.001, 100, false,  "iteration change threshold"));
-	add_parameter("k", new CFloatParameter(m_k, 0, 100, false,
-					       "k the noise threshold (<=0 -> adaptive)"));
+	add_parameter("iter", make_ci_param(m_maxiter, 1, 10000, false,  "number of iterations"));
 
+	add_parameter("epsilon", make_positive_param(m_epsilon, false,  "iteration change threshold"));
+	add_parameter("k", make_ci_param(m_k, 0.0f, 100.0f, false, "k the noise threshold (<=0 -> adaptive)"));
+	
 	add_parameter("psi", new CDictParameter<C2DAnisoDiff::FEdgeStopping>(m_edge_stop, edge_stop_table,
 							       "edge stopping function"));
 
diff --git a/mia/2d/filter/aniso.hh b/mia/2d/filter/aniso.hh
index 6ffe744..6b5e8e4 100644
--- a/mia/2d/filter/aniso.hh
+++ b/mia/2d/filter/aniso.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/filter/bandpass.cc b/mia/2d/filter/bandpass.cc
index 06d884b..fcd972d 100644
--- a/mia/2d/filter/bandpass.cc
+++ b/mia/2d/filter/bandpass.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/filter/bandpass.hh b/mia/2d/filter/bandpass.hh
index b5c2092..773f80e 100644
--- a/mia/2d/filter/bandpass.hh
+++ b/mia/2d/filter/bandpass.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/filter/binarize.cc b/mia/2d/filter/binarize.cc
index a336001..5a7d43f 100644
--- a/mia/2d/filter/binarize.cc
+++ b/mia/2d/filter/binarize.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/filter/binarize.hh b/mia/2d/filter/binarize.hh
index 0c6affe..9f3103c 100644
--- a/mia/2d/filter/binarize.hh
+++ b/mia/2d/filter/binarize.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/filter/classmap.cc b/mia/2d/filter/classmap.cc
index 24017a0..53b0f28 100644
--- a/mia/2d/filter/classmap.cc
+++ b/mia/2d/filter/classmap.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/filter/combiner.cc b/mia/2d/filter/combiner.cc
index 81fce58..e6eef98 100644
--- a/mia/2d/filter/combiner.cc
+++ b/mia/2d/filter/combiner.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/filter/combiner.hh b/mia/2d/filter/combiner.hh
index 70040ca..ad97a6e 100644
--- a/mia/2d/filter/combiner.hh
+++ b/mia/2d/filter/combiner.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/filter/convert.cc b/mia/2d/filter/convert.cc
index 8005ced..4b3c124 100644
--- a/mia/2d/filter/convert.cc
+++ b/mia/2d/filter/convert.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/filter/convert.hh b/mia/2d/filter/convert.hh
index d8166f6..f19a6aa 100644
--- a/mia/2d/filter/convert.hh
+++ b/mia/2d/filter/convert.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/filter/crop.cc b/mia/2d/filter/crop.cc
index b34f6e1..9cd81b0 100644
--- a/mia/2d/filter/crop.cc
+++ b/mia/2d/filter/crop.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -36,7 +36,7 @@ typename C2DCrop::result_type C2DCrop::operator () (const Data2D& data) const
 	TRACE("C2DCrop::operator ()");
 
 
-	C2DSize end = m_size;
+	C2DSize end = m_end;
 	if (end.x == -1)
 		end.x = data.get_size().x;
 	if (end.y == -1)
@@ -58,6 +58,7 @@ typename C2DCrop::result_type C2DCrop::operator () (const Data2D& data) const
 	if (!result) {
 		throw runtime_error("crop2d: unable to allocate image");
 	}
+	result->set_origin(C2DFVector(m_start) * data.get_pixel_size());
 
 	size_t read_start_x = m_start.x < 0 ? 0 : m_start.x;
 	size_t write_start_x = m_start.x < 0 ? - m_start.x : 0;
diff --git a/mia/2d/filter/crop.hh b/mia/2d/filter/crop.hh
index d95e59c..380ac05 100644
--- a/mia/2d/filter/crop.hh
+++ b/mia/2d/filter/crop.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -29,9 +29,9 @@ NS_BEGIN(crop_2dimage_filter)
 class C2DCrop: public mia::C2DFilter {
 public:
 	typedef mia::T2DVector<int> C2DSize;
-	C2DCrop(const C2DSize & start, const C2DSize& size):
+	C2DCrop(const C2DSize & start, const C2DSize& end):
 		m_start(start),
-		m_size(size)
+		m_end(end)
 	{
 	}
 
@@ -41,7 +41,7 @@ public:
 private:
 	virtual mia::P2DImage do_filter(const mia::C2DImage& image) const;
 	C2DSize m_start;
-	C2DSize m_size;
+	C2DSize m_end;
 
 };
 
diff --git a/mia/2d/filter/cst.cc b/mia/2d/filter/cst.cc
index 3fea92a..9b0999c 100644
--- a/mia/2d/filter/cst.cc
+++ b/mia/2d/filter/cst.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/filter/cst.hh b/mia/2d/filter/cst.hh
index 0a70195..f4c39c8 100644
--- a/mia/2d/filter/cst.hh
+++ b/mia/2d/filter/cst.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/filter/distance.cc b/mia/2d/filter/distance.cc
index d9c7006..3f134d5 100644
--- a/mia/2d/filter/distance.cc
+++ b/mia/2d/filter/distance.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/filter/distance.hh b/mia/2d/filter/distance.hh
index a76b35b..e914155 100644
--- a/mia/2d/filter/distance.hh
+++ b/mia/2d/filter/distance.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/filter/downscale.cc b/mia/2d/filter/downscale.cc
index 38877f5..323cf09 100644
--- a/mia/2d/filter/downscale.cc
+++ b/mia/2d/filter/downscale.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -101,13 +101,9 @@ C2DDownscaleFilterPlugin::C2DDownscaleFilterPlugin():
 	m_b(1,1), 
 	m_filter("gauss")
 {
-	add_parameter("bx", new CUIntParameter(m_b.x, 1,
-					      numeric_limits<int>::max(), false,
-					      "blocksize in x direction"));
+	add_parameter("bx", make_lc_param(m_b.x, 1u, false, "blocksize in x direction"));
 
-	add_parameter("by", new CUIntParameter(m_b.y, 1,
-					      numeric_limits<int>::max(), false,
-					      "blocksize in y direction"));
+	add_parameter("by", make_lc_param(m_b.y, 1u, false, "blocksize in y direction"));
 
 	add_parameter("b", new C2DBoundsParameter(m_b, false, "blocksize"));
 
diff --git a/mia/2d/filter/downscale.hh b/mia/2d/filter/downscale.hh
index 964f890..4100e8a 100644
--- a/mia/2d/filter/downscale.hh
+++ b/mia/2d/filter/downscale.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/filter/fft.cc b/mia/2d/filter/fft.cc
index 8641b1b..088c4f2 100644
--- a/mia/2d/filter/fft.cc
+++ b/mia/2d/filter/fft.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/filter/fft.hh b/mia/2d/filter/fft.hh
index bd3262f..896246d 100644
--- a/mia/2d/filter/fft.hh
+++ b/mia/2d/filter/fft.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/filter/frequency.cc b/mia/2d/filter/frequency.cc
index ca35ff7..ea91354 100644
--- a/mia/2d/filter/frequency.cc
+++ b/mia/2d/filter/frequency.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/filter/gradnorm.cc b/mia/2d/filter/gradnorm.cc
index 83f124a..b3f777b 100644
--- a/mia/2d/filter/gradnorm.cc
+++ b/mia/2d/filter/gradnorm.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/filter/gradnorm.hh b/mia/2d/filter/gradnorm.hh
index be28a04..e6ffec9 100644
--- a/mia/2d/filter/gradnorm.hh
+++ b/mia/2d/filter/gradnorm.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/filter/harmmean.cc b/mia/2d/filter/harmmean.cc
index e9fe6d5..0c67bc0 100644
--- a/mia/2d/filter/harmmean.cc
+++ b/mia/2d/filter/harmmean.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/filter/ianiso.cc b/mia/2d/filter/ianiso.cc
index 913ca34..4201691 100644
--- a/mia/2d/filter/ianiso.cc
+++ b/mia/2d/filter/ianiso.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/filter/invert.cc b/mia/2d/filter/invert.cc
index b145d4e..50e6421 100644
--- a/mia/2d/filter/invert.cc
+++ b/mia/2d/filter/invert.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/filter/invert.hh b/mia/2d/filter/invert.hh
index 0e23c74..56861de 100644
--- a/mia/2d/filter/invert.hh
+++ b/mia/2d/filter/invert.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/filter/kmeans.cc b/mia/2d/filter/kmeans.cc
index 7ad03be..eb6dedf 100644
--- a/mia/2d/filter/kmeans.cc
+++ b/mia/2d/filter/kmeans.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -63,8 +63,7 @@ C2DKMeansFilterPluginFactory::C2DKMeansFilterPluginFactory():
 	C2DFilterPlugin("kmeans"),
 	m_classes(3)
 {
-	add_parameter("c", new CIntParameter(m_classes, 2, numeric_limits<unsigned char>::max(),
-					     false, "number of classes"));
+	add_parameter("c", make_lc_param(m_classes, 2, false, "number of classes"));
 }
 
 C2DFilter *C2DKMeansFilterPluginFactory::do_create()const
diff --git a/mia/2d/filter/kmeans.hh b/mia/2d/filter/kmeans.hh
index c5345f2..f8d6afe 100644
--- a/mia/2d/filter/kmeans.hh
+++ b/mia/2d/filter/kmeans.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/filter/kuwahara.cc b/mia/2d/filter/kuwahara.cc
index 3364675..9b9960e 100644
--- a/mia/2d/filter/kuwahara.cc
+++ b/mia/2d/filter/kuwahara.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/filter/label.cc b/mia/2d/filter/label.cc
index aed7ef3..0074b6c 100644
--- a/mia/2d/filter/label.cc
+++ b/mia/2d/filter/label.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/filter/label.hh b/mia/2d/filter/label.hh
index 8c26324..9b4494c 100644
--- a/mia/2d/filter/label.hh
+++ b/mia/2d/filter/label.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/filter/labelmap.cc b/mia/2d/filter/labelmap.cc
index ad8c29a..98ccce5 100644
--- a/mia/2d/filter/labelmap.cc
+++ b/mia/2d/filter/labelmap.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -23,79 +23,17 @@
 #include <fstream>
 #include <mia/2d/filter/labelmap.hh>
 
-NS_BEGIN(labelmap_2dimage_filter)
-NS_MIA_USE;
-using namespace std; 
+#include <mia/template/labelmap.cxx>
 
-C2DLabelMapFilter::C2DLabelMapFilter(const CLabelMap& lmap):
-	m_map(std::numeric_limits<unsigned short>::max())
-{
-	for (size_t i = 0; i < m_map.size(); ++i)
-		m_map[i] = i; 
-	
-	for (CLabelMap::const_iterator i = lmap.begin(), e = lmap.end(); 
-	     i != e; ++i)
-		m_map[i->first] = i->second; 
-}
-
-
-
-P2DImage C2DLabelMapFilter::do_filter(const C2DImage& image) const
-{
-	return mia::filter(*this, image); 
-}
-
-template <typename T> 
-struct dispatch_label_map {
-	static P2DImage apply(const T& /*image*/, const vector<size_t>& /*lmap*/){
-		throw invalid_argument("Only unsigned short images are supported"); 
-	}
-};
-
-template <> 
-struct dispatch_label_map<C2DUSImage> {
-	static P2DImage apply(const C2DUSImage& image, const vector<size_t>& lmap){
-		C2DUSImage *result = new C2DUSImage(image.get_size(), image); 
-		transform(image.begin(), image.end(), result->begin(), 
-			  [&lmap](unsigned short x){ return lmap[x]; });
-		return P2DImage(result); 
-	}
-};
+NS_MIA_BEGIN
 
-template <class Data2D>
-typename C2DLabelMapFilter::result_type C2DLabelMapFilter::operator () (const Data2D& data) const
-{
-	return dispatch_label_map<Data2D>::apply(data, m_map); 
-	
-}
-
-C2DLabelMapFilterPlugin::C2DLabelMapFilterPlugin():
-	C2DFilterPlugin("labelmap")
-{
-	add_parameter("map", new CStringParameter(m_map, CCmdOptionFlags::required_input, "Label mapping file")) ;
-}
-
-
-C2DFilter *C2DLabelMapFilterPlugin::do_create() const
-{
-	ifstream is(m_map.c_str()); 
-
-	if (!is.good())
-		throw create_exception<runtime_error>("C2DLabelMapFilterPlugin::load_label_map:"
-					    "Unable to open file '", m_map, "'"); 
-	
-	CLabelMap map(is);
-	return new C2DLabelMapFilter(map); 
-}
-
-const string C2DLabelMapFilterPlugin::do_get_descr()const
-{
-	return "2D image filter to remap label id's."; 
-}
+template class TLabelMapFilter<C2DImage>;  
+template class TLabelMapFilterPlugin<C2DImage>;  
 
 extern "C" EXPORT CPluginBase *get_plugin_interface()
 {
 	return new C2DLabelMapFilterPlugin(); 
 }
 
-NS_END
+
+NS_MIA_END
diff --git a/mia/2d/filter/labelmap.hh b/mia/2d/filter/labelmap.hh
index 9d7ad63..68aca75 100644
--- a/mia/2d/filter/labelmap.hh
+++ b/mia/2d/filter/labelmap.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -20,30 +20,11 @@
 
 #include <mia/2d/filter.hh>
 #include <mia/core/labelmap.hh>
+#include <mia/template/labelmap.hh>
 
-NS_BEGIN(labelmap_2dimage_filter)
-      
-class C2DLabelMapFilter: public mia::C2DFilter {
-	std::vector<size_t>  m_map;
-public:
-	C2DLabelMapFilter(const mia::CLabelMap& lmap); 
-	
-	template <class Data2D>
-	typename C2DLabelMapFilter::result_type operator () (const Data2D& data) const ;
+NS_MIA_BEGIN
 
-private: 
-	virtual mia::P2DImage do_filter(const mia::C2DImage& image) const;
+typedef TLabelMapFilter<C2DImage> C2DLabelMapFilter;  
+typedef TLabelMapFilterPlugin<C2DImage> C2DLabelMapFilterPlugin;  
 
-};
-
-class C2DLabelMapFilterPlugin: public mia::C2DFilterPlugin {
-public: 
-	C2DLabelMapFilterPlugin();
-	virtual mia::C2DFilter *do_create()const; 
-	virtual const std::string do_get_descr()const; 
-
-private: 
-	std::string m_map; 
-};
-
-NS_END
+NS_MIA_END
diff --git a/mia/2d/filter/labelscale.cc b/mia/2d/filter/labelscale.cc
index e171a95..af51ebe 100644
--- a/mia/2d/filter/labelscale.cc
+++ b/mia/2d/filter/labelscale.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/filter/labelscale.hh b/mia/2d/filter/labelscale.hh
index 4d9f158..29db0b6 100644
--- a/mia/2d/filter/labelscale.hh
+++ b/mia/2d/filter/labelscale.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/filter/lnfft.cc b/mia/2d/filter/lnfft.cc
index 50bc807..ffdff9c 100644
--- a/mia/2d/filter/lnfft.cc
+++ b/mia/2d/filter/lnfft.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/filter/load.cc b/mia/2d/filter/load.cc
index 01208c4..0c0f3de 100644
--- a/mia/2d/filter/load.cc
+++ b/mia/2d/filter/load.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/filter/load.hh b/mia/2d/filter/load.hh
index e68959e..661510a 100644
--- a/mia/2d/filter/load.hh
+++ b/mia/2d/filter/load.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/filter/mask.cc b/mia/2d/filter/mask.cc
index feb4174..751fba2 100644
--- a/mia/2d/filter/mask.cc
+++ b/mia/2d/filter/mask.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/filter/mask.hh b/mia/2d/filter/mask.hh
index 7cce737..0165b70 100644
--- a/mia/2d/filter/mask.hh
+++ b/mia/2d/filter/mask.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/filter/mean.cc b/mia/2d/filter/mean.cc
index 2e1e29e..3840668 100644
--- a/mia/2d/filter/mean.cc
+++ b/mia/2d/filter/mean.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -124,7 +124,7 @@ C2DMeanFilterPlugin::C2DMeanFilterPlugin():
 	C2DFilterPlugin("mean"), 
 	m_hw(1)
 {
-	add_parameter("w", new CIntParameter(m_hw, 0, numeric_limits<int>::max(), false, "half filter width"));
+	add_parameter("w", make_lc_param(m_hw, 1, false, "half filter width"));
 }
 
 C2DFilter *C2DMeanFilterPlugin::do_create()const
diff --git a/mia/2d/filter/mean.hh b/mia/2d/filter/mean.hh
index 93273dd..1e94c7b 100644
--- a/mia/2d/filter/mean.hh
+++ b/mia/2d/filter/mean.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/filter/median.cc b/mia/2d/filter/median.cc
index f4ec78e..04e0c58 100644
--- a/mia/2d/filter/median.cc
+++ b/mia/2d/filter/median.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -104,7 +104,7 @@ C2DMedianFilterPluginFactory::C2DMedianFilterPluginFactory():
 	C2DFilterPlugin("median"),
 	m_hw(1)
 {
-	add_parameter("w", new CIntParameter(m_hw, 0, numeric_limits<int>::max(), false, "half filter width"));
+	add_parameter("w", make_lc_param(m_hw, 1, false, "half filter width"));
 }
 
 C2DFilter *C2DMedianFilterPluginFactory::do_create()const
@@ -158,8 +158,8 @@ C2DSaltAndPepperFilterFactory::C2DSaltAndPepperFilterFactory():
 	m_hw(1),
 	m_thresh(100)
 {
-	add_parameter("w", new CIntParameter(m_hw, 0, numeric_limits<int>::max(), false, "filter width parameter"));
-	add_parameter("thresh", new CFloatParameter(m_thresh, 0, numeric_limits<float>::max(), false, "thresh value"));
+	add_parameter("w", make_lc_param(m_hw, 1, false, "filter width parameter"));
+	add_parameter("thresh", make_lo_param(m_thresh, 0.0f, false, "thresh value"));
 }
 
 C2DFilter *C2DSaltAndPepperFilterFactory::do_create()const
diff --git a/mia/2d/filter/median.hh b/mia/2d/filter/median.hh
index 4e92dc1..2ae8947 100644
--- a/mia/2d/filter/median.hh
+++ b/mia/2d/filter/median.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/filter/midpoint.cc b/mia/2d/filter/midpoint.cc
index 65c9252..c805577 100644
--- a/mia/2d/filter/midpoint.cc
+++ b/mia/2d/filter/midpoint.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/filter/mlv.cc b/mia/2d/filter/mlv.cc
index 65a3a41..b8098f0 100644
--- a/mia/2d/filter/mlv.cc
+++ b/mia/2d/filter/mlv.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -273,7 +273,7 @@ C2DMLVImageFilterFactory::C2DMLVImageFilterFactory():
 	C2DFilterPlugin("mlv"),
 	m_hw(1)
 {
-	add_parameter("w", new CIntParameter(m_hw, 0, numeric_limits<int>::max(), false, "filter width parameter"));
+	add_parameter("w", make_lc_param(m_hw, 1, false, "filter width parameter"));
 }
 
 C2DFilter *C2DMLVImageFilterFactory::do_create()const
diff --git a/mia/2d/filter/mlv.hh b/mia/2d/filter/mlv.hh
index 2be2048..97a6079 100644
--- a/mia/2d/filter/mlv.hh
+++ b/mia/2d/filter/mlv.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/filter/morphological.cc b/mia/2d/filter/morphological.cc
index f302019..80f9e97 100644
--- a/mia/2d/filter/morphological.cc
+++ b/mia/2d/filter/morphological.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/filter/morphological.hh b/mia/2d/filter/morphological.hh
index f74d9db..ab05ad2 100644
--- a/mia/2d/filter/morphological.hh
+++ b/mia/2d/filter/morphological.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/filter/ngfnorm.cc b/mia/2d/filter/ngfnorm.cc
index 38406ec..db7cab2 100644
--- a/mia/2d/filter/ngfnorm.cc
+++ b/mia/2d/filter/ngfnorm.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/filter/ngfnorm.hh b/mia/2d/filter/ngfnorm.hh
index 724435e..772f136 100644
--- a/mia/2d/filter/ngfnorm.hh
+++ b/mia/2d/filter/ngfnorm.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/filter/noise.cc b/mia/2d/filter/noise.cc
index ac9d4c6..81fb5dd 100644
--- a/mia/2d/filter/noise.cc
+++ b/mia/2d/filter/noise.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/filter/noise.hh b/mia/2d/filter/noise.hh
index a760d2f..8322879 100644
--- a/mia/2d/filter/noise.hh
+++ b/mia/2d/filter/noise.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/filter/regiongrow.cc b/mia/2d/filter/regiongrow.cc
index a919ec6..3b267fc 100644
--- a/mia/2d/filter/regiongrow.cc
+++ b/mia/2d/filter/regiongrow.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/filter/regiongrow.hh b/mia/2d/filter/regiongrow.hh
index c3c1d22..c0ffec9 100644
--- a/mia/2d/filter/regiongrow.hh
+++ b/mia/2d/filter/regiongrow.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/filter/rgg.cc b/mia/2d/filter/rgg.cc
index 8b1fd9a..9f7e4f3 100644
--- a/mia/2d/filter/rgg.cc
+++ b/mia/2d/filter/rgg.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/filter/scale.cc b/mia/2d/filter/scale.cc
index 1136d3e..01111c1 100644
--- a/mia/2d/filter/scale.cc
+++ b/mia/2d/filter/scale.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -100,12 +100,10 @@ C2DScaleFilterPlugin::C2DScaleFilterPlugin():
 	m_s(0,0)
 
 {
-	add_parameter("sx", new CUIntParameter(m_s.x, 0,
-					       numeric_limits<unsigned int>::max(), false,
+	add_parameter("sx", make_lc_param(m_s.x, 0, false,
 					       "target size in x direction, 0: use input size"));
 	
-	add_parameter("sy", new CUIntParameter(m_s.y, 0,
-					       numeric_limits<unsigned int>::max(), false,
+	add_parameter("sy", make_lc_param(m_s.y, 0, false,
 					       "target size in y direction, 0: use input size"));
 	
 	add_parameter("s", new C2DBoundsParameter(m_s, false, "target size as 2D vector"));
diff --git a/mia/2d/filter/scale.hh b/mia/2d/filter/scale.hh
index 25a3d10..ed797ab 100644
--- a/mia/2d/filter/scale.hh
+++ b/mia/2d/filter/scale.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/filter/seededwatershed.cc b/mia/2d/filter/seededwatershed.cc
index 0f865cc..1e74c5f 100644
--- a/mia/2d/filter/seededwatershed.cc
+++ b/mia/2d/filter/seededwatershed.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/filter/seededwatershed.hh b/mia/2d/filter/seededwatershed.hh
index 61716fa..1be0fbf 100644
--- a/mia/2d/filter/seededwatershed.hh
+++ b/mia/2d/filter/seededwatershed.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/filter/selectbig.cc b/mia/2d/filter/selectbig.cc
index ad0f404..f1a7792 100644
--- a/mia/2d/filter/selectbig.cc
+++ b/mia/2d/filter/selectbig.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/filter/selectbig.hh b/mia/2d/filter/selectbig.hh
index 06365c4..99f5a29 100644
--- a/mia/2d/filter/selectbig.hh
+++ b/mia/2d/filter/selectbig.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/filter/sepconv.cc b/mia/2d/filter/sepconv.cc
index 1caea0c..0139a90 100644
--- a/mia/2d/filter/sepconv.cc
+++ b/mia/2d/filter/sepconv.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -112,8 +112,7 @@ C2DGaussFilterPlugin::C2DGaussFilterPlugin():
 	C2DFilterPlugin("gauss"),
 	m_w(1)
 {
-	add_parameter("w", new CIntParameter(m_w, 0, numeric_limits<int>::max(),
-					     false, "filter width parameter"));
+	add_parameter("w", make_lc_param(m_w, 0, false, "filter width parameter"));
 }
 
 C2DFilter *C2DGaussFilterPlugin::do_create()const
@@ -132,10 +131,49 @@ const string C2DGaussFilterPlugin::do_get_descr()const
 	return "isotropic 2D gauss filter";
 }
 
+const TDictMap<C2DSobelFilterPlugin::EGradientDirection>::Table C2DSobelFilterPlugin::dir_dict[] = {
+	{"x", C2DSobelFilterPlugin::gd_x, "gradient in x-direction "},
+	{"y", C2DSobelFilterPlugin::gd_y, "gradient in y-direction "},
+	{NULL, C2DSobelFilterPlugin::gd_undefined, ""}
+};
+
+const TDictMap<C2DSobelFilterPlugin::EGradientDirection>
+C2DSobelFilterPlugin::Ddirection(C2DSobelFilterPlugin::dir_dict);
+
+C2DSobelFilterPlugin::C2DSobelFilterPlugin():
+	C2DFilterPlugin("sobel"),
+	m_direction(gd_x)
+{
+	add_parameter("dir", new CDictParameter<EGradientDirection>(m_direction, Ddirection, "Gradient direction"));
+}
+
+mia::C2DFilter *C2DSobelFilterPlugin::do_create()const
+{
+	const auto&  skp = C1DSpacialKernelPluginHandler::instance();
+	auto gauss = skp.produce("gauss:w=1");
+	auto cdiff = skp.produce("cdiff");
+	
+	switch (m_direction) {
+	case gd_x: return new CSeparableConvolute(cdiff, gauss);
+	case gd_y: return new CSeparableConvolute(gauss, cdiff);
+	default:
+		throw invalid_argument("C2DSobelFilterPlugin: unknown gradient direction specified");
+	}
+}
+
+const std::string C2DSobelFilterPlugin::do_get_descr()const
+{
+	return "The 2D Sobel filter for gradient evaluation. Note that the output pixel type "
+		"of the filtered image is the same as the input pixel type, so converting the input "
+		"beforehand to a floating point valued image is recommendable."; 
+}
+
+
 extern "C" EXPORT CPluginBase *get_plugin_interface()
 {
 	CPluginBase *gauss = new C2DGaussFilterPlugin();
 	gauss->append_interface(new C2DSeparableConvoluteFilterPlugin());
+	gauss->append_interface(new C2DSobelFilterPlugin());
 	return gauss;
 }
 
diff --git a/mia/2d/filter/sepconv.hh b/mia/2d/filter/sepconv.hh
index db41ae4..7e1decf 100644
--- a/mia/2d/filter/sepconv.hh
+++ b/mia/2d/filter/sepconv.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -21,6 +21,7 @@
 #include <mia/core/filter.hh>
 #include <mia/core/msgstream.hh>
 #include <mia/core/spacial_kernel.hh>
+#include <mia/core/dictmap.hh>
 #include <mia/2d/filter.hh>
 
 
@@ -66,5 +67,22 @@ private:
 	int m_w;
 };
 
+
+class C2DSobelFilterPlugin: public mia::C2DFilterPlugin {
+public:
+	C2DSobelFilterPlugin();
+	virtual mia::C2DFilter *do_create()const;
+	virtual const std::string do_get_descr()const;
+private:
+	enum EGradientDirection {gd_x, gd_y, gd_undefined};
+
+	static const mia::TDictMap<EGradientDirection>::Table dir_dict[];
+	static const mia::TDictMap<C2DSobelFilterPlugin::EGradientDirection> Ddirection;
+
+	EGradientDirection m_direction; 
+};
+
+
+
 NS_END
 
diff --git a/mia/2d/filter/shaped_mean.cc b/mia/2d/filter/shaped_mean.cc
index 3935092..d7d3712 100644
--- a/mia/2d/filter/shaped_mean.cc
+++ b/mia/2d/filter/shaped_mean.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/filter/shaped_mean.hh b/mia/2d/filter/shaped_mean.hh
index 7e31411..1fac862 100644
--- a/mia/2d/filter/shaped_mean.hh
+++ b/mia/2d/filter/shaped_mean.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/filter/sortlabel.cc b/mia/2d/filter/sortlabel.cc
index bd5841d..fd82af1 100644
--- a/mia/2d/filter/sortlabel.cc
+++ b/mia/2d/filter/sortlabel.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/filter/sortlabel.hh b/mia/2d/filter/sortlabel.hh
index b890ca6..ec09629 100644
--- a/mia/2d/filter/sortlabel.hh
+++ b/mia/2d/filter/sortlabel.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/filter/tee.cc b/mia/2d/filter/tee.cc
index bc4a872..2198155 100644
--- a/mia/2d/filter/tee.cc
+++ b/mia/2d/filter/tee.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/filter/tee.hh b/mia/2d/filter/tee.hh
index d06c27d..399c484 100644
--- a/mia/2d/filter/tee.hh
+++ b/mia/2d/filter/tee.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/filter/test_adaptmed.cc b/mia/2d/filter/test_adaptmed.cc
index 0ad2440..5b70de0 100644
--- a/mia/2d/filter/test_adaptmed.cc
+++ b/mia/2d/filter/test_adaptmed.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/filter/test_admean.cc b/mia/2d/filter/test_admean.cc
index 76edbed..817ad44 100644
--- a/mia/2d/filter/test_admean.cc
+++ b/mia/2d/filter/test_admean.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/filter/test_aniso.cc b/mia/2d/filter/test_aniso.cc
index f44bd8c..beaf211 100644
--- a/mia/2d/filter/test_aniso.cc
+++ b/mia/2d/filter/test_aniso.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/filter/test_bandpass.cc b/mia/2d/filter/test_bandpass.cc
index 560145c..3c5f969 100644
--- a/mia/2d/filter/test_bandpass.cc
+++ b/mia/2d/filter/test_bandpass.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/filter/test_binarize.cc b/mia/2d/filter/test_binarize.cc
index 6364065..d0ec664 100644
--- a/mia/2d/filter/test_binarize.cc
+++ b/mia/2d/filter/test_binarize.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/filter/test_combiner.cc b/mia/2d/filter/test_combiner.cc
index a450dea..bfd197e 100644
--- a/mia/2d/filter/test_combiner.cc
+++ b/mia/2d/filter/test_combiner.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/filter/test_convert.cc b/mia/2d/filter/test_convert.cc
index e7c967a..ea57354 100644
--- a/mia/2d/filter/test_convert.cc
+++ b/mia/2d/filter/test_convert.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/filter/test_crop.cc b/mia/2d/filter/test_crop.cc
index ac48278..5b8aa3a 100644
--- a/mia/2d/filter/test_crop.cc
+++ b/mia/2d/filter/test_crop.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -82,6 +82,7 @@ BOOST_FIXTURE_TEST_CASE(test_crop_reduce,  STestFicture)
 			BOOST_CHECK_EQUAL((*crop_image)(x,y), (*src_image)(x+b.x, y+b.y));
 	
 	BOOST_CHECK_EQUAL( crop_image->get_pixel_size(), test_pixelsize); 
+	BOOST_CHECK_EQUAL( crop_image->get_origin(), C2DFVector(b) * test_pixelsize); 
 }
 
 BOOST_FIXTURE_TEST_CASE(test_crop_enlarge,  STestFicture)
diff --git a/mia/2d/filter/test_cst.cc b/mia/2d/filter/test_cst.cc
index 3add0b6..249c457 100644
--- a/mia/2d/filter/test_cst.cc
+++ b/mia/2d/filter/test_cst.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/filter/test_distance.cc b/mia/2d/filter/test_distance.cc
index 65f601e..1d393c6 100644
--- a/mia/2d/filter/test_distance.cc
+++ b/mia/2d/filter/test_distance.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/filter/test_downscale.cc b/mia/2d/filter/test_downscale.cc
index 11b02fe..d353f27 100644
--- a/mia/2d/filter/test_downscale.cc
+++ b/mia/2d/filter/test_downscale.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/filter/test_fft.cc b/mia/2d/filter/test_fft.cc
index 47a299f..2e79662 100644
--- a/mia/2d/filter/test_fft.cc
+++ b/mia/2d/filter/test_fft.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/filter/test_gradnorm.cc b/mia/2d/filter/test_gradnorm.cc
index c3406ee..3506f8b 100644
--- a/mia/2d/filter/test_gradnorm.cc
+++ b/mia/2d/filter/test_gradnorm.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/filter/test_invert.cc b/mia/2d/filter/test_invert.cc
index 214284f..cb8690a 100644
--- a/mia/2d/filter/test_invert.cc
+++ b/mia/2d/filter/test_invert.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/filter/test_kmeans.cc b/mia/2d/filter/test_kmeans.cc
index e8d3d0f..a74ab86 100644
--- a/mia/2d/filter/test_kmeans.cc
+++ b/mia/2d/filter/test_kmeans.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/filter/test_label.cc b/mia/2d/filter/test_label.cc
index 850908a..81dc5fe 100644
--- a/mia/2d/filter/test_label.cc
+++ b/mia/2d/filter/test_label.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -44,10 +44,6 @@ static void do_test_label(const C2DImage& inp, const char* filter_descr, unsigne
 BOOST_AUTO_TEST_CASE( test_label )
 {
 
-	CPathNameArray kernelsearchpath;
-	kernelsearchpath.push_back(bfs::path("..")/bfs::path("shapes"));
-	C2DShapePluginHandler::set_search_path(kernelsearchpath);
-
 	bool input[9] = { 1, 1, 0,
 			  0, 0, 1,
 			  0, 1, 1 };
diff --git a/mia/2d/filter/test_labelmap.cc b/mia/2d/filter/test_labelmap.cc
index 04be97f..a89e4aa 100644
--- a/mia/2d/filter/test_labelmap.cc
+++ b/mia/2d/filter/test_labelmap.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -21,7 +21,6 @@
 #include <mia/internal/autotest.hh>
 #include <mia/2d/filter/labelmap.hh>
 
-using namespace labelmap_2dimage_filter; 
 NS_MIA_USE;
 using namespace std; 
 
diff --git a/mia/2d/filter/test_labelscale.cc b/mia/2d/filter/test_labelscale.cc
index 3538824..fc51a29 100644
--- a/mia/2d/filter/test_labelscale.cc
+++ b/mia/2d/filter/test_labelscale.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/filter/test_load.cc b/mia/2d/filter/test_load.cc
index edeb489..9ade1a8 100644
--- a/mia/2d/filter/test_load.cc
+++ b/mia/2d/filter/test_load.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/filter/test_mask.cc b/mia/2d/filter/test_mask.cc
index eabd55c..7c1a41d 100644
--- a/mia/2d/filter/test_mask.cc
+++ b/mia/2d/filter/test_mask.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/filter/test_mean.cc b/mia/2d/filter/test_mean.cc
index d9b47d8..760e5b7 100644
--- a/mia/2d/filter/test_mean.cc
+++ b/mia/2d/filter/test_mean.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/filter/test_median.cc b/mia/2d/filter/test_median.cc
index d6c5acf..b55ff38 100644
--- a/mia/2d/filter/test_median.cc
+++ b/mia/2d/filter/test_median.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/filter/test_mlv.cc b/mia/2d/filter/test_mlv.cc
index 56275ce..cbee934 100644
--- a/mia/2d/filter/test_mlv.cc
+++ b/mia/2d/filter/test_mlv.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/filter/test_morphological.cc b/mia/2d/filter/test_morphological.cc
index a7418c2..9ea103a 100644
--- a/mia/2d/filter/test_morphological.cc
+++ b/mia/2d/filter/test_morphological.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/filter/test_ngfnorm.cc b/mia/2d/filter/test_ngfnorm.cc
index 6fc7777..001f8b0 100644
--- a/mia/2d/filter/test_ngfnorm.cc
+++ b/mia/2d/filter/test_ngfnorm.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/filter/test_noise.cc b/mia/2d/filter/test_noise.cc
index 9dce243..b0810fd 100644
--- a/mia/2d/filter/test_noise.cc
+++ b/mia/2d/filter/test_noise.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/filter/test_regiongrow.cc b/mia/2d/filter/test_regiongrow.cc
index 9448a08..9176ec8 100644
--- a/mia/2d/filter/test_regiongrow.cc
+++ b/mia/2d/filter/test_regiongrow.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/filter/test_scale.cc b/mia/2d/filter/test_scale.cc
index 3d723a0..5d1571d 100644
--- a/mia/2d/filter/test_scale.cc
+++ b/mia/2d/filter/test_scale.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/filter/test_seededwatershed.cc b/mia/2d/filter/test_seededwatershed.cc
index 42c579e..7eda00e 100644
--- a/mia/2d/filter/test_seededwatershed.cc
+++ b/mia/2d/filter/test_seededwatershed.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/filter/test_selectbig.cc b/mia/2d/filter/test_selectbig.cc
index 696132f..01d7784 100644
--- a/mia/2d/filter/test_selectbig.cc
+++ b/mia/2d/filter/test_selectbig.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/filter/test_sepconv.cc b/mia/2d/filter/test_sepconv.cc
index 7968336..7863cc9 100644
--- a/mia/2d/filter/test_sepconv.cc
+++ b/mia/2d/filter/test_sepconv.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -75,6 +75,78 @@ BOOST_FIXTURE_TEST_CASE( test_gauss, SepconvTextFixture )
 	run(*filter); 
 }
 
+BOOST_AUTO_TEST_CASE( test_sobel_x )
+{
+	auto sobel_x = BOOST_TEST_create_from_plugin<C2DSobelFilterPlugin>("sobel:dir=x"); 
+
+	const float in_image[] = {
+		1, 2, 3, 4,                 
+		2, 3, 2, 5,
+		6, 7, 8, 9,
+		5, 4, 6, 3,
+		6, 7, 8, 3
+	};
+
+	
+	const float test_image[] = {
+		0, 0.75,    1, 0, 
+		0, 0.5,    1, 0, 
+		0, 2.5/4,      0.625, 0,       
+		0, 0.75, -0.5, 0,     
+		0, 3.5/4, -6.5 / 4, 0        
+	};
+
+	C2DFImage src(C2DBounds(4,5), in_image);
+
+	auto filtered = sobel_x->filter(src);
+
+	const C2DFImage& f = dynamic_cast<const C2DFImage&>(*filtered);
+
+	BOOST_CHECK_EQUAL(f.get_size(), src.get_size());
+
+	const float *t = test_image; 
+	for(auto i = f.begin(); i != f.end(); ++i, ++t) {
+		cvdebug() << *i << " " << *t << "\n"; 
+		BOOST_CHECK_CLOSE(*i, *t, 0.1);
+	}
+}
+
+BOOST_AUTO_TEST_CASE( test_sobel_y )
+{
+	auto sobel_y = BOOST_TEST_create_from_plugin<C2DSobelFilterPlugin>("sobel:dir=y"); 
+
+	const float in_image[] = {
+		1, 2, 6, 5, 6,
+		2, 3, 7, 4, 7,
+		3, 2, 8, 6, 8,
+		4, 5, 9, 3, 3
+	};
+
+	
+	const float test_image[] = {
+		0,  0,  0,  0,  0,
+		0.75, 0.5, 2.5/4, 0.75, 3.5/4,
+		1, 1, 0.625, -0.5, -6.5/4,
+		0,  0,  0,  0,  0
+	};
+
+	C2DFImage src(C2DBounds(5,4), in_image);
+
+	auto filtered = sobel_y->filter(src);
+
+	const C2DFImage& f = dynamic_cast<const C2DFImage&>(*filtered);
+
+	BOOST_CHECK_EQUAL(f.get_size(), src.get_size());
+
+	const float *t = test_image; 
+	for(auto i = f.begin(); i != f.end(); ++i, ++t) {
+		cvdebug() << *i << " " << *t << "\n"; 
+		BOOST_CHECK_CLOSE(*i, *t, 0.1);
+	}
+	
+}
+
+
 
 
 
diff --git a/mia/2d/filter/test_shaped_mean.cc b/mia/2d/filter/test_shaped_mean.cc
index 3c2a432..ee01cd4 100644
--- a/mia/2d/filter/test_shaped_mean.cc
+++ b/mia/2d/filter/test_shaped_mean.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/filter/test_sortlabel.cc b/mia/2d/filter/test_sortlabel.cc
index 3603fc9..d635243 100644
--- a/mia/2d/filter/test_sortlabel.cc
+++ b/mia/2d/filter/test_sortlabel.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/filter/test_tee.cc b/mia/2d/filter/test_tee.cc
index 1531ca6..e837804 100644
--- a/mia/2d/filter/test_tee.cc
+++ b/mia/2d/filter/test_tee.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/filter/test_thinning.cc b/mia/2d/filter/test_thinning.cc
index bd7637a..fab27ec 100644
--- a/mia/2d/filter/test_thinning.cc
+++ b/mia/2d/filter/test_thinning.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/filter/test_thresh.cc b/mia/2d/filter/test_thresh.cc
index 8a63792..9d70347 100644
--- a/mia/2d/filter/test_thresh.cc
+++ b/mia/2d/filter/test_thresh.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/filter/test_transform.cc b/mia/2d/filter/test_transform.cc
index 481924e..23bc6d8 100644
--- a/mia/2d/filter/test_transform.cc
+++ b/mia/2d/filter/test_transform.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/filter/test_watershed.cc b/mia/2d/filter/test_watershed.cc
index d8841f1..3890ade 100644
--- a/mia/2d/filter/test_watershed.cc
+++ b/mia/2d/filter/test_watershed.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/filter/thinning.cc b/mia/2d/filter/thinning.cc
index b340398..b1122bd 100644
--- a/mia/2d/filter/thinning.cc
+++ b/mia/2d/filter/thinning.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -156,8 +156,8 @@ C2DThinningFilterFactory::C2DThinningFilterFactory():
 	C2DFilterPlugin("thinning"),
 	m_max_iterations(0)
 {
-	add_parameter("iter", new CIntParameter(m_max_iterations, 1, 1000000, false,  
-						"Number of iterations to run, 0=until convergence"));
+	add_parameter("iter", make_ci_param(m_max_iterations, 1, 1000000, false,  
+					    "Number of iterations to run, 0=until convergence"));
 }
 
 mia::C2DFilter *C2DThinningFilterFactory::do_create()const
@@ -175,8 +175,8 @@ C2DPruningFilterFactory::C2DPruningFilterFactory():
 	C2DFilterPlugin("pruning"),
 	m_max_iterations(0)
 {
-	add_parameter("iter", new CIntParameter(m_max_iterations, 1, 1000000, false,  
-						"Number of iterations to run, 0=until convergence"));
+	add_parameter("iter", make_ci_param(m_max_iterations, 1, 1000000, false,  
+					    "Number of iterations to run, 0=until convergence"));
 }
 
 mia::C2DFilter *C2DPruningFilterFactory::do_create()const
diff --git a/mia/2d/filter/thinning.hh b/mia/2d/filter/thinning.hh
index 998bc04..cd52d12 100644
--- a/mia/2d/filter/thinning.hh
+++ b/mia/2d/filter/thinning.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/filter/thresh.cc b/mia/2d/filter/thresh.cc
index 4e26425..1425b70 100644
--- a/mia/2d/filter/thresh.cc
+++ b/mia/2d/filter/thresh.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -70,11 +70,7 @@ C2DThreshNImageFilterFactory::C2DThreshNImageFilterFactory():
 	m_thresh(5.0)
 {
 	add_parameter("shape", make_param(m_shape, "4n", false, "neighborhood shape to take into account")); 
-	
-	add_parameter("thresh", new CDoubleParameter(m_thresh, 
-						     -numeric_limits<double>::max(), 
-						     numeric_limits<double>::max(),
-						     false, "The threshhold value"));
+	add_parameter("thresh", make_param(m_thresh, false, "The threshhold value"));
 }
 
 C2DFilter *C2DThreshNImageFilterFactory::do_create()const
diff --git a/mia/2d/filter/thresh.hh b/mia/2d/filter/thresh.hh
index 2cbdcf5..ea02094 100644
--- a/mia/2d/filter/thresh.hh
+++ b/mia/2d/filter/thresh.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/filter/transform.cc b/mia/2d/filter/transform.cc
index b1495b9..522ff83 100644
--- a/mia/2d/filter/transform.cc
+++ b/mia/2d/filter/transform.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/filter/transform.hh b/mia/2d/filter/transform.hh
index 8f15f5f..0163a29 100644
--- a/mia/2d/filter/transform.hh
+++ b/mia/2d/filter/transform.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/filter/variation.cc b/mia/2d/filter/variation.cc
index 22a42b9..aad2d81 100644
--- a/mia/2d/filter/variation.cc
+++ b/mia/2d/filter/variation.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/filter/watershed.cc b/mia/2d/filter/watershed.cc
index 35d6269..8ae4003 100644
--- a/mia/2d/filter/watershed.cc
+++ b/mia/2d/filter/watershed.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/filter/watershed.hh b/mia/2d/filter/watershed.hh
index 300b970..6c5f85f 100644
--- a/mia/2d/filter/watershed.hh
+++ b/mia/2d/filter/watershed.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/filter/wmean.cc b/mia/2d/filter/wmean.cc
index 541c6ad..10d4061 100644
--- a/mia/2d/filter/wmean.cc
+++ b/mia/2d/filter/wmean.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/filter/ws.cc b/mia/2d/filter/ws.cc
index 19f6d7c..20dba5e 100644
--- a/mia/2d/filter/ws.cc
+++ b/mia/2d/filter/ws.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/filterchain.cc b/mia/2d/filterchain.cc
index 880d42b..a3ea6d4 100644
--- a/mia/2d/filterchain.cc
+++ b/mia/2d/filterchain.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/filterchain.hh b/mia/2d/filterchain.hh
index af1a622..ccf9d80 100644
--- a/mia/2d/filterchain.hh
+++ b/mia/2d/filterchain.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/filtertest.cc b/mia/2d/filtertest.cc
index ec7a503..0aabddf 100644
--- a/mia/2d/filtertest.cc
+++ b/mia/2d/filtertest.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -37,16 +37,6 @@ using namespace boost::unit_test;
 
 EXPORT_2DTEST void imagefiltertest2d_prepare_plugin_path()
 {
-	CPathNameArray filtersearchpath;
-	filtersearchpath.push_back( bfs::path("2d") / bfs::path("filter"));
-	filtersearchpath.push_back( bfs::path("filter"));
-	C2DFilterPluginHandler::set_search_path(filtersearchpath);
-
-	CPathNameArray kernelsearchpath;
-	kernelsearchpath.push_back(bfs::path("core")/bfs::path("spacialkernel"));
-	kernelsearchpath.push_back(bfs::path("..")/bfs::path("core")/bfs::path("spacialkernel"));
-
-	C1DSpacialKernelPluginHandler::set_search_path(kernelsearchpath);
 }
 
 NS_MIA_END
diff --git a/mia/2d/filtertest.hh b/mia/2d/filtertest.hh
index 02ea88a..f7665a9 100644
--- a/mia/2d/filtertest.hh
+++ b/mia/2d/filtertest.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/fullcost.cc b/mia/2d/fullcost.cc
index 579606d..f5d6c8d 100644
--- a/mia/2d/fullcost.cc
+++ b/mia/2d/fullcost.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/fullcost.hh b/mia/2d/fullcost.hh
index a2867ba..28a8fc1 100644
--- a/mia/2d/fullcost.hh
+++ b/mia/2d/fullcost.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/fullcost/CMakeLists.txt b/mia/2d/fullcost/CMakeLists.txt
index 5545095..65a1903 100644
--- a/mia/2d/fullcost/CMakeLists.txt
+++ b/mia/2d/fullcost/CMakeLists.txt
@@ -1,6 +1,6 @@
 #
 # This file is part of MIA - a toolbox for medical image analysis 
-# Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+# 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
diff --git a/mia/2d/fullcost/image.cc b/mia/2d/fullcost/image.cc
index ed35e29..788befb 100644
--- a/mia/2d/fullcost/image.cc
+++ b/mia/2d/fullcost/image.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/fullcost/image.hh b/mia/2d/fullcost/image.hh
index 4a56a3d..1c23acd 100644
--- a/mia/2d/fullcost/image.hh
+++ b/mia/2d/fullcost/image.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/fullcost/label.cc b/mia/2d/fullcost/label.cc
index c448b14..e885533 100644
--- a/mia/2d/fullcost/label.cc
+++ b/mia/2d/fullcost/label.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -309,10 +309,10 @@ C2DLabelFullCostPlugin::C2DLabelFullCostPlugin():
 			      &C2DImageIOPluginHandler::instance()));
 	add_parameter("ref", new CStringParameter(m_ref_name, CCmdOptionFlags::input, "Reference image", 
 			      &C2DImageIOPluginHandler::instance()));
-	add_parameter("maxlabel", new CIntParameter(m_maxlabel, 2, 32000, false, 
-						    "maximum number of labels to consider"));
-	add_parameter("debug", new CIntParameter(m_debug, 0, 1, false, 
-						    "write the distance transforms to a 3D image"));
+	add_parameter("maxlabel", make_ci_param(m_maxlabel, 2, 32000, false, 
+						 "maximum number of labels to consider"));
+	add_parameter("debug", make_ci_param(m_debug, 0, 1, false, 
+					      "write the distance transforms to a 3D image"));
 
 }
 
diff --git a/mia/2d/fullcost/label.hh b/mia/2d/fullcost/label.hh
index dab3ca9..23bad6a 100644
--- a/mia/2d/fullcost/label.hh
+++ b/mia/2d/fullcost/label.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/fullcost/maskedimage.cc b/mia/2d/fullcost/maskedimage.cc
index 0994c18..ff35ce1 100644
--- a/mia/2d/fullcost/maskedimage.cc
+++ b/mia/2d/fullcost/maskedimage.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/fullcost/maskedimage.hh b/mia/2d/fullcost/maskedimage.hh
index 92f3c2a..491a4f2 100644
--- a/mia/2d/fullcost/maskedimage.hh
+++ b/mia/2d/fullcost/maskedimage.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/fullcost/test_image.cc b/mia/2d/fullcost/test_image.cc
index 40e6fa0..2c5ad7b 100644
--- a/mia/2d/fullcost/test_image.cc
+++ b/mia/2d/fullcost/test_image.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/fullcost/test_label.cc b/mia/2d/fullcost/test_label.cc
index 1cc6738..b8daad6 100644
--- a/mia/2d/fullcost/test_label.cc
+++ b/mia/2d/fullcost/test_label.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -101,7 +101,7 @@ BOOST_FIXTURE_TEST_CASE ( test_labeldistance, TransformInitFixture )
         BOOST_CHECK_CLOSE(cost->cost_value(), 6 + sqrt(2.0), 0.01); 
         
 	CDoubleVector gradient(t->degrees_of_freedom()); 
-	double cost_value = cost->evaluate(*t, gradient);
+	cost->evaluate(*t, gradient);
 
 	for(int i = 0; i < 25; ++i) {
 		cvdebug() << "[" << i << "]: (" << gradient[2*i] << ", " << gradient[2*i+1]
diff --git a/mia/2d/fullcost/test_maskedimage.cc b/mia/2d/fullcost/test_maskedimage.cc
index 20b6c38..cded7a7 100644
--- a/mia/2d/fullcost/test_maskedimage.cc
+++ b/mia/2d/fullcost/test_maskedimage.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/fuzzyclustersolver_cg.cc b/mia/2d/fuzzyclustersolver_cg.cc
index 5c97ab1..4b9b65a 100644
--- a/mia/2d/fuzzyclustersolver_cg.cc
+++ b/mia/2d/fuzzyclustersolver_cg.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/fuzzyclustersolver_cg.hh b/mia/2d/fuzzyclustersolver_cg.hh
index 0efaf31..eba7ec2 100644
--- a/mia/2d/fuzzyclustersolver_cg.hh
+++ b/mia/2d/fuzzyclustersolver_cg.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/fuzzyclustersolver_sor.cc b/mia/2d/fuzzyclustersolver_sor.cc
index 7a370fe..c589914 100644
--- a/mia/2d/fuzzyclustersolver_sor.cc
+++ b/mia/2d/fuzzyclustersolver_sor.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/fuzzyclustersolver_sor.hh b/mia/2d/fuzzyclustersolver_sor.hh
index 12d4653..d1f99d7 100644
--- a/mia/2d/fuzzyclustersolver_sor.hh
+++ b/mia/2d/fuzzyclustersolver_sor.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/fuzzyseg.cc b/mia/2d/fuzzyseg.cc
index 49ffe0c..b3fd88c 100644
--- a/mia/2d/fuzzyseg.cc
+++ b/mia/2d/fuzzyseg.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/fuzzyseg.hh b/mia/2d/fuzzyseg.hh
index 22b2ba7..5d2d976 100644
--- a/mia/2d/fuzzyseg.hh
+++ b/mia/2d/fuzzyseg.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/ground_truth_evaluator.cc b/mia/2d/ground_truth_evaluator.cc
index 3cb0247..c7f5363 100644
--- a/mia/2d/ground_truth_evaluator.cc
+++ b/mia/2d/ground_truth_evaluator.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/ground_truth_evaluator.hh b/mia/2d/ground_truth_evaluator.hh
index fe2ef06..c675ba1 100644
--- a/mia/2d/ground_truth_evaluator.hh
+++ b/mia/2d/ground_truth_evaluator.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/groundtruthproblem.cc b/mia/2d/groundtruthproblem.cc
index 4907ebf..1b2fa2e 100644
--- a/mia/2d/groundtruthproblem.cc
+++ b/mia/2d/groundtruthproblem.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/groundtruthproblem.hh b/mia/2d/groundtruthproblem.hh
index 7934e0b..9d9c7df 100644
--- a/mia/2d/groundtruthproblem.hh
+++ b/mia/2d/groundtruthproblem.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/ica.cc b/mia/2d/ica.cc
index b0c9c04..f31eb3c 100644
--- a/mia/2d/ica.cc
+++ b/mia/2d/ica.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/ica.hh b/mia/2d/ica.hh
index 8e2de4e..8f2889c 100644
--- a/mia/2d/ica.hh
+++ b/mia/2d/ica.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/image.cc b/mia/2d/image.cc
index 2d3eb47..b31a228 100644
--- a/mia/2d/image.cc
+++ b/mia/2d/image.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -57,6 +57,28 @@ const C2DBounds& C2DImage::get_size() const
 }
 
 
+C2DFVector C2DImage::get_origin() const
+{
+       const PAttribute attr = get_attribute("origin");
+        if (!attr) {
+                cvinfo() << "C2DImage::get_origin(): origin size not defined, returning default (0,0)\n";
+                return C2DFVector::_0;
+        }
+	
+        const TAttribute<C2DFVector> * vs = dynamic_cast<TAttribute<C2DFVector> *>(attr.get());
+        if (!vs){
+                cvinfo() << "C2DImage::get_origin(): pixel size wrong type, returning default (0,0)\n";
+                return C2DFVector::_0;
+        }
+        return *vs;
+}
+
+
+void C2DImage::set_origin(const C2DFVector& origin)
+{
+        set_attribute("origin", PAttribute(new TAttribute<C2DFVector>(origin)));	
+}
+
 
 C2DFVector C2DImage::get_pixel_size() const
 {
diff --git a/mia/2d/image.hh b/mia/2d/image.hh
index cb626f3..9919d0b 100644
--- a/mia/2d/image.hh
+++ b/mia/2d/image.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -70,6 +70,13 @@ public:
         /// \param  pixel set the pixel real world size to the given value
 	void set_pixel_size(const C2DFVector& pixel);
 
+
+        /// \returns the origin in real-world units
+	C2DFVector get_origin() const;
+
+        /// \param  origin set the origin in world coordinates 
+	void set_origin(const C2DFVector& origin);
+
         /**
         returns a copy of this image
         Abstract method
@@ -422,34 +429,7 @@ struct Binder<C2DImage> {
 	typedef __bind_all<T2DImage> Derived;
 };
 
-/**
-   Specialization of the attribute to string conversion for 2D Vectors. 
- */
-template <>
-struct dispatch_attr_string<C2DFVector> {
-	/**
-	   Convert the vector to a string 
-	   \param value 
-	   \returns the values corresponding to the vector elements as separated by spaces 
-	 */
-	static std::string val2string(const C2DFVector& value) {
-		std::stringstream sval;
-		sval << value.x << " " << value.y;
-		return sval.str();
-	}
-	/**
-	   Convert a string to 2D vector 
-	   \param str a string of two values separated by a whitespace 
-	   \returns 2D vector with the elements set accordingly 
-	 */
-	static C2DFVector string2val(const std::string& str) {
-		std::istringstream sval(str);
-		C2DFVector value;
-		sval >> value.x >> value.y;
-		return value;
-	}
-};
-/// @endcond 
+//@endcond INTERNAL 
 
 /**
    \brief functor to convert an image with an abitrary pixel type to single floating point pixels 
@@ -507,9 +487,6 @@ struct FConvert2DImageToPixeltypeO: public TFilter<T2DImage<O> > {
 */
 typedef FConvert2DImageToPixeltypeO<float> FCopy2DImageToFloatRepn; 
 
-/// typedef for the C2DFVector to std::string translator 
-typedef TTranslator<C2DFVector> C2DFVectorTranslator;
-
 
 NS_MIA_END
 
diff --git a/mia/2d/imageio.cc b/mia/2d/imageio.cc
index a3ef66f..38498c0 100644
--- a/mia/2d/imageio.cc
+++ b/mia/2d/imageio.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/imageio.hh b/mia/2d/imageio.hh
index df1afd4..29c2d11 100644
--- a/mia/2d/imageio.hh
+++ b/mia/2d/imageio.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/imageiotest.cc b/mia/2d/imageiotest.cc
index 9175694..887ddb6 100644
--- a/mia/2d/imageiotest.cc
+++ b/mia/2d/imageiotest.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/imageiotest.hh b/mia/2d/imageiotest.hh
index 7ff2b5b..5edd3d2 100644
--- a/mia/2d/imageiotest.hh
+++ b/mia/2d/imageiotest.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/imagetest.cc b/mia/2d/imagetest.cc
index 2e33cf1..20e1867 100644
--- a/mia/2d/imagetest.cc
+++ b/mia/2d/imagetest.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/imagetest.hh b/mia/2d/imagetest.hh
index b98ad1c..75c2560 100644
--- a/mia/2d/imagetest.hh
+++ b/mia/2d/imagetest.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/interpolator.cc b/mia/2d/interpolator.cc
index 93387dc..8d631ca 100644
--- a/mia/2d/interpolator.cc
+++ b/mia/2d/interpolator.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/interpolator.cxx b/mia/2d/interpolator.cxx
index 8f51855..56271eb 100644
--- a/mia/2d/interpolator.cxx
+++ b/mia/2d/interpolator.cxx
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/interpolator.hh b/mia/2d/interpolator.hh
index 0eabec7..ae71670 100644
--- a/mia/2d/interpolator.hh
+++ b/mia/2d/interpolator.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/io/CMakeLists.txt b/mia/2d/io/CMakeLists.txt
index b3a382e..34d3830 100644
--- a/mia/2d/io/CMakeLists.txt
+++ b/mia/2d/io/CMakeLists.txt
@@ -1,6 +1,6 @@
 #
 # This file is part of MIA - a toolbox for medical image analysis 
-# Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+# 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
diff --git a/mia/2d/io/bmp.cc b/mia/2d/io/bmp.cc
index e1e6041..9b739c4 100644
--- a/mia/2d/io/bmp.cc
+++ b/mia/2d/io/bmp.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/io/raw.cc b/mia/2d/io/raw.cc
index 00641e8..fde3fa2 100644
--- a/mia/2d/io/raw.cc
+++ b/mia/2d/io/raw.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/io/test_xml.cc b/mia/2d/io/test_xml.cc
index 08e99c0..02dc6ac 100644
--- a/mia/2d/io/test_xml.cc
+++ b/mia/2d/io/test_xml.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/io/xml.cc b/mia/2d/io/xml.cc
index e7b9e3f..f58e5be 100644
--- a/mia/2d/io/xml.cc
+++ b/mia/2d/io/xml.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/io/xml.hh b/mia/2d/io/xml.hh
index f55c3b8..8d4666e 100644
--- a/mia/2d/io/xml.hh
+++ b/mia/2d/io/xml.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/iterator.cxx b/mia/2d/iterator.cxx
index 7e4dafe..674df97 100644
--- a/mia/2d/iterator.cxx
+++ b/mia/2d/iterator.cxx
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/iterator.hh b/mia/2d/iterator.hh
index 0b819ba..5f334f5 100644
--- a/mia/2d/iterator.hh
+++ b/mia/2d/iterator.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/kernel/CMakeLists.txt b/mia/2d/kernel/CMakeLists.txt
index e4a1da8..5fd1146 100644
--- a/mia/2d/kernel/CMakeLists.txt
+++ b/mia/2d/kernel/CMakeLists.txt
@@ -1,6 +1,6 @@
 #
 # This file is part of MIA - a toolbox for medical image analysis 
-# Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+# 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
diff --git a/mia/2d/kernel/curv.cc b/mia/2d/kernel/curv.cc
index 8b09974..1ddad7b 100644
--- a/mia/2d/kernel/curv.cc
+++ b/mia/2d/kernel/curv.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/maskedcost.cc b/mia/2d/maskedcost.cc
index 1cd27a6..67f738d 100644
--- a/mia/2d/maskedcost.cc
+++ b/mia/2d/maskedcost.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/maskedcost.hh b/mia/2d/maskedcost.hh
index 2d4d546..d5edc79 100644
--- a/mia/2d/maskedcost.hh
+++ b/mia/2d/maskedcost.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/maskedcost/CMakeLists.txt b/mia/2d/maskedcost/CMakeLists.txt
index 2c03415..e5d5231 100644
--- a/mia/2d/maskedcost/CMakeLists.txt
+++ b/mia/2d/maskedcost/CMakeLists.txt
@@ -1,6 +1,6 @@
 #
 # This file is part of MIA - a toolbox for medical image analysis 
-# Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+# 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
diff --git a/mia/2d/maskedcost/lncc.cc b/mia/2d/maskedcost/lncc.cc
index bab5fda..506f353 100644
--- a/mia/2d/maskedcost/lncc.cc
+++ b/mia/2d/maskedcost/lncc.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -208,8 +208,8 @@ CLNCC2DImageCostPlugin::CLNCC2DImageCostPlugin():
 C2DMaskedImageCostPlugin("lncc"), 
      m_hw(5)
 {
-	this->add_parameter("w", new CUIntParameter(m_hw, 1, 256, false, 
-						    "half width of the window used for evaluating the localized cross correlation")); 
+	this->add_parameter("w", make_ci_param(m_hw, 1, 256, false, 
+					       "half width of the window used for evaluating the localized cross correlation")); 
 }
 
 C2DMaskedImageCost *CLNCC2DImageCostPlugin::do_create() const
diff --git a/mia/2d/maskedcost/lncc.hh b/mia/2d/maskedcost/lncc.hh
index 6f861f5..8292f83 100644
--- a/mia/2d/maskedcost/lncc.hh
+++ b/mia/2d/maskedcost/lncc.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/maskedcost/mi.cc b/mia/2d/maskedcost/mi.cc
index eff7d4b..63b4ed0 100644
--- a/mia/2d/maskedcost/mi.cc
+++ b/mia/2d/maskedcost/mi.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/maskedcost/mi.hh b/mia/2d/maskedcost/mi.hh
index 3c2de4c..0fb7931 100644
--- a/mia/2d/maskedcost/mi.hh
+++ b/mia/2d/maskedcost/mi.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/maskedcost/ncc.cc b/mia/2d/maskedcost/ncc.cc
index 113b4ed..55c8a4b 100644
--- a/mia/2d/maskedcost/ncc.cc
+++ b/mia/2d/maskedcost/ncc.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/maskedcost/ncc.hh b/mia/2d/maskedcost/ncc.hh
index a48ab3e..cf4d7bb 100644
--- a/mia/2d/maskedcost/ncc.hh
+++ b/mia/2d/maskedcost/ncc.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/maskedcost/ssd.cc b/mia/2d/maskedcost/ssd.cc
index e408815..78095c8 100644
--- a/mia/2d/maskedcost/ssd.cc
+++ b/mia/2d/maskedcost/ssd.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/maskedcost/ssd.hh b/mia/2d/maskedcost/ssd.hh
index b2a67b6..4e4f1cb 100644
--- a/mia/2d/maskedcost/ssd.hh
+++ b/mia/2d/maskedcost/ssd.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/maskedcost/test_lncc.cc b/mia/2d/maskedcost/test_lncc.cc
index 7d612af..f435ab2 100644
--- a/mia/2d/maskedcost/test_lncc.cc
+++ b/mia/2d/maskedcost/test_lncc.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/maskedcost/test_mi.cc b/mia/2d/maskedcost/test_mi.cc
index 0ad9ef5..a52b06e 100644
--- a/mia/2d/maskedcost/test_mi.cc
+++ b/mia/2d/maskedcost/test_mi.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/maskedcost/test_ncc.cc b/mia/2d/maskedcost/test_ncc.cc
index db60752..ea4a075 100644
--- a/mia/2d/maskedcost/test_ncc.cc
+++ b/mia/2d/maskedcost/test_ncc.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/maskedcost/test_ssd.cc b/mia/2d/maskedcost/test_ssd.cc
index a5249c7..f637608 100644
--- a/mia/2d/maskedcost/test_ssd.cc
+++ b/mia/2d/maskedcost/test_ssd.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/matrix.hh b/mia/2d/matrix.hh
index 2616139..b5ecbbd 100644
--- a/mia/2d/matrix.hh
+++ b/mia/2d/matrix.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/model.cc b/mia/2d/model.cc
index e4e4d7e..09dd693 100644
--- a/mia/2d/model.cc
+++ b/mia/2d/model.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/model.hh b/mia/2d/model.hh
index b3e06e0..68b4ad6 100644
--- a/mia/2d/model.hh
+++ b/mia/2d/model.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/model/CMakeLists.txt b/mia/2d/model/CMakeLists.txt
index 542b8b2..a9aa8e1 100644
--- a/mia/2d/model/CMakeLists.txt
+++ b/mia/2d/model/CMakeLists.txt
@@ -1,6 +1,6 @@
 #
 # This file is part of MIA - a toolbox for medical image analysis 
-# Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+# 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
diff --git a/mia/2d/model/identity.cc b/mia/2d/model/identity.cc
index 6f33412..a93cf09 100644
--- a/mia/2d/model/identity.cc
+++ b/mia/2d/model/identity.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/model/identity.hh b/mia/2d/model/identity.hh
index 038b181..20c4e06 100644
--- a/mia/2d/model/identity.hh
+++ b/mia/2d/model/identity.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/model/navier.cc b/mia/2d/model/navier.cc
index 53e174e..6e39eb2 100644
--- a/mia/2d/model/navier.cc
+++ b/mia/2d/model/navier.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -134,17 +134,11 @@ C2DNavierRegModelPlugin::C2DNavierRegModelPlugin():
 	m_epsilon(0.0001),
 	m_maxiter(100)
 {
-	add_parameter("mu", new CFloatParameter(m_mu, 0.0, numeric_limits<float>::max(),
-						false, "isotropic compliance"));
-	add_parameter("lambda", new CFloatParameter(m_lambda, 0.0,
-						    numeric_limits<float>::max(),
-						    false, "isotropic compression"));
-	add_parameter("omega", new CFloatParameter(m_omega, 0.1, 10,
-						   false, "relexation parameter"));
-	add_parameter("epsilon", new CFloatParameter(m_epsilon, 0.000001, 0.1,
-						     false, "stopping parameter"));
-	add_parameter("iter", new CIntParameter(m_maxiter, 10, 10000,
-						false, "maximum number of iterations"));
+	add_parameter("mu", make_lc_param(m_mu, 0.0, false, "isotropic compliance"));
+	add_parameter("lambda", make_lc_param(m_lambda, 0.0, false, "isotropic compression"));
+	add_parameter("omega", make_ci_param(m_omega, 0.1, 10, false, "relexation parameter"));
+	add_parameter("epsilon", make_oci_param(m_epsilon, 0.0, 0.1, false, "stopping parameter"));
+	add_parameter("iter", make_ci_param(m_maxiter, 1, 10000, false, "maximum number of iterations"));
 }
 
 C2DRegModel *C2DNavierRegModelPlugin::do_create()const
diff --git a/mia/2d/model/navier.hh b/mia/2d/model/navier.hh
index 2171351..a9a368a 100644
--- a/mia/2d/model/navier.hh
+++ b/mia/2d/model/navier.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/model/naviera.cc b/mia/2d/model/naviera.cc
index 98712cd..71c8256 100644
--- a/mia/2d/model/naviera.cc
+++ b/mia/2d/model/naviera.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -175,16 +175,11 @@ C2DNavierRegModelPlugin::C2DNavierRegModelPlugin():
 	m_epsilon(0.0001),
 	m_maxiter(100)
 {
-	add_parameter("mu", new CFloatParameter(m_mu, 0.0, numeric_limits<float>::max(),
-							   false, "isotropic compliance"));
-	add_parameter("lambda", new CFloatParameter(m_lambda, 0.0, numeric_limits<float>::max(),
-							       false, "isotropic compression"));
-	add_parameter("omega", new CFloatParameter(m_omega, 0.1, 10,
-							      false, "relexation parameter"));
-	add_parameter("epsilon", new CFloatParameter(m_epsilon, 0.000001, 0.1,
-								false, "stopping parameter"));
-	add_parameter("iter", new CIntParameter(m_maxiter, 10, 10000,
-							   false, "maximum number of iterations"));
+	add_parameter("mu", make_nonnegative_param(m_mu, false, "isotropic compliance"));
+	add_parameter("lambda", make_nonnegative_param(m_lambda, false, "isotropic compression"));
+	add_parameter("omega", make_ci_param(m_omega, 0.1, 10, false, "relexation parameter"));
+	add_parameter("epsilon", make_oci_param(m_epsilon, 0.0, 0.1, false, "stopping parameter"));
+	add_parameter("iter", make_ci_param(m_maxiter, 1, 10000, false, "maximum number of iterations"));
 }
 
 C2DRegModel *C2DNavierRegModelPlugin::do_create()const
diff --git a/mia/2d/model/naviera.hh b/mia/2d/model/naviera.hh
index 7fd824c..4d864c3 100644
--- a/mia/2d/model/naviera.hh
+++ b/mia/2d/model/naviera.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/model/test_identity.cc b/mia/2d/model/test_identity.cc
index 7eaf688..35ed563 100644
--- a/mia/2d/model/test_identity.cc
+++ b/mia/2d/model/test_identity.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/model/test_navier.cc b/mia/2d/model/test_navier.cc
index d0244f9..69989c3 100644
--- a/mia/2d/model/test_navier.cc
+++ b/mia/2d/model/test_navier.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/model/test_naviera.cc b/mia/2d/model/test_naviera.cc
index 498902a..d3369e1 100644
--- a/mia/2d/model/test_naviera.cc
+++ b/mia/2d/model/test_naviera.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/modelsolverreg.cc b/mia/2d/modelsolverreg.cc
index 5b1f867..f2bb351 100644
--- a/mia/2d/modelsolverreg.cc
+++ b/mia/2d/modelsolverreg.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/modelsolverreg.hh b/mia/2d/modelsolverreg.hh
index 425f3d8..65e1fdc 100644
--- a/mia/2d/modelsolverreg.hh
+++ b/mia/2d/modelsolverreg.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/morphshape.cc b/mia/2d/morphshape.cc
index 45c93c7..b3ece4b 100644
--- a/mia/2d/morphshape.cc
+++ b/mia/2d/morphshape.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/morphshape.hh b/mia/2d/morphshape.hh
index a7ab808..3eb33be 100644
--- a/mia/2d/morphshape.hh
+++ b/mia/2d/morphshape.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/multicost.cc b/mia/2d/multicost.cc
index e2c153a..8e617fb 100644
--- a/mia/2d/multicost.cc
+++ b/mia/2d/multicost.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/multicost.hh b/mia/2d/multicost.hh
index 32d38b5..44452b7 100644
--- a/mia/2d/multicost.hh
+++ b/mia/2d/multicost.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/nfg.cc b/mia/2d/nfg.cc
index 6e2fec8..eaeac05 100644
--- a/mia/2d/nfg.cc
+++ b/mia/2d/nfg.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/nfg.hh b/mia/2d/nfg.hh
index e2483b1..bdede88 100644
--- a/mia/2d/nfg.hh
+++ b/mia/2d/nfg.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/nonrigidregister.cc b/mia/2d/nonrigidregister.cc
index 70ebceb..50ac2bc 100644
--- a/mia/2d/nonrigidregister.cc
+++ b/mia/2d/nonrigidregister.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/nonrigidregister.hh b/mia/2d/nonrigidregister.hh
index 52047aa..799a77a 100644
--- a/mia/2d/nonrigidregister.hh
+++ b/mia/2d/nonrigidregister.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/perfusion.cc b/mia/2d/perfusion.cc
index 1f151b0..94b47df 100644
--- a/mia/2d/perfusion.cc
+++ b/mia/2d/perfusion.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/perfusion.hh b/mia/2d/perfusion.hh
index 5744064..2853d18 100644
--- a/mia/2d/perfusion.hh
+++ b/mia/2d/perfusion.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/polygon.cc b/mia/2d/polygon.cc
index e07b957..22055ec 100644
--- a/mia/2d/polygon.cc
+++ b/mia/2d/polygon.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/polygon.hh b/mia/2d/polygon.hh
index e9a444b..36638bf 100644
--- a/mia/2d/polygon.hh
+++ b/mia/2d/polygon.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/ppmatrix.cc b/mia/2d/ppmatrix.cc
index 068a376..c786cbf 100644
--- a/mia/2d/ppmatrix.cc
+++ b/mia/2d/ppmatrix.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -267,8 +267,8 @@ double C2DPPDivcurlMatrixImpl::evaluate(const T2DDatafield<C2DDVector>& coeffici
 	assert(coefficients.size() == m_nodes); 
 	assert(gradient.size() == coefficients.size() * 2); 
 #if defined(__SSE2__)
-	register __m128d result_a = {0.0, 0.0}; 
-	register __m128d result_b = result_a; 
+	__m128d result_a = {0.0, 0.0}; 
+	__m128d result_b = result_a; 
 	
 	auto p = m_P.begin(); 
 	auto pe = m_P.end(); 
@@ -330,9 +330,9 @@ double C2DPPDivcurlMatrixImpl::evaluate(const C2DFVectorfield& coefficients,
 {
 	assert(coefficients.size() == m_nodes); 
 	assert(gradient.size() == coefficients.size() * 2); 
-	register double result_1 = 0.0; 
-	register double result_2 = 0.0; 
-	register double result_3 = 0.0; 
+	double result_1 = 0.0; 
+	double result_2 = 0.0; 
+	double result_3 = 0.0; 
 	for (auto p = m_P.begin(); p != m_P.end();++p) {
 		auto ci = coefficients[p->i]; 
 		auto cj = coefficients[p->j]; 
diff --git a/mia/2d/ppmatrix.hh b/mia/2d/ppmatrix.hh
index 4f24a7c..6a17ab0 100644
--- a/mia/2d/ppmatrix.hh
+++ b/mia/2d/ppmatrix.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/register.cc b/mia/2d/register.cc
index cf4d28b..3e4dca5 100644
--- a/mia/2d/register.cc
+++ b/mia/2d/register.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/register.hh b/mia/2d/register.hh
index 3555311..5518e2d 100644
--- a/mia/2d/register.hh
+++ b/mia/2d/register.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/rgbimageio.cc b/mia/2d/rgbimageio.cc
index 36e93b9..20ee992 100644
--- a/mia/2d/rgbimageio.cc
+++ b/mia/2d/rgbimageio.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/rgbimageio.hh b/mia/2d/rgbimageio.hh
index b094f41..f7701cd 100644
--- a/mia/2d/rgbimageio.hh
+++ b/mia/2d/rgbimageio.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/rgbio/CMakeLists.txt b/mia/2d/rgbio/CMakeLists.txt
index 9906a78..9895874 100644
--- a/mia/2d/rgbio/CMakeLists.txt
+++ b/mia/2d/rgbio/CMakeLists.txt
@@ -1,6 +1,6 @@
 #
 # This file is part of MIA - a toolbox for medical image analysis 
-# Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+# 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
diff --git a/mia/2d/rgbio/bmp.cc b/mia/2d/rgbio/bmp.cc
index da180bd..0e2f806 100644
--- a/mia/2d/rgbio/bmp.cc
+++ b/mia/2d/rgbio/bmp.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/rigidregister.cc b/mia/2d/rigidregister.cc
index 8440011..48aea23 100644
--- a/mia/2d/rigidregister.cc
+++ b/mia/2d/rigidregister.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/rigidregister.hh b/mia/2d/rigidregister.hh
index 469fee0..2cd5076 100644
--- a/mia/2d/rigidregister.hh
+++ b/mia/2d/rigidregister.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/segframe.cc b/mia/2d/segframe.cc
index 61f1a9c..e58cc91 100644
--- a/mia/2d/segframe.cc
+++ b/mia/2d/segframe.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -23,7 +23,6 @@
 #include <mia/2d/segframe.hh>
 #include <mia/core/msgstream.hh>
 #include <mia/core/errormacro.hh>
-#include <mia/core/bfsv23dispatch.hh>
 #include <mia/2d/imageio.hh>
 #include <mia/2d/angle.hh>
 
@@ -61,6 +60,23 @@ CSegFrame::CSegFrame(const string& image, const CSegStar& star, const Sections&
 }
 
 
+template <typename T>
+void read_attribute_from_node(const xmlpp::Element& elm, const std::string& key, T& out_value, bool required)
+{
+	auto attr = elm.get_attribute(key);
+	if (!attr) {
+		if (required) 
+			throw create_exception<std::runtime_error>( elm.get_name(), ":required attribute '", key, "' not found"); 
+		else 
+			return; 
+	}
+	
+	if (!from_string(attr->get_value(), out_value)) 
+		throw create_exception<std::runtime_error>( elm.get_name(), ":attribute '", key, "' has bogus value '", 
+						       attr->get_value(), "'");
+}
+
+
 CSegFrame::CSegFrame(const Node& node, int version):
 	m_has_star(false), 
 	m_quality(0),
@@ -99,9 +115,9 @@ CSegFrame::CSegFrame(const Node& node, int version):
 		if (version == 2 && m_sections.size() > 2)
 			cvwarn() << "CSegFrame: gor a version 2 segmentation, but more then two sections, this may be bogus\n";
 			
-		read_attribute_from_node(elm, "quality", m_quality);  
-		read_attribute_from_node(elm, "brightness", m_brightness);  
-		read_attribute_from_node(elm, "contrast", m_contrast);  
+		read_attribute_from_node(elm, "quality", m_quality, false);  
+		read_attribute_from_node(elm, "brightness", m_brightness, false);  
+		read_attribute_from_node(elm, "contrast", m_contrast, false);  
 	}
 }
 
@@ -118,8 +134,8 @@ void CSegFrame::set_imagename(const std::string& name)
 void CSegFrame::rename_base(const std::string& new_base)
 {
 	bfs::path filename(m_filename); 
-	string suffix = __bfs_get_extension(filename); 
-	string name = __bfs_get_stem(filename);
+	string suffix = filename.extension().string(); 
+	string name = filename.stem().string();
 	auto i = name.rbegin();
 	int k = 0; 
 	while (i != name.rend() && isdigit(*i) ) {
diff --git a/mia/2d/segframe.hh b/mia/2d/segframe.hh
index 04e95c0..f46f39d 100644
--- a/mia/2d/segframe.hh
+++ b/mia/2d/segframe.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/segpoint.cc b/mia/2d/segpoint.cc
index 8934bf7..a5094a1 100644
--- a/mia/2d/segpoint.cc
+++ b/mia/2d/segpoint.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/segpoint.hh b/mia/2d/segpoint.hh
index e46e160..5359e6c 100644
--- a/mia/2d/segpoint.hh
+++ b/mia/2d/segpoint.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -21,14 +21,15 @@
 #ifndef mia_2d_SegPoint_hh
 #define mia_2d_SegPoint_hh
 
-namespace xmlpp {
-	class Node;
-};
-
 #include <mia/2d/vector.hh>
 #include <mia/2d/defines2d.hh>
 #include <mia/2d/transform.hh>
 
+namespace xmlpp {
+class Node;
+class Element; 
+}
+
 NS_MIA_BEGIN
 
 /**
@@ -83,23 +84,9 @@ public:
 
 
 template <typename T>
-void read_attribute_from_node(const xmlpp::Element& elm, const std::string& key, T& out_value, bool required = false)
-{
-	auto attr = elm.get_attribute(key);
-	if (!attr) {
-		if (required) 
-			throw create_exception<std::runtime_error>( elm.get_name(), ":required attribute '", key, "' not found"); 
-		else 
-			return; 
-	}
-	
-	if (!from_string(attr->get_value(), out_value)) 
-		throw create_exception<std::runtime_error>( elm.get_name(), ":attribute '", key, "' has bogus value '", 
-						       attr->get_value(), "'");
-}
-
+void read_attribute_from_node(const xmlpp::Element& elm, const std::string& key, T& out_value, bool required); 
 
-void read_attribute_from_node(const xmlpp::Element& elm, const std::string& key, bool& out_value, bool required = false); 
+void read_attribute_from_node(const xmlpp::Element& elm, const std::string& key, bool& out_value, bool required); 
 
 NS_MIA_END
 
diff --git a/mia/2d/segsection.cc b/mia/2d/segsection.cc
index dfecd6a..ff194a4 100644
--- a/mia/2d/segsection.cc
+++ b/mia/2d/segsection.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -58,7 +58,7 @@ CSegSection::CSegSection(xmlpp::Node& node, int version):
 		m_points.push_back(CSegPoint2D(**i));
 
 	if (version > 1) {
-		read_attribute_from_node(elm, "open", m_is_open);  
+		read_attribute_from_node(elm, "open", m_is_open, false);  
 	}
 }
 
diff --git a/mia/2d/segsection.hh b/mia/2d/segsection.hh
index 20c7eda..d8c314b 100644
--- a/mia/2d/segsection.hh
+++ b/mia/2d/segsection.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/segset.cc b/mia/2d/segset.cc
index bdcfc4f..e17c5db 100644
--- a/mia/2d/segset.cc
+++ b/mia/2d/segset.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/segset.hh b/mia/2d/segset.hh
index 56483dd..9fe2ecc 100644
--- a/mia/2d/segset.hh
+++ b/mia/2d/segset.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/segsetwithimages.cc b/mia/2d/segsetwithimages.cc
index af1b7b4..633362e 100644
--- a/mia/2d/segsetwithimages.cc
+++ b/mia/2d/segsetwithimages.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/segsetwithimages.hh b/mia/2d/segsetwithimages.hh
index fd3dcac..d2142ba 100644
--- a/mia/2d/segsetwithimages.hh
+++ b/mia/2d/segsetwithimages.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/segstar.cc b/mia/2d/segstar.cc
index 9394bcd..86af9ec 100644
--- a/mia/2d/segstar.cc
+++ b/mia/2d/segstar.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/segstar.hh b/mia/2d/segstar.hh
index e5caddd..7f39590 100644
--- a/mia/2d/segstar.hh
+++ b/mia/2d/segstar.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/shape.cc b/mia/2d/shape.cc
index 98e8d87..a230835 100644
--- a/mia/2d/shape.cc
+++ b/mia/2d/shape.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/shape.hh b/mia/2d/shape.hh
index e8ed038..3c30055 100644
--- a/mia/2d/shape.hh
+++ b/mia/2d/shape.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/shapes/CMakeLists.txt b/mia/2d/shapes/CMakeLists.txt
index 7c4118d..10183c6 100644
--- a/mia/2d/shapes/CMakeLists.txt
+++ b/mia/2d/shapes/CMakeLists.txt
@@ -1,6 +1,6 @@
 #
 # This file is part of MIA - a toolbox for medical image analysis 
-# Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+# 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
diff --git a/mia/2d/shapes/basic_shapes.cc b/mia/2d/shapes/basic_shapes.cc
index dae19ab..1eecc26 100644
--- a/mia/2d/shapes/basic_shapes.cc
+++ b/mia/2d/shapes/basic_shapes.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/shapes/basic_shapes.hh b/mia/2d/shapes/basic_shapes.hh
index 338467d..8d58138 100644
--- a/mia/2d/shapes/basic_shapes.hh
+++ b/mia/2d/shapes/basic_shapes.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/shapes/rect.cc b/mia/2d/shapes/rect.cc
index 54fdbbe..85180ab 100644
--- a/mia/2d/shapes/rect.cc
+++ b/mia/2d/shapes/rect.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -46,7 +46,7 @@ CSquare2DShapePlugin::CSquare2DShapePlugin():
 	m_width(2), 
 	m_filled(true)
 {
-	add_parameter("width", new CIntParameter(m_width, 0, numeric_limits<int>::max(), false, "width of rectangle"));
+	add_parameter("width", make_lc_param(m_width, 1, false, "width of rectangle"));
 	add_parameter("fill", new CBoolParameter(m_filled, false, "create a filled shape"));
 }
 
@@ -68,8 +68,8 @@ CRectangle2DShapePlugin::CRectangle2DShapePlugin():
 	m_height(2), 
 	m_filled(true)
 {
-	add_parameter("width", new CIntParameter(m_width, 0, numeric_limits<int>::max(), false, "width of rectangle"));
-	add_parameter("height", new CIntParameter(m_height, 0, numeric_limits<int>::max(), false, "height of rectangle"));
+	add_parameter("width", make_lc_param(m_width, 1, false, "width of rectangle"));
+	add_parameter("height", make_lc_param(m_height, 1, false, "height of rectangle"));
 	add_parameter("fill", new CBoolParameter(m_filled, false, "create a filled shape"));
 }
 
diff --git a/mia/2d/shapes/rect.hh b/mia/2d/shapes/rect.hh
index e5f3209..41d58d8 100644
--- a/mia/2d/shapes/rect.hh
+++ b/mia/2d/shapes/rect.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/shapes/sphere.cc b/mia/2d/shapes/sphere.cc
index a74d657..2d1d6dc 100644
--- a/mia/2d/shapes/sphere.cc
+++ b/mia/2d/shapes/sphere.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -51,7 +51,7 @@ CSphere2DShapeFactory::CSphere2DShapeFactory():
 	C2DShapePlugin("sphere"),
 	m_r(2)
 {
-	add_parameter("r", new CFloatParameter(m_r, 0, numeric_limits<float>::max(), false, "sphere radius"));
+	add_parameter("r", make_positive_param(m_r, false, "sphere radius"));
 }
 
 C2DShape *CSphere2DShapeFactory::do_create()const
diff --git a/mia/2d/shapes/sphere.hh b/mia/2d/shapes/sphere.hh
index 831bbf2..23012ca 100644
--- a/mia/2d/shapes/sphere.hh
+++ b/mia/2d/shapes/sphere.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/shapes/test_basic_shapes.cc b/mia/2d/shapes/test_basic_shapes.cc
index ca0de07..465d421 100644
--- a/mia/2d/shapes/test_basic_shapes.cc
+++ b/mia/2d/shapes/test_basic_shapes.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/shapes/test_rect.cc b/mia/2d/shapes/test_rect.cc
index 6856ab0..4d72f84 100644
--- a/mia/2d/shapes/test_rect.cc
+++ b/mia/2d/shapes/test_rect.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/shapes/test_sphere.cc b/mia/2d/shapes/test_sphere.cc
index 637ba00..5afe7e6 100644
--- a/mia/2d/shapes/test_sphere.cc
+++ b/mia/2d/shapes/test_sphere.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/similarity_profile.cc b/mia/2d/similarity_profile.cc
index 5673044..2ec8316 100644
--- a/mia/2d/similarity_profile.cc
+++ b/mia/2d/similarity_profile.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/similarity_profile.hh b/mia/2d/similarity_profile.hh
index bce6cfe..977fdd7 100644
--- a/mia/2d/similarity_profile.hh
+++ b/mia/2d/similarity_profile.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/sparse_image_solver.cc b/mia/2d/sparse_image_solver.cc
index 3bd18e8..8ced76d 100644
--- a/mia/2d/sparse_image_solver.cc
+++ b/mia/2d/sparse_image_solver.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/sparse_image_solver.hh b/mia/2d/sparse_image_solver.hh
index 2e55e3d..903da14 100644
--- a/mia/2d/sparse_image_solver.hh
+++ b/mia/2d/sparse_image_solver.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/splinepenalty/CMakeLists.txt b/mia/2d/splinepenalty/CMakeLists.txt
index 166dc03..9852203 100644
--- a/mia/2d/splinepenalty/CMakeLists.txt
+++ b/mia/2d/splinepenalty/CMakeLists.txt
@@ -1,6 +1,6 @@
 #
 # This file is part of MIA - a toolbox for medical image analysis 
-# Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+# 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
diff --git a/mia/2d/splinepenalty/divcurl.cc b/mia/2d/splinepenalty/divcurl.cc
index 808f797..3f4ddfa 100644
--- a/mia/2d/splinepenalty/divcurl.cc
+++ b/mia/2d/splinepenalty/divcurl.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -67,10 +67,8 @@ C2DDivcurlSplinePenaltyPlugin::C2DDivcurlSplinePenaltyPlugin():
 	m_div_weight(1.0), 
 	m_curl_weight(1.0)
 {
-	this->add_parameter("div", new CFloatParameter(m_div_weight, 0.0f, std::numeric_limits<float>::max(), 
-						       false, "penalty weight on divergence"));
-	this->add_parameter("curl", new CFloatParameter(m_curl_weight, 0.0f, std::numeric_limits<float>::max(), 
-							false, "penalty weight on curl"));
+	this->add_parameter("div", make_nonnegative_param(m_div_weight, false, "penalty weight on divergence"));
+	this->add_parameter("curl", make_nonnegative_param(m_curl_weight, false, "penalty weight on curl"));
 	
 }
 
diff --git a/mia/2d/splinepenalty/divcurl.hh b/mia/2d/splinepenalty/divcurl.hh
index 0686168..7ebd508 100644
--- a/mia/2d/splinepenalty/divcurl.hh
+++ b/mia/2d/splinepenalty/divcurl.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/splinepenalty/test_divcurl.cc b/mia/2d/splinepenalty/test_divcurl.cc
index b9a0828..37ef99f 100644
--- a/mia/2d/splinepenalty/test_divcurl.cc
+++ b/mia/2d/splinepenalty/test_divcurl.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/splinetransformpenalty.cc b/mia/2d/splinetransformpenalty.cc
index f33f9c6..e4edd9f 100644
--- a/mia/2d/splinetransformpenalty.cc
+++ b/mia/2d/splinetransformpenalty.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -111,8 +111,8 @@ C2DSplineTransformPenaltyPlugin::C2DSplineTransformPenaltyPlugin(char const * co
 	m_weight(1.0), 
 	m_normalize(false)
 {
-	add_parameter("weight", new CFloatParameter(m_weight, 0.0f, std::numeric_limits<float>::max(), 
-						    false, "weight of penalty energy"));
+	add_parameter("weight", new CFBoundedParameter(m_weight, EParameterBounds::bf_min_open, {0.0f},
+						       false, "weight of penalty energy"));
 	add_parameter("norm", new CBoolParameter(m_normalize, false, "Set to 1 if the penalty should be normalized " 
 						 "with respect to the image size")); 
 }
@@ -135,8 +135,6 @@ EXPLICIT_INSTANCE_DERIVED_FACTORY_HANDLER(C2DSplineTransformPenalty, C2DSplineTr
 
 C2DSplineTransformPenaltyPluginHandlerTest::C2DSplineTransformPenaltyPluginHandlerTest()
 {
-	CPathNameArray plugpath({bfs::path("splinepenalty")});
-	C2DSplineTransformPenaltyPluginHandler::set_search_path(plugpath);
 
 }
 
diff --git a/mia/2d/splinetransformpenalty.hh b/mia/2d/splinetransformpenalty.hh
index 3299ee9..5c1d29b 100644
--- a/mia/2d/splinetransformpenalty.hh
+++ b/mia/2d/splinetransformpenalty.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/test_2d.cc b/mia/2d/test_2d.cc
index f20d00d..506e6be 100644
--- a/mia/2d/test_2d.cc
+++ b/mia/2d/test_2d.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/test_angle.cc b/mia/2d/test_angle.cc
index 56e4609..12cea1c 100644
--- a/mia/2d/test_angle.cc
+++ b/mia/2d/test_angle.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/test_boundingbox.cc b/mia/2d/test_boundingbox.cc
index a7e6aa1..154fa54 100644
--- a/mia/2d/test_boundingbox.cc
+++ b/mia/2d/test_boundingbox.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/test_combiner.cc b/mia/2d/test_combiner.cc
index ee76058..8202f8b 100644
--- a/mia/2d/test_combiner.cc
+++ b/mia/2d/test_combiner.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -32,10 +32,6 @@ namespace bfs=boost::filesystem;
 
 BOOST_AUTO_TEST_CASE( test_load_plugins ) 
 {	
-	CPathNameArray plugpath;
-	plugpath.push_back(bfs::path("combiner"));
-	C2DImageCombinerPluginHandler::set_search_path(plugpath);
-
 	const C2DImageCombinerPluginHandler::Instance& handler = C2DImageCombinerPluginHandler::instance(); 
 	BOOST_CHECK_EQUAL(handler.size(), 5u); 
 	BOOST_CHECK_EQUAL(handler.get_plugin_names(), "absdiff add div mul sub ");
diff --git a/mia/2d/test_correlation_weight.cc b/mia/2d/test_correlation_weight.cc
index 3f531f5..426573d 100644
--- a/mia/2d/test_correlation_weight.cc
+++ b/mia/2d/test_correlation_weight.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -156,9 +156,6 @@ namespace bfs=boost::filesystem;
 
 FixPluginpath::FixPluginpath()
 {
-	CPathNameArray minimizerpath;
-	minimizerpath.push_back(bfs::path("../core/minimizer"));
-	CMinimizerPluginHandler::set_search_path(minimizerpath); 
 }
 
 FixPluginpath PseudoGroundTruthFixture::fix; 
diff --git a/mia/2d/test_cost.cc b/mia/2d/test_cost.cc
index 298976f..e3aa77c 100644
--- a/mia/2d/test_cost.cc
+++ b/mia/2d/test_cost.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/test_datafield.cc b/mia/2d/test_datafield.cc
index 3f87372..e5e809e 100644
--- a/mia/2d/test_datafield.cc
+++ b/mia/2d/test_datafield.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/test_distance.cc b/mia/2d/test_distance.cc
index 0756042..22b405d 100644
--- a/mia/2d/test_distance.cc
+++ b/mia/2d/test_distance.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/test_divcurlmatrix.cc b/mia/2d/test_divcurlmatrix.cc
index 3fb55e8..0b32a15 100644
--- a/mia/2d/test_divcurlmatrix.cc
+++ b/mia/2d/test_divcurlmatrix.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/test_filter.cc b/mia/2d/test_filter.cc
index acae766..209fda3 100644
--- a/mia/2d/test_filter.cc
+++ b/mia/2d/test_filter.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -29,6 +29,10 @@
 #include <mia/2d/filtertest.hh>
 
 
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif 
+
 NS_MIA_USE
 using namespace std; 
 
@@ -40,9 +44,12 @@ BOOST_AUTO_TEST_CASE(test_available_filters)
 		"adaptmed", "admean", "aniso", "bandpass", "binarize", "close", "combiner", "convert", "crop", 
 		"dilate", "distance", "downscale", "erode", "gauss", "gradnorm", "invert", "kmeans", 
 		"label", "labelmap", "labelscale", "load", "mask", "mean", "median", "mlv", "ngfnorm", "noise", "open",
-		"pruning", "regiongrow", "sandp", "scale", "selectbig", "sepconv", "shmean", "sort-label", 
-		"sws", "tee", "thinning", "thresh", "transform", "ws"}; 
+		"pruning", "regiongrow", "sandp", "scale", "selectbig", "sepconv", "shmean", "sobel", "sort-label", 
+		"sws", "tee", "thinning", "thresh", "transform", "ws"};
 
+#ifdef HAVE_MAXFLOW
+	test_data.insert("maxflow"); 
+#endif 
 	test_availabe_plugins(handler, test_data); 
 }
 
diff --git a/mia/2d/test_filter_cast.cc b/mia/2d/test_filter_cast.cc
index a54e743..dfb1b37 100644
--- a/mia/2d/test_filter_cast.cc
+++ b/mia/2d/test_filter_cast.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/test_fullcost.cc b/mia/2d/test_fullcost.cc
index b4f77bd..f4a8c18 100644
--- a/mia/2d/test_fullcost.cc
+++ b/mia/2d/test_fullcost.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -387,17 +387,5 @@ const C2DTransformCreatorHandler::Instance& PrepareFullcostTests::transform_hand
 
 PrepareFullcostTests::PrepareFullcostTests()
 {
-	CPathNameArray cost_kernel_plugpath;
-	cost_kernel_plugpath.push_back(bfs::path("cost"));
-	C2DImageCostPluginHandler::set_search_path(cost_kernel_plugpath);
-	
-	CPathNameArray cost_plugpath;
-	cost_plugpath.push_back(bfs::path("fullcost"));
-	C2DFullCostPluginHandler::set_search_path(cost_plugpath);
-
-	CPathNameArray transform_searchpath;
-	transform_searchpath.push_back(bfs::path("transform"));
-	C2DTransformCreatorHandler::set_search_path(transform_searchpath);
-
 }
 
diff --git a/mia/2d/test_fullcost_mi_spline.cc b/mia/2d/test_fullcost_mi_spline.cc
index 9780d45..d26324b 100644
--- a/mia/2d/test_fullcost_mi_spline.cc
+++ b/mia/2d/test_fullcost_mi_spline.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/test_groundtruthproblem.cc b/mia/2d/test_groundtruthproblem.cc
index 3bf655e..dce6643 100644
--- a/mia/2d/test_groundtruthproblem.cc
+++ b/mia/2d/test_groundtruthproblem.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/test_ica.cc b/mia/2d/test_ica.cc
index d03dcf8..bf0524c 100644
--- a/mia/2d/test_ica.cc
+++ b/mia/2d/test_ica.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/test_image.cc b/mia/2d/test_image.cc
index 13efa1b..c003029 100644
--- a/mia/2d/test_image.cc
+++ b/mia/2d/test_image.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/test_imagecostbase.cc b/mia/2d/test_imagecostbase.cc
index 716990c..1b0664e 100644
--- a/mia/2d/test_imagecostbase.cc
+++ b/mia/2d/test_imagecostbase.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/test_imageio.cc b/mia/2d/test_imageio.cc
index 540daa9..53b1333 100644
--- a/mia/2d/test_imageio.cc
+++ b/mia/2d/test_imageio.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/test_interpol.cc b/mia/2d/test_interpol.cc
index 8314d30..eae4377 100644
--- a/mia/2d/test_interpol.cc
+++ b/mia/2d/test_interpol.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/test_iterator.cc b/mia/2d/test_iterator.cc
index 3238812..e5d73f3 100644
--- a/mia/2d/test_iterator.cc
+++ b/mia/2d/test_iterator.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/test_matrix.cc b/mia/2d/test_matrix.cc
index 9f920ae..3d2015f 100644
--- a/mia/2d/test_matrix.cc
+++ b/mia/2d/test_matrix.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/test_modelsolverreg.cc b/mia/2d/test_modelsolverreg.cc
index 7cf402a..53f876b 100644
--- a/mia/2d/test_modelsolverreg.cc
+++ b/mia/2d/test_modelsolverreg.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/test_morphshape.cc b/mia/2d/test_morphshape.cc
index c776386..c3d87d3 100644
--- a/mia/2d/test_morphshape.cc
+++ b/mia/2d/test_morphshape.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/test_nfg.cc b/mia/2d/test_nfg.cc
index c49f139..33b6573 100644
--- a/mia/2d/test_nfg.cc
+++ b/mia/2d/test_nfg.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/test_nonrigidregister.cc b/mia/2d/test_nonrigidregister.cc
index 7baca16..d01a1e6 100644
--- a/mia/2d/test_nonrigidregister.cc
+++ b/mia/2d/test_nonrigidregister.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/test_oldnewintegrate.cc b/mia/2d/test_oldnewintegrate.cc
index 1cfe490..73ff20e 100644
--- a/mia/2d/test_oldnewintegrate.cc
+++ b/mia/2d/test_oldnewintegrate.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/test_param.cc b/mia/2d/test_param.cc
index 016fa7b..631fadf 100644
--- a/mia/2d/test_param.cc
+++ b/mia/2d/test_param.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/test_perfusion.cc b/mia/2d/test_perfusion.cc
index be84021..636a12e 100644
--- a/mia/2d/test_perfusion.cc
+++ b/mia/2d/test_perfusion.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/test_polygon.cc b/mia/2d/test_polygon.cc
index 90bb3e6..5dca688 100644
--- a/mia/2d/test_polygon.cc
+++ b/mia/2d/test_polygon.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/test_ppmatrix.cc b/mia/2d/test_ppmatrix.cc
index 8689acf..77aae8a 100644
--- a/mia/2d/test_ppmatrix.cc
+++ b/mia/2d/test_ppmatrix.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/test_register.cc b/mia/2d/test_register.cc
index 2f931fb..3b37f9d 100644
--- a/mia/2d/test_register.cc
+++ b/mia/2d/test_register.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/test_regplugins.cc b/mia/2d/test_regplugins.cc
index 23604aa..c0fa9e0 100644
--- a/mia/2d/test_regplugins.cc
+++ b/mia/2d/test_regplugins.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/test_rigidregister.cc b/mia/2d/test_rigidregister.cc
index 6512cfe..5e8b7a5 100644
--- a/mia/2d/test_rigidregister.cc
+++ b/mia/2d/test_rigidregister.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/test_segframe.cc b/mia/2d/test_segframe.cc
index d8ee634..d1beb0f 100644
--- a/mia/2d/test_segframe.cc
+++ b/mia/2d/test_segframe.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/test_segmentation.cc b/mia/2d/test_segmentation.cc
index 429712b..763388a 100644
--- a/mia/2d/test_segmentation.cc
+++ b/mia/2d/test_segmentation.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/test_segpoint.cc b/mia/2d/test_segpoint.cc
index 366e87d..591581a 100644
--- a/mia/2d/test_segpoint.cc
+++ b/mia/2d/test_segpoint.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/test_shape.cc b/mia/2d/test_shape.cc
index 08d2867..f9479a8 100644
--- a/mia/2d/test_shape.cc
+++ b/mia/2d/test_shape.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/test_similarity_profile.cc b/mia/2d/test_similarity_profile.cc
index 25fd280..fbd62c1 100644
--- a/mia/2d/test_similarity_profile.cc
+++ b/mia/2d/test_similarity_profile.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/test_sparse_image_solver.cc b/mia/2d/test_sparse_image_solver.cc
index abd180a..f4f9a9e 100644
--- a/mia/2d/test_sparse_image_solver.cc
+++ b/mia/2d/test_sparse_image_solver.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/test_splinetransformpenalty.cc b/mia/2d/test_splinetransformpenalty.cc
index fdb3928..69e0a9a 100644
--- a/mia/2d/test_splinetransformpenalty.cc
+++ b/mia/2d/test_splinetransformpenalty.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/test_trackpoint.cc b/mia/2d/test_trackpoint.cc
index 8b4807a..b2e2b60 100644
--- a/mia/2d/test_trackpoint.cc
+++ b/mia/2d/test_trackpoint.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/test_transform.cc b/mia/2d/test_transform.cc
index e8efc9d..5af6c0d 100644
--- a/mia/2d/test_transform.cc
+++ b/mia/2d/test_transform.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -207,10 +207,6 @@ TransformGradientFixture::TransformGradientFixture():
 	gradient(size)
 
 {
-	CPathNameArray kernelsearchpath;
-	kernelsearchpath.push_back(bfs::path("transform"));
-	C2DTransformCreatorHandler::set_search_path(kernelsearchpath);
-
 	cost.value_and_gradient(gradient);
 	
 }
diff --git a/mia/2d/test_transformfactory.cc b/mia/2d/test_transformfactory.cc
index 7c3497e..4c7f307 100644
--- a/mia/2d/test_transformfactory.cc
+++ b/mia/2d/test_transformfactory.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/test_transio.cc b/mia/2d/test_transio.cc
index 3632cf8..32cc316 100644
--- a/mia/2d/test_transio.cc
+++ b/mia/2d/test_transio.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/test_vector.cc b/mia/2d/test_vector.cc
index 756f988..2d3e6c8 100644
--- a/mia/2d/test_vector.cc
+++ b/mia/2d/test_vector.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/test_vectorfield_interpolator.cc b/mia/2d/test_vectorfield_interpolator.cc
index 570be1f..aaece6b 100644
--- a/mia/2d/test_vectorfield_interpolator.cc
+++ b/mia/2d/test_vectorfield_interpolator.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/test_vfio.cc b/mia/2d/test_vfio.cc
index a94c2bc..9712b13 100644
--- a/mia/2d/test_vfio.cc
+++ b/mia/2d/test_vfio.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/timestep.cc b/mia/2d/timestep.cc
index 4bdd1bc..282049f 100644
--- a/mia/2d/timestep.cc
+++ b/mia/2d/timestep.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -32,8 +32,7 @@ using std::numeric_limits;
 C2DRegTimeStep::C2DRegTimeStep(float min, float max):
 	m_min(min),
 	m_max(max),
-	m_current((max - min)/ 2.0 + min ),
-	m_step((max-min) / 20)
+	m_current((max - min)/ 2.0 + min )
 {
 }
 
@@ -87,10 +86,10 @@ C2DRegTimeStepPlugin::C2DRegTimeStepPlugin(const char *name):
 	m_min(0.1),
 	m_max(2.0)
 {
-	add_parameter("min", new CFloatParameter(m_min, 0.001, numeric_limits<float>::max(),
-							   false, "minimum time step allowed"));
-	add_parameter("max", new CFloatParameter(m_max, 0.002, numeric_limits<float>::max(),
-							       false, "maximum time step allowed"));
+	add_parameter("min", new CFBoundedParameter(m_min, EParameterBounds::bf_min_open, {0.0},
+						    false, "minimum time step allowed"));
+	add_parameter("max", new CFBoundedParameter(m_max, EParameterBounds::bf_min_open, {0.0},
+						    false, "maximum time step allowed"));
 }
 
 float C2DRegTimeStepPlugin::get_min_timestep() const
diff --git a/mia/2d/timestep.hh b/mia/2d/timestep.hh
index 096e9ca..9cae355 100644
--- a/mia/2d/timestep.hh
+++ b/mia/2d/timestep.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -114,7 +114,6 @@ private:
 	float m_min;
 	float m_max;
 	float m_current;
-	float m_step;
 };
 
 /// pointer type for the 2D registration time step 
diff --git a/mia/2d/timestep/CMakeLists.txt b/mia/2d/timestep/CMakeLists.txt
index cb2dae7..79ad24b 100644
--- a/mia/2d/timestep/CMakeLists.txt
+++ b/mia/2d/timestep/CMakeLists.txt
@@ -1,6 +1,6 @@
 #
 # This file is part of MIA - a toolbox for medical image analysis 
-# Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+# 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
diff --git a/mia/2d/timestep/direct.cc b/mia/2d/timestep/direct.cc
index e91b88f..1af3044 100644
--- a/mia/2d/timestep/direct.cc
+++ b/mia/2d/timestep/direct.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/timestep/direct.hh b/mia/2d/timestep/direct.hh
index f17905e..1461fbd 100644
--- a/mia/2d/timestep/direct.hh
+++ b/mia/2d/timestep/direct.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/timestep/fluid.cc b/mia/2d/timestep/fluid.cc
index 0ee0e91..e331221 100644
--- a/mia/2d/timestep/fluid.cc
+++ b/mia/2d/timestep/fluid.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/timestep/fluid.hh b/mia/2d/timestep/fluid.hh
index 88622fb..d1c3108 100644
--- a/mia/2d/timestep/fluid.hh
+++ b/mia/2d/timestep/fluid.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/timestep/test_direct.cc b/mia/2d/timestep/test_direct.cc
index 4dccea3..d79b72b 100644
--- a/mia/2d/timestep/test_direct.cc
+++ b/mia/2d/timestep/test_direct.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/timestep/test_fluid.cc b/mia/2d/timestep/test_fluid.cc
index 3d97a4f..6394a1e 100644
--- a/mia/2d/timestep/test_fluid.cc
+++ b/mia/2d/timestep/test_fluid.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/trackpoint.cc b/mia/2d/trackpoint.cc
index 501c1f2..6baf5db 100644
--- a/mia/2d/trackpoint.cc
+++ b/mia/2d/trackpoint.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/trackpoint.hh b/mia/2d/trackpoint.hh
index 15bca70..6248e95 100644
--- a/mia/2d/trackpoint.hh
+++ b/mia/2d/trackpoint.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 David Pastor, Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2015 Gert Wollny, David Pastor
  *
  * MIA is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
diff --git a/mia/2d/trait.hh b/mia/2d/trait.hh
index c184ca9..c1194eb 100644
--- a/mia/2d/trait.hh
+++ b/mia/2d/trait.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/transform.cc b/mia/2d/transform.cc
index b35fad3..e795c2f 100644
--- a/mia/2d/transform.cc
+++ b/mia/2d/transform.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/transform.hh b/mia/2d/transform.hh
index b378f5a..c1d2577 100644
--- a/mia/2d/transform.hh
+++ b/mia/2d/transform.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/transform/CMakeLists.txt b/mia/2d/transform/CMakeLists.txt
index c308a45..f614570 100644
--- a/mia/2d/transform/CMakeLists.txt
+++ b/mia/2d/transform/CMakeLists.txt
@@ -1,6 +1,6 @@
 #
 # This file is part of MIA - a toolbox for medical image analysis 
-# Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+# 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
diff --git a/mia/2d/transform/affine.cc b/mia/2d/transform/affine.cc
index 6ea2515..4143959 100644
--- a/mia/2d/transform/affine.cc
+++ b/mia/2d/transform/affine.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/transform/affine.hh b/mia/2d/transform/affine.hh
index b4b07da..f7f73de 100644
--- a/mia/2d/transform/affine.hh
+++ b/mia/2d/transform/affine.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/transform/rigid.cc b/mia/2d/transform/rigid.cc
index ca7b1f6..2f08b7f 100644
--- a/mia/2d/transform/rigid.cc
+++ b/mia/2d/transform/rigid.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/transform/rigid.hh b/mia/2d/transform/rigid.hh
index 7d0afe2..650f0f3 100644
--- a/mia/2d/transform/rigid.hh
+++ b/mia/2d/transform/rigid.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/transform/rotation.cc b/mia/2d/transform/rotation.cc
index b49007d..020fbb3 100644
--- a/mia/2d/transform/rotation.cc
+++ b/mia/2d/transform/rotation.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/transform/rotation.hh b/mia/2d/transform/rotation.hh
index f6a1683..03e93d6 100644
--- a/mia/2d/transform/rotation.hh
+++ b/mia/2d/transform/rotation.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/transform/spline.cc b/mia/2d/transform/spline.cc
index 4a54a4e..3105fbf 100644
--- a/mia/2d/transform/spline.cc
+++ b/mia/2d/transform/spline.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -739,8 +739,8 @@ C2DSplineTransformCreatorPlugin::C2DSplineTransformCreatorPlugin():
 	m_rate2d(0, 0)
 {
 	add_parameter("kernel", make_param(m_interpolator, "bspline:d=3", false, "transformation spline kernel."));
-	add_parameter("rate",   new CFloatParameter(m_rate, 1, numeric_limits<float>::max(), false,
-						    "isotropic coefficient rate in pixels"));
+	add_parameter("rate",   make_lc_param(m_rate, 1, false,
+					      "isotropic coefficient rate in pixels"));
 	add_parameter("anisorate",   new C2DFVectorParameter(m_rate2d, false, "anisotropic coefficient rate in pixels, "
 							     "nonpositive values will be overwritten by the 'rate' value."));
 	add_parameter("penalty", make_param(m_penalty, "", false, "Transformation penalty term")); 
diff --git a/mia/2d/transform/spline.hh b/mia/2d/transform/spline.hh
index 1d4ae9b..fd7746e 100644
--- a/mia/2d/transform/spline.hh
+++ b/mia/2d/transform/spline.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/transform/test_affine.cc b/mia/2d/transform/test_affine.cc
index 9d1e47a..5851646 100644
--- a/mia/2d/transform/test_affine.cc
+++ b/mia/2d/transform/test_affine.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/transform/test_nonlinear.cc b/mia/2d/transform/test_nonlinear.cc
index e4293f2..cca9755 100644
--- a/mia/2d/transform/test_nonlinear.cc
+++ b/mia/2d/transform/test_nonlinear.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/transform/test_rigid.cc b/mia/2d/transform/test_rigid.cc
index 5b97005..db65564 100644
--- a/mia/2d/transform/test_rigid.cc
+++ b/mia/2d/transform/test_rigid.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/transform/test_rotation.cc b/mia/2d/transform/test_rotation.cc
index add8ccf..8a4f28d 100644
--- a/mia/2d/transform/test_rotation.cc
+++ b/mia/2d/transform/test_rotation.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/transform/test_spline.cc b/mia/2d/transform/test_spline.cc
index e298a8c..28fd7a2 100644
--- a/mia/2d/transform/test_spline.cc
+++ b/mia/2d/transform/test_spline.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/transform/test_translate.cc b/mia/2d/transform/test_translate.cc
index 1335dd9..bb75301 100644
--- a/mia/2d/transform/test_translate.cc
+++ b/mia/2d/transform/test_translate.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/transform/test_vectorfield.cc b/mia/2d/transform/test_vectorfield.cc
index 84f7149..e83ebe5 100644
--- a/mia/2d/transform/test_vectorfield.cc
+++ b/mia/2d/transform/test_vectorfield.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/transform/translate.cc b/mia/2d/transform/translate.cc
index dad7fdf..dd6a463 100644
--- a/mia/2d/transform/translate.cc
+++ b/mia/2d/transform/translate.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/transform/translate.hh b/mia/2d/transform/translate.hh
index 907de21..41a149c 100644
--- a/mia/2d/transform/translate.hh
+++ b/mia/2d/transform/translate.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/transform/vectorfield.cc b/mia/2d/transform/vectorfield.cc
index 1e3bcc7..897eacb 100644
--- a/mia/2d/transform/vectorfield.cc
+++ b/mia/2d/transform/vectorfield.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/transform/vectorfield.hh b/mia/2d/transform/vectorfield.hh
index 9408287..6e35fac 100644
--- a/mia/2d/transform/vectorfield.hh
+++ b/mia/2d/transform/vectorfield.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/transformfactory.cc b/mia/2d/transformfactory.cc
index eef3929..986414a 100644
--- a/mia/2d/transformfactory.cc
+++ b/mia/2d/transformfactory.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/transformfactory.hh b/mia/2d/transformfactory.hh
index 6fc4c40..0430579 100644
--- a/mia/2d/transformfactory.hh
+++ b/mia/2d/transformfactory.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/transformio.cc b/mia/2d/transformio.cc
index 19d6907..747f3b8 100644
--- a/mia/2d/transformio.cc
+++ b/mia/2d/transformio.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -30,8 +30,8 @@ NS_MIA_BEGIN
 
 C2DTransformIOPluginHandlerImpl::C2DTransformIOPluginHandlerImpl()
 {
-	TTranslator<C2DFVector>::register_for(C2DTransformation::input_spacing_attr);
-	TTranslator<C2DFVector>::register_for(C2DTransformation::output_spacing_attr);
+	C2DFVectorTranslator::register_for(C2DTransformation::input_spacing_attr);
+	C2DFVectorTranslator::register_for(C2DTransformation::output_spacing_attr);
 }
 
 
diff --git a/mia/2d/transformio.hh b/mia/2d/transformio.hh
index f1dadd1..1bbd722 100644
--- a/mia/2d/transformio.hh
+++ b/mia/2d/transformio.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/transformmock.cc b/mia/2d/transformmock.cc
index fe13640..6c4d458 100644
--- a/mia/2d/transformmock.cc
+++ b/mia/2d/transformmock.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/transformmock.hh b/mia/2d/transformmock.hh
index ea9fa91..bedb5ab 100644
--- a/mia/2d/transformmock.hh
+++ b/mia/2d/transformmock.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/transio/CMakeLists.txt b/mia/2d/transio/CMakeLists.txt
index 57dc798..7fbda83 100644
--- a/mia/2d/transio/CMakeLists.txt
+++ b/mia/2d/transio/CMakeLists.txt
@@ -1,6 +1,6 @@
 #
 # This file is part of MIA - a toolbox for medical image analysis 
-# Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+# 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
diff --git a/mia/2d/transio/bbs.cc b/mia/2d/transio/bbs.cc
index 5aaea30..146fd72 100644
--- a/mia/2d/transio/bbs.cc
+++ b/mia/2d/transio/bbs.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/transio/pbs.cc b/mia/2d/transio/pbs.cc
index 6ad4a8a..d9bac6b 100644
--- a/mia/2d/transio/pbs.cc
+++ b/mia/2d/transio/pbs.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/transio/serialization.hh b/mia/2d/transio/serialization.hh
index 915eb42..d3d491c 100644
--- a/mia/2d/transio/serialization.hh
+++ b/mia/2d/transio/serialization.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/transio/xml.cc b/mia/2d/transio/xml.cc
index c84d182..b454306 100644
--- a/mia/2d/transio/xml.cc
+++ b/mia/2d/transio/xml.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/vector.hh b/mia/2d/vector.hh
index a8acb50..6f61af1 100644
--- a/mia/2d/vector.hh
+++ b/mia/2d/vector.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/vectorfield.cc b/mia/2d/vectorfield.cc
index 952a428..98931bb 100644
--- a/mia/2d/vectorfield.cc
+++ b/mia/2d/vectorfield.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/vectorfield.hh b/mia/2d/vectorfield.hh
index a48180f..8f363b5 100644
--- a/mia/2d/vectorfield.hh
+++ b/mia/2d/vectorfield.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/vfio.cc b/mia/2d/vfio.cc
index 5558554..9833273 100644
--- a/mia/2d/vfio.cc
+++ b/mia/2d/vfio.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/vfio.hh b/mia/2d/vfio.hh
index 35fd306..9f03f80 100644
--- a/mia/2d/vfio.hh
+++ b/mia/2d/vfio.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/vfiotest.cc b/mia/2d/vfiotest.cc
index 77ea934..2f32037 100644
--- a/mia/2d/vfiotest.cc
+++ b/mia/2d/vfiotest.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d.hh b/mia/3d.hh
index 9b7afd9..99d8738 100644
--- a/mia/3d.hh
+++ b/mia/3d.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/2dimagefifofilter.cc b/mia/3d/2dimagefifofilter.cc
index 646e14c..1d43d72 100644
--- a/mia/3d/2dimagefifofilter.cc
+++ b/mia/3d/2dimagefifofilter.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/2dimagefifofilter.hh b/mia/3d/2dimagefifofilter.hh
index 3c2d043..0c6ab99 100644
--- a/mia/3d/2dimagefifofilter.hh
+++ b/mia/3d/2dimagefifofilter.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/CMakeLists.txt b/mia/3d/CMakeLists.txt
index 57861a2..c8a2b3e 100644
--- a/mia/3d/CMakeLists.txt
+++ b/mia/3d/CMakeLists.txt
@@ -1,6 +1,6 @@
 #
 # This file is part of MIA - a toolbox for medical image analysis 
-# Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+# 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
@@ -41,6 +41,7 @@ SET(MIA3D_SRC
   fuzzyseg.cc
   fuzzyclustersolver_cg.cc
   image.cc
+  imagedraw.cc
   imageio.cc
   imagecollect.cc
   interpolator.cc
@@ -79,6 +80,7 @@ SET(MIA3D_HEADERS
   datafield.hh datafield.cxx
   image.hh
   filter.hh
+  imagedraw.cc
   imageio.hh
   imagetest.hh
   imageiotest.hh
@@ -219,6 +221,7 @@ TEST_3D(similarity_profile similarity_profile)
 TEST_3D(trackpoint similarity_profile)
 TEST_3D(distance distance)
 TEST_3D(imagecollect imagecollect)
+TEST_3D(imagedraw imagedraw)
 TEST_3D(rot rot)
 TEST_3D(splinetransformpenalty splinetransformpenalty)
 #
diff --git a/mia/3d/affine_matrix.cc b/mia/3d/affine_matrix.cc
index 0fca110..bc10d72 100644
--- a/mia/3d/affine_matrix.cc
+++ b/mia/3d/affine_matrix.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/affine_matrix.hh b/mia/3d/affine_matrix.hh
index 64d5a25..889769f 100644
--- a/mia/3d/affine_matrix.hh
+++ b/mia/3d/affine_matrix.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/camera.cc b/mia/3d/camera.cc
index 0d4a6d0..a5833ea 100644
--- a/mia/3d/camera.cc
+++ b/mia/3d/camera.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/camera.hh b/mia/3d/camera.hh
index 280ec8a..3ee42a9 100644
--- a/mia/3d/camera.hh
+++ b/mia/3d/camera.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/combiner/CMakeLists.txt b/mia/3d/combiner/CMakeLists.txt
index 00cc67f..9f23b2e 100644
--- a/mia/3d/combiner/CMakeLists.txt
+++ b/mia/3d/combiner/CMakeLists.txt
@@ -1,6 +1,6 @@
 #
 # This file is part of MIA - a toolbox for medical image analysis 
-# Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+# 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
diff --git a/mia/3d/combiner/labelxmap.cc b/mia/3d/combiner/labelxmap.cc
index 34cfa78..7352ff8 100644
--- a/mia/3d/combiner/labelxmap.cc
+++ b/mia/3d/combiner/labelxmap.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/combiner/labelxmap.hh b/mia/3d/combiner/labelxmap.hh
index 9f9c60b..6f97e4e 100644
--- a/mia/3d/combiner/labelxmap.hh
+++ b/mia/3d/combiner/labelxmap.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/combiner/ops.cc b/mia/3d/combiner/ops.cc
index d6ec4d0..68390a4 100644
--- a/mia/3d/combiner/ops.cc
+++ b/mia/3d/combiner/ops.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -35,7 +35,7 @@ mia::P3DImage T3DImageCombiner<BO>::operator () ( const T3DImage<T>& a, const T3
 	BO bo; 
 	typedef decltype(bo(a[0], b[0])) R; 
 			
-	auto  r = new T3DImage<R>(a.get_size()); 
+	auto  r = new T3DImage<R>(a.get_size(), a); 
 	
 	P3DImage result(r);
 
diff --git a/mia/3d/combiner/ops.hh b/mia/3d/combiner/ops.hh
index 3835fed..419bb0b 100644
--- a/mia/3d/combiner/ops.hh
+++ b/mia/3d/combiner/ops.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/combiner/plugin.hh b/mia/3d/combiner/plugin.hh
index 11c4f9c..e355109 100644
--- a/mia/3d/combiner/plugin.hh
+++ b/mia/3d/combiner/plugin.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/combiner/test_labelxmap.cc b/mia/3d/combiner/test_labelxmap.cc
index 27dc065..54b2cbd 100644
--- a/mia/3d/combiner/test_labelxmap.cc
+++ b/mia/3d/combiner/test_labelxmap.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/combiner/test_ops.cc b/mia/3d/combiner/test_ops.cc
index a4140ee..d568571 100644
--- a/mia/3d/combiner/test_ops.cc
+++ b/mia/3d/combiner/test_ops.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/cost.cc b/mia/3d/cost.cc
index 7ab7ff8..d9a8764 100644
--- a/mia/3d/cost.cc
+++ b/mia/3d/cost.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/cost.hh b/mia/3d/cost.hh
index dfa24a6..89b60b2 100644
--- a/mia/3d/cost.hh
+++ b/mia/3d/cost.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/cost/CMakeLists.txt b/mia/3d/cost/CMakeLists.txt
index 052f745..2163424 100644
--- a/mia/3d/cost/CMakeLists.txt
+++ b/mia/3d/cost/CMakeLists.txt
@@ -1,6 +1,6 @@
 #
 # This file is part of MIA - a toolbox for medical image analysis 
-# Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+# 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
diff --git a/mia/3d/cost/lncc.cc b/mia/3d/cost/lncc.cc
index c8e28aa..ff4dd1f 100644
--- a/mia/3d/cost/lncc.cc
+++ b/mia/3d/cost/lncc.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -196,8 +196,8 @@ CLNCC3DImageCostPlugin::CLNCC3DImageCostPlugin():
         C3DImageCostPlugin("lncc"), 
 	m_hw(5)
 {
-	this->add_parameter("w", new CUIntParameter(m_hw, 1, 256, false, 
-						    "half width of the window used for evaluating the localized cross correlation")); 
+	this->add_parameter("w", make_ci_param(m_hw, 1, 256, false, 
+					       "half width of the window used for evaluating the localized cross correlation")); 
 }
 
 C3DImageCost *CLNCC3DImageCostPlugin::do_create() const
diff --git a/mia/3d/cost/lncc.hh b/mia/3d/cost/lncc.hh
index 42ee1dd..8dae95a 100644
--- a/mia/3d/cost/lncc.hh
+++ b/mia/3d/cost/lncc.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/cost/mi.cc b/mia/3d/cost/mi.cc
index 35a2639..8a29086 100644
--- a/mia/3d/cost/mi.cc
+++ b/mia/3d/cost/mi.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/cost/mi.hh b/mia/3d/cost/mi.hh
index 85ecf4b..9f0b358 100644
--- a/mia/3d/cost/mi.hh
+++ b/mia/3d/cost/mi.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/cost/ncc.cc b/mia/3d/cost/ncc.cc
index fe9ed2d..c439bff 100644
--- a/mia/3d/cost/ncc.cc
+++ b/mia/3d/cost/ncc.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/cost/ncc.hh b/mia/3d/cost/ncc.hh
index 8ed3b32..45ed562 100644
--- a/mia/3d/cost/ncc.hh
+++ b/mia/3d/cost/ncc.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/cost/ngf.cc b/mia/3d/cost/ngf.cc
index 378b8da..8002166 100644
--- a/mia/3d/cost/ngf.cc
+++ b/mia/3d/cost/ngf.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/cost/ngf.hh b/mia/3d/cost/ngf.hh
index 505a8d4..caeea7c 100644
--- a/mia/3d/cost/ngf.hh
+++ b/mia/3d/cost/ngf.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/cost/ssd-automask.cc b/mia/3d/cost/ssd-automask.cc
index c2c1703..cfd1281 100644
--- a/mia/3d/cost/ssd-automask.cc
+++ b/mia/3d/cost/ssd-automask.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/cost/ssd-automask.hh b/mia/3d/cost/ssd-automask.hh
index 288d18a..1ac57d7 100644
--- a/mia/3d/cost/ssd-automask.hh
+++ b/mia/3d/cost/ssd-automask.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/cost/ssd.cc b/mia/3d/cost/ssd.cc
index 6189546..6d2859c 100644
--- a/mia/3d/cost/ssd.cc
+++ b/mia/3d/cost/ssd.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/cost/ssd.hh b/mia/3d/cost/ssd.hh
index 70335e7..b586b52 100644
--- a/mia/3d/cost/ssd.hh
+++ b/mia/3d/cost/ssd.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/cost/test_lncc.cc b/mia/3d/cost/test_lncc.cc
index ed184ba..1fcb8fb 100644
--- a/mia/3d/cost/test_lncc.cc
+++ b/mia/3d/cost/test_lncc.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/cost/test_mi.cc b/mia/3d/cost/test_mi.cc
index 6d12f9d..460e5d8 100644
--- a/mia/3d/cost/test_mi.cc
+++ b/mia/3d/cost/test_mi.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/cost/test_ncc.cc b/mia/3d/cost/test_ncc.cc
index 975db10..c6759bb 100644
--- a/mia/3d/cost/test_ncc.cc
+++ b/mia/3d/cost/test_ncc.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/cost/test_ngf.cc b/mia/3d/cost/test_ngf.cc
index d8cd3a7..66a30ec 100644
--- a/mia/3d/cost/test_ngf.cc
+++ b/mia/3d/cost/test_ngf.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/cost/test_ssd-automask.cc b/mia/3d/cost/test_ssd-automask.cc
index 656b603..3382cca 100644
--- a/mia/3d/cost/test_ssd-automask.cc
+++ b/mia/3d/cost/test_ssd-automask.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/cost/test_ssd.cc b/mia/3d/cost/test_ssd.cc
index c44943a..d22f647 100644
--- a/mia/3d/cost/test_ssd.cc
+++ b/mia/3d/cost/test_ssd.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/cost/test_ssdautomask.cc b/mia/3d/cost/test_ssdautomask.cc
index 5b324be..2098c0e 100644
--- a/mia/3d/cost/test_ssdautomask.cc
+++ b/mia/3d/cost/test_ssdautomask.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/creator.cc b/mia/3d/creator.cc
index 4c11d18..759dbce 100644
--- a/mia/3d/creator.cc
+++ b/mia/3d/creator.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/creator.hh b/mia/3d/creator.hh
index 654f111..e148860 100644
--- a/mia/3d/creator.hh
+++ b/mia/3d/creator.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/creator/CMakeLists.txt b/mia/3d/creator/CMakeLists.txt
index 3bb4c6f..a1aa15f 100644
--- a/mia/3d/creator/CMakeLists.txt
+++ b/mia/3d/creator/CMakeLists.txt
@@ -1,6 +1,6 @@
 #
 # This file is part of MIA - a toolbox for medical image analysis 
-# Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+# 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
diff --git a/mia/3d/creator/lattic.cc b/mia/3d/creator/lattic.cc
index 19a6301..aa9468f 100644
--- a/mia/3d/creator/lattic.cc
+++ b/mia/3d/creator/lattic.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -98,9 +98,9 @@ C3DLatticCreatorPlugin::C3DLatticCreatorPlugin():
 	C3DImageCreatorPlugin("lattic"),
 	m_freq(16.0, 16.0, 16.0)
 {
-	add_parameter("fx", new CFloatParameter(m_freq.x, 1, 64, false, "frequency in x-dir"));
-	add_parameter("fy", new CFloatParameter(m_freq.y, 1, 64, false, "frequency in y-dir"));
-	add_parameter("fz", new CFloatParameter(m_freq.z, 1, 64, false, "frequency in z-dir"));
+	add_parameter("fx", make_ci_param(m_freq.x, 1, 64, false, "frequency in x-dir"));
+	add_parameter("fy", make_ci_param(m_freq.y, 1, 64, false, "frequency in y-dir"));
+	add_parameter("fz", make_ci_param(m_freq.z, 1, 64, false, "frequency in z-dir"));
 }
 
 C3DImageCreator *C3DLatticCreatorPlugin::do_create()const
diff --git a/mia/3d/creator/lattic.hh b/mia/3d/creator/lattic.hh
index adf7104..48effdd 100644
--- a/mia/3d/creator/lattic.hh
+++ b/mia/3d/creator/lattic.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/creator/sphere.cc b/mia/3d/creator/sphere.cc
index 3d4f486..ffbc18c 100644
--- a/mia/3d/creator/sphere.cc
+++ b/mia/3d/creator/sphere.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -116,8 +116,8 @@ C3DSphereCreatorPlugin::C3DSphereCreatorPlugin():
 	m_f(2.0),
 	m_p(2.0)
 {
-	add_parameter("f", new CFloatParameter(m_f, 0, 10, false, "spherical change frequency"));
-	add_parameter("p", new CFloatParameter(m_p, 0.1, 100, false, "spherical shape parameter (2.0 = sphere)"));
+	add_parameter("f", make_ci_param(m_f, 0, 10, false, "spherical change frequency"));
+	add_parameter("p", make_ci_param(m_p, 0.1, 100, false, "spherical shape parameter (2.0 = sphere)"));
 }
 
 C3DImageCreator *C3DSphereCreatorPlugin::do_create()const
diff --git a/mia/3d/creator/sphere.hh b/mia/3d/creator/sphere.hh
index 85fb6e9..255e754 100644
--- a/mia/3d/creator/sphere.hh
+++ b/mia/3d/creator/sphere.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/creator/test_lattic.cc b/mia/3d/creator/test_lattic.cc
index 2240bf1..49d0460 100644
--- a/mia/3d/creator/test_lattic.cc
+++ b/mia/3d/creator/test_lattic.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/creator/test_sphere.cc b/mia/3d/creator/test_sphere.cc
index 6f9dac2..fca532d 100644
--- a/mia/3d/creator/test_sphere.cc
+++ b/mia/3d/creator/test_sphere.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/critical_point.cc b/mia/3d/critical_point.cc
index f63877d..1ebde24 100644
--- a/mia/3d/critical_point.cc
+++ b/mia/3d/critical_point.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/critical_point.hh b/mia/3d/critical_point.hh
index 6c92651..0a614a6 100644
--- a/mia/3d/critical_point.hh
+++ b/mia/3d/critical_point.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/datafield.cc b/mia/3d/datafield.cc
index 03f74f5..e92d95d 100644
--- a/mia/3d/datafield.cc
+++ b/mia/3d/datafield.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -30,6 +30,7 @@
 #include <mia/3d/iterator.cxx>
 #include <mia/2d/iterator.cxx>
 #include <mia/core/parameter.cxx>
+#include <mia/core/attributes.cxx>
 
 NS_MIA_BEGIN
 
@@ -57,27 +58,27 @@ T3DDatafield<bool>::get_trilin_interpol_val_at(const T3DVector<float >& p) const
         float  dy = 1-fy;
         float  dz = 1-fz;
 
-        register float a1,a3,a5,a7;
+        float a1,a3,a5,a7;
 
 	a1 = (dx * (*this)(x  , y  , z  ) + fx * (*this)(x+1, y  , z  ));
 	a3 = (dx * (*this)(x  , y+1, z  ) + fx * (*this)(x+1, y+1, z  ));
 	a5 = (dx * (*this)(x  , y  , z+1) + fx * (*this)(x+1, y  , z+1));
 	a7 = (dx * (*this)(x  , y+1, z+1) + fx * (*this)(x+1, y+1, z+1));
 
-        register float b1 = dy * a1 + fy * a3;
-        register float b2 = dy * a5 + fy * a7;
+        float b1 = dy * a1 + fy * a3;
+	float b2 = dy * a5 + fy * a7;
 
 	return  (dz * b1 + fz * b2) > 0.5;
 }
 
-#define INSTANCIATE(TYPE) \
-	template class  T3DDatafield<TYPE>;			\
-	template class  EXPORT_3D range3d_iterator<T3DDatafield<TYPE>::iterator>; \
-	template class  EXPORT_3D range3d_iterator<T3DDatafield<TYPE>::const_iterator>; \
-	template class  EXPORT_3D range3d_iterator_with_boundary_flag<T3DDatafield<TYPE>::iterator>; \
-	template class  EXPORT_3D range3d_iterator_with_boundary_flag<T3DDatafield<TYPE>::const_iterator>; \
-	template class  EXPORT_3D range2d_iterator<T3DDatafield<TYPE>::iterator>; \
-	template class  EXPORT_3D range2d_iterator<T3DDatafield<TYPE>::const_iterator>;
+#define INSTANCIATE(TYPE)						\
+	template class  T3DDatafield<TYPE>;				\
+	template class  range3d_iterator<T3DDatafield<TYPE>::iterator>; \
+	template class  range3d_iterator<T3DDatafield<TYPE>::const_iterator>; \
+	template class  range3d_iterator_with_boundary_flag<T3DDatafield<TYPE>::iterator>; \
+	template class  range3d_iterator_with_boundary_flag<T3DDatafield<TYPE>::const_iterator>; \
+	template class  range2d_iterator<T3DDatafield<TYPE>::iterator>; \
+	template class  range2d_iterator<T3DDatafield<TYPE>::const_iterator>;
 
 
 
@@ -96,10 +97,16 @@ INSTANCIATE(unsigned char );
 INSTANCIATE(signed char);
 INSTANCIATE(bool);
 
+INSTANCIATE(C3DFVector)
+INSTANCIATE(C3DDVector)
+
+
 DEFINE_TYPE_DESCR2(C3DBounds, "3dbounds"); 
 DEFINE_TYPE_DESCR2(C3DFVector, "3dfvector"); 
+
 template class EXPORT_3D  CTParameter<C3DBounds>;
-template class EXPORT_2D  CTParameter<C3DFVector>;
+template class EXPORT_3D  CTParameter<C3DFVector>;
+template class EXPORT_3D  TTranslator<C3DFVector>; 
 
 NS_MIA_END
 
diff --git a/mia/3d/datafield.cxx b/mia/3d/datafield.cxx
index b08714b..63722d9 100644
--- a/mia/3d/datafield.cxx
+++ b/mia/3d/datafield.cxx
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -31,7 +31,7 @@
 NS_MIA_BEGIN
 
 template <typename T>
-const unsigned int T3DDatafield<T>::m_elements = 
+const size_t T3DDatafield<T>::m_elements = 
 	sizeof(T) / sizeof(typename T3DDatafield<T>::atomic_type); 
 
 template <typename T>
@@ -53,16 +53,16 @@ void T3DDatafield<T>::swap(T3DDatafield& other)
 template <typename T>
 T3DDatafield<T>::T3DDatafield(const C3DBounds& size ):
 	m_size(size),
-	m_xy(size.x * size.y), 
-	m_data(new std::vector<T>(size.x * size.y * size.z))
+	m_xy(static_cast<size_t>(size.x) * static_cast<size_t>(size.y)), 
+	m_data(new std::vector<T>(m_xy * static_cast<size_t>(size.z)))
 {
 }
 
 template <typename T>
 T3DDatafield<T>::T3DDatafield(const C3DBounds& size, const T *data):
 	m_size(size), 
-	m_xy(size.x * size.y), 
-	m_data(new std::vector<T>(size.x * size.y * size.z))
+	m_xy(static_cast<size_t>(size.x) * static_cast<size_t>(size.y)), 
+	m_data(new std::vector<T>(m_xy * static_cast<size_t>(size.z)))
 {
 	std::copy(data, data + m_data->size(), m_data->begin()); 
 }
@@ -141,6 +141,23 @@ T3DDatafield<T>::get_trilin_interpol_val_at(const T3DVector<float >& p) const
         }
 }
 
+
+template <typename T>
+typename T3DDatafield<T>::Range
+T3DDatafield<T>::get_range(const C3DBounds& start, const C3DBounds& end)
+{
+	this->make_single_ref(); 
+	return Range(start, end, *this); 
+}
+
+template <typename T>
+typename T3DDatafield<T>::ConstRange
+T3DDatafield<T>::get_range(const C3DBounds& start, const C3DBounds& end) const
+{
+	return ConstRange(start, end, *this); 
+}
+
+
 template <typename T>
 struct __copy_dispatch {
 	typedef typename atomic_data<T>::type atomic_type; 
@@ -227,7 +244,7 @@ template <typename T>
 void T3DDatafield<T>::get_data_line_x(int y, int z, std::vector<T>& result)const
 {
         result.resize(m_size.x);
-	const int start = m_size.x * (y + z * m_size.y); 
+	const size_t start = m_xy * z + static_cast<size_t>(m_size.x) * y; 
 	__mia_copy_dispatch<T>::apply_read(result, *m_data, start, m_size.x); 
 }
 
@@ -235,9 +252,7 @@ template <typename T>
 void T3DDatafield<T>::get_data_line_y(int x, int z, std::vector<T>& result)const
 {
         result.resize(m_size.y);
-	size_t start = x + m_size.x * m_size.y * z;
-
-	typename std::vector<T>::const_iterator i = m_data->begin() + start; 
+	auto i = m_data->begin() + static_cast<size_t>(x) + m_xy * z; 
 	
 	for (typename std::vector<T>::iterator k = result.begin(); k != result.end(); ++k, i += m_size.x)
                 *k = *i;
@@ -247,7 +262,7 @@ template <typename T>
 void T3DDatafield<T>::get_data_line_z(int x, int y, std::vector<T>& result)const
 {
         result.resize(m_size.z);
-	size_t start = x + m_size.x * y;
+	size_t start = static_cast<size_t>(x) + static_cast<size_t>(m_size.x) * y;
 
 
 	typename std::vector<T>::const_iterator i = m_data->begin() + start;
@@ -637,6 +652,52 @@ T3DDatafield<T>::end_range_with_boundary_flags(const C3DBounds& begin, const C3D
 }
 
 
+template <typename T>
+typename T3DDatafield<T>::Range::iterator T3DDatafield<T>::Range::begin()
+{
+	return m_begin; 
+}
+
+template <typename T>
+typename T3DDatafield<T>::Range::iterator T3DDatafield<T>::Range::end()
+{
+	return m_end; 
+}
+
+template <typename T>
+T3DDatafield<T>::Range::Range(const C3DBounds& start, const C3DBounds& end, T3DDatafield<T>& field):
+	m_begin(field.begin_range(start, end)), m_end(field.end_range(start, end))
+{
+}
+					    
+
+template <typename T>
+typename T3DDatafield<T>::ConstRange::iterator T3DDatafield<T>::ConstRange::begin() const 
+{
+	return m_begin; 
+}
+
+template <typename T>
+typename T3DDatafield<T>::ConstRange::iterator T3DDatafield<T>::ConstRange::end() const 
+{
+	return m_end; 
+}
+
+
+template <typename T>
+T3DDatafield<T>::ConstRange::ConstRange(const C3DBounds& start, const C3DBounds& end, const T3DDatafield<T>& field):
+	m_begin(field.begin_range(start, end)), m_end(field.end_range(start, end))
+{
+}
+
+template <typename T>
+T3DDatafield<T>::ConstRange::ConstRange(const Range& range):
+	m_begin(range.m_begin), m_end(range.m_end)
+{
+}
+
+
+
 NS_MIA_END
 
 #endif
diff --git a/mia/3d/datafield.hh b/mia/3d/datafield.hh
index 1f36786..501a076 100644
--- a/mia/3d/datafield.hh
+++ b/mia/3d/datafield.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -37,6 +37,33 @@
 
 NS_MIA_BEGIN
 
+
+#define DECLARE_EXTERN_ITERATORS(TYPE)						\
+	extern template class  EXPORT_3D range3d_iterator<std::vector<TYPE>::iterator>; \
+	extern template class  EXPORT_3D range3d_iterator<std::vector<TYPE>::const_iterator>; \
+	extern template class  EXPORT_3D range3d_iterator_with_boundary_flag<std::vector<TYPE>::iterator>; \
+	extern template class  EXPORT_3D range3d_iterator_with_boundary_flag<std::vector<TYPE>::const_iterator>; \
+	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);
+DECLARE_EXTERN_ITERATORS(int);
+DECLARE_EXTERN_ITERATORS(short);
+DECLARE_EXTERN_ITERATORS(unsigned short);
+DECLARE_EXTERN_ITERATORS(unsigned char );
+DECLARE_EXTERN_ITERATORS(signed char);
+
+#ifdef LONG_64BIT
+DECLARE_EXTERN_ITERATORS(signed long);
+DECLARE_EXTERN_ITERATORS(unsigned long);
+#endif
+
+DECLARE_EXTERN_ITERATORS(C3DFVector)
+DECLARE_EXTERN_ITERATORS(C3DDVector)
+
+
 /**
    @ingroup basic 
    \brief A templated class of a 3D data field.
@@ -60,9 +87,10 @@ class  EXPORT_3D T3DDatafield {
         /** helper: represents the zero-value */
         static const T Zero;
 	
-	static const unsigned int m_elements; 
+	static const size_t m_elements; 
 
 public:
+	
 
         /** makes a single reference of the data, after calling this, it is save to write to the data field
          */
@@ -99,6 +127,53 @@ public:
 	typedef C3DBounds dimsize_type;
 	/// \endcond 
 
+	/**
+	   \brief This class provides access to a sub-range of the input data field
+
+	   This class provides iterator access to a axis-aligned 3D sub-range of the 
+	   corresponding data field. 
+	*/
+
+	
+	
+	class EXPORT_3D Range {
+		friend class T3DDatafield<T>;
+		friend class ConstRange;
+	public:
+		
+		typedef T3DDatafield<T>::range_iterator iterator;
+		
+		iterator begin();
+		
+		iterator end();
+		
+	private:
+		Range(const C3DBounds& start, const C3DBounds& end, T3DDatafield<T>& field);
+
+		iterator m_begin;
+		iterator m_end;
+	}; 
+	
+	class EXPORT_3D ConstRange {
+	public:
+		friend class T3DDatafield<T>;
+
+		typedef T3DDatafield<T>::const_range_iterator iterator;
+		
+		iterator begin() const;
+		
+		iterator end() const;
+
+	private:
+		ConstRange(const C3DBounds& start, const C3DBounds& end, const T3DDatafield<T>& field);
+
+		ConstRange(const Range& range); 
+		
+		iterator m_begin;
+		iterator m_end;
+	}; 
+
+	
 	T3DDatafield();
 
         /** Constructor to create empty Datafield if given size */
@@ -382,8 +457,12 @@ public:
                 make_single_ref();
                 return m_data->begin();
         }
+	
+	Range get_range(const C3DBounds& start, const C3DBounds& end);
 
-        /** \returns an read/write forward iterator over a subset of the data. 
+	ConstRange get_range(const C3DBounds& start, const C3DBounds& end) const; 
+	
+/** \returns an read/write forward iterator over a subset of the data. 
             The functions ensures, that the field uses a single referenced datafield */
         range_iterator begin_range(const C3DBounds& begin, const C3DBounds& end); 
 
@@ -461,7 +540,6 @@ public:
 private:
 };
 
-
 /// a data field of float values
 typedef T3DDatafield<float>  C3DFDatafield;
 
@@ -490,6 +568,8 @@ typedef  CTParameter<C3DBounds> C3DBoundsParameter;
 /// 3D vector parameter type 
 typedef  CTParameter<C3DFVector> C3DFVectorParameter;
 
+typedef  TTranslator<C3DFVector> C3DFVectorTranslator; 
+
 /// @cond NEVER 
 DECLARE_TYPE_DESCR(C3DBounds); 
 DECLARE_TYPE_DESCR(C3DFVector); 
@@ -633,6 +713,40 @@ T3DVector<Out> T3DDatafield<T>::get_gradient(const T3DVector<float >& p) const
 
 }
 
+#ifdef __GNUC__
+#pragma GCC diagnostic push
+#ifndef __clang__
+#pragma GCC diagnostic ignored "-Wattributes"
+#endif
+#endif
+
+#define DECLARE_EXTERN(TYPE)						\
+	extern template class  EXPORT_3D T3DDatafield<TYPE>; 
+
+
+DECLARE_EXTERN(double);
+DECLARE_EXTERN(float);
+DECLARE_EXTERN(unsigned int);
+DECLARE_EXTERN(int);
+DECLARE_EXTERN(short);
+DECLARE_EXTERN(unsigned short);
+DECLARE_EXTERN(unsigned char );
+DECLARE_EXTERN(signed char);
+
+#ifdef LONG_64BIT
+DECLARE_EXTERN(signed long);
+DECLARE_EXTERN(unsigned long);
+#endif
+
+DECLARE_EXTERN(C3DFVector);
+DECLARE_EXTERN(C3DDVector);
+
+#undef DECLARE_EXTERN
+
+#ifdef __GNUC__
+#pragma GCC diagnostic pop
+#endif 
+
 NS_MIA_END
 
 #endif
diff --git a/mia/3d/defines3d.hh b/mia/3d/defines3d.hh
index 3b7bfa2..1d8d507 100644
--- a/mia/3d/defines3d.hh
+++ b/mia/3d/defines3d.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/deformer.hh b/mia/3d/deformer.hh
index 2202576..b8f7a35 100644
--- a/mia/3d/deformer.hh
+++ b/mia/3d/deformer.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/distance.cc b/mia/3d/distance.cc
index 26e04d9..6f920b6 100644
--- a/mia/3d/distance.cc
+++ b/mia/3d/distance.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/distance.hh b/mia/3d/distance.hh
index 816ac26..62d7971 100644
--- a/mia/3d/distance.hh
+++ b/mia/3d/distance.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/fifof/CMakeLists.txt b/mia/3d/fifof/CMakeLists.txt
index cfbc601..612d339 100644
--- a/mia/3d/fifof/CMakeLists.txt
+++ b/mia/3d/fifof/CMakeLists.txt
@@ -1,6 +1,6 @@
 #
 # This file is part of MIA - a toolbox for medical image analysis 
-# Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+# 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
diff --git a/mia/3d/fifof/byslice.cc b/mia/3d/fifof/byslice.cc
index cf824f3..683fb3c 100644
--- a/mia/3d/fifof/byslice.cc
+++ b/mia/3d/fifof/byslice.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/fifof/byslice.hh b/mia/3d/fifof/byslice.hh
index f4050d4..366c8f5 100644
--- a/mia/3d/fifof/byslice.hh
+++ b/mia/3d/fifof/byslice.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/fifof/gauss.cc b/mia/3d/fifof/gauss.cc
index 3de86ed..d4790b3 100644
--- a/mia/3d/fifof/gauss.cc
+++ b/mia/3d/fifof/gauss.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -156,8 +156,7 @@ C2DGaussStackFilterFactory::C2DGaussStackFilterFactory():
 	C2DFifoFilterPlugin("gauss"),
 	m_hw(1)
 {
-	add_parameter("w", new CIntParameter(m_hw, 0, numeric_limits<int>::max(),
-					     false, "filter width parameter (2*w+1)"));
+	add_parameter("w", make_lc_param(m_hw, 1, false, "filter width parameter (2*w+1)"));
 }
 
 const string C2DGaussStackFilterFactory::do_get_descr() const
diff --git a/mia/3d/fifof/gauss.hh b/mia/3d/fifof/gauss.hh
index 4acc6d9..50a049e 100644
--- a/mia/3d/fifof/gauss.hh
+++ b/mia/3d/fifof/gauss.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/fifof/label.cc b/mia/3d/fifof/label.cc
index 99ab4d2..622c255 100644
--- a/mia/3d/fifof/label.cc
+++ b/mia/3d/fifof/label.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/fifof/label.hh b/mia/3d/fifof/label.hh
index 1b7c6ce..8b38aa9 100644
--- a/mia/3d/fifof/label.hh
+++ b/mia/3d/fifof/label.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/fifof/median.cc b/mia/3d/fifof/median.cc
index 1c368a5..2485c52 100644
--- a/mia/3d/fifof/median.cc
+++ b/mia/3d/fifof/median.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -197,8 +197,7 @@ C2DMedianFifoFilterPlugin::C2DMedianFifoFilterPlugin():
 	C2DFifoFilterPlugin("median"),
 	m_hw(1)
 {
-	add_parameter("w", new CIntParameter(m_hw, 0, numeric_limits<int>::max(),
-					     false, "filter width parameter"));
+	add_parameter("w", make_lc_param(m_hw, 1, false, "filter width parameter"));
 }
 
 const string C2DMedianFifoFilterPlugin::do_get_descr() const
diff --git a/mia/3d/fifof/median.hh b/mia/3d/fifof/median.hh
index 3dbe799..e8c3439 100644
--- a/mia/3d/fifof/median.hh
+++ b/mia/3d/fifof/median.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/fifof/mlv.cc b/mia/3d/fifof/mlv.cc
index f197faf..ae210e3 100644
--- a/mia/3d/fifof/mlv.cc
+++ b/mia/3d/fifof/mlv.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -304,8 +304,7 @@ C2DMLVnFifoFilterPlugin::C2DMLVnFifoFilterPlugin():
 	C2DFifoFilterPlugin("mlv"),
 	m_hw(1)
 {
-	add_parameter("w", new CIntParameter(m_hw, 0, numeric_limits<int>::max(),
-					     false, "filter width parameter"));
+	add_parameter("w", make_lc_param(m_hw, 1, false, "filter width parameter"));
 }
 
 const string C2DMLVnFifoFilterPlugin::do_get_descr() const
diff --git a/mia/3d/fifof/mlv.hh b/mia/3d/fifof/mlv.hh
index 363046e..f8e7e11 100644
--- a/mia/3d/fifof/mlv.hh
+++ b/mia/3d/fifof/mlv.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/fifof/morphological.cc b/mia/3d/fifof/morphological.cc
index f5441d6..86fa3d7 100644
--- a/mia/3d/fifof/morphological.cc
+++ b/mia/3d/fifof/morphological.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/fifof/morphological.hh b/mia/3d/fifof/morphological.hh
index 13183f1..09f19fb 100644
--- a/mia/3d/fifof/morphological.hh
+++ b/mia/3d/fifof/morphological.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/fifof/regiongrow.cc b/mia/3d/fifof/regiongrow.cc
index 6288051..60d2025 100644
--- a/mia/3d/fifof/regiongrow.cc
+++ b/mia/3d/fifof/regiongrow.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -189,15 +189,13 @@ C2DRegiongrowFifoFilterPlugin::C2DRegiongrowFifoFilterPlugin():
 	m_depth(10)
 {
 	add_parameter("map", new CStringParameter(m_map, CCmdOptionFlags::required_input, "seed class map"));
-	add_parameter("low", new CFloatParameter(m_low, .0f, 1.0f, false,
+	add_parameter("low", make_oci_param(m_low, .0f, 1.0f, false,
 						 "low threshold for acceptance probability"));
-	add_parameter("seed", new CFloatParameter(m_seed, .0f, 1.0f, false,
+	add_parameter("seed", make_oci_param(m_seed, .0f, 1.0f, false,
 						 "threshold for seed probability"));
 
-	add_parameter("class", new CIntParameter(m_class, 0, numeric_limits<int>::max(), false,
-						 "class to be segmented"));
-	add_parameter("depth", new CIntParameter(m_depth, 5, numeric_limits<int>::max(), false,
-						 "number of slices to keep during processing"));
+	add_parameter("class", make_lc_param(m_class, 0, false, "class to be segmented"));
+	add_parameter("depth", make_lc_param(m_depth, 1, false, "number of slices to keep during processing"));
 }
 
 
diff --git a/mia/3d/fifof/regiongrow.hh b/mia/3d/fifof/regiongrow.hh
index cab1d82..c2325d5 100644
--- a/mia/3d/fifof/regiongrow.hh
+++ b/mia/3d/fifof/regiongrow.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/fifof/rgg.cc b/mia/3d/fifof/rgg.cc
index e258ecf..1c435f1 100644
--- a/mia/3d/fifof/rgg.cc
+++ b/mia/3d/fifof/rgg.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/fifof/rgg2pass.cc b/mia/3d/fifof/rgg2pass.cc
index bd492f7..f794a26 100644
--- a/mia/3d/fifof/rgg2pass.cc
+++ b/mia/3d/fifof/rgg2pass.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/fifof/test_byslice.cc b/mia/3d/fifof/test_byslice.cc
index b5e41b6..71a476f 100644
--- a/mia/3d/fifof/test_byslice.cc
+++ b/mia/3d/fifof/test_byslice.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/fifof/test_gauss.cc b/mia/3d/fifof/test_gauss.cc
index 17062c1..9933f3f 100644
--- a/mia/3d/fifof/test_gauss.cc
+++ b/mia/3d/fifof/test_gauss.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/fifof/test_label.cc b/mia/3d/fifof/test_label.cc
index 19301d9..d1374ff 100644
--- a/mia/3d/fifof/test_label.cc
+++ b/mia/3d/fifof/test_label.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/fifof/test_median.cc b/mia/3d/fifof/test_median.cc
index d931519..a81e65f 100644
--- a/mia/3d/fifof/test_median.cc
+++ b/mia/3d/fifof/test_median.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/fifof/test_mlv.cc b/mia/3d/fifof/test_mlv.cc
index f58e13d..76c4dd3 100644
--- a/mia/3d/fifof/test_mlv.cc
+++ b/mia/3d/fifof/test_mlv.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/fifof/test_morphological.cc b/mia/3d/fifof/test_morphological.cc
index a220afb..66f8bc1 100644
--- a/mia/3d/fifof/test_morphological.cc
+++ b/mia/3d/fifof/test_morphological.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -37,9 +37,6 @@ struct MorpologicalFilter_Fixture: public fifof_Fixture  {
 
 MorpologicalFilter_Fixture::MorpologicalFilter_Fixture()
 {
-	CPathNameArray searchpath;
-	searchpath.push_back(bfs::path("..")/bfs::path("shapes"));
-	C3DShapePluginHandler::set_search_path(searchpath);
 	m_shape = C3DShapePluginHandler::instance().produce("6n");
 }
 
diff --git a/mia/3d/fifof/test_regiongrow.cc b/mia/3d/fifof/test_regiongrow.cc
index 3890e23..9f34c0e 100644
--- a/mia/3d/fifof/test_regiongrow.cc
+++ b/mia/3d/fifof/test_regiongrow.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -28,9 +28,6 @@ NS_MIA_USE;
 
 struct RegiongrowFixture: public fifof_Fixture {
 	RegiongrowFixture() {
-		CPathNameArray searchpath;
-		searchpath.push_back(bfs::path("..")/bfs::path("shapes"));
-		C3DShapePluginHandler::set_search_path(searchpath);
 	}
 };
 
diff --git a/mia/3d/fifotestfixture.cc b/mia/3d/fifotestfixture.cc
index 280a36c..a595398 100644
--- a/mia/3d/fifotestfixture.cc
+++ b/mia/3d/fifotestfixture.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/fifotestfixture.hh b/mia/3d/fifotestfixture.hh
index ae6ef65..aee89af 100644
--- a/mia/3d/fifotestfixture.hh
+++ b/mia/3d/fifotestfixture.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/filter.cc b/mia/3d/filter.cc
index 61c9fe2..1466897 100644
--- a/mia/3d/filter.cc
+++ b/mia/3d/filter.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/filter.hh b/mia/3d/filter.hh
index c20a434..59e96da 100644
--- a/mia/3d/filter.hh
+++ b/mia/3d/filter.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/filter/CMakeLists.txt b/mia/3d/filter/CMakeLists.txt
index 3bbada1..5b4c868 100644
--- a/mia/3d/filter/CMakeLists.txt
+++ b/mia/3d/filter/CMakeLists.txt
@@ -1,6 +1,6 @@
 #
 # This file is part of MIA - a toolbox for medical image analysis 
-# Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+# 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
@@ -29,6 +29,7 @@ SET(filters3dNew
   invert
   kmeans 
   label
+  labelmap
   labelscale
   load
   lvdownscale
@@ -38,7 +39,7 @@ SET(filters3dNew
   mlv 
   morphological 
   msnormalizer
-#  reorient 
+  reorient 
   resize
   scale
   seededwatershed
diff --git a/mia/3d/filter/aniso.cc b/mia/3d/filter/aniso.cc
index faf6715..3fef19a 100644
--- a/mia/3d/filter/aniso.cc
+++ b/mia/3d/filter/aniso.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/filter/bandpass.cc b/mia/3d/filter/bandpass.cc
index 38ca2e7..f202393 100644
--- a/mia/3d/filter/bandpass.cc
+++ b/mia/3d/filter/bandpass.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/filter/bandpass.hh b/mia/3d/filter/bandpass.hh
index 20eb8e2..8b6e77e 100644
--- a/mia/3d/filter/bandpass.hh
+++ b/mia/3d/filter/bandpass.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/filter/binarize.cc b/mia/3d/filter/binarize.cc
index 63bb2b2..493b262 100644
--- a/mia/3d/filter/binarize.cc
+++ b/mia/3d/filter/binarize.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/filter/binarize.hh b/mia/3d/filter/binarize.hh
index 41239f8..85948f2 100644
--- a/mia/3d/filter/binarize.hh
+++ b/mia/3d/filter/binarize.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/filter/combiner.cc b/mia/3d/filter/combiner.cc
index 271315e..aecbad1 100644
--- a/mia/3d/filter/combiner.cc
+++ b/mia/3d/filter/combiner.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/filter/combiner.hh b/mia/3d/filter/combiner.hh
index 771c2b7..42ea40c 100644
--- a/mia/3d/filter/combiner.hh
+++ b/mia/3d/filter/combiner.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/filter/convert.cc b/mia/3d/filter/convert.cc
index 079e364..bdef436 100644
--- a/mia/3d/filter/convert.cc
+++ b/mia/3d/filter/convert.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/filter/convert.hh b/mia/3d/filter/convert.hh
index 6a811a9..7484573 100644
--- a/mia/3d/filter/convert.hh
+++ b/mia/3d/filter/convert.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/filter/crop.cc b/mia/3d/filter/crop.cc
index 9967188..088af7b 100644
--- a/mia/3d/filter/crop.cc
+++ b/mia/3d/filter/crop.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -53,6 +53,9 @@ C3DCrop::result_type C3DCrop::operator () (const T3DImage<T>& data) const
 	cvdebug() << "crop (" << begin << " - " << end << "\n";
 
 	T3DImage<T> * result = new T3DImage<T>(size, data);
+	if (!result) 
+		throw create_exception<runtime_error>("crop: unable to allocate image of size ", size);
+	result->set_origin(C3DFVector(begin) * data.get_voxel_size());
 
 	for (size_t z = 0; z < size.z; ++z)
 		for (size_t y = 0; y < size.y; ++y) {
diff --git a/mia/3d/filter/crop.hh b/mia/3d/filter/crop.hh
index 69066e4..a1eb2a6 100644
--- a/mia/3d/filter/crop.hh
+++ b/mia/3d/filter/crop.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/filter/distance.cc b/mia/3d/filter/distance.cc
index baab730..3f7804c 100644
--- a/mia/3d/filter/distance.cc
+++ b/mia/3d/filter/distance.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -22,6 +22,11 @@
 #include <mia/3d/filter/distance.hh>
 #include <mia/core/distance.hh>
 
+#include <mia/core/threadedmsg.hh>
+#include <tbb/parallel_for.h>
+#include <tbb/blocked_range.h>
+
+
 namespace distance_3d_filter {
 
 using namespace mia; 
@@ -33,34 +38,48 @@ template <typename T>
 P3DImage C3DDistanceFilter::operator () ( const T3DImage<T>& image) const
 {
 	C3DFImage *result = new C3DFImage(image.get_size(), image);
-	vector<float> buffer(image.get_size().x); 
-	vector<T> in_buffer(image.get_size().x); 
-	for (size_t z = 0; z < image.get_size().z; ++z) {
-		for (size_t y = 0; y < image.get_size().y; ++y) {
-			image.get_data_line_x(y, z, in_buffer);
-                        distance_transform_prepare(in_buffer.begin(), in_buffer.end(), buffer.begin()); 
-			distance_transform_inplace(buffer); 
-			result->put_data_line_x(y, z, buffer);
+
+	auto transform_x = [result, &image](const tbb::blocked_range<size_t>& range) {
+		vector<float> buffer(image.get_size().x); 
+		vector<T> in_buffer(image.get_size().x); 
+		for (size_t z = range.begin(); z != range.end(); ++z) {
+			for (size_t y = 0; y < image.get_size().y; ++y) {
+				image.get_data_line_x(y, z, in_buffer);
+				distance_transform_prepare(in_buffer.begin(), in_buffer.end(), buffer.begin()); 
+				distance_transform_inplace(buffer); 
+				result->put_data_line_x(y, z, buffer);
+			}
 		}
-	}
+	}; 
 	
-	buffer.resize(image.get_size().y); 
-	for (size_t z = 0; z < image.get_size().z; ++z) {
-		for (size_t x = 0; x < image.get_size().x; ++x) {
-			result->get_data_line_y(x, z, buffer);
- 			distance_transform_inplace(buffer); 
-			result->put_data_line_y(x, z, buffer);
+	auto transform_y = [result](const tbb::blocked_range<size_t>& range) {
+		vector<float> buffer(result->get_size().y); 
+		for (size_t z = range.begin(); z != range.end(); ++z) {
+			for (size_t x = 0; x < result->get_size().x; ++x) {
+				result->get_data_line_y(x, z, buffer);
+				distance_transform_inplace(buffer); 
+				result->put_data_line_y(x, z, buffer);
+			}
 		}
-	}
+	}; 
 
-	buffer.resize(image.get_size().z); 
-	for (size_t y = 0; y < image.get_size().y; ++y) {
-		for (size_t x = 0; x < image.get_size().x; ++x) {
-			result->get_data_line_z(x, y, buffer);
-			distance_transform_inplace(buffer); 
-			result->put_data_line_z(x, y, buffer);
+	auto transform_z = [result](const tbb::blocked_range<size_t>& range) {
+		vector<float> buffer(result->get_size().z);
+		for (size_t y = range.begin(); y != range.end(); ++y) {
+			for (size_t x = 0; x < result->get_size().x; ++x) {
+				result->get_data_line_z(x, y, buffer);
+				distance_transform_inplace(buffer); 
+				transform(buffer.begin(), buffer.end(), buffer.begin(), 
+					  [](float x) { return sqrtf(x);}); 
+				result->put_data_line_z(x, y, buffer);
+			}
 		}
-	}
+	}; 
+	
+	parallel_for(tbb::blocked_range<size_t>(0, image.get_size().z, 1), transform_x); 
+	parallel_for(tbb::blocked_range<size_t>(0, image.get_size().z, 1), transform_y); 
+	parallel_for(tbb::blocked_range<size_t>(0, image.get_size().y, 1), transform_z); 
+	
 	return P3DImage(result); 
 }
 
diff --git a/mia/3d/filter/distance.hh b/mia/3d/filter/distance.hh
index 2a37ca2..6d3d7de 100644
--- a/mia/3d/filter/distance.hh
+++ b/mia/3d/filter/distance.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/filter/downscale.cc b/mia/3d/filter/downscale.cc
index b9e9e20..8628e07 100644
--- a/mia/3d/filter/downscale.cc
+++ b/mia/3d/filter/downscale.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -105,17 +105,11 @@ C3DDownscaleFilterPlugin::C3DDownscaleFilterPlugin():
 	m_b(1,1,1), 
 	m_filter("gauss")
 {
-	add_parameter("bx", new CUIntParameter(m_b.x, 1,
-					       numeric_limits<int>::max(), false,
-					       "blocksize in x direction"));
+	add_parameter("bx", make_lc_param(m_b.x, 1, false, "blocksize in x direction"));
 	
-	add_parameter("by", new CUIntParameter(m_b.y, 1,
-					       numeric_limits<int>::max(), false,
-					       "blocksize in y direction"));
+	add_parameter("by", make_lc_param(m_b.y, 1,false, "blocksize in y direction"));
 	
-	add_parameter("bz", new CUIntParameter(m_b.z, 1,
-					       numeric_limits<int>::max(), false,
-                                                "blocksize in z direction"));
+	add_parameter("bz", make_lc_param(m_b.z, 1, false, "blocksize in z direction"));
 
 	add_parameter("b", new C3DBoundsParameter(m_b, false, "blocksize"));
 
diff --git a/mia/3d/filter/downscale.hh b/mia/3d/filter/downscale.hh
index 74eddd6..b49b7c1 100644
--- a/mia/3d/filter/downscale.hh
+++ b/mia/3d/filter/downscale.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/filter/gradnorm.cc b/mia/3d/filter/gradnorm.cc
index b0acfe2..c4c970a 100644
--- a/mia/3d/filter/gradnorm.cc
+++ b/mia/3d/filter/gradnorm.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/filter/gradnorm.hh b/mia/3d/filter/gradnorm.hh
index 0b439e8..5a0829f 100644
--- a/mia/3d/filter/gradnorm.hh
+++ b/mia/3d/filter/gradnorm.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/filter/growmask.cc b/mia/3d/filter/growmask.cc
index a1491a2..add81c2 100644
--- a/mia/3d/filter/growmask.cc
+++ b/mia/3d/filter/growmask.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -113,9 +113,7 @@ C3DGrowmaskImageFilterFactory::C3DGrowmaskImageFilterFactory():
 						  "reference image for mask region growing", 
 			      &C3DImageIOPluginHandler::instance()));
 	add_parameter("shape", make_param(m_shape, "6n", false, "neighborhood mask"));
-	add_parameter("min", new CFloatParameter(m_min, -numeric_limits<float>::max(),
-						 numeric_limits<float>::max(), false,
-						 "lower threshold for mask growing"));
+	add_parameter("min", make_param(m_min, false, "lower threshold for mask growing"));
 }
 
 /* The factory create function creates and returns the filter with the given options*/
diff --git a/mia/3d/filter/growmask.hh b/mia/3d/filter/growmask.hh
index 69a446e..2e54744 100644
--- a/mia/3d/filter/growmask.hh
+++ b/mia/3d/filter/growmask.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/filter/invert.cc b/mia/3d/filter/invert.cc
index 3201442..c624769 100644
--- a/mia/3d/filter/invert.cc
+++ b/mia/3d/filter/invert.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/filter/invert.hh b/mia/3d/filter/invert.hh
index b09983b..374bb87 100644
--- a/mia/3d/filter/invert.hh
+++ b/mia/3d/filter/invert.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/filter/kmeans.cc b/mia/3d/filter/kmeans.cc
index 1268c8c..0e17ea6 100644
--- a/mia/3d/filter/kmeans.cc
+++ b/mia/3d/filter/kmeans.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -63,8 +63,7 @@ C3DKMeansFilterPluginFactory::C3DKMeansFilterPluginFactory():
 	C3DFilterPlugin("kmeans"),
 	m_classes(3)
 {
-	add_parameter("c", new CIntParameter(m_classes, 0, numeric_limits<unsigned char>::max(),
-					     false, "number of classes"));
+	add_parameter("c", make_lc_param(m_classes, 2, false, "number of classes"));
 }
 
 C3DFilter *C3DKMeansFilterPluginFactory::do_create()const
diff --git a/mia/3d/filter/kmeans.hh b/mia/3d/filter/kmeans.hh
index 33a5b40..ff51166 100644
--- a/mia/3d/filter/kmeans.hh
+++ b/mia/3d/filter/kmeans.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/filter/label.cc b/mia/3d/filter/label.cc
index b693cfc..9682924 100644
--- a/mia/3d/filter/label.cc
+++ b/mia/3d/filter/label.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/filter/label.hh b/mia/3d/filter/label.hh
index cfe74d7..178efdb 100644
--- a/mia/3d/filter/label.hh
+++ b/mia/3d/filter/label.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/filter/combiner.cc b/mia/3d/filter/labelmap.cc
similarity index 71%
copy from mia/3d/filter/combiner.cc
copy to mia/3d/filter/labelmap.cc
index 271315e..1a385b6 100644
--- a/mia/3d/filter/combiner.cc
+++ b/mia/3d/filter/labelmap.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -18,19 +18,22 @@
  *
  */
 
-#include <mia/3d/filter/combiner.hh>
-#include <mia/3d/imageio.hh>
+#include <stdexcept>
+#include <istream>
+#include <fstream>
+#include <mia/3d/filter/labelmap.hh>
 
-NS_MIA_BEGIN
+#include <mia/template/labelmap.cxx>
 
-template class  TImageCombinerFilter<C3DImage>; 
-template class  TImageCombinerFilterPlugin<C3DImage>; 
+NS_MIA_BEGIN
 
+template class TLabelMapFilter<C3DImage>;  
+template class TLabelMapFilterPlugin<C3DImage>;  
 
 extern "C" EXPORT CPluginBase *get_plugin_interface()
 {
-        return new C3DImageCombinerFilterPlugin; 
+	return new C3DLabelMapFilterPlugin(); 
 }
 
-NS_MIA_END
 
+NS_MIA_END
diff --git a/mia/3d/nonrigidregister.cc b/mia/3d/filter/labelmap.hh
similarity index 73%
copy from mia/3d/nonrigidregister.cc
copy to mia/3d/filter/labelmap.hh
index 7993014..0235833 100644
--- a/mia/3d/nonrigidregister.cc
+++ b/mia/3d/filter/labelmap.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -18,17 +18,13 @@
  *
  */
 
-#define VSTREAM_DOMAIN "NR-REG"
-
-
 #include <mia/3d/filter.hh>
-#include <mia/3d/imageio.hh>
-#include <mia/3d/transformfactory.hh>
-#include <mia/3d/nonrigidregister.hh>
-#include <mia/template/nonrigidregister.cxx>
+#include <mia/core/labelmap.hh>
+#include <mia/template/labelmap.hh>
 
 NS_MIA_BEGIN
 
-template class TNonrigidRegister<3>; 
+typedef TLabelMapFilter<C3DImage> C3DLabelMapFilter;  
+typedef TLabelMapFilterPlugin<C3DImage> C3DLabelMapFilterPlugin;  
 
 NS_MIA_END
diff --git a/mia/3d/filter/labelscale.cc b/mia/3d/filter/labelscale.cc
index 60a90b0..4ac9c6f 100644
--- a/mia/3d/filter/labelscale.cc
+++ b/mia/3d/filter/labelscale.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/filter/labelscale.hh b/mia/3d/filter/labelscale.hh
index c8d5905..ac03844 100644
--- a/mia/3d/filter/labelscale.hh
+++ b/mia/3d/filter/labelscale.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/filter/load.cc b/mia/3d/filter/load.cc
index 8966544..1a2f61d 100644
--- a/mia/3d/filter/load.cc
+++ b/mia/3d/filter/load.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/filter/load.hh b/mia/3d/filter/load.hh
index dedbabd..0221ae6 100644
--- a/mia/3d/filter/load.hh
+++ b/mia/3d/filter/load.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/filter/lvdownscale.cc b/mia/3d/filter/lvdownscale.cc
index b0b8ff0..1ec6d26 100644
--- a/mia/3d/filter/lvdownscale.cc
+++ b/mia/3d/filter/lvdownscale.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/filter/lvdownscale.hh b/mia/3d/filter/lvdownscale.hh
index c8cc2c6..7663c4d 100644
--- a/mia/3d/filter/lvdownscale.hh
+++ b/mia/3d/filter/lvdownscale.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/filter/mask.cc b/mia/3d/filter/mask.cc
index 7008235..67aae52 100644
--- a/mia/3d/filter/mask.cc
+++ b/mia/3d/filter/mask.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/filter/mask.hh b/mia/3d/filter/mask.hh
index 1bb8855..9b1b392 100644
--- a/mia/3d/filter/mask.hh
+++ b/mia/3d/filter/mask.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/filter/mean.cc b/mia/3d/filter/mean.cc
index 9689f2a..99c143d 100644
--- a/mia/3d/filter/mean.cc
+++ b/mia/3d/filter/mean.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -164,7 +164,7 @@ C3DMeanFilterPlugin::C3DMeanFilterPlugin():
         C3DFilterPlugin("mean"), 
         m_hw(1)
 {
-        add_parameter("w", new CIntParameter(m_hw, 1, std::numeric_limits<int>::max(), false, "half filter width"));
+        add_parameter("w", make_lc_param(m_hw, 1, false, "half filter width"));
 }
                        
 C3DFilter *C3DMeanFilterPlugin::do_create()const
@@ -230,7 +230,7 @@ C3DVarianceFilterPlugin::C3DVarianceFilterPlugin():
 C3DFilterPlugin("variance"), 
         m_hw(1)
 {
-        add_parameter("w", new CIntParameter(m_hw, 1, std::numeric_limits<int>::max(), false, "half filter width"));        
+        add_parameter("w", make_lc_param(m_hw, 1, false, "half filter width"));        
 }
         
 mia::C3DFilter *C3DVarianceFilterPlugin::do_create()const
diff --git a/mia/3d/filter/mean.hh b/mia/3d/filter/mean.hh
index 5da34cd..5834ffd 100644
--- a/mia/3d/filter/mean.hh
+++ b/mia/3d/filter/mean.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/filter/median.cc b/mia/3d/filter/median.cc
index 1b10264..d3fce8a 100644
--- a/mia/3d/filter/median.cc
+++ b/mia/3d/filter/median.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -112,7 +112,7 @@ C3DMedianFilterFactory::C3DMedianFilterFactory():
 	C3DFilterPlugin("median"),
 	m_hw(1)
 {
-	add_parameter("w", new CIntParameter(m_hw, 0, numeric_limits<int>::max(), false, "filter width parameter"));
+	add_parameter("w", make_lc_param(m_hw, 1, false, "filter width parameter"));
 }
 
 const string  C3DMedianFilterFactory::do_get_descr() const
@@ -166,8 +166,8 @@ C3DSaltAndPepperFilterFactory::C3DSaltAndPepperFilterFactory():
 	m_hw(1),
 	m_thresh(100)
 {
-	add_parameter("w", new CIntParameter(m_hw, 0, numeric_limits<int>::max(), false, "filter width parameter"));
-	add_parameter("thresh", new CFloatParameter(m_thresh, 0, numeric_limits<float>::max(), false, "thresh value"));
+	add_parameter("w", make_lc_param(m_hw, 1, false, "filter width parameter"));
+	add_parameter("thresh", make_nonnegative_param(m_thresh, false, "thresh value"));
 }
 
 C3DFilter *C3DSaltAndPepperFilterFactory::do_create()const
diff --git a/mia/3d/filter/median.hh b/mia/3d/filter/median.hh
index a878ac6..cbab1ba 100644
--- a/mia/3d/filter/median.hh
+++ b/mia/3d/filter/median.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/filter/mlv.cc b/mia/3d/filter/mlv.cc
index 111c8d7..c5471de 100644
--- a/mia/3d/filter/mlv.cc
+++ b/mia/3d/filter/mlv.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -151,7 +151,7 @@ C3DMLVImageFilterFactory::C3DMLVImageFilterFactory():
 	C3DFilterPlugin("mlv"),
 	m_hw(1)
 {
-	add_parameter("w", new CIntParameter(m_hw, 0, numeric_limits<int>::max(), false, "filter width parameter"));
+	add_parameter("w", make_lc_param(m_hw, 1, false, "filter width parameter"));
 
 }
 
diff --git a/mia/3d/filter/mlv.hh b/mia/3d/filter/mlv.hh
index dc27a2a..5e28e24 100644
--- a/mia/3d/filter/mlv.hh
+++ b/mia/3d/filter/mlv.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/filter/morphological.cc b/mia/3d/filter/morphological.cc
index d7c6b30..ebd0560 100644
--- a/mia/3d/filter/morphological.cc
+++ b/mia/3d/filter/morphological.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/filter/morphological.hh b/mia/3d/filter/morphological.hh
index 38bd7bc..609260a 100644
--- a/mia/3d/filter/morphological.hh
+++ b/mia/3d/filter/morphological.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/filter/msnormalizer.cc b/mia/3d/filter/msnormalizer.cc
index 77f4d9e..28961ac 100644
--- a/mia/3d/filter/msnormalizer.cc
+++ b/mia/3d/filter/msnormalizer.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -152,7 +152,7 @@ C3DMSNormalizerFilterPlugin::C3DMSNormalizerFilterPlugin():
 C3DFilterPlugin("msnormalizer"), 
         m_hw(1)
 {
-        add_parameter("w", new CIntParameter(m_hw, 1, std::numeric_limits<int>::max(), false, "half filter width"));        
+        add_parameter("w", make_lc_param(m_hw, 1, false, "half filter width"));        
 }
 
 mia::C3DFilter *C3DMSNormalizerFilterPlugin::do_create()const
diff --git a/mia/3d/filter/msnormalizer.hh b/mia/3d/filter/msnormalizer.hh
index d8cbd48..023bdd3 100644
--- a/mia/3d/filter/msnormalizer.hh
+++ b/mia/3d/filter/msnormalizer.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/filter/reorient.cc b/mia/3d/filter/reorient.cc
index 517ae00..190e682 100644
--- a/mia/3d/filter/reorient.cc
+++ b/mia/3d/filter/reorient.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -44,10 +44,6 @@ C3DReorient::result_type C3DReorient::operator () (const mia::T3DImage<T>& data)
 
 	EOrientations strategy = m_strategy;
 
-	if (strategy == axial ||  strategy == coronal || strategy == saggital) {
-		strategy = get_strategy(data.get_orientation());
-	}
-
 	cvdebug() << "strategy = " << strategy << "(" << m_strategy <<")\n";
 	switch (strategy) {
 	case xyz: {
@@ -55,7 +51,7 @@ C3DReorient::result_type C3DReorient::operator () (const mia::T3DImage<T>& data)
 		copy(data.begin(), data.end(), result->begin());
 		break;
 	}
-	case xzy: {
+	case flip_yz: {
 		C3DBounds out_size(data.get_size().xzy() );
 		result = new T3DImage<T>(out_size, data);
 		result->set_voxel_size(data.get_voxel_size().xzy());
@@ -67,7 +63,7 @@ C3DReorient::result_type C3DReorient::operator () (const mia::T3DImage<T>& data)
 		}
 		break;
 	}
-	case yxz: {
+	case flip_xy: {
 		C3DBounds out_size(data.get_size().yxz() );
 		result = new T3DImage<T>(out_size, data);
 		result->set_voxel_size(data.get_voxel_size().yxz());
@@ -106,7 +102,7 @@ C3DReorient::result_type C3DReorient::operator () (const mia::T3DImage<T>& data)
 		}
 		break;
 	}
-	case zyx: {
+	case flip_xz: {
 		C3DBounds out_size(data.get_size().zyx() );
 		result = new T3DImage<T>(out_size, data);
 		result->set_voxel_size(data.get_voxel_size().zyx());
@@ -119,6 +115,149 @@ C3DReorient::result_type C3DReorient::operator () (const mia::T3DImage<T>& data)
 		}
 		break;
 	}
+	case rotate_x90:{
+		// rotate around x-axis by 90 degree 
+		C3DBounds out_size(data.get_size().yxz() );
+		result = new T3DImage<T>(out_size, data);
+		result->set_voxel_size(data.get_voxel_size().yxz());
+		for (size_t z = 0; z < data.get_size().z; ++z) {
+			for (size_t y = 0; y < data.get_size().y; ++y) {
+				copy(data.begin_at(0,y,z), data.begin_at(0,y,z) + data.get_size().x,
+				     result->begin_at(0,result->get_size().z - z - 1,y));
+			}
+		}
+		break;
+	}
+	case rotate_x180:{
+		// rotate around x-axis by 180 degree 
+		C3DBounds out_size(data.get_size());
+		result = new T3DImage<T>(out_size, data);
+		result->set_voxel_size(data.get_voxel_size());
+		for (size_t z = 0; z < data.get_size().z; ++z) {
+			for (size_t y = 0; y < data.get_size().y; ++y) {
+				copy(data.begin_at(0,y,z), data.begin_at(0,y,z) + data.get_size().x,
+				     result->begin_at(0,result->get_size().y - 1 - y,
+						      result->get_size().z - 1 - z));
+			}
+		}
+		break;
+	}
+	case rotate_x270:{
+		// rotate around x-axis by 270 degree 
+		C3DBounds out_size(data.get_size().yxz() );
+		result = new T3DImage<T>(out_size, data);
+		result->set_voxel_size(data.get_voxel_size().yxz());
+		for (size_t z = 0; z < data.get_size().z; ++z) {
+			for (size_t y = 0; y < data.get_size().y; ++y) {
+				copy(data.begin_at(0,y,z), data.begin_at(0,y,z) + data.get_size().x,
+				     result->begin_at(0,z,result->get_size().y - 1 - y));
+			}
+		}
+		break;
+	}
+	case rotate_y90:{
+		// rotate around y-axis by 90 degree clock wise
+		
+		C3DBounds out_size(data.get_size().zyx());
+		result = new T3DImage<T>(out_size, data);
+		result->set_voxel_size(data.get_voxel_size().zyx());
+
+		unsigned  oz = data.get_size().z - 1; 
+		for (size_t z = 0; z < data.get_size().z; ++z, --oz) {
+			for (size_t y = 0; y < data.get_size().y; ++y) {
+				for (size_t x = 0; x < data.get_size().x; ++x) {
+					(*result)(oz,y,x) = data(x,y,z);
+				}
+			}
+		}
+		break;
+	}
+	case rotate_y180:{
+		// rotate around y-axis by 180 degree 
+		C3DBounds out_size(data.get_size());
+		result = new T3DImage<T>(out_size, data);
+		result->set_voxel_size(data.get_voxel_size());
+		
+		unsigned  oz = data.get_size().z - 1; 
+		for (size_t z = 0; z < data.get_size().z; ++z, --oz) {
+			for (size_t y = 0; y < data.get_size().y; ++y) {
+				unsigned ox = data.get_size().x - 1; 
+				for (size_t x = 0; x < data.get_size().x; ++x, --ox) {
+					(*result)(oz,y,ox) = data(x,y,z);
+				}
+			}
+		}
+		break;
+	}
+	case rotate_y270:{
+		// rotate around y-axis by 90 degree clock wise
+		C3DBounds out_size(data.get_size().zyx());
+		result = new T3DImage<T>(out_size, data);
+		result->set_voxel_size(data.get_voxel_size().zyx());
+
+		for (size_t z = 0; z < data.get_size().z; ++z) {
+			for (size_t y = 0; y < data.get_size().y; ++y) {
+				unsigned  ox = data.get_size().x - 1; 
+				for (size_t x = 0; x < data.get_size().x; ++x, --ox) {
+					(*result)(z,y,ox) = data(x,y,z);
+				}
+				
+			}
+		}
+		break;
+	}
+	case rotate_z90:{
+		// rotate around z-axis by 90 degree clock wise
+		
+		C3DBounds out_size(data.get_size().yxz());
+		result = new T3DImage<T>(out_size, data);
+		result->set_voxel_size(data.get_voxel_size().yxz());
+
+		for (size_t z = 0; z < data.get_size().z; ++z) {
+			unsigned  oy = data.get_size().y - 1; 
+			for (size_t y = 0; y < data.get_size().y; ++y, --oy) {
+				for (size_t x = 0; x < data.get_size().x; ++x) {
+					(*result)(oy,x,z) = data(x,y,z);
+				}
+			}
+		}
+		break;
+	}
+	case rotate_z180:{
+		// rotate around y-axis by 180 degree 
+		C3DBounds out_size(data.get_size());
+		result = new T3DImage<T>(out_size, data);
+		result->set_voxel_size(data.get_voxel_size());
+		
+		for (size_t z = 0; z < data.get_size().z; ++z) {
+			unsigned  oy = data.get_size().y - 1; 
+			for (size_t y = 0; y < data.get_size().y; ++y, --oy) {
+				unsigned ox = data.get_size().x - 1; 
+				for (size_t x = 0; x < data.get_size().x; ++x, --ox) {
+					(*result)(oy,ox,z) = data(x,y,z);
+				}
+			}
+		}
+		break;
+	}
+	case rotate_z270:{
+		
+		// rotate around z-axis by 270 degree clock wise
+		C3DBounds out_size(data.get_size().yxz());
+		result = new T3DImage<T>(out_size, data);
+		result->set_voxel_size(data.get_voxel_size().yxz());
+
+		for (size_t z = 0; z < data.get_size().z; ++z) {
+			for (size_t y = 0; y < data.get_size().y; ++y) {
+				unsigned  ox = data.get_size().x - 1; 
+				for (size_t x = 0; x < data.get_size().x; ++x, --ox) {
+					(*result)(y,ox,z) = data(x,y,z);
+				}
+				
+			}
+		}
+		break;
+	}
 	default:
 		throw invalid_argument("Unknown reorientation requested");
 	}
@@ -134,20 +273,15 @@ E3DImageOrientation C3DReorient::get_new_orientation(EOrientations strategy, E3D
 	cvdebug() << "strategy = " << strategy << ", old_orientation: " << old_orientation << "\n";
 	switch (strategy) {
 	case xyz: return old_orientation;
-	case xzy: switch (old_orientation) {
+	case flip_yz: switch (old_orientation) {
 		case ior_axial:    return ior_saggital;
 		case ior_saggital: return ior_axial;
 		case ior_coronal:  return ior_axial;
 		default:
 			return old_orientation;
 		}
-	case yxz:switch (old_orientation) {
-		case ior_axial:    return ior_axial;
-		case ior_saggital: return ior_saggital;
-		case ior_coronal:  return ior_coronal;
-		default:
-			return old_orientation;
-		}
+	case flip_xy:
+		return old_orientation;
 	case yzx:switch (old_orientation) {
 		case ior_axial:    return ior_saggital;
 		case ior_saggital: return ior_coronal;
@@ -162,7 +296,7 @@ E3DImageOrientation C3DReorient::get_new_orientation(EOrientations strategy, E3D
 		default:
 			return old_orientation;
 		}
-	case zyx:
+	case flip_xz:
 		switch (old_orientation) {
 		case ior_axial:    return ior_saggital;
 		case ior_saggital: return ior_coronal;
@@ -170,46 +304,11 @@ E3DImageOrientation C3DReorient::get_new_orientation(EOrientations strategy, E3D
 		default:
 			return old_orientation;
 		}
-	case axial: return ior_axial;
-	case coronal: return ior_coronal;
-	case saggital: return ior_saggital;
 	default:
 		return old_orientation;
 	}
 }
 
-C3DReorient::EOrientations C3DReorient::get_strategy(E3DImageOrientation old_orientation) const
-{
-	TRACE(__FUNCTION__);
-	switch (old_orientation)  {
-	case ior_axial:
-		switch (m_strategy)  {
-		case axial:    return xyz;
-		case saggital: return zyx; //??
-		case coronal:  return xyz; //??
-		default:
-			return xyz;
-		};
-	case ior_saggital:
-		switch (m_strategy)  {
-		case axial:    return zyx;
-		case saggital: return xyz; //??
-		case coronal:  return xyz; //??
-		default:
-			return xyz;
-		};
-	case ior_coronal:
-		switch (m_strategy)  {
-		case axial:    return xyz;
-		case saggital: return zyx; //??
-		case coronal:  return xyz; //??
-		default:
-			return xyz;
-		};
-	default:
-		return xyz;
-	}
-}
 
 /* The actual filter dispatch function calls the filter by selecting the right pixel type through wrap_filter */
 P3DImage C3DReorient::do_filter(const C3DImage& image) const
@@ -241,11 +340,20 @@ const string C3DReorientImageFilterFactory::do_get_descr()const
 const TDictMap<C3DReorient::EOrientations>::Table
 C3DReorientImageFilterFactory::table[] = {
 	{"xyz", C3DReorient::xyz, "keep orientation"},
-	{"xzy", C3DReorient::xzy, "switch y-z" },
-	{"yxz", C3DReorient::yzx, "switch x-y" },
-	{"yzx", C3DReorient::yxz, "rotate x->z->y->x" },
-	{"zxy", C3DReorient::zxy, "rotate x->y->z->x" },
-	{"zyx", C3DReorient::zxy, "switch x-z" },
+	{"f-yz", C3DReorient::flip_yz, "flip y-z" },
+	{"f-xy", C3DReorient::flip_xy, "flip x-y" },
+	{"p-yzx", C3DReorient::yzx, "permutate x->z->y->x" },
+	{"p-zxy", C3DReorient::zxy, "permutate x->y->z->x" },
+	{"f-xz", C3DReorient::flip_xz, "flip x-z" },
+	{"r-x90", C3DReorient::rotate_x90, "rotate around x-axis clockwise 90 degree" },
+	{"r-x180", C3DReorient::rotate_x180, "rotate around x-axis clockwise 180 degree" },
+	{"r-x270", C3DReorient::rotate_x270, "rotate around x-axis clockwise 270 degree" },
+	{"r-y90", C3DReorient::rotate_y90, "rotate around y-axis clockwise 90 degree" },
+	{"r-y180", C3DReorient::rotate_y180, "rotate around y-axis clockwise 180 degree" },
+	{"r-y270", C3DReorient::rotate_y270, "rotate around y-axis clockwise 270 degree" },
+	{"r-z90", C3DReorient::rotate_z90, "rotate around z-axis clockwise 90 degree" },
+	{"r-z180", C3DReorient::rotate_z180, "rotate around z-axis clockwise 180 degree" },
+	{"r-z270", C3DReorient::rotate_z270, "rotate around z-axis clockwise 270 degree" },
 	{NULL,  C3DReorient::ooo, "" },
 };
 const TDictMap<C3DReorient::EOrientations>
diff --git a/mia/3d/filter/reorient.hh b/mia/3d/filter/reorient.hh
index 2b327ce..2b4d0f0 100644
--- a/mia/3d/filter/reorient.hh
+++ b/mia/3d/filter/reorient.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -40,7 +40,22 @@ NS_BEGIN(reorient_3dimage_filter)
  */
 class C3DReorient: public mia::C3DFilter {
 public:
-	enum EOrientations {xyz, xzy, yxz, yzx, zxy, zyx, axial, coronal, saggital, ooo};
+	enum EOrientations {xyz,
+			    yzx, // permutate axes
+			    zxy, // permutate axes
+			    flip_yz, 
+			    flip_xy,
+			    flip_xz,
+			    rotate_x90,
+			    rotate_x180,
+			    rotate_x270,
+			    rotate_y90,
+			    rotate_y180,
+			    rotate_y270,
+			    rotate_z90,
+			    rotate_z180,
+			    rotate_z270,
+			    ooo};
 
 	C3DReorient(EOrientations strategy);
 
@@ -48,7 +63,6 @@ public:
 	C3DReorient::result_type operator () (const mia::T3DImage<T>& data) const;
 private:
 	virtual mia::P3DImage do_filter(const mia::C3DImage& image) const;
-	EOrientations get_strategy(mia::E3DImageOrientation old_orientation) const;
 	mia::E3DImageOrientation get_new_orientation(EOrientations strategy, mia::E3DImageOrientation old_orientation)const;
 	EOrientations m_strategy;
 };
diff --git a/mia/3d/filter/resize.cc b/mia/3d/filter/resize.cc
index 2b356b8..3f1f243 100644
--- a/mia/3d/filter/resize.cc
+++ b/mia/3d/filter/resize.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/filter/resize.hh b/mia/3d/filter/resize.hh
index 04a2a04..da10d88 100644
--- a/mia/3d/filter/resize.hh
+++ b/mia/3d/filter/resize.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/filter/scale.cc b/mia/3d/filter/scale.cc
index 03d9748..4d19565 100644
--- a/mia/3d/filter/scale.cc
+++ b/mia/3d/filter/scale.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -156,16 +156,13 @@ C3DScaleFilterPlugin::C3DScaleFilterPlugin():
 {
 	add_parameter("s", new C3DBoundsParameter(m_s, 0,"target size to set all components at once (component 0:use input image size)"));
 
-	add_parameter("sx", new CUIntParameter(m_s.x, 0,
-					      numeric_limits<unsigned int>::max(), false,
-					      "target size in x direction (0:use input image size)"));
+	add_parameter("sx", make_nonnegative_param(m_s.x, false,
+					  "target size in x direction (0:use input image size)"));
 
-	add_parameter("sy", new CUIntParameter(m_s.y, 0,
-					      numeric_limits<unsigned int>::max(), false,
+	add_parameter("sy", make_nonnegative_param(m_s.y, false,
 					      "target size in y direction (0:use input image size)"));
 
-	add_parameter("sz", new CUIntParameter(m_s.z, 0,
-					      numeric_limits<unsigned int>::max(), false,
+	add_parameter("sz", make_nonnegative_param(m_s.z, false,
 					      "target size in y direction (0:use input image size)"));
 
 	add_parameter("interp", make_param(m_kernel, "bspline:d=3",  false, "interpolation kernel to be used "));
@@ -222,16 +219,11 @@ C3DScaleFactorFilterPlugin::C3DScaleFactorFilterPlugin():
 	C3DFilterPlugin("fscale"),
 	m_factor(1,1,1)
 {
-	add_parameter("fx", new CFloatParameter(m_factor.x, 0.0001,
-						numeric_limits<unsigned int>::max(), false,
-						"scaling factor in x direction"));
+	add_parameter("fx", make_positive_param(m_factor.x, false, "scaling factor in x direction"));
 
-	add_parameter("fy", new CFloatParameter(m_factor.y, 0.0001, 10000, false,
-					       "scaling factor in y direction"));
+	add_parameter("fy", make_positive_param(m_factor.y, false, "scaling factor in y direction"));
 
-	add_parameter("fz", new CFloatParameter(m_factor.z, 0.0001,
-						numeric_limits<unsigned int>::max(), false,
-						"scaling factor in z direction"));
+	add_parameter("fz", make_positive_param(m_factor.z, false, "scaling factor in z direction"));
 
 	add_parameter("interp", make_param(m_kernel, "bspline:d=3",  false, "interpolation kernel to be used "));
 	
@@ -279,7 +271,7 @@ CIsoVoxelFilterPlugin::CIsoVoxelFilterPlugin():
 	C3DFilterPlugin("isovoxel"),
 	m_voxelsize(1.0)
 {
-	add_parameter("size", new CFloatParameter(m_voxelsize, 0.001, 1e+6, false,"isometric target voxel size"));
+	add_parameter("size", make_positive_param(m_voxelsize, false,"isometric target voxel size"));
 	add_parameter("interp", make_param(m_kernel, "bspline:d=3",  false, "interpolation kernel to be used "));
 }
 
diff --git a/mia/3d/filter/scale.hh b/mia/3d/filter/scale.hh
index e8113e7..7241592 100644
--- a/mia/3d/filter/scale.hh
+++ b/mia/3d/filter/scale.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/filter/seededwatershed.cc b/mia/3d/filter/seededwatershed.cc
index 3d318ab..c6a7941 100644
--- a/mia/3d/filter/seededwatershed.cc
+++ b/mia/3d/filter/seededwatershed.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/filter/seededwatershed.hh b/mia/3d/filter/seededwatershed.hh
index 0bdae3b..0dcbb7a 100644
--- a/mia/3d/filter/seededwatershed.hh
+++ b/mia/3d/filter/seededwatershed.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/filter/selectbig.cc b/mia/3d/filter/selectbig.cc
index 2d226e9..0aebd93 100644
--- a/mia/3d/filter/selectbig.cc
+++ b/mia/3d/filter/selectbig.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/filter/selectbig.hh b/mia/3d/filter/selectbig.hh
index 9edcf0b..5b8eead 100644
--- a/mia/3d/filter/selectbig.hh
+++ b/mia/3d/filter/selectbig.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/filter/sepconv.cc b/mia/3d/filter/sepconv.cc
index 4a1af9a..5fbcb62 100644
--- a/mia/3d/filter/sepconv.cc
+++ b/mia/3d/filter/sepconv.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -154,7 +154,7 @@ C3DGaussFilterPlugin::C3DGaussFilterPlugin():
 	C3DFilterPlugin("gauss"),
 	m_w(1)
 {
-	add_parameter("w", new CIntParameter(m_w, 0,numeric_limits<int>::max(), false, "filter width parameter"));
+	add_parameter("w", make_lc_param(m_w, 0, false, "filter width parameter"));
 }
 
 C3DFilter *C3DGaussFilterPlugin::do_create()const
diff --git a/mia/3d/filter/sepconv.hh b/mia/3d/filter/sepconv.hh
index 93adca5..5daf52c 100644
--- a/mia/3d/filter/sepconv.hh
+++ b/mia/3d/filter/sepconv.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/filter/tee.cc b/mia/3d/filter/tee.cc
index 5002269..5956774 100644
--- a/mia/3d/filter/tee.cc
+++ b/mia/3d/filter/tee.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/filter/tee.hh b/mia/3d/filter/tee.hh
index db8d980..9d00fd2 100644
--- a/mia/3d/filter/tee.hh
+++ b/mia/3d/filter/tee.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/filter/test_bandpass.cc b/mia/3d/filter/test_bandpass.cc
index 2f223c0..f39b94b 100644
--- a/mia/3d/filter/test_bandpass.cc
+++ b/mia/3d/filter/test_bandpass.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/filter/test_binarize.cc b/mia/3d/filter/test_binarize.cc
index 0a1add4..deab7e2 100644
--- a/mia/3d/filter/test_binarize.cc
+++ b/mia/3d/filter/test_binarize.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/filter/test_combiner.cc b/mia/3d/filter/test_combiner.cc
index 2b5ebcf..2d2869b 100644
--- a/mia/3d/filter/test_combiner.cc
+++ b/mia/3d/filter/test_combiner.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/filter/test_convert.cc b/mia/3d/filter/test_convert.cc
index 4a6e64f..7467b80 100644
--- a/mia/3d/filter/test_convert.cc
+++ b/mia/3d/filter/test_convert.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/filter/test_crop.cc b/mia/3d/filter/test_crop.cc
index b881288..ffb5ae0 100644
--- a/mia/3d/filter/test_crop.cc
+++ b/mia/3d/filter/test_crop.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -64,6 +64,8 @@ void CropFixture::check_result(C3DCrop& f, const C3DBounds& start, C3DBounds rsi
 						  (x+1+start.x ) * (y +1+start.y) * (z+1+start.z));
 			}
 	BOOST_CHECK_EQUAL(result->get_voxel_size(), src.get_voxel_size()); 
+
+	BOOST_CHECK_EQUAL(result->get_origin(), C3DFVector(start) * src.get_voxel_size()); 
 }
 
 BOOST_FIXTURE_TEST_CASE( test_crop_inside, CropFixture )
diff --git a/mia/3d/filter/test_distance.cc b/mia/3d/filter/test_distance.cc
index 8f52392..34652a4 100644
--- a/mia/3d/filter/test_distance.cc
+++ b/mia/3d/filter/test_distance.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -54,7 +54,7 @@ BOOST_FIXTURE_TEST_CASE( test_distance_full3d_inf, Distance3DInfFixture )
 
 	int k = 0; 
 	for(auto i = result.begin(); i != result.end(); ++i, ++k ) {
-		BOOST_CHECK_CLOSE(*i, test_val[k], 0.1); 
+		BOOST_CHECK_CLOSE(*i, sqrtf(test_val[k]), 0.1); 
 	}
 }
 
@@ -70,7 +70,7 @@ BOOST_FIXTURE_TEST_CASE( test_distance_full3d_func,  Distance3DFuncFixture )
 	int k = 0; 
 	for(auto i = result.begin(); i != result.end(); ++i, ++k ) {
 		cvdebug() << "k=" << k << ":" << *i << ", vs " << test_val[k] << "\n"; 
-		BOOST_CHECK_CLOSE(*i, test_val[k], 0.1); 
+		BOOST_CHECK_CLOSE(*i, sqrtf(test_val[k]), 0.1); 
 	}
 }
 
diff --git a/mia/3d/filter/test_downscale.cc b/mia/3d/filter/test_downscale.cc
index be69298..a73436d 100644
--- a/mia/3d/filter/test_downscale.cc
+++ b/mia/3d/filter/test_downscale.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/filter/test_gradnorm.cc b/mia/3d/filter/test_gradnorm.cc
index f9b4b2d..3bda0a6 100644
--- a/mia/3d/filter/test_gradnorm.cc
+++ b/mia/3d/filter/test_gradnorm.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/filter/test_growmask.cc b/mia/3d/filter/test_growmask.cc
index e6621a8..f2a64a9 100644
--- a/mia/3d/filter/test_growmask.cc
+++ b/mia/3d/filter/test_growmask.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/filter/test_invert.cc b/mia/3d/filter/test_invert.cc
index 586ee03..cf93410 100644
--- a/mia/3d/filter/test_invert.cc
+++ b/mia/3d/filter/test_invert.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/filter/test_kmeans.cc b/mia/3d/filter/test_kmeans.cc
index 3052330..0fedc76 100644
--- a/mia/3d/filter/test_kmeans.cc
+++ b/mia/3d/filter/test_kmeans.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/filter/test_label.cc b/mia/3d/filter/test_label.cc
index a574a83..f28d438 100644
--- a/mia/3d/filter/test_label.cc
+++ b/mia/3d/filter/test_label.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/2d/filter/test_labelmap.cc b/mia/3d/filter/test_labelmap.cc
similarity index 68%
copy from mia/2d/filter/test_labelmap.cc
copy to mia/3d/filter/test_labelmap.cc
index 04be97f..246c7c2 100644
--- a/mia/2d/filter/test_labelmap.cc
+++ b/mia/3d/filter/test_labelmap.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -19,19 +19,18 @@
  */
 
 #include <mia/internal/autotest.hh>
-#include <mia/2d/filter/labelmap.hh>
+#include <mia/3d/filter/labelmap.hh>
 
-using namespace labelmap_2dimage_filter; 
 NS_MIA_USE;
 using namespace std; 
 
 BOOST_AUTO_TEST_CASE (test_labelmap) 
 {
-	C2DUSImage *src = new C2DUSImage(C2DBounds(8,32));
-	C2DUSImage ref(C2DBounds(8,32));
+	C3DUSImage *src = new C3DUSImage(C3DBounds(8,32, 2));
+	C3DUSImage ref(C3DBounds(8,32, 2));
 	
-	C2DUSImage::iterator is = src->begin();
-	C2DUSImage::iterator ir = ref.begin();
+	C3DUSImage::iterator is = src->begin();
+	C3DUSImage::iterator ir = ref.begin();
 	
 	for (size_t i = 0; i < src->size(); ++i, ++is, ++ir)
 		*is = *ir = i;
@@ -42,17 +41,17 @@ BOOST_AUTO_TEST_CASE (test_labelmap)
 	map[23] = 7;
 	map[189] = 10;
 	
-	ref(1,0) = 2; 
-	ref(2,0) = 4;
-	ref(7,2) = 7; 
-	ref(5,23) = 10; 
+	ref(1,0, 0) = 2; 
+	ref(2,0, 0) = 4;
+	ref(7,2, 0) = 7; 
+	ref(5,23, 0) = 10; 
 	
-	P2DImage wsrc(src); 
+	P3DImage wsrc(src); 
 
-	C2DLabelMapFilter filter(map); 
+	C3DLabelMapFilter filter(map); 
 	
-	P2DImage wres = filter.filter(*wsrc); 
-	const C2DUSImage& result = dynamic_cast<const C2DUSImage&>(*wres); 
+	P3DImage wres = filter.filter(*wsrc); 
+	const C3DUSImage& result = dynamic_cast<const C3DUSImage&>(*wres); 
 	
 	BOOST_CHECK_EQUAL(result.get_size(), ref.get_size()); 
 	BOOST_CHECK(equal(result.begin(), result.end(), ref.begin())); 
diff --git a/mia/3d/filter/test_labelscale.cc b/mia/3d/filter/test_labelscale.cc
index 66302a1..b43facd 100644
--- a/mia/3d/filter/test_labelscale.cc
+++ b/mia/3d/filter/test_labelscale.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/filter/test_load.cc b/mia/3d/filter/test_load.cc
index cb84a5c..cdff622 100644
--- a/mia/3d/filter/test_load.cc
+++ b/mia/3d/filter/test_load.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/filter/test_lvdownscale.cc b/mia/3d/filter/test_lvdownscale.cc
index a464bb6..04ea099 100644
--- a/mia/3d/filter/test_lvdownscale.cc
+++ b/mia/3d/filter/test_lvdownscale.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/filter/test_mask.cc b/mia/3d/filter/test_mask.cc
index 0cba453..fbbb2ef 100644
--- a/mia/3d/filter/test_mask.cc
+++ b/mia/3d/filter/test_mask.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/filter/test_mean.cc b/mia/3d/filter/test_mean.cc
index 67918f5..bf0cd3f 100644
--- a/mia/3d/filter/test_mean.cc
+++ b/mia/3d/filter/test_mean.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/filter/test_median.cc b/mia/3d/filter/test_median.cc
index f6966f9..6cbcb57 100644
--- a/mia/3d/filter/test_median.cc
+++ b/mia/3d/filter/test_median.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/filter/test_mlv.cc b/mia/3d/filter/test_mlv.cc
index fec1b52..5c64d10 100644
--- a/mia/3d/filter/test_mlv.cc
+++ b/mia/3d/filter/test_mlv.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/filter/test_morphological.cc b/mia/3d/filter/test_morphological.cc
index 0800c25..8bfb849 100644
--- a/mia/3d/filter/test_morphological.cc
+++ b/mia/3d/filter/test_morphological.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -29,13 +29,6 @@ using namespace morph_3dimage_filter;
 
 void SetPluginpath()
 {
-	static bool run = false;
-	if (!run) {
-		CPathNameArray kernelsearchpath;
-		kernelsearchpath.push_back(bfs::path("..")/bfs::path("shapes"));
-		C3DShapePluginHandler::set_search_path(kernelsearchpath);
-		run = true;
-	}
 }
 
 struct SetPathFixture {
diff --git a/mia/3d/filter/test_msnormalizer.cc b/mia/3d/filter/test_msnormalizer.cc
index b44d300..117a1f1 100644
--- a/mia/3d/filter/test_msnormalizer.cc
+++ b/mia/3d/filter/test_msnormalizer.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/filter/test_reorient.cc b/mia/3d/filter/test_reorient.cc
index 8e1f5a4..a07c0d7 100644
--- a/mia/3d/filter/test_reorient.cc
+++ b/mia/3d/filter/test_reorient.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -69,7 +69,7 @@ BOOST_FIXTURE_TEST_CASE( test_reorient_traversal_to_traversal, ReorientMock )
 
 BOOST_FIXTURE_TEST_CASE( test_reorient_xzy, ReorientMock )
 {
-	C3DReorient f(C3DReorient::xzy);
+	C3DReorient f(C3DReorient::flip_yz);
 	C3DBounds test_size(size.x, size.z, size.y);
 
 	C3DUSImage  test_image(test_size, src);
@@ -86,7 +86,7 @@ BOOST_FIXTURE_TEST_CASE( test_reorient_xzy, ReorientMock )
 
 BOOST_FIXTURE_TEST_CASE( test_reorient_yxz, ReorientMock )
 {
-	C3DReorient f(C3DReorient::yxz);
+	C3DReorient f(C3DReorient::flip_xy);
 	C3DBounds test_size(size.y, size.x, size.z);
 
 	C3DUSImage  test_image(test_size, src);
@@ -133,7 +133,7 @@ BOOST_FIXTURE_TEST_CASE( test_reorient_zxy, ReorientMock )
 
 BOOST_FIXTURE_TEST_CASE( test_reorient_zyx, ReorientMock )
 {
-	C3DReorient f(C3DReorient::zyx);
+	C3DReorient f(C3DReorient::flip_xz);
 	C3DBounds test_size(size.z, size.y, size.x);
 
 	C3DUSImage  test_image(test_size, src);
@@ -191,14 +191,3 @@ void ReorientFromAxialMock::check_result(const C3DReorient& f, E3DImageOrientati
 
 
 
-BOOST_FIXTURE_TEST_CASE( test_reorient_axial_to_axial, ReorientFromAxialMock )
-{
-	C3DReorient f(C3DReorient::axial);
-	check_result(f, ior_axial, "lrfbud");
-}
-
-BOOST_FIXTURE_TEST_CASE( test_reorient_axial_to_saggital, ReorientFromAxialMock )
-{
-	C3DReorient f(C3DReorient::saggital);
-	check_result(f, ior_saggital, "udfblr");
-}
diff --git a/mia/3d/filter/test_resize.cc b/mia/3d/filter/test_resize.cc
index ad5b878..b63bb62 100644
--- a/mia/3d/filter/test_resize.cc
+++ b/mia/3d/filter/test_resize.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/filter/test_scale.cc b/mia/3d/filter/test_scale.cc
index dd9108a..4c9c110 100644
--- a/mia/3d/filter/test_scale.cc
+++ b/mia/3d/filter/test_scale.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/filter/test_seededwatershed.cc b/mia/3d/filter/test_seededwatershed.cc
index f0c9750..06277d3 100644
--- a/mia/3d/filter/test_seededwatershed.cc
+++ b/mia/3d/filter/test_seededwatershed.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/filter/test_selectbig.cc b/mia/3d/filter/test_selectbig.cc
index 2a2f06f..a7b5006 100644
--- a/mia/3d/filter/test_selectbig.cc
+++ b/mia/3d/filter/test_selectbig.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/filter/test_sepconv.cc b/mia/3d/filter/test_sepconv.cc
index 1efee04..207d470 100644
--- a/mia/3d/filter/test_sepconv.cc
+++ b/mia/3d/filter/test_sepconv.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/filter/test_tee.cc b/mia/3d/filter/test_tee.cc
index 700922a..0aed629 100644
--- a/mia/3d/filter/test_tee.cc
+++ b/mia/3d/filter/test_tee.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/filter/test_thinning.cc b/mia/3d/filter/test_thinning.cc
index 63eb5c5..8866368 100644
--- a/mia/3d/filter/test_thinning.cc
+++ b/mia/3d/filter/test_thinning.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/filter/test_transform.cc b/mia/3d/filter/test_transform.cc
index 09d7f44..d6f661d 100644
--- a/mia/3d/filter/test_transform.cc
+++ b/mia/3d/filter/test_transform.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/filter/test_watershed.cc b/mia/3d/filter/test_watershed.cc
index 67e055d..94854d7 100644
--- a/mia/3d/filter/test_watershed.cc
+++ b/mia/3d/filter/test_watershed.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/filter/thinning.cc b/mia/3d/filter/thinning.cc
index 54505fc..d32378a 100644
--- a/mia/3d/filter/thinning.cc
+++ b/mia/3d/filter/thinning.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/filter/thinning.hh b/mia/3d/filter/thinning.hh
index 5d62f94..b43e27f 100644
--- a/mia/3d/filter/thinning.hh
+++ b/mia/3d/filter/thinning.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/filter/transform.cc b/mia/3d/filter/transform.cc
index 2734f68..0a88f78 100644
--- a/mia/3d/filter/transform.cc
+++ b/mia/3d/filter/transform.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/filter/transform.hh b/mia/3d/filter/transform.hh
index 8c724b3..39f4771 100644
--- a/mia/3d/filter/transform.hh
+++ b/mia/3d/filter/transform.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/filter/watershed.cc b/mia/3d/filter/watershed.cc
index 70ba3ae..cdecd94 100644
--- a/mia/3d/filter/watershed.cc
+++ b/mia/3d/filter/watershed.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/filter/watershed.hh b/mia/3d/filter/watershed.hh
index 6174676..162a06a 100644
--- a/mia/3d/filter/watershed.hh
+++ b/mia/3d/filter/watershed.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/fullcost.cc b/mia/3d/fullcost.cc
index 3bdaffd..bfb987d 100644
--- a/mia/3d/fullcost.cc
+++ b/mia/3d/fullcost.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/fullcost.hh b/mia/3d/fullcost.hh
index a53e5ba..66f415e 100644
--- a/mia/3d/fullcost.hh
+++ b/mia/3d/fullcost.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/fullcost/CMakeLists.txt b/mia/3d/fullcost/CMakeLists.txt
index c324b30..e8d5282 100644
--- a/mia/3d/fullcost/CMakeLists.txt
+++ b/mia/3d/fullcost/CMakeLists.txt
@@ -1,6 +1,6 @@
 #
 # This file is part of MIA - a toolbox for medical image analysis 
-# Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+# 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
diff --git a/mia/3d/fullcost/image.cc b/mia/3d/fullcost/image.cc
index c2473f6..11f08de 100644
--- a/mia/3d/fullcost/image.cc
+++ b/mia/3d/fullcost/image.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/fullcost/image.hh b/mia/3d/fullcost/image.hh
index 20fe631..e381ab0 100644
--- a/mia/3d/fullcost/image.hh
+++ b/mia/3d/fullcost/image.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/fullcost/label.cc b/mia/3d/fullcost/label.cc
index cd9f62b..d94c845 100644
--- a/mia/3d/fullcost/label.cc
+++ b/mia/3d/fullcost/label.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -293,7 +293,7 @@ C3DLabelFullCostPlugin::C3DLabelFullCostPlugin():
 			      &C3DImageIOPluginHandler::instance()));
 	add_parameter("ref", new CStringParameter(m_ref_name, CCmdOptionFlags::input, "Reference image", 
 			      &C3DImageIOPluginHandler::instance()));
-	add_parameter("maxlabel", new CIntParameter(m_maxlabel, 2, 32000, false, 
+	add_parameter("maxlabel", make_ci_param(m_maxlabel, 2, 32000, false, 
 						    "maximum number of labels to consider"));
 }
 
diff --git a/mia/3d/fullcost/label.hh b/mia/3d/fullcost/label.hh
index 8a0299d..7debac2 100644
--- a/mia/3d/fullcost/label.hh
+++ b/mia/3d/fullcost/label.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/fullcost/maskedimage.cc b/mia/3d/fullcost/maskedimage.cc
index ac042be..6b09a5a 100644
--- a/mia/3d/fullcost/maskedimage.cc
+++ b/mia/3d/fullcost/maskedimage.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/fullcost/maskedimage.hh b/mia/3d/fullcost/maskedimage.hh
index 3bd4682..750751b 100644
--- a/mia/3d/fullcost/maskedimage.hh
+++ b/mia/3d/fullcost/maskedimage.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/fullcost/taggedssd.cc b/mia/3d/fullcost/taggedssd.cc
index d23144d..fbcc1f7 100644
--- a/mia/3d/fullcost/taggedssd.cc
+++ b/mia/3d/fullcost/taggedssd.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/fullcost/taggedssd.hh b/mia/3d/fullcost/taggedssd.hh
index bc8e1a2..a29628a 100644
--- a/mia/3d/fullcost/taggedssd.hh
+++ b/mia/3d/fullcost/taggedssd.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/fullcost/test_image.cc b/mia/3d/fullcost/test_image.cc
index 923265a..473d947 100644
--- a/mia/3d/fullcost/test_image.cc
+++ b/mia/3d/fullcost/test_image.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -98,15 +98,5 @@ BOOST_FIXTURE_TEST_CASE( test_imagefullcost_2,  ImagefullcostFixture)
 
 ImagefullcostFixture::ImagefullcostFixture()
 {
-	CPathNameArray cost_plugpath;
-	cost_plugpath.push_back(bfs::path("../cost"));
-	C3DImageCostPluginHandler::set_search_path(cost_plugpath);
 
-	CPathNameArray filter_plugpath;
-	filter_plugpath.push_back(bfs::path("../filter"));
-	C3DFilterPluginHandler::set_search_path(filter_plugpath);
-
-	CPathNameArray io_plugpath;
-	io_plugpath.push_back(bfs::path("../io"));
-	C3DImageIOPluginHandler::set_search_path(io_plugpath);
 }
diff --git a/mia/3d/fullcost/test_label.cc b/mia/3d/fullcost/test_label.cc
index 23454c8..8f1c2a7 100644
--- a/mia/3d/fullcost/test_label.cc
+++ b/mia/3d/fullcost/test_label.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/fullcost/test_maskedimage.cc b/mia/3d/fullcost/test_maskedimage.cc
index 6286cc3..7e197c6 100644
--- a/mia/3d/fullcost/test_maskedimage.cc
+++ b/mia/3d/fullcost/test_maskedimage.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/fullcost/test_taggedssd.cc b/mia/3d/fullcost/test_taggedssd.cc
index 8e34478..57ffaa9 100644
--- a/mia/3d/fullcost/test_taggedssd.cc
+++ b/mia/3d/fullcost/test_taggedssd.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/fuzzyclustersolver_cg.cc b/mia/3d/fuzzyclustersolver_cg.cc
index e04ab33..bac10ef 100644
--- a/mia/3d/fuzzyclustersolver_cg.cc
+++ b/mia/3d/fuzzyclustersolver_cg.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/fuzzyclustersolver_cg.hh b/mia/3d/fuzzyclustersolver_cg.hh
index d8153b3..2e895f5 100644
--- a/mia/3d/fuzzyclustersolver_cg.hh
+++ b/mia/3d/fuzzyclustersolver_cg.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/fuzzyseg.cc b/mia/3d/fuzzyseg.cc
index c7155ee..82caf4c 100644
--- a/mia/3d/fuzzyseg.cc
+++ b/mia/3d/fuzzyseg.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/fuzzyseg.hh b/mia/3d/fuzzyseg.hh
index ab6ddac..8f62361 100644
--- a/mia/3d/fuzzyseg.hh
+++ b/mia/3d/fuzzyseg.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/ica.cc b/mia/3d/ica.cc
index 609ddb9..3b6e70d 100644
--- a/mia/3d/ica.cc
+++ b/mia/3d/ica.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/ica.hh b/mia/3d/ica.hh
index b36ee06..90431ce 100644
--- a/mia/3d/ica.hh
+++ b/mia/3d/ica.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/image.cc b/mia/3d/image.cc
index 041ced4..c5bdc44 100644
--- a/mia/3d/image.cc
+++ b/mia/3d/image.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/image.hh b/mia/3d/image.hh
index 554fd7d..0a8a7c7 100644
--- a/mia/3d/image.hh
+++ b/mia/3d/image.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/imagecollect.cc b/mia/3d/imagecollect.cc
index c06008e..6dec2fc 100644
--- a/mia/3d/imagecollect.cc
+++ b/mia/3d/imagecollect.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -46,8 +46,14 @@ void C3DImageCollector::operator ()(const T2DImage<T>& image) {
 		    out_image->get_size().y != image.get_size().y)
 			throw invalid_argument("input images are not all of the same size");
 		
+		size_t offset = image.get_size().x; 
+		offset *= image.get_size().y; 
+		offset *= m_cur_slice; 
+		
+		cvdebug() << "offset=" << offset << "\n"; 
 		auto out = out_image->begin() + image.get_size().x * image.get_size().y * m_cur_slice;
 		
+
 		copy(image.begin(), image.end(), out);
 		++m_cur_slice; 
 	}else
diff --git a/mia/3d/imagecollect.hh b/mia/3d/imagecollect.hh
index 2f7f978..f2d6cd3 100644
--- a/mia/3d/imagecollect.hh
+++ b/mia/3d/imagecollect.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/imagedraw.cc b/mia/3d/imagedraw.cc
new file mode 100644
index 0000000..de1e578
--- /dev/null
+++ b/mia/3d/imagedraw.cc
@@ -0,0 +1,356 @@
+/* -*- mia-c++  -*-
+ *
+ * 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 MIA; if not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <mia/3d/imagedraw.hh>
+#include <mia/3d/imagedraw.cxx>
+
+#include <cstdlib>
+#include <cmath>
+
+NS_MIA_BEGIN
+
+using std::max; 
+using std::min; 
+using std::swap; 
+using std::fabs; 
+
+C3DDrawBox::C3DDrawBox(const C3DBounds& size, const C3DFVector& origin, const C3DFVector& spacing):
+        m_size(size), 
+        m_fsize(size), 
+        m_origin(origin)
+{
+        assert(spacing > C3DFVector::_0); 
+        m_stepping = C3DFVector::_1 / spacing;         
+}
+
+void C3DDrawBox::draw_point(const C3DFVector& p)
+{
+       
+        C3DBounds ip(static_cast<unsigned>(floor(p.x + 0.5)), 
+                     static_cast<unsigned>(floor(p.y + 0.5)), 
+                     static_cast<unsigned>(floor(p.z + 0.5)));
+       
+	cvdebug() << "about to draw " << ip << " from " << p << "\n"; 
+        if (ip < m_size) 
+                do_draw_point(ip);
+}
+
+
+bool C3DDrawBox::is_inside(const C3DFVector& p) const 
+{
+        return p >= C3DFVector::_0 && p < m_fsize; 
+}
+
+// 
+// This code follows zacharmarz answer in 
+//
+// http://gamedev.stackexchange.com/questions/18436/most-efficient-aabb-vs-ray-collision-algorithms
+// our AABB is [(0,0,0), box_size )
+// 
+inline bool evaluate_t(float& _min, float& _max, float size, float p, float dir, bool t_initialized)
+{
+	if (dir != 0.0f)  {
+		float invx = 1.0f / dir; 
+		float p0 = - p * invx; 
+		float p1 = (size - p) * invx; 
+		if (!t_initialized) {
+			_min = min(p0, p1); 
+			_max = max(p0, p1); 
+		}else{
+			_min = max(min(p0, p1), _min); 
+			_max = min(max(p0, p1), _max); 
+		}
+		return true; 
+	}else{
+		return false; 
+	}
+} 
+
+bool C3DDrawBox::make_inside(C3DFVector& p, const C3DFVector& searchdir) const 
+{
+        if (is_inside(p))
+                return true; 
+
+        // find intersection of the ray with the box
+	float  tmin = 0; 
+	float  tmax = 0;  
+
+	// check if we move parallel to the box and are outside
+	if (searchdir.x == 0.0) {
+		if (p.x < 0 || p.x > m_size.x) 
+			return false; 
+	}
+	if (searchdir.y == 0.0) {
+		if (p.y < 0 || p.y > m_size.y) 
+			return false; 
+	}
+	if (searchdir.z == 0.0) {
+		if (p.z < 0 || p.z > m_size.z) 
+			return false; 
+	}
+	
+	
+	bool t_initialized = evaluate_t(tmin, tmax, m_fsize.x, p.x, searchdir.x, false);
+	t_initialized = evaluate_t(tmin, tmax, m_fsize.y, p.y, searchdir.y, t_initialized); 
+	t_initialized = evaluate_t(tmin, tmax, m_fsize.z, p.z, searchdir.z, t_initialized);
+
+	cvdebug() << "search = " << p << " -> " <<  searchdir
+		  << "; tmin = " << tmin << ", tmax= "<< tmax 
+		  << "\n"; 
+
+        // the ray would hit, but the box is behind us 
+        if (tmax < 0) 
+                return false; 
+
+        // ray doesn't intersect 
+        if (tmin > tmax) 
+                return false; 
+        
+        // ray intersects, adjust point 
+        p += tmin * searchdir; 
+	cvdebug() << "boundary point = " << p << "\n"; 
+        return true; 
+}
+
+void C3DDrawBox::draw_line_pivot_x(C3DFVector& x, C3DFVector& y, C3DFVector& v)
+{
+        if (v.x < 0) {
+                swap(x,y); 
+		v *= -1.0f; 
+        }
+	v /= 2.0 * v.x; 
+        while (x.x <= y.x) {
+                draw_point(x); 
+                x += v; 
+        }
+}
+
+void C3DDrawBox::draw_line_pivot_y(C3DFVector& x, C3DFVector& y, C3DFVector& v)
+{
+	cvdebug() << "C3DDrawBox::draw_line_pivot_y: " << x << " - " << y <<   " > " << v << "\n"; 
+        if (v.y < 0) {
+                swap(x,y); 
+		v *= -1.0f; 
+        }
+	v /= 2.0 * v.y; 
+        while (x.y <= y.y) {
+                draw_point(x); 
+                x += v; 
+        }
+}
+
+void C3DDrawBox::draw_line_pivot_z(C3DFVector& x, C3DFVector& y, C3DFVector& v)
+{
+        if (v.z < 0) {
+                swap(x,y); 
+		v *= -1.0f; 
+        }
+	v /= 2.0 * v.z; 
+        while (x.z <= y.z) {
+                draw_point(x); 
+                x += v; 
+        }
+}
+
+
+void C3DDrawBox::draw_line(const C3DFVector& a, const C3DFVector& b)
+{
+       C3DFVector x = (a - m_origin ) * m_stepping; 
+       C3DFVector y = (b - m_origin ) * m_stepping; 
+       draw_line_internal(x, y); 
+}
+
+void C3DDrawBox::draw_line_internal(const C3DFVector& _x, const C3DFVector& _y)
+{       
+	cvdebug() << "C3DDrawBox::draw_line_internal: " << _x << " - " << _y << "\n"; 
+        C3DFVector x = _x;
+        C3DFVector y = _y;
+        
+        C3DFVector v = y - x;
+        float vn2 = v.norm2(); 
+        
+        if (vn2 < 0.5f) { // the line is only one point
+                // testing if it is inside is done 
+                // within the method
+                draw_point(x); 
+                return; 
+        }
+       
+        // clip the line with the box boundaries 
+        // early return if the ray does not hit the box in the search direction 
+        if (!make_inside(x,v)) 
+                return; 
+        
+        if (!make_inside(y,-1.0f*v)) 
+                return;
+        
+        C3DFVector av(fabs(v.x), fabs(v.y), fabs(v.z));  
+        
+        // draw along the fastest changing coordinate 
+        if (av.x > av.y) {
+                if (av.x > av.z) {
+                        draw_line_pivot_x(x, y, v); 
+                }else{
+                        draw_line_pivot_z(x, y, v); 
+                }
+        } else {
+                if (av.y > av.z) {
+                        draw_line_pivot_y(x, y, v); 
+                }else{
+                        draw_line_pivot_z(x, y, v); 
+                }
+        }
+}
+
+bool C3DDrawBox::has_overlap(const C3DFVector& x, const C3DFVector& y, const C3DFVector& z) 
+{
+	// check if at least one corner is inside 
+	// 
+	if (x >= C3DFVector::_0 &&  x <= m_fsize) 
+		return true; 
+
+	if (y >= C3DFVector::_0 &&  y <= m_fsize) 
+		return true; 
+	
+	if (z >= C3DFVector::_0 &&  z <= m_fsize) 
+		return true; 
+
+	C3DFVector c0(x); 
+	C3DFVector c1(x); 
+
+	if (y.x < c0.x) c0.x = y.x; 
+	if (y.y < c0.y) c0.y = y.y; 
+	if (y.z < c0.z) c0.z = y.z; 
+
+	if (y.x > c1.x) c1.x = y.x; 
+	if (y.y > c1.y) c1.y = y.y; 
+	if (y.z > c1.z) c1.z = y.z; 
+
+	if (z.x < c0.x) c0.x = z.x; 
+	if (z.y < c0.y) c0.y = z.y; 
+	if (z.z < c0.z) c0.z = z.z; 
+
+	if (z.x > c1.x) c1.x = z.x; 
+	if (z.y > c1.y) c1.y = z.y; 
+	if (z.z > c1.z) c1.z = z.z; 
+
+	if (c1.x < 0.0 || c0.x > m_fsize.x) 
+		return false; 
+	
+	if (c1.y < 0.0 || c1.y > m_fsize.y) 
+		return false; 
+
+	if (c1.z < 0.0 || c1.z > m_fsize.z) 
+		return false; 
+
+	return true; 
+	
+}
+
+void C3DDrawBox::draw_triangle(const C3DFVector& a, const C3DFVector& b, const C3DFVector& c)
+{
+	cvdebug() << "C3DDrawBox::draw_triangle: [" << a << "],[" << b << "],[" << c << "]\n"; 
+
+        C3DFVector x = (a - m_origin ) * m_stepping; 
+        C3DFVector y = (b - m_origin ) * m_stepping; 
+        C3DFVector z = (c - m_origin ) * m_stepping; 
+
+	if (!has_overlap(x,y,z)) {
+		cvdebug() << "skip triangle (["<< a <<"]["<< b <<"]["<< c <<"]) since it it doesn't overlap \n"; 
+		return; 
+	}
+        
+        C3DFVector e1 = x - y; 
+        C3DFVector e2 = y - z; 
+        C3DFVector e3 = z - x; 
+
+        auto e1n = e1.norm2(); 
+        auto e2n = e2.norm2(); 
+        auto e3n = e3.norm2(); 
+
+        enum pivot_edge { pe_xy, pe_yz, pe_zx}; 
+        
+        pivot_edge pe = pe_xy; 
+
+        if (e1n < e2n) {
+                swap(e1,e2); 
+                swap(e1n,e2n); 
+                pe = pe_yz; 
+        }
+        if (e1n < e3n) {
+                pe = pe_zx; 
+        }
+
+        switch (pe) {
+        case pe_xy: draw_triangle_internal(a, b, c); break; 
+        case pe_yz: draw_triangle_internal(b, c, a); break; 
+        case pe_zx: draw_triangle_internal(c, a, b); break; 
+        }
+}
+
+
+static float distance_point_infinite_line(const C3DFVector& point,
+                                          const C3DFVector& a,
+                                          const C3DFVector& b)
+{
+	if (point == a || point == b)
+		return 0.0;
+
+	const C3DFVector line = a - b;
+	const C3DFVector p_end = point - b;
+	const float nline =  line.norm2();
+	const float npoint = p_end.norm2();
+	if (nline > 0.0 ) {
+		const float dotlplt = dot(line, p_end) / nline;
+
+		const C3DFVector proj = b + dotlplt * line;
+		return (point - proj).norm();
+	}else // special case: line segment is actually a point
+		return sqrt(npoint);
+}
+
+void C3DDrawBox::draw_triangle_internal(const C3DFVector& a, const C3DFVector& b, const C3DFVector& c)
+{
+        // a-b is the longest edge and we draw all lines parallel to it
+        
+        float dist = distance_point_infinite_line(c, a, b);
+        draw_line_internal(a, b); 
+
+        if (dist > 0.5f) {
+                C3DFVector e1 = (c - a) / dist; 
+                C3DFVector e2 = (c - b) / dist; 
+                
+                for (float d = 0; d < dist; d += 0.5) {
+                        draw_line_internal(a + d * e1, b + d * e2);
+                }
+        }
+}
+
+template class EXPORT_3D T3DImageDrawTarget<bool>; 
+template class EXPORT_3D T3DImageDrawTarget<unsigned char>; 
+template class EXPORT_3D T3DImageDrawTarget<signed char>; 
+template class EXPORT_3D T3DImageDrawTarget<unsigned short>; 
+template class EXPORT_3D T3DImageDrawTarget<signed short>; 
+template class EXPORT_3D T3DImageDrawTarget<unsigned int>; 
+template class EXPORT_3D T3DImageDrawTarget<signed int>; 
+template class EXPORT_3D T3DImageDrawTarget<float>; 
+template class EXPORT_3D T3DImageDrawTarget<double>; 
+
+NS_MIA_END
diff --git a/mia/3d/imagedraw.cxx b/mia/3d/imagedraw.cxx
new file mode 100644
index 0000000..2367a70
--- /dev/null
+++ b/mia/3d/imagedraw.cxx
@@ -0,0 +1,60 @@
+/* -*- mia-c++  -*-
+ *
+ * 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 MIA; if not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <mia/3d/imagedraw.hh>
+#include <limits>
+
+NS_MIA_BEGIN
+
+
+/**
+   \brief implements T3DImage as a target for drawing operations 
+
+*/
+template <typename T> 
+T3DImageDrawTarget<T>::T3DImageDrawTarget(const C3DBounds& size, const C3DFVector& origin, const C3DFVector& spacing):
+        C3DDrawBox(size, origin, spacing),
+        m_target(size)
+{
+        m_target.set_voxel_size(spacing); 
+        m_target.set_origin(origin); 
+        
+        m_color = std::numeric_limits<T>::is_integer ? std::numeric_limits<T>::max() : 1.0;
+}
+        
+template <typename T> 
+const T3DImage<T>& T3DImageDrawTarget<T>::get_image() const
+{
+        return m_target; 
+}
+
+template <typename T> 
+void T3DImageDrawTarget<T>::set_color(T c)
+{
+        m_color = c; 
+}
+
+template <typename T> 
+void T3DImageDrawTarget<T>::do_draw_point(const C3DBounds& p)
+{
+        m_target(p) = m_color; 
+}
+
+NS_MIA_END
diff --git a/mia/3d/imagedraw.hh b/mia/3d/imagedraw.hh
new file mode 100644
index 0000000..3a2b03c
--- /dev/null
+++ b/mia/3d/imagedraw.hh
@@ -0,0 +1,132 @@
+/* -*- mia-c++  -*-
+ *
+ * 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 MIA; if not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef mia_3d_imagedraw_hh
+#define mia_3d_imagedraw_hh
+
+
+#include <mia/3d/image.hh>
+
+NS_MIA_BEGIN
+
+/**
+   \brief base class for a 3D volume raster graphics draw target 
+   
+   
+*/
+
+class EXPORT_3D C3DDrawBox {
+public: 
+	C3DDrawBox(const C3DBounds& size, const C3DFVector& origin, const C3DFVector& spacing); 
+	
+	void draw_point(const C3DFVector& p); 
+
+        /**
+           Draw a line from a to b in the volume with the current draw color. 
+           The line will be clipped at the output boundaries.
+           \param a 
+           \param b 
+         */
+	void draw_line(const C3DFVector& a, const C3DFVector& b); 
+
+        /**
+           Draw a filled triangle with the corners a, b, d in the volume with the 
+           current draw color. 
+           The triangle will be clipped at the output boundaries.
+           \param a 
+           \param b 
+           \param c
+        */
+
+	void draw_triangle(const C3DFVector& a, const C3DFVector& b, const C3DFVector& c); 
+	
+private: 
+	/**
+	   \returns true if the given point is inside the drawing volume
+	*/
+
+	bool is_inside(const C3DFVector& p) const; 
+
+	/**
+	   This function moves p along and in the direction of searchdir
+	   so that it is inside the draw volume
+	 */
+	bool make_inside(C3DFVector& p, const C3DFVector& searchdir) const;
+
+	void draw_line_pivot_x(C3DFVector& x, C3DFVector& y, C3DFVector& v); 
+	void draw_line_pivot_y(C3DFVector& x, C3DFVector& y, C3DFVector& v); 
+	void draw_line_pivot_z(C3DFVector& x, C3DFVector& y, C3DFVector& v); 
+
+	void draw_triangle_internal(const C3DFVector& a, const C3DFVector& b, const C3DFVector& c); 
+	void draw_line_internal(const C3DFVector& x, const C3DFVector& y); 
+
+	// check wether the bounding box enclosing the triangle overlaps with the drawing area
+	bool has_overlap(const C3DFVector& x, const C3DFVector& y, const C3DFVector& z); 
+
+	virtual void do_draw_point(const C3DBounds& p) = 0; 
+	
+	C3DBounds m_size; 
+	C3DFVector m_fsize; 
+	C3DFVector m_origin; 
+	C3DFVector m_stepping; 
+	
+}; 
+
+
+/**
+   \brief implements T3DImage as a target for drawing operations 
+
+*/
+template <typename T> 
+class T3DImageDrawTarget : public C3DDrawBox {
+        
+public: 
+        /**
+           Create a draw target of the given output size and the given voxel spacing
+         */
+        T3DImageDrawTarget(const C3DBounds& size, const C3DFVector& origin, const C3DFVector& spacing); 
+
+
+        /// \param c New drawing color  
+        void set_color(T c); 
+
+        
+        /// \returns the draw target 
+        const T3DImage<T>& get_image() const; 
+private: 
+	void do_draw_point(const C3DBounds& p); 
+	
+        T3DImage<T> m_target; 
+        T m_color; 
+}; 
+
+typedef T3DImageDrawTarget<bool> C3DBitImageDrawTarget; 
+typedef T3DImageDrawTarget<unsigned char> C3DUBImageDrawTarget; 
+typedef T3DImageDrawTarget<signed char> C3DSBImageDrawTarget; 
+typedef T3DImageDrawTarget<unsigned short> C3DUSImageDrawTarget; 
+typedef T3DImageDrawTarget<signed short> C3DSSImageDrawTarget; 
+typedef T3DImageDrawTarget<unsigned int> C3DUIImageDrawTarget; 
+typedef T3DImageDrawTarget<signed int> C3DSIImageDrawTarget; 
+typedef T3DImageDrawTarget<float> C3DFImageDrawTarget; 
+typedef T3DImageDrawTarget<double> C3DDImageDrawTarget; 
+
+NS_MIA_END
+
+#endif
diff --git a/mia/3d/imageio.cc b/mia/3d/imageio.cc
index 1dac3ce..42eb9a0 100644
--- a/mia/3d/imageio.cc
+++ b/mia/3d/imageio.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/imageio.hh b/mia/3d/imageio.hh
index 02af158..a0c9dbe 100644
--- a/mia/3d/imageio.hh
+++ b/mia/3d/imageio.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/imageiotest.cc b/mia/3d/imageiotest.cc
index 52f6852..eef35b8 100644
--- a/mia/3d/imageiotest.cc
+++ b/mia/3d/imageiotest.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/imageiotest.hh b/mia/3d/imageiotest.hh
index 59c9171..a1d6b3b 100644
--- a/mia/3d/imageiotest.hh
+++ b/mia/3d/imageiotest.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/imagetest.cc b/mia/3d/imagetest.cc
index cf5993a..364547e 100644
--- a/mia/3d/imagetest.cc
+++ b/mia/3d/imagetest.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/imagetest.hh b/mia/3d/imagetest.hh
index d789d95..b190061 100644
--- a/mia/3d/imagetest.hh
+++ b/mia/3d/imagetest.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/interpolator.cc b/mia/3d/interpolator.cc
index 41d62b5..d8c616c 100644
--- a/mia/3d/interpolator.cc
+++ b/mia/3d/interpolator.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/interpolator.cxx b/mia/3d/interpolator.cxx
index 4c82b5a..7087c55 100644
--- a/mia/3d/interpolator.cxx
+++ b/mia/3d/interpolator.cxx
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/interpolator.hh b/mia/3d/interpolator.hh
index c42e222..85ad6ae 100644
--- a/mia/3d/interpolator.hh
+++ b/mia/3d/interpolator.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/io/CMakeLists.txt b/mia/3d/io/CMakeLists.txt
index 8217af6..0b863e3 100644
--- a/mia/3d/io/CMakeLists.txt
+++ b/mia/3d/io/CMakeLists.txt
@@ -1,6 +1,6 @@
 #
 # This file is part of MIA - a toolbox for medical image analysis 
-# Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+# 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
diff --git a/mia/3d/io/analyze.cc b/mia/3d/io/analyze.cc
index b67ec66..da13782 100644
--- a/mia/3d/io/analyze.cc
+++ b/mia/3d/io/analyze.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/io/analyze.hh b/mia/3d/io/analyze.hh
index e3cffdc..17a665b 100644
--- a/mia/3d/io/analyze.hh
+++ b/mia/3d/io/analyze.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/io/inria.cc b/mia/3d/io/inria.cc
index 2ce6ae9..3841609 100644
--- a/mia/3d/io/inria.cc
+++ b/mia/3d/io/inria.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/io/vff.cc b/mia/3d/io/vff.cc
index 1650add..9508461 100644
--- a/mia/3d/io/vff.cc
+++ b/mia/3d/io/vff.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/iterator.cxx b/mia/3d/iterator.cxx
index 0b4c706..0a75083 100644
--- a/mia/3d/iterator.cxx
+++ b/mia/3d/iterator.cxx
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/iterator.hh b/mia/3d/iterator.hh
index 499ce0e..51a06fe 100644
--- a/mia/3d/iterator.hh
+++ b/mia/3d/iterator.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -40,7 +40,7 @@ NS_MIA_BEGIN
  */
 
 template <typename I> 
-class range3d_iterator_with_boundary_flag: public std::forward_iterator_tag {
+class EXPORT_3D range3d_iterator_with_boundary_flag: public std::forward_iterator_tag {
 public: 
 	/// data type reference 
 	typedef typename I::reference reference; 
@@ -186,7 +186,7 @@ private:
  */
 
 template <typename I> 
-class range3d_iterator: public std::forward_iterator_tag {
+class EXPORT_3D range3d_iterator: public std::forward_iterator_tag {
 public: 
 	/// data type reference 
 	typedef typename I::reference reference; 
diff --git a/mia/3d/landmark.cc b/mia/3d/landmark.cc
index 922c8cf..c91843f 100644
--- a/mia/3d/landmark.cc
+++ b/mia/3d/landmark.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -21,6 +21,8 @@
 #include <mia/3d/landmark.hh>
 #include <mia/2d/imageio.hh>
 
+#include <boost/filesystem/path.hpp>
+
 NS_MIA_BEGIN
 
 using boost::filesystem::path; 
diff --git a/mia/3d/landmark.hh b/mia/3d/landmark.hh
index e0f368a..4e16f8a 100644
--- a/mia/3d/landmark.hh
+++ b/mia/3d/landmark.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -23,11 +23,15 @@
 
 #include <memory>
 #include <vector>
-#include <boost/filesystem.hpp>
 #include <mia/3d/defines3d.hh>
 #include <mia/3d/camera.hh>
 #include <mia/2d/image.hh>
 
+namespace boost {
+namespace filesystem {
+class path;
+}}
+
 NS_MIA_BEGIN
 
 /**
diff --git a/mia/3d/landmarklist.cc b/mia/3d/landmarklist.cc
index 52d9448..7380434 100644
--- a/mia/3d/landmarklist.cc
+++ b/mia/3d/landmarklist.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -75,7 +75,7 @@ C3DLandmarklist::iterator C3DLandmarklist::end()
 	return m_list.end();
 }
 
-void C3DLandmarklist::set_path(const boost::filesystem::path& path)
+void C3DLandmarklist::set_path(const std::string& path)
 {
 	m_path = path; 
 }
diff --git a/mia/3d/landmarklist.hh b/mia/3d/landmarklist.hh
index 874ebc6..7a889cc 100644
--- a/mia/3d/landmarklist.hh
+++ b/mia/3d/landmarklist.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -22,8 +22,6 @@
 #define mia_3d_landmarklist_hh
 
 #include <map> 
-#include <boost/filesystem.hpp>
-
 #include <mia/core/iodata.hh>
 #include <mia/3d/landmark.hh>
 
@@ -95,7 +93,7 @@ public:
 	   Set the root path of the document (used to read the images) 
 	   \param path
 	 */
-	void set_path(const boost::filesystem::path& path); 
+	void set_path(const std::string& path); 
 
 	/**
 	   Set the name of the landmark list
@@ -113,7 +111,7 @@ public:
 private: 
 	CMap m_list; 
 
-	boost::filesystem::path m_path; 
+	std::string m_path; 
 	std::string m_name; 
 }; 
 
diff --git a/mia/3d/landmarklistio.cc b/mia/3d/landmarklistio.cc
index 82b7077..9900715 100644
--- a/mia/3d/landmarklistio.cc
+++ b/mia/3d/landmarklistio.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/landmarklistio.hh b/mia/3d/landmarklistio.hh
index a6679a4..b9c4594 100644
--- a/mia/3d/landmarklistio.hh
+++ b/mia/3d/landmarklistio.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/linear_transform.cc b/mia/3d/linear_transform.cc
index 8bdecf2..a37ab50 100644
--- a/mia/3d/linear_transform.cc
+++ b/mia/3d/linear_transform.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/linear_transform.hh b/mia/3d/linear_transform.hh
index 97051fd..825df96 100644
--- a/mia/3d/linear_transform.hh
+++ b/mia/3d/linear_transform.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/lmio/CMakeLists.txt b/mia/3d/lmio/CMakeLists.txt
index 3029342..6779b8b 100644
--- a/mia/3d/lmio/CMakeLists.txt
+++ b/mia/3d/lmio/CMakeLists.txt
@@ -1,6 +1,6 @@
 #
 # This file is part of MIA - a toolbox for medical image analysis 
-# Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+# 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
diff --git a/mia/3d/lmio/lmx.cc b/mia/3d/lmio/lmx.cc
index d7cf542..ca7f4f6 100644
--- a/mia/3d/lmio/lmx.cc
+++ b/mia/3d/lmio/lmx.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -22,7 +22,7 @@
 #include <libxml++/libxml++.h>
 #include <mia/core/msgstream.hh>
 #include <mia/core/tools.hh>
-
+#include <boost/filesystem.hpp>
 
 
 namespace
@@ -214,7 +214,7 @@ P3DLandmarklist C3DLMXLandmarklistIOPlugin::do_load(string const&  filename)cons
 	P3DLandmarklist result(new C3DLandmarklist);
 
 	bfs::path bfsfilename(filename); 
-	result->set_path(bfsfilename.root_path()); 
+	result->set_path(bfsfilename.root_path().string()); 
 
 	// get name of the set 
 	string name;  
diff --git a/mia/3d/maskedcost.cc b/mia/3d/maskedcost.cc
index 9deccbf..2fea381 100644
--- a/mia/3d/maskedcost.cc
+++ b/mia/3d/maskedcost.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/maskedcost.hh b/mia/3d/maskedcost.hh
index 4e33a23..92d98a8 100644
--- a/mia/3d/maskedcost.hh
+++ b/mia/3d/maskedcost.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/maskedcost/CMakeLists.txt b/mia/3d/maskedcost/CMakeLists.txt
index 0676ceb..15a0ca1 100644
--- a/mia/3d/maskedcost/CMakeLists.txt
+++ b/mia/3d/maskedcost/CMakeLists.txt
@@ -1,6 +1,6 @@
 #
 # This file is part of MIA - a toolbox for medical image analysis 
-# Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+# 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
diff --git a/mia/3d/maskedcost/lncc.cc b/mia/3d/maskedcost/lncc.cc
index 0d235ed..0c12b5f 100644
--- a/mia/3d/maskedcost/lncc.cc
+++ b/mia/3d/maskedcost/lncc.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -223,8 +223,8 @@ CLNCC3DImageCostPlugin::CLNCC3DImageCostPlugin():
 C3DMaskedImageCostPlugin("lncc"), 
 	m_hw(5)
 {
-	this->add_parameter("w", new CUIntParameter(m_hw, 1, 256, false, 
-						    "half width of the window used for evaluating the localized cross correlation")); 
+	this->add_parameter("w", make_ci_param(m_hw, 1, 256, false, 
+					       "half width of the window used for evaluating the localized cross correlation")); 
 }
 
 C3DMaskedImageCost *CLNCC3DImageCostPlugin::do_create() const
diff --git a/mia/3d/maskedcost/lncc.hh b/mia/3d/maskedcost/lncc.hh
index 85afc37..77494c9 100644
--- a/mia/3d/maskedcost/lncc.hh
+++ b/mia/3d/maskedcost/lncc.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/maskedcost/mi.cc b/mia/3d/maskedcost/mi.cc
index cee031b..a14eed8 100644
--- a/mia/3d/maskedcost/mi.cc
+++ b/mia/3d/maskedcost/mi.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/maskedcost/mi.hh b/mia/3d/maskedcost/mi.hh
index 8ec33c1..355087c 100644
--- a/mia/3d/maskedcost/mi.hh
+++ b/mia/3d/maskedcost/mi.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/maskedcost/ncc.cc b/mia/3d/maskedcost/ncc.cc
index f6d854b..00e4cca 100644
--- a/mia/3d/maskedcost/ncc.cc
+++ b/mia/3d/maskedcost/ncc.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/maskedcost/ncc.hh b/mia/3d/maskedcost/ncc.hh
index dc7b80e..5e352d1 100644
--- a/mia/3d/maskedcost/ncc.hh
+++ b/mia/3d/maskedcost/ncc.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/maskedcost/ssd.cc b/mia/3d/maskedcost/ssd.cc
index 7056db4..04ca519 100644
--- a/mia/3d/maskedcost/ssd.cc
+++ b/mia/3d/maskedcost/ssd.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/maskedcost/ssd.hh b/mia/3d/maskedcost/ssd.hh
index 310a42a..0ecce45 100644
--- a/mia/3d/maskedcost/ssd.hh
+++ b/mia/3d/maskedcost/ssd.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/maskedcost/test_lncc.cc b/mia/3d/maskedcost/test_lncc.cc
index 9fbee5d..40dec83 100644
--- a/mia/3d/maskedcost/test_lncc.cc
+++ b/mia/3d/maskedcost/test_lncc.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/maskedcost/test_mi.cc b/mia/3d/maskedcost/test_mi.cc
index 195af86..f995dfa 100644
--- a/mia/3d/maskedcost/test_mi.cc
+++ b/mia/3d/maskedcost/test_mi.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/maskedcost/test_ncc.cc b/mia/3d/maskedcost/test_ncc.cc
index b4c17cb..9eeb7f9 100644
--- a/mia/3d/maskedcost/test_ncc.cc
+++ b/mia/3d/maskedcost/test_ncc.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/maskedcost/test_ssd.cc b/mia/3d/maskedcost/test_ssd.cc
index d28ba17..eb415a5 100644
--- a/mia/3d/maskedcost/test_ssd.cc
+++ b/mia/3d/maskedcost/test_ssd.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/matrix.cc b/mia/3d/matrix.cc
index d2d1b2f..98e06b8 100644
--- a/mia/3d/matrix.cc
+++ b/mia/3d/matrix.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -20,30 +20,35 @@
 
 #include <mia/3d/matrix.hh>
 
+#ifdef __GNUC__
+#pragma GCC diagnostic push
+#ifndef __clang__ 
+#pragma GCC diagnostic ignored "-Wunused-local-typedefs"
+#else
+#pragma clang diagnostic ignored "-Wdeprecated-register"
+#endif 
+#endif 
 
+#include <Eigen/Core>
+#include <Eigen/Eigenvalues> 
 
-NS_MIA_BEGIN
+#ifdef __GNUC__
+#pragma GCC diagnostic pop
+#endif 
 
-template <typename T> 
-T3DMatrix<T>::T3DMatrix(const T3DMatrix<T>& o):
-	T3DVector< T3DVector<T> >
-        (o.x, o.y, o.z)
-{
-}
+
+NS_MIA_BEGIN
 
 
 template <typename T> 
-T3DMatrix<T>& T3DMatrix<T>::operator = (const T3DMatrix<T>& o)
+T3DMatrix<T>::T3DMatrix():
+        m_ev_type(0),
+	m_evectors(3),
+	m_ev_order(3)
 {
-	this->x = o.x; 
-	this->y = o.y; 
-	this->z = o.z; 
-
-	this->m_esolver.reset(nullptr); 
-	return *this; 
-
 }
 
+
 template <typename T> 
 T3DMatrix<T> T3DMatrix<T>::diagonal(T v)
 {
@@ -62,13 +67,19 @@ T3DMatrix<T> T3DMatrix<T>::diagonal(const T3DVector<T>& v)
 
 template <typename T> 
 T3DMatrix<T>::T3DMatrix(const T3DVector< T3DVector<T> >& other):
-	T3DVector<T3DVector<T> >(other.x, other.y, other.z)
+	T3DVector<T3DVector<T> >(other.x, other.y, other.z),
+	m_ev_type(0),
+	m_evectors(3),
+	m_ev_order(3)
 {
 }
 
 template <typename T> 
 T3DMatrix<T>::T3DMatrix(const T3DVector< T >& x, const T3DVector< T >& y, const T3DVector< T >& z ):
-	T3DVector<T3DVector<T> >(x, y, z)
+	T3DVector<T3DVector<T> >(x, y, z),
+	m_ev_type(0),
+	m_evectors(3),
+	m_ev_order(3)
 {
 }
 template <typename T> 
@@ -88,12 +99,18 @@ T3DMatrix<T>  T3DMatrix<T>::transposed()const
 template <typename T> 
 void T3DMatrix<T>::evaluate_ev() const
 {
+	typedef Eigen::Matrix<T, 3, 3> EMatrix3; 
+	typedef Eigen::EigenSolver<EMatrix3>  ESolver3;
+
 	EMatrix3  matrix; 
-	matrix << this->x.x, this->x.y, this->x.z, /**/ this->y.x, this->y.y, this->y.z, /**/  this->z.x, this->z.y, this->
-z.z; 
-	m_esolver.reset( new ESolver3(matrix, true)); 
+	// fill the matrix with the 
+	matrix << this->x.x, this->x.y, this->x.z, /**/
+		this->y.x, this->y.y, this->y.z, /**/
+		this->z.x, this->z.y, this->z.z; 
 
-	auto eval = m_esolver->eigenvalues(); 
+	ESolver3 esolver(matrix, true); 
+	
+	auto eval = esolver.eigenvalues(); 
 
 	// check if there are complex eigenvalues
 	bool complex = false; 
@@ -104,80 +121,105 @@ z.z;
 	}
 	
 	if (complex) {
+		m_ev_type = 1; 
 		for (int i = 0; i < 3; ++i) {
 			if (eval[i].imag() == 0.0) {
 				m_ev_order[0] = i; 
 				// in the complex case, the two complex evalues are 
 				// conjugated complex 
 				m_ev_order[1] = i+1 % 3; 
-				m_ev_order[2] = i+1 % 3; 
-				return; 
+				m_ev_order[2] = i+1 % 3;  
 			}
 		}
-	}
-
-	// not complex, just sort the eval indices
-	double evnorms[3]; 
-	for (int i = 0; i < 3; ++i)
-		evnorms[i] = std::norm(eval(i)); 
-
-
+	}else {
+	       
+		// not complex, just sort the eval indices
+		double evnorms[3]; 
+		for (int i = 0; i < 3; ++i)
+			evnorms[i] = std::norm(eval(i)); 
+		
 		
-	if (evnorms[0] < evnorms[1]) {
-                if (evnorms[0] < evnorms[2]) {
-			m_ev_order[2] = 0; 
-                        if (evnorms[1] < evnorms[2]) {
-				m_ev_order[0] = 2; 
-				m_ev_order[1] = 1; 
 		
-                        }else{
+		if (evnorms[0] < evnorms[1]) {
+			if (evnorms[0] < evnorms[2]) {
+				m_ev_order[2] = 0; 
+				if (evnorms[1] < evnorms[2]) {
+					m_ev_order[0] = 2; 
+					m_ev_order[1] = 1; 
+					
+				}else{
+					m_ev_order[0] = 1; 
+					m_ev_order[1] = 2; 
+				}
+			}else {
 				m_ev_order[0] = 1; 
-				m_ev_order[1] = 2; 
+				m_ev_order[1] = 0; 
+				m_ev_order[2] = 2; 
 			}
-                }else {
-			m_ev_order[0] = 1; 
-			m_ev_order[1] = 0; 
-			m_ev_order[2] = 2; 
-		}
                         
-        } else { 
-                
-                if (evnorms[0] > evnorms[2]) {
-			m_ev_order[0] = 0; 
+		} else { 
 			
-                        if (evnorms[1] < evnorms[2]) {
-				m_ev_order[1] = 2; 
+			if (evnorms[0] > evnorms[2]) {
+				m_ev_order[0] = 0; 
+				
+				if (evnorms[1] < evnorms[2]) {
+					m_ev_order[1] = 2; 
+					m_ev_order[2] = 1; 
+				}else{
+					m_ev_order[1] = 1; 
+					m_ev_order[2] = 2; 
+				}
+				
+			}else{ 
+				m_ev_order[0] = 2; 
+				m_ev_order[1] = 0; 
 				m_ev_order[2] = 1; 
-			}else{
-				m_ev_order[1] = 1; 
-				m_ev_order[2] = 2; 
 			}
-
-                }else{ 
-			m_ev_order[0] = 2; 
-			m_ev_order[1] = 0; 
-			m_ev_order[2] = 1; 
 		}
 	}
+	 
+	
+	// copy results over
+	m_evalues.x = eval[m_ev_order[0]].real(); 
+	
+	if (m_ev_order[1] == m_ev_order[2]) {
+		// complex case
+		m_evalues.y = eval[m_ev_order[1]].real(); 
+		m_evalues.z = eval[m_ev_order[2]].imag(); 
+	} else {
+
+		m_evalues.y = eval[m_ev_order[1]].real(); 
+		m_evalues.z = eval[m_ev_order[2]].real();
+		
+		if (m_evalues.x == m_evalues.y || m_evalues.y == m_evalues.z) 
+			m_ev_type = 2;
+		else 
+			m_ev_type = 3; 
+	}
+	assert(m_ev_type);
+	for (int i = 0; i < 3; ++i) {
+		const auto evec = esolver.eigenvectors().col(m_ev_order[i]);
+		m_evectors[i] = C3DFVector(evec(0).real(), evec(1).real(), evec(2).real());
+	}
 }
 
 template <typename T> 
 int T3DMatrix<T>::get_rank()const
 {
-	C3DFVector ev; 
-	auto type = this->get_eigenvalues(ev); 
-	cvdebug()<< "Matrix = "<< *this <<", Rank: eigenvalues: " << ev << "\n"; 
 	
-	switch (type) {
-	case 1: return (ev.x != 0.0) ? 3 : 2; 
-	case 3: return (ev.z != 0.0) ? 3 : 2; 
+	if (!m_ev_type)
+		evaluate_ev(); 
+		
+	switch (m_ev_type) {
+	case 1: return (m_evalues.x != 0.0) ? 3 : 2; 
+	case 3: return (m_evalues.z != 0.0) ? 3 : 2;
 	default: {
 		int rank = 0; 
-		if (ev.x != 0.0)  
+		if (m_evalues.x != 0.0)  
 			rank++; 
-		if (ev.y != 0.0)  
+		if (m_evalues.y != 0.0)  
 			rank++; 
-		if (ev.z != 0.0)  
+		if (m_evalues.z != 0.0)  
 			rank++; 
 		return rank; 
 	}
@@ -197,37 +239,20 @@ T T3DMatrix<T>::get_det()  const
 template <typename T> 
 int T3DMatrix<T>::get_eigenvalues(C3DFVector& result)const
 {
-	if (!m_esolver) 
+	if (m_ev_type == 0) 
 		evaluate_ev(); 
 
-	auto eval = m_esolver->eigenvalues(); 
-
-	result.x = eval[m_ev_order[0]].real(); 
-	
-	if (m_ev_order[1] == m_ev_order[2]) {
-		// complex case
-		result.y = eval[m_ev_order[1]].real(); 
-		result.y = eval[m_ev_order[2]].imag(); 
-		return 1;
-	}
-
-	result.y = eval[m_ev_order[1]].real(); 
-	result.z = eval[m_ev_order[2]].real();
-
-	if (result.x == result.y || result.y == result.z) 
-		return 2; 
-	return 3; 
+	result = m_evalues;
+	return m_ev_type;
 }
 
 template <typename T> 
 C3DFVector T3DMatrix<T>::get_eigenvector(int i)const
 {
-	if (!m_esolver) 
+	if (m_ev_type == 0) 
 		evaluate_ev(); 
 	
-
-	const auto evec = m_esolver->eigenvectors().col(m_ev_order[i]); 
-	return C3DFVector(evec(0).real(), evec(1).real(), evec(2).real()); 
+	return m_evectors[i];
 }
 
 template class T3DMatrix<float>; 
diff --git a/mia/3d/matrix.hh b/mia/3d/matrix.hh
index 56c477a..3d91901 100644
--- a/mia/3d/matrix.hh
+++ b/mia/3d/matrix.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -20,20 +20,7 @@
 #ifndef __mia_3d_matrix_hh
 #define __mia_3d_matrix_hh
 
-#ifdef __GNUC__
-#pragma GCC diagnostic push
-#ifndef __clang__ 
-#pragma GCC diagnostic ignored "-Wunused-local-typedefs"
-#endif 
-#endif 
-
-#include <Eigen/Core>
-#include <Eigen/Eigenvalues> 
-
-#ifdef __GNUC__
-#pragma GCC diagnostic pop
-#endif 
-
+#include <vector>
 #include <memory>
 
 #include <mia/3d/vector.hh>
@@ -41,6 +28,7 @@
 
 NS_MIA_BEGIN
 
+
 /**
    @ingroup basic 
    \brief a simple 3x3 matrix 
@@ -57,11 +45,8 @@ class T3DMatrix: public T3DVector< T3DVector<T> > {
 
 public:  
 	
-	T3DMatrix() = default; 
-	T3DMatrix(const T3DMatrix<T>& o); 
-
-	T3DMatrix<T>& operator = (const T3DMatrix<T>& o); 
-
+	T3DMatrix(); 
+	
 
 	/**
 	   Create a diagonal matrix 
@@ -163,11 +148,11 @@ public:
 private:
 	void evaluate_ev() const; 
 
-	typedef Eigen::Matrix<T, 3, 3> EMatrix3; 
-	typedef Eigen::EigenSolver<EMatrix3>  ESolver3; 
 		
-	mutable std::unique_ptr<ESolver3> m_esolver; 
-	mutable int m_ev_order[3]; 
+	mutable int m_ev_type; // 0 = not valid 
+	mutable C3DFVector m_evalues;
+	mutable std::vector<C3DFVector> m_evectors; 
+	mutable std::vector<int> m_ev_order; 
 }; 
 
 template <typename T> 
@@ -204,6 +189,7 @@ std::ostream& operator << (std::ostream& os, const T3DMatrix<T>& m)
 template <typename T> 
 T3DMatrix<T>& T3DMatrix<T>::operator -= (const T3DMatrix<T>& o)
 {
+	m_ev_type = 0; 
 	this->x -= o.x; 
 	this->y -= o.y; 
 	this->z -= o.z; 
diff --git a/mia/3d/model.cc b/mia/3d/model.cc
index f1968ac..d686332 100644
--- a/mia/3d/model.cc
+++ b/mia/3d/model.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/model.hh b/mia/3d/model.hh
index b7e35fc..2dddf0c 100644
--- a/mia/3d/model.hh
+++ b/mia/3d/model.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/multicost.cc b/mia/3d/multicost.cc
index c38466a..cfd0992 100644
--- a/mia/3d/multicost.cc
+++ b/mia/3d/multicost.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/multicost.hh b/mia/3d/multicost.hh
index df39ed0..d3db3c6 100644
--- a/mia/3d/multicost.hh
+++ b/mia/3d/multicost.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/multireg.cc b/mia/3d/multireg.cc
index f1f9d6e..ed1ed97 100644
--- a/mia/3d/multireg.cc
+++ b/mia/3d/multireg.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/multireg.hh b/mia/3d/multireg.hh
index c44a36e..55168dc 100644
--- a/mia/3d/multireg.hh
+++ b/mia/3d/multireg.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/nfg.cc b/mia/3d/nfg.cc
index 5e91347..6605634 100644
--- a/mia/3d/nfg.cc
+++ b/mia/3d/nfg.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/nfg.hh b/mia/3d/nfg.hh
index 98adc61..533ac3d 100644
--- a/mia/3d/nfg.hh
+++ b/mia/3d/nfg.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/nonrigidregister.cc b/mia/3d/nonrigidregister.cc
index 7993014..ff5a527 100644
--- a/mia/3d/nonrigidregister.cc
+++ b/mia/3d/nonrigidregister.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/nonrigidregister.hh b/mia/3d/nonrigidregister.hh
index a578f45..4a28fe5 100644
--- a/mia/3d/nonrigidregister.hh
+++ b/mia/3d/nonrigidregister.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/orientation.cc b/mia/3d/orientation.cc
index c8b5d53..d5b7b5e 100644
--- a/mia/3d/orientation.cc
+++ b/mia/3d/orientation.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -20,6 +20,7 @@
 
 #include <mia/3d/orientation.hh>
 #include <mia/core/utils.hh>
+#include <mia/core/attributes.cxx>
 
 NS_MIA_BEGIN
 using namespace std; 
@@ -313,6 +314,9 @@ EXPORT_3D  std::istream& operator >> (std::istream& is, C3DOrientationAndPositio
 	return is; 
 }
 
+template class  EXPORT_3D TTranslator<E3DImageOrientation>;
+template class  EXPORT_3D TTranslator<E3DPatientPositioning>;
+template class  EXPORT_3D TTranslator<C3DOrientationAndPosition>; 
 
 
 NS_MIA_END
diff --git a/mia/3d/orientation.hh b/mia/3d/orientation.hh
index 334276c..3bfa25d 100644
--- a/mia/3d/orientation.hh
+++ b/mia/3d/orientation.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/ppmatrix.cc b/mia/3d/ppmatrix.cc
index b220108..bda3d76 100644
--- a/mia/3d/ppmatrix.cc
+++ b/mia/3d/ppmatrix.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -310,12 +310,12 @@ double C3DPPDivcurlMatrixImpl::multiply(const Field& coefficients) const
 {
 	assert(coefficients.size() == m_nodes); 
 
-	register double result_1 = 0.0; 
-	register double result_2 = 0.0; 
-	register double result_3 = 0.0; 
-	register double result_4 = 0.0; 
-	register double result_5 = 0.0; 
-	register double result_6 = 0.0; 
+	double result_1 = 0.0; 
+	double result_2 = 0.0; 
+	double result_3 = 0.0; 
+	double result_4 = 0.0; 
+	double result_5 = 0.0; 
+	double result_6 = 0.0; 
 
 	const int nx = m_size.x;
 	const int ny = m_size.y;
diff --git a/mia/3d/ppmatrix.hh b/mia/3d/ppmatrix.hh
index 33d13e1..1135e36 100644
--- a/mia/3d/ppmatrix.hh
+++ b/mia/3d/ppmatrix.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/quaternion.cc b/mia/3d/quaternion.cc
index d1ed302..cc25570 100644
--- a/mia/3d/quaternion.cc
+++ b/mia/3d/quaternion.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/quaternion.hh b/mia/3d/quaternion.hh
index 1d31c3a..f0ef409 100644
--- a/mia/3d/quaternion.hh
+++ b/mia/3d/quaternion.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/reg3d/CMakeLists.txt b/mia/3d/reg3d/CMakeLists.txt
index 225d8c7..8129c1f 100644
--- a/mia/3d/reg3d/CMakeLists.txt
+++ b/mia/3d/reg3d/CMakeLists.txt
@@ -1,6 +1,6 @@
 #
 # This file is part of MIA - a toolbox for medical image analysis 
-# Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+# 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
diff --git a/mia/3d/reg3d/direct.cc b/mia/3d/reg3d/direct.cc
index 26c442b..befdcaf 100644
--- a/mia/3d/reg3d/direct.cc
+++ b/mia/3d/reg3d/direct.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/reg3d/fluid.cc b/mia/3d/reg3d/fluid.cc
index cf9a0c3..34f17c9 100644
--- a/mia/3d/reg3d/fluid.cc
+++ b/mia/3d/reg3d/fluid.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/reg3d/navier.cc b/mia/3d/reg3d/navier.cc
index d6d5d9c..9c12a4a 100644
--- a/mia/3d/reg3d/navier.cc
+++ b/mia/3d/reg3d/navier.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -176,16 +176,11 @@ C3DNavierRegModelPlugin::C3DNavierRegModelPlugin():
 	m_epsilon(0.0001),
 	m_maxiter(100)
 {
-	add_parameter("mu", new CFloatParameter(m_mu, 0.0, numeric_limits<float>::max(),
-							   false, "isotropic compliance"));
-	add_parameter("lambda", new CFloatParameter(m_lambda, 0.0, numeric_limits<float>::max(),
-							       false, "isotropic compression"));
-	add_parameter("omega", new CFloatParameter(m_omega, 0.1, 10,
-							      false, "relexation parameter"));
-	add_parameter("epsilon", new CFloatParameter(m_epsilon, 0.000001, 0.1,
-								false, "stopping parameter"));
-	add_parameter("iter", new CIntParameter(m_maxiter, 10, 10000,
-							   false, "maximum number of iterations"));
+	add_parameter("mu", make_nonnegative_param(m_mu, false, "isotropic compliance"));
+	add_parameter("lambda", make_nonnegative_param(m_lambda, false, "isotropic compression"));
+	add_parameter("omega", make_ci_param(m_omega, 0.1, 10, false, "relexation parameter"));
+	add_parameter("epsilon", make_oci_param(m_epsilon, 0.0, 0.1, false, "stopping parameter"));
+	add_parameter("iter", make_lc_param(m_maxiter, 1, false, "maximum number of iterations"));
 }
 
 C3DRegModel *C3DNavierRegModelPlugin::do_create()const
diff --git a/mia/3d/reg3d/naviera.cc b/mia/3d/reg3d/naviera.cc
index 21a412a..e405b69 100644
--- a/mia/3d/reg3d/naviera.cc
+++ b/mia/3d/reg3d/naviera.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -100,8 +100,8 @@ float C3DNavierRegModel::do_force_scale() const
 
 inline PRIVATE  void C3DNavierRegModel::set_flags(C3DUBImage::iterator loc)const
 {
-	const register int dx = m_dx;
-	const register int mdx = - m_dx;
+	const int dx = m_dx;
+	const int mdx = - m_dx;
 
 	C3DUBImage::iterator lmz = loc - m_dxy;
 	C3DUBImage::iterator lpz = loc + m_dxy;
@@ -272,14 +272,14 @@ inline C3DFVector C3DNavierRegModel::get_q(const C3DFVectorfield::iterator& v)co
 
 inline float  C3DNavierRegModel::solve_at(const C3DFVector& b, C3DFVectorfield::iterator& v)const
 {
-	register C3DFVector& vv = *v;
+	C3DFVector& vv = *v;
 	const C3DFVector old_v = vv;
 
 	const  C3DFVectorfield::iterator vm = v - m_dxy;
 	const  C3DFVectorfield::iterator vp = v + m_dxy;
 
-	const register int dx = m_dx;
-	const register int mx = - m_dx;
+	const int dx = m_dx;
+	const int mx = - m_dx;
 
 	const C3DFVector& v0mm = vm[ mx];
 	const C3DFVector& vm0m = vm[ -1];
@@ -305,19 +305,19 @@ inline float  C3DNavierRegModel::solve_at(const C3DFVector& b, C3DFVectorfield::
 	const C3DFVector& v0pp = vp[  dx];
 	const C3DFVector& vp0p = vp[  1];
 
-	register float rx = (vm00.x + vp00.x) * m_a_b + b.x;
-	register const float hx = vym.x + vyp.x + vzp.x + vzm.x;
+	float rx = (vm00.x + vp00.x) * m_a_b + b.x;
+	const float hx = vym.x + vyp.x + vzp.x + vzm.x;
 
-	register float ry = (vm00.y + vp00.y) * m_a_b + b.y;
-	register const float hy = vym.y + vyp.y + vzp.y + vzm.y;
+	float ry = (vm00.y + vp00.y) * m_a_b + b.y;
+	const float hy = vym.y + vyp.y + vzp.y + vzm.y;
 
-	register float rz = (vm00.z + vp00.z) * m_a_b + b.z;
-	register const float hz = vym.z + vyp.z + vzp.z + vzm.z;
+	float rz = (vm00.z + vp00.z) * m_a_b + b.z;
+	const float hz = vym.z + vyp.z + vzp.z + vzm.z;
 
 	{
-		register float ax = vmm0.y + vpp0.y;
-		register float ay = vmm0.x + vpp0.x;
-		register float az = vm0m.x + vp0p.x;
+		float ax = vmm0.y + vpp0.y;
+		float ay = vmm0.x + vpp0.x;
+		float az = vm0m.x + vp0p.x;
 
 		ax -= vmp0.y;
 		ay -= vmp0.x;
@@ -402,15 +402,11 @@ C3DNavierRegModelPlugin::C3DNavierRegModelPlugin():
 	m_epsilon(0.0001),
 	m_maxiter(40)
 {
-	add_parameter("mu", new CFloatParameter(m_mu, 0.0, numeric_limits<float>::max(),
-							   false, "isotropic compliance"));
-	add_parameter("lambda", new CFloatParameter(m_lambda, 0.0, numeric_limits<float>::max(),
-							       false, "isotropic compression"));
-
-	add_parameter("epsilon", new CFloatParameter(m_epsilon, 0.000001, 0.1,
-								false, "stopping parameter"));
-	add_parameter("iter", new CIntParameter(m_maxiter, 10, 10000,
-							   false, "maximum number of iterations"));
+	add_parameter("mu", make_nonnegative_param(m_mu, false, "isotropic compliance"));
+	add_parameter("lambda", make_nonnegative_param(m_lambda, false, "isotropic compression"));
+
+	add_parameter("epsilon", make_oci_param(m_epsilon, 0.0, 0.1, false, "stopping parameter"));
+	add_parameter("iter", make_lc_param(m_maxiter, 1, false, "maximum number of iterations"));
 }
 
 C3DRegModel *C3DNavierRegModelPlugin::do_create()const
diff --git a/mia/3d/reg3d/navierasse.cc b/mia/3d/reg3d/navierasse.cc
index d93aeb4..d53b514 100644
--- a/mia/3d/reg3d/navierasse.cc
+++ b/mia/3d/reg3d/navierasse.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -313,10 +313,10 @@ inline static float  solve_at(const xchg& b, xchg *v, const xchg& param, const i
 	const  xchg *vdp = v + dx;
 	sse_prefetch(vdp, 0, SSE_HINT_T1);
 
-	register v4sf a, m;
-	register v4sf r   = sse_addps (v[-1].xmm, v[ 1].xmm);
-	register v4sf vs2 = sse_addps (vdm[ 0 ].xmm, vdp[ 0 ].xmm);
-	register v4sf vs3 = sse_addps (vm[ 0 ].xmm, vp[ 0 ].xmm);
+	v4sf a, m;
+	v4sf r   = sse_addps (v[-1].xmm, v[ 1].xmm);
+	v4sf vs2 = sse_addps (vdm[ 0 ].xmm, vdp[ 0 ].xmm);
+	v4sf vs3 = sse_addps (vm[ 0 ].xmm, vp[ 0 ].xmm);
 
 	const  xchg *vdmm = vdm - 1;
 	sse_prefetch(vdmm, 0, SSE_HINT_T1);
@@ -325,7 +325,7 @@ inline static float  solve_at(const xchg& b, xchg *v, const xchg& param, const i
 	sse_prefetch(vdpm, 0, SSE_HINT_T1);
 
 
-	register v4sf help = sse_shufps( p, p, S_AB);
+	v4sf help = sse_shufps( p, p, S_AB);
 	r = sse_mulps(r, help);
 	vs2 = sse_addps (vs2, vs3);
 
@@ -342,11 +342,11 @@ inline static float  solve_at(const xchg& b, xchg *v, const xchg& param, const i
 	vs2 = sse_addps(vm[-1].xmm, vp[ 1 ].xmm);
 	a = sse_shufps( a, a, S_XY);
 
-	register v4sf vs4 = sse_addps(vm[1].xmm, vp[ -1 ].xmm);
+	v4sf vs4 = sse_addps(vm[1].xmm, vp[ -1 ].xmm);
 	vs3 = sse_addps(vm[-dx].xmm, vp[dx].xmm);
 	vs2 = sse_shufps( vs2, vs2, S_XZ);
 
-	register v4sf vs5 = sse_addps(vm[dx].xmm, vp[-dx].xmm);
+	v4sf vs5 = sse_addps(vm[dx].xmm, vp[-dx].xmm);
 
 	vs3 = sse_shufps( vs3, vs3, S_YZ);
 	m = sse_shufps( m, m, S_XY);
@@ -513,15 +513,11 @@ C3DNavierRegModelPlugin::C3DNavierRegModelPlugin():
 	m_epsilon(0.0001),
 	m_maxiter(40)
 {
-	add_parameter("mu", new CFloatParameter(m_mu, 0.0, numeric_limits<float>::max(),
-							   false, "isotropic compliance"));
-	add_parameter("lambda", new CFloatParameter(m_lambda, 0.0, numeric_limits<float>::max(),
-							       false, "isotropic compression"));
-
-	add_parameter("epsilon", new CFloatParameter(m_epsilon, 0.000001, 0.1,
-								false, "stopping parameter"));
-	add_parameter("iter", new CIntParameter(m_maxiter, 10, 10000,
-							   false, "maximum number of iterations"));
+	add_parameter("mu", make_nonnegative_param(m_mu,  false, "isotropic compliance"));
+	add_parameter("lambda", make_nonnegative_param(m_lambda,  false, "isotropic compression"));
+
+	add_parameter("epsilon", make_oci_param(m_epsilon, 0.0, 0.1, false, "stopping parameter"));
+	add_parameter("iter", make_lc_param(m_maxiter, 1, false, "maximum number of iterations"));
 }
 
 C3DRegModel *C3DNavierRegModelPlugin::do_create()const
diff --git a/mia/3d/reg3d/navierpsse.cc b/mia/3d/reg3d/navierpsse.cc
index acf3231..b1cdb5a 100644
--- a/mia/3d/reg3d/navierpsse.cc
+++ b/mia/3d/reg3d/navierpsse.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -294,7 +294,7 @@ inline static float  solve_at(const xchg& b, xchg *v, const xchg& param, const i
 	const int S_A  = 0xD5; // 1 1 1 3
 	const int S_B4 = 0xEA; // 2 2 2 3
 
-	register const v4sf p = param.xmm;
+	const v4sf p = param.xmm;
 
 	const  xchg *vm = v - dxy;
 	sse_prefetch(vm, 0, SSE_HINT_T1);
@@ -306,10 +306,10 @@ inline static float  solve_at(const xchg& b, xchg *v, const xchg& param, const i
 	const  xchg *vdp = v + dx;
 	sse_prefetch(vdp, 0, SSE_HINT_T1);
 
-	register v4sf a, m;
-	register v4sf r   = sse_addps (v[-1].xmm, v[ 1].xmm);
-	register v4sf vs2 = sse_addps (vdm[ 0 ].xmm, vdp[ 0 ].xmm);
-	register v4sf vs3 = sse_addps (vm[ 0 ].xmm, vp[ 0 ].xmm);
+	v4sf a, m;
+	v4sf r   = sse_addps (v[-1].xmm, v[ 1].xmm);
+	v4sf vs2 = sse_addps (vdm[ 0 ].xmm, vdp[ 0 ].xmm);
+	v4sf vs3 = sse_addps (vm[ 0 ].xmm, vp[ 0 ].xmm);
 
 	const  xchg *vdmm = vdm - 1;
 	sse_prefetch(vdmm, 0, SSE_HINT_T1);
@@ -318,7 +318,7 @@ inline static float  solve_at(const xchg& b, xchg *v, const xchg& param, const i
 	sse_prefetch(vdpm, 0, SSE_HINT_T1);
 
 
-	register v4sf help = sse_shufps( p, p, S_AB);
+	v4sf help = sse_shufps( p, p, S_AB);
 	r = sse_mulps(r, help);
 	vs2 = sse_addps (vs2, vs3);
 
@@ -335,11 +335,11 @@ inline static float  solve_at(const xchg& b, xchg *v, const xchg& param, const i
 	vs2 = sse_addps(vm[-1].xmm, vp[ 1 ].xmm);
 	a = sse_shufps( a, a, S_XY);
 
-	register v4sf vs4 = sse_addps(vm[1].xmm, vp[ -1 ].xmm);
+	v4sf vs4 = sse_addps(vm[1].xmm, vp[ -1 ].xmm);
 	vs3 = sse_addps(vm[-dx].xmm, vp[dx].xmm);
 	vs2 = sse_shufps( vs2, vs2, S_XZ);
 
-	register v4sf vs5 = sse_addps(vm[dx].xmm, vp[-dx].xmm);
+	v4sf vs5 = sse_addps(vm[dx].xmm, vp[-dx].xmm);
 
 	vs3 = sse_shufps( vs3, vs3, S_YZ);
 	m = sse_shufps( m, m, S_XY);
@@ -514,15 +514,10 @@ C3DNavierRegModelPlugin::C3DNavierRegModelPlugin():
 	m_epsilon(0.0001),
 	m_maxiter(40)
 {
-	add_parameter("mu", new CFloatParameter(m_mu, 0.0, numeric_limits<float>::max(),
-							   false, "isotropic compliance"));
-	add_parameter("lambda", new CFloatParameter(m_lambda, 0.0, numeric_limits<float>::max(),
-							       false, "isotropic compression"));
-
-	add_parameter("epsilon", new CFloatParameter(m_epsilon, 0.000001, 0.1,
-								false, "stopping parameter"));
-	add_parameter("iter", new CIntParameter(m_maxiter, 10, 10000,
-							   false, "maximum number of iterations"));
+	add_parameter("mu", make_nonnegative_param(m_mu, false, "isotropic compliance"));
+	add_parameter("lambda", make_nonnegative_param(m_lambda, false, "isotropic compression"));
+	add_parameter("epsilon", make_oci_param(m_epsilon, 0.0, 0.1, false, "stopping parameter"));
+	add_parameter("iter", make_lc_param(m_maxiter, 1, false, "maximum number of iterations"));
 }
 
 C3DRegModel *C3DNavierRegModelPlugin::do_create()const
diff --git a/mia/3d/register.cc b/mia/3d/register.cc
index f3fd964..c6c626a 100644
--- a/mia/3d/register.cc
+++ b/mia/3d/register.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/register.hh b/mia/3d/register.hh
index b1b8439..d7b48a1 100644
--- a/mia/3d/register.hh
+++ b/mia/3d/register.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/rigidregister.cc b/mia/3d/rigidregister.cc
index 4abb155..99166e0 100644
--- a/mia/3d/rigidregister.cc
+++ b/mia/3d/rigidregister.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/rigidregister.hh b/mia/3d/rigidregister.hh
index e492183..01d1fef 100644
--- a/mia/3d/rigidregister.hh
+++ b/mia/3d/rigidregister.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/rot.cc b/mia/3d/rot.cc
index 778922d..d6f0d5b 100644
--- a/mia/3d/rot.cc
+++ b/mia/3d/rot.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -24,6 +24,7 @@
 #include <boost/algorithm/string/classification.hpp>
 
 #include <mia/3d/rot.hh>
+#include <mia/core/attributes.cxx>
 
 NS_MIA_BEGIN
 
@@ -301,5 +302,6 @@ EXPORT_3D bool operator < (const C3DRotation& lhs, const C3DRotation& rhs)
 }
 
 template class EXPORT_3D TAttribute<C3DRotation>; 
+template class EXPORT_3D TTranslator<C3DRotation>;
 
 NS_MIA_END
diff --git a/mia/3d/rot.hh b/mia/3d/rot.hh
index 622211d..ee3de24 100644
--- a/mia/3d/rot.hh
+++ b/mia/3d/rot.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/shape.cc b/mia/3d/shape.cc
index 110129f..55f396e 100644
--- a/mia/3d/shape.cc
+++ b/mia/3d/shape.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -67,6 +67,6 @@ template class TPlugin<C3DImage, shape_type>;
 template class TFactory<C3DShape>;
 template class THandlerSingleton<TFactoryPluginHandler<C3DShapePlugin> >;
 template class TFactoryPluginHandler<C3DShapePlugin>;
-template class EXPORT_3D TPluginHandler<C3DShapePlugin>;
+template class TPluginHandler<C3DShapePlugin>;
 
 NS_MIA_END
diff --git a/mia/3d/shape.hh b/mia/3d/shape.hh
index c3127f3..5254832 100644
--- a/mia/3d/shape.hh
+++ b/mia/3d/shape.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/shapes/CMakeLists.txt b/mia/3d/shapes/CMakeLists.txt
index 337e937..7f92d43 100644
--- a/mia/3d/shapes/CMakeLists.txt
+++ b/mia/3d/shapes/CMakeLists.txt
@@ -1,6 +1,6 @@
 #
 # This file is part of MIA - a toolbox for medical image analysis 
-# Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+# 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
diff --git a/mia/3d/shapes/basic_shapes.cc b/mia/3d/shapes/basic_shapes.cc
index 1dc5d1c..d4ac09e 100644
--- a/mia/3d/shapes/basic_shapes.cc
+++ b/mia/3d/shapes/basic_shapes.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/shapes/sphere.cc b/mia/3d/shapes/sphere.cc
index 5ea4bde..589d38a 100644
--- a/mia/3d/shapes/sphere.cc
+++ b/mia/3d/shapes/sphere.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -57,7 +57,7 @@ CSphere3DShapeFactory::CSphere3DShapeFactory():
 	C3DShapePlugin("sphere"),
 	m_r(2)
 {
-	add_parameter("r", new CFloatParameter(m_r, 0, numeric_limits<float>::max(), false, "sphere radius"));
+	add_parameter("r", make_positive_param(m_r, false, "sphere radius"));
 }
 
 C3DShape *CSphere3DShapeFactory::do_create()const
diff --git a/mia/3d/shapes/sphere.hh b/mia/3d/shapes/sphere.hh
index 9f5658b..293bce0 100644
--- a/mia/3d/shapes/sphere.hh
+++ b/mia/3d/shapes/sphere.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/similarity_profile.cc b/mia/3d/similarity_profile.cc
index 0eb3ffd..6b26cbd 100644
--- a/mia/3d/similarity_profile.cc
+++ b/mia/3d/similarity_profile.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/similarity_profile.hh b/mia/3d/similarity_profile.hh
index d6d663c..bbfa730 100644
--- a/mia/3d/similarity_profile.hh
+++ b/mia/3d/similarity_profile.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/splinepenalty/CMakeLists.txt b/mia/3d/splinepenalty/CMakeLists.txt
index b638035..c7f16a5 100644
--- a/mia/3d/splinepenalty/CMakeLists.txt
+++ b/mia/3d/splinepenalty/CMakeLists.txt
@@ -1,6 +1,6 @@
 #
 # This file is part of MIA - a toolbox for medical image analysis 
-# Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+# 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
diff --git a/mia/3d/splinepenalty/divcurl.cc b/mia/3d/splinepenalty/divcurl.cc
index 782147b..2818b5f 100644
--- a/mia/3d/splinepenalty/divcurl.cc
+++ b/mia/3d/splinepenalty/divcurl.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -67,10 +67,8 @@ C3DDivcurlSplinePenaltyPlugin::C3DDivcurlSplinePenaltyPlugin():
 	m_div_weight(1.0), 
 	m_curl_weight(1.0)
 {
-	this->add_parameter("div", new CFloatParameter(m_div_weight, 0.0f, std::numeric_limits<float>::max(), 
-						       false, "penalty weight on divergence"));
-	this->add_parameter("curl", new CFloatParameter(m_curl_weight, 0.0f, std::numeric_limits<float>::max(), 
-							false, "penalty weight on curl"));
+	this->add_parameter("div", make_nonnegative_param(m_div_weight, false, "penalty weight on divergence"));
+	this->add_parameter("curl", make_nonnegative_param(m_curl_weight, false, "penalty weight on curl"));
 	
 }
 
diff --git a/mia/3d/splinepenalty/divcurl.hh b/mia/3d/splinepenalty/divcurl.hh
index b91c393..7db08f9 100644
--- a/mia/3d/splinepenalty/divcurl.hh
+++ b/mia/3d/splinepenalty/divcurl.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/splinepenalty/test_divcurl.cc b/mia/3d/splinepenalty/test_divcurl.cc
index 3d8b4f7..814d3cb 100644
--- a/mia/3d/splinepenalty/test_divcurl.cc
+++ b/mia/3d/splinepenalty/test_divcurl.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/splinetransformpenalty.cc b/mia/3d/splinetransformpenalty.cc
index 277b545..d0f07bf 100644
--- a/mia/3d/splinetransformpenalty.cc
+++ b/mia/3d/splinetransformpenalty.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -110,8 +110,7 @@ C3DSplineTransformPenaltyPlugin::C3DSplineTransformPenaltyPlugin(char const * co
 	m_weight(1.0), 
 	m_normalize(false)
 {
-	add_parameter("weight", new CFloatParameter(m_weight, 0.0f, std::numeric_limits<float>::max(), 
-						    false, "weight of penalty energy"));
+	add_parameter("weight", make_positive_param(m_weight, false, "weight of penalty energy"));
 	add_parameter("norm", new CBoolParameter(m_normalize, false, "Set to 1 if the penalty should be normalized " 
 						 "with respect to the image size")); 
 	
@@ -135,9 +134,6 @@ EXPLICIT_INSTANCE_DERIVED_FACTORY_HANDLER(C3DSplineTransformPenalty, C3DSplineTr
 
 C3DSplineTransformPenaltyPluginHandlerTest::C3DSplineTransformPenaltyPluginHandlerTest()
 {
-	CPathNameArray plugpath({bfs::path("splinepenalty")});
-	C3DSplineTransformPenaltyPluginHandler::set_search_path(plugpath);
-
 }
 
 NS_MIA_END
diff --git a/mia/3d/splinetransformpenalty.hh b/mia/3d/splinetransformpenalty.hh
index d8acdb3..bc2df2d 100644
--- a/mia/3d/splinetransformpenalty.hh
+++ b/mia/3d/splinetransformpenalty.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/stackdisttrans.cc b/mia/3d/stackdisttrans.cc
index 7276360..5e7906c 100644
--- a/mia/3d/stackdisttrans.cc
+++ b/mia/3d/stackdisttrans.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/stackdisttrans.hh b/mia/3d/stackdisttrans.hh
index 761e1fb..6d4a5b0 100644
--- a/mia/3d/stackdisttrans.hh
+++ b/mia/3d/stackdisttrans.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/test_2dimagefifofilter.cc b/mia/3d/test_2dimagefifofilter.cc
index a841b78..eafe7d0 100644
--- a/mia/3d/test_2dimagefifofilter.cc
+++ b/mia/3d/test_2dimagefifofilter.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -36,12 +36,4 @@ namespace bfs=::boost::filesystem;
 
 BOOST_AUTO_TEST_CASE( test_found_filters )
 {
-	CPathNameArray searchpath;
-	searchpath.push_back( bfs::path("fifof"));
-	C2DFifoFilterPluginHandler::set_search_path(searchpath);
-	BOOST_CHECK_EQUAL(C2DFifoFilterPluginHandler::instance().size(), 10u);
-
-	BOOST_CHECK_EQUAL(C2DFifoFilterPluginHandler::instance().get_plugin_names(),
-			  "byslice close dilate erode gauss label median mlv open regiongrow ");
-
 }
diff --git a/mia/3d/test_3d.cc b/mia/3d/test_3d.cc
index 9a591eb..956cc57 100644
--- a/mia/3d/test_3d.cc
+++ b/mia/3d/test_3d.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/test_affine_matrix.cc b/mia/3d/test_affine_matrix.cc
index 9c51b31..89901cf 100644
--- a/mia/3d/test_affine_matrix.cc
+++ b/mia/3d/test_affine_matrix.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/test_combiner.cc b/mia/3d/test_combiner.cc
index f31b1fb..8e10fb7 100644
--- a/mia/3d/test_combiner.cc
+++ b/mia/3d/test_combiner.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/test_cost.cc b/mia/3d/test_cost.cc
index 6ff3c01..ef73808 100644
--- a/mia/3d/test_cost.cc
+++ b/mia/3d/test_cost.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/test_datafield.cc b/mia/3d/test_datafield.cc
index 271e80c..79be924 100644
--- a/mia/3d/test_datafield.cc
+++ b/mia/3d/test_datafield.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -236,3 +236,62 @@ BOOST_AUTO_TEST_CASE( test_3ddatafield_get_put_yz )
 			BOOST_CHECK(plane_yz(y, z) == data(1, y, z));
 }
 
+
+#ifdef LONG_64BIT
+
+BOOST_AUTO_TEST_CASE( test_3ddatafield_larger_than_4GB )
+{
+	
+	
+	C3DBounds size(2048, 2048, 1048); 
+	
+	try {
+		// allocate 4GB+ of data 
+		C3DUBDatafield data(size); 
+		
+		// check successfull writing the data 
+		fill(data.begin() + 0xFFFFF000U, data.begin() + 0x100000000U, 1);
+		fill(data.begin() + 0x100000000U, data.end(), 2);
+		
+
+		BOOST_CHECK_EQUAL(data(2047, 2047, 1047), 2u); 
+
+		BOOST_CHECK_EQUAL(data(2047, 2045, 1023), 0u); 
+		BOOST_CHECK_EQUAL(data(0, 2046, 1023), 1u); 
+		BOOST_CHECK_EQUAL(data(2047, 2047, 1023), 1u); 
+		BOOST_CHECK_EQUAL(data(0, 0, 1024), 2u); 
+		
+		// test the line get and set routines 
+
+		vector<unsigned char> row(2048); 
+		data.get_data_line_x(10,1025, row); 
+		for (unsigned i = 0; i < row.size(); ++i) 
+			BOOST_CHECK_EQUAL(row[i], 2u); 
+
+		data.get_data_line_y(10,1025, row); 
+		for (unsigned i = 0; i < row.size(); ++i) 
+			BOOST_CHECK_EQUAL(row[i], 2u); 
+
+
+		data.get_data_line_z(10,2046, row); 
+		for (unsigned i = 0; i < 1023; ++i) 
+			BOOST_CHECK_EQUAL(row[i], 0u); 
+		for (unsigned i = 1023; i < 1024; ++i) 
+			BOOST_CHECK_EQUAL(row[i], 1u); 
+		for (unsigned i = 1025; i < 1048; ++i) 
+			BOOST_CHECK_EQUAL(row[i], 2u); 
+
+
+		
+	}
+	// if the memory can not be allocated then the test can not be run. 
+	catch (	std::bad_alloc& ba) {
+		cvdebug()  << "Unable to allocate memory for data field of size " << size 
+			   << ": " << ba.what() << "\n"
+			   << "test_3ddatafield_larger_than_4GB not exectuted\n"; 
+	}
+	
+}
+
+
+#endif 
diff --git a/mia/3d/test_deform.cc b/mia/3d/test_deform.cc
index ee38a61..97c424e 100644
--- a/mia/3d/test_deform.cc
+++ b/mia/3d/test_deform.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/test_distance.cc b/mia/3d/test_distance.cc
index 5e5d553..8687070 100644
--- a/mia/3d/test_distance.cc
+++ b/mia/3d/test_distance.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/test_fullcost.cc b/mia/3d/test_fullcost.cc
index ad28eee..c411488 100644
--- a/mia/3d/test_fullcost.cc
+++ b/mia/3d/test_fullcost.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -408,17 +408,5 @@ const C3DTransformCreatorHandler::Instance& PrepareFullcostTests::transform_hand
 
 PrepareFullcostTests::PrepareFullcostTests()
 {
-	CPathNameArray cost_kernel_plugpath;
-	cost_kernel_plugpath.push_back(bfs::path("cost"));
-	C3DImageCostPluginHandler::set_search_path(cost_kernel_plugpath);
-	
-	CPathNameArray cost_plugpath;
-	cost_plugpath.push_back(bfs::path("fullcost"));
-	C3DFullCostPluginHandler::set_search_path(cost_plugpath);
-
-	CPathNameArray transform_searchpath;
-	transform_searchpath.push_back(bfs::path("transform"));
-	C3DTransformCreatorHandler::set_search_path(transform_searchpath);
-
 }
 
diff --git a/mia/3d/test_ica.cc b/mia/3d/test_ica.cc
index 74f46e4..975d6e2 100644
--- a/mia/3d/test_ica.cc
+++ b/mia/3d/test_ica.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/test_image.cc b/mia/3d/test_image.cc
index 8b2b209..9cdee4e 100644
--- a/mia/3d/test_image.cc
+++ b/mia/3d/test_image.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/test_imagecollect.cc b/mia/3d/test_imagecollect.cc
index 6251e8d..2c32e38 100644
--- a/mia/3d/test_imagecollect.cc
+++ b/mia/3d/test_imagecollect.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/test_imagedraw.cc b/mia/3d/test_imagedraw.cc
new file mode 100644
index 0000000..c73c5de
--- /dev/null
+++ b/mia/3d/test_imagedraw.cc
@@ -0,0 +1,546 @@
+/* -*- mia-c++  -*-
+ *
+ * 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 MIA; if not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <mia/internal/autotest.hh>
+#include <mia/3d/imagedraw.hh>
+#include <mia/3d/imageio.hh>
+#include <set>
+
+using namespace mia; 
+using std::set; 
+
+class SimpleBitImageDrawFixture {
+        
+protected: 
+        SimpleBitImageDrawFixture(); 
+
+        C3DBitImageDrawTarget output; 
+
+}; 
+
+
+BOOST_FIXTURE_TEST_CASE( test_simple_draw_point, SimpleBitImageDrawFixture ) 
+{
+        output.draw_point(C3DFVector(4,5,6)); 
+        auto& img = output.get_image(); 
+        
+        auto i = img.begin_range(C3DBounds::_0, img.get_size()); 
+        auto e = img.end_range(C3DBounds::_0, img.get_size()); 
+        
+        for(; i != e; ++i) {
+                BOOST_CHECK_EQUAL(*i, i.pos() == C3DBounds(4,5,6)); 
+        }
+}
+
+BOOST_FIXTURE_TEST_CASE( test_simple_draw_point_outside, SimpleBitImageDrawFixture ) 
+{
+        output.draw_point(C3DFVector(-1,5,6)); 
+        output.draw_point(C3DFVector(1,-5,6)); 
+        output.draw_point(C3DFVector(1,5,-6)); 
+
+        output.draw_point(C3DFVector(10,5,6)); 
+        output.draw_point(C3DFVector(1,11,6)); 
+        output.draw_point(C3DFVector(1,5,12)); 
+
+
+
+        auto& img = output.get_image(); 
+        
+        
+        for(auto i : img) {
+                BOOST_CHECK(!i);
+        }
+}
+
+BOOST_FIXTURE_TEST_CASE( test_simple_draw_point_corners, SimpleBitImageDrawFixture ) 
+{
+        output.draw_point(C3DFVector(-.4,-.4,-.4)); 
+        output.draw_point(C3DFVector(9.4,-.4,-.4)); 
+        output.draw_point(C3DFVector(-.4,10.4,-.4)); 
+        output.draw_point(C3DFVector(-.4,-.4, 11.4)); 
+
+        output.draw_point(C3DFVector(9.4, 10.4, 11.4)); 
+        output.draw_point(C3DFVector(-.4, 10.4, 11.4)); 
+        output.draw_point(C3DFVector(9.4, -.4,  11.4)); 
+        output.draw_point(C3DFVector(9.4, 10.4, -.4)); 
+
+        auto& img = output.get_image(); 
+                
+        auto i = img.begin_range(C3DBounds::_0, img.get_size()); 
+        auto e = img.end_range(C3DBounds::_0, img.get_size()); 
+        
+        for(; i != e; ++i) {
+                if (i.pos() == C3DBounds::_0 ||
+                    i.pos() == C3DBounds(9, 0, 0) || 
+                    i.pos() == C3DBounds(0, 10, 0) ||
+                    i.pos() == C3DBounds(0, 0, 11) ||
+                    i.pos() == C3DBounds(9, 10, 0) ||
+                    i.pos() == C3DBounds(9,  0,11) ||
+                    i.pos() == C3DBounds(0, 10,11) ||
+                    i.pos() == C3DBounds(9, 10,11))
+                        BOOST_CHECK(*i); 
+                else 
+                        BOOST_CHECK(!*i);
+        }
+}
+
+
+struct compare_coordinate  {
+	bool operator () (const C3DBounds& lhs, const C3DBounds& rhs) {
+		return (lhs.z < rhs.z) || 
+			((lhs.z == rhs.z) && ((lhs.y < rhs.y) ||
+					      ((lhs.y == rhs.y) && (lhs.x < rhs.x)))); 
+	}
+}; 
+
+BOOST_FIXTURE_TEST_CASE( test_simple_draw_line_z_pivot, SimpleBitImageDrawFixture ) 
+{
+        output.draw_line(C3DFVector(0,0,0), C3DFVector(10,11,12)); 
+        auto& img = output.get_image(); 
+                
+        auto i = img.begin_range(C3DBounds::_0, img.get_size()); 
+        auto e = img.end_range(C3DBounds::_0, img.get_size()); 
+
+
+	set<C3DBounds, compare_coordinate> pixels; 
+
+	pixels.insert(C3DBounds::_0); 
+	pixels.insert(img.get_size() - C3DBounds::_1);
+	
+	C3DFVector dir(10.0 / 24, 11.0 / 24, 0.5f);
+	
+	C3DFVector p(0,0,0);
+	for (int k = 0; k < 24; ++k, p += dir) {
+		C3DBounds ip(static_cast<unsigned>(floor(p.x + 0.5)), 
+			     static_cast<unsigned>(floor(p.y + 0.5)), 
+			     static_cast<unsigned>(floor(p.z + 0.5))); 
+		cvdebug() << "test about to draw " << ip << " from " << p << "\n"; 
+		pixels.insert(ip); 
+	}
+        
+	cvdebug() << "Expect " << pixels.size() << " pixels to be set\n"; 
+        for(; i != e; ++i) {
+		cvdebug() << i.pos() <<" = "  <<*i << "\n"; 
+                if (pixels.find(i.pos()) == pixels.end())
+                        BOOST_CHECK(!*i); 
+                else 
+                        BOOST_CHECK(*i);
+        }
+}
+
+BOOST_FIXTURE_TEST_CASE( test_simple_draw_line_pivot_x, SimpleBitImageDrawFixture ) 
+{
+        output.draw_line(C3DFVector(0,4,5), C3DFVector(10,10,12)); 
+        auto& img = output.get_image(); 
+                
+        auto i = img.begin_range(C3DBounds::_0, img.get_size()); 
+        auto e = img.end_range(C3DBounds::_0, img.get_size()); 
+
+
+	set<C3DBounds, compare_coordinate> pixels; 
+
+
+	C3DFVector dir(0.5, 0.3, 0.35f);
+	
+	C3DFVector p(0,4,5);
+	for (int k = 0; k < 22; ++k, p += dir) {
+		C3DBounds ip(static_cast<unsigned>(floor(p.x + 0.5)), 
+			     static_cast<unsigned>(floor(p.y + 0.5)), 
+			     static_cast<unsigned>(floor(p.z + 0.5))); 
+		cvdebug() << "test about to draw " << ip << " from " << p << "\n"; 
+		pixels.insert(ip); 
+	}
+        
+	cvdebug() << "Expect " << pixels.size() << " pixels to be set\n"; 
+        for(; i != e; ++i) {
+		cvdebug() << i.pos() <<" = "  <<*i << "\n"; 
+                if (pixels.find(i.pos()) == pixels.end())
+                        BOOST_CHECK(!*i); 
+                else 
+                        BOOST_CHECK(*i);
+        }
+}
+
+BOOST_FIXTURE_TEST_CASE( test_simple_draw_line_pivot_y, SimpleBitImageDrawFixture ) 
+{
+        output.draw_line(C3DFVector(4,0,5), C3DFVector(10,10,9)); 
+        auto& img = output.get_image(); 
+                
+        auto i = img.begin_range(C3DBounds::_0, img.get_size()); 
+        auto e = img.end_range(C3DBounds::_0, img.get_size()); 
+
+
+	set<C3DBounds, compare_coordinate> pixels; 
+
+
+	C3DFVector dir(0.3, .5, 0.2f);
+	
+	C3DFVector p(4,0,5);
+	for (int k = 0; k < 22; ++k, p += dir) {
+		C3DBounds ip(static_cast<unsigned>(floor(p.x + 0.5)), 
+			     static_cast<unsigned>(floor(p.y + 0.5)), 
+			     static_cast<unsigned>(floor(p.z + 0.5))); 
+		cvdebug() << "test about to draw " << ip << " from " << p << "\n"; 
+		pixels.insert(ip); 
+	}
+        
+	cvdebug() << "Expect " << pixels.size() << " pixels to be set\n"; 
+        for(; i != e; ++i) {
+		cvdebug() << i.pos() <<" = "  <<*i << "\n"; 
+                if (pixels.find(i.pos()) == pixels.end())
+                        BOOST_CHECK(!*i); 
+                else 
+                        BOOST_CHECK(*i);
+        }
+}
+
+BOOST_FIXTURE_TEST_CASE( test_draw_line_pivot_x_outside_ends, SimpleBitImageDrawFixture ) 
+{
+        output.draw_line(C3DFVector(-4, 2, 5), C3DFVector(16, 14, 9)); 
+        auto& img = output.get_image(); 
+                
+        auto i = img.begin_range(C3DBounds::_0, img.get_size()); 
+        auto e = img.end_range(C3DBounds::_0, img.get_size()); 
+
+
+	set<C3DBounds, compare_coordinate> pixels; 
+
+
+	C3DFVector dir(0.5, 0.3, 0.1f);
+	
+	C3DFVector p(-4,2,5);
+	for (int k = 0; k < 42; ++k, p += dir) {
+		C3DBounds ip(static_cast<unsigned>(floor(p.x + 0.5)), 
+			     static_cast<unsigned>(floor(p.y + 0.5)), 
+			     static_cast<unsigned>(floor(p.z + 0.5))); 
+		cvdebug() << "test about to draw " << ip << " from " << p << "\n"; 
+		if (ip.x < img.get_size().x) 
+			pixels.insert(ip); 
+	}
+        
+	cvdebug() << "Expect " << pixels.size() << " pixels to be set\n"; 
+        for(; i != e; ++i) {
+		cvdebug() << i.pos() <<" = "  <<*i << "\n"; 
+                if (pixels.find(i.pos()) == pixels.end())
+                        BOOST_CHECK(!*i); 
+                else 
+                        BOOST_CHECK(*i);
+        }
+}
+
+
+
+BOOST_FIXTURE_TEST_CASE( test_draw_line_pivot_y_outside_ends, SimpleBitImageDrawFixture ) 
+{
+        output.draw_line(C3DFVector(4,-6, 5), C3DFVector(10,14,9)); 
+        auto& img = output.get_image(); 
+                
+        auto i = img.begin_range(C3DBounds::_0, img.get_size()); 
+        auto e = img.end_range(C3DBounds::_0, img.get_size()); 
+
+
+	set<C3DBounds, compare_coordinate> pixels; 
+
+
+	C3DFVector dir(0.15, 0.5, 0.1f);
+	
+	C3DFVector p(4,-6,5);
+	for (int k = 0; k < 42; ++k, p += dir) {
+		C3DBounds ip(static_cast<unsigned>(floor(p.x + 0.5)), 
+			     static_cast<unsigned>(floor(p.y + 0.5)), 
+			     static_cast<unsigned>(floor(p.z + 0.5))); 
+		cvdebug() << "test about to draw " << ip << " from " << p << "\n"; 
+		if (ip.y < img.get_size().y) 
+			pixels.insert(ip); 
+	}
+        
+	cvdebug() << "Expect " << pixels.size() << " pixels to be set\n"; 
+        for(; i != e; ++i) {
+		cvdebug() << i.pos() <<" = "  <<*i << "\n"; 
+                if (pixels.find(i.pos()) == pixels.end())
+                        BOOST_CHECK(!*i); 
+                else 
+                        BOOST_CHECK(*i);
+        }
+}
+
+
+BOOST_FIXTURE_TEST_CASE( test_draw_line_pivot_y_outside_ends_dx_is_zero, SimpleBitImageDrawFixture ) 
+{
+        output.draw_line(C3DFVector(4,-6, 5), C3DFVector(4,14,9)); 
+        auto& img = output.get_image(); 
+                
+        auto i = img.begin_range(C3DBounds::_0, img.get_size()); 
+        auto e = img.end_range(C3DBounds::_0, img.get_size()); 
+
+
+	set<C3DBounds, compare_coordinate> pixels; 
+
+
+	C3DFVector dir(0.0, 0.5, 0.1f);
+	
+	C3DFVector p(4,-6,5);
+	for (int k = 0; k < 42; ++k, p += dir) {
+		C3DBounds ip(static_cast<unsigned>(floor(p.x + 0.5)), 
+			     static_cast<unsigned>(floor(p.y + 0.5)), 
+			     static_cast<unsigned>(floor(p.z + 0.5))); 
+		cvdebug() << "test about to draw " << ip << " from " << p << "\n"; 
+		if (ip.y < img.get_size().y) 
+			pixels.insert(ip); 
+	}
+        
+	cvdebug() << "Expect " << pixels.size() << " pixels to be set\n"; 
+        for(; i != e; ++i) {
+		cvdebug() << i.pos() <<" = "  <<*i << "\n"; 
+                if (pixels.find(i.pos()) == pixels.end())
+                        BOOST_CHECK(!*i); 
+                else 
+                        BOOST_CHECK(*i);
+        }
+}
+
+
+BOOST_FIXTURE_TEST_CASE( test_draw_line_pivot_y_outside_ends_dN_is_zero_and_N_outside, SimpleBitImageDrawFixture ) 
+{
+	// x outside and parallel 
+        output.draw_line(C3DFVector(-1,-6, 5), C3DFVector(-1,14,9)); 
+        output.draw_line(C3DFVector(30,6, 5), C3DFVector(30,6,5)); 
+
+	// y outside and parallel 
+        output.draw_line(C3DFVector(1,-6, 5), C3DFVector(1,-6,9)); 
+        output.draw_line(C3DFVector(1, 40, 5), C3DFVector(1,40,9)); 
+
+	// z outside and parallel 
+        output.draw_line(C3DFVector(1,6, -5), C3DFVector(1,6,-5)); 
+        output.draw_line(C3DFVector(1,6, 22), C3DFVector(1,14,22)); 
+
+        auto& img = output.get_image(); 
+                
+        auto i = img.begin_range(C3DBounds::_0, img.get_size()); 
+        auto e = img.end_range(C3DBounds::_0, img.get_size()); 
+
+        
+	cvdebug() << "Expect 0  pixels to be set\n"; 
+        for(; i != e; ++i) {
+		cvdebug() << i.pos() <<" = "  <<*i << "\n"; 
+		BOOST_CHECK(!*i); 
+        }
+}
+
+BOOST_FIXTURE_TEST_CASE( test_draw_line_pivot_z_outside_ends, SimpleBitImageDrawFixture ) 
+{
+        output.draw_line(C3DFVector(4, 4, -5), C3DFVector(10, 14, 15)); 
+        auto& img = output.get_image(); 
+                
+        auto i = img.begin_range(C3DBounds::_0, img.get_size()); 
+        auto e = img.end_range(C3DBounds::_0, img.get_size()); 
+
+
+	set<C3DBounds, compare_coordinate> pixels; 
+
+
+	C3DFVector dir(0.15, 0.25, 0.5f);
+	
+	C3DFVector p(5.5, 6.5, 0);
+	for (int k = 0; k < 41 && p.z < 12; ++k, p += dir) {
+		C3DBounds ip(static_cast<unsigned>(floor(p.x + 0.5)), 
+			     static_cast<unsigned>(floor(p.y + 0.5)), 
+			     static_cast<unsigned>(floor(p.z + 0.5))); 
+		cvdebug() << "test about to draw " << ip << " from " << p << "\n"; 
+		if (ip.z < img.get_size().z) 
+			pixels.insert(ip); 
+	}
+        
+	cvdebug() << "Expect " << pixels.size() << " pixels to be set\n"; 
+        for(; i != e; ++i) {
+		cvdebug() << i.pos() <<" = "  <<*i << "\n"; 
+                if (pixels.find(i.pos()) == pixels.end())
+                        BOOST_CHECK(!*i); 
+                else 
+                        BOOST_CHECK(*i);
+        }
+}
+
+
+BOOST_FIXTURE_TEST_CASE( test_draw_line_pivot_x_outside_ends_dz_is_zero, SimpleBitImageDrawFixture ) 
+{
+        output.draw_line(C3DFVector(-4, 2, 5), C3DFVector(16, 14, 5)); 
+        auto& img = output.get_image(); 
+                
+        auto i = img.begin_range(C3DBounds::_0, img.get_size()); 
+        auto e = img.end_range(C3DBounds::_0, img.get_size()); 
+
+
+	set<C3DBounds, compare_coordinate> pixels; 
+
+
+	C3DFVector dir(0.5, 0.3, 0.0);
+	
+	C3DFVector p(-4,2,5);
+	for (int k = 0; k < 42; ++k, p += dir) {
+		C3DBounds ip(static_cast<unsigned>(floor(p.x + 0.5)), 
+			     static_cast<unsigned>(floor(p.y + 0.5)), 
+			     static_cast<unsigned>(floor(p.z + 0.5))); 
+		cvdebug() << "test about to draw " << ip << " from " << p << "\n"; 
+		if (ip.x < img.get_size().x) 
+			pixels.insert(ip); 
+	}
+        
+	cvdebug() << "Expect " << pixels.size() << " pixels to be set\n"; 
+        for(; i != e; ++i) {
+		cvdebug() << i.pos() <<" = "  <<*i << "\n"; 
+                if (pixels.find(i.pos()) == pixels.end())
+                        BOOST_CHECK(!*i); 
+                else 
+                        BOOST_CHECK(*i);
+        }
+}
+
+
+BOOST_FIXTURE_TEST_CASE( test_draw_line_pivot_z_outside_ends_dy_is_zero, SimpleBitImageDrawFixture ) 
+{
+        output.draw_line(C3DFVector(4, 4, -5), C3DFVector(10, 4, 15)); 
+        auto& img = output.get_image(); 
+                
+        auto i = img.begin_range(C3DBounds::_0, img.get_size()); 
+        auto e = img.end_range(C3DBounds::_0, img.get_size()); 
+
+
+	set<C3DBounds, compare_coordinate> pixels; 
+
+
+	C3DFVector dir(0.15, 0.0, 0.5f);
+	
+	C3DFVector p(5.5, 4, 0);
+	for (int k = 0; k < 41 && p.z < 12; ++k, p += dir) {
+		C3DBounds ip(static_cast<unsigned>(floor(p.x + 0.5)), 
+			     static_cast<unsigned>(floor(p.y + 0.5)), 
+			     static_cast<unsigned>(floor(p.z + 0.5))); 
+		cvdebug() << "test about to draw " << ip << " from " << p << "\n"; 
+		if (ip.z < img.get_size().z) 
+			pixels.insert(ip); 
+	}
+        
+	cvdebug() << "Expect " << pixels.size() << " pixels to be set\n"; 
+        for(; i != e; ++i) {
+		cvdebug() << i.pos() <<" = "  <<*i << "\n"; 
+                if (pixels.find(i.pos()) == pixels.end())
+                        BOOST_CHECK(!*i); 
+                else 
+                        BOOST_CHECK(*i);
+        }
+}
+
+
+BOOST_FIXTURE_TEST_CASE( test_draw_line_triangle_inside, SimpleBitImageDrawFixture ) 
+{
+	C3DFVector a(4, 4, 4); 
+	C3DFVector b(9, 10, 11); 
+	C3DFVector c(5, 8, 1); 
+
+        output.draw_triangle(a, b, c);
+        auto img = output.get_image(); 
+                
+        auto i = img.begin_range(C3DBounds::_0, img.get_size()); 
+        auto e = img.end_range(C3DBounds::_0, img.get_size()); 
+
+
+	// visually inspecting the pixels shows that this is 
+	// indeed the approximation of a triangle in 3D 
+	
+	set<C3DBounds, compare_coordinate> pixels; 
+	pixels.insert(C3DBounds(9,10,11)); 
+	
+
+	pixels.insert(C3DBounds(8,9,10)); 
+	pixels.insert(C3DBounds(8,10,10));
+	pixels.insert(C3DBounds(9,10,10)); 	
+
+	pixels.insert(C3DBounds(8,9,9)); 
+	pixels.insert(C3DBounds(8,10,9)); 
+
+	pixels.insert(C3DBounds(7,7,8));
+	pixels.insert(C3DBounds(7,9,8));
+	pixels.insert(C3DBounds(8,9,8)); 
+	pixels.insert(C3DBounds(7,8,8)); 
+
+	pixels.insert(C3DBounds(6,7,7)); 
+	pixels.insert(C3DBounds(7,9,7)); 
+	pixels.insert(C3DBounds(7,8,7)); 
+	pixels.insert(C3DBounds(7,7,7));
+
+	pixels.insert(C3DBounds(7,9,6)); 
+	pixels.insert(C3DBounds(6,7,6)); 
+	pixels.insert(C3DBounds(6,8,6)); 
+	pixels.insert(C3DBounds(6,6,6)); 
+	pixels.insert(C3DBounds(5,6,6));
+	pixels.insert(C3DBounds(7,8,6));
+
+
+	pixels.insert(C3DBounds(6,9,5));
+	pixels.insert(C3DBounds(7,9,5)); 
+	pixels.insert(C3DBounds(6,8,5)); 
+	pixels.insert(C3DBounds(6,7,5)); 
+	pixels.insert(C3DBounds(5,5,5)); 
+	pixels.insert(C3DBounds(5,6,5)); 
+
+
+	pixels.insert(C3DBounds(4,5,4));
+	pixels.insert(C3DBounds(6,7,4));
+	pixels.insert(C3DBounds(6,8,4)); 
+	pixels.insert(C3DBounds(6,9,4)); 
+	pixels.insert(C3DBounds(5,5,4)); 
+	pixels.insert(C3DBounds(5,6,4)); 
+	pixels.insert(C3DBounds(5,7,4)); 
+	pixels.insert(C3DBounds(4,4,4)); 
+
+	pixels.insert(C3DBounds(5,6,3));
+	pixels.insert(C3DBounds(5,8,3));
+
+	pixels.insert(C3DBounds(4,5,3)); 
+	pixels.insert(C3DBounds(4,6,3)); 
+	pixels.insert(C3DBounds(5,7,3)); 
+	pixels.insert(C3DBounds(6,8,3)); 
+
+	pixels.insert(C3DBounds(5,6,2));
+	pixels.insert(C3DBounds(5,7,2)); 
+	pixels.insert(C3DBounds(5,8,2)); 
+
+	pixels.insert(C3DBounds(5,8,1)); 
+
+        
+	cvdebug() << "Expect " << pixels.size() << " pixels to be set\n"; 
+        for(; i != e; ++i) {
+		cvdebug() << i.pos() <<" = "  <<*i << "\n"; 
+                if (pixels.find(i.pos()) == pixels.end()) {
+                        BOOST_CHECK(!*i); 
+                }else 
+                        BOOST_CHECK(*i);
+        }
+
+}
+
+
+
+
+SimpleBitImageDrawFixture::SimpleBitImageDrawFixture():
+        output(C3DBounds(10,11,12), C3DFVector::_0, C3DFVector::_1)
+{
+}
diff --git a/mia/3d/test_interpol.cc b/mia/3d/test_interpol.cc
index ce0836f..5c345ec 100644
--- a/mia/3d/test_interpol.cc
+++ b/mia/3d/test_interpol.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/test_iterator.cc b/mia/3d/test_iterator.cc
index 0496e9e..3e62476 100644
--- a/mia/3d/test_iterator.cc
+++ b/mia/3d/test_iterator.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/test_landmark.cc b/mia/3d/test_landmark.cc
index 906150d..346241e 100644
--- a/mia/3d/test_landmark.cc
+++ b/mia/3d/test_landmark.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/test_landmarklistio.cc b/mia/3d/test_landmarklistio.cc
index c23a714..8717e77 100644
--- a/mia/3d/test_landmarklistio.cc
+++ b/mia/3d/test_landmarklistio.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/test_matrix.cc b/mia/3d/test_matrix.cc
index 950de97..4883b50 100644
--- a/mia/3d/test_matrix.cc
+++ b/mia/3d/test_matrix.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/test_nfg.cc b/mia/3d/test_nfg.cc
index be8f446..8251774 100644
--- a/mia/3d/test_nfg.cc
+++ b/mia/3d/test_nfg.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/test_nonrigidregister.cc b/mia/3d/test_nonrigidregister.cc
index 75834b5..9037020 100644
--- a/mia/3d/test_nonrigidregister.cc
+++ b/mia/3d/test_nonrigidregister.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/test_orientation.cc b/mia/3d/test_orientation.cc
index c0330e1..b04655d 100644
--- a/mia/3d/test_orientation.cc
+++ b/mia/3d/test_orientation.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/test_ppmatrix.cc b/mia/3d/test_ppmatrix.cc
index 6883394..5fbd588 100644
--- a/mia/3d/test_ppmatrix.cc
+++ b/mia/3d/test_ppmatrix.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/test_quaternion.cc b/mia/3d/test_quaternion.cc
index 8272328..2a6dc6a 100644
--- a/mia/3d/test_quaternion.cc
+++ b/mia/3d/test_quaternion.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/test_regplugins.cc b/mia/3d/test_regplugins.cc
index 346981d..3e5d631 100644
--- a/mia/3d/test_regplugins.cc
+++ b/mia/3d/test_regplugins.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/test_rigidregister.cc b/mia/3d/test_rigidregister.cc
index 040021f..3fd20fc 100644
--- a/mia/3d/test_rigidregister.cc
+++ b/mia/3d/test_rigidregister.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/test_rot.cc b/mia/3d/test_rot.cc
index 89e658e..510431e 100644
--- a/mia/3d/test_rot.cc
+++ b/mia/3d/test_rot.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/test_shape.cc b/mia/3d/test_shape.cc
index 71a9e80..814a9a3 100644
--- a/mia/3d/test_shape.cc
+++ b/mia/3d/test_shape.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/test_similarity_profile.cc b/mia/3d/test_similarity_profile.cc
index bacd618..6837578 100644
--- a/mia/3d/test_similarity_profile.cc
+++ b/mia/3d/test_similarity_profile.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/test_splinetransformpenalty.cc b/mia/3d/test_splinetransformpenalty.cc
index f22e1bb..86f3111 100644
--- a/mia/3d/test_splinetransformpenalty.cc
+++ b/mia/3d/test_splinetransformpenalty.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/test_stackdisttrans.cc b/mia/3d/test_stackdisttrans.cc
index 38186d8..34d4ca8 100644
--- a/mia/3d/test_stackdisttrans.cc
+++ b/mia/3d/test_stackdisttrans.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/test_trackpoint.cc b/mia/3d/test_trackpoint.cc
index b7c8c50..fa02029 100644
--- a/mia/3d/test_trackpoint.cc
+++ b/mia/3d/test_trackpoint.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/test_transform.cc b/mia/3d/test_transform.cc
index 386f62f..344b0cb 100644
--- a/mia/3d/test_transform.cc
+++ b/mia/3d/test_transform.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/test_transformfactory.cc b/mia/3d/test_transformfactory.cc
index 435d775..eab8218 100644
--- a/mia/3d/test_transformfactory.cc
+++ b/mia/3d/test_transformfactory.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -36,10 +36,6 @@ struct HandlerTestFixture {
 
 HandlerTestFixture::HandlerTestFixture()
 {
-
-	CPathNameArray kernelsearchpath;
-	kernelsearchpath.push_back(bfs::path("transform"));
-	C3DTransformCreatorHandler::set_search_path(kernelsearchpath);
 }
 
 BOOST_FIXTURE_TEST_CASE(test_handler, HandlerTestFixture)
diff --git a/mia/3d/test_transio.cc b/mia/3d/test_transio.cc
index 42664bd..a8e9231 100644
--- a/mia/3d/test_transio.cc
+++ b/mia/3d/test_transio.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -118,14 +118,6 @@ const C3DTransformCreatorHandler::Instance& PrepareTransIOTests::transform_handl
 
 PrepareTransIOTests::PrepareTransIOTests()
 {
-	CPathNameArray transformio_plugpath;
-	transformio_plugpath.push_back(bfs::path("transio"));
-	C3DTransformationIOPluginHandler::set_search_path(transformio_plugpath);
-	
-	CPathNameArray transform_searchpath;
-	transform_searchpath.push_back(bfs::path("transform"));
-	C3DTransformCreatorHandler::set_search_path(transform_searchpath);
-
 }
 
 
diff --git a/mia/3d/test_vector.cc b/mia/3d/test_vector.cc
index c2dc577..43505a8 100644
--- a/mia/3d/test_vector.cc
+++ b/mia/3d/test_vector.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/test_vectorfield.cc b/mia/3d/test_vectorfield.cc
index 9cdc411..b429900 100644
--- a/mia/3d/test_vectorfield.cc
+++ b/mia/3d/test_vectorfield.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/test_vfio.cc b/mia/3d/test_vfio.cc
index 7671dbb..032deb9 100644
--- a/mia/3d/test_vfio.cc
+++ b/mia/3d/test_vfio.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/timestep.cc b/mia/3d/timestep.cc
index 6e914b5..bbc981f 100644
--- a/mia/3d/timestep.cc
+++ b/mia/3d/timestep.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -94,10 +94,8 @@ C3DRegTimeStepPlugin::C3DRegTimeStepPlugin(const char *name):
 	m_min(0.1),
 	m_max(2.0)
 {
-	add_parameter("min", new CFloatParameter(m_min, 0.001, std::numeric_limits<float>::max(),
-							   false, "minimum time step allowed"));
-	add_parameter("max", new CFloatParameter(m_max, 0.002, std::numeric_limits<float>::max(),
-							       false, "maximum time step allowed"));
+	add_parameter("min", make_positive_param(m_min, false, "minimum time step allowed"));
+	add_parameter("max", make_positive_param(m_max, false, "maximum time step allowed"));
 }
 
 float C3DRegTimeStepPlugin::get_min_timestep() const
diff --git a/mia/3d/timestep.hh b/mia/3d/timestep.hh
index 56a8ec4..e8b0cf7 100644
--- a/mia/3d/timestep.hh
+++ b/mia/3d/timestep.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/trackpoint.cc b/mia/3d/trackpoint.cc
index f9ea1ae..b7bac90 100644
--- a/mia/3d/trackpoint.cc
+++ b/mia/3d/trackpoint.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/trackpoint.hh b/mia/3d/trackpoint.hh
index 47b3948..dcca7e8 100644
--- a/mia/3d/trackpoint.hh
+++ b/mia/3d/trackpoint.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/trait.hh b/mia/3d/trait.hh
index b0b4b71..d0939ee 100644
--- a/mia/3d/trait.hh
+++ b/mia/3d/trait.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/transform.cc b/mia/3d/transform.cc
index 8ac47b2..5e00dca 100644
--- a/mia/3d/transform.cc
+++ b/mia/3d/transform.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/transform.hh b/mia/3d/transform.hh
index 9f34a28..8ffd9e1 100644
--- a/mia/3d/transform.hh
+++ b/mia/3d/transform.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/transform/CMakeLists.txt b/mia/3d/transform/CMakeLists.txt
index 9768307..856d42a 100644
--- a/mia/3d/transform/CMakeLists.txt
+++ b/mia/3d/transform/CMakeLists.txt
@@ -1,6 +1,6 @@
 #
 # This file is part of MIA - a toolbox for medical image analysis 
-# Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+# 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
diff --git a/mia/3d/transform/affine.cc b/mia/3d/transform/affine.cc
index d4c162e..ec0a998 100644
--- a/mia/3d/transform/affine.cc
+++ b/mia/3d/transform/affine.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/transform/affine.hh b/mia/3d/transform/affine.hh
index f9e0b84..efa937b 100644
--- a/mia/3d/transform/affine.hh
+++ b/mia/3d/transform/affine.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/transform/axisrot.cc b/mia/3d/transform/axisrot.cc
index 870c773..93944c1 100644
--- a/mia/3d/transform/axisrot.cc
+++ b/mia/3d/transform/axisrot.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2013 Gert Wollny
+ * 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
diff --git a/mia/3d/transform/axisrot.hh b/mia/3d/transform/axisrot.hh
index c5dd4c5..9da63c9 100644
--- a/mia/3d/transform/axisrot.hh
+++ b/mia/3d/transform/axisrot.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2013 Gert Wollny
+ * 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
diff --git a/mia/3d/transform/raffine.cc b/mia/3d/transform/raffine.cc
index 6845efe..d3240ee 100644
--- a/mia/3d/transform/raffine.cc
+++ b/mia/3d/transform/raffine.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2013 Gert Wollny
+ * 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
diff --git a/mia/3d/transform/raffine.hh b/mia/3d/transform/raffine.hh
index 8886e65..82920b8 100644
--- a/mia/3d/transform/raffine.hh
+++ b/mia/3d/transform/raffine.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2013 Gert Wollny
+ * 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
diff --git a/mia/3d/transform/rigid.cc b/mia/3d/transform/rigid.cc
index f2d9d01..a48d2a2 100644
--- a/mia/3d/transform/rigid.cc
+++ b/mia/3d/transform/rigid.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/transform/rigid.hh b/mia/3d/transform/rigid.hh
index f9b690e..be8dce8 100644
--- a/mia/3d/transform/rigid.hh
+++ b/mia/3d/transform/rigid.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/transform/rotation.cc b/mia/3d/transform/rotation.cc
index 291c23f..55d230d 100644
--- a/mia/3d/transform/rotation.cc
+++ b/mia/3d/transform/rotation.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/transform/rotation.hh b/mia/3d/transform/rotation.hh
index 08cde6c..fc73ac7 100644
--- a/mia/3d/transform/rotation.hh
+++ b/mia/3d/transform/rotation.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/transform/rotbend.cc b/mia/3d/transform/rotbend.cc
index aad4644..dc3abe4 100644
--- a/mia/3d/transform/rotbend.cc
+++ b/mia/3d/transform/rotbend.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2013 Gert Wollny
+ * 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
@@ -180,7 +180,7 @@ float C3DRotBendTransformation::get_jacobian(const C3DFVectorfield& /*v*/, float
 	DEBUG_ASSERT_RELEASE_THROW(false, "C3DRotBendTransformation doesn't implement a jacobian."); 
 }
 
-void C3DRotBendTransformation::translate(const C3DFVectorfield& gradient, CDoubleVector& params) const
+void C3DRotBendTransformation::translate(const C3DFVectorfield& MIA_PARAM_UNUSED(gradient), CDoubleVector& MIA_PARAM_UNUSED(params)) const
 {
 	
 	assert(0 && !"not yet implemented"); 
@@ -281,10 +281,10 @@ P3DTransformation C3DRotBendTransformCreator::do_create(const C3DBounds& size,
 
 C3DRotBendTransformCreatorPlugin::C3DRotBendTransformCreatorPlugin():
 C3DTransformCreatorPlugin("rotbend"), 
-	m_norot(0)
+	m_norot(false)
 {
 	add_parameter("origin", new C3DFVectorParameter(m_origin, true, "center of the transformation"));
-	add_parameter("norot", new CIntParameter(m_norot, 0, 1, false, "Don't optimize the rotation"));
+	add_parameter("norot", make_param(m_norot, false, "Don't optimize the rotation"));
 }
 
 
diff --git a/mia/3d/transform/rotbend.hh b/mia/3d/transform/rotbend.hh
index 1ac3c72..d46dccf 100644
--- a/mia/3d/transform/rotbend.hh
+++ b/mia/3d/transform/rotbend.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2013 Gert Wollny
+ * 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
@@ -115,7 +115,7 @@ public:
 	const std::string do_get_descr() const;
 private:
 	mia::C3DFVector m_origin; 
-	int m_norot; 
+	bool m_norot; 
 };
 
 
diff --git a/mia/3d/transform/spline.cc b/mia/3d/transform/spline.cc
index 738fda2..9f1de51 100644
--- a/mia/3d/transform/spline.cc
+++ b/mia/3d/transform/spline.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -1086,9 +1086,7 @@ C3DSplineTransformCreatorPlugin::C3DSplineTransformCreatorPlugin():
 	m_debug(false)
 {
 	add_parameter("kernel", make_param(m_kernel, "bspline:d=3", false, "transformation spline kernel"));
-	add_parameter("rate",
-		      new CFloatParameter(m_rate, 1, numeric_limits<float>::max(), false,
-					  "isotropic coefficient rate in pixels"));
+	add_parameter("rate", make_lc_param(m_rate, 1, false, "isotropic coefficient rate in pixels"));
 	add_parameter("anisorate",
 		      new C3DFVectorParameter(m_rate3d, false,"anisotropic coefficient rate in pixels, nonpositive values "
 							 "will be overwritten by the 'rate' value."));
diff --git a/mia/3d/transform/spline.hh b/mia/3d/transform/spline.hh
index f405e13..cc20a3d 100644
--- a/mia/3d/transform/spline.hh
+++ b/mia/3d/transform/spline.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/transform/test_affine.cc b/mia/3d/transform/test_affine.cc
index c865ada..67e7e6c 100644
--- a/mia/3d/transform/test_affine.cc
+++ b/mia/3d/transform/test_affine.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/transform/test_axisrot.cc b/mia/3d/transform/test_axisrot.cc
index 19cf458..76b7992 100644
--- a/mia/3d/transform/test_axisrot.cc
+++ b/mia/3d/transform/test_axisrot.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2013 Gert Wollny
+ * 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
diff --git a/mia/3d/transform/test_nonlinear.cc b/mia/3d/transform/test_nonlinear.cc
index e4293f2..cca9755 100644
--- a/mia/3d/transform/test_nonlinear.cc
+++ b/mia/3d/transform/test_nonlinear.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/transform/test_raffine.cc b/mia/3d/transform/test_raffine.cc
index 1e5438f..8312705 100644
--- a/mia/3d/transform/test_raffine.cc
+++ b/mia/3d/transform/test_raffine.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2013 Gert Wollny
+ * 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
diff --git a/mia/3d/transform/test_rigid.cc b/mia/3d/transform/test_rigid.cc
index 1f57fd1..7103d61 100644
--- a/mia/3d/transform/test_rigid.cc
+++ b/mia/3d/transform/test_rigid.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/transform/test_rotation.cc b/mia/3d/transform/test_rotation.cc
index 27afded..b5a13ed 100644
--- a/mia/3d/transform/test_rotation.cc
+++ b/mia/3d/transform/test_rotation.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/transform/test_rotbend.cc b/mia/3d/transform/test_rotbend.cc
index 45e1c6d..6c318a5 100644
--- a/mia/3d/transform/test_rotbend.cc
+++ b/mia/3d/transform/test_rotbend.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2013 Gert Wollny
+ * 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
diff --git a/mia/3d/transform/test_spline.cc b/mia/3d/transform/test_spline.cc
index 9a27632..fa541af 100644
--- a/mia/3d/transform/test_spline.cc
+++ b/mia/3d/transform/test_spline.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/transform/test_translate.cc b/mia/3d/transform/test_translate.cc
index b9773f3..63980d0 100644
--- a/mia/3d/transform/test_translate.cc
+++ b/mia/3d/transform/test_translate.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/transform/test_vectorfield.cc b/mia/3d/transform/test_vectorfield.cc
index d64ddfb..ac5f304 100644
--- a/mia/3d/transform/test_vectorfield.cc
+++ b/mia/3d/transform/test_vectorfield.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/transform/translate.cc b/mia/3d/transform/translate.cc
index 3e45ffd..04de8f6 100644
--- a/mia/3d/transform/translate.cc
+++ b/mia/3d/transform/translate.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/transform/translate.hh b/mia/3d/transform/translate.hh
index 7617dac..94d6f44 100644
--- a/mia/3d/transform/translate.hh
+++ b/mia/3d/transform/translate.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/transform/vectorfield.cc b/mia/3d/transform/vectorfield.cc
index 59c57c7..9c979fb 100644
--- a/mia/3d/transform/vectorfield.cc
+++ b/mia/3d/transform/vectorfield.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -367,6 +367,7 @@ float C3DGridTransformation::pertuberate(C3DFVectorfield& v) const
 float C3DGridTransformation::get_jacobian(const C3DFVectorfield& v, float delta) const
 {
 	assert(v.get_size() == get_size());
+	assert(0 && "this function needs to be fixed"); 
 	const int dx = v.get_size().x;
 	const int dxy = v.get_size().x * v.get_size().y;
 	
@@ -381,7 +382,7 @@ float C3DGridTransformation::get_jacobian(const C3DFVectorfield& v, float delta)
 				C3DFVector jy((iu[dx] - iu[-dx]) + (delta * (iv[dx] - iv[-dx])));
 				C3DFVector jz((iu[dxy] - iu[-dxy]) + (delta * (iv[dxy] - iv[-dxy])));
 				
-				const float j = (2.0 - jx.x) * (2.0 - jy.y) * (2.0 - jy.z) - jx.y * jy.x * jy.z;
+				const float j = (2.0 - jx.x) * (2.0 - jy.y) * (2.0 - jz.z) - jx.y * jy.x * jy.z;
 				if ( j_min > j) {
 					j_min = j;
 				}
diff --git a/mia/3d/transform/vectorfield.hh b/mia/3d/transform/vectorfield.hh
index d5d624b..1d3d89d 100644
--- a/mia/3d/transform/vectorfield.hh
+++ b/mia/3d/transform/vectorfield.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/transformfactory.cc b/mia/3d/transformfactory.cc
index 0b0e3ce..5c78b6e 100644
--- a/mia/3d/transformfactory.cc
+++ b/mia/3d/transformfactory.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/transformfactory.hh b/mia/3d/transformfactory.hh
index c6f372f..a617ca5 100644
--- a/mia/3d/transformfactory.hh
+++ b/mia/3d/transformfactory.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/transformio.cc b/mia/3d/transformio.cc
index d383acc..309ca9b 100644
--- a/mia/3d/transformio.cc
+++ b/mia/3d/transformio.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -30,8 +30,8 @@ NS_MIA_BEGIN
 
 C3DTransformIOPluginHandlerImpl::C3DTransformIOPluginHandlerImpl()
 {
-	TTranslator<C3DFVector>::register_for(C3DTransformation::input_spacing_attr);
-	TTranslator<C3DFVector>::register_for(C3DTransformation::output_spacing_attr);
+	C3DFVectorTranslator::register_for(C3DTransformation::input_spacing_attr);
+	C3DFVectorTranslator::register_for(C3DTransformation::output_spacing_attr);
 
 }
 
diff --git a/mia/3d/transformio.hh b/mia/3d/transformio.hh
index ddb778a..10dbe53 100644
--- a/mia/3d/transformio.hh
+++ b/mia/3d/transformio.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/transformmock.cc b/mia/3d/transformmock.cc
index cf7f3ec..f2305b1 100644
--- a/mia/3d/transformmock.cc
+++ b/mia/3d/transformmock.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/transformmock.hh b/mia/3d/transformmock.hh
index 858e5f0..8775a2d 100644
--- a/mia/3d/transformmock.hh
+++ b/mia/3d/transformmock.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/transio/CMakeLists.txt b/mia/3d/transio/CMakeLists.txt
index df0e651..56a0390 100644
--- a/mia/3d/transio/CMakeLists.txt
+++ b/mia/3d/transio/CMakeLists.txt
@@ -1,6 +1,6 @@
 #
 # This file is part of MIA - a toolbox for medical image analysis 
-# Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+# 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
diff --git a/mia/3d/transio/bbs.cc b/mia/3d/transio/bbs.cc
index eb8fe82..ff427f5 100644
--- a/mia/3d/transio/bbs.cc
+++ b/mia/3d/transio/bbs.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/transio/serialization.hh b/mia/3d/transio/serialization.hh
index c09b2fe..5ee87c2 100644
--- a/mia/3d/transio/serialization.hh
+++ b/mia/3d/transio/serialization.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/transio/xml.cc b/mia/3d/transio/xml.cc
index c023664..8e9a548 100644
--- a/mia/3d/transio/xml.cc
+++ b/mia/3d/transio/xml.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/valueattributetranslator.hh b/mia/3d/valueattributetranslator.hh
index c43b065..d0c1f88 100644
--- a/mia/3d/valueattributetranslator.hh
+++ b/mia/3d/valueattributetranslator.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/vector.hh b/mia/3d/vector.hh
index 6ce25b7..ab3e8e3 100644
--- a/mia/3d/vector.hh
+++ b/mia/3d/vector.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/vectorfield.cc b/mia/3d/vectorfield.cc
index d7ca642..f082531 100644
--- a/mia/3d/vectorfield.cc
+++ b/mia/3d/vectorfield.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -23,6 +23,7 @@
 
 
 #include <mia/3d/vectorfield.hh>
+
 #include <mia/3d/datafield.cxx>
 #include <mia/2d/datafield.cxx>
 #include <mia/3d/iterator.cxx>
@@ -64,8 +65,8 @@ EXPORT_3D C3DFVectorfield& operator += (C3DFVectorfield& a, const C3DFVectorfiel
 
 #define INSTANCIATE2D(TYPE)						\
 	template class  EXPORT_3D T2DDatafield<TYPE>;			\
-	template class  EXPORT_3D range2d_iterator<T2DDatafield<TYPE>::iterator>; \
-	template class  EXPORT_3D range2d_iterator<T2DDatafield<TYPE>::const_iterator>;
+	template class  range2d_iterator<T2DDatafield<TYPE>::iterator>; \
+	template class  range2d_iterator<T2DDatafield<TYPE>::const_iterator>;
 
 
 INSTANCIATE2D(C3DFVector); 
diff --git a/mia/3d/vectorfield.hh b/mia/3d/vectorfield.hh
index f2b822e..906e76c 100644
--- a/mia/3d/vectorfield.hh
+++ b/mia/3d/vectorfield.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -26,8 +26,6 @@
 
 NS_MIA_BEGIN
 
-extern template class EXPORT_3D T3DDatafield<C3DFVector>;
-extern template class EXPORT_3D T3DDatafield<C3DDVector>;
 
 /**
    @ingroup basic 
@@ -37,9 +35,9 @@ extern template class EXPORT_3D T3DDatafield<C3DDVector>;
 */
 
 template <typename T>
-class T3DVectorfield: public T3DDatafield<T>, public CAttributedData {
+class EXPORT_3D  T3DVectorfield: public T3DDatafield<T>, public CAttributedData {
 public:
-	T3DVectorfield()  = default;
+	T3DVectorfield() {};
 	T3DVectorfield(const T3DVectorfield<T>& org):
 		T3DDatafield<T>(org),
 		CAttributedData(org)
@@ -82,22 +80,28 @@ public:
 	void set_voxel_size(const C3DFVector& voxel){
 		set_attribute("voxel", PAttribute(new CVoxelAttribute(voxel)));
 	}
-
+	
 };
 
 extern template class EXPORT_3D T3DVectorfield<C3DFVector>;
-extern template class EXPORT_3D T3DVectorfield<C3DDVector>;
-extern template class EXPORT_3D range3d_iterator<T3DDatafield<C3DFVector>::iterator>;
-extern template class EXPORT_3D range3d_iterator_with_boundary_flag<T3DDatafield<C3DFVector>::iterator>;
-extern template class EXPORT_3D range3d_iterator<T3DDatafield<C3DFVector>::const_iterator>;
-extern template class EXPORT_3D range3d_iterator_with_boundary_flag<T3DDatafield<C3DFVector>::const_iterator>;
-
-
 /**
    @ingroup basic 
    @brief a 3D field of floating point single accuracy 3D vectors 
 */
-typedef T3DVectorfield<C3DFVector>  C3DFVectorfield;
+class EXPORT_3D C3DFVectorfield : public T3DVectorfield<C3DFVector> {
+public: 
+	static const char *data_descr;
+
+	using T3DVectorfield<C3DFVector>::T3DVectorfield; 
+	
+	void update_as_inverse_of(const C3DFVectorfield& other, float tol, int maxiter);
+
+};
+
+
+extern template class EXPORT_3D T3DVectorfield<C3DDVector>;
+
+
 
 /**
    @ingroup basic 
diff --git a/mia/3d/vfio.cc b/mia/3d/vfio.cc
index b1cb14d..5a6af72 100644
--- a/mia/3d/vfio.cc
+++ b/mia/3d/vfio.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/vfio.hh b/mia/3d/vfio.hh
index de7bfe1..b717b91 100644
--- a/mia/3d/vfio.hh
+++ b/mia/3d/vfio.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/vfiotest.cc b/mia/3d/vfiotest.cc
index 9f3c648..16d9cff 100644
--- a/mia/3d/vfiotest.cc
+++ b/mia/3d/vfiotest.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/vfiotest.hh b/mia/3d/vfiotest.hh
index 4bb3405..8b31c62 100644
--- a/mia/3d/vfiotest.hh
+++ b/mia/3d/vfiotest.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/3d/vfregularizer/test_sor.cc b/mia/3d/vfregularizer/test_sor.cc
new file mode 100644
index 0000000..e23dcc8
--- /dev/null
+++ b/mia/3d/vfregularizer/test_sor.cc
@@ -0,0 +1,109 @@
+/* -*- mia-c++  -*-
+ *
+ * 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 MIA; if not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <mia/3d/vfregularizer/sor.hh>
+
+class Mock3DVectorfieldRegularizerKernel: public C3DVectorfieldRegularizerKernel {
+private: 
+        virtual float do_evaluate_row(unsigned y, unsigned z, CBuffers& buffers); 
+        virtual float do_evaluate_row_sparse(unsigned y, unsigned z, CBuffers& buffers); 
+        virtual unsigned do_get_boundary_padding() const; 
+        float solve_at(C3DFVector *v, const C3DFVector& b); 
+
+}; 
+
+BOOST_AUTO_TEST_CASE(test_sor_solver) 
+{
+	C3DBounds size(5, 6, 7); 
+	C3DBounds rbe = size - C3DBounds::_1;
+	
+	C3DFVectorfield v(size); 
+	C3DFVectorfield b(size); 
+
+
+	auto useful_range = v.get_range(C3DBounds::_1, rbe);
+	
+	
+	while ( irv != erv ) {
+		C3DFVector x(irv.pos());
+		
+		float fz = x.z - 3.5; 
+		fz = 1.0 / (1 + fz * fz); 
+		float fy = fz * cos((x.y - 3.0)/6.0 * M_PI);
+		float fx = x.x - 2.5f;
+
+		*irv = C3DFVector( fy *  1.0 / (1 + fx * fx), 
+				   fy * fy *  1.0 / (1 + fx * fx), 
+				   fz * fy *  2.0 / (1 + fx * fx)); 
+		
+		++irv; 
+	}
+
+	
+	
+	
+	auto iib = b.begin_range(
+	
+	
+	
+}
+
+
+
+float Mock3DVectorfieldRegularizerKernel::do_evaluate_row(unsigned y, unsigned z, 
+                                                          CBuffers& MIA_PARAM_UNUSED(buffers))
+{
+        float residuum = 0.0f; 
+        unsigned linear_index = 1 + y * m_dx + z * m_dxy; 
+        auto& v = get_output_field(); 
+        auto& b = get_input_field(); 
+
+        for (int x = 1; x < m_dx - 1; ++x, ++linear_index) {
+                residuum += solve_at(&v[linear_index], b[linear_index]); 
+        }
+        return residuum; 
+
+}
+
+float Mock3DVectorfieldRegularizerKernel::do_evaluate_row_sparse(unsigned y, unsigned z, 
+                                                                 CBuffers& MIA_PARAM_UNUSED(buffers))
+{
+        
+}
+
+float Mock3DVectorfieldRegularizerKernel::solve_at(C3DFVector *v, const C3DFVector& b)
+{
+        // do a small gaussian patch 
+        
+        C3DFVector s = (6.0f * v[0] + 
+                        v[1] + v[-1] + v[m_dx] + v[-m_dx] 
+                        + v[m_dxy] + v[-m_dxy]) * 1.0f/12.0f; 
+        
+        C3DFVector r = 1.2 * ( b - s); 
+
+        v[0] += r; 
+        
+        return r.norm(); 
+}
+
+unsigned Mock3DVectorfieldRegularizerKernel::do_get_boundary_padding() const
+{
+        return 1; 
+}
diff --git a/mia/CMakeLists.txt b/mia/CMakeLists.txt
index 5a7d79b..066cf34 100644
--- a/mia/CMakeLists.txt
+++ b/mia/CMakeLists.txt
@@ -1,6 +1,6 @@
 #
 # This file is part of MIA - a toolbox for medical image analysis 
-# Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+# 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
diff --git a/mia/core.hh b/mia/core.hh
index 3a10e60..65cc614 100644
--- a/mia/core.hh
+++ b/mia/core.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/CMakeLists.txt b/mia/core/CMakeLists.txt
index 0f947b4..6e754f3 100644
--- a/mia/core/CMakeLists.txt
+++ b/mia/core/CMakeLists.txt
@@ -1,6 +1,6 @@
 #
 # This file is part of MIA - a toolbox for medical image analysis 
-# Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+# 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
@@ -27,6 +27,7 @@ SET(MIACORE_SRC_BASE
   cmdoption.cc
   cmdstringoption.cc
   cmdbooloption.cc
+  cmeans.cc
   creator.cc
   datapool.cc
   distance.cc
@@ -59,6 +60,7 @@ SET(MIACORE_SRC_BASE
   optparam.cc 
   paramoption.cc  
   parameter.cc  
+  paramtranslator.cc  
   pixeltype.cc 
   plugin_base.cc  
   product_base.cc
@@ -68,6 +70,7 @@ SET(MIACORE_SRC_BASE
   regmodel.cc
   revision.cc 
   scaler1d.cc
+  searchpath.cc
   seriesstats.cc 
   selftestcmdoption.cc
   shape.cc 
@@ -83,6 +86,7 @@ SET(MIACORE_SRC_BASE
   utils.cc 
   watch.cc 
   waveletslopeclassifier.cc
+  xmlinterface.cc
   )
 
 SET(MIACORE_HEADER_BASE
@@ -90,13 +94,13 @@ SET(MIACORE_HEADER_BASE
   attribute_names.hh 
   attributetype.hh
   boundary_conditions.hh
-  bfsv23dispatch.hh
   callback.hh
   cmdbooloption.hh
   cmdlineparser.hh
   cmdoption.hh
   cmdoptionflags.hh
   cmdstringoption.hh
+  cmeans.hh
   combiner.hh
   cost.hh
   cost.cxx
@@ -121,6 +125,7 @@ SET(MIACORE_HEADER_BASE
   filetools.hh
   filter.hh
   fixedwidthoutput.hh
+  flags.hh
   flagstring.hh
   fullstats.hh
   handlerbase.hh
@@ -145,6 +150,7 @@ SET(MIACORE_HEADER_BASE
   optparam.hh
   parameter.cxx parameter.hh
   paramoption.hh
+  paramtranslator.hh
   pixeltype.hh
   plugin_base.cxx plugin_base.hh
   probmap.hh
@@ -155,6 +161,7 @@ SET(MIACORE_HEADER_BASE
   regmodel.hh
   scaler1d.hh
   shape.hh shape.cxx
+  searchpath.hh
   seriesstats.hh
   selftestcmdoption.hh
   singular_refobj.hh
@@ -180,6 +187,7 @@ SET(MIACORE_HEADER_BASE
   vector.hh
   watch.hh
   waveletslopeclassifier.hh
+  xmlinterface.hh
   )
 
 SET(MIACORETEST_SRC 
@@ -276,12 +284,13 @@ ENDIF(WIN32)
 #ENDIF (NOT WIN32)
 #CORE_TEST(noisegen)
 
-ADD_SUBDIRECTORY(testplug      )
+ADD_SUBDIRECTORY(cmeansinit    )
 ADD_SUBDIRECTORY(spacialkernel )
 ADD_SUBDIRECTORY(noise         ) 
 ADD_SUBDIRECTORY(minimizer     ) 
 ADD_SUBDIRECTORY(splinekernel  ) 
 ADD_SUBDIRECTORY(splinebc  ) 
+ADD_SUBDIRECTORY(testplug      )
 
 NEW_TEST(Vector miacore)
 NEW_TEST(attributes miacore)
@@ -289,6 +298,7 @@ NEW_TEST(boundary_conditions  miacore)
 NEW_TEST(callback miacore)
 NEW_TEST(cmdoptionflags miacore)
 NEW_TEST(cmdlineparser miacore)
+NEW_TEST(cmeans miacore)
 NEW_TEST(datapool miacore)
 NEW_TEST(delayedparameter miacore)
 NEW_TEST(distance miacore)
@@ -326,6 +336,7 @@ NEW_TEST(tools miacore)
 NEW_TEST(utils miacore)
 #NEW_TEST(watch miacore)
 NEW_TEST(waveletslopeclassifier miacore)
+NEW_TEST(xmlinterface miacore)
 
 IF(ITPP_FOUND)
   NEW_TEST(ica miacore)
diff --git a/mia/core/attribute_names.cc b/mia/core/attribute_names.cc
index db535f8..0a3d8d3 100644
--- a/mia/core/attribute_names.cc
+++ b/mia/core/attribute_names.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/attribute_names.hh b/mia/core/attribute_names.hh
index e35e24a..d7eb623 100644
--- a/mia/core/attribute_names.hh
+++ b/mia/core/attribute_names.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/attributes.cc b/mia/core/attributes.cc
index 35718a2..c22ddcb 100644
--- a/mia/core/attributes.cc
+++ b/mia/core/attributes.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -22,6 +22,8 @@
 #include <mia/core/attributes.hh>
 #include <mia/core/msgstream.hh>
 
+#include <mia/core/attributes.cxx>
+
 NS_MIA_BEGIN
 using namespace std;
 
@@ -268,4 +270,7 @@ template class EXPORT_CORE  TTranslator<std::vector<signed char> >;
 template class EXPORT_CORE  TTranslator<bool>;
 template class EXPORT_CORE  TTranslator<std::vector<bool> >;
 
+
+
+
 NS_MIA_END
diff --git a/mia/core/slopevector.hh b/mia/core/attributes.cxx
similarity index 62%
copy from mia/core/slopevector.hh
copy to mia/core/attributes.cxx
index dd96f7c..3ada79f 100644
--- a/mia/core/slopevector.hh
+++ b/mia/core/attributes.cxx
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -18,19 +18,22 @@
  *
  */
 
-#ifndef mia_core_slopearray_hh
-#define mia_core_slopearray_hh
-
-#include <vector>
-#include <mia/core/defines.hh>
-
 NS_MIA_BEGIN 
 
-/**
-   \ingroup perf
-   \brief class to store the ICA weight matrix 
-*/
-typedef std::vector<std::vector<float> > CSlopeColumns;
-NS_MIA_END
+template <typename T>
+bool TTranslator<T>::register_for(const std::string& key)
+{
+	TTranslator<T> * me = new TTranslator<T>();
+	if (!me->do_register(key)) {
+		delete me; 
+		return false; 
+	}
+	return true; 
+}
 
-#endif
+template <typename T>
+PAttribute TTranslator<T>::do_from_string(const std::string& value) const
+{
+	return PAttribute(new TAttribute<T>(dispatch_attr_string<T>::string2val(value)));
+}
+NS_MIA_END
diff --git a/mia/core/attributes.hh b/mia/core/attributes.hh
index 99480d1..b333881 100644
--- a/mia/core/attributes.hh
+++ b/mia/core/attributes.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -725,23 +725,6 @@ bool TAttribute<T>::do_is_less(const CAttribute& other) const
 }
 
 template <typename T>
-bool TTranslator<T>::register_for(const std::string& key)
-{
-	TTranslator<T> * me = new TTranslator<T>();
-	if (!me->do_register(key)) {
-		delete me; 
-		return false; 
-	}
-	return true; 
-}
-
-template <typename T>
-PAttribute TTranslator<T>::do_from_string(const std::string& value) const
-{
-	return PAttribute(new TAttribute<T>(dispatch_attr_string<T>::string2val(value)));
-}
-
-template <typename T>
 const T CAttributedData::get_attribute_as(const std::string& key)const
 {
 	PAttribute attr = get_attribute(key);
diff --git a/mia/core/attributetype.hh b/mia/core/attributetype.hh
index afb5766..334efb0 100644
--- a/mia/core/attributetype.hh
+++ b/mia/core/attributetype.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/bfsv23dispatch.hh b/mia/core/bfsv23dispatch.hh
deleted file mode 100644
index 153dbc9..0000000
--- a/mia/core/bfsv23dispatch.hh
+++ /dev/null
@@ -1,59 +0,0 @@
-/* -*- mia-c++  -*-
- *
- * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 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 MIA; if not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#ifndef mia_core_bfsv23dispatch_hh
-#define mia_core_bfsv23dispatch_hh
-
-#include <boost/filesystem/path.hpp>
-#include <mia/core/defines.hh>
-
-NS_MIA_BEGIN
-
-inline std::string __bfs_get_filename(const boost::filesystem::path& path) 
-{
-#if BOOST_FILESYSTEM_VERSION==3
-	return path.filename().string(); 
-#else 
-	return path.filename(); 
-#endif
-}
-
-inline std::string __bfs_get_extension(const boost::filesystem::path& path) 
-{
-#if BOOST_FILESYSTEM_VERSION==3
-	return path.extension().string(); 
-#else 
-	return path.extension(); 
-#endif
-}
-
-inline std::string __bfs_get_stem(const boost::filesystem::path& path) 
-{
-#if BOOST_FILESYSTEM_VERSION==3
-	return path.stem().string(); 
-#else 
-	return path.stem(); 
-#endif
-}
-
-
-NS_MIA_END
-
-#endif
diff --git a/mia/core/boundary_conditions.cc b/mia/core/boundary_conditions.cc
index d2e867b..22e006b 100644
--- a/mia/core/boundary_conditions.cc
+++ b/mia/core/boundary_conditions.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/boundary_conditions.hh b/mia/core/boundary_conditions.hh
index a866094..e9c39d5 100644
--- a/mia/core/boundary_conditions.hh
+++ b/mia/core/boundary_conditions.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/callback.cc b/mia/core/callback.cc
index 52eddc9..7f56386 100644
--- a/mia/core/callback.cc
+++ b/mia/core/callback.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/callback.hh b/mia/core/callback.hh
index 76e01e6..cf328ef 100644
--- a/mia/core/callback.hh
+++ b/mia/core/callback.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/cmdbooloption.cc b/mia/core/cmdbooloption.cc
index 2b511ed..20d0349 100644
--- a/mia/core/cmdbooloption.cc
+++ b/mia/core/cmdbooloption.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -45,7 +45,7 @@ void CCmdBoolOption::do_write_value(std::ostream& /*os*/) const
 {
 }									
 
-void CCmdBoolOption::do_get_long_help_xml(std::ostream& os, xmlpp::Element& parent, HandlerHelpMap& /*handler_map*/) const
+void CCmdBoolOption::do_get_long_help_xml(std::ostream& os, CXMLElement& parent, HandlerHelpMap& /*handler_map*/) const
 {
 	do_get_long_help(os);
 	parent.set_attribute("type", __type_descr<bool>::value);
diff --git a/mia/core/cmdbooloption.hh b/mia/core/cmdbooloption.hh
index dc8f89a..b184600 100644
--- a/mia/core/cmdbooloption.hh
+++ b/mia/core/cmdbooloption.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -49,7 +49,7 @@ class EXPORT_CORE CCmdBoolOption : public CCmdOption {
  private: 
 	bool do_set_value(const char *str_value);
 	void do_write_value(std::ostream& os) const;
-	void do_get_long_help_xml(std::ostream& os, xmlpp::Element& parent, HandlerHelpMap& handler_map) const; 
+	void do_get_long_help_xml(std::ostream& os, CXMLElement& parent, HandlerHelpMap& handler_map) const; 
 	const std::string do_get_value_as_string() const; 
 	size_t do_get_needed_args() const;
 
diff --git a/mia/core/cmdlineparser.cc b/mia/core/cmdlineparser.cc
index 452084c..77bc443 100644
--- a/mia/core/cmdlineparser.cc
+++ b/mia/core/cmdlineparser.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -34,7 +34,7 @@
 #endif
 #include <tbb/task_scheduler_init.h>
 
-#include <libxml++/libxml++.h>
+#include <mia/core/xmlinterface.hh>
 #include <mia/core/tools.hh>
 #include <mia/core/msgstream.hh>
 #include <mia/core/cmdstringoption.hh>
@@ -193,7 +193,7 @@ string CCmdOptionListData::set_description_value(EProgramDescriptionEntry entry,
 const char *g_help_optiongroup="Help & Info"; 
 const char *g_default_author = "Gert Wollny"; 
 const char *g_basic_copyright1 = "This software is Copyright (c) "; 
-const char *g_basic_copyright2 = " 1999-2014 Leipzig, Germany and Madrid, Spain. "
+const char *g_basic_copyright2 = " 1999-2015 Leipzig, Germany and Madrid, Spain. "
 	      "It comes with ABSOLUTELY NO WARRANTY and you may redistribute it "
 	      "under the terms of the GNU GENERAL PUBLIC LICENSE Version 3 (or later). "
 	      "For more information run the program with the option '--copyright'.\n"; 
@@ -308,26 +308,25 @@ vector<const char *> CCmdOptionListData::has_unset_required_options() const
 }
 
 
-using xmlpp::Element; 
 void CCmdOptionListData::print_help_xml(const char *name_help, const CPluginHandlerBase *additional_help) const
 {
 	HandlerHelpMap handler_help_map; 
 	if (additional_help) 
 		additional_help->add_dependend_handlers(handler_help_map); 
 		
-	unique_ptr<xmlpp::Document> doc(new xmlpp::Document);
+	unique_ptr<CXMLDocument> doc(new CXMLDocument);
 	
-	Element* nodeRoot = doc->create_root_node("program");
-	Element* program_name = nodeRoot->add_child("name"); 
+	auto nodeRoot = doc->create_root_node("program");
+	auto program_name = nodeRoot->add_child("name"); 
 	program_name->set_child_text(name_help); 
-	Element*  version_string = nodeRoot->add_child("version"); 
+	auto  version_string = nodeRoot->add_child("version"); 
 	version_string->set_child_text(get_revision()); 
-	Element* program_group = nodeRoot->add_child("section"); 
+	auto program_group = nodeRoot->add_child("section"); 
 	program_group->set_child_text(m_program_group); 
-	Element* description = nodeRoot->add_child("description"); 
+	auto description = nodeRoot->add_child("description"); 
 	description->set_child_text(m_general_help); 
-	Element* basic_usage = nodeRoot->add_child("basic_usage"); 
-	Element*  short_descr = nodeRoot->add_child("whatis"); 
+	auto basic_usage = nodeRoot->add_child("basic_usage"); 
+	auto  short_descr = nodeRoot->add_child("whatis"); 
 	short_descr->set_child_text(m_short_descr); 
 
 
@@ -339,7 +338,7 @@ void CCmdOptionListData::print_help_xml(const char *name_help, const CPluginHand
 		if (g->second.empty()) 
 			continue; 
 		
-		Element* group = nodeRoot->add_child("group"); 
+		auto group = nodeRoot->add_child("group"); 
 		group->set_attribute("name", g->first); 
 		
 		for (auto iopt= g->second.begin(); iopt != g->second.end(); ++iopt) {
@@ -351,16 +350,16 @@ void CCmdOptionListData::print_help_xml(const char *name_help, const CPluginHand
 			
 			if (opt.is_required()) {
 				if (opt.get_short_option())
-					usage_text << "-" << opt.get_short_option() << " <" 
-						   << opt.get_long_option() << "> "; 
+					usage_text << "-" << opt.get_short_option() << " <" 
+						   << opt.get_long_option() << "> "; 
 				else
 					usage_text << "--" << opt.get_long_option() 
-						   << " <value> ";
+						   << " <value> ";
 			}
 		}
 	}
 	if (additional_help) {
-		Element* free_parameters = nodeRoot->add_child("freeparams"); 
+		auto free_parameters = nodeRoot->add_child("freeparams"); 
 		free_parameters->set_attribute("name", additional_help->get_descriptor()); 
 		free_parameters->set_attribute("type", "factory"); 
 	}
@@ -371,18 +370,18 @@ void CCmdOptionListData::print_help_xml(const char *name_help, const CPluginHand
 		
 	usage_text << "[options]"; 
 	if (additional_help) 
-		usage_text << " <PLUGINS:" << additional_help->get_descriptor() <<">"; 
+		usage_text << " <PLUGINS:" << additional_help->get_descriptor() <<">"; 
 	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);
 	
-	Element* example = nodeRoot->add_child("Example");
+	auto example = nodeRoot->add_child("Example");
 	example->set_child_text(m_program_example_descr); 
-	Element* example_code = example->add_child("Code"); 
+	auto example_code = example->add_child("Code"); 
 	example_code->set_child_text(m_program_example_code); 
 	
-	Element* cr = nodeRoot->add_child("Author");
+	auto cr = nodeRoot->add_child("Author");
 	cr->set_child_text(m_author); 
 
 	ofstream xmlfile(help_xml.c_str());  
@@ -854,7 +853,7 @@ void CCmdFlagOption::do_write_value(std::ostream& os) const
 
 void CCmdFlagOption::do_get_long_help(std::ostream& os) const
 {
-	os << " supported flags:(" <<m_map.get_flagnames() << os << ")";
+	os << " supported flags:(" <<m_map.get_flagnames() << ")";
 }
 
 const std::string CCmdFlagOption::do_get_value_as_string() const
diff --git a/mia/core/cmdlineparser.hh b/mia/core/cmdlineparser.hh
index acce537..f8a8d87 100644
--- a/mia/core/cmdlineparser.hh
+++ b/mia/core/cmdlineparser.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -117,7 +117,7 @@ public:
                    const char *short_help, CCmdOptionFlags flags = CCmdOptionFlags::none);
 
 private:
-	virtual void do_get_long_help_xml(std::ostream& os, xmlpp::Element& parent, HandlerHelpMap& handler_map) const; 
+	virtual void do_get_long_help_xml(std::ostream& os, CXMLElement& parent, HandlerHelpMap& handler_map) const; 
 	virtual bool do_set_value(const char *str_value);
 	virtual size_t do_get_needed_args() const;
 	virtual void do_write_value(std::ostream& os) const;
@@ -517,7 +517,7 @@ void TCmdOption<T>::do_write_value(std::ostream& os) const
 }
 
 template <typename T>
-void TCmdOption<T>::do_get_long_help_xml(std::ostream& os, xmlpp::Element& parent, 
+void TCmdOption<T>::do_get_long_help_xml(std::ostream& os, CXMLElement& parent, 
 					 HandlerHelpMap& /*handler_map*/) const
 {
 	do_get_long_help(os);
@@ -556,28 +556,27 @@ PCmdOption make_opt(T& value, const char *long_opt, char short_opt,
 
 /**
    \ingroup cmdline
-   \brief Create an option of a scalar value that is expecte to be within a given range 
+   \brief Create an option of a scalar value that can have boundaries 
    
-   If the given value does not fit into the range it will be adjusted accordingly 
+   If the given value does not fit into the range an exception will be thrown 
    \tparam T type of the value to be parsed, supported are float, double, long, int, short, unsigned long, unsigned int, unsigned short. 
-   \tparam Tmin type of the given minmum of the range, a conversion to type T must exist
-   \tparam Tmax type of the given maximum of the range, a conversion to type T must exist
    \param value value variable to hold the parsed option value - pass in the default value -
-   \param min start of the value range the option can be set to 
-   \param max end of the value range the option can be set to 
+   \param bflags boundary flags 
+   \param bounds vector containing the boundaries of the allowed parameter range (depends on bflags) 
    \param short_opt short option name (or 0)
    \param long_opt long option name (must not be NULL)
    \param help long help string (must not be NULL)
    \param flags add flags like whether the optionis required to be set 
    \returns the option warped into a \a boost::shared_ptr
 */
-template <typename T, typename Tmin, typename Tmax>
-PCmdOption make_opt(T& value, Tmin min, Tmax max,  const char *long_opt, char short_opt, 
+template <typename T>
+PCmdOption make_opt(T& value, EParameterBounds bflags, const std::vector<T>& bounds, 
+		    const char *long_opt, char short_opt, 
 		    const char *help, CCmdOptionFlags flags = CCmdOptionFlags::none)
 {
 	bool required = has_flag(flags, CCmdOptionFlags::required); 
 	return PCmdOption(new CParamOption( short_opt, long_opt, 
-					    new TRangeParameter<T>(value, min, max, required, help)));
+					    new TBoundedParameter<T>(value, bflags, bounds, required, help)));
 }
 
 /**
diff --git a/mia/core/cmdoption.cc b/mia/core/cmdoption.cc
index 5ae9bcf..b827de5 100644
--- a/mia/core/cmdoption.cc
+++ b/mia/core/cmdoption.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -77,7 +77,7 @@ void CCmdOption::do_get_long_help(std::ostream& /*os*/) const
 {
 }
 
-string CCmdOption::get_long_help_xml(xmlpp::Element& parent, HandlerHelpMap& handler_map) const
+string CCmdOption::get_long_help_xml(CXMLElement& parent, HandlerHelpMap& handler_map) const
 {
 	cvdebug() << "write XML for '" << m_long_opt << "'\n"; 
 	ostringstream shelp; 
@@ -86,7 +86,7 @@ string CCmdOption::get_long_help_xml(xmlpp::Element& parent, HandlerHelpMap& han
 	return shelp.str(); 
 }
 
-void CCmdOption::do_get_long_help_xml(std::ostream& os, xmlpp::Element& /*parent*/, HandlerHelpMap& /*handler_map*/) const
+void CCmdOption::do_get_long_help_xml(std::ostream& os, CXMLElement& /*parent*/, HandlerHelpMap& /*handler_map*/) const
 {
 	do_get_long_help(os);
 }
@@ -217,7 +217,7 @@ void CCmdOption::do_add_option(CShortoptionMap& sm, CLongoptionMap& lm)
 	}
 }
 
-void CCmdOption::add_option_xml(xmlpp::Element& parent, HandlerHelpMap& handler_map) const
+void CCmdOption::add_option_xml(CXMLElement& parent, HandlerHelpMap& handler_map) const
 {
 	TRACE_FUNCTION;
 	auto option = parent.add_child("option"); 
diff --git a/mia/core/cmdoption.hh b/mia/core/cmdoption.hh
index 93ad177..18711ce 100644
--- a/mia/core/cmdoption.hh
+++ b/mia/core/cmdoption.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -26,7 +26,7 @@
 #include <iostream>
 #include <mia/core/cmdoptionflags.hh>
 #include <mia/core/handlerbase.hh>
-#include <libxml++/libxml++.h>
+#include <mia/core/xmlinterface.hh>
 
 NS_MIA_BEGIN
 
@@ -124,7 +124,7 @@ public:
 	   \returns the text relate to the help 
 	   \remark the text should probably be added to the parent node instead. 
 	 */
-	std::string get_long_help_xml(xmlpp::Element& parent, HandlerHelpMap& handler_map) const; 
+	std::string get_long_help_xml(CXMLElement& parent, HandlerHelpMap& handler_map) const; 
 
 	/** This function must be called after the parameter was set through a string in order to handle 
 	    complex initialization like done for factory based command line parameters 
@@ -137,7 +137,7 @@ public:
 	   \param[in,out] parent the parent xml node to which to add documentation 
 	   \param[in,out] handler_map the map of possibely recoursively called plug-in handlers 
 	*/
-	void add_option_xml(xmlpp::Element& parent, HandlerHelpMap& handler_map) const;
+	void add_option_xml(CXMLElement& parent, HandlerHelpMap& handler_map) const;
 protected:
 
 	/// clear the "required" flag 
@@ -165,7 +165,7 @@ private:
 	virtual const std::string do_get_value_as_string() const;
 	virtual	void do_post_set(); 
 
-	virtual void do_get_long_help_xml(std::ostream& os, xmlpp::Element& parent, HandlerHelpMap& handler_map) const; 
+	virtual void do_get_long_help_xml(std::ostream& os, CXMLElement& parent, HandlerHelpMap& handler_map) const; 
 
 	char m_short_opt; 
 	const char *m_long_opt;
diff --git a/mia/core/cmdoptionflags.hh b/mia/core/cmdoptionflags.hh
index 327a5c9..7d8c771 100644
--- a/mia/core/cmdoptionflags.hh
+++ b/mia/core/cmdoptionflags.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -21,7 +21,7 @@
 #ifndef mia_core_cmdoption_flags_hh
 #define mia_core_cmdoption_flags_hh
 
-#include <mia/core/defines.hh>
+#include <mia/core/flags.hh>
 
 NS_MIA_BEGIN
 
@@ -36,26 +36,8 @@ enum class CCmdOptionFlags : int {
         nonipype = 16
 }; 
 
-inline CCmdOptionFlags operator | (CCmdOptionFlags lhs, CCmdOptionFlags rhs) 
-{
-        return static_cast<CCmdOptionFlags>(  static_cast<int>(lhs) | static_cast<int>(rhs)); 
-}
 
-inline CCmdOptionFlags operator  & (CCmdOptionFlags lhs, CCmdOptionFlags rhs) 
-{
-        return static_cast<CCmdOptionFlags>(  static_cast<int>(lhs) & static_cast<int>(rhs)); 
-}
-
-inline CCmdOptionFlags operator -= (CCmdOptionFlags& lhs, CCmdOptionFlags rhs) 
-{
-        lhs = static_cast<CCmdOptionFlags>(  static_cast<int>(lhs) & ~static_cast<int>(rhs)); 
-        return lhs; 
-}
-
-inline bool has_flag(CCmdOptionFlags flags, CCmdOptionFlags test) 
-{
-	return (flags & test) == test; 
-}
+IMPLEMENT_FLAG_OPERATIONS(CCmdOptionFlags); 
 
 inline std::ostream& operator << (std::ostream& os, CCmdOptionFlags flags) 
 {
@@ -73,6 +55,9 @@ inline std::ostream& operator << (std::ostream& os, CCmdOptionFlags flags)
         return os; 
 }
 
+
+
+
 NS_MIA_END
 
 #endif 
diff --git a/mia/core/cmdstringoption.cc b/mia/core/cmdstringoption.cc
index b112511..b72fc24 100644
--- a/mia/core/cmdstringoption.cc
+++ b/mia/core/cmdstringoption.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -64,7 +64,7 @@ void CCmdStringOption::do_write_value(std::ostream& os) const
 		os << "=" << m_value;
 }
 
-void CCmdStringOption::do_get_long_help_xml(std::ostream& os, xmlpp::Element& parent, HandlerHelpMap& handler_map) const
+void CCmdStringOption::do_get_long_help_xml(std::ostream& os, CXMLElement& parent, HandlerHelpMap& handler_map) const
 {
 	if (m_plugin_hint) {
 		m_plugin_hint->add_dependend_handlers(handler_map); 
diff --git a/mia/core/cmdstringoption.hh b/mia/core/cmdstringoption.hh
index d87112f..2cdb9ab 100644
--- a/mia/core/cmdstringoption.hh
+++ b/mia/core/cmdstringoption.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -53,7 +53,7 @@ class EXPORT_CORE CCmdStringOption : public CCmdOption {
  private: 
 	bool do_set_value(const char *str_value);
 	void do_write_value(std::ostream& os) const;
-	void do_get_long_help_xml(std::ostream& os, xmlpp::Element& parent, HandlerHelpMap& handler_map) const; 
+	void do_get_long_help_xml(std::ostream& os, CXMLElement& parent, HandlerHelpMap& handler_map) const; 
 	void do_get_long_help(std::ostream& os) const; 
 	const std::string do_get_value_as_string() const; 
 
diff --git a/mia/core/cmdtranslateroption.cc b/mia/core/cmdtranslateroption.cc
new file mode 100644
index 0000000..c2a6a02
--- /dev/null
+++ b/mia/core/cmdtranslateroption.cc
@@ -0,0 +1,86 @@
+/* -*- mia-c++  -*-
+ *
+ * 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 MIA; if not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#include <mia/core/cmdtranslatoroption.hh>
+
+NS_MIA_BEGIN
+
+using std::shared_ptr; 
+
+void CValueTranslator::add_translator(CTranslator *t)
+{
+        assert(t); 
+        
+        auto name = t->get_name(); 
+        assert(m_translators.find( name ) != m_translators.end()); 
+        
+        m_translators[name] = shared_ptr<CTranslator>(t); 
+        post_add_translator(*t);
+}
+
+bool CValueTranslator::set_value(const CComplexOptionParser::CParts& options)
+{
+        // select the sub-parameter set 
+        
+        auto backend = m_translators.find( options.first ); 
+        if (backend == m_translators.end()) {
+                throw create_exception<invalid_argument>("CValueTranslator: unknown set translator '", 
+                                                         options.first, "'requested"); 
+        }
+        
+        return do_set_value(*backend.second, options.second);
+}
+
+void CValueTranslator::write_value(std::ostream& os) const
+{
+        do_write_value(os); 
+}
+
+CCmdTranslatorOption::CCmdTranslatorOption(const ValueTranslator & vt, char short_opt, const char *long_opt, 
+                                           const char *long_help):
+        CCmdOption(short_opt, long_opt, long_help, short_help, flags),
+        m_vt(vt)
+{
+}
+
+bool CCmdTranslatorOption::do_set_value(const char *str_value)
+{
+        CComplexOptionParser param_list(str_value);
+        
+        if (param_list.size() < 1) {
+		throw create_exception<std::invalid_argument>( "CCmdTranslatorOption: Description string '"
+		      , str_value , "' can not be interpreted. "); 
+	}
+        if (param_list.size() != 1) {
+                cvwarn() << "The  CCmdTranslatorOption currently only accepts one parameter set, "
+                        "ignoring additional " << param_list.size() << " parameter set(s)\n"; 
+        }
+        
+        m_vt.set_value(param_list[0]);
+}
+
+void CCmdTranslatorOption::do_write_value(std::ostream& os) const
+{
+        m_vt.write_value(os); 
+}
+
+
+NS_MIA_END
diff --git a/mia/core/cmdtranslateroption.hh b/mia/core/cmdtranslateroption.hh
new file mode 100644
index 0000000..562fd10
--- /dev/null
+++ b/mia/core/cmdtranslateroption.hh
@@ -0,0 +1,81 @@
+/* -*- mia-c++  -*-
+ *
+ * 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 MIA; if not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#ifndef mia_core_cmdtranslatoroption_hh
+#define mia_core_cmdtranslatoroption_hh
+
+#include <mia/core/cmdoption.hh>
+#include <mia/core/optionparser.hh>
+
+NS_MIA_BEGIN
+
+
+
+class CParamizedFunctor : public CParamTranslator  {
+public: 
+        CParamizedFunctor(const char *name); 
+
+        class Selector {
+                void add_functor(CParamizedFunctor *t); 
+                
+                void set_value(const char *str_value); 
+                
+                void write_value(std::ostream& os) const;
+                
+                static instance(); 
+	private: 
+		virtual void post_add_translator(CTranslator& t) = 0; 
+                virtual bool do_set_value(const CTranslator& t, const CComplexOptionParser::CParts& options) = 0; 
+                virtual void do_write_value(std::ostream& os) const = 0;
+                
+                std::map<std::string, std::shared_ptr<CTranslator> > m_translators;
+                
+        }
+                
+private: 
+        
+}; 
+
+
+class CTranslatorSelector {
+public: 
+
+        
+
+}; 
+
+class EXPORT_CORE CCmdParametrizedFunktorOption  {
+ public: 
+        CCmdParametrizedFunktorOption(CParamizedFunctor& vt, const char *init, char short_opt, const char *long_opt, 
+                                      const char *long_help, const char *short_help, CCmdOptionFlags flags);
+
+ private: 
+        virtual bool do_set_value(const char *str_value);
+	virtual void do_write_value(std::ostream& os) const;
+
+        ValueTranslator& m_vt;
+};
+
+
+NS_MIA_END
+
+
+#endif 
diff --git a/mia/core/cmeans.cc b/mia/core/cmeans.cc
new file mode 100644
index 0000000..61bf889
--- /dev/null
+++ b/mia/core/cmeans.cc
@@ -0,0 +1,382 @@
+/* -*- mia-c++  -*-
+ *
+ * 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 MIA; if not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#define VSTREAM_DOMAIN "CMEANS"
+
+#include <algorithm>
+#include <mia/core/export_handler.hh>
+
+#include <mia/core/cmeans.hh>
+#include <mia/core/handler.cxx>
+#include <mia/core/plugin_base.cxx>
+
+NS_MIA_BEGIN
+
+
+using namespace std; 
+
+
+struct CMeansImpl {
+
+	CMeansImpl(double k, double epsilon);
+
+	CMeans::SparseProbmap run(const CMeans::NormalizedHistogram& nh, CMeans::DVector& class_centers) const; 
+
+private: 
+	void evaluate_probabilities(const CMeans::DVector& classes, CMeans::SparseProbmap& pv, double k) const; 
+	double update_class_centers(CMeans::DVector& class_center,
+				    const CMeans::NormalizedHistogram& nh, 
+				    const CMeans::SparseProbmap& pv) const; 
+	
+	double adjust_k(const CMeans::DVector& class_center,
+			const CMeans::NormalizedHistogram& nh, 
+			const CMeans::SparseProbmap& pv) const; 
+		
+	
+	double m_k;
+	double m_epsilon;
+}; 
+
+
+CMeansImpl::CMeansImpl(double k, double epsilon):
+	m_k(k), 
+	m_epsilon(epsilon)
+{
+}
+
+const char *CMeans::Initializer::data_descr = "1d";
+const char *CMeans::Initializer::type_descr = "cmeans"; 
+
+
+CMeans::CMeans(double k, double epsilon, PInitializer class_center_initializer):
+	m_cci(class_center_initializer)
+{
+	impl = new CMeansImpl(k, epsilon);
+}
+
+CMeans::~CMeans()
+{
+	delete impl; 
+}
+
+
+CMeans::SparseProbmap CMeans::run(const SparseHistogram& histogram,  DVector& class_centers) const
+{
+	// prepare input data 
+	NormalizedHistogram nhist(histogram.size());
+	
+	const double bin_shift = histogram[0].first;
+	const double bin_scale = 1.0 / double(histogram[histogram.size() - 1].first - bin_shift);
+	const double inv_bin_scale = double(histogram[histogram.size() - 1].first - bin_shift);
+
+	size_t n = 0;
+	for(auto h: histogram)
+		n += h.second;
+
+	double normalizer = 1.0/n; 
+
+	transform(histogram.begin(), histogram.end(), nhist.begin(),
+		  [bin_shift, bin_scale, normalizer](const SparseHistogram::value_type& x) -> NormalizedHistogram::value_type {
+			  return make_pair((x.first - bin_shift) * bin_scale, x.second * normalizer);  
+		  });
+	
+
+	class_centers = m_cci->run(nhist);
+	cvmsg() << "Initial class centers =" << class_centers << "\n"; 
+	SparseProbmap result = impl->run(nhist, class_centers);
+	cvmsg() << "Finale class centers =" << class_centers << "\n"; 
+	
+	transform(result.begin(), result.end(), histogram.begin(), result.begin(),
+		  [](const SparseProbmap::value_type& p, const SparseHistogram::value_type& h) -> SparseProbmap::value_type {
+			  return make_pair(h.first, p.second); 
+		  }); 
+	
+	transform(class_centers.begin(), class_centers.end(), class_centers.begin(),
+		  [inv_bin_scale, bin_shift](double x) {
+			  return inv_bin_scale * x +  bin_shift; 
+		  });
+	
+	return result; 
+}
+
+template<>  const char * const 
+TPluginHandler<TFactory<CMeans::Initializer>>::m_help = 
+	"These plug-ins provide methods to initialize the cmeans classification.";
+
+
+template class TPlugin<CMeans::Initializer, CMeans::Initializer>;
+template class TFactory<CMeans::Initializer>;
+template class TFactoryPluginHandler<CMeansInitializerPlugin>;
+template class EXPORT_CORE TPluginHandler<TFactory<CMeans::Initializer>>;
+template class THandlerSingleton<TFactoryPluginHandler<CMeansInitializerPlugin>>;
+
+void CMeansImpl::evaluate_probabilities(const CMeans::DVector& classes, CMeans::SparseProbmap& pv, double k) const
+{
+        for (auto p = pv.begin(); p != pv.end(); ++p) {
+                double x = p->first;
+                double sum = 0.0;
+
+                for (size_t j = 0; j < classes.size(); ++j) {
+                        double  val =  x - classes[j]; 
+                        val = exp(- (val * val) / k);
+                        p->second[j] = val; 
+			sum += val;
+                }
+                
+                assert(sum != 0.0);
+                for (size_t j = 0; j < classes.size(); ++j)
+			p->second[j] /= sum;
+
+		cvdebug() << "Probs " << x << ":" << p->second << "\n"; 
+        }
+}
+
+double CMeansImpl::update_class_centers(CMeans::DVector& class_center,
+				     const CMeans::NormalizedHistogram& nh, 
+				     const CMeans::SparseProbmap& pv)const
+{
+	double residuum = 0.0; 
+
+	for (size_t i = 0; i < class_center.size(); ++i) {
+		float cc = class_center[i]; 
+		double sum_prob = 0.0; 
+		double sum_weight = 0.0; 
+			
+		
+		for (unsigned  k = 0; k < nh.size(); ++k) {
+			auto prob = pv[k].second[i]; 
+			if ( prob > 0.0) {
+				auto v = prob * nh[k].second;
+				sum_prob += v; 
+				sum_weight += v * pv[k].first;
+			}
+		}
+		
+		if (sum_prob  != 0.0) // move slowly in the direction of new center
+			cc = sum_weight / sum_prob; 
+		else {
+			cvwarn() << "class[" << i << "] has no probable members, keeping old value:" << 
+				sum_prob << ":" <<sum_weight <<"\n"; 
+			
+		}
+		double delta = cc - class_center[i]; 
+		residuum += delta * delta; 
+		class_center[i] =  cc; 
+		
+	}// end update class centers
+	return sqrt(residuum); 
+}
+
+double CMeansImpl::adjust_k(const CMeans::DVector& class_center,
+			     const CMeans::NormalizedHistogram& nh, 
+			     const CMeans::SparseProbmap& pv)const
+{
+	cvwarn() << "CMeans: auto 'k' not implemented\n"; 
+	return m_k; 
+}
+
+
+CMeans::SparseProbmap CMeansImpl::run(const CMeans::NormalizedHistogram& nh, CMeans::DVector& class_centers) const
+{
+	int csize = class_centers.size(); 
+	CMeans::SparseProbmap pv(nh.size()); 
+
+	transform(nh.begin(), nh.end(), pv.begin(), [csize](const CMeans::NormalizedHistogram::value_type& x) {
+			return make_pair(x.first, CMeans::DVector(csize));
+		}); 
+        
+	double k = m_k; 
+	bool cont = true;
+
+	// for now no k adjustment
+	const bool auto_k = false; 
+	
+	while (cont) {
+		evaluate_probabilities(class_centers, pv, k);
+		double residuum = update_class_centers(class_centers, nh, pv);
+		if (auto_k) {
+			k = adjust_k(class_centers, nh, pv); 
+		}
+		cvmsg() << "Class centers: " << class_centers
+			<<  ", res=" << residuum
+			<<  ", k=" << k 
+			<< "\n";
+		cont = residuum > m_epsilon; 
+	};
+	return pv; 
+}
+
+
+// the class that has only the size as a paramater
+CMeansInitializerSizedPlugin::CMeansInitializerSizedPlugin(const char *name):
+        CMeansInitializerPlugin(name)
+{
+        add_parameter("nc", make_lo_param(m_size, 2, true, "Number of classes to use for the fuzzy-cmeans classification")); 
+}
+
+size_t CMeansInitializerSizedPlugin::get_size_param() const
+{
+        return m_size; 
+}
+
+
+static const string map_signature("#sparse-probability-map");
+
+
+CMeans::SparseProbmap::SparseProbmap(size_t size):m_map(size)
+{
+	if (!size)  {
+		throw invalid_argument("CMeans::SparseProbmap must have at least one element"); 
+	}
+}
+
+
+bool CMeans::SparseProbmap::save(const std::string& filename) const
+{
+	ostream* os = &std::cout; 
+
+	unique_ptr<ofstream> ofs;
+		
+	if (filename != "-" ) {
+		ofs.reset(new ofstream(filename)); 
+		if (!ofs->good()) {
+			throw create_exception<runtime_error>("CMeans::SparseProbmap::save:",
+							      "Unable to open file ", filename,
+							      " for saving\n");   
+		}
+		os = ofs.get(); 
+	}
+	
+	*os << map_signature <<"\n";
+	*os << m_map.size() << " " << m_map[0].second.size() << '\n';
+
+	for (size_t i = 0; i < m_map.size(); ++i) {
+		auto & row = m_map[i];
+		*os << row.first << " : "; 
+		
+		for
+			(auto d: row.second) {
+			*os << d << " ";
+		}
+		*os <<'\n';
+	}
+	return os->good();
+
+}
+
+CMeans::SparseProbmap::SparseProbmap(const std::string& filename)
+{
+	istream* is = &std::cin; 
+
+	unique_ptr<ifstream> ifs;
+		
+	if (filename != "-" ) {
+		ifs.reset(new ifstream(filename)); 
+		if (!ifs->good()) {
+			throw create_exception<runtime_error>("CMeans::SparseProbmap::load:",
+							      "Unable to open file ", filename,
+							      " for reading\n");   
+		}
+		is = ifs.get(); 
+	}
+	
+	string buf;
+	*is >> buf;
+	size_t hsize, nclasses;
+
+	if (buf != map_signature) {
+		throw create_exception<runtime_error>("CMeans::SparseProbmap::load: Input file '",
+						      filename, "'is not a sparse probability map: signature:'",
+						      buf, "'");
+	}
+
+	*is  >> hsize >> nclasses;
+
+	if (!is->good())
+		throw create_exception<runtime_error>("CMeans::SparseProbmap::load: error reading from input file '",
+						      filename, "'");
+
+	m_map.resize(hsize);
+
+	char c; 
+	for(auto& r: m_map) {
+		*is >> r.first >> c;
+		r.second.resize(nclasses); 
+		for(auto& prob: r.second) {
+			*is >> prob; 
+		}
+	}
+
+	if (!is->good())
+		throw create_exception<runtime_error>("CMeans::SparseProbmap::load: error reading from input file '",
+						      filename, "'");
+}
+
+CMeans::DVector CMeans::SparseProbmap::get_fuzzy(double x) const
+{
+	if (x <= m_map[0].first)
+		return m_map[0].second;
+	if (x >= m_map[m_map.size() - 1].first)
+		return m_map[m_map.size() - 1].second; 
+	
+	int idx = m_map.size() / 2;
+	int next_step = idx / 4; 
+	
+	while (next_step > 0 ) {
+		if (m_map[idx].first == x)
+			return m_map[idx].second;  
+		
+		if ( x < m_map[idx].first) {
+			idx -= next_step;
+		}else{
+			idx += next_step;
+		}
+
+		next_step /= 2; 
+	}
+	
+	if (m_map[idx].first == x)
+		return m_map[idx].second;  
+	
+	if ( x < m_map[idx].first) {
+		--idx;
+	}
+
+	double base = m_map[idx].first; 
+	double delta = m_map[idx+1].first - base;
+
+	double f = (x - base) / delta;
+
+	CMeans::DVector result( m_map[idx].second.size());
+
+	transform(m_map[idx].second.begin(), m_map[idx].second.end(),
+		  m_map[idx+1].second.begin(), result.begin(), 
+		  [f](double l, double h) {
+			  return f * (h-l) + l;
+		  });
+	
+	return result; 
+		
+}
+
+		
+
+
+NS_MIA_END
diff --git a/mia/core/cmeans.hh b/mia/core/cmeans.hh
new file mode 100644
index 0000000..0b2ebac
--- /dev/null
+++ b/mia/core/cmeans.hh
@@ -0,0 +1,137 @@
+/* -*- mia-c++  -*-
+ *
+ * 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 MIA; if not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#include <mia/core/probmap.hh>
+#include <mia/core/factory.hh>
+
+NS_MIA_BEGIN
+
+
+
+class EXPORT_CORE CMeans {
+public:
+	typedef std::vector<double> DVector;
+	typedef std::vector<std::pair<int, unsigned long>> SparseHistogram;
+	typedef std::vector<std::pair<double, double>> NormalizedHistogram;
+
+	class EXPORT_CORE SparseProbmap { 
+	public: 
+		typedef std::pair<double, DVector> value_type;  
+		typedef std::vector<std::pair<double, DVector>> Map;
+
+		SparseProbmap() = delete; 
+		SparseProbmap (size_t size);
+		SparseProbmap (const std::string& filename); 
+		
+		value_type& operator [](int i){
+			return m_map[i]; 
+		}
+
+		const value_type& operator [](int i) const{
+			return m_map[i]; 
+		}
+
+		Map::const_iterator begin() const {
+			return m_map.begin(); 
+		}
+		Map::iterator begin() {
+			return m_map.begin(); 
+		}
+
+		Map::const_iterator end() const {
+			return m_map.end(); 
+		}
+		Map::iterator end() {
+			return m_map.end(); 
+		}
+		
+		bool save(const std::string& filename) const;
+
+	   
+		DVector get_fuzzy(double x) const; 
+
+		size_t size() const {
+			return m_map.size(); 
+		}
+	private: 
+		Map m_map; 
+
+	}; 
+        
+
+	class EXPORT_CORE Initializer : public CProductBase {
+	public:
+		typedef Initializer plugin_data;
+		typedef Initializer plugin_type;
+		static const char *data_descr;
+		static const char *type_descr;
+		virtual DVector run(const NormalizedHistogram& nh) const = 0; 
+	}; 
+	typedef std::shared_ptr<Initializer> PInitializer; 
+	
+	CMeans(double k, double epsilon, PInitializer class_center_initializer);
+
+	~CMeans();
+	
+	SparseProbmap run(const SparseHistogram& histogram,  DVector& class_centers) const;
+	
+private:
+	PInitializer m_cci; 
+	struct CMeansImpl *impl;
+	
+};
+
+
+
+typedef TFactory<CMeans::Initializer> CMeansInitializerPlugin;
+
+// the class that has only the size as a paramater
+class EXPORT_CORE CMeansInitializerSizedPlugin : public CMeansInitializerPlugin {
+public: 
+        CMeansInitializerSizedPlugin(const char *name);
+protected:
+        size_t get_size_param() const; 
+private:
+        size_t m_size; 
+       
+}; 
+
+extern template class EXPORT_CORE TPlugin<CMeans::Initializer, CMeans::Initializer>; 
+extern template class EXPORT_CORE TFactory<CMeans::Initializer>;
+
+template <>  const char * const TPluginHandler<TFactory<CMeans::Initializer>>::m_help;
+
+extern template class EXPORT_CORE TFactoryPluginHandler<TFactory<CMeans::Initializer>>;
+
+extern template class EXPORT_CORE THandlerSingleton<TFactoryPluginHandler<TFactory<CMeans::Initializer>> >;
+
+
+
+
+typedef THandlerSingleton<TFactoryPluginHandler<CMeansInitializerPlugin> >CMeansInitializerPluginHandler;
+
+/// @cond NEVER
+FACTORY_TRAIT(CMeansInitializerPluginHandler); 
+/// @endcond
+
+
+NS_MIA_END
+
diff --git a/mia/core/splinebc/CMakeLists.txt b/mia/core/cmeansinit/CMakeLists.txt
similarity index 81%
copy from mia/core/splinebc/CMakeLists.txt
copy to mia/core/cmeansinit/CMakeLists.txt
index 1778fbc..69bd09f 100644
--- a/mia/core/splinebc/CMakeLists.txt
+++ b/mia/core/cmeansinit/CMakeLists.txt
@@ -1,6 +1,6 @@
 #
 # This file is part of MIA - a toolbox for medical image analysis 
-# Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+# 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
@@ -16,6 +16,6 @@
 # along with this program; if not, see <http://www.gnu.org/licenses/>.
 #
 
-SET(NAMES bc) 
+SET(NAMES kmeans static) 
 
-PLUGINGROUP_WITH_TEST_AND_PREFIX2("1d" "splinebc" "${NAMES}" "${MIACORE}")
+PLUGINGROUP_WITH_TEST_AND_PREFIX2( "1d" "cmeans" "${NAMES}" "${MIACORE}")
diff --git a/mia/core/cmeansinit/kmeans.cc b/mia/core/cmeansinit/kmeans.cc
new file mode 100644
index 0000000..e913a9d
--- /dev/null
+++ b/mia/core/cmeansinit/kmeans.cc
@@ -0,0 +1,176 @@
+/* -*- mia-c++  -*-
+ *
+ * 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 MIA; if not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#include <mia/core/cmeansinit/kmeans.hh>
+
+#include <iomanip>
+
+NS_MIA_BEGIN
+
+CKMeansInitializer::CKMeansInitializer(size_t nclasses):m_nclasses(nclasses)
+{
+}
+
+bool kmeans_step(const CMeans::NormalizedHistogram& nh, std::vector<int>& classification,
+		 CMeans::DVector& classes, size_t l, int& biggest_class )
+{
+	cvdebug()<<  "kmeans enter: ";
+	for (size_t i = 0; i <= l; ++i )
+		cverb << std::setw(8) << classes[i]<< " ";  
+	cverb << "\n"; 
+	
+	biggest_class = -1; 
+	const double convLimit = 0.005;	// currently fixed
+	
+	std::vector<double> sums(classes.size()); 
+	std::vector<double> count(classes.size()); 
+	
+	bool conv = false;
+	int iter = 50; 
+	
+	while( iter-- && !conv) {
+
+		sort(classes.begin(), classes.end()); 
+		
+		// assign closest cluster center
+		auto ob = classification.begin(); 
+		for (auto b = nh.begin(); b != nh.end(); ++b, ++ob) {
+			const double val = b->first;
+			double dmin = std::numeric_limits<double>::max();
+			int c = 0;
+			for (size_t i = 0; i <= l; i++) {
+				double d = fabs (val - classes[i]);
+				if (d < dmin) {
+					dmin = d;
+					c = i;
+				};
+			};
+			*ob = c; 
+			
+			count[c] += b->second;
+			sums[c] += val * b->second;
+		};
+
+		
+		// recompute cluster centers
+		conv = true;
+		double max_count = 0; 
+		for (size_t i = 0; i <= l; i++) {
+			if (count[i]) {
+				double a = sums[i] / count[i];
+				if (a  && fabs ((a - classes[i]) / a) > convLimit)
+					conv = false;
+				classes[i] = a;
+				
+				if (max_count < count[i]) {
+					max_count  = count[i]; 
+					biggest_class = i; 
+				}
+			} else { // if a class is empty move it closer to neighbour 
+				if (i == 0)
+					classes[i] = (classes[i] + classes[i + 1]) / 2.0; 
+				else
+					classes[i] = (classes[i] + classes[i - 1]) / 2.0; 
+				conv = false;
+			}
+			sums[i] = 0;
+			count[i] = 0;
+		};
+	};
+
+	cvinfo()<<  "kmeans: " << l + 1 << " classes " << 50 - iter << "  iterations";
+	for (size_t i = 0; i <= l; ++i )
+		cverb << std::setw(8) << classes[i]<< " ";  
+	cverb << "\n"; 
+	
+	return conv; 
+
+}
+	
+
+CMeans::DVector CKMeansInitializer::run(const CMeans::NormalizedHistogram& nh) const
+{
+	if (m_nclasses < 2)
+		throw create_exception<std::invalid_argument>("cmeans: requested ", m_nclasses, 
+						    "class(es), required are at least two");
+	
+	if ( nh.size() < m_nclasses ) 
+		throw create_exception<std::invalid_argument>("kmeans: insufficient input: want ", m_nclasses , 
+						    " classes, but git only ",  nh.size(), " distinct input values"); 
+
+	CMeans::DVector classes(m_nclasses);
+
+	std::vector<int> classification(nh.size(), 0);
+	
+	double sum = 0.0;
+	for(auto h : nh) {
+		sum += h.first * h.second; 
+	}; 
+
+	
+	// simple initialization splitting at the mean 
+	classes[0] = sum / 1.99;  
+	classes[1] = sum / 2.01; 
+	
+	// first run calles directly 
+	int biggest_class = 0; 
+	kmeans_step(nh, classification, classes, 1, biggest_class);
+	
+	// further clustering always splits biggest class 
+	for (size_t  l = 2; l < m_nclasses; l++) {
+		const size_t pos = biggest_class > 0 ? biggest_class - 1 : biggest_class + 1; 
+		classes[l] = 0.5 * (classes[biggest_class] + classes[pos]);
+		kmeans_step(nh, classification, classes, l, biggest_class); 
+	};		
+	
+	// some post iteration until centers no longer change 
+	for (size_t  l = 1; l < 3; l++) {
+		if (kmeans_step(nh, classification, classes, m_nclasses - 1, biggest_class)) 
+			break; 
+	}
+	return classes; 
+        
+}
+
+CKMeansInitializerPlugin::CKMeansInitializerPlugin():
+	CMeansInitializerSizedPlugin("kmeans")
+{
+}
+
+
+CMeansInitializerPlugin::Product * CKMeansInitializerPlugin::do_create() const
+{
+        return new CKMeansInitializer(get_size_param());
+}
+
+const std::string CKMeansInitializerPlugin::do_get_descr() const
+{
+        return "C-Means initializer that sets the initial class centers by using a k-means classification";
+}
+
+extern "C" EXPORT CPluginBase  *get_plugin_interface()
+{
+
+	return new CKMeansInitializerPlugin(); 
+}
+
+
+NS_MIA_END
diff --git a/mia/3d/imagecollect.hh b/mia/core/cmeansinit/kmeans.hh
similarity index 58%
copy from mia/3d/imagecollect.hh
copy to mia/core/cmeansinit/kmeans.hh
index 2f7f978..515bbcd 100644
--- a/mia/3d/imagecollect.hh
+++ b/mia/core/cmeansinit/kmeans.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -18,30 +18,29 @@
  *
  */
 
-#ifndef mia_3d_imagecollect_hh
-#define mia_3d_imagecollect_hh
 
-#include <mia/3d/image.hh>
-#include <mia/core/filter.hh>
+#include <mia/core/cmeans.hh>
+
 
 NS_MIA_BEGIN
 
-class  EXPORT_3D C3DImageCollector : public TFilter<void> {
+class CKMeansInitializer : public CMeans::Initializer {
+public: 
+        CKMeansInitializer(size_t nclasses);
+        
+        CMeans::DVector run(const CMeans::NormalizedHistogram& nh) const;
+private: 
+        size_t m_nclasses; 
+        
+}; 
+
+class CKMeansInitializerPlugin : public CMeansInitializerSizedPlugin {
 public: 
-	C3DImageCollector(size_t slices); 
-	
-	template <typename T>
-	void operator ()(const T2DImage<T>& image); 
-
-	void add(const C2DImage &image); 
-	
-	P3DImage get_result()const; 
+        CKMeansInitializerPlugin();
 private:
-	size_t m_slices;
-	size_t m_cur_slice;
-	P3DImage m_image;
-};
+        CMeansInitializerPlugin::Product * do_create() const;
+        virtual const std::string do_get_descr() const;
+}; 
 
-NS_MIA_END
 
-#endif
+NS_MIA_END
diff --git a/mia/core/cmeansinit/static.cc b/mia/core/cmeansinit/static.cc
new file mode 100644
index 0000000..0a95903
--- /dev/null
+++ b/mia/core/cmeansinit/static.cc
@@ -0,0 +1,99 @@
+/* -*- mia-c++  -*-
+ *
+ * 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 MIA; if not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#include <mia/core/cmeansinit/static.hh>
+#include <mia/core/parameter.cxx>
+
+
+NS_MIA_BEGIN
+
+CEqualInitializer::CEqualInitializer(size_t nclasses):m_nclasses(nclasses)
+{
+}
+
+CMeans::DVector CEqualInitializer::run(const CMeans::NormalizedHistogram& nh) const
+{
+        CMeans::DVector result(m_nclasses);
+
+        for (unsigned i = 0; i < m_nclasses; ++i)
+                result[i] = static_cast<double>(i) / ( m_nclasses - 1); 
+        
+        return result; 
+}
+
+CPredefinedInitializer::CPredefinedInitializer(const CMeans::DVector& init):m_init(init)
+{
+        // should check that this is in normalized range ? 
+}
+
+CMeans::DVector CPredefinedInitializer::run(const CMeans::NormalizedHistogram& nh) const
+{
+        
+        
+        return m_init; 
+}
+
+
+CPredefinedInitializerPlugin::CPredefinedInitializerPlugin():
+        CMeansInitializerPlugin("predefined")
+        
+{
+        add_parameter("cc", make_param(m_init, true,
+                                          "Initial class centers fuzzy-cmeans classification (normalized to range [0,1])")); 
+}
+
+CMeansInitializerPlugin::Product * CPredefinedInitializerPlugin::do_create() const
+{
+        return new CPredefinedInitializer(m_init); 
+}
+
+const std::string CPredefinedInitializerPlugin::do_get_descr() const
+{
+        return "C-Means initializer that sets pre-defined values for the initial class centers"; 
+}
+
+
+CEqualInitializerPlugin::CEqualInitializerPlugin():
+        CMeansInitializerSizedPlugin("even")
+{
+}
+
+
+CMeansInitializerPlugin::Product * CEqualInitializerPlugin::do_create() const
+{
+        return new CEqualInitializer(get_size_param());
+}
+
+const std::string CEqualInitializerPlugin::do_get_descr() const
+{
+        return "C-Means initializer that sets the initial class centers as evenly distributed over [0,1]"; 
+}
+
+
+extern "C" EXPORT CPluginBase  *get_plugin_interface()
+{
+	auto retval = new CEqualInitializerPlugin();
+	retval->append_interface(new CPredefinedInitializerPlugin());
+	return retval; 
+}
+
+
+NS_MIA_END
diff --git a/mia/core/cmeansinit/static.hh b/mia/core/cmeansinit/static.hh
new file mode 100644
index 0000000..c1e2161
--- /dev/null
+++ b/mia/core/cmeansinit/static.hh
@@ -0,0 +1,70 @@
+/* -*- mia-c++  -*-
+ *
+ * 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 MIA; if not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#include <mia/core/cmeans.hh>
+
+
+NS_MIA_BEGIN
+
+class CEqualInitializer : public CMeans::Initializer {
+public:
+        CEqualInitializer(size_t nclasses);
+
+        CMeans::DVector run(const CMeans::NormalizedHistogram& nh) const; 
+        
+private:
+
+        size_t m_nclasses; 
+        
+}; 
+
+
+class CPredefinedInitializer : public CMeans::Initializer {
+public: 
+
+	CPredefinedInitializer(const CMeans::DVector& init); 
+	CMeans::DVector run(const CMeans::NormalizedHistogram& nh) const;
+private:
+	CMeans::DVector m_init; 
+}; 
+
+
+
+
+class CPredefinedInitializerPlugin : public CMeansInitializerPlugin {
+public: 
+        CPredefinedInitializerPlugin();
+private:
+        CMeansInitializerPlugin::Product * do_create() const;
+        virtual const std::string do_get_descr() const;
+        CMeans::DVector m_init; 
+}; 
+
+class CEqualInitializerPlugin : public CMeansInitializerSizedPlugin {
+public: 
+        CEqualInitializerPlugin();
+private:
+        CMeansInitializerPlugin::Product * do_create() const;
+        virtual const std::string do_get_descr() const;
+}; 
+
+
+NS_MIA_END
diff --git a/mia/core/cmeansinit/test_kmeans.cc b/mia/core/cmeansinit/test_kmeans.cc
new file mode 100644
index 0000000..c9bdd42
--- /dev/null
+++ b/mia/core/cmeansinit/test_kmeans.cc
@@ -0,0 +1,88 @@
+/* -*- mia-c++  -*-
+ *
+ * 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 MIA; if not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <mia/internal/plugintester.hh>
+#include <mia/core/cmeansinit/kmeans.hh>
+
+NS_MIA_USE
+
+using std::vector; 
+
+BOOST_AUTO_TEST_CASE (test_kmeans_simple)
+{
+	const vector<double> input_data = {0.1,  0.4,  0.8}; 
+
+	CMeans::NormalizedHistogram in_h(3);
+
+	for (auto i = 0; i < 3; ++i) {
+		in_h[i].first = input_data[i];
+		in_h[i].second = 1.0 / 3.0;
+	}
+
+	auto initializer = BOOST_TEST_create_from_plugin<CKMeansInitializerPlugin>("kmeans:nc=3");
+
+	auto classes = initializer->run(in_h);
+
+	BOOST_CHECK_EQUAL(classes.size(), 3u);
+	
+	BOOST_CHECK_CLOSE(classes[0], 0.1f, 0.1);
+	BOOST_CHECK_CLOSE(classes[1], 0.4f, 0.1);
+	BOOST_CHECK_CLOSE(classes[2], 0.8f, 0.1);
+	
+}
+
+
+BOOST_AUTO_TEST_CASE (test_kmeans)
+{
+	const vector<double> input_bins = {1.0, 3.0, 2.0, 10.4, 2.4,
+					   11.0, 11.1, 25.1, 25.2, 28.0,
+					   29.7, 12.2, 29.9,
+					   2.1, 27.1,  2.5,  3.1
+	};
+
+	const vector<double> input_count = {2, 1, 1, 1, 1,
+					    1, 2, 1, 1, 2,
+					    1, 1, 1, 1, 1, 1, 1}; 
+	
+
+	
+	CMeans::NormalizedHistogram in_h(17);
+
+	for (auto i = 0; i < 17; ++i) {
+		in_h[i].first = input_bins[i];
+		in_h[i].second = input_count[i] / 20.0;
+	}
+	
+	auto initializer = BOOST_TEST_create_from_plugin<CKMeansInitializerPlugin>("kmeans:nc=3");
+	
+	auto classes = initializer->run(in_h);
+
+	BOOST_CHECK_EQUAL(classes.size(), 3u);
+
+	BOOST_CHECK_CLOSE(classes[0], (1.0 + 3.0 + 2.0 + 1.0 + 2.4 + 2.1 + 2.5 + 3.1) / 8.0, 0.1);
+	BOOST_CHECK_CLOSE(classes[1], (10.4 + 11.0 + 11.1 + 11.1 + 12.2) / 5.0, 0.1);
+	BOOST_CHECK_CLOSE(classes[2], (25.1 + 25.2 + 28.0 + 29.7 + 28.0 + 29.9 + 27.1) / 7.0, 0.1);
+
+
+}
+
+
+
+
diff --git a/mia/core/cmeansinit/test_static.cc b/mia/core/cmeansinit/test_static.cc
new file mode 100644
index 0000000..a2de711
--- /dev/null
+++ b/mia/core/cmeansinit/test_static.cc
@@ -0,0 +1,60 @@
+/* -*- mia-c++  -*-
+ *
+ * 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 MIA; if not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <mia/internal/plugintester.hh>
+#include <mia/core/cmeansinit/static.hh>
+
+NS_MIA_USE
+
+BOOST_AUTO_TEST_CASE (test_even)
+{
+	
+	auto initializer = BOOST_TEST_create_from_plugin<CEqualInitializerPlugin>("even:nc=3");
+
+	CMeans::NormalizedHistogram nh;
+
+	auto classes = initializer->run(nh);
+
+	BOOST_CHECK_EQUAL(classes.size(), 3u);
+
+	BOOST_CHECK_EQUAL(classes[0], 0.0f);
+	BOOST_CHECK_EQUAL(classes[1], 0.5f);
+	BOOST_CHECK_EQUAL(classes[2], 1.0f);
+}
+
+BOOST_AUTO_TEST_CASE (test_predefined)
+{
+	
+	auto initializer = BOOST_TEST_create_from_plugin<CPredefinedInitializerPlugin>("predefined:cc=[0.1,0.2,0.3,0.9]");
+
+	CMeans::NormalizedHistogram nh;
+
+	auto classes = initializer->run(nh);
+
+	BOOST_CHECK_EQUAL(classes.size(), 4u);
+
+	BOOST_CHECK_CLOSE(classes[0], 0.1f, 0.1);
+	BOOST_CHECK_CLOSE(classes[1], 0.2f, 0.1);
+	BOOST_CHECK_CLOSE(classes[2], 0.3f, 0.1);
+	BOOST_CHECK_CLOSE(classes[3], 0.9f, 0.1);
+}
+
+
+
diff --git a/mia/core/combiner.cc b/mia/core/combiner.cc
index 8e8e434..a139a5a 100644
--- a/mia/core/combiner.cc
+++ b/mia/core/combiner.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/combiner.hh b/mia/core/combiner.hh
index c968a76..f399bae 100644
--- a/mia/core/combiner.hh
+++ b/mia/core/combiner.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/cost.cc b/mia/core/cost.cc
index 506b88b..f707630 100644
--- a/mia/core/cost.cc
+++ b/mia/core/cost.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/cost.cxx b/mia/core/cost.cxx
index 2663212..2e1b66b 100644
--- a/mia/core/cost.cxx
+++ b/mia/core/cost.cxx
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/cost.hh b/mia/core/cost.hh
index c4ccb17..337ea50 100644
--- a/mia/core/cost.hh
+++ b/mia/core/cost.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/creator.cc b/mia/core/creator.cc
index 6a6e68b..d92d99d 100644
--- a/mia/core/creator.cc
+++ b/mia/core/creator.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/creator.hh b/mia/core/creator.hh
index 165f53d..24f56d5 100644
--- a/mia/core/creator.hh
+++ b/mia/core/creator.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/cstplan.hh b/mia/core/cstplan.hh
index 4f7ba5d..6319f68 100644
--- a/mia/core/cstplan.hh
+++ b/mia/core/cstplan.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/datapool.cc b/mia/core/datapool.cc
index 52eb7d6..4327b95 100644
--- a/mia/core/datapool.cc
+++ b/mia/core/datapool.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/datapool.hh b/mia/core/datapool.hh
index 56bfba8..5b9f4c8 100644
--- a/mia/core/datapool.hh
+++ b/mia/core/datapool.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/defines.hh b/mia/core/defines.hh
index 818a0d7..b4a43b0 100644
--- a/mia/core/defines.hh
+++ b/mia/core/defines.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/delayedparameter.hh b/mia/core/delayedparameter.hh
index 372418e..82d7676 100644
--- a/mia/core/delayedparameter.hh
+++ b/mia/core/delayedparameter.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/dictmap.hh b/mia/core/dictmap.hh
index 9355d92..1366e12 100644
--- a/mia/core/dictmap.hh
+++ b/mia/core/dictmap.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/distance.cc b/mia/core/distance.cc
index 518ac2d..2ac9365 100644
--- a/mia/core/distance.cc
+++ b/mia/core/distance.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/distance.hh b/mia/core/distance.hh
index 1e1eef4..1bf0e58 100644
--- a/mia/core/distance.hh
+++ b/mia/core/distance.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/dlloader.cc b/mia/core/dlloader.cc
index 600e050..3d1a3f8 100644
--- a/mia/core/dlloader.cc
+++ b/mia/core/dlloader.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -45,7 +45,8 @@ struct CDLLoaderData {
 		// valgrind will report reachable memory blocks on this call, 
 		// see destructor for a justification 
 	        m_module(dlopen(name, flags)),
-		m_name(name) 	{
+		m_name(name), 
+		m_unload (true){
 		if (!m_module) {
 			stringstream s;
 			s << name << ":'" << dlerror() << "'";
@@ -59,20 +60,32 @@ struct CDLLoaderData {
 		// the plugin-destructor is executing code within the module,
 		// after releasing it. Hence the module might be unloaded even though,
 		// the code is still needed.
-		// For now, the unloading is left to the final clean up when
+		// For now, the unloading is normally left to the final clean up when
 		// the program ends, this leaves some reachable memory blocks
+		// if the called knows that unloading is save, then 
+		// unloading can be explicitely specified.
 		//
-		// dlclose(m_module);
+		if (m_unload) 
+			dlclose(m_module);
 	}
+	
 	void *get_function(const char *name) {
 		return dlsym(m_module, name);
 	}
+	
 	const string& get_name() const {
 		return m_name;
 	}
+	
+	void set_unload_library(bool value) {
+		m_unload = value; 
+	}
+
+
 private:
 	ModuleHandle m_module;
 	string m_name;
+	bool m_unload; 
 };
 
 CDLLoader::CDLLoader(const char *name, int flags):
@@ -95,5 +108,16 @@ const string& CDLLoader::get_name() const
 	return impl->get_name();
 }
 
+void CDLLoader::set_unload_library()
+{
+	impl->set_unload_library(true); 
+}
+
+void CDLLoader::set_keep_library() 
+{
+	impl->set_unload_library(false); 
+}
+
+
 NS_MIA_END
 
diff --git a/mia/core/dlloader.hh b/mia/core/dlloader.hh
index 1d97539..c7e3d43 100644
--- a/mia/core/dlloader.hh
+++ b/mia/core/dlloader.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -55,6 +55,11 @@ public:
 
 	/// \returns the module name
 	const std::string& get_name() const;
+
+	/// tell the loader that the library should be unloaded at destruction
+	void set_unload_library(); 
+
+	void set_keep_library(); 
 private:
 	struct CDLLoaderData *impl;
 };
diff --git a/mia/core/dummyhandler.cc b/mia/core/dummyhandler.cc
index 15f1664..77cfdb8 100644
--- a/mia/core/dummyhandler.cc
+++ b/mia/core/dummyhandler.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/dummyhandler.hh b/mia/core/dummyhandler.hh
index f427688..27f7f33 100644
--- a/mia/core/dummyhandler.hh
+++ b/mia/core/dummyhandler.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/errormacro.hh b/mia/core/errormacro.hh
index 5dfa42d..b117c56 100644
--- a/mia/core/errormacro.hh
+++ b/mia/core/errormacro.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/export_handler.hh b/mia/core/export_handler.hh
index 8fbc48f..be53390 100644
--- a/mia/core/export_handler.hh
+++ b/mia/core/export_handler.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/factory.hh b/mia/core/factory.hh
index d8c5560..591534b 100644
--- a/mia/core/factory.hh
+++ b/mia/core/factory.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/factory_trait.hh b/mia/core/factory_trait.hh
index 74f6bb7..efa6cab 100644
--- a/mia/core/factory_trait.hh
+++ b/mia/core/factory_trait.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -22,6 +22,7 @@
 #define mia_core_factory_trait_hh
 
 #include <mia/core/defines.hh>
+#include <memory>
 
 NS_MIA_BEGIN
 /**
diff --git a/mia/core/fft1d_r2c.cc b/mia/core/fft1d_r2c.cc
index 46da06a..685f6c5 100644
--- a/mia/core/fft1d_r2c.cc
+++ b/mia/core/fft1d_r2c.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/fft1d_r2c.hh b/mia/core/fft1d_r2c.hh
index a3dcacd..00570ec 100644
--- a/mia/core/fft1d_r2c.hh
+++ b/mia/core/fft1d_r2c.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/fftslopeclassifier.cc b/mia/core/fftslopeclassifier.cc
index 4e6b129..3fceb40 100644
--- a/mia/core/fftslopeclassifier.cc
+++ b/mia/core/fftslopeclassifier.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/fftslopeclassifier.hh b/mia/core/fftslopeclassifier.hh
index a346f77..b169e05 100644
--- a/mia/core/fftslopeclassifier.hh
+++ b/mia/core/fftslopeclassifier.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/fifofilter.cxx b/mia/core/fifofilter.cxx
index 0a2e6bc..207a2a4 100644
--- a/mia/core/fifofilter.cxx
+++ b/mia/core/fifofilter.cxx
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/fifofilter.hh b/mia/core/fifofilter.hh
index f405a3e..155ee41 100644
--- a/mia/core/fifofilter.hh
+++ b/mia/core/fifofilter.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/file.cc b/mia/core/file.cc
index e2d7e10..8cab476 100644
--- a/mia/core/file.cc
+++ b/mia/core/file.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -24,12 +24,139 @@
 #include <iostream>
 #include <sstream>
 #include <stdexcept>
+#include <stdexcept>
+#include <map>
+#include <set>
+
+#include <boost/filesystem.hpp>
+#include <boost/tokenizer.hpp>
 
 #include <mia/core/file.hh>
+#include <mia/core/errormacro.hh>
+#include <mia/core/msgstream.hh>
 
 NS_MIA_BEGIN
 using namespace std;
 
+namespace bf = boost::filesystem; 
+
+#ifndef WIN32
+struct ExternalCompressors {
+
+	string has_compressor(const string& program) const; 
+	string has_decompressor(const string& program) const; 
+
+	static const ExternalCompressors& instance(); 
+private: 
+	void search_compressor(const char *suffix, const vector<const char *>& names, const vector<bf::path>&  binary_dirs); 
+	ExternalCompressors(); 
+	bool try_path(const bf::path& p); 
+	void search_compressor(const char *suffix, const vector<const char *>& names);  
+	void search_decompressor(const char *suffix, const char *name, const vector<bf::path>&  binary_dirs); 
+
+	string has(const string& suffix, const map<string, string>& m) const; 
+	map<string, string> compressor; 
+	map<string, string> decompressor; 
+}; 
+
+void ExternalCompressors::search_compressor(const char *suffix, const vector<const char *>& names, const vector<bf::path>&  binary_dirs)
+{
+	bool success = false; 
+	unsigned i = 0; 
+	while (!success && i < names.size()) {
+		string progname(names[i]); 
+
+		for (auto bd = binary_dirs.begin(); bd != binary_dirs.end() && !success; ++bd) {
+			cvdebug() << "Search compressor " << *bd << "/" << progname << "\n"; 
+			success = try_path(*bd / progname);
+		}
+		if (success) 
+			compressor[suffix] = progname; 
+		++i; 
+	}
+}
+
+void ExternalCompressors::search_decompressor(const char *suffix, const char *name, const vector<bf::path>&  binary_dirs)
+{
+	bool success = false; 
+	string progname(name); 
+	for (auto bd = binary_dirs.begin(); bd != binary_dirs.end() && !success; ++bd) {
+		cvdebug() << "Search decompressor " << *bd << "/" << progname << "\n"; 
+		success = try_path(*bd / progname);
+	}
+	if (success) 
+		decompressor[suffix] = progname; 
+}
+
+ExternalCompressors::ExternalCompressors()
+{
+	vector<bf::path> binary_dirs; 
+
+	const char *path = getenv("PATH");
+	if (!path) 
+		return; 
+	string spath(path); 
+	boost::char_separator<char> sep(":");
+	boost::tokenizer< boost::char_separator<char> > tok(spath, sep); 
+	
+	for (auto t = tok.begin(); t != tok.end(); ++t) 
+		binary_dirs.push_back(bf::path(*t));
+	
+	search_compressor(".gz", {"pigz", "gzip"}, binary_dirs); 
+	search_compressor(".xz", {"pxz", "xz"}, binary_dirs); 
+	search_compressor(".bz2", {"bzip2"}, binary_dirs); 
+	search_compressor(".Z", {"compress"}, binary_dirs); 
+
+	search_decompressor(".gz", "zcat", binary_dirs); 
+	search_decompressor(".xz", "xzcat", binary_dirs); 
+	search_decompressor(".bz2", "bzcat", binary_dirs); 
+	search_decompressor(".Z", "zcat", binary_dirs); 
+
+}
+
+const ExternalCompressors& ExternalCompressors::instance()
+{
+	static ExternalCompressors me; 
+	return me; 
+}
+
+string ExternalCompressors::has_compressor(const string& suffix) const
+{
+	return has(suffix, compressor); 
+}
+string ExternalCompressors::has_decompressor(const string& suffix) const
+{
+	return has(suffix, decompressor); 
+}
+
+string ExternalCompressors::has(const string& suffix, const map<string, string>& m) const
+{
+	auto idx = m.find(suffix); 
+	if (idx == m.end()) {
+		throw create_exception<runtime_error>("Try to do IO with compresssed file of type '", 
+						      suffix, "', but no corresponding (de-)compressor program found");
+	}
+	return idx->second; 
+}
+
+
+bool ExternalCompressors::try_path(const bf::path& p)
+{
+	boost::system::error_code ec;
+	auto st = bf::status(p, ec); 
+	if (ec != boost::system::errc::success)
+		return false; 
+
+	if (st.permissions() & bf::others_exe) 
+		return true; 
+	return false; 
+}
+
+
+set<string> recognized_sompression_suffixes{".gz", ".xz", ".bz2", ".Z"}; 
+
+#endif 
+
 CFile::CFile(const string& filename, bool from_stdio, bool write):
 	m_must_close(!from_stdio),
 	m_is_pipe(false),
@@ -40,31 +167,35 @@ CFile::CFile(const string& filename, bool from_stdio, bool write):
 		return;
 	}
 #ifndef WIN32
-	int  last_dot = filename.rfind('.');
 
+	int  last_dot = filename.rfind('.');
 	string suffix = last_dot >= 0   ? filename.substr(last_dot) : "";
-
-	string pipe;
-	if (suffix == string(".gz")) {
-		m_is_pipe = true;
-		pipe = (write ? string("gzip >") : string("zcat ")) + filename.c_str();
-	}else if (suffix == string(".bz2")) {
-		m_is_pipe = true;
-		pipe = (write ? string("bzip2 >") : string("bzcat ")) + filename.c_str();
-	}else if (suffix == string(".xz")) {
-		m_is_pipe = true;
-		pipe = (write ? string("xz >") : string("xzcat ")) + filename.c_str();
-
-	}else if (suffix == string(".Z")) {
-		m_is_pipe = true;
-		pipe = (write ? string("compress >") : string("zcat ")) + filename.c_str();
+	
+	if (recognized_sompression_suffixes.find(suffix) == recognized_sompression_suffixes.end()) {
+		m_file = fopen (filename.c_str(), write? "wb" : "rb");
+	} else {
+		cvdebug() << "Try using a (de)compressor for type " << suffix << "\n"; 
+		if (!write) {
+			string pipe;
+			auto dcprogname = ExternalCompressors::instance().has_decompressor(suffix); 
+			m_is_pipe = true;
+			pipe = dcprogname + string(" ") + filename.c_str();
+			cvdebug() << "Open pipe like '" << pipe << "'\n"; 
+			m_file = popen (pipe.c_str(), "r");
+		} else {
+			string pipe;
+			cvdebug() << "See if compressor is available\n"; 
+			auto cprogname = ExternalCompressors::instance().has_compressor(suffix); 
+			m_is_pipe = true;
+			pipe = cprogname + string(" > ") + filename.c_str();
+			cvdebug() << "Open pipe like '" << pipe << "'\n"; 
+			m_file = popen (pipe.c_str(), "w");
+		}
 	}
-
-	if (m_is_pipe)
-		m_file = popen (pipe.c_str(), write ? "w": "r");
-	else
+#else 
+// in WIN32 no pipes 
+	m_file = fopen (filename.c_str(), write ? "wb": "rb");
 #endif
-		m_file = fopen (filename.c_str(), write ? "wb": "rb");
 
 	if (!m_file) {
 		stringstream errmsg;
diff --git a/mia/core/file.hh b/mia/core/file.hh
index b5b7516..046d674 100644
--- a/mia/core/file.hh
+++ b/mia/core/file.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/filetools.cc b/mia/core/filetools.cc
index 369ca2f..17d8b84 100644
--- a/mia/core/filetools.cc
+++ b/mia/core/filetools.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -25,7 +25,6 @@
 #include <boost/filesystem/path.hpp>
 #include <boost/filesystem/operations.hpp> // includes boost/filesystem/path.hpp
 #include <boost/filesystem/fstream.hpp>    // ditto
-#include <mia/core/bfsv23dispatch.hh>
 #include <boost/regex.hpp>
 
 #include <mia/core/msgstream.hh>
@@ -280,9 +279,9 @@ EXPORT_CORE size_t get_filename_number_pattern_width(std::string const& in_filen
 EXPORT_CORE size_t get_filename_number_pattern(std::string const& in_filename, string& base, string& suffix)
 {
 	bfs::path p(in_filename);
-	suffix = __bfs_get_extension(p);
+	suffix = p.extension().string();
 
-	string rest = __bfs_get_stem(p);
+	string rest = p.stem().string();
 
 	size_t nwidth = 0;
 	string::const_reverse_iterator r = rest.rbegin();
@@ -299,7 +298,7 @@ EXPORT_CORE void split_filename_number_pattern(std::string const& in_filename, s
 {
 	bfs::path p(in_filename);
 	size_t nwidth = get_filename_number_pattern(in_filename, base, suffix);
-	string stem = __bfs_get_stem(p); 
+	string stem = p.stem().string();  
 	number = stem.substr(stem.size() - nwidth);
 }
 
diff --git a/mia/core/filetools.hh b/mia/core/filetools.hh
index ec8b306..baf6a0b 100644
--- a/mia/core/filetools.hh
+++ b/mia/core/filetools.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/filter.cc b/mia/core/filter.cc
index d146173..ea5115a 100644
--- a/mia/core/filter.cc
+++ b/mia/core/filter.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/filter.hh b/mia/core/filter.hh
index 1c17820..58fa01d 100644
--- a/mia/core/filter.hh
+++ b/mia/core/filter.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/fixedwidthoutput.cc b/mia/core/fixedwidthoutput.cc
index 089f2a6..d6a3a7b 100644
--- a/mia/core/fixedwidthoutput.cc
+++ b/mia/core/fixedwidthoutput.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -65,7 +65,7 @@ void CFixedWidthOutput::newline()
 {
 	if (m_line_continue) 
 		m_os << '\\'; 
-	m_os << '\n'; 
+	m_os << std::endl; 
 	if ( m_offset )
 		m_os << setw(m_offset) << " "; 
 	m_pos = m_offset;
diff --git a/mia/core/fixedwidthoutput.hh b/mia/core/fixedwidthoutput.hh
index 1d7bb30..8137262 100644
--- a/mia/core/fixedwidthoutput.hh
+++ b/mia/core/fixedwidthoutput.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/flags.hh b/mia/core/flags.hh
new file mode 100644
index 0000000..0e283f8
--- /dev/null
+++ b/mia/core/flags.hh
@@ -0,0 +1,59 @@
+/* -*- mia-c++  -*-
+ *
+ * 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 MIA; if not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef mia_core_flags_hh
+#define mia_core_flags_hh
+
+#include <mia/core/defines.hh>
+
+NS_MIA_BEGIN 
+
+/**
+   This macro implements operations on a strongly typed enum 
+   that is used as a flag. We use a macro since we don't want to 
+   provide a template that would be valid for all types that don't 
+   have these operators implemented 
+*/
+
+#define IMPLEMENT_FLAG_OPERATIONS(E)					\
+	inline E operator | (E lhs, E rhs)				\
+	{								\
+		return static_cast<E>(  static_cast<int>(lhs) | static_cast<int>(rhs)); \
+	}								\
+									\
+	inline E operator  & (E lhs, E rhs)				\
+	{								\
+		return static_cast<E>(  static_cast<int>(lhs) & static_cast<int>(rhs)); \
+	}								\
+									\
+	inline E operator -= (E& lhs, E rhs)				\
+	{								\
+		lhs = static_cast<E>(  static_cast<int>(lhs) & ~static_cast<int>(rhs)); \
+		return lhs;						\
+	}								\
+									\
+	inline bool has_flag(E flags, E test)				\
+	{								\
+		return (flags & test) == test;				\
+	}
+
+
+NS_MIA_END 
+#endif 
diff --git a/mia/core/flagstring.cc b/mia/core/flagstring.cc
index 81ca02f..34923d6 100644
--- a/mia/core/flagstring.cc
+++ b/mia/core/flagstring.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/flagstring.hh b/mia/core/flagstring.hh
index d123e51..e261e50 100644
--- a/mia/core/flagstring.hh
+++ b/mia/core/flagstring.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/fullstats.cc b/mia/core/fullstats.cc
index 3d90f1d..82d7913 100644
--- a/mia/core/fullstats.cc
+++ b/mia/core/fullstats.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/fullstats.hh b/mia/core/fullstats.hh
index bd20cd6..c9ccc56 100644
--- a/mia/core/fullstats.hh
+++ b/mia/core/fullstats.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/handler.cxx b/mia/core/handler.cxx
index 970901e..7997e97 100644
--- a/mia/core/handler.cxx
+++ b/mia/core/handler.cxx
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -30,13 +30,14 @@
 
 #include <boost/regex.hpp>
 #include <boost/filesystem/operations.hpp>
-#include <mia/core/bfsv23dispatch.hh>
 
 #include <mia/core/module.hh>
 #include <mia/core/plugin_base.hh>
 #include <mia/core/msgstream.hh>
 
 
+
+
 #include <config.h>
 
 
@@ -48,106 +49,18 @@ EXPORT_CORE const std::string get_plugin_root();
 
 template <typename I> 
 TPluginHandler<I>::TPluginHandler():
-	CPluginHandlerBase(TPlugin<typename I::PlugData,typename I::PlugType>::search_path().string())
-{
-	TRACE_FUNCTION; 
-}
-
-template <typename I>
-void TPluginHandler<I>::global_searchpath(CPathNameArray& searchpath)
+	CPluginHandlerBase(I::PlugData::data_descr, I::PlugType::type_descr)
 {
 	TRACE_FUNCTION; 
-	bfs::path type_path = TPlugin<typename I::PlugData,typename I::PlugType>::search_path();
-	
-	cvdebug() << "Add plugin searchpath\n"; 
-	cvdebug() << "   " << get_plugin_root() << "/" << type_path.string() << "\n"; 
-
-	searchpath.push_back( bfs::path(get_plugin_root()) / type_path); 
-
-
-#ifdef PLUGIN_HOME_SEARCH_PATH 
-	char *c_home = getenv("HOME"); 
-	if (c_home) {
-
-		cvdebug() << "   " << c_home << "/" << PLUGIN_HOME_SEARCH_PATH 
-			  << "/" << type_path.native_file_string() << "\n"; 
-
-		searchpath.push_back( bfs::path(c_home, bfs::native) / bfs::path(PLUGIN_HOME_SEARCH_PATH) 
-				      / type_path); 
-	}
-#endif
-
-	char *c_user = getenv("MIA_PLUGIN_PATH");
-	if (c_user) {
-		cvdebug() << "   " << c_user << "/" << type_path.string() << "\n"; 
-		bfs::path lala(c_user); 
-		bfs::path subdir = lala / type_path; 
-		
-		searchpath.push_back( subdir ); 
-	}	
 }
 
-
 template <typename I>
-void TPluginHandler<I>::initialise(CPathNameArray searchpath)
+void TPluginHandler<I>::initialise(const CPluginSearchpath& searchpath)
 {
 	TRACE_FUNCTION; 
 
-	if (searchpath.empty())
-		global_searchpath(searchpath); 
-
-
-	// create the pattern match
-	std::stringstream pattern; 
-
-	pattern << ".*\\."<< MIA_MODULE_SUFFIX << "$"; 
-
-	cvdebug() << "TPluginHandler<I>::initialise: '"<<
-		TPlugin<typename I::PlugData,typename I::PlugType>::search_path() <<
-		"' using search pattern'" << pattern.str() << "'\n"; 
-
-	boost::regex pat_expr(pattern.str());	
-	std::vector<bfs::path> candidates; 
-
-	// search through all the path to find the plugins
-	for (auto dir = searchpath.begin(); dir != searchpath.end(); ++dir){
-		cvdebug() << "Looking for " << dir->string() << "\n"; 
-		if (bfs::exists(*dir) && bfs::is_directory(*dir)) {
-			// if we cant save the old directory something is terribly wrong
-			bfs::directory_iterator di(*dir); 
-			bfs::directory_iterator dend;
-			
-			cvdebug() << "TPluginHandler<I>::initialise: scan '"<<dir->string() <<"'\n"; 
-
-			while (di != dend) {
-				cvdebug() << "    candidate:'" << di->path().string() << "'"; 
-				if (boost::regex_match(di->path().string(), pat_expr)) {
-					candidates.push_back(*di); 
-					cverb << " add\n";
-				}else
-					cverb << " discard\n";
-				++di; 
-			}
-		}
-	}
+	m_modules = searchpath.find_modules(I::get_data_path_part(), I::get_type_path_part()); 
 	
-	// candidates contains all the names of the possible plug-ins
-	// now load the modules and put them in a list
-	for (auto i = candidates.begin(); i != candidates.end(); ++i) {
-		try {
-			cvdebug()<< " Load '" <<i->string()<<"'\n"; 
-			m_modules.push_back(PPluginModule(new CPluginModule(i->string().c_str())));
-		}
-		catch (std::invalid_argument& ex) {
-			cverr() << ex.what() << "\n"; 
-		}
-		catch (std::exception& ex) {
-			cverr() << ex.what() << "\n"; 
-		}
-		catch (...) {
-			cverr() << "Loading module " << i->string() << "failed for unknown reasons\n"; 
-		}
-	}
 
 	// now try to load the interfaces and put them in the map
 	for (auto i = m_modules.begin(); i != m_modules.end(); ++i) {
@@ -166,14 +79,43 @@ void TPluginHandler<I>::initialise(CPathNameArray searchpath)
 				
 				if (p) {
 					cvdebug() << "add plugin '" << p->get_name() << "'\n"; 
-					if (m_plugins.find(p->get_name()) ==  m_plugins.end()) {
+
+					auto loaded_plugin_i = m_plugins.find(p->get_name()); 
+					if ( loaded_plugin_i ==  m_plugins.end()) {
 						p->set_module(*i);
-						add_plugin(p); 
+						add_plugin_internal(PInterface(p)); 
+
+						// since this module will be used 
+						// keep its module till the final cleanup 
+						(*i)->set_keep_library(); 
 					} else {
-						cvwarn() << "Plugin with name '" << p->get_name() 
-							 << "' already loaded, ignoring new one.\n"; 
-						delete p; 
+						auto loaded_plugin = loaded_plugin_i->second; 
+						if (loaded_plugin->get_priority() < p->get_priority()) {
+							cvwarn() << "Plugin with name '" << p->get_name() 
+								 << "' and priority '" <<  p->get_priority() 
+								 << "' overrides already loaded plugin\n"; 
+							p->set_module(*i);
+							
+							// since this module will be used 
+							// keep its module till the final cleanup 
+							(*i)->set_keep_library(); 
+								
+							*i = loaded_plugin->get_module(); 
+							add_plugin_internal(PInterface(p)); 
+						}else{
+							cvwarn() << "Plugin with name '" << p->get_name() 
+								 << "' already loaded, and new one has no higher priority.\n"; 
+							delete p;
+						}
+						
+						// since this module will not be used at all 
+						// unload the according library 
+						(*i)->set_unload_library(); 
 					}
+
+
+					
+
 					
 				}else {
 					cvdebug() << "discard '" << pold->get_name() << "'\n"; 
@@ -191,8 +133,42 @@ void TPluginHandler<I>::initialise(CPathNameArray searchpath)
 }
 
 template <typename I>
-void TPluginHandler<I>::add_plugin(Interface *p)
+bool TPluginHandler<I>::add_plugin(PInterface p)
+{
+	bool result = true; 
+	auto loaded_plugin_i = m_plugins.find(p->get_name()); 
+	if ( loaded_plugin_i ==  m_plugins.end()) {
+		add_plugin_internal(p); 
+	}else{
+		auto loaded_plugin = loaded_plugin_i->second; 
+		if (loaded_plugin->get_priority() < p->get_priority()) {
+			cvinfo() << "Plugin with name '" << p->get_name() 
+				 << "' and priority '" <<  p->get_priority() 
+				 << "' overrides already loaded plugin with priority '"
+				 << loaded_plugin->get_priority() << "'\n"; 
+			add_plugin_internal(p);
+
+			// if the plug-in was inported from a module, mark this module for removal
+			auto old_module = loaded_plugin->get_module(); 
+			if (old_module)
+				old_module->set_unload_library(); 
+			
+		}else{
+			cvinfo() << "Plugin with name '" << p->get_name() 
+				 << "' has lower or equal priority '" <<  p->get_priority() 
+				 << "' compared to already loaded plugin with priority '"
+				 << loaded_plugin->get_priority() << "' ... discarding\n"; 
+			result = false; 
+		}
+	}
+	return result; 
+}
+
+
+template <typename I>
+void TPluginHandler<I>::add_plugin_internal(PInterface p)
 {
+	
 	m_plugins[p->get_name()] = p;	
 }
 
@@ -221,10 +197,7 @@ typename TPluginHandler<I>::const_iterator TPluginHandler<I>::end() const
 template <typename I>
 TPluginHandler<I>::~TPluginHandler()
 {
-	for (typename CPluginMap::iterator i = m_plugins.begin(); 
-	     i != m_plugins.end(); ++i) {
-		delete i->second; 
-	}
+	
 }
 
 
@@ -271,7 +244,7 @@ typename TPluginHandler<I>::Interface *TPluginHandler<I>::plugin(const char *plu
 		    << "    '" << get_plugin_root(); 
 		return nullptr; 
 	}
-	return p->second; 
+	return p->second.get(); 
 }
 
 template <typename I>
@@ -291,11 +264,11 @@ void TPluginHandler<I>::do_print_help(std::ostream& os) const
 }
 
 template <typename I>
-void TPluginHandler<I>::do_get_xml_help(xmlpp::Element *handlerRoot) const
+void TPluginHandler<I>::do_get_xml_help(CXMLElement *handlerRoot) const
 {
 	handlerRoot->set_child_text(m_help);
 	for (auto i = begin(); i != end(); ++i) {
-		xmlpp::Element* pluginRoot = handlerRoot->add_child("plugin");
+		auto* pluginRoot = handlerRoot->add_child("plugin");
 		pluginRoot->set_attribute("name", i->first);
 		i->second->get_help_xml(*pluginRoot); 
 	}
@@ -327,7 +300,13 @@ const T* THandlerSingleton<T>::pointer()
 }
 
 template <typename T> 
-const T& THandlerSingleton<T>::do_instance(bool require_initialization)
+bool THandlerSingleton<T>::add_plugin(typename T::PInterface p)
+{
+	return do_instance(true).add_plugin(p); 
+} 
+
+template <typename T> 
+T& THandlerSingleton<T>::do_instance(bool require_initialization)
 {
 	TRACE_FUNCTION; 
 	CScopedLock lock(m_creation_mutex); 
@@ -350,33 +329,34 @@ const T& THandlerSingleton<T>::do_instance(bool require_initialization)
 }
 
 template <typename T>
-void THandlerSingleton<T>::set_search_path(const CPathNameArray& searchpath)
+void THandlerSingleton<T>::set_search_path(const CPluginSearchpath& searchpath)
 {
 	TRACE_FUNCTION; 
 
 	CScopedLock lock(m_creation_mutex); 
-	typedef typename  T::Interface IF; 
-	cvdebug() << "Set path: "  << TPlugin<typename IF::PlugData,typename IF::PlugType>::search_path() << '\n'; 
+	cvdebug() << "Set path: "
+		  << T::Interface::get_data_path_part() << "/"
+		  << T::Interface::get_type_path_part() << '\n'; 
 
 	if (m_is_created) {
-		bfs::path type_path = TPlugin<typename IF::PlugData,typename IF::PlugType>::search_path();
-		cvinfo() << "THandlerSingleton<" << 
-			type_path.string() <<
-			">::set_search_path: handler was already created\n"; 
-			
+		cvinfo() << "THandlerSingleton<" 
+			 << T::Interface::get_data_path_part() << "/"
+			 << T::Interface::get_type_path_part()
+			 << ">::set_search_path: handler was already created\n"; 
+		
 	}
 #if 0 // work around the appearent icc bug, where the static member 
       //variable is not initialised
 	::new (&m_searchpath) CPathNameArray; 
 #endif
-	cvdebug() << "searchpath=" << searchpath << "\n"; 
+//	cvdebug() << "searchpath=" << searchpath << "\n"; 
 	m_searchpath = searchpath; 
 
 }
 
 
 template <typename T>
-CPathNameArray THandlerSingleton<T>::m_searchpath;
+CPluginSearchpath THandlerSingleton<T>::m_searchpath;
 
 template <typename T>
 bool THandlerSingleton<T>::m_is_created = false; 
diff --git a/mia/core/handler.hh b/mia/core/handler.hh
index 273bab2..13f5f2e 100644
--- a/mia/core/handler.hh
+++ b/mia/core/handler.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -35,7 +35,7 @@
 #include <mia/core/module.hh>
 #include <mia/core/plugin_base.hh>
 #include <mia/core/handlerbase.hh>
-
+#include <mia/core/searchpath.hh>
 #include <mia/core/import_handler.hh>
 
 NS_MIA_BEGIN
@@ -56,8 +56,10 @@ public:
 	/// typedef for the plug-in interface provided by the class 
 	typedef I Interface; 
 
+	typedef std::shared_ptr<I> PInterface; 
+
 	/// a map containing the names and theavailabe plug-ins 
-	typedef std::map<std::string, Interface*> CPluginMap; 
+	typedef std::map<std::string, PInterface> CPluginMap; 
 
 	/// the iterator to walk over the available plug-ins 
 	typedef typename CPluginMap::const_iterator const_iterator; 
@@ -87,12 +89,23 @@ public:
 	const_iterator end()const; 
 
 	/**
-	   Add a given plug-in to the handler. The pointer must not be freed in client code. 
+	   Add a given plug-in to the handler. 
 	   @param plugin 
+	   @returns true if the plug-in was added, false if a plug-in with a higher or equal 
+	   priority and the same name already existed. 
 	*/
-	void add_plugin(Interface *plugin); 
+	bool add_plugin(PInterface plugin); 
 
 protected: 
+
+
+	/**
+	   Add a given plug-in to the handler. The pointer must not be freed in client code. 
+	   @param plugin 
+	*/
+	void add_plugin_internal(PInterface plugin); 
+
+
 	//! \name Constructors
         //@{
 
@@ -111,11 +124,10 @@ protected:
 	typename TPluginHandler<I>::Interface *plugin(const char *plugin) const;
 
 
-	void initialise(CPathNameArray searchpath); 
+	void initialise(const CPluginSearchpath& searchpath); 
 
 private: 
 	virtual void do_initialise(); 
-	void global_searchpath(CPathNameArray& searchpath); 
 
 	void do_add_dependend_handlers(HandlerHelpMap& handler_map) const; 	
 	
@@ -124,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(xmlpp::Element *root) const; 	
+	virtual void do_get_xml_help(CXMLElement *root) const; 	
 
 	static const char * const m_help; 
 
@@ -147,7 +159,7 @@ public:
 	   Set the plugin search path for the plug-in - throws "runtime_error" if the 
 	   plugin handler is already instanciated. 
 	 */
-	static void set_search_path(const CPathNameArray& searchpath);
+	static void set_search_path(const CPluginSearchpath& searchpath);
 	
 	/// The instance of the plugin handler 
 	typedef T Instance;
@@ -163,6 +175,8 @@ public:
 	*/
 	static const T& instance(); 
 
+	static bool add_plugin(typename T::PInterface p); 
+
 	/**
 	   \returns a pointer to the only instance of the plugin handler, it is possible that 
 	   this instance is not yet initialized.   
@@ -180,9 +194,9 @@ private:
 	// template the singleton with the derived handler. 
 	THandlerSingleton(); 
 
-	static const T& do_instance(bool require_initialization); 
+	static T& do_instance(bool require_initialization); 
 
-	static CPathNameArray m_searchpath; 
+	static CPluginSearchpath m_searchpath; 
 	static bool m_is_created; 
 	static CMutex m_initialization_mutex;
 	static bool m_is_initialized; 
diff --git a/mia/core/handlerbase.cc b/mia/core/handlerbase.cc
index f322e1a..fb4b0d3 100644
--- a/mia/core/handlerbase.cc
+++ b/mia/core/handlerbase.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -20,11 +20,14 @@
 
 #include <mia/core/handlerbase.hh>
 #include <mia/core/msgstream.hh>
+#include <boost/filesystem/path.hpp>
 
 NS_MIA_BEGIN
 
-CPluginHandlerBase::CPluginHandlerBase(const std::string& descriptor):
-	m_descriptor(descriptor)
+using boost::filesystem::path; 
+
+CPluginHandlerBase::CPluginHandlerBase(const char *data_descr, const char *type_descr):
+	m_descriptor((path(data_descr) / path(type_descr)).string())
 {
 }
 
@@ -44,9 +47,9 @@ void CPluginHandlerBase::print_help(std::ostream& os) const
 	do_print_help(os); 
 }
 
-void CPluginHandlerBase::get_xml_help(xmlpp::Element *root) const
+void CPluginHandlerBase::get_xml_help(CXMLElement *root) const
 {
-	xmlpp::Element* handlerRoot = root->add_child("handler");
+	CXMLElement* handlerRoot = root->add_child("handler");
 	handlerRoot->set_attribute("name", get_descriptor());
 	do_get_xml_help(handlerRoot); 
 }
@@ -66,10 +69,10 @@ 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, xmlpp::Element *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);
+	auto factory = parent->add_child(type.c_str());
 	factory->set_attribute("name", get_descriptor());
 	parent->set_attribute("type", type);
 }
diff --git a/mia/core/handlerbase.hh b/mia/core/handlerbase.hh
index fb6fb38..1075aeb 100644
--- a/mia/core/handlerbase.hh
+++ b/mia/core/handlerbase.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -24,7 +24,7 @@
 #include <ostream>
 #include <fstream>
 #include <map>
-#include <libxml++/libxml++.h>
+#include <mia/core/xmlinterface.hh>
 
 #include <mia/core/defines.hh>
 
@@ -59,9 +59,10 @@ class EXPORT_CORE CPluginHandlerBase  {
 
 	/**
 	   Constructor 
-	   \param descriptor plugin search  path descriptor, used to identify the plugin type for users
+	   \param data_descr plugin search  path descriptor, used to identify the plugin data
+	   \param type_descr plugin search  path descriptor, used to identify the plugin type
 	*/
-	CPluginHandlerBase(const std::string& descriptor); 
+	CPluginHandlerBase(const char *data_descr, const char *type_descr); 
 
 	/**
 	   forbid copying - doxygen should drop these from the documentation 
@@ -91,11 +92,12 @@ 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(xmlpp::Element *root) const; 
+	void get_xml_help(CXMLElement *root) const; 
 
 	/// \returns the plug-in handler descriptor
 	const std::string& get_descriptor() const; 
 
+	
 	/** add all plug-in handler that may be called by this plug-in handler
 	    \param [in,out] handler_map plug in handler map to add to 
 	 */
@@ -106,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, xmlpp::Element *root) const; 
+	void get_string_help_description_xml(std::ostream& os, CXMLElement *root) const; 
 	
 	
 	/**
@@ -126,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(xmlpp::Element *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/histogram.hh b/mia/core/histogram.hh
index 7f283df..d9c12ee 100644
--- a/mia/core/histogram.hh
+++ b/mia/core/histogram.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/history.cc b/mia/core/history.cc
index f96f4fe..e8ca6b1 100644
--- a/mia/core/history.cc
+++ b/mia/core/history.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/history.hh b/mia/core/history.hh
index 512c360..1e4665a 100644
--- a/mia/core/history.hh
+++ b/mia/core/history.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/ica.cc b/mia/core/ica.cc
index 1f6edb4..e45f2f7 100644
--- a/mia/core/ica.cc
+++ b/mia/core/ica.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/ica.hh b/mia/core/ica.hh
index 30c4b8f..16e25b8 100644
--- a/mia/core/ica.hh
+++ b/mia/core/ica.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/ica_template.cxx b/mia/core/ica_template.cxx
index 8d05b07..ef9d9fb 100644
--- a/mia/core/ica_template.cxx
+++ b/mia/core/ica_template.cxx
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/ica_template.hh b/mia/core/ica_template.hh
index 1706629..5c82724 100644
--- a/mia/core/ica_template.hh
+++ b/mia/core/ica_template.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/import_handler.hh b/mia/core/import_handler.hh
index 59e5915..b1b4b5a 100644
--- a/mia/core/import_handler.hh
+++ b/mia/core/import_handler.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/index.cc b/mia/core/index.cc
index b0d0a2a..e89f6be 100644
--- a/mia/core/index.cc
+++ b/mia/core/index.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/index.hh b/mia/core/index.hh
index 0c85c2e..9e874eb 100644
--- a/mia/core/index.hh
+++ b/mia/core/index.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/info.cc b/mia/core/info.cc
index ad2d559..987795b 100644
--- a/mia/core/info.cc
+++ b/mia/core/info.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -22,7 +22,7 @@
 #include <cstdlib>
 
 static const char info[] = "%s is Copyright %s\n"
-	"    (c) 1999-2014 Leipzig, Germany and Madrid, Spain \n"
+	"    (c) 1999-2015 Leipzig, Germany and Madrid, Spain \n"
 	""
 	"and it comes with  ABSOLUTELY NO WARRANTY. You may redistribute .\n"
 	"it under the terms of the GNU GENERAL PUBLIC LICENSE (see below).\n"
diff --git a/mia/core/interpolator1d.cc b/mia/core/interpolator1d.cc
index 6384048..dccdcc9 100644
--- a/mia/core/interpolator1d.cc
+++ b/mia/core/interpolator1d.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/interpolator1d.cxx b/mia/core/interpolator1d.cxx
index 6c2266c..0942c16 100644
--- a/mia/core/interpolator1d.cxx
+++ b/mia/core/interpolator1d.cxx
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/interpolator1d.hh b/mia/core/interpolator1d.hh
index ac7a6b2..b3031a2 100644
--- a/mia/core/interpolator1d.hh
+++ b/mia/core/interpolator1d.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/iodata.cc b/mia/core/iodata.cc
index 3c585fe..6bd85fb 100644
--- a/mia/core/iodata.cc
+++ b/mia/core/iodata.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/iodata.hh b/mia/core/iodata.hh
index e3370ea..cf9c56e 100644
--- a/mia/core/iodata.hh
+++ b/mia/core/iodata.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/iohandler.cxx b/mia/core/iohandler.cxx
index f62eb17..e167ebf 100644
--- a/mia/core/iohandler.cxx
+++ b/mia/core/iohandler.cxx
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -19,7 +19,6 @@
  */
 
 #include <stdexcept>
-#include <mia/core/bfsv23dispatch.hh>
 #include <mia/core/handler.cxx>
 
 
@@ -55,13 +54,13 @@ TIOPluginHandler<I>::preferred_plugin_ptr(const std::string& fname) const
 	TRACE_FUNCTION; 
 	// get the suffix - if there is a Z, gz, or bz2, include it in the suffix
 	bfs::path fpath(fname);
-	std::string fsuffix = __bfs_get_extension(fpath); 
+	std::string fsuffix = fpath.extension().string();
 	if (!fsuffix.empty()) {
 		if (m_compress_sfx.find(fsuffix) != m_compress_sfx.end()) {
 			cvdebug() << "Got compression suffix '" << fsuffix << "\n"; 
 			// remove the last extension and get the one before
 			bfs::path help(fpath.stem()); 
-			fsuffix = __bfs_get_extension(help); 
+			fsuffix = help.extension().string(); 
 		}
 	}else 
 		fsuffix = fname; 
@@ -72,7 +71,7 @@ TIOPluginHandler<I>::preferred_plugin_ptr(const std::string& fname) const
 	cvdebug() << "looking up plugin for '" << fsuffix << "'\n"; 
 
 	if (fsuffix == ".datapool") 
-		return m_pool_plugin; 
+		return m_pool_plugin.get(); 
 
 	CSuffixmap::const_iterator p = m_suffixmap.find(fsuffix);
 	if (p != m_suffixmap.end())
@@ -122,10 +121,10 @@ TIOPluginHandler<I>::preferred_plugin(const std::string& fname) const
 	TRACE_FUNCTION; 
 	// get the suffix - if there is a Z, gz, or bz2, include it in the suffix
 	bfs::path fpath(fname);
-	auto fsuffix = __bfs_get_extension(fpath); 
+	auto fsuffix = fpath.extension().string(); 
 	if (m_compress_sfx.find(fsuffix) != m_compress_sfx.end()) {
 		bfs::path  help(fpath.stem()); 
-		fsuffix = __bfs_get_extension(help); 
+		fsuffix = help.extension().string(); 
 	}
 	cvdebug() << "Got suffix '" << fsuffix << "'\n"; 
 	auto p = m_suffixmap.find(fsuffix);
diff --git a/mia/core/iohandler.hh b/mia/core/iohandler.hh
index 8bd5e98..d4efc36 100644
--- a/mia/core/iohandler.hh
+++ b/mia/core/iohandler.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -162,7 +162,7 @@ private:
 		const std::string do_get_preferred_suffix() const; 
 			
 	}; 
-	CDatapoolPlugin *m_pool_plugin; 
+	std::shared_ptr<Interface> m_pool_plugin; 
 }; 
 
 /**
diff --git a/mia/core/ioplugin.cc b/mia/core/ioplugin.cc
index d3e8fa6..092e7c9 100644
--- a/mia/core/ioplugin.cc
+++ b/mia/core/ioplugin.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/ioplugin.cxx b/mia/core/ioplugin.cxx
index e8994a7..c1f9186 100644
--- a/mia/core/ioplugin.cxx
+++ b/mia/core/ioplugin.cxx
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -70,7 +70,7 @@ std::string get_values_as_string(I begin, I end, T translate)
 }
 
 template <typename D> 
-void TIOPlugin<D>::do_get_help_xml(xmlpp::Element& root) const
+void TIOPlugin<D>::do_get_help_xml(CXMLElement& root) const
 {
 	//flag that docu should not print help about non-existent parameters 
 	root.add_child("noparam"); 
diff --git a/mia/core/ioplugin.hh b/mia/core/ioplugin.hh
index ca4bff8..fbbf556 100644
--- a/mia/core/ioplugin.hh
+++ b/mia/core/ioplugin.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -128,7 +128,7 @@ private:
 	 */
 	virtual PData do_load(const std::string& fname) const = 0;
 
-	void do_get_help_xml(xmlpp::Element& root) const; 
+	void do_get_help_xml(CXMLElement& root) const; 
 
 
 	/**
diff --git a/mia/core/kmeans.cc b/mia/core/kmeans.cc
index a0a06f3..91f1375 100644
--- a/mia/core/kmeans.cc
+++ b/mia/core/kmeans.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/kmeans.hh b/mia/core/kmeans.hh
index 9758738..f99d5d8 100644
--- a/mia/core/kmeans.hh
+++ b/mia/core/kmeans.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/labelmap.cc b/mia/core/labelmap.cc
index d8f73e5..64f7fef 100644
--- a/mia/core/labelmap.cc
+++ b/mia/core/labelmap.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/labelmap.hh b/mia/core/labelmap.hh
index e141fbb..28fa62d 100644
--- a/mia/core/labelmap.hh
+++ b/mia/core/labelmap.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/meanvar.hh b/mia/core/meanvar.hh
index a1a3bc6..4ba1fda 100644
--- a/mia/core/meanvar.hh
+++ b/mia/core/meanvar.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/minimizer.cc b/mia/core/minimizer.cc
index 2492f25..b4ad675 100644
--- a/mia/core/minimizer.cc
+++ b/mia/core/minimizer.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/minimizer.hh b/mia/core/minimizer.hh
index 2fc5cef..914de69 100644
--- a/mia/core/minimizer.hh
+++ b/mia/core/minimizer.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/minimizer/CMakeLists.txt b/mia/core/minimizer/CMakeLists.txt
index acc39a2..fafb2a7 100644
--- a/mia/core/minimizer/CMakeLists.txt
+++ b/mia/core/minimizer/CMakeLists.txt
@@ -1,6 +1,6 @@
 #
 # This file is part of MIA - a toolbox for medical image analysis 
-# Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+# 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
diff --git a/mia/core/minimizer/gdas.cc b/mia/core/minimizer/gdas.cc
index e0ab822..ba0c111 100644
--- a/mia/core/minimizer/gdas.cc
+++ b/mia/core/minimizer/gdas.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -153,15 +153,20 @@ CGDSAMinimizerPlugin::CGDSAMinimizerPlugin():
 	m_xtol( 0.01 ), 
 	m_maxiter( 200 )
 {
-	add_parameter("maxiter", new CUIntParameter(m_maxiter, 1, numeric_limits<int>::max(), false, 
-                                                    "Stopping criterion: the maximum number of iterations")); 
+	add_parameter("maxiter", new CUIBoundedParameter(m_maxiter, EParameterBounds::bf_min_closed, {1}, false, 
+							 "Stopping criterion: the maximum number of iterations")); 
 	
-	add_parameter("min-step", new CDoubleParameter(m_min_step, 1e-10, HUGE_VAL, false, "Maximal absolute step size")); 
-	add_parameter("max-step", new CDoubleParameter(m_max_step, 1.0, HUGE_VAL, false, "Minimal absolute step size")); 
-	add_parameter("xtola", new CDoubleParameter(m_xtol, 0.0, HUGE_VAL, false, 
-						    "Stop if the inf-norm of the change applied to x is below this value."));
-	add_parameter("ftolr", new CDoubleParameter(m_ftolr, 0.0, HUGE_VAL, false, 
-						    "Stop if the relative change of the criterion is below."));
+	add_parameter("min-step", new CDBoundedParameter(m_min_step, EParameterBounds::bf_min_open, {0.0}, false,
+							 "Minimal absolute step size"));
+	
+	add_parameter("max-step", new CDBoundedParameter(m_max_step, EParameterBounds::bf_min_open, {0.0}, false,
+							 "Maximal absolute step size"));
+	
+	add_parameter("xtola", new CDBoundedParameter(m_xtol, EParameterBounds::bf_min_closed, {0.0}, false, 
+						      "Stop if the inf-norm of the change applied to x is below this value."));
+	
+	add_parameter("ftolr", new CDBoundedParameter(m_ftolr, EParameterBounds::bf_min_closed, {0.0},false, 
+						      "Stop if the relative change of the criterion is below."));
 }
 
 
diff --git a/mia/core/minimizer/gdas.hh b/mia/core/minimizer/gdas.hh
index f444eea..5095416 100644
--- a/mia/core/minimizer/gdas.hh
+++ b/mia/core/minimizer/gdas.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/minimizer/gdsq.cc b/mia/core/minimizer/gdsq.cc
index a0dba33..92981b3 100644
--- a/mia/core/minimizer/gdsq.cc
+++ b/mia/core/minimizer/gdsq.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -132,17 +132,21 @@ CGDSQMinimizerPlugin::CGDSQMinimizerPlugin():
 	m_step_scale(2.0), 
 	m_min_step(1e-6)
 {
-	add_parameter("maxiter", new CUIntParameter(m_maxiter, 1, numeric_limits<int>::max(), false, 
-						   "Stopping criterion: the maximum number of iterations")); 
+	add_parameter("maxiter", new CUIBoundedParameter(m_maxiter, EParameterBounds::bf_min_closed, {1}, false,
+							 "Stopping criterion: the maximum number of iterations")); 
 	
-	add_parameter("step", new CDoubleParameter(m_start_step, 0.0, HUGE_VAL, false, "Initial step size")); 
-	add_parameter("scale", new CDoubleParameter(m_step_scale, 1.0, HUGE_VAL, false, "Fallback fixed step size scaling")); 
-	add_parameter("xtola", new CDoubleParameter(m_xtol, 0.0, HUGE_VAL, false, 
-						    "Stop if the inf-norm of x-update is below this value.")); 
-	add_parameter("gtola", new CDoubleParameter(m_gtol, 0.0, HUGE_VAL, false, 
-						    "Stop if the inf-norm of the gradient is below this value."));
-	add_parameter("ftolr", new CDoubleParameter(m_ftolr, 0.0, HUGE_VAL, false, 
-						    "Stop if the relative change of the criterion is below."));
+	add_parameter("step", new CDBoundedParameter(m_start_step, EParameterBounds::bf_min_open, {0.0f},
+						     false, "Initial step size"));
+	
+	add_parameter("scale", new CDBoundedParameter(m_step_scale, EParameterBounds::bf_min_open, {1.0f},
+						      false, "Fallback fixed step size scaling"));
+	
+	add_parameter("xtola", new CDBoundedParameter(m_xtol, EParameterBounds::bf_min_closed, {0.0}, false, 
+						      "Stop if the inf-norm of x-update is below this value.")); 
+	add_parameter("gtola", new CDBoundedParameter(m_gtol, EParameterBounds::bf_min_closed, {0.0}, false, 
+						      "Stop if the inf-norm of the gradient is below this value."));
+	add_parameter("ftolr", new CDBoundedParameter(m_ftolr, EParameterBounds::bf_min_closed, {0.0}, false, 
+						      "Stop if the relative change of the criterion is below."));
 }
 
 	
diff --git a/mia/core/minimizer/gdsq.hh b/mia/core/minimizer/gdsq.hh
index aa33fa6..200a81e 100644
--- a/mia/core/minimizer/gdsq.hh
+++ b/mia/core/minimizer/gdsq.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/minimizer/gsl.cc b/mia/core/minimizer/gsl.cc
index f8b9670..9576b42 100644
--- a/mia/core/minimizer/gsl.cc
+++ b/mia/core/minimizer/gsl.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -210,7 +210,7 @@ void CGSLFMinimizer::do_set_problem()
 
 int CGSLFMinimizer::do_run(CDoubleVector& x)
 {
-	int iter = 0; 
+	unsigned iter = 0; 
 	int status;  
 	shared_ptr<gsl_vector> init_x(gsl_vector_alloc(x.size()), DeallocGSLVector()); 
 	copy(x.begin(), x.end(), init_x->data);  
@@ -260,17 +260,19 @@ CGSLMinimizerPlugin::CGSLMinimizerPlugin():
 	add_parameter("opt", new CGSLMinimizerParam(m_ot, CGSLMinimizerDict(minimizer_table), 
 						    "Specific optimizer to be used."));
 	
-	add_parameter("tol", new CDoubleParameter(m_gorth_tolerance, 0.001, 10.0, false, 
-						"some tolerance parameter"));
+	add_parameter("tol", new CDBoundedParameter(m_gorth_tolerance, EParameterBounds::bf_min_open, {0.0f}, false, 
+						    "some tolerance parameter"));
+	
+	add_parameter("eps", new CDBoundedParameter(m_stop_eps, EParameterBounds::bf_min_open, {0.0f}, 
+						    false, 
+						    "gradient based optimizers: stop when |grad| < eps, "
+						    "simplex: stop when simplex size < eps."));
 	
-	add_parameter("eps", new CDoubleParameter(m_stop_eps, 1e-10, 10.0, false, 
-						  "gradient based optimizers: stop when |grad| < eps, "
-						  "simplex: stop when simplex size < eps."));
+	add_parameter("iter", new CUIBoundedParameter(m_maxiter, EParameterBounds::bf_min_closed, {1},
+						      false, "maximum number of iterations"));
 	
-	add_parameter("iter", new CIntParameter(m_maxiter, 1, numeric_limits<int>::max(), 
-						false, "maximum number of iterations"));
-	add_parameter("step", new CDoubleParameter(m_start_step, 0, 10, false, 
-						 "initial step size"));
+	add_parameter("step", new CDBoundedParameter(m_start_step, EParameterBounds::bf_min_open, {0.0f},  false, 
+						     "initial step size"));
 }						
 
 const std::string CGSLMinimizerPlugin::do_get_descr() const
diff --git a/mia/core/minimizer/gsl.hh b/mia/core/minimizer/gsl.hh
index 08295ae..67c2e0e 100644
--- a/mia/core/minimizer/gsl.hh
+++ b/mia/core/minimizer/gsl.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -77,7 +77,7 @@ private:
 	gsl_multimin_fminimizer *m_s; 
 	double m_stop_eps; 
 	gsl_multimin_function m_func; 
-	int m_maxiter;  
+	unsigned m_maxiter;  
 	double m_start_step;
 	gsl_vector *m_step_init; 	
 }; 
@@ -105,7 +105,7 @@ private:
 	EGSLOptimizer m_ot;
 	double m_gorth_tolerance; 
 	double m_stop_eps; 
-	int m_maxiter;  
+	unsigned m_maxiter;  
 	double m_start_step;
 
 
diff --git a/mia/core/minimizer/test_gdas.cc b/mia/core/minimizer/test_gdas.cc
index 6318a0b..4b1b12d 100644
--- a/mia/core/minimizer/test_gdas.cc
+++ b/mia/core/minimizer/test_gdas.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/minimizer/test_gdsq.cc b/mia/core/minimizer/test_gdsq.cc
index 2df3b7e..647aaa0 100644
--- a/mia/core/minimizer/test_gdsq.cc
+++ b/mia/core/minimizer/test_gdsq.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/minimizer/test_gsl.cc b/mia/core/minimizer/test_gsl.cc
index 71ca187..2aedd22 100644
--- a/mia/core/minimizer/test_gsl.cc
+++ b/mia/core/minimizer/test_gsl.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/mitestimages.cc b/mia/core/mitestimages.cc
index 04aff6c..b88074c 100644
--- a/mia/core/mitestimages.cc
+++ b/mia/core/mitestimages.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/mitestimages.hh b/mia/core/mitestimages.hh
index df3f1db..1f09769 100644
--- a/mia/core/mitestimages.hh
+++ b/mia/core/mitestimages.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/module.cc b/mia/core/module.cc
index 8883b5f..2796d7e 100644
--- a/mia/core/module.cc
+++ b/mia/core/module.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -62,6 +62,16 @@ const std::string& CPluginModule::get_name() const
 	return m_name; 
 }
 
+void CPluginModule::set_unload_library()
+{
+	m_loader.set_unload_library(); 
+}
+
+void CPluginModule::set_keep_library()
+{
+	m_loader.set_keep_library(); 
+}
+
 CPluginBase *CPluginModule::get_interface() const
 {
 	FPluginInterface f = reinterpret_cast<FPluginInterface>(m_loader.get_function("get_plugin_interface"));
diff --git a/mia/core/module.hh b/mia/core/module.hh
index 2adc31f..9043685 100644
--- a/mia/core/module.hh
+++ b/mia/core/module.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -52,7 +52,6 @@ public:
 	   an \a invalid_argument exception, if the module can not be loaded
 	*/
 	CPluginModule(const char *path);
-
 	~CPluginModule();
 
 	/**
@@ -64,6 +63,11 @@ public:
 	///\returns the file name of the module
 	const std::string& get_name() const; 
 
+	/** tell the DLL loader that it should unload this library
+	    when the modules is destroyed */ 
+	void set_unload_library(); 
+
+	void set_keep_library(); 
 private:
 	CDLLoader m_loader;
 	std::string m_name;
diff --git a/mia/core/msgstream.cc b/mia/core/msgstream.cc
index 5d56020..653f0d0 100644
--- a/mia/core/msgstream.cc
+++ b/mia/core/msgstream.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/msgstream.hh b/mia/core/msgstream.hh
index 1c921d0..e71de21 100644
--- a/mia/core/msgstream.hh
+++ b/mia/core/msgstream.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/nccsum.cc b/mia/core/nccsum.cc
index e893a45..95e9728 100644
--- a/mia/core/nccsum.cc
+++ b/mia/core/nccsum.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/nccsum.hh b/mia/core/nccsum.hh
index e776a1b..d7e6b3e 100644
--- a/mia/core/nccsum.hh
+++ b/mia/core/nccsum.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/noise/CMakeLists.txt b/mia/core/noise/CMakeLists.txt
index 22c2a5f..623ed6e 100644
--- a/mia/core/noise/CMakeLists.txt
+++ b/mia/core/noise/CMakeLists.txt
@@ -1,6 +1,6 @@
 #
 # This file is part of MIA - a toolbox for medical image analysis 
-# Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+# 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
diff --git a/mia/core/noise/gauss.cc b/mia/core/noise/gauss.cc
index b2905ec..5fa4676 100644
--- a/mia/core/noise/gauss.cc
+++ b/mia/core/noise/gauss.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -41,8 +41,6 @@ NS_BEGIN(gauss_noise_generator)
 using namespace std;
 using namespace mia;
 
-static const size_t center = 1024;
-
 double CGaussNoiseGenerator::box_muller()const	/* normal random variate generator */
 {
 	double x1, x2, w, y1;
@@ -86,17 +84,12 @@ CGaussNoiseGeneratorFactory::CGaussNoiseGeneratorFactory():
 	m_param_mu(0.0f),
 	m_param_sigma(1.0f)
 {
-	add_parameter("mu", new CFloatParameter(m_param_mu, -numeric_limits<float>::max(),
-								       numeric_limits<float>::max(),
-								       false, "mean of distribution"));
-
-	add_parameter("sigma", new CFloatParameter(m_param_sigma, 0.0f,
-								       numeric_limits<float>::max(),
-								       false, "standard derivation of distribution"));
-
-	add_parameter("seed", new CUIntParameter(m_param_seed, 0,   numeric_limits<unsigned int>::max(),
-						  false, "set random seed (0=init based on system time)"));
+	add_parameter("mu", new CTParameter<float>(m_param_mu, false, "mean of distribution"));
+	add_parameter("sigma", new CFBoundedParameter(m_param_sigma, EParameterBounds::bf_min_open, {0.0}, 
+						      false, "standard derivation of distribution"));
 
+	add_parameter("seed", new CUIBoundedParameter(m_param_seed, EParameterBounds::bf_min_closed, {0},
+						      false, "set random seed (0=init based on system time)"));
 }
 
 CNoiseGenerator *
diff --git a/mia/core/noise/gauss.hh b/mia/core/noise/gauss.hh
index bff7619..737a910 100644
--- a/mia/core/noise/gauss.hh
+++ b/mia/core/noise/gauss.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/noise/test_gauss.cc b/mia/core/noise/test_gauss.cc
index 1a229e7..423cbbc 100644
--- a/mia/core/noise/test_gauss.cc
+++ b/mia/core/noise/test_gauss.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/noise/test_uniform.cc b/mia/core/noise/test_uniform.cc
index 76f1902..a17bfab 100644
--- a/mia/core/noise/test_uniform.cc
+++ b/mia/core/noise/test_uniform.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/noise/uniform.cc b/mia/core/noise/uniform.cc
index 686c53e..25b0981 100644
--- a/mia/core/noise/uniform.cc
+++ b/mia/core/noise/uniform.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -29,8 +29,6 @@ NS_BEGIN(uniform_noise_generator)
 using namespace std;
 using namespace mia;
 
-static const size_t center = 1024;
-
 CUniformNoiseGenerator::CUniformNoiseGenerator(unsigned int seed, double a, double b):
 	CNoiseGenerator(seed),
 	m_a(a),
@@ -50,15 +48,11 @@ CUniformNoiseGeneratorFactory::CUniformNoiseGeneratorFactory():
 	m_param_a(0),
 	m_param_b(1)
 {
-	add_parameter("a", new CFloatParameter(m_param_a, -numeric_limits<float>::max(),
-								       numeric_limits<float>::max(),
-								       false, "lower bound if noise range"));
+	add_parameter("a", new CTParameter<float>(m_param_a, false, "lower bound if noise range"));
 
-	add_parameter("b", new CFloatParameter(m_param_b, -numeric_limits<float>::max(),
-								       numeric_limits<float>::max(),
-								       false, "higher bound if noise range"));
-	add_parameter("seed", new CUIntParameter(m_param_seed, 0,   numeric_limits<unsigned int>::max(),
-						  false, "set random seed (0=init based on system time)"));
+	add_parameter("b", new CTParameter<float>(m_param_b, false, "higher bound if noise range"));
+	add_parameter("seed", new CUIBoundedParameter(m_param_seed, EParameterBounds::bf_min_closed, {0}, 
+						     false, "set random seed (0=init based on system time)"));
 
 }
 
diff --git a/mia/core/noise/uniform.hh b/mia/core/noise/uniform.hh
index 4ed99df..1abf532 100644
--- a/mia/core/noise/uniform.hh
+++ b/mia/core/noise/uniform.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/noisegen.cc b/mia/core/noisegen.cc
index 991d7cd..0356dbf 100644
--- a/mia/core/noisegen.cc
+++ b/mia/core/noisegen.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/noisegen.hh b/mia/core/noisegen.hh
index f464eb5..bb2456d 100644
--- a/mia/core/noisegen.hh
+++ b/mia/core/noisegen.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/optionparser.cc b/mia/core/optionparser.cc
index 949fcda..3a858ee 100644
--- a/mia/core/optionparser.cc
+++ b/mia/core/optionparser.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/optionparser.hh b/mia/core/optionparser.hh
index ae760a4..f3ff7e8 100644
--- a/mia/core/optionparser.hh
+++ b/mia/core/optionparser.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/optparam.cc b/mia/core/optparam.cc
index 24dc05f..312f038 100644
--- a/mia/core/optparam.cc
+++ b/mia/core/optparam.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -89,12 +89,12 @@ void CParamList::print_help(std::ostream& os) const
 	os << "\n"; 
 }
 
-void CParamList::get_help_xml(xmlpp::Element& root)const
+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"; 
-		xmlpp::Element *p = root.add_child("param"); 
+		CXMLElement *p = root.add_child("param"); 
 		p->set_attribute("name", i->first); 
 		i->second->get_help_xml(*p); 
 	}
diff --git a/mia/core/optparam.hh b/mia/core/optparam.hh
index 9f3c305..8738801 100644
--- a/mia/core/optparam.hh
+++ b/mia/core/optparam.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -26,7 +26,7 @@
 
 #include <mia/core/parameter.hh>
 #include <mia/core/optionparser.hh>
-#include <libxml++/libxml++.h>
+#include <mia/core/xmlinterface.hh>
 
 
 NS_MIA_BEGIN
@@ -82,7 +82,7 @@ public:
 	   Append the help for this parameter list to the given root node
 	   \param[in,out] root the root node of the XML tree 
 	 */
-	void get_help_xml(xmlpp::Element& root)const;  
+	void get_help_xml(CXMLElement& root)const;  
 
 	/**
 	   Add all plug-in handlers that may be called by processing this parameter list 
diff --git a/mia/core/parameter.cc b/mia/core/parameter.cc
index a02794f..37728be 100644
--- a/mia/core/parameter.cc
+++ b/mia/core/parameter.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -20,7 +20,7 @@
 
 #define VSTREAM_DOMAIN "core-parameter"
 #include <sstream>
-#include <libxml++/libxml++.h>
+#include <mia/core/xmlinterface.hh>
 #include <mia/core/parameter.hh>
 #include <mia/core/parameter.cxx>
 
@@ -51,7 +51,7 @@ const char *CParameter::type() const
 	return m_type;
 }
 
-void CParameter::get_help_xml(xmlpp::Element& param) const
+void CParameter::get_help_xml(CXMLElement& param) const
 {
 	TRACE_FUNCTION; 
 	param.set_attribute("type", m_type); 
@@ -65,7 +65,7 @@ void CParameter::get_help_xml(xmlpp::Element& param) const
 	}
 }
 
-void CParameter::do_get_help_xml(xmlpp::Element& /*param*/) const
+void CParameter::do_get_help_xml(CXMLElement& /*param*/) const
 {
 }
 
@@ -167,12 +167,12 @@ void CStringParameter::do_descr(std::ostream& os) const
 		m_plugin_hint->print_help(os); 
 }
 
-void CStringParameter::do_get_help_xml(xmlpp::Element& self) const
+void CStringParameter::do_get_help_xml(CXMLElement& self) const
 {
 	TRACE_FUNCTION; 
 	if (m_plugin_hint)  {
 		auto type = m_plugin_hint->get_handler_type_string(); 
-		auto dict = self.add_child(type); 
+		auto dict = self.add_child(type.c_str()); 
 		dict->set_attribute("name", m_plugin_hint->get_descriptor());
 		self.set_attribute("type", type); 
 	}
@@ -197,14 +197,138 @@ void CStringParameter::do_add_dependend_handler(HandlerHelpMap& handler_map)cons
 		m_plugin_hint->add_dependend_handlers(handler_map); 
 }
 
-template class TRangeParameter<unsigned short>;
-template class TRangeParameter<unsigned int>;
-template class TRangeParameter<unsigned long>;
-template class TRangeParameter<short>;
-template class TRangeParameter<int>;
-template class TRangeParameter<long>;
-template class TRangeParameter<float>;
-template class TRangeParameter<double>; 
+template <typename T> 
+TBoundedParameter<T>::TBoundedParameter(T& value, EParameterBounds flags, 
+					const vector<T>& boundaries, 
+					bool required, const char *descr): 
+	CTParameter<T>(value, required, descr),
+	// this silences coverty warnings but it should actually not be necessary 
+	m_min(T()),
+	m_max(T()),
+	m_flags(flags)
+{
+	assert(!boundaries.empty());
+	unsigned idx = 0; 
+
+	if (has_flag(flags, EParameterBounds::bf_min)) {
+		m_min = boundaries[0]; 
+		++idx; 
+	}
+	if (has_flag(flags, EParameterBounds::bf_max)) {
+		assert(boundaries.size() > idx); 
+		m_max = boundaries[idx]; 
+	}
+}
+
+template <typename T> 
+void TBoundedParameter<T>::adjust(T& value)
+{
+	if (has_flag(m_flags, EParameterBounds::bf_min_closed)&& value < m_min) {
+		throw create_exception<invalid_argument>("Parameters value ", value, " given, but ", 
+							 "expected a value >= ", m_min, ". Parameter is ", 
+							 this->get_descr(), " flags=", m_flags); 
+	}
+	if (has_flag(m_flags, EParameterBounds::bf_min_open) && value <= m_min) {
+		throw create_exception<invalid_argument>("Parameters value ", value, " given, but ",
+							 "expected a value > ", m_min, ". Parameter is ", 
+							 this->get_descr(), " flags=", m_flags); 
+	}
+
+	if (has_flag(m_flags, EParameterBounds::bf_max_closed)&& value > m_max) {
+		throw create_exception<invalid_argument>("Parameters value ", value, " given, but ",
+							 "expected a value <= ", m_max, ". Parameter is ", 
+							 this->get_descr(), " flags=", m_flags); 
+	}
+	if (has_flag(m_flags, EParameterBounds::bf_max_open) && value >= m_max) {
+		throw create_exception<invalid_argument>("Parameters value ", value, " given, but "
+							 "expected a value < ", m_max, ". Parameter is ", 
+							 this->get_descr(), " flags=", m_flags ); 
+	}
+}
+
+template <typename T> 
+void TBoundedParameter<T>::do_get_help_xml(CXMLElement& self) const
+{
+	TRACE_FUNCTION; 
+	auto dict = self.add_child("bounded"); 
+
+	stringstream min_str; 
+	
+	if (has_flag(m_flags, EParameterBounds::bf_min_closed))
+		min_str << "[" << m_min; 
+	else if (has_flag(m_flags,EParameterBounds::bf_min_open))
+		min_str << "(" << m_min; 
+	else if (numeric_limits<T>::is_signed) 
+		min_str << "(-inf"; 
+	else 
+		min_str << "[0"; 
+	
+	dict->set_attribute("min", min_str.str()); 
+
+	stringstream max_str; 
+	if (has_flag(m_flags,EParameterBounds::bf_max_closed))
+		max_str << m_max << "]"; 
+	else if (has_flag(m_flags,EParameterBounds::bf_max_open))
+		max_str << m_max << ")"; 
+	else 
+		max_str << "inf)";
+	
+	dict->set_attribute("max", max_str.str()); 
+
+}
+
+template <typename T> 
+void TBoundedParameter<T>::do_descr(std::ostream& os) const
+{
+	CTParameter<T>::do_descr(os); 
+	
+	os << " in "; 
+	if (has_flag(m_flags, EParameterBounds::bf_min_closed))
+		os << "[" << m_min; 
+	else if (has_flag(m_flags, EParameterBounds::bf_min_open))
+		os << "(" << m_min; 
+	else if (numeric_limits<T>::is_signed) 
+		os << "(-inf"; 
+	else 
+		os << "[0"; 
+
+	os << ", "; 
+	
+	if (has_flag(m_flags, EParameterBounds::bf_max_closed))
+		os << m_max << "]"; 
+	else if (has_flag(m_flags, EParameterBounds::bf_max_open))
+		os << m_max << ")"; 
+	else 
+		os << "inf)";
+}
+
+EXPORT_CORE std::ostream& operator << (std::ostream& os, EParameterBounds flags)
+{
+	auto min_flags = flags & EParameterBounds::bf_min_flags; 
+	if (min_flags == EParameterBounds::bf_min_open) 
+		os << "min(o) "; 
+	if (min_flags == EParameterBounds::bf_min_closed) 
+		os << "min[c] ";
+	
+	auto max_flags = flags & EParameterBounds::bf_max_flags; 
+	if (max_flags == EParameterBounds::bf_max_open) 
+		os << "max(o)"; 
+	if (max_flags == EParameterBounds::bf_max_closed) 
+		os << "max[c]";
+	return os; 
+}
+
+
+
+template class TBoundedParameter<unsigned short>;
+template class TBoundedParameter<unsigned int>;
+template class TBoundedParameter<unsigned long>;
+template class TBoundedParameter<short>;
+template class TBoundedParameter<int>;
+template class TBoundedParameter<long>;
+template class TBoundedParameter<float>;
+template class TBoundedParameter<double>; 
+
 
 template class CTParameter<unsigned short>;
 template class CTParameter<unsigned int>;
diff --git a/mia/core/parameter.cxx b/mia/core/parameter.cxx
index 39058b6..83884a3 100644
--- a/mia/core/parameter.cxx
+++ b/mia/core/parameter.cxx
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -55,6 +55,18 @@ void CTParameter<T>::do_descr(std::ostream& /*os*/) const
 template <typename T>
 struct __dispatch_parameter_do_set {
 	static bool apply (const std::string& str_value, T& value) {
+		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 "
+									      "that is comprised of whitespaces only"); 
+			}
+			if (str_value[startpos] == '-') {
+				throw create_exception<std::invalid_argument>("Try setting an unsigned value with negative value ", str_value); 
+			}
+		}
+		
+
 		char c; 
 		std::istringstream s(str_value); 
 		s >> value; 
@@ -115,6 +127,7 @@ struct __dispatch_parameter_do_set<std::string> {
 template <typename T> 
 bool CTParameter<T>::do_set(const std::string& str_value)
 {
+	
 	bool retval = __dispatch_parameter_do_set<T>::apply(str_value, m_value); 
 	adjust(m_value); 
 	return retval; 
@@ -159,47 +172,4 @@ std::string CTParameter<T>::do_get_default_value() const
 	return str; 
 }
 
-template <typename T> 
-TRangeParameter<T>::TRangeParameter(T& value, T min, T max, bool required, const char *descr):
-	CTParameter<T>(value, required, descr),
-	m_min(min), 
-	m_max(max)
-{
-	if (m_min > m_max) 
-		throw create_exception<std::invalid_argument>("Parameter '",descr,"' TRangeParameter<T,", __type_descr<T>::value , ">: min(" 
-						    , m_min ,") > max (", m_max , ")  not allowed"); 
-}
-
-template <typename T> 
-void TRangeParameter<T>::adjust(T& value)
-{
-	if (value < m_min) {
-		cvwarn() << "TRangeParameter<T>: adjust " << value <<" to lower bound " << m_min << "\n"; 
-		value = m_min; 
-	}
-
-	
-	if (value > m_max) {
-		cvwarn() << "TRangeParameter<T>: adjust " << value <<" to upper bound " << m_max << "\n"; 
-		value = m_max; 
-	}
-}
-
-template <typename T> 
-void TRangeParameter<T>::do_descr(std::ostream& os) const
-{
-	CTParameter<T>::do_descr(os); 
-	os << " in [" << m_min << "," << m_max << "] ";
-}
-
-template <typename T> 
-void TRangeParameter<T>::do_get_help_xml(xmlpp::Element& self) const
-{
-	TRACE_FUNCTION; 
-	auto dict = self.add_child("range"); 
-	dict->set_attribute("min", to_string<T>(m_min)); 
-	dict->set_attribute("max", to_string<T>(m_max)); 
-}
-
-
 NS_MIA_END
diff --git a/mia/core/parameter.hh b/mia/core/parameter.hh
index 359f511..286f944 100644
--- a/mia/core/parameter.hh
+++ b/mia/core/parameter.hh
@@ -1,10 +1,11 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
+ * it under the terms of the GNU General Pub
+lic License as published by
  * the Free Software Foundation; either version 3 of the License, or
  * (at your option) any later version.
  *
@@ -26,16 +27,14 @@
 #include <ostream>
 #include <istream>
 #include <sstream>
+#include <memory>
+#include <mia/core/flags.hh>
 #include <mia/core/dictmap.hh>
 #include <mia/core/msgstream.hh>
 #include <mia/core/handlerbase.hh>
 #include <mia/core/factory_trait.hh>
 #include <mia/core/cmdoptionflags.hh>
 
-namespace xmlpp {
-	class Element; 
-}
-
 NS_MIA_BEGIN
 
 /**
@@ -115,7 +114,7 @@ q	*/
 	   Add the help for this parameter to a given XML tree
 	   \param root the root node to add the help entry to. 
 	 */
-	void get_help_xml(xmlpp::Element& root) const;
+	void get_help_xml(CXMLElement& root) const;
 
 
 	/**
@@ -144,7 +143,7 @@ private:
 	virtual void do_reset() = 0;
 	virtual std::string do_get_default_value() const = 0;
 	virtual std::string do_get_value_as_string() const = 0;
-	virtual void do_get_help_xml(xmlpp::Element& self) const;
+	virtual void do_get_help_xml(CXMLElement& self) const;
 	bool m_required;
 	bool m_is_required; 
 	const char *m_type;
@@ -194,18 +193,52 @@ private:
    to a value outside the range, the set method will throw an \a invalid_argument exception
 */
 
+
+
+/**
+   \ingroup cmdline
+   \brief Scalar parameter with a expected value boundaries 
+
+   A scalar parameter that supports specifying boundaries. These boundaries can be one-sided 
+   or on both sides, and the boundaries can be included in the range or not. 
+   If the user tries to set the parameter to a value outside the range, 
+   the set method will throw an \a invalid_argument exception
+*/
+
+enum class EParameterBounds : int {
+	bf_min = 1,  
+	bf_min_open = 3, 
+	bf_min_closed = 5, 
+	bf_min_flags = 7, 
+	bf_max = 0x10, 
+	bf_max_open = 0x30, 
+	bf_max_closed =  0x50, 
+	bf_max_flags = 0x70,
+	bf_closed_interval = 0x55, 
+	bf_open_interval = 0x33 
+	}; 
+
+IMPLEMENT_FLAG_OPERATIONS(EParameterBounds); 
+
+
+EXPORT_CORE std::ostream& operator << (std::ostream& os, EParameterBounds flags); 
+
 template <typename T>
-class EXPORT_CORE TRangeParameter : public CTParameter<T> {
+class EXPORT_CORE TBoundedParameter : public CTParameter<T> {
 
 public:
+
 	/** Constructor
 	   \param value reference to the parameter handled by this parameter object
-	   \param min minimum of the parameter value range
-	   \param max maximum of the parameter value range
+	   \param flags boundary flags 
+	   \param boundaries the boundaries of the parameter. Depending on the flags 
+	   it expects one or two values. If two values are given the first value is interpreted 
+	   as the lower boundary, 
+	   \param flags boundary flags 
 	   \param required set to \a true if the parameter has to be set by the user
 	   \param descr a description of the parameter
 	 */
-	TRangeParameter(T& value, T min, T max, bool required, const char *descr);
+	TBoundedParameter(T& value, EParameterBounds flags, const std::vector<T>& boundaries, bool required, const char *descr);
 protected:
 	/**
 	   the implementation of the description-function
@@ -213,12 +246,90 @@ protected:
 	void do_descr(std::ostream& os) const;
 private:
 	virtual void adjust(T& value);
-	virtual void do_get_help_xml(xmlpp::Element& self) const;
+	virtual void do_get_help_xml(CXMLElement& self) const;
 	T m_min;
 	T m_max;
-
+	EParameterBounds m_flags; 
 };
 
+template <typename T>
+CParameter *make_param(T& value, bool required, const char *descr)
+{
+	return new CTParameter<T>(value, required, descr); 
+}
+
+
+template <typename T, typename S>
+CParameter *make_lo_param(T& value, S lower_bound, bool required, const char *descr)
+{
+	return new TBoundedParameter<T>(value, EParameterBounds::bf_min_open,
+		{static_cast<T>(lower_bound)}, required, descr); 
+}
+
+template <typename T>
+CParameter *make_positive_param(T& value, bool required, const char *descr)
+{
+	return new TBoundedParameter<T>(value, EParameterBounds::bf_min_open, {T()}, required, descr); 
+}
+
+template <typename T, typename S>
+CParameter *make_lc_param(T& value, S lower_bound, bool required, const char *descr)
+{
+	return new TBoundedParameter<T>(value, EParameterBounds::bf_min_closed,
+		{static_cast<T>(lower_bound)}, required, descr); 
+}
+
+
+template <typename T>
+CParameter *make_nonnegative_param(T& value, bool required, const char *descr)
+{
+	return new TBoundedParameter<T>(value, EParameterBounds::bf_min_closed, {T()}, required, descr); 
+}
+
+
+template <typename T, typename S>
+CParameter *make_uo_param(T& value, S upper_bound, bool required, const char *descr)
+{
+	return new TBoundedParameter<T>(value, EParameterBounds::bf_min_open,
+		{static_cast<T>(upper_bound)}, required, descr); 
+}
+
+template <typename T, typename S>
+CParameter *make_uc_param(T& value, S upper_bound, bool required, const char *descr)
+{
+	return new TBoundedParameter<T>(value, EParameterBounds::bf_min_closed,
+		{static_cast<T>(upper_bound)}, required, descr); 
+}
+
+template <typename T, typename S1, typename S2>
+CParameter *make_ci_param(T& value, S1 lower_bound, S2 upper_bound, bool required, const char *descr)
+{
+	return new TBoundedParameter<T>(value, EParameterBounds::bf_closed_interval,
+		{static_cast<T>(lower_bound), static_cast<T>(upper_bound)}, required, descr); 
+}
+
+template <typename T, typename S1, typename S2>
+CParameter *make_oi_param(T& value, S1 lower_bound, S2 upper_bound, bool required, const char *descr)
+{
+	return new TBoundedParameter<T>(value, EParameterBounds::bf_open_interval,
+		{static_cast<T>(lower_bound), static_cast<T>(upper_bound)}, required, descr); 
+}
+
+template <typename T, typename S1, typename S2>
+CParameter *make_coi_param(T& value, S1 lower_bound, S2 upper_bound,bool required, const char *descr)
+{
+	return new TBoundedParameter<T>(value, EParameterBounds::bf_min_closed | EParameterBounds::bf_max_open,
+		{static_cast<T>(lower_bound), static_cast<T>(upper_bound)}, required, descr); 
+}
+
+template <typename T, typename S1, typename S2>
+CParameter *make_oci_param(T& value, S1 lower_bound, S2 upper_bound,bool required, const char *descr)
+{
+	return new TBoundedParameter<T>(value, EParameterBounds::bf_max_closed | EParameterBounds::bf_min_open,
+		{static_cast<T>(lower_bound), static_cast<T>(upper_bound)}, required, descr); 
+}
+
+
 
 /**
    \ingroup cmdline
@@ -249,7 +360,7 @@ private:
 	virtual void do_reset();
 	virtual std::string do_get_default_value() const; 
 	virtual std::string do_get_value_as_string() const;
-	virtual void do_get_help_xml(xmlpp::Element& self) const;
+	virtual void do_get_help_xml(CXMLElement& self) const;
 	T& m_value;
 	T m_default_value; 
 	const TDictMap<T> m_dict;
@@ -301,7 +412,7 @@ private:
 	virtual void do_reset();
 	virtual std::string do_get_default_value() const; 
 	virtual std::string do_get_value_as_string() const;
-	virtual void do_get_help_xml(xmlpp::Element& self) const;
+	virtual void do_get_help_xml(CXMLElement& self) const;
 
 	typename F::ProductPtr dummy_shared_value; 
 	typename F::UniqueProduct dummy_unique_value; 
@@ -351,7 +462,7 @@ private:
 	virtual void do_reset();
 	virtual std::string do_get_default_value() const; 
 	virtual std::string do_get_value_as_string() const;
-	void do_get_help_xml(xmlpp::Element& self) const; 
+	void do_get_help_xml(CXMLElement& self) const; 
 	T& m_value;
 	T m_default_value; 
 	const std::set<T> m_valid_set;
@@ -406,7 +517,7 @@ private:
 	virtual std::string do_get_value_as_string() const; 
 
 	virtual void do_descr(std::ostream& os) const;
-	virtual void do_get_help_xml(xmlpp::Element& self) const;
+	virtual void do_get_help_xml(CXMLElement& self) const;
 	virtual void do_add_dependend_handler(HandlerHelpMap& handler_map)const; 
 
 
@@ -417,17 +528,29 @@ private:
 }; 
 
 
-/// an integer parameter (with range)
-typedef TRangeParameter<int> CIntParameter;
-/// an unsigned integer parameter (with range)
-typedef TRangeParameter<unsigned int> CUIntParameter;
-/// a float parameter (with range)
-typedef TRangeParameter<float> CFloatParameter;
-/// a double parameter (with range)
-typedef TRangeParameter<double> CDoubleParameter;
 /// boolean parameter
 typedef CTParameter<bool> CBoolParameter;
 
+
+/// an unsigned short parameter (with possible boundaries)
+typedef TBoundedParameter<unsigned short> CUSBoundedParameter;
+/// an unsigned int parameter (with possible boundaries)
+typedef TBoundedParameter<unsigned int> CUIBoundedParameter;
+/// an unsigned long parameter (with possible boundaries)
+typedef TBoundedParameter<unsigned long> CULBoundedParameter;
+
+/// an signed short parameter (with possible boundaries)
+typedef TBoundedParameter<short> CSSBoundedParameter;
+/// an signed int parameter (with possible boundaries)
+typedef TBoundedParameter<int>   CSIBoundedParameter;
+/// an signed long parameter (with possible boundaries)
+typedef TBoundedParameter<long>  CSLBoundedParameter;
+
+/// an float parameter, single accuracy (with possible boundaries)
+typedef TBoundedParameter<float> CFBoundedParameter;
+/// an float parameter, double accuracy (with possible boundaries)
+typedef TBoundedParameter<double> CDBoundedParameter; 
+
 /**    
       \ingroup cmdline
       \brief create a factory parameter that initializes to a std::shared_ptr
@@ -474,12 +597,6 @@ CParameter *make_param(std::unique_ptr<T>& value, const std::string& init,  bool
 }
 
 
-template <typename T> 
-CParameter *make_param(T& value, bool required, const char *descr) 
-{                       
-	return new TParameter<T>(value, required, descr);
-}
-
 
 
 //// implementations 
@@ -530,7 +647,7 @@ void CDictParameter<T>::do_descr(std::ostream& os) const
 }
 
 template <typename T>
-void CDictParameter<T>::do_get_help_xml(xmlpp::Element& self) const
+void CDictParameter<T>::do_get_help_xml(CXMLElement& self) const
 {
 	TRACE_FUNCTION; 
 	auto dict = self.add_child("dict"); 
@@ -599,7 +716,7 @@ void TFactoryParameter<T>::do_descr(std::ostream& os) const
 }
 
 template <typename T>
-void TFactoryParameter<T>::do_get_help_xml(xmlpp::Element& self) const
+void TFactoryParameter<T>::do_get_help_xml(CXMLElement& self) const
 {
 	auto dict = self.add_child("factory"); 
 	dict->set_attribute("name", T::instance().get_descriptor());
@@ -697,7 +814,7 @@ void CSetParameter<T>::do_descr(std::ostream& os) const
 }
 
 template <typename T>
-void CSetParameter<T>::do_get_help_xml(xmlpp::Element& self) const
+void CSetParameter<T>::do_get_help_xml(CXMLElement& self) const
 {
 	auto set = self.add_child("set"); 
 	for (auto i = m_valid_set.begin(); i != m_valid_set.end(); ++i) {
@@ -779,6 +896,7 @@ std::string TParameter<T>::do_get_value_as_string() const
 	return __dispatch_param_translate<T>::apply(m_value);	
 }
 
+
 NS_MIA_END
 
 #endif
diff --git a/mia/core/paramoption.cc b/mia/core/paramoption.cc
index 5bbd4b3..08e65f3 100644
--- a/mia/core/paramoption.cc
+++ b/mia/core/paramoption.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -63,7 +63,7 @@ void CParamOption::do_post_set()
 	m_param->post_set();
 }
 
-void CParamOption::do_get_long_help_xml(std::ostream& os, xmlpp::Element& parent, HandlerHelpMap& handler_map) const
+void CParamOption::do_get_long_help_xml(std::ostream& os, CXMLElement& parent, HandlerHelpMap& handler_map) const
 {
 	m_param->add_dependend_handler(handler_map); 
 	m_param->get_help_xml(parent);
diff --git a/mia/core/paramoption.hh b/mia/core/paramoption.hh
index 16fc356..62d6605 100644
--- a/mia/core/paramoption.hh
+++ b/mia/core/paramoption.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -48,7 +48,7 @@ private:
 	virtual void do_post_set(); 
 
 	virtual const std::string do_get_value_as_string() const; 
-	virtual void do_get_long_help_xml(std::ostream& os, xmlpp::Element& parent, HandlerHelpMap& handler_map) const; 
+	virtual void do_get_long_help_xml(std::ostream& os, CXMLElement& parent, HandlerHelpMap& handler_map) const; 
 	virtual void do_get_long_help(std::ostream& os) const;
 	virtual bool do_set_value(const char *str_value);
 	virtual size_t do_get_needed_args() const;
diff --git a/mia/core/paramtranslator.cc b/mia/core/paramtranslator.cc
new file mode 100644
index 0000000..74cfc4a
--- /dev/null
+++ b/mia/core/paramtranslator.cc
@@ -0,0 +1,107 @@
+/* -*- mia-c++  -*-
+ *
+ * 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 MIA; if not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <mia/core/paramtranslator.hh>
+
+NS_MIA_BEGIN
+using std::invalid_argument; 
+
+
+CParamTranslator::CParamTranslator(const char *name):
+        m_name(name)
+{
+}
+
+CParamTranslator::~CParamTranslator()
+{
+}
+        
+void CParamTranslator::add_parameter(const std::string& name, CParameter *param)
+{
+        CParamList::PParameter p(param);
+	if ( m_parameters.has_key(name) ) {
+                throw create_exception<invalid_argument>("CParamTranslator: Parameter name '", 
+                                                         name, "' already in use'");
+	}
+	m_parameters[name] = p;
+}
+
+void CParamTranslator::set_parameters(const CParsedOptions& options)
+{
+        try {
+		m_parameters.set(options);
+	}
+	catch (invalid_argument& x) {
+                throw create_exception<invalid_argument>("CParamTranslator:", x.what());
+	}
+}
+
+void CParamTranslator::check_parameters()
+{
+	try {
+		m_parameters.check_required();
+	}
+	catch (invalid_argument& x) {
+                throw create_exception<invalid_argument>("CParamTranslator:", x.what());
+        }
+}
+
+void CParamTranslator::get_short_help(std::ostream& os) const
+{
+	os << get_name() << ": " << get_descr() << "\n";
+	m_parameters.print_help(os);
+	os  << "\n";
+}
+
+const char *CParamTranslator::get_name() const
+{
+        return m_name; 
+}
+
+const std::string CParamTranslator::get_descr() const
+{
+	return do_get_descr();
+}
+
+
+void CParamTranslator::get_help(std::ostream& os) const
+{
+	m_parameters.print_help(os);
+}
+
+void CParamTranslator::get_help_xml(CXMLElement& root) const
+{
+	cvdebug() << "Get help for " << m_name << "\n"; 
+	root.set_child_text(get_descr()); 
+	do_get_help_xml(root); 
+}
+
+void CParamTranslator::do_get_help_xml(CXMLElement& root) const
+{
+	TRACE_FUNCTION; 
+	m_parameters.get_help_xml(root);
+}
+
+CParamList& CParamTranslator::get_parameters()
+{
+        return m_parameters; 
+}
+
+NS_MIA_END
diff --git a/mia/core/paramtranslator.hh b/mia/core/paramtranslator.hh
new file mode 100644
index 0000000..41245ef
--- /dev/null
+++ b/mia/core/paramtranslator.hh
@@ -0,0 +1,92 @@
+/* -*- mia-c++  -*-
+ *
+ * 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 MIA; if not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef mia_core_paramtranslator_hh
+#define mia_core_paramtranslator_hh
+
+#include <map>
+#include <set>
+#include <string>
+#include <ostream>
+
+#include <mia/core/defines.hh>
+#include <mia/core/optparam.hh>
+
+NS_MIA_BEGIN 
+
+class EXPORT_CORE CParamTranslator {
+public: 
+        CParamTranslator(const char *name); 
+                
+        virtual ~CParamTranslator(); 
+        
+        /**
+	   Add a parameter to the parameter list. If the name of
+	   the parameter already exists this function throws an \a
+	   invalid_argument exception.
+	   \param name Name of the new parameter
+	   \param param the actual parameter
+	*/
+	void add_parameter(const std::string& name, CParameter *param);
+        
+        /**
+	   Set the parameter according to the given option map. If the
+	   parameter name does not exists, the function will throw an
+	   \a invalid_argument exception. Depending on the parameter type
+	   setting it might also throw an \a invalid_argument exception.
+	   \param options the options map
+	*/
+	void set_parameters(const CParsedOptions& options);
+
+        /**
+	   This function checks, whether all requzired parameters have really been set.
+	   It throws an \a invalid_argument
+	*/
+	void check_parameters();
+
+        void get_short_help(std::ostream& os) const; 
+
+        void get_help(std::ostream& os) const; 
+
+        void get_help_xml(CXMLElement& root) const; 
+        
+        virtual void do_get_help_xml(CXMLElement& root) const; 
+
+	/// \returns the name of the translator 
+	const char *get_name() const;
+
+	/// \returns the description of the translator 
+	const std::string get_descr() const;
+protected: 
+        CParamList& get_parameters(); 
+
+private: 
+	virtual const std::string do_get_descr() const = 0;
+
+        CParamList  m_parameters;
+
+	// plugin name 
+	const char *m_name;
+
+}; 
+
+NS_MIA_END
+
+#endif 
diff --git a/mia/core/pixeltype.cc b/mia/core/pixeltype.cc
index 83363f0..b92f325 100644
--- a/mia/core/pixeltype.cc
+++ b/mia/core/pixeltype.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -35,6 +35,7 @@ const TDictMap<EPixelType>::Table PixelTypeTable[] = {
 #endif
 	{"float", it_float, "floating point 32 bit"},
 	{"double",it_double, "floating point 64 bit"},
+	{"none", it_none, "no pixel type defined"}, 
 	{NULL, it_unknown, ""}
 };
 const TDictMap<EPixelType> CPixelTypeDict(PixelTypeTable);
diff --git a/mia/core/pixeltype.hh b/mia/core/pixeltype.hh
index 300494d..95bf233 100644
--- a/mia/core/pixeltype.hh
+++ b/mia/core/pixeltype.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/plugin_base.cc b/mia/core/plugin_base.cc
index 6b395ba..47b2572 100644
--- a/mia/core/plugin_base.cc
+++ b/mia/core/plugin_base.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -49,96 +49,36 @@ using namespace std;
 const std::string plugin_help("help");
 
 CPluginBase::CPluginBase(const char *name):
-	m_name(name),
-	m_next_interface(NULL)
+	CParamTranslator(name),
+	m_next_interface(NULL),
+	m_priority(0)
 {
 }
 
-CPluginBase::~CPluginBase()
+void CPluginBase::set_priority(unsigned p)
 {
-	TRACE("CPluginBase::~CPluginBase()");
+	m_priority = p; 
 }
 
-void CPluginBase::add_parameter(const std::string& name, CParameter *param)
+unsigned CPluginBase::get_priority() const
 {
-	CParamList::PParameter p(param);
-	if ( m_parameters.has_key(name) ) {
-		stringstream errmsg;
-		errmsg << get_name() << ": Parameter name '" << name << "' already in use'";
-		throw invalid_argument(errmsg.str());
-	}
-	m_parameters[name] = p;
+	return m_priority; 
 }
 
 
-void CPluginBase::set_parameters(const CParsedOptions& options)
-{
-	try {
-		m_parameters.set(options);
-	}
-	catch (invalid_argument& x) {
-		stringstream errmsg;
-		errmsg << get_name() << ":" << x.what();
-		throw invalid_argument(errmsg.str());
-	}
-}
-
-void CPluginBase::check_parameters()
+CPluginBase::~CPluginBase()
 {
-	try {
-		m_parameters.check_required();
-	}
-	catch (invalid_argument& x) {
-		stringstream errmsg;
-		errmsg << get_name() << ":" << x.what();
-		throw invalid_argument(errmsg.str());
-	}
+	TRACE("CPluginBase::~CPluginBase()");
 }
 
 void CPluginBase::add_dependend_handlers(HandlerHelpMap& handler_map)
 {
 	TRACE_FUNCTION; 
-	cvdebug() << "Add dependend handler for plugin '" << m_name << "'\n"; 
-	m_parameters.add_dependend_handlers(handler_map); 
-}
-
-const char *CPluginBase::get_name() const
-{
-	return m_name;
-}
-
-
-const std::string CPluginBase::get_descr() const
-{
-	return do_get_descr();
+	cvdebug() << "Add dependend handler for plugin '" << get_name() << "'\n"; 
+	get_parameters().add_dependend_handlers(handler_map); 
 }
 
 
-void CPluginBase::get_short_help(std::ostream& os) const
-{
-	os << get_name() << ": " << get_descr() << "\n";
-	m_parameters.print_help(os);
-	os  << "\n";
-}
-
-void CPluginBase::get_help(std::ostream& os) const
-{
-	m_parameters.print_help(os);
-}
-
-void CPluginBase::get_help_xml(xmlpp::Element& root) const
-{
-	cvdebug() << "Get help for " << m_name << "\n"; 
-	root.set_child_text(get_descr()); 
-	do_get_help_xml(root); 
-}
-
-void CPluginBase::do_get_help_xml(xmlpp::Element& root) const
-{
-	TRACE_FUNCTION; 
-	m_parameters.get_help_xml(root);
-}
-
 void CPluginBase::append_interface(CPluginBase *plugin)
 {
 	if (m_next_interface)
@@ -184,6 +124,8 @@ PrepareTestPluginPath::~PrepareTestPluginPath()
 	g_plugin_root = nullptr; 
 }
 
+
+
 #ifdef WIN32
 
 EXPORT_CORE const string get_plugin_root()
diff --git a/mia/core/plugin_base.cxx b/mia/core/plugin_base.cxx
index 6b2e254..b4a2e77 100644
--- a/mia/core/plugin_base.cxx
+++ b/mia/core/plugin_base.cxx
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -48,13 +48,18 @@ const std::string TPlugin<D, T>::get_long_name() const
 	return msg.str();
 }
 
+
 template <typename D, typename T>
-::boost::filesystem::path TPlugin<D, T>::search_path()
+const char * TPlugin<D, T>::get_data_path_part()
 {
-	return ::boost::filesystem::path(D::data_descr)/ 
-		::boost::filesystem::path(T::type_descr);
+	return D::data_descr; 
 }
 
+template <typename D, typename T>
+const char * TPlugin<D, T>::get_type_path_part()
+{
+	return T::type_descr; 
+}
 
 NS_MIA_END
 
diff --git a/mia/core/plugin_base.hh b/mia/core/plugin_base.hh
index 1c6f51a..c3bb16f 100644
--- a/mia/core/plugin_base.hh
+++ b/mia/core/plugin_base.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -26,11 +26,8 @@
 #include <string>
 #include <ostream>
 
-#include <boost/filesystem/path.hpp>
-
-#include <mia/core/defines.hh>
+#include <mia/core/paramtranslator.hh>
 #include <mia/core/module.hh>
-#include <mia/core/optparam.hh>
 #include <mia/core/property_flags.hh>
 
 #include <mia/core/import_handler.hh>
@@ -64,7 +61,7 @@ struct EXPORT_CORE PrepareTestPluginPath {
    and a provides a help interface. 
 */
 
-class EXPORT_CORE CPluginBase {
+class EXPORT_CORE CPluginBase: public CParamTranslator {
 public:
 	/**
 	   The constructor  initialises the plug-in with its name and sets
@@ -78,52 +75,19 @@ public:
 	*/
 	virtual ~CPluginBase();
 
-	/**
-	   Add a parameter to the parameter list. If the name of
-	   the parameter already exists this function throws an \a
-	   invalid_argument exception.
-	   \param name Name of the new parameter
-	   \param param the actual parameter
-	*/
-	void add_parameter(const std::string& name, CParameter *param);
 
 	/**
-	   Set the parameter according to the given option map. If the
-	   parameter name does not exists, the function will throw an
-	   \a invalid_argument exception. Depending on the parameter type
-	   setting it might also throw an \a invalid_argument exception.
-	   \param options the options map
-	*/
-	void set_parameters(const CParsedOptions& options);
-
-	/**
-	   This function checks, whether all requzired parameters have really been set.
-	   It throws an \a invalid_argument
-	*/
-	void check_parameters();
-
-	/// \returns the name of the plug-in
-	const char *get_name() const;
-
-	/// \returns the name of the plug-in
-	const std::string get_descr() const;
-
+	   Set the plug-in priority, if two plug-ins of the same type and 
+	   name are loaded, then the one with the higher priority is kept. 
+	   \param p priority of this plugin 
+	 */
+	void set_priority(unsigned p); 
 
 	/**
-	   Write a help regarding the plugin to the output stream
-	   \param os
+	   \returns the priority of the plug-in
 	 */
-	void get_short_help(std::ostream& os) const;
-
-	/** prints out a help text to the given output stream
-	    \param os
-	*/
-	virtual void get_help(std::ostream& os) const;
-
-	/** Adds the help for this plug-in to an XML tree 
-	    \param root node to add the help to
-	*/
-	void get_help_xml(xmlpp::Element& root) const;
+	unsigned get_priority() const;
+	
 
 	/**
 	   link up another plug-in in order to be able to put several
@@ -166,13 +130,9 @@ public:
 	*/
 	void add_property(const char *property);
 
-private:
-	virtual const std::string do_get_descr() const = 0;
 
-	virtual void do_get_help_xml(xmlpp::Element& root) const;
+private:
 
-	// plugin name 
-	const char *m_name;
 
 	/* pointer to the next interface in a plugin chain 
 	   NULL indicates end of chain
@@ -180,19 +140,17 @@ private:
 	CPluginBase *m_next_interface;
 
 	/*
-	  List of paramaters understudd by this plugin 
-	 */
-	CParamList  m_parameters;
-
-	/*
 	  Specific properties of this plug in 
 	 */
 	CPropertyFlagHolder m_properties;
 
+	unsigned m_priority;  
+
 	/*
 	  The dynamically loadable module that holds the code of this plugin.  
 	 */
 	PPluginModule  m_module;
+
 };
 
 
@@ -231,10 +189,11 @@ public:
 	virtual void get_help(std::ostream& os) const;
 
 
-
-	/// \returns the plugin specific part of the plugin search path
-	static ::boost::filesystem::path search_path();
-
+	static const char * get_data_path_part();
+	
+	static const char * get_type_path_part(); 
+	
+	
 	/// @returns the long name of the plug in consisting of its name, its type, and data descriptors 
 	const std::string get_long_name() const;
 
diff --git a/mia/core/plugin_test.cc b/mia/core/plugin_test.cc
index 12a1e14..fa9486f 100644
--- a/mia/core/plugin_test.cc
+++ b/mia/core/plugin_test.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/probmap.cc b/mia/core/probmap.cc
index 798a602..afb122e 100644
--- a/mia/core/probmap.cc
+++ b/mia/core/probmap.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/probmap.hh b/mia/core/probmap.hh
index 13f8c92..a7535db 100644
--- a/mia/core/probmap.hh
+++ b/mia/core/probmap.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/product_base.cc b/mia/core/product_base.cc
index 0244f73..71c20dd 100644
--- a/mia/core/product_base.cc
+++ b/mia/core/product_base.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/product_base.hh b/mia/core/product_base.hh
index 7ca1254..e4fe14f 100644
--- a/mia/core/product_base.hh
+++ b/mia/core/product_base.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/productcache.cc b/mia/core/productcache.cc
index f132a00..a25b286 100644
--- a/mia/core/productcache.cc
+++ b/mia/core/productcache.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/productcache.hh b/mia/core/productcache.hh
index e98ec2c..736024e 100644
--- a/mia/core/productcache.hh
+++ b/mia/core/productcache.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/property_flags.cc b/mia/core/property_flags.cc
index 5b0e092..b060663 100644
--- a/mia/core/property_flags.cc
+++ b/mia/core/property_flags.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/property_flags.hh b/mia/core/property_flags.hh
index b5185aa..8af9937 100644
--- a/mia/core/property_flags.hh
+++ b/mia/core/property_flags.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/pwh.cc b/mia/core/pwh.cc
index 42ab901..4e3b0bb 100644
--- a/mia/core/pwh.cc
+++ b/mia/core/pwh.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/pwh.hh b/mia/core/pwh.hh
index b202bc2..c06a7e9 100644
--- a/mia/core/pwh.hh
+++ b/mia/core/pwh.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/refholder.hh b/mia/core/refholder.hh
index 2827506..8e49805 100644
--- a/mia/core/refholder.hh
+++ b/mia/core/refholder.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/regmodel.cc b/mia/core/regmodel.cc
index af856e5..dc4bcb5 100644
--- a/mia/core/regmodel.cc
+++ b/mia/core/regmodel.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/regmodel.hh b/mia/core/regmodel.hh
index af72ea6..f8d41f9 100644
--- a/mia/core/regmodel.hh
+++ b/mia/core/regmodel.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/revision.cc b/mia/core/revision.cc
index be385c3..62ff26b 100644
--- a/mia/core/revision.cc
+++ b/mia/core/revision.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/scaler1d.cc b/mia/core/scaler1d.cc
index fb8cb1f..48c732d 100644
--- a/mia/core/scaler1d.cc
+++ b/mia/core/scaler1d.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/scaler1d.hh b/mia/core/scaler1d.hh
index 4f9f91f..7f3fc97 100644
--- a/mia/core/scaler1d.hh
+++ b/mia/core/scaler1d.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/searchpath.cc b/mia/core/searchpath.cc
new file mode 100644
index 0000000..256325e
--- /dev/null
+++ b/mia/core/searchpath.cc
@@ -0,0 +1,170 @@
+/* -*- mia-c++  -*-
+ *
+ * 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 MIA; if not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <stdexcept>
+#include <sstream>
+#include <cstdlib>
+
+#include <mia/core/searchpath.hh>
+#include <mia/core/msgstream.hh>
+
+#include <boost/regex.hpp>
+#include <boost/filesystem/operations.hpp>
+
+#include <config.h>
+
+
+NS_MIA_BEGIN
+
+using std::swap; 
+using namespace boost::filesystem;
+
+EXPORT_CORE const std::string get_plugin_root();
+
+struct CPluginSearchpathData {
+
+        CPluginSearchpathData(bool no_subpath);
+
+        void set_standard_paths(); 
+        
+        std::vector<boost::filesystem::path> m_paths;
+	bool m_no_subpath; 
+}; 
+
+CPluginSearchpathData::CPluginSearchpathData(bool no_subpath):
+	m_no_subpath(no_subpath)
+{
+}
+
+void CPluginSearchpathData::set_standard_paths()
+{
+       
+#ifdef PLUGIN_HOME_SEARCH_PATH
+        char *c_home = getenv("HOME"); 
+        if (c_home)
+                impl->m_paths.push_back( path(c_home, bfs::native) / path(PLUGIN_HOME_SEARCH_PATH)); 
+#endif
+
+	// MIA_PLUGIN_PATH overrides the system path. 
+        char *c_user = getenv("MIA_PLUGIN_PATH");
+        if (c_user)
+                m_paths.push_back( path(c_user) );
+	else
+		m_paths.push_back( path(get_plugin_root()));
+}
+
+CPluginSearchpath::CPluginSearchpath(bool no_subpath)
+{
+        impl = new CPluginSearchpathData(no_subpath); 
+}
+        
+
+CPluginSearchpath::CPluginSearchpath(const CPluginSearchpath& other)
+{
+	impl = new CPluginSearchpathData(*other.impl); 
+}
+	
+CPluginSearchpath& CPluginSearchpath::operator = (const CPluginSearchpath& other)
+{
+	if (&other != this) {
+		auto i = new CPluginSearchpathData(*other.impl);
+		swap(i, impl);
+		delete i; 
+	}
+	return *this; 
+}
+
+
+CPluginSearchpath::~CPluginSearchpath()
+{
+        delete impl; 
+}
+
+void CPluginSearchpath::add(const char *path)
+{
+	impl->m_paths.push_back(boost::filesystem::path(path)); 
+}
+
+void CPluginSearchpath::add(const boost::filesystem::path& path)
+{
+        impl->m_paths.push_back(path); 
+}
+
+std::vector<PPluginModule> CPluginSearchpath::find_modules(const std::string& data, const std::string& type) const
+{
+        if (impl->m_paths.empty())
+                impl->set_standard_paths(); 
+
+
+        std::stringstream pattern; 
+        pattern << ".*\\."<< MIA_MODULE_SUFFIX << "$";
+        boost::regex pat_expr(pattern.str());	
+
+	std::vector<PPluginModule> result;
+	
+	path type_path = path(data) / path(type);
+
+	std::vector<path> candidates; 
+        
+        for(auto p: impl->m_paths) {
+                auto dir = impl->m_no_subpath ? p  : p / type_path;
+                
+                cvdebug() << "Looking for " << dir.string() << "\n";
+                
+		if (exists(dir) && is_directory(dir)) {
+                        
+			// if we cant save the old directory something is terribly wrong
+			directory_iterator di(dir); 
+			directory_iterator dend;
+			
+			cvdebug() << "TPluginHandler<I>::initialise: scan '" << dir.string() << "'\n"; 
+                        
+			while (di != dend) {
+				cvdebug() << "    candidate:'" << di->path().string() << "'"; 
+				if (boost::regex_match(di->path().string(), pat_expr)) {
+					candidates.push_back(*di); 
+					cverb << " add\n";
+				}else
+					cverb << " discard\n";
+				++di;
+			}
+		}
+        }
+
+        for (auto i : candidates) {
+		try {
+			cvdebug()<< " Load '" <<i.string()<<"'\n"; 
+			result.push_back(PPluginModule(new CPluginModule(i.string().c_str())));
+		}
+		catch (std::invalid_argument& ex) {
+			cverr() << ex.what() << "\n"; 
+		}
+		catch (std::exception& ex) {
+			cverr() << ex.what() << "\n"; 
+		}
+		catch (...) {
+			cverr() << "Loading module " << i.string() << "failed for unknown reasons\n"; 
+		}
+	}
+        
+        return result; 
+}
+
+NS_MIA_END
diff --git a/mia/core/flagstring.hh b/mia/core/searchpath.hh
similarity index 52%
copy from mia/core/flagstring.hh
copy to mia/core/searchpath.hh
index d123e51..097d540 100644
--- a/mia/core/flagstring.hh
+++ b/mia/core/searchpath.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -18,39 +18,35 @@
  *
  */
 
-#ifndef mia_core_flagstring_hh
-#define mia_core_flagstring_hh
+#include <mia/core/module.hh>
+#include <vector>
 
-#include <map>
-
-#include <mia/core/defines.hh>
-#include <mia/core/errormacro.hh>
+namespace boost {
+namespace filesystem {
+class path;
+}
+}
 
 NS_MIA_BEGIN
 
-class  EXPORT_CORE CFlagString {
+class EXPORT_CORE CPluginSearchpath {
 public:
-	typedef struct {
-		char id;
-		int  flag;
-	} Table;
-
-	CFlagString(const Table table[]);
+        CPluginSearchpath(bool no_subpath=false);
 
-	int get(const std::string& flags)const;
+	CPluginSearchpath(const CPluginSearchpath& other); 
+	CPluginSearchpath& operator = (const CPluginSearchpath& other); 
 
-	const std::string get(int flags)const;
+        ~CPluginSearchpath();
 
-	const std::string get_flagnames()const;
+        void add(const char *path);
+	
+        void add(const boost::filesystem::path& path)__attribute__((deprecated));
+        
+        std::vector<PPluginModule> find_modules(const std::string& data, const std::string& type) const; 
 
 private:
-	typedef std::map<char, int> TMap;
-	typedef std::map<int, char> TBackMap;
-
-	TMap m_map;
-	TBackMap m_backmap;
-
-};
+        struct CPluginSearchpathData *impl; 
+        
+}; 
 
 NS_MIA_END
-#endif
diff --git a/mia/core/selftestcmdoption.cc b/mia/core/selftestcmdoption.cc
index 890c199..7388c73 100644
--- a/mia/core/selftestcmdoption.cc
+++ b/mia/core/selftestcmdoption.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/selftestcmdoption.hh b/mia/core/selftestcmdoption.hh
index c9ddaec..9c596d5 100644
--- a/mia/core/selftestcmdoption.hh
+++ b/mia/core/selftestcmdoption.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/seriesstats.cc b/mia/core/seriesstats.cc
index 3dc64bb..345922d 100644
--- a/mia/core/seriesstats.cc
+++ b/mia/core/seriesstats.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/seriesstats.hh b/mia/core/seriesstats.hh
index 8c8b44e..e52f916 100644
--- a/mia/core/seriesstats.hh
+++ b/mia/core/seriesstats.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -63,7 +63,7 @@ public:
 	/**
 	   This function gets called for each entity from the input that the statistics is 
 	   evaluated for. 
-	   \param @data the data container to be processed
+	   \param data the data container to be processed
 	 */
 	template <typename Container> 
 	void operator () ( const Container& data); 
diff --git a/mia/core/shape.cc b/mia/core/shape.cc
index 6421d19..9e3e639 100644
--- a/mia/core/shape.cc
+++ b/mia/core/shape.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/shape.cxx b/mia/core/shape.cxx
index faac0fc..210b929 100644
--- a/mia/core/shape.cxx
+++ b/mia/core/shape.cxx
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/shape.hh b/mia/core/shape.hh
index 2a622ac..e135c8e 100644
--- a/mia/core/shape.hh
+++ b/mia/core/shape.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/simpson.hh b/mia/core/simpson.hh
index c5c7e52..caaa2d9 100644
--- a/mia/core/simpson.hh
+++ b/mia/core/simpson.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/singular_refobj.hh b/mia/core/singular_refobj.hh
index 74422a7..0e218bd 100644
--- a/mia/core/singular_refobj.hh
+++ b/mia/core/singular_refobj.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/slopeclassifier.cc b/mia/core/slopeclassifier.cc
index 323167b..49b794c 100644
--- a/mia/core/slopeclassifier.cc
+++ b/mia/core/slopeclassifier.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/slopeclassifier.hh b/mia/core/slopeclassifier.hh
index f3d19e9..3b38eec 100644
--- a/mia/core/slopeclassifier.hh
+++ b/mia/core/slopeclassifier.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/slopestatistics.cc b/mia/core/slopestatistics.cc
index 9572b2a..dda5721 100644
--- a/mia/core/slopestatistics.cc
+++ b/mia/core/slopestatistics.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/slopestatistics.hh b/mia/core/slopestatistics.hh
index 17b1df6..3c550b6 100644
--- a/mia/core/slopestatistics.hh
+++ b/mia/core/slopestatistics.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/slopevector.hh b/mia/core/slopevector.hh
index dd96f7c..56964c2 100644
--- a/mia/core/slopevector.hh
+++ b/mia/core/slopevector.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/spacial_kernel.cc b/mia/core/spacial_kernel.cc
index 759a9cd..12619d6 100644
--- a/mia/core/spacial_kernel.cc
+++ b/mia/core/spacial_kernel.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -33,7 +33,7 @@ const char *spacial_kernel_data::data_descr = "1d";
 const char *kernel_plugin_type::type_descr = "spacialkernel";
 
 
-C1DFilterKernel::C1DFilterKernel(int fsize):
+C1DFilterKernel::C1DFilterKernel(unsigned fsize):
 	m_fsize(fsize)
 {
 }
diff --git a/mia/core/spacial_kernel.hh b/mia/core/spacial_kernel.hh
index 703a34d..4d10c39 100644
--- a/mia/core/spacial_kernel.hh
+++ b/mia/core/spacial_kernel.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -54,7 +54,7 @@ protected:
 	/** constructs the kernel
 	    \param fsize width parameter of the kernel
 	*/
-	C1DFilterKernel(int fsize);
+	C1DFilterKernel(unsigned fsize);
 
 	virtual ~C1DFilterKernel();
 public:
@@ -87,7 +87,7 @@ private:
 
 	virtual std::vector<double> do_apply(const std::vector<double>& data) const = 0;
 
-	int m_fsize;
+	unsigned m_fsize;
 
 };
 
diff --git a/mia/core/spacialkernel/CMakeLists.txt b/mia/core/spacialkernel/CMakeLists.txt
index bfa3a61..d688155 100644
--- a/mia/core/spacialkernel/CMakeLists.txt
+++ b/mia/core/spacialkernel/CMakeLists.txt
@@ -1,6 +1,6 @@
 #
 # This file is part of MIA - a toolbox for medical image analysis 
-# Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+# 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
@@ -16,7 +16,7 @@
 # along with this program; if not, see <http://www.gnu.org/licenses/>.
 #
 
-SET(NAMES gauss) 
+SET(NAMES gauss cdiff) 
 
-PLUGINGROUP_WITH_TEST_AND_PREFIX2( "1d" "spacialkernel" ${NAMES} "${MIACORE}")
+PLUGINGROUP_WITH_TEST_AND_PREFIX2( "1d" "spacialkernel" "${NAMES}" "${MIACORE}")
 
diff --git a/mia/core/spacialkernel/cdiff.cc b/mia/core/spacialkernel/cdiff.cc
new file mode 100644
index 0000000..823bec9
--- /dev/null
+++ b/mia/core/spacialkernel/cdiff.cc
@@ -0,0 +1,64 @@
+/* -*- mia-c++  -*-
+ *
+ * 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 MIA; if not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <mia/core/spacialkernel/cdiff.hh>
+
+NS_MIA_USE
+using namespace std;
+using namespace cdiff_1d_folding_kernel;
+
+C1DCDiffFilterKernel::C1DCDiffFilterKernel():
+	C1DFoldingKernel(1)
+{
+	(*this)[0] = -1;
+	(*this)[2] = 1; 
+}
+
+C1DSpacialCDiffKernelPlugin::C1DSpacialCDiffKernelPlugin():
+	C1DSpacialKernelPlugin("cdiff")
+{
+}
+
+C1DFoldingKernel *C1DSpacialCDiffKernelPlugin::do_create() const
+{
+		return new C1DCDiffFilterKernel();
+}
+
+std::vector<double> C1DCDiffFilterKernel::do_apply(const std::vector<double>& data) const
+{
+	std::vector<double> result(data.size(),0.0);
+	transform(data.begin() + 2, data.end(),
+		  data.begin(), 
+		  result.begin() + 1,
+		  [](double xp, double xm){return 0.5 * (xp - xm);}); 
+
+	return result;
+}
+
+const string C1DSpacialCDiffKernelPlugin::do_get_descr()const
+{
+	return "Central difference filter kernel, mirror boundary conditions are used.";
+}
+
+extern "C" EXPORT CPluginBase  *get_plugin_interface()
+{
+	return new C1DSpacialCDiffKernelPlugin();
+}
+
diff --git a/mia/core/spacialkernel/gauss.hh b/mia/core/spacialkernel/cdiff.hh
similarity index 63%
copy from mia/core/spacialkernel/gauss.hh
copy to mia/core/spacialkernel/cdiff.hh
index 7438403..3714ad9 100644
--- a/mia/core/spacialkernel/gauss.hh
+++ b/mia/core/spacialkernel/cdiff.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -22,33 +22,23 @@
 #include <limits>
 #include <mia/core/spacial_kernel.hh>
 
-NS_BEGIN(gauss_1d_folding_kernel)
+NS_BEGIN(cdiff_1d_folding_kernel)
 
-/**  Class for a one-dimensional Gaussian convolution filter kernel. */
-class C1DGaussFilterKernel: public mia::C1DFoldingKernel {
+/**  Class for a one-dimensional central difference filter kernel. */
+class C1DCDiffFilterKernel: public mia::C1DFoldingKernel {
 
 public:
-	/** contructor creates a kernel with the width = 2 * fsize +1
-	    \param fsize is the filter with parameter */
-	C1DGaussFilterKernel(int fsize);
+	/** contructor creates the kernel, is always -1, 0, 1 */
+	C1DCDiffFilterKernel();
 private:
 	virtual std::vector<double> do_apply(const std::vector<double>& data) const;
 };
 
-class C1DSpacialGaussKernelPlugin: public mia::C1DSpacialKernelPlugin {
+class C1DSpacialCDiffKernelPlugin: public mia::C1DSpacialKernelPlugin {
 public:
-	C1DSpacialGaussKernelPlugin();
+	C1DSpacialCDiffKernelPlugin();
 	virtual mia::C1DFoldingKernel *do_create() const;
 	virtual const std::string do_get_descr()const;
-private:
-	int m_w;
-};
-
-struct equal_double {
-	bool operator () (double a , double b) {
-		return ::fabs(a-b) < 0.0001;
-	}
 };
 
-NS_END
-
+NS_END 
diff --git a/mia/core/spacialkernel/gauss.cc b/mia/core/spacialkernel/gauss.cc
index 7c956e6..264c601 100644
--- a/mia/core/spacialkernel/gauss.cc
+++ b/mia/core/spacialkernel/gauss.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -24,7 +24,7 @@ NS_MIA_USE
 using namespace std;
 using namespace gauss_1d_folding_kernel;
 
-C1DGaussFilterKernel::C1DGaussFilterKernel(int fsize):
+C1DGaussFilterKernel::C1DGaussFilterKernel(unsigned fsize):
 	C1DFoldingKernel(fsize)
 {
 	size_t n = size();
@@ -59,8 +59,7 @@ C1DSpacialGaussKernelPlugin::C1DSpacialGaussKernelPlugin():
 	C1DSpacialKernelPlugin("gauss"),
 	m_w(1)
 {
-	add_parameter("w", new CIntParameter(m_w, 0, numeric_limits<int>::max(),
-					     false, "half filter width"));
+	add_parameter("w", make_lc_param(m_w, 0, false, "half filter width"));
 }
 
 C1DFoldingKernel *C1DSpacialGaussKernelPlugin::do_create() const
diff --git a/mia/core/spacialkernel/gauss.hh b/mia/core/spacialkernel/gauss.hh
index 7438403..db35f13 100644
--- a/mia/core/spacialkernel/gauss.hh
+++ b/mia/core/spacialkernel/gauss.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -30,7 +30,7 @@ class C1DGaussFilterKernel: public mia::C1DFoldingKernel {
 public:
 	/** contructor creates a kernel with the width = 2 * fsize +1
 	    \param fsize is the filter with parameter */
-	C1DGaussFilterKernel(int fsize);
+	C1DGaussFilterKernel(unsigned fsize);
 private:
 	virtual std::vector<double> do_apply(const std::vector<double>& data) const;
 };
@@ -41,7 +41,7 @@ public:
 	virtual mia::C1DFoldingKernel *do_create() const;
 	virtual const std::string do_get_descr()const;
 private:
-	int m_w;
+	unsigned  m_w;
 };
 
 struct equal_double {
diff --git a/mia/core/noise/test_gauss.cc b/mia/core/spacialkernel/test_cdiff.cc
similarity index 55%
copy from mia/core/noise/test_gauss.cc
copy to mia/core/spacialkernel/test_cdiff.cc
index 1a229e7..a737e07 100644
--- a/mia/core/noise/test_gauss.cc
+++ b/mia/core/spacialkernel/test_cdiff.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -18,42 +18,33 @@
  *
  */
 
-#include <mia/internal/autotest.hh>
-#include <mia/core/noise/gauss.hh>
-#include <cmath>
 
+#include <mia/internal/autotest.hh>
+#include <mia/core/spacialkernel/cdiff.hh>
 
 NS_MIA_USE
 using namespace std; 
 using namespace ::boost::unit_test; 
-using namespace gauss_noise_generator; 
+using namespace cdiff_1d_folding_kernel; 
 
-BOOST_AUTO_TEST_CASE( test_gauss )
+BOOST_AUTO_TEST_CASE( test_cdiff )
 {
-	const double mu = 1.0; 
-	const double sigma = 10.0; 
-	
-	CGaussNoiseGenerator ng(1, mu, sigma); 
-	
-	double sum1 = 0.0; 
-	double sum2 = 0.0; 
-	const size_t n = 10000000; 
-	
-	size_t k = n; 
-	while (k--) {
-		double val = ng(); 
-		sum1 += val; 
-		sum2 += val * val; 
-	}
-	
-	cvdebug() << sum1 << " (" << sum2 << ")\n"; 
-	
-	sum1 /= n; 
-	sum2 = sqrt(( sum2 - n * sum1 * sum1) / (n-1)); 
-	
-	cvdebug() << sum1 << " (" << sum2 << ")\n"; 
-
-	BOOST_CHECK_CLOSE(mu, sum1, 1.0); 
-	BOOST_CHECK_CLOSE(sigma, sum2, 1.0); 
-	
+        C1DCDiffFilterKernel kernel; 
+	BOOST_CHECK_EQUAL(kernel.size(), 3u); 
+	BOOST_CHECK_EQUAL(kernel[0], -1);
+        BOOST_CHECK_EQUAL(kernel[1],  0);
+        BOOST_CHECK_EQUAL(kernel[2],  1);
+
+
+        vector<double> input = {0,1,2,-1,0 }; 
+        
+        kernel.apply_inplace(input);
+
+        BOOST_CHECK_SMALL(input[0], 1e-10);
+        BOOST_CHECK_CLOSE(input[1], 1, 0.1);
+        BOOST_CHECK_CLOSE(input[2], -1, 0.1);
+	BOOST_CHECK_CLOSE(input[3], -1, 0.1);
+        BOOST_CHECK_SMALL(input[4], 1e-10); 
+
 }
+
diff --git a/mia/core/spacialkernel/test_gauss.cc b/mia/core/spacialkernel/test_gauss.cc
index b4e07de..951cf7d 100644
--- a/mia/core/spacialkernel/test_gauss.cc
+++ b/mia/core/spacialkernel/test_gauss.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/sparse_solver.hh b/mia/core/sparse_solver.hh
index 382fe03..0baca75 100644
--- a/mia/core/sparse_solver.hh
+++ b/mia/core/sparse_solver.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/splinebc/CMakeLists.txt b/mia/core/splinebc/CMakeLists.txt
index 1778fbc..616915c 100644
--- a/mia/core/splinebc/CMakeLists.txt
+++ b/mia/core/splinebc/CMakeLists.txt
@@ -1,6 +1,6 @@
 #
 # This file is part of MIA - a toolbox for medical image analysis 
-# Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+# 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
diff --git a/mia/core/splinebc/bc.cc b/mia/core/splinebc/bc.cc
index 468b96b..2109d07 100644
--- a/mia/core/splinebc/bc.cc
+++ b/mia/core/splinebc/bc.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/splinebc/bc.hh b/mia/core/splinebc/bc.hh
index 13cff19..418f08f 100644
--- a/mia/core/splinebc/bc.hh
+++ b/mia/core/splinebc/bc.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/splinebc/test_bc.cc b/mia/core/splinebc/test_bc.cc
index d558097..2d3a2bd 100644
--- a/mia/core/splinebc/test_bc.cc
+++ b/mia/core/splinebc/test_bc.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/splinekernel.cc b/mia/core/splinekernel.cc
index a0a50dc..3d41366 100644
--- a/mia/core/splinekernel.cc
+++ b/mia/core/splinekernel.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/splinekernel.hh b/mia/core/splinekernel.hh
index d31c2c5..cff7325 100644
--- a/mia/core/splinekernel.hh
+++ b/mia/core/splinekernel.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/splinekernel/CMakeLists.txt b/mia/core/splinekernel/CMakeLists.txt
index 96fddce..19f29ab 100644
--- a/mia/core/splinekernel/CMakeLists.txt
+++ b/mia/core/splinekernel/CMakeLists.txt
@@ -1,6 +1,6 @@
 #
 # This file is part of MIA - a toolbox for medical image analysis 
-# Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+# 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
diff --git a/mia/core/splinekernel/bspline.cc b/mia/core/splinekernel/bspline.cc
index 99297e0..04ddccb 100644
--- a/mia/core/splinekernel/bspline.cc
+++ b/mia/core/splinekernel/bspline.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -34,7 +34,7 @@ using std::runtime_error;
 
 template <int sd, int degree>
 struct bspline {
-	static double apply(double x) {
+	static double apply(double MIA_PARAM_UNUSED(x)) {
 		throw create_exception<invalid_argument>( "Spline ", sd , ":derivative degree "
 		      ,  degree , " not supported for spline of degree 2");
 	}
@@ -71,7 +71,7 @@ double CBSplineKernel0::get_weight_at(double x, int degree) const
 		throw create_exception<invalid_argument>( "CBSplineKernel0::get_weight_at: degree " ,  degree , 
 		      "not supported for Haar spline"); 
 	}
-	return abs(x) < 0.5 ? 1.0 : 0.0; 
+	return std::abs(x) < 0.5 ? 1.0 : 0.0; 
 }
 void CBSplineKernel0::get_derivative_weights(double /*x*/, VWeight& weight, int degree) const
 {
@@ -865,7 +865,7 @@ CBSplineKernelPlugin::CBSplineKernelPlugin():
 	CSplineKernelPlugin("bspline"), 
 	m_degree(3)
 {
-	add_parameter("d", new CIntParameter(m_degree, 0, 5, false, "Spline degree"));
+	add_parameter("d", make_ci_param(m_degree, 0, 5, false, "Spline degree"));
 }
 	
 CSplineKernel *CBSplineKernelPlugin::do_create() const
@@ -893,7 +893,7 @@ COMomsSplineKernelPlugin::COMomsSplineKernelPlugin():
 	CSplineKernelPlugin("omoms"), 
 	m_degree(3)
 {
-	add_parameter("d", new CIntParameter(m_degree, 3, 3, false, "Spline degree"));
+	add_parameter("d", make_ci_param(m_degree, 3, 3, false, "Spline degree"));
 }
 
 CSplineKernel *COMomsSplineKernelPlugin::do_create() const
diff --git a/mia/core/splinekernel/bspline.hh b/mia/core/splinekernel/bspline.hh
index 027b6b9..ed04eae 100644
--- a/mia/core/splinekernel/bspline.hh
+++ b/mia/core/splinekernel/bspline.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/splinekernel/test_bspline.cc b/mia/core/splinekernel/test_bspline.cc
index a7d936d..2507d1c 100644
--- a/mia/core/splinekernel/test_bspline.cc
+++ b/mia/core/splinekernel/test_bspline.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/splineparzenmi.cc b/mia/core/splineparzenmi.cc
index 95a6eec..bfc7716 100644
--- a/mia/core/splineparzenmi.cc
+++ b/mia/core/splineparzenmi.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/splineparzenmi.hh b/mia/core/splineparzenmi.hh
index aa41596..fe9b472 100644
--- a/mia/core/splineparzenmi.hh
+++ b/mia/core/splineparzenmi.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/sqmin.cc b/mia/core/sqmin.cc
index b5e0d59..b3aef5a 100644
--- a/mia/core/sqmin.cc
+++ b/mia/core/sqmin.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/sqmin.hh b/mia/core/sqmin.hh
index 6df20ae..55ed915 100644
--- a/mia/core/sqmin.hh
+++ b/mia/core/sqmin.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/statistics.hh b/mia/core/statistics.hh
index 89987f7..7669a78 100644
--- a/mia/core/statistics.hh
+++ b/mia/core/statistics.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/streamredir.cc b/mia/core/streamredir.cc
index 7a128e3..c699794 100644
--- a/mia/core/streamredir.cc
+++ b/mia/core/streamredir.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/streamredir.hh b/mia/core/streamredir.hh
index 64367e2..a3798a9 100644
--- a/mia/core/streamredir.hh
+++ b/mia/core/streamredir.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/svector.hh b/mia/core/svector.hh
index 67ba31c..c9e1636 100644
--- a/mia/core/svector.hh
+++ b/mia/core/svector.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/test_Vector.cc b/mia/core/test_Vector.cc
index fc325b7..bc2000b 100644
--- a/mia/core/test_Vector.cc
+++ b/mia/core/test_Vector.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/test_attributes.cc b/mia/core/test_attributes.cc
index 006bc68..1e70aca 100644
--- a/mia/core/test_attributes.cc
+++ b/mia/core/test_attributes.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/test_boundary_conditions.cc b/mia/core/test_boundary_conditions.cc
index 6c55a7e..ab8e05d 100644
--- a/mia/core/test_boundary_conditions.cc
+++ b/mia/core/test_boundary_conditions.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/test_callback.cc b/mia/core/test_callback.cc
index c4eb7d0..9707717 100644
--- a/mia/core/test_callback.cc
+++ b/mia/core/test_callback.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/test_cmdlineparser.cc b/mia/core/test_cmdlineparser.cc
index ea8cf46..86a0d6a 100644
--- a/mia/core/test_cmdlineparser.cc
+++ b/mia/core/test_cmdlineparser.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -165,23 +165,6 @@ BOOST_FIXTURE_TEST_CASE( test_float_option, CmdlineParserFixture )
 	}
 }
 
-BOOST_FIXTURE_TEST_CASE( test_ranged_float_option, CmdlineParserFixture )
-{
-	float value = 10;
-	PCmdOption popt(make_opt(value, -10, 12, "float", 'f', "a float option"));
-	const char *str_value = "12.2";
-	try {
-		popt->set_value(str_value);
-		BOOST_CHECK(value == 12.0f);
-		BOOST_CHECK(popt->get_value_as_string() == "12");
-	}
-	catch (invalid_argument& x) {
-		BOOST_FAIL(x.what());
-	}
-
-	BOOST_CHECK_THROW(popt->set_value("12.1s"), invalid_argument); 
-}
-
 
 BOOST_FIXTURE_TEST_CASE( test_int_option, CmdlineParserFixture )
 {
@@ -453,7 +436,7 @@ BOOST_FIXTURE_TEST_CASE( test_parser_help_output, CmdlineParserFixture )
 			  "Example usage:\n  Example text\n"
 			  "    \n    test-program Example command\n\n"
 			  "Copyright:\n"
-			  "  This software is Copyright (c) Gert Wollny 1999-2014 Leipzig, \n"
+			  "  This software is Copyright (c) Gert Wollny 1999-2015 Leipzig, \n"
 			  "  Germany and Madrid, Spain. It comes with ABSOLUTELY NO WARRANTY and\n"
 			  "  you may redistribute it under the terms of the GNU GENERAL PUBLIC \n"
 			  "  LICENSE Version 3 (or later). For more information run the program \n"
diff --git a/mia/core/test_cmdoptionflags.cc b/mia/core/test_cmdoptionflags.cc
index bf3fc05..6aee087 100644
--- a/mia/core/test_cmdoptionflags.cc
+++ b/mia/core/test_cmdoptionflags.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/test_cmdtranslatoroption.cc b/mia/core/test_cmdtranslatoroption.cc
new file mode 100644
index 0000000..14d9fa9
--- /dev/null
+++ b/mia/core/test_cmdtranslatoroption.cc
@@ -0,0 +1,97 @@
+/* -*- mia-c++  -*-
+ *
+ * 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 MIA; if not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#include <mia/internal/autotest.hh>
+#include <mia/core/msgstream.hh>
+
+
+#include <stdexcept>
+
+class VectorInitializer: public CParamizedFunctor {
+public: 
+        VectorInitializer(const char*name): CValueTranslator::CTranslator(name){}
+        
+        virtual std::vector<double> prepare(const std::vector<double>& init){
+                
+        };
+}
+
+class Translator1 : public VectorInitializer {
+public: 
+        Translator1(); 
+        
+        virtual std::vector<double> prepare(const std::vector<double>& init) {
+                return std::vector<double>(m_n); 
+        }
+        unsigned m_n; 
+}; 
+
+class Translator2 : public VectorInitializer {
+public: 
+        Translator2(); 
+        
+        virtual std::vector<double> prepare(const std::vector<double>& init) {
+                return std::vector<double>(init);
+        }
+}; 
+
+struct CmdTranslateFixture {
+        CmdTranslateFixture(); 
+
+        vector<double> m_init; 
+
+}; 
+
+BOOST_FIXTURE_TEST_CASE( test_option_fixedempty, CmdTranslateFixture )
+{
+        unique_ptr<VectorInitializer> initializer;
+        CCmdTranslatorOption opt(initializer, nullptr, 'i', 'initializer', 
+                                 "vector initializer", "vector initializer", CCmdOptionFlags::required);
+        
+        opt.set_value("fixedequal:n=3,init=10.0"); 
+        
+        assert(initializer); 
+        
+        auto initalized = initializer->run(m_init); 
+        
+        BOOST_CHECK_EQUAL(initalized.size(), 3ul); 
+        BOOST_CHECK_EQUAL(initalized[0], 10.0); 
+        BOOST_CHECK_EQUAL(initalized[1], 10.0); 
+        BOOST_CHECK_EQUAL(initalized[2], 10.0); 
+
+}
+
+Translator1::Translator1(): VectorInitializer("fixedempty"), 
+        m_n(2)
+{
+        add_parameter("n", make_positive_param(m_n, false, "set size of init vector"));
+}
+
+Translator2::Translator2(): VectorInitializer("copy"), 
+{
+}
+
+CmdTranslateFixture::CmdTranslateFixture():m_init({1,2,3,4})
+{
+        auto& selector = VectorInitializer::selector_instance();
+        selector.add_translator(new Translator1()); 
+        selector.add_translator(new Translator2());
+}
diff --git a/mia/core/test_cmeans.cc b/mia/core/test_cmeans.cc
new file mode 100644
index 0000000..384c76f
--- /dev/null
+++ b/mia/core/test_cmeans.cc
@@ -0,0 +1,214 @@
+/* -*- mia-c++  -*-
+ *
+ * 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 MIA; if not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+
+#include <mia/internal/autotest.hh>
+
+#include <cmath>
+#include <mia/core/cmeans.hh>
+
+
+using namespace mia;
+
+using std::vector; 
+
+double gauss(double x , double c, double sigma)
+{
+	const double f = sqrt(2 * 3.1415926); 
+	double d = x - c;
+	return 100000 * exp(- d * d / (2 * sigma * sigma)) / (sigma * f); 
+}
+
+class CTestFixedInitializer: public CMeans::Initializer
+{
+public:
+	CTestFixedInitializer(const CMeans::DVector& init);
+	CMeans::DVector run(const CMeans::NormalizedHistogram& nh) const; 
+private:
+	CMeans::DVector m_init; 
+};
+
+CTestFixedInitializer::CTestFixedInitializer(const CMeans::DVector& init):
+	m_init(init)
+{
+}
+
+CMeans::DVector CTestFixedInitializer::run(const CMeans::NormalizedHistogram& nh) const
+{
+	return m_init; 
+}
+
+	
+BOOST_AUTO_TEST_CASE( test_even_initialized )
+{
+
+        CMeans::SparseHistogram sh(250);
+
+	vector<double> x = {
+		2,    4,  5,  7,  8, 10, 12, 14, 18, 20,
+		22,  24, 25, 30, 31, 34, 37, 38, 39, 40,
+		41, 42, 43, 45, 46, 48, 49, 50, 53, 55,
+		57, 58, 60, 61, 63, 64, 67, 70, 72, 75,
+   	        78, 79, 80, 82, 85, 86, 88, 90, 92, 93,
+		
+		95, 99,100,102,103,104,106,107,109,110,
+		112,114,116,118,121,122,123,124,128,130,
+		132,134,136,138,141,142,143,144,148,149,
+
+		150,152,156,158,159,160,163,164,165,167,
+		168,169,170,171,172,173,175,177,178,179,
+
+		180,182,186,188,189,190,193,194,195,197,
+		198,199,200,201,202,203,205,207,208,209,
+		212,214,216,218,221,222,223,224,228,230,
+		232,234,236,238,241,242,243,244,248,249,
+		250,252,256,258,259,260,263,264,265,267,
+		
+		268,269,270,271,272,273,275,277,278,279,
+		280,282,286,288,289,290,293,294,295,297,
+		312,314,316,318,321,322,323,324,328,330,
+		332,334,336,338,341,342,343,344,348,349,
+		350,352,356,358,359,360,363,364,365,367,
+
+		368,369,370,371,372,373,375,377,378,379,
+		380,382,386,388,389,390,393,394,395,397,
+		400,401,402,403,405,407,408,409,412,414,
+		416,418,421,422,423,424,428,430,432,434,
+		436,438,441,442,443,444,448,449,450,452
+	}; 
+
+	vector<double> centers{30, 120, 220, 300, 390};
+	vector<double> weights{2.0, 0.9, 1.3, 1.1, 0.9};
+
+	vector<double> expect{34.34, 105.31, 214.627, 278.295, 383.15};
+
+	double k = 20;
+	for (int i = 0; i < 250; ++i) {
+		sh[i].first = x[i];
+		for (int j = 0; j < 5; ++j) {
+			double v = gauss(x[i], centers[j], k) * weights[j];
+			sh[i].second += v; 
+		}
+		cvdebug() << "h[" << sh[i].first << "]=" << sh[i].second << "\n"; 
+	}
+
+	CMeans::PInitializer cci(new CTestFixedInitializer({0, 0.25, 0.5, 0.75, 1}));
+	CMeans cm(0.01, 0.0001, cci);
+
+
+	CMeans::DVector result_cci(5); 
+	
+	auto sp = cm.run(sh,  result_cci);
+
+	
+	for (int i = 0; i < 5; ++i) {
+		BOOST_CHECK_CLOSE(result_cci[i], expect[i], 0.1); 
+	}
+        
+}
+
+
+BOOST_AUTO_TEST_CASE( test_store_load_probmap )
+{
+	CMeans::SparseProbmap my_map(2);
+
+	my_map[0].first = 1.0;
+	my_map[1].first = 2.0;
+	
+	my_map[0].second = CMeans::DVector({1,2,3});
+	my_map[1].second = CMeans::DVector({4,5,6});
+
+	my_map.save("/tmp/tempmap.mia");
+
+	CMeans::SparseProbmap loaded_map("/tmp/tempmap.mia");
+
+	BOOST_CHECK_EQUAL(loaded_map.size(), my_map.size()); 
+
+	BOOST_CHECK_EQUAL(loaded_map[0].first, my_map[0].first);
+	BOOST_CHECK_EQUAL(loaded_map[1].first, my_map[1].first); 
+
+	BOOST_CHECK_EQUAL(loaded_map[0].second.size(), my_map[0].second.size());
+	BOOST_CHECK_EQUAL(loaded_map[1].second.size(), my_map[1].second.size()); 
+
+	for (int i = 0; i < 3; ++i) {
+		BOOST_CHECK_EQUAL(loaded_map[0].second[i], my_map[0].second[i]);
+		BOOST_CHECK_EQUAL(loaded_map[1].second[i], my_map[1].second[i]);
+	}
+	
+}
+
+
+BOOST_AUTO_TEST_CASE( test_get_fuzzy )
+{
+	CMeans::SparseProbmap my_map(3);
+
+	my_map[0].first = 1.0;
+	my_map[1].first = 2.0;
+	my_map[2].first = 4.0;
+	
+	my_map[0].second = CMeans::DVector({1,2,3});
+	my_map[1].second = CMeans::DVector({4,5,6});
+	my_map[2].second = CMeans::DVector({6,9,9});
+
+
+	auto fuzzy0 = my_map.get_fuzzy(0.0);
+
+	BOOST_CHECK_EQUAL(fuzzy0[0], 1.0);
+	BOOST_CHECK_EQUAL(fuzzy0[1], 2.0);
+	BOOST_CHECK_EQUAL(fuzzy0[2], 3.0);
+
+	fuzzy0 = my_map.get_fuzzy(1.0);
+	
+	BOOST_CHECK_EQUAL(fuzzy0[0], 1.0);
+	BOOST_CHECK_EQUAL(fuzzy0[1], 2.0);
+	BOOST_CHECK_EQUAL(fuzzy0[2], 3.0);
+
+	fuzzy0 = my_map.get_fuzzy(1.2);
+
+	BOOST_CHECK_CLOSE(fuzzy0[0], 1.6, 0.01);
+	BOOST_CHECK_CLOSE(fuzzy0[1], 2.6, 0.01);
+	BOOST_CHECK_CLOSE(fuzzy0[2], 3.6, 0.01);
+
+	fuzzy0 = my_map.get_fuzzy(2.0);
+
+	BOOST_CHECK_EQUAL(fuzzy0[0], 4.0);
+	BOOST_CHECK_EQUAL(fuzzy0[1], 5.0);
+	BOOST_CHECK_EQUAL(fuzzy0[2], 6.0);
+
+	fuzzy0 = my_map.get_fuzzy(3.4);
+
+	BOOST_CHECK_CLOSE(fuzzy0[0], 5.4, 0.01);
+	BOOST_CHECK_CLOSE(fuzzy0[1], 7.8, 0.01);
+	BOOST_CHECK_CLOSE(fuzzy0[2], 8.1, 0.01);
+
+	fuzzy0 = my_map.get_fuzzy(4.0);
+
+	BOOST_CHECK_CLOSE(fuzzy0[0], 6, 0.01);
+	BOOST_CHECK_CLOSE(fuzzy0[1], 9, 0.01);
+	BOOST_CHECK_CLOSE(fuzzy0[2], 9, 0.01);
+
+	fuzzy0 = my_map.get_fuzzy(4.4);
+
+	BOOST_CHECK_CLOSE(fuzzy0[0], 6, 0.01);
+	BOOST_CHECK_CLOSE(fuzzy0[1], 9, 0.01);
+	BOOST_CHECK_CLOSE(fuzzy0[2], 9, 0.01);	
+	
+}
diff --git a/mia/core/test_core.cc b/mia/core/test_core.cc
index 3a564ea..68124a9 100644
--- a/mia/core/test_core.cc
+++ b/mia/core/test_core.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/test_cost.cc b/mia/core/test_cost.cc
index 428e6f0..e4ecc71 100644
--- a/mia/core/test_cost.cc
+++ b/mia/core/test_cost.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/test_cstplan.cc b/mia/core/test_cstplan.cc
index 53dd875..968253b 100644
--- a/mia/core/test_cstplan.cc
+++ b/mia/core/test_cstplan.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/test_datapool.cc b/mia/core/test_datapool.cc
index 1914cac..6f853a3 100644
--- a/mia/core/test_datapool.cc
+++ b/mia/core/test_datapool.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/test_delayedparameter.cc b/mia/core/test_delayedparameter.cc
index 6065d60..83c0c08 100644
--- a/mia/core/test_delayedparameter.cc
+++ b/mia/core/test_delayedparameter.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/test_dictmap.cc b/mia/core/test_dictmap.cc
index dd23c38..b007646 100644
--- a/mia/core/test_dictmap.cc
+++ b/mia/core/test_dictmap.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/test_distance.cc b/mia/core/test_distance.cc
index fba7914..8398dc3 100644
--- a/mia/core/test_distance.cc
+++ b/mia/core/test_distance.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/test_factoryoption.cc b/mia/core/test_factoryoption.cc
index 14852d2..aedf540 100644
--- a/mia/core/test_factoryoption.cc
+++ b/mia/core/test_factoryoption.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -62,7 +62,7 @@ class CFactoryMockPluginHandler : public TFactoryPluginHandler<CFactoryMock> {
 public: 
 	CFactoryMockPluginHandler()
 	{
-		add_plugin(new CFactoryMock()); 
+		assert(add_plugin(TFactoryPluginHandler<CFactoryMock>::PInterface(new CFactoryMock()))); 
 	}
 }; 
 
diff --git a/mia/core/test_fft1d.cc b/mia/core/test_fft1d.cc
index 8e9a7cc..8491245 100644
--- a/mia/core/test_fft1d.cc
+++ b/mia/core/test_fft1d.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/test_fftslopeclassifier.cc b/mia/core/test_fftslopeclassifier.cc
index 22b494f..f38af19 100644
--- a/mia/core/test_fftslopeclassifier.cc
+++ b/mia/core/test_fftslopeclassifier.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/test_fifofilter.cc b/mia/core/test_fifofilter.cc
index 291f077..7bb4e8e 100644
--- a/mia/core/test_fifofilter.cc
+++ b/mia/core/test_fifofilter.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/test_filetools.cc b/mia/core/test_filetools.cc
index 5dc6e3c..564fb8b 100644
--- a/mia/core/test_filetools.cc
+++ b/mia/core/test_filetools.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/test_filter.cc b/mia/core/test_filter.cc
index 107a806..736bae7 100644
--- a/mia/core/test_filter.cc
+++ b/mia/core/test_filter.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/test_fixedwidthoutput.cc b/mia/core/test_fixedwidthoutput.cc
index db392af..dd6958d 100644
--- a/mia/core/test_fixedwidthoutput.cc
+++ b/mia/core/test_fixedwidthoutput.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/test_flagstring.cc b/mia/core/test_flagstring.cc
index 9964b7f..fed4c3c 100644
--- a/mia/core/test_flagstring.cc
+++ b/mia/core/test_flagstring.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/test_fullstats.cc b/mia/core/test_fullstats.cc
index e362fa6..5b9cfbe 100644
--- a/mia/core/test_fullstats.cc
+++ b/mia/core/test_fullstats.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/test_handler.cc b/mia/core/test_handler.cc
index fff2ca4..29a1092 100644
--- a/mia/core/test_handler.cc
+++ b/mia/core/test_handler.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -32,6 +32,7 @@
 #include <tbb/parallel_reduce.h>
 #include <tbb/blocked_range.h>
 
+#include <boost/filesystem/path.hpp>
 
 NS_MIA_USE
 using namespace std;
@@ -41,11 +42,13 @@ namespace bfs = ::boost::filesystem;
 /*
    It is not quite clean whether BOOST test is thread save, therefore 
    the threaded function only counts the fails and uses MIA to report, 
-   and then ins ther serial code part the number of fails is tested via BOOST
+   and then in the serial code part the number of fails is tested via BOOST
 */
 BOOST_AUTO_TEST_CASE( test_dummy_plugin_handler_parallel )
 {
-	CTestPluginHandler::set_search_path({bfs::path("testplug")});
+	CPluginSearchpath sp(true);
+	sp.add("testplug"); 
+	CTestPluginHandler::set_search_path(sp);
 	auto callback = [](const tbb::blocked_range<int>& range, int init){
 		
 		CThreadMsgStream thread_stream;
@@ -87,7 +90,9 @@ BOOST_AUTO_TEST_CASE( test_dummy_plugin_handler_parallel )
 
 BOOST_AUTO_TEST_CASE( test_dummy_plugin_handler )
 {
-	CTestPluginHandler::set_search_path({bfs::path("testplug")});
+	CPluginSearchpath sp(true);
+	sp.add("testplug"); 
+	CTestPluginHandler::set_search_path(sp);
 	
 	const CTestPluginHandler::Instance& handler = CTestPluginHandler::instance();
 
@@ -98,6 +103,71 @@ BOOST_AUTO_TEST_CASE( test_dummy_plugin_handler )
 	BOOST_CHECK(handler.get_plugin("dummy3")->has_property(test_property));
 	BOOST_CHECK(!handler.get_plugin("dummy1")->has_property(test_property));
 
+	cvdebug() << handler.get_plugin("dummy3")->get_descr()  << "\n";  
+	cvdebug() << handler.get_plugin("dummy1")->get_descr()  << "\n";  
+
+	BOOST_CHECK_EQUAL(handler.get_plugin("dummy1")->get_descr(), 
+			  string("test_dummy_symbol from dummy1")); 
+	
+	BOOST_CHECK_EQUAL(handler.get_plugin("dummy3")->get_descr(), 
+			  std::string("test_dummy_symbol from dummy3")); 
+
+}
+
+
+class CDummy1Override :public CTestPlugin {
+public:
+	CDummy1Override();
+private:
+	virtual const string do_get_descr() const;
+};
+
+CDummy1Override::CDummy1Override():
+  CTestPlugin("dummy1")
+{
+	set_priority(1); 
+	add_property(test_property);
+}
+
+const std::string test_dummy_symbol()
+{
+	return "test_dummy_symbol from main application"; 
+}
+
+const string CDummy1Override::do_get_descr() const
+{
+	return test_dummy_symbol(); 
+}
+
+BOOST_AUTO_TEST_CASE( test_dummy_plugin_handler_override_plugin )
+{
+	CPluginSearchpath sp(true);
+	sp.add("testplug"); 
+	CTestPluginHandler::set_search_path(sp);
+
+	
+	auto& handler = CTestPluginHandler::instance();
+	
+	shared_ptr<CDummy1Override> override(new CDummy1Override); 
+
+	BOOST_CHECK(CTestPluginHandler::add_plugin(override)); 
+
+	BOOST_CHECK(handler.size() == 3);
+
+	BOOST_CHECK(handler.get_plugin_names() == "dummy1 dummy2 dummy3 ");
+
+	BOOST_CHECK(handler.get_plugin("dummy3")->has_property(test_property));
+	BOOST_CHECK(handler.get_plugin("dummy1")->has_property(test_property));
+
+	cvdebug() << handler.get_plugin("dummy3")->get_descr()  << "\n";  
+	cvdebug() << handler.get_plugin("dummy1")->get_descr()  << "\n";  
+	
+	BOOST_CHECK_EQUAL(handler.get_plugin("dummy1")->get_descr(), 
+			  string("test_dummy_symbol from main application")); 
+	
+	BOOST_CHECK_EQUAL(handler.get_plugin("dummy3")->get_descr(), 
+			  std::string("test_dummy_symbol from dummy3")); 
+
 }
 
 
diff --git a/mia/core/test_helpers.hh b/mia/core/test_helpers.hh
index 7747bb5..4fd1c2e 100644
--- a/mia/core/test_helpers.hh
+++ b/mia/core/test_helpers.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/test_histogram.cc b/mia/core/test_histogram.cc
index 5d00c42..0412af7 100644
--- a/mia/core/test_histogram.cc
+++ b/mia/core/test_histogram.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/test_history.cc b/mia/core/test_history.cc
index 172c640..3ac690d 100644
--- a/mia/core/test_history.cc
+++ b/mia/core/test_history.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/test_ica.cc b/mia/core/test_ica.cc
index ad7855e..0c92aac 100644
--- a/mia/core/test_ica.cc
+++ b/mia/core/test_ica.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/test_index.cc b/mia/core/test_index.cc
index 2bb8c63..15f240b 100644
--- a/mia/core/test_index.cc
+++ b/mia/core/test_index.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/test_interpol.cc b/mia/core/test_interpol.cc
index f1728c9..620d3d5 100644
--- a/mia/core/test_interpol.cc
+++ b/mia/core/test_interpol.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/test_interpolator1d.cc b/mia/core/test_interpolator1d.cc
index e73f29c..d463816 100644
--- a/mia/core/test_interpolator1d.cc
+++ b/mia/core/test_interpolator1d.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/test_iohandler.cc b/mia/core/test_iohandler.cc
index ffbf83a..42b37a0 100644
--- a/mia/core/test_iohandler.cc
+++ b/mia/core/test_iohandler.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -41,8 +41,9 @@ struct DummyPluginFixture {
 
 DummyPluginFixture::DummyPluginFixture()
 {
-	TRACE_FUNCTION; 
-	CPathNameArray sp{bfs::path("testplug")}; 
+	TRACE_FUNCTION;
+	CPluginSearchpath sp(true);
+	sp.add("testplug"); 
 	CTestIOPluginHandler::set_search_path(sp);
 }
 
diff --git a/mia/core/test_kernels.cc b/mia/core/test_kernels.cc
index 59127b7..f475495 100644
--- a/mia/core/test_kernels.cc
+++ b/mia/core/test_kernels.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/test_kmeans.cc b/mia/core/test_kmeans.cc
index 7922790..7e056eb 100644
--- a/mia/core/test_kmeans.cc
+++ b/mia/core/test_kmeans.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/test_labelmap.cc b/mia/core/test_labelmap.cc
index 23aac0c..c282273 100644
--- a/mia/core/test_labelmap.cc
+++ b/mia/core/test_labelmap.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/test_meanvar.cc b/mia/core/test_meanvar.cc
index 6c2461c..b9f68ce 100644
--- a/mia/core/test_meanvar.cc
+++ b/mia/core/test_meanvar.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/test_minimizer.cc b/mia/core/test_minimizer.cc
index 95a198a..524cd57 100644
--- a/mia/core/test_minimizer.cc
+++ b/mia/core/test_minimizer.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/test_nccsum.cc b/mia/core/test_nccsum.cc
index 5277309..b99c13d 100644
--- a/mia/core/test_nccsum.cc
+++ b/mia/core/test_nccsum.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/test_noisegen.cc b/mia/core/test_noisegen.cc
index 48431f1..7a142ef 100644
--- a/mia/core/test_noisegen.cc
+++ b/mia/core/test_noisegen.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/test_optionparser.cc b/mia/core/test_optionparser.cc
index b33d5e5..f88b493 100644
--- a/mia/core/test_optionparser.cc
+++ b/mia/core/test_optionparser.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/test_optparam.cc b/mia/core/test_optparam.cc
index d996674..025e69c 100644
--- a/mia/core/test_optparam.cc
+++ b/mia/core/test_optparam.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -48,11 +48,11 @@ void try_parsing_and_setting(const char *options, const params& expect)
 
 	CParamList pm;
 	pm["kill"] =  CParamList::PParameter(new CBoolParameter(read.kill, false, "a bool value"));
-	pm["min"] =   CParamList::PParameter(new CFloatParameter(read.min, -100, 20, true, "a float value"));
-	pm["max"] =   CParamList::PParameter(new CFloatParameter(read.max, -10, 200, true, "a float value"));
+	pm["min"] =   CParamList::PParameter(make_ci_param(read.min, -100, 20, true, "a float value"));
+	pm["max"] =   CParamList::PParameter(make_ci_param(read.max, -10, 200, true, "a float value"));
 	pm["nana"] =  CParamList::PParameter(new CStringParameter(read.nana, CCmdOptionFlags::required,
 								  "a string value"));
-	pm["n"] =     CParamList::PParameter(new CIntParameter(read.n, -200, 100, true, "an int value"));
+	pm["n"] =     CParamList::PParameter(make_ci_param(read.n, -200, 100, true, "an int value"));
 
 	CComplexOptionParser cpo(options);
 	BOOST_CHECK(cpo.size() == 1);
@@ -72,10 +72,10 @@ void try_parsing_and_setting(const char *options, const params& expect, params r
 {
 	CParamList pm;
 	pm["kill"] =  CParamList::PParameter(new CBoolParameter(read.kill, false, "a bool value"));
-	pm["min"] =   CParamList::PParameter(new CFloatParameter(read.min, -100, 20, false, "a float value"));
-	pm["max"] =   CParamList::PParameter(new CFloatParameter(read.max, -10, 200, false, "a float value"));
+	pm["min"] =   CParamList::PParameter(make_ci_param(read.min, -100, 20, false, "a float value"));
+	pm["max"] =   CParamList::PParameter(make_ci_param(read.max, -10, 200, false, "a float value"));
 	pm["nana"] =  CParamList::PParameter(new CStringParameter(read.nana, CCmdOptionFlags::none, "a string value"));
-	pm["n"] =     CParamList::PParameter(new CIntParameter(read.n, -200, 100, false, "an int value"));
+	pm["n"] =     CParamList::PParameter(make_ci_param(read.n, -200, 100, false, "an int value"));
 
 	CComplexOptionParser cpo(options);
 	BOOST_CHECK(cpo.size() == 1);
@@ -154,10 +154,10 @@ BOOST_AUTO_TEST_CASE( test_reset )
 
 		CParamList pm;
 		pm["kill"] =  CParamList::PParameter(new CBoolParameter(read.kill, false, "a bool value"));
-		pm["min"] =   CParamList::PParameter(new CFloatParameter(read.min, -100, 20, false, "a float value"));
-		pm["max"] =   CParamList::PParameter(new CFloatParameter(read.max, -10, 200, false, "a float value"));
+		pm["min"] =   CParamList::PParameter(make_ci_param(read.min, -100, 20, false, "a float value"));
+		pm["max"] =   CParamList::PParameter(make_ci_param(read.max, -10, 200, false, "a float value"));
 		pm["nana"] =  CParamList::PParameter(new CStringParameter(read.nana, CCmdOptionFlags::none, "a string value"));
-		pm["n"] =     CParamList::PParameter(new CIntParameter(read.n, -200, 100, false, "an int value"));
+		pm["n"] =     CParamList::PParameter(make_ci_param(read.n, -200, 100, false, "an int value"));
 		
 		CComplexOptionParser cpo("plugin:kill=0,min=1.1,nana=ping,max=3.1,n=1");
 		BOOST_CHECK(cpo.size() == 1);
diff --git a/mia/core/test_parameter.cc b/mia/core/test_parameter.cc
index 628b773..8d38f7b 100644
--- a/mia/core/test_parameter.cc
+++ b/mia/core/test_parameter.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -39,54 +39,24 @@ using namespace std;
 BOOST_AUTO_TEST_CASE( test_params )
 {
 
-	int int_val = 1;
-	float float_val = 2.1;
 	bool bool_val = false;
 	string string_val("initial");
 	string sval("replaced");
 
-	CIntParameter   param_int(int_val, -2, 5, true, "an integer value");
-	CFloatParameter param_float(float_val, -10, 200, true, "a float value");
 	CStringParameter param_string(string_val, CCmdOptionFlags::required, "a string value");
 	CBoolParameter   param_bool(bool_val, false, "a bool value");
 
-	BOOST_CHECK_THROW( CIntParameter(int_val, 5, -2, false, "impossible"), std::invalid_argument);
-
-	BOOST_CHECK(param_int.required_set());
 	BOOST_CHECK(!param_bool.required_set());
 
-	param_int.set("3");
-	param_float.set("3.12");
 	param_string.set(sval);
 	param_bool.set("1");
-
-	BOOST_CHECK(!param_int.required_set());
-	BOOST_CHECK(!param_float.required_set());
 	BOOST_CHECK(!param_string.required_set());
 
-	BOOST_CHECK(int_val == 3);
-	BOOST_CHECK_CLOSE(float_val, 3.12f, 1e-10);
+
 
 	BOOST_CHECK(string_val == sval);
 	BOOST_CHECK(bool_val);
 
-	// check boundary adjustment
-	param_int.set("7");
-	BOOST_CHECK(int_val == 5);
-
-	param_int.set("-3");
-	BOOST_CHECK(int_val == -2);
-
-	param_float.set("-20");
-	BOOST_CHECK(float_val == -10.f);
-
-	param_float.set("300");
-	BOOST_CHECK(float_val == 200.f);
-
-	BOOST_CHECK_THROW( param_float.set("bla"), std::invalid_argument);
-
-	BOOST_CHECK_THROW( param_int.set("1.1"), std::invalid_argument);
-	BOOST_CHECK_NO_THROW( param_int.set("1 "));
 }
 
 enum ETest {te_unknown, te_a, te_b, te_c};
@@ -141,7 +111,7 @@ BOOST_AUTO_TEST_CASE( test_set_params)
 
 	BOOST_CHECK_THROW(testp1.set("3"), std::invalid_argument);
 
-	BOOST_CHECK_THROW(!testp1.set("gjhgjhdf"), std::invalid_argument);
+	BOOST_CHECK_THROW(testp1.set("gjhgjhdf"), std::invalid_argument);
 }
 
 BOOST_AUTO_TEST_CASE( test_vector_param)
@@ -159,5 +129,113 @@ BOOST_AUTO_TEST_CASE( test_vector_param)
 }
 
 
+BOOST_AUTO_TEST_CASE( test_bounded_param_float_closed)
+{
+	float v = 0.0; 
+	CFBoundedParameter testv(v, EParameterBounds::bf_closed_interval, 
+				 {2.0, 4.0}, false, "a bounded test value"); 
+	
+	
+	BOOST_CHECK(testv.set("2.5"));
+	BOOST_CHECK_EQUAL(v, 2.5);
+	
+	BOOST_CHECK(testv.set("4.0"));
+	BOOST_CHECK_EQUAL(v, 4.0);
+
+	BOOST_CHECK(testv.set("2.0"));
+	BOOST_CHECK_EQUAL(v, 2.0);
+	
+
+	BOOST_CHECK_THROW(testv.set("1.0"), std::invalid_argument);
+	BOOST_CHECK_THROW(testv.set("5.0"), std::invalid_argument);
+}
+
+BOOST_AUTO_TEST_CASE( test_bounded_param_float_open)
+{
+	float v = 0.0; 
+	CFBoundedParameter testv(v, EParameterBounds::bf_open_interval, 
+				 {2.0, 4.0}, false, "a bounded test value"); 
+	
+	
+	BOOST_CHECK(testv.set("2.5"));
+	BOOST_CHECK_EQUAL(v, 2.5);
+	
+	BOOST_CHECK_THROW(testv.set("4.0"), std::invalid_argument); 
+	BOOST_CHECK_THROW(testv.set("2.0"), std::invalid_argument);
+	BOOST_CHECK_THROW(testv.set("1.0"), std::invalid_argument);
+	BOOST_CHECK_THROW(testv.set("5.0"), std::invalid_argument);
+}
+
+BOOST_AUTO_TEST_CASE( test_bounded_param_int_min_open)
+{
+	int v = 0; 
+	CSIBoundedParameter testv(v, EParameterBounds::bf_min_open, 
+				  {-2}, false, "a bounded test value"); 
+	
+	
+	BOOST_CHECK(testv.set("-1"));
+	BOOST_CHECK_EQUAL(v, -1);
+	
+	BOOST_CHECK_THROW(testv.set("-2"), std::invalid_argument); 
+	BOOST_CHECK_THROW(testv.set("-3"), std::invalid_argument); 
+}
+
+BOOST_AUTO_TEST_CASE( test_bounded_param_int_min_close)
+{
+	int v = 0; 
+	CSIBoundedParameter testv(v, EParameterBounds::bf_min_closed, 
+				  {-2}, false, "a bounded test value"); 
+	
+	
+	BOOST_CHECK(testv.set("-2"));
+	BOOST_CHECK_EQUAL(v, -2);
+
+	BOOST_CHECK(testv.set("2"));
+	BOOST_CHECK_EQUAL(v, 2);
+	
+	BOOST_CHECK_THROW(testv.set("-3"), std::invalid_argument); 
+}
+
+
+BOOST_AUTO_TEST_CASE( test_bounded_param_unsignedshort_min_open)
+{
+	unsigned short v = 0; 
+	CUSBoundedParameter testv(v, EParameterBounds::bf_min_open, 
+				  {2}, false, "a bounded test value"); 
+	
+	
+	BOOST_CHECK(testv.set("3"));
+	BOOST_CHECK_EQUAL(v, 3);
+	
+	BOOST_CHECK_THROW(testv.set("2"), std::invalid_argument); 
+	BOOST_CHECK_THROW(testv.set("1"), std::invalid_argument); 
+}
+
+BOOST_AUTO_TEST_CASE( test_bounded_param_unsignedshort_min_close)
+{
+	unsigned short v = 0; 
+	CUSBoundedParameter testv(v, EParameterBounds::bf_min_closed, 
+				  {2}, false, "a bounded test value"); 
+	
+	
+	BOOST_CHECK(testv.set("2"));
+	BOOST_CHECK_EQUAL(v, 2);
+
+	BOOST_CHECK(testv.set(" 3"));
+	BOOST_CHECK_EQUAL(v, 3);
+	
+	BOOST_CHECK_THROW(testv.set("1"), std::invalid_argument); 
+}
+
+BOOST_AUTO_TEST_CASE( test_bounded_param_unsignedshort_min_close_negative_input)
+{
+	unsigned short v = 0; 
+	CUSBoundedParameter testv(v, EParameterBounds::bf_min_closed, 
+				  {2}, false, "a bounded test value"); 
+	
+	BOOST_CHECK_THROW(testv.set(" -1"), std::invalid_argument); 
+}
+
+
 
 
diff --git a/mia/core/test_parseroutput.cc b/mia/core/test_parseroutput.cc
index e434d3a..83f0320 100644
--- a/mia/core/test_parseroutput.cc
+++ b/mia/core/test_parseroutput.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/test_pixeltype.cc b/mia/core/test_pixeltype.cc
index 1608f48..9b946b5 100644
--- a/mia/core/test_pixeltype.cc
+++ b/mia/core/test_pixeltype.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -34,7 +34,7 @@ BOOST_AUTO_TEST_CASE( test_pixeltype_translation )
 {
 
 #ifdef LONG_64BIT
-	BOOST_CHECK(CPixelTypeDict.get_name_set().size() == 11);
+	BOOST_CHECK(CPixelTypeDict.get_name_set().size() == 12);
 	BOOST_CHECK(it_none == 11);
 #else
 	BOOST_CHECK(CPixelTypeDict.get_name_set().size() == 9);
@@ -54,6 +54,7 @@ BOOST_AUTO_TEST_CASE( test_pixeltype_translation )
 #endif
 	BOOST_CHECK(CPixelTypeDict.get_value("float")  == it_float);
 	BOOST_CHECK(CPixelTypeDict.get_value("double") == it_double);
+	BOOST_CHECK(CPixelTypeDict.get_value("none") == it_none);
 	try {
 		CPixelTypeDict.get_value("something");
 		BOOST_FAIL("pixel type name 'something' should throw");
diff --git a/mia/core/test_probmap.cc b/mia/core/test_probmap.cc
index cf3a445..5180b93 100644
--- a/mia/core/test_probmap.cc
+++ b/mia/core/test_probmap.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/test_productcache.cc b/mia/core/test_productcache.cc
index fc829a1..7398bd5 100644
--- a/mia/core/test_productcache.cc
+++ b/mia/core/test_productcache.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/test_property_flags.cc b/mia/core/test_property_flags.cc
index 7bb58a0..79c5593 100644
--- a/mia/core/test_property_flags.cc
+++ b/mia/core/test_property_flags.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/test_pwh.cc b/mia/core/test_pwh.cc
index 9db20e9..2890671 100644
--- a/mia/core/test_pwh.cc
+++ b/mia/core/test_pwh.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/test_register.cc b/mia/core/test_register.cc
index ec7f6db..9848825 100644
--- a/mia/core/test_register.cc
+++ b/mia/core/test_register.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/test_scaler1d.cc b/mia/core/test_scaler1d.cc
index 00572f9..09d744f 100644
--- a/mia/core/test_scaler1d.cc
+++ b/mia/core/test_scaler1d.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/test_seriesstats.cc b/mia/core/test_seriesstats.cc
index f60b857..919c2c2 100644
--- a/mia/core/test_seriesstats.cc
+++ b/mia/core/test_seriesstats.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/test_shape.cc b/mia/core/test_shape.cc
index d563777..1a2694b 100644
--- a/mia/core/test_shape.cc
+++ b/mia/core/test_shape.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/test_simpson.cc b/mia/core/test_simpson.cc
index 896f6cd..ee9860e 100644
--- a/mia/core/test_simpson.cc
+++ b/mia/core/test_simpson.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/test_singular_refobj.cc b/mia/core/test_singular_refobj.cc
index dd28152..5cd29c5 100644
--- a/mia/core/test_singular_refobj.cc
+++ b/mia/core/test_singular_refobj.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/test_slopeclassifier.cc b/mia/core/test_slopeclassifier.cc
index eb9f7dc..ac42213 100644
--- a/mia/core/test_slopeclassifier.cc
+++ b/mia/core/test_slopeclassifier.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/test_slopestatistics.cc b/mia/core/test_slopestatistics.cc
index eb19d25..af11d4d 100644
--- a/mia/core/test_slopestatistics.cc
+++ b/mia/core/test_slopestatistics.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/test_sparse_solver.cc b/mia/core/test_sparse_solver.cc
index aabb184..3f837f2 100644
--- a/mia/core/test_sparse_solver.cc
+++ b/mia/core/test_sparse_solver.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/test_splinekernel.cc b/mia/core/test_splinekernel.cc
index bf5c6c9..c2e7064 100644
--- a/mia/core/test_splinekernel.cc
+++ b/mia/core/test_splinekernel.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/test_splineparzenmi.cc b/mia/core/test_splineparzenmi.cc
index e9abb7e..3043cbe 100644
--- a/mia/core/test_splineparzenmi.cc
+++ b/mia/core/test_splineparzenmi.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -122,8 +122,6 @@ SplineMutualInformationFixture::SplineMutualInformationFixture():
         moving(moving_init_data, moving_init_data + size), 
         bins(128)
 {        
-	CPathNameArray sksearchpath({bfs::path("splinekernel")});
-	CSplineKernelPluginHandler::set_search_path(sksearchpath); 
 
         rkernel = CSplineKernelPluginHandler::instance().produce("bspline:d=0");  
         mkernel = CSplineKernelPluginHandler::instance().produce("bspline:d=3"); 
diff --git a/mia/core/test_sqmin.cc b/mia/core/test_sqmin.cc
index 517bb3d..eb6b5fd 100644
--- a/mia/core/test_sqmin.cc
+++ b/mia/core/test_sqmin.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/test_statistics.cc b/mia/core/test_statistics.cc
index 9653809..e9f129b 100644
--- a/mia/core/test_statistics.cc
+++ b/mia/core/test_statistics.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/test_streamredir.cc b/mia/core/test_streamredir.cc
index 1118c62..5ed627e 100644
--- a/mia/core/test_streamredir.cc
+++ b/mia/core/test_streamredir.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/test_streamvector.cc b/mia/core/test_streamvector.cc
index 7450397..cf21fc3 100644
--- a/mia/core/test_streamvector.cc
+++ b/mia/core/test_streamvector.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/test_threadedmsg.cc b/mia/core/test_threadedmsg.cc
index 9f0b68f..25bc428 100644
--- a/mia/core/test_threadedmsg.cc
+++ b/mia/core/test_threadedmsg.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/test_tools.cc b/mia/core/test_tools.cc
index 3f84d51..4eabc41 100644
--- a/mia/core/test_tools.cc
+++ b/mia/core/test_tools.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/test_utils.cc b/mia/core/test_utils.cc
index 8a093bd..201d186 100644
--- a/mia/core/test_utils.cc
+++ b/mia/core/test_utils.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/test_watch.cc b/mia/core/test_watch.cc
index 390e756..2c19141 100644
--- a/mia/core/test_watch.cc
+++ b/mia/core/test_watch.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/test_waveletslopeclassifier.cc b/mia/core/test_waveletslopeclassifier.cc
index 56a5020..cdcc2db 100644
--- a/mia/core/test_waveletslopeclassifier.cc
+++ b/mia/core/test_waveletslopeclassifier.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/test_xmlinterface.cc b/mia/core/test_xmlinterface.cc
new file mode 100644
index 0000000..127eca1
--- /dev/null
+++ b/mia/core/test_xmlinterface.cc
@@ -0,0 +1,88 @@
+/* -*- mia-c++  -*-
+ *
+ * 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 MIA; if not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <mia/internal/autotest.hh>
+#include <mia/core/xmlinterface.hh>
+
+using namespace mia;
+using namespace std;
+
+BOOST_AUTO_TEST_CASE( test_nested_xml_doc_string )
+{
+        CXMLDocument doc;
+        
+        auto root_node = doc.create_root_node("root");
+ 
+        CXMLElement* 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");
+        child2->set_attribute("attribute21", "3");
+        child2->set_attribute("attribute22", "4");
+
+
+        auto result_string = doc.write_to_string_formatted();
+
+        cvdebug() << "Result=\n" << result_string << "\n";
+
+        const char *test_string =
+                "<?xml version=\"1.0\"?>\n"
+                "<root>\n"
+                "  <child1 attribute1=\"1\" attribute2=\"2\">Some <text>&</child1>\n"
+                "  <child2 attribute21=\"3\" attribute22=\"4\"/>\n"
+                "</root>\n"; 
+
+        BOOST_CHECK_EQUAL(result_string, string(test_string)); 
+
+}               
+
+BOOST_AUTO_TEST_CASE( test_simple_xml_doc_string )
+{
+        CXMLDocument doc;
+        
+        auto root_node = doc.create_root_node("root");
+ 
+        CXMLElement* child1 = root_node->add_child("child1");
+        child1->set_attribute("attribute1", "1");
+        child1->set_attribute("attribute2", "2");
+
+        CXMLElement* child2 = child1->add_child("child2");
+        child2->set_attribute("attribute21", "3");
+        child2->set_attribute("attribute22", "4");
+
+
+        auto result_string = doc.write_to_string_formatted();
+
+        cvdebug() << "Result=\n" << result_string << "\n";
+
+        const char *test_string =
+                "<?xml version=\"1.0\"?>\n"
+                "<root>\n"
+                "  <child1 attribute1=\"1\" attribute2=\"2\">\n"
+                "    <child2 attribute21=\"3\" attribute22=\"4\"/>\n"
+                "  </child1>\n"
+                "</root>\n"; 
+
+        BOOST_CHECK_EQUAL(result_string, string(test_string)); 
+
+}               
diff --git a/mia/core/testplug/CMakeLists.txt b/mia/core/testplug/CMakeLists.txt
index c5b1854..fced76e 100644
--- a/mia/core/testplug/CMakeLists.txt
+++ b/mia/core/testplug/CMakeLists.txt
@@ -1,6 +1,6 @@
 #
 # This file is part of MIA - a toolbox for medical image analysis 
-# Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+# 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
diff --git a/mia/core/testplug/dummy1.cc b/mia/core/testplug/dummy1.cc
index d83e746..a96b414 100644
--- a/mia/core/testplug/dummy1.cc
+++ b/mia/core/testplug/dummy1.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -35,9 +35,14 @@ CDummy1::CDummy1():
 {
 }
 
+const std::string test_dummy_symbol()
+{
+	return "test_dummy_symbol from dummy1"; 
+}
+
 const string CDummy1::do_get_descr() const
 {
-	return "test module with no data";
+	return test_dummy_symbol();;
 }
 
 
diff --git a/mia/core/testplug/dummy2.cc b/mia/core/testplug/dummy2.cc
index d8ac527..66c03a2 100644
--- a/mia/core/testplug/dummy2.cc
+++ b/mia/core/testplug/dummy2.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -36,7 +36,7 @@ CDummy2::CDummy2():
 
 const std::string CDummy2::do_get_descr() const
 {
-  return "test module with no data";
+  return "test module with no data (2)";
 }
 
 class CDummy3 :public CTestPlugin {
@@ -52,9 +52,14 @@ CDummy3::CDummy3():
 	add_property(test_property);
 }
 
+const std::string test_dummy_symbol()
+{
+	return std::string("test_dummy_symbol from dummy3"); 
+}
+
 const std::string CDummy3::do_get_descr() const
 {
-  return "test module with no data";
+	return test_dummy_symbol(); 
 }
 
 extern "C" EXPORT CPluginBase *get_plugin_interface()
diff --git a/mia/core/testplug/lala.cc b/mia/core/testplug/lala.cc
index c63b0c7..3648a15 100644
--- a/mia/core/testplug/lala.cc
+++ b/mia/core/testplug/lala.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/testplug/lolo.cc b/mia/core/testplug/lolo.cc
index e777699..4d4b0c5 100644
--- a/mia/core/testplug/lolo.cc
+++ b/mia/core/testplug/lolo.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/testplugin.cc b/mia/core/testplugin.cc
index 9562451..f9c78f3 100644
--- a/mia/core/testplugin.cc
+++ b/mia/core/testplugin.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/testplugin.hh b/mia/core/testplugin.hh
index cfc4125..850ddc4 100644
--- a/mia/core/testplugin.hh
+++ b/mia/core/testplugin.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/threadedmsg.cc b/mia/core/threadedmsg.cc
index cffca9d..898c1ae 100644
--- a/mia/core/threadedmsg.cc
+++ b/mia/core/threadedmsg.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/threadedmsg.hh b/mia/core/threadedmsg.hh
index 0d97d38..6e8087d 100644
--- a/mia/core/threadedmsg.hh
+++ b/mia/core/threadedmsg.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/tools.hh b/mia/core/tools.hh
index 79aec9a..8d6dcb8 100644
--- a/mia/core/tools.hh
+++ b/mia/core/tools.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/traits.hh b/mia/core/traits.hh
index bd91bc9..ea6770a 100644
--- a/mia/core/traits.hh
+++ b/mia/core/traits.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/transformation.hh b/mia/core/transformation.hh
index bd9a645..30d1bce 100644
--- a/mia/core/transformation.hh
+++ b/mia/core/transformation.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/type_traits.hh b/mia/core/type_traits.hh
index 6da2428..c7dd0f7 100644
--- a/mia/core/type_traits.hh
+++ b/mia/core/type_traits.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/typedescr.cc b/mia/core/typedescr.cc
index 346f0ff..b072053 100644
--- a/mia/core/typedescr.cc
+++ b/mia/core/typedescr.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/typedescr.hh b/mia/core/typedescr.hh
index ed7c62d..c1a1949 100644
--- a/mia/core/typedescr.hh
+++ b/mia/core/typedescr.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/utils.cc b/mia/core/utils.cc
index 53c5b4c..cdd9890 100644
--- a/mia/core/utils.cc
+++ b/mia/core/utils.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/utils.hh b/mia/core/utils.hh
index 792350e..50bb911 100644
--- a/mia/core/utils.hh
+++ b/mia/core/utils.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/vector.hh b/mia/core/vector.hh
index b148e35..bf31d1e 100644
--- a/mia/core/vector.hh
+++ b/mia/core/vector.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/watch.cc b/mia/core/watch.cc
index e48f584..f5c4bf3 100644
--- a/mia/core/watch.cc
+++ b/mia/core/watch.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/watch.hh b/mia/core/watch.hh
index 1a4e9e0..3bb0a42 100644
--- a/mia/core/watch.hh
+++ b/mia/core/watch.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/core/waveletslopeclassifier.cc b/mia/core/waveletslopeclassifier.cc
index 80b69b6..51da392 100644
--- a/mia/core/waveletslopeclassifier.cc
+++ b/mia/core/waveletslopeclassifier.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -197,12 +197,15 @@ CWaveletSlopeClassifierImpl::CWaveletSlopeClassifierImpl(const CWaveletSlopeClas
 	cvdebug() << "Movement coeff weights:" << movement_pos << "\n"; 
 	
 	int skip_idx = 0; 
-	bool ifree_breathing = false; 
+	bool ifree_breathing = false;
+
+	// usually we test for free breathing. By setting the min_freq to 0.0, we assume some kind of breath hold. 
 	if (min_freq != 0.0) {
-		((movement_pos[CSlopeStatistics::ecp_center] > movement_pos[CSlopeStatistics::ecp_begin]) &&
-		 (movement_pos[CSlopeStatistics::ecp_center] > movement_pos[CSlopeStatistics::ecp_end]));
+		ifree_breathing = 
+			((movement_pos[CSlopeStatistics::ecp_center] > movement_pos[CSlopeStatistics::ecp_begin]) &&
+			 (movement_pos[CSlopeStatistics::ecp_center] > movement_pos[CSlopeStatistics::ecp_end])); 
 		
-		// handle free breathing and series that only end with breath holding in the same way 
+			// handle free breathing and series that only end with breath holding in the same way 
 		if  ((!ifree_breathing) && (movement_pos[CSlopeStatistics::ecp_end] < movement_pos[CSlopeStatistics::ecp_begin]))
 			ifree_breathing = true; 
 	}else 
diff --git a/mia/core/waveletslopeclassifier.hh b/mia/core/waveletslopeclassifier.hh
index 29e8268..5ddb8f5 100644
--- a/mia/core/waveletslopeclassifier.hh
+++ b/mia/core/waveletslopeclassifier.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -56,7 +56,7 @@ public:
 	   Initialize the classifier with the given curves and the information whether the means were stripped 
 	   @param m matrix of curves 
 	   @param mean_stripped
-	   @param min_freq minimum breatjing frequency to consider movement, set to <0 to diable this test 
+	   @param min_freq minimum breathing frequency to consider movement, set to <0 to diable this test 
 	 */
 	CWaveletSlopeClassifier(const Columns& m, bool mean_stripped, float min_freq);
 
diff --git a/mia/core/xmlinterface.cc b/mia/core/xmlinterface.cc
new file mode 100644
index 0000000..94ecc9f
--- /dev/null
+++ b/mia/core/xmlinterface.cc
@@ -0,0 +1,146 @@
+/* -*- mia-c++  -*-
+ *
+ * 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 MIA; if not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <libxml/parser.h>
+#include <libxml/tree.h>
+#include <sstream>
+
+#include <mia/core/xmlinterface.hh>
+#include <mia/core/msgstream.hh>
+
+NS_MIA_BEGIN
+
+using std::string;
+using std::stringstream; 
+
+struct CXMLElementImpl {
+        CXMLElementImpl(const char *name);
+        ~CXMLElementImpl();
+        
+        xmlNodePtr element;
+}; 
+
+CXMLElementImpl::CXMLElementImpl(const char *name)
+{
+        element = xmlNewNode(nullptr, BAD_CAST name);
+}
+
+CXMLElementImpl::~CXMLElementImpl()
+{
+        // here the element should be freed if it is not a child
+        
+}
+        
+
+CXMLElement::CXMLElement(const char *name):
+        impl(new CXMLElementImpl(name))
+{
+        
+}
+
+CXMLElement::~CXMLElement()
+{
+        delete impl; 
+}
+
+
+CXMLElement* CXMLElement::add_child(const char *name)
+{
+        CXMLElement *result = new CXMLElement(name);
+        xmlAddChild(impl->element, result->impl->element); 
+        return result; 
+}
+
+void CXMLElement::set_child_text(const std::string& value)
+{
+	xmlNodeAddContent(impl->element, BAD_CAST value.c_str()); 
+}
+
+void CXMLElement::set_attribute(const char *name, const std::string& value)
+{
+	xmlChar *attr = xmlGetProp(impl->element, BAD_CAST name);
+	if (!attr)  {
+		xmlNewProp(impl->element, BAD_CAST name,  BAD_CAST value.c_str());
+	}else{
+		xmlChar *path = xmlGetNodePath(impl->element); 
+		cvdebug() << "CXMLElement: trying to add attribute " << name << " a second time to '"
+			  << path << "'\n";
+		xmlFree(path);
+		xmlFree(attr);
+	}
+}
+
+
+struct CXMLDocumentImpl {
+        CXMLDocumentImpl();
+        ~CXMLDocumentImpl();
+
+        xmlDocPtr doc;
+}; 
+
+CXMLDocumentImpl::CXMLDocumentImpl()
+{
+        doc = xmlNewDoc(BAD_CAST "1.0");
+}
+
+CXMLDocumentImpl::~CXMLDocumentImpl()
+{
+        xmlFreeDoc(doc);
+}
+
+       
+CXMLDocument::CXMLDocument():
+        impl(new CXMLDocumentImpl)
+{
+}
+        
+
+CXMLDocument::~CXMLDocument()
+{
+        delete impl;
+        xmlCleanupParser();
+        
+}
+
+	
+CXMLElement* CXMLDocument::create_root_node(const char *name)
+{
+        CXMLElement *result = new CXMLElement(name);
+        xmlDocSetRootElement(impl->doc, result->impl->element);
+        return result; 
+}
+
+string CXMLDocument::write_to_string_formatted() const
+{
+        xmlChar *doc_txt_ptr = NULL;
+        int doc_txt_len = 0;
+        xmlKeepBlanksDefault(0); 
+        xmlDocDumpFormatMemory(impl->doc, 
+                               &doc_txt_ptr, 
+                               &doc_txt_len, 
+                               1);
+
+        stringstream out_string;
+	out_string << doc_txt_ptr; 
+        free(doc_txt_ptr);
+        return out_string.str(); 
+}
+
+NS_MIA_END
diff --git a/mia/core/xmlinterface.hh b/mia/core/xmlinterface.hh
new file mode 100644
index 0000000..c8933d3
--- /dev/null
+++ b/mia/core/xmlinterface.hh
@@ -0,0 +1,79 @@
+/* -*- mia-c++  -*-
+ *
+ * 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 MIA; if not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#ifndef mia_core_xmlinterface_hh
+#define mia_core_xmlinterface_hh
+
+#include <mia/core/defines.hh>
+
+NS_MIA_BEGIN
+
+/**
+   \brief This class implements a facade for the xml Element 
+
+   This class implements a facade for the XML IO to make it (later)
+   possible to change the used XML implementation. It is also useful 
+   to reduce the compile time dependencies for programs that use MIA. 
+
+   
+*/
+
+
+class EXPORT_CORE CXMLElement {
+public:
+	CXMLElement(const char *name);
+	~CXMLElement(); 
+	
+	// do not allow copying 
+	CXMLElement(const CXMLElement& orig) = delete;
+	CXMLElement& operator = (const CXMLElement& orig) = delete;
+
+	
+	CXMLElement* add_child(const char *name);
+	void set_attribute(const char *name, const std::string& value);
+	void set_child_text(const std::string& value);
+private:
+	friend class CXMLDocument; 
+	struct CXMLElementImpl *impl; 
+}; 
+
+
+class EXPORT_CORE CXMLDocument {
+public: 
+	CXMLDocument();
+
+	~CXMLDocument();
+
+	CXMLDocument(const CXMLDocument& other) = delete;
+	CXMLDocument& operator = (const CXMLDocument& other) = delete;
+		
+	
+	CXMLElement* create_root_node(const char *);
+	std::string write_to_string_formatted() const;
+
+private:
+	
+	struct CXMLDocumentImpl *impl; 
+}; 
+
+NS_MIA_END
+
+#endif 
diff --git a/mia/internal/autotest.hh b/mia/internal/autotest.hh
index eef1447..8a90a17 100644
--- a/mia/internal/autotest.hh
+++ b/mia/internal/autotest.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/internal/main.hh b/mia/internal/main.hh
index 7428739..6f2cab8 100644
--- a/mia/internal/main.hh
+++ b/mia/internal/main.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -36,19 +36,19 @@
   	              return callback(argc, argv);			\
 	        }                                                       \
 		catch (const std::runtime_error &e){			\
-			std::cerr << argv[0] << " runtime error: " << e.what() << std::endl; \
+			std::cerr << "\n" << argv[0] << " runtime error: " << e.what() << std::endl; \
  	        }							\
  	        catch (const std::invalid_argument &e){			\
-		        std::cerr << argv[0] << " invalid argument: " << e.what() << std::endl;	\
+		        std::cerr << "\n"  << argv[0] << " invalid argument: " << e.what() << std::endl;	\
 	        }							\
  	        catch (const std::logic_error &e){			\
-		        std::cerr << argv[0] << " logic error: " << e.what() << std::endl; \
+		        std::cerr << "\n"  << argv[0] << " logic error: " << e.what() << std::endl; \
 	        }							\
 	        catch (const std::exception& e){			\
-		        std::cerr << argv[0] << " error: " << e.what() << std::endl; \
+		        std::cerr << "\n"  << argv[0] << " error: " << e.what() << std::endl; \
 	        }							\
 	        catch (...){						\
-			std::cerr << argv[0] << " unknown exception" << std::endl; \
+			std::cerr << "\n"  << argv[0] << " unknown exception" << std::endl; \
 		}							\
 		return EXIT_FAILURE;					\
 	}
diff --git a/mia/internal/pluginsettest.hh b/mia/internal/pluginsettest.hh
index 0c6fce9..39c0e56 100644
--- a/mia/internal/pluginsettest.hh
+++ b/mia/internal/pluginsettest.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/internal/plugintester.hh b/mia/internal/plugintester.hh
index f755059..32e6ab2 100644
--- a/mia/internal/plugintester.hh
+++ b/mia/internal/plugintester.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/mesh.hh b/mia/mesh.hh
index 606c51c..55df13a 100644
--- a/mia/mesh.hh
+++ b/mia/mesh.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/mesh/CMakeLists.txt b/mia/mesh/CMakeLists.txt
index 6fee581..30f948f 100644
--- a/mia/mesh/CMakeLists.txt
+++ b/mia/mesh/CMakeLists.txt
@@ -1,6 +1,6 @@
 #
 # This file is part of MIA - a toolbox for medical image analysis 
-# Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+# 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
@@ -17,11 +17,13 @@
 #
 
 SET(MIAMESH_SRC
+  triangle_neighbourhood.cc
   triangularMesh.cc
   filter.cc
 ) 
 
 SET(MIAMESH_HEADERS
+  triangle_neighbourhood.hh
   triangularMesh.hh
   triangulate.hh
   filter.hh
@@ -48,5 +50,6 @@ SET(MIAMESHLIBS miamesh)
 ADD_SUBDIRECTORY(io)
 ADD_SUBDIRECTORY(filter)
 
+TEST_MESH(triangulate)
+TEST_MESH(triangle_neighbourhood)
 
-TEST_MESH(triangulate)
\ No newline at end of file
diff --git a/mia/mesh/clist.hh b/mia/mesh/clist.hh
index e7409fc..f7d72be 100644
--- a/mia/mesh/clist.hh
+++ b/mia/mesh/clist.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/mesh/filter.cc b/mia/mesh/filter.cc
index 989d390..32adee6 100644
--- a/mia/mesh/filter.cc
+++ b/mia/mesh/filter.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/mesh/filter.hh b/mia/mesh/filter.hh
index 3bd2ab5..c12d537 100644
--- a/mia/mesh/filter.hh
+++ b/mia/mesh/filter.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/mesh/filter/CMakeLists.txt b/mia/mesh/filter/CMakeLists.txt
index a007107..0915063 100644
--- a/mia/mesh/filter/CMakeLists.txt
+++ b/mia/mesh/filter/CMakeLists.txt
@@ -1,6 +1,6 @@
 #
 # This file is part of MIA - a toolbox for medical image analysis 
-# Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+# 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
@@ -17,7 +17,10 @@
 #
 
 SET(filtersMesh
+  addscale
+  deltrianglesbynormal
   scale
+  selectbig
   vtxsort
   )
 
diff --git a/mia/mesh/filter/addscale.cc b/mia/mesh/filter/addscale.cc
new file mode 100644
index 0000000..f6809d1
--- /dev/null
+++ b/mia/mesh/filter/addscale.cc
@@ -0,0 +1,87 @@
+/* -*- mia-c++  -*-
+ *
+ * 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 MIA; if not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <mia/mesh/filter/addscale.hh>
+#include <mia/3d/imageio.hh>
+#include <mia/3d/interpolator.hh>
+
+NS_BEGIN(mia_meshfilter_addscale) 
+using namespace mia; 
+using namespace std; 
+
+
+CAddScaleMeshFilter::CAddScaleMeshFilter(const string& image_filename ):
+	m_image_filename(image_filename) 
+{
+}
+	
+struct FSetScale: public TFilter<void> {
+        FSetScale(CTriangleMesh& mesh): m_mesh(mesh){}; 
+        
+        template <typename T> 
+        void operator ()( const T3DImage<T>& image) {
+                C3DInterpolatorFactory ipf("bspline:d=1", "zero");
+                unique_ptr<T3DConvoluteInterpolator<T>> ip(ipf.create(image.data())); 
+                
+		
+                transform(m_mesh.vertices_begin(), m_mesh.vertices_end(), 
+                          m_mesh.scale_begin(), [&ip](const C3DFVector& v) -> float {
+                                  return (*ip)(v); 
+                          });
+        }
+private: 
+        CTriangleMesh& m_mesh; 
+}; 
+
+PTriangleMesh CAddScaleMeshFilter::do_filter(const CTriangleMesh& mesh) const
+{
+        PTriangleMesh result = make_shared<CTriangleMesh>(mesh); 
+        P3DImage image = load_image3d(m_image_filename); 
+        
+        FSetScale ssc(*result); 
+        mia::accumulate(ssc, *image); 
+
+        return result; 
+}
+
+CAddScaleMeshFilterPlugin::CAddScaleMeshFilterPlugin():
+	CMeshFilterPlugin("addscale")
+{
+	add_parameter("img", make_param(m_image_filename, true, 
+					"3DImage that containes the scale values as a volume image."));
+}
+
+mia::CMeshFilter *CAddScaleMeshFilterPlugin::do_create()const
+{
+	return new CAddScaleMeshFilter(m_image_filename);
+}
+
+const std::string CAddScaleMeshFilterPlugin::do_get_descr()const
+{
+	return "This filter sorts sets the scale parameter for each vertex from a 3D image. "
+                "Image and mesh are expected to be in the same physical coordinate space."; 
+}
+
+extern "C" EXPORT CPluginBase *get_plugin_interface()
+{
+	return new CAddScaleMeshFilterPlugin();
+}
+
+NS_END
diff --git a/mia/mesh/filter/vtxsort.hh b/mia/mesh/filter/addscale.hh
similarity index 73%
copy from mia/mesh/filter/vtxsort.hh
copy to mia/mesh/filter/addscale.hh
index 0c803a7..39237d6 100644
--- a/mia/mesh/filter/vtxsort.hh
+++ b/mia/mesh/filter/addscale.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -21,32 +21,31 @@
 #include <mia/mesh/filter.hh>
 
 
-NS_BEGIN(mia_meshfilter_vtxsort) 
+NS_BEGIN(mia_meshfilter_addscale) 
 
-using mia::C3DFVector; 
 using mia::PTriangleMesh; 
 using mia::CTriangleMesh; 
 
 
-class CVtxSortMeshFilter: public mia::CMeshFilter {
+class CAddScaleMeshFilter: public mia::CMeshFilter {
 public: 
-	CVtxSortMeshFilter(const C3DFVector& sort_direction ); 
+	CAddScaleMeshFilter(const std::string& image_filename ); 
 private: 
 	PTriangleMesh do_filter(const CTriangleMesh& image) const; 
 	
-	C3DFVector m_sort_direction; 
+	std::string m_image_filename; 
 }; 
 
 
-class CVtxSortMeshFilterPlugin: public mia::CMeshFilterPlugin {
+class CAddScaleMeshFilterPlugin: public mia::CMeshFilterPlugin {
 public: 
-	CVtxSortMeshFilterPlugin(); 
+	CAddScaleMeshFilterPlugin(); 
 
 	virtual mia::CMeshFilter *do_create()const;
 	virtual const std::string do_get_descr()const;
 
 private: 
-	C3DFVector m_sort_direction; 
+	std::string m_image_filename; 
 }; 
 
 NS_END
diff --git a/mia/mesh/filter/deltrianglesbynormal.cc b/mia/mesh/filter/deltrianglesbynormal.cc
new file mode 100644
index 0000000..791f67a
--- /dev/null
+++ b/mia/mesh/filter/deltrianglesbynormal.cc
@@ -0,0 +1,160 @@
+/* -*- mia-c++  -*-
+ *
+ * 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 MIA; if not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <mia/mesh/filter/deltrianglesbynormal.hh>
+#include <mia/mesh/triangle_neighbourhood.hh>
+
+#include <tbb/parallel_for.h>
+#include <tbb/blocked_range.h>
+#include <mia/core/threadedmsg.hh>
+
+
+
+#include <cmath>
+#include <set>
+
+NS_BEGIN(mia_meshfilter_deltribynormal) 
+using namespace mia; 
+using namespace std; 
+using tbb::blocked_range; 
+using tbb::parallel_for; 
+
+
+CDeleteTriangleByNormalMeshFilter::CDeleteTriangleByNormalMeshFilter(const C3DFVector& point_direction, float angle):
+	m_point_direction(point_direction), 
+	m_test_angle_cos(cosf(angle / 180.0f * M_PI))
+{
+	auto pn = m_point_direction.norm(); 
+	if (pn < 1e-5)
+		throw invalid_argument("CDeleteTriangleByNormalMeshFilter:you provided a very small normal direction vector."); 
+	
+	m_point_direction /= pn; 
+
+	cvdebug() << "CDeleteTriangleByNormalMeshFilter:dir=" << m_point_direction << ", cos(angle)= "<< m_test_angle_cos << "\n";
+}
+	
+
+PTriangleMesh CDeleteTriangleByNormalMeshFilter::do_filter(const CTriangleMesh& mesh) const
+{
+	// evaluate the triangle normals, 
+	vector<bool>  keep(mesh.triangle_size(), false); 
+
+	auto run_triangles = [this, &mesh, &keep](const blocked_range<unsigned>& range) {
+		CThreadMsgStream thread_stream;		
+		for (auto i = range.begin(); i != range.end(); ++i) {
+			auto& t = mesh.triangle_at(i); 
+			auto& vx = mesh.vertex_at(t.x); 
+			auto& vy = mesh.vertex_at(t.y); 
+			auto& vz = mesh.vertex_at(t.z); 
+
+			auto e1 = vx - vy;
+			auto e2 = vz - vy;
+			auto normal = cross(e2, e1);
+			auto nn = normal.norm(); 
+
+			// very small triangles will be discarded
+			// this should become a separate filter 
+			if (nn < 1e-5) 
+				continue; 
+
+			auto test_dir = dot(normal, m_point_direction) / nn; 
+
+			cvdebug() << "Triangle:" << t << ": test-angle-cos = " << test_dir << "\n"; 
+			if (test_dir >= m_test_angle_cos) 
+				keep[i] = true; 
+		}; 
+	}; 
+	
+	// estimate which triangles to keep 
+	parallel_for(blocked_range<unsigned>(0, mesh.triangle_size()), run_triangles); 
+
+	// iteratively re-add all triangles that have at least two neighbours within the keep 
+	CTrianglesWithAdjacentList trineigh(mesh); 
+
+	int changed;
+	do {
+		changed = 0; 
+		for (size_t i = 0; i < mesh.triangle_size(); ++i) {
+			if (!keep[i]) {
+				auto& ajd =  trineigh[i]; 
+				int k = 0; 
+				for ( auto a: ajd) 
+					if (keep[a]) 
+						++k; 
+				
+				if (k >= 2) {
+					++changed; 
+					keep[i] = true; 
+				}
+			}
+		} 
+		cvdebug() << "readded " << changed << " triangles, because of neighbourhood\n"; 
+	} while (changed > 0); 
+
+	// remove isolated triangles 
+	for (size_t i = 0; i < mesh.triangle_size(); ++i) {
+		if (keep[i]) {
+			auto& ajd =  trineigh[i]; 
+			bool k = false; 
+			for ( auto a: ajd) 
+				k |= keep[a];
+			keep[i] = k;
+		}
+	}
+	
+	vector<unsigned> triangle_indices; 
+	for (size_t i = 0; i < mesh.triangle_size(); ++i) {
+		if (keep[i]) 
+			triangle_indices.push_back(i);
+	}
+	
+	return get_sub_mesh(mesh, triangle_indices); 
+}
+
+CDeleteTriangleByNormalMeshFilterPlugin::CDeleteTriangleByNormalMeshFilterPlugin():
+	CMeshFilterPlugin("deltribynormal"), 
+	m_point_direction(0,1,0), 
+	m_tolerance_angle(5)
+{
+	add_parameter("dir", make_param(m_point_direction, true, 
+					"Direction the triangle normals are expected to point to. The "
+					"orientation of the vector is taken into account."));
+	add_parameter("angle", make_param(m_tolerance_angle, false, 
+					  "Tolerance angle (in degree) that the normal can diviate from "
+					  "the provided direction."));
+}
+
+mia::CMeshFilter *CDeleteTriangleByNormalMeshFilterPlugin::do_create()const
+{
+	return new CDeleteTriangleByNormalMeshFilter(m_point_direction, m_tolerance_angle);
+}
+
+const std::string CDeleteTriangleByNormalMeshFilterPlugin::do_get_descr()const
+{
+	return "This filter deletes all triangles that have a normal that differs by the  " 
+		"given angle from the provided direction."; 
+}
+
+extern "C" EXPORT CPluginBase *get_plugin_interface()
+{
+	return new CDeleteTriangleByNormalMeshFilterPlugin();
+}
+
+NS_END
diff --git a/mia/mesh/filter/vtxsort.hh b/mia/mesh/filter/deltrianglesbynormal.hh
similarity index 68%
copy from mia/mesh/filter/vtxsort.hh
copy to mia/mesh/filter/deltrianglesbynormal.hh
index 0c803a7..6a7e71c 100644
--- a/mia/mesh/filter/vtxsort.hh
+++ b/mia/mesh/filter/deltrianglesbynormal.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -21,32 +21,34 @@
 #include <mia/mesh/filter.hh>
 
 
-NS_BEGIN(mia_meshfilter_vtxsort) 
+NS_BEGIN(mia_meshfilter_deltribynormal) 
 
 using mia::C3DFVector; 
 using mia::PTriangleMesh; 
 using mia::CTriangleMesh; 
 
 
-class CVtxSortMeshFilter: public mia::CMeshFilter {
+class CDeleteTriangleByNormalMeshFilter: public mia::CMeshFilter {
 public: 
-	CVtxSortMeshFilter(const C3DFVector& sort_direction ); 
+	CDeleteTriangleByNormalMeshFilter(const C3DFVector& point_direction, float angle); 
 private: 
 	PTriangleMesh do_filter(const CTriangleMesh& image) const; 
 	
-	C3DFVector m_sort_direction; 
+	C3DFVector m_point_direction; 
+	float m_test_angle_cos; 
 }; 
 
 
-class CVtxSortMeshFilterPlugin: public mia::CMeshFilterPlugin {
+class CDeleteTriangleByNormalMeshFilterPlugin: public mia::CMeshFilterPlugin {
 public: 
-	CVtxSortMeshFilterPlugin(); 
+	CDeleteTriangleByNormalMeshFilterPlugin(); 
 
 	virtual mia::CMeshFilter *do_create()const;
 	virtual const std::string do_get_descr()const;
 
 private: 
-	C3DFVector m_sort_direction; 
+	C3DFVector m_point_direction; 
+	float m_tolerance_angle; 
 }; 
 
 NS_END
diff --git a/mia/mesh/filter/scale.cc b/mia/mesh/filter/scale.cc
index 2cb7036..4efac0d 100644
--- a/mia/mesh/filter/scale.cc
+++ b/mia/mesh/filter/scale.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/mesh/filter/scale.hh b/mia/mesh/filter/scale.hh
index 2bd1054..d4c0c73 100644
--- a/mia/mesh/filter/scale.hh
+++ b/mia/mesh/filter/scale.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/mesh/filter/selectbig.cc b/mia/mesh/filter/selectbig.cc
new file mode 100644
index 0000000..7943500
--- /dev/null
+++ b/mia/mesh/filter/selectbig.cc
@@ -0,0 +1,111 @@
+/* -*- mia-c++  -*-
+ *
+ * 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 MIA; if not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <queue>
+#include <mia/mesh/filter/selectbig.hh>
+#include <mia/mesh/triangle_neighbourhood.hh>
+
+NS_BEGIN(mia_meshfilter_selectbig) 
+using namespace mia; 
+using namespace std; 
+
+
+CSelectBigMeshFilter::CSelectBigMeshFilter()
+{
+}
+	
+
+PTriangleMesh CSelectBigMeshFilter::do_filter(const CTriangleMesh& mesh) const
+{
+        CTrianglesWithAdjacentList tri_neigh(mesh); 
+        
+        vector<bool> taken(mesh.triangle_size(), false); 
+        vector<bool> added(mesh.triangle_size(), false); 
+        
+        size_t remaining = mesh.triangle_size(); 
+        
+        vector<unsigned> largest_section; 
+                
+        while (remaining) {
+                vector<unsigned> section; 
+                
+                unsigned int idx = 0; 
+                while (taken[idx]) 
+                        ++idx; 
+        
+                cvdebug() << "Start section at " << idx << "\n"; 
+                queue<unsigned> next_triangle; 
+                next_triangle.push(idx); 
+		added[idx] = true; 
+                while (!next_triangle.empty()) {
+                        unsigned t = next_triangle.front(); 
+                        next_triangle.pop(); 
+                        if (!taken[t]) {
+				cvdebug() << "Add " << t << "\n"; 
+                                section.push_back(t); 
+                                taken[t] = true; 
+                                --remaining; 
+                        }
+                        
+                        auto& ajd =  tri_neigh[t]; 
+                        for ( auto a: ajd) {
+                                if (!taken[a] && !added[a]) {
+                                        next_triangle.push(a); 
+					added[a] = true; 
+				}
+                        }
+                }
+                if (section.size() > largest_section.size()) {
+                        swap(largest_section, section); 
+                        cvdebug() << "got section of size " << largest_section.size() << "\n"; 
+                }
+                if (largest_section.size() > remaining) {
+                        cvdebug() << "Only remain " << remaining << " triangles, stop processing\n"; 
+                        break; 
+                }
+        }
+        
+        return get_sub_mesh(mesh, largest_section);
+}
+
+CSelectBigMeshFilterPlugin::CSelectBigMeshFilterPlugin():
+	CMeshFilterPlugin("selectbig")
+{
+}
+
+mia::CMeshFilter *CSelectBigMeshFilterPlugin::do_create()const
+{
+	return new CSelectBigMeshFilter();
+}
+
+const std::string CSelectBigMeshFilterPlugin::do_get_descr()const
+{
+	return "This filter selects the component with the highest number of triangles from "
+                "a mesh that is actually composed of disconnected components. Components are "
+                "considered to be disconnected if they don't share a common edge (they might "
+                "share a common vertex though"; 
+}
+
+extern "C" EXPORT CPluginBase *get_plugin_interface()
+{
+	return new CSelectBigMeshFilterPlugin();
+}
+
+NS_END
diff --git a/mia/mesh/filter/vtxsort.hh b/mia/mesh/filter/selectbig.hh
similarity index 73%
copy from mia/mesh/filter/vtxsort.hh
copy to mia/mesh/filter/selectbig.hh
index 0c803a7..b281908 100644
--- a/mia/mesh/filter/vtxsort.hh
+++ b/mia/mesh/filter/selectbig.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -21,32 +21,27 @@
 #include <mia/mesh/filter.hh>
 
 
-NS_BEGIN(mia_meshfilter_vtxsort) 
+NS_BEGIN(mia_meshfilter_selectbig) 
 
 using mia::C3DFVector; 
 using mia::PTriangleMesh; 
 using mia::CTriangleMesh; 
 
 
-class CVtxSortMeshFilter: public mia::CMeshFilter {
+class CSelectBigMeshFilter: public mia::CMeshFilter {
 public: 
-	CVtxSortMeshFilter(const C3DFVector& sort_direction ); 
+	CSelectBigMeshFilter(); 
 private: 
 	PTriangleMesh do_filter(const CTriangleMesh& image) const; 
-	
-	C3DFVector m_sort_direction; 
 }; 
 
 
-class CVtxSortMeshFilterPlugin: public mia::CMeshFilterPlugin {
+class CSelectBigMeshFilterPlugin: public mia::CMeshFilterPlugin {
 public: 
-	CVtxSortMeshFilterPlugin(); 
+	CSelectBigMeshFilterPlugin(); 
 
 	virtual mia::CMeshFilter *do_create()const;
 	virtual const std::string do_get_descr()const;
-
-private: 
-	C3DFVector m_sort_direction; 
 }; 
 
 NS_END
diff --git a/mia/mesh/filter/test_addscale.cc b/mia/mesh/filter/test_addscale.cc
new file mode 100644
index 0000000..e2baf36
--- /dev/null
+++ b/mia/mesh/filter/test_addscale.cc
@@ -0,0 +1,87 @@
+/* -*- mia-c++  -*-
+ *
+ * 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 MIA; if not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <mia/internal/plugintester.hh>
+#include <mia/mesh/filter/addscale.hh>
+#include <mia/3d/imageio.hh>
+
+using namespace mia; 
+using namespace mia_meshfilter_addscale; 
+
+struct DefineMeshFixture {
+
+	DefineMeshFixture(); 
+
+	PTriangleMesh mesh; 
+}; 
+
+BOOST_FIXTURE_TEST_CASE(test_add_scale, DefineMeshFixture) 
+{
+	C3DFImage *scales = new C3DFImage(C3DBounds(3,3,3)); 
+	P3DImage pimg(scales); 
+	
+	float values[27] = { 1, 2, 3,  4, 5, 6,  7, 8, 9, 
+			     11, 12, 13,   14, 15, 16,   17, 18, 19, 
+			     31, 32, 33,   34, 35, 36,   37, 38, 39}; 
+
+	copy(values, values+27, scales->begin()); 
+
+	save_image("scales.@", pimg); 
+	
+	auto add = BOOST_TEST_create_from_plugin<CAddScaleMeshFilterPlugin>("addscale:img=scales.@");
+	
+	auto new_mesh = add->filter(*mesh); 
+	
+	float expect[] = {2.5f, 1.5f, 5.5f, 6.5f, 21.f, 11.5f}; 
+	
+	BOOST_CHECK_EQUAL(new_mesh->vertices_size(), 6u); 
+	BOOST_CHECK_EQUAL(new_mesh->triangle_size(), 8u); 
+
+	for (unsigned i = 0; i < 6; ++i) {
+		BOOST_CHECK_CLOSE(new_mesh->scale_at(i), expect[i], 0.01); 
+		BOOST_CHECK_EQUAL(new_mesh->vertex_at(i), mesh->vertex_at(i));
+	}
+	for (unsigned i = 0; i < 8; ++i) {
+		BOOST_CHECK_EQUAL(new_mesh->triangle_at(i), mesh->triangle_at(i));
+	}
+}
+
+DefineMeshFixture::DefineMeshFixture()
+{
+	auto vertices = CTriangleMesh::PVertexfield(
+		new CTriangleMesh::CVertexfield(
+			{C3DFVector(1.5,0,0), C3DFVector(0.5,0,0), 
+					C3DFVector(0,1.5,0), C3DFVector(1,1.5,0), 
+					C3DFVector(0,0,1.5), C3DFVector(0.5,0,1)})); 
+	
+	typedef CTriangleMesh::triangle_type Triangle; 
+	
+	auto triangles = CTriangleMesh::PTrianglefield(
+		new CTriangleMesh::CTrianglefield(
+			{Triangle(4, 0, 2), Triangle(4, 2, 1), 
+					Triangle(4, 1, 3), Triangle(4, 3, 0), 
+					Triangle(5, 2, 0), Triangle(5, 1, 2), 
+					Triangle(5, 3, 1), Triangle(5, 0, 3)})); 
+	
+	mesh = std::make_shared<CTriangleMesh>(triangles, vertices); 
+	
+}
+
+
diff --git a/mia/mesh/filter/test_deltrianglesbynormal.cc b/mia/mesh/filter/test_deltrianglesbynormal.cc
new file mode 100644
index 0000000..2d5bec2
--- /dev/null
+++ b/mia/mesh/filter/test_deltrianglesbynormal.cc
@@ -0,0 +1,101 @@
+/* -*- mia-c++  -*-
+ *
+ * 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 MIA; if not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <mia/internal/plugintester.hh>
+#include <mia/mesh/filter/deltrianglesbynormal.hh>
+
+#include <set>
+
+using namespace mia; 
+using namespace mia_meshfilter_deltribynormal; 
+
+using std::set; 
+using std::for_each; 
+using std::make_shared; 
+
+struct DefineMeshFixture {
+
+	DefineMeshFixture(); 
+
+	PTriangleMesh mesh; 
+}; 
+
+template <typename T> 
+struct compare_vertex_ordered  {
+	bool operator () (const T3DVector<T>& lhs, const T3DVector<T>& rhs) {
+		return (lhs.z < rhs.z) || 
+			((lhs.z == rhs.z) && ((lhs.y < rhs.y) ||
+						  ((lhs.y == rhs.y) && (lhs.x < rhs.x)))); 
+	}
+}; 
+
+
+
+
+BOOST_FIXTURE_TEST_CASE(test_positive_z, DefineMeshFixture) 
+{
+	auto clean = BOOST_TEST_create_from_plugin<CDeleteTriangleByNormalMeshFilterPlugin>("deltribynormal:dir=[0,0,1],angle=36");
+	
+	auto filtered_mesh = clean->filter(mesh); 
+
+	BOOST_CHECK_EQUAL(filtered_mesh->triangle_size(), 4u); 
+	BOOST_CHECK_EQUAL(filtered_mesh->vertices_size(), 5u); 
+	
+	set<C3DFVector, compare_vertex_ordered<float> > expect_vertices({C3DFVector(2,0,0), C3DFVector(-2,0,0), 
+				C3DFVector(0,2,0), C3DFVector(0,-2,0), 
+				C3DFVector(0,0,1)}); 
+	
+	for_each(filtered_mesh->vertices_begin(), filtered_mesh->vertices_end(), 
+		 [&expect_vertices](const C3DFVector& x) {BOOST_CHECK(expect_vertices.find(x) != expect_vertices.end());}); 
+
+	typedef CTriangleMesh::triangle_type Triangle; 
+	
+	
+	set<Triangle, compare_vertex_ordered<unsigned int>> expect_triangles(
+		{Triangle(4, 2, 3), Triangle(4, 3, 1), Triangle(4, 1, 0), Triangle(4, 0, 2)}
+		); 
+
+	for_each(filtered_mesh->triangles_begin(), filtered_mesh->triangles_end(), 
+		 [&expect_triangles](const Triangle& x) {BOOST_CHECK(expect_triangles.find(x) != expect_triangles.end());});
+}
+
+
+
+DefineMeshFixture::DefineMeshFixture()
+{
+	auto vertices = CTriangleMesh::PVertexfield(
+		new CTriangleMesh::CVertexfield(
+			{C3DFVector(2,0,0), C3DFVector(-2,0,0), 
+					C3DFVector(0,2,0), C3DFVector(0,-2,0), 
+					C3DFVector(0,0,1), C3DFVector(0,0,-1)})); 
+	
+	typedef CTriangleMesh::triangle_type Triangle; 
+	
+	auto triangles = CTriangleMesh::PTrianglefield(
+		new CTriangleMesh::CTrianglefield(
+			{Triangle(4, 0, 2), Triangle(4, 2, 1), 
+					Triangle(4, 1, 3), Triangle(4, 3, 0), 
+					Triangle(5, 2, 0), Triangle(5, 1, 2), 
+					Triangle(5, 3, 1), Triangle(5, 0, 3)})); 
+	
+	mesh = make_shared<CTriangleMesh>(triangles, vertices); 
+	
+	
+}
diff --git a/mia/mesh/filter/test_scale.cc b/mia/mesh/filter/test_scale.cc
index 5895e1a..0bb4557 100644
--- a/mia/mesh/filter/test_scale.cc
+++ b/mia/mesh/filter/test_scale.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/mesh/filter/test_selectbig.cc b/mia/mesh/filter/test_selectbig.cc
new file mode 100644
index 0000000..74461a5
--- /dev/null
+++ b/mia/mesh/filter/test_selectbig.cc
@@ -0,0 +1,103 @@
+/* -*- mia-c++  -*-
+ *
+ * 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 MIA; if not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <mia/internal/plugintester.hh>
+#include <mia/mesh/filter/selectbig.hh>
+
+#include <set>
+
+using namespace mia; 
+using namespace mia_meshfilter_selectbig; 
+
+using std::set; 
+using std::for_each; 
+using std::make_shared; 
+
+struct DefineMeshFixture {
+
+	DefineMeshFixture(); 
+
+	PTriangleMesh mesh; 
+}; 
+
+template <typename T> 
+struct compare_vertex_ordered  {
+	bool operator () (const T3DVector<T>& lhs, const T3DVector<T>& rhs) {
+		return (lhs.z < rhs.z) || 
+			((lhs.z == rhs.z) && ((lhs.y < rhs.y) ||
+						  ((lhs.y == rhs.y) && (lhs.x < rhs.x)))); 
+	}
+}; 
+
+BOOST_FIXTURE_TEST_CASE(test_submesh, DefineMeshFixture) 
+{
+	auto selbig = BOOST_TEST_create_from_plugin<CSelectBigMeshFilterPlugin>("selectbig");
+	
+	auto filtered_mesh = selbig->filter(mesh); 
+
+	BOOST_CHECK_EQUAL(filtered_mesh->triangle_size(), 8u); 
+	BOOST_CHECK_EQUAL(filtered_mesh->vertices_size(), 6u); 
+	
+	set<C3DFVector, compare_vertex_ordered<float> > expect_vertices({C3DFVector(2,0,0), C3DFVector(-2,0,0), 
+				C3DFVector(0,2,0), C3DFVector(0,-2,0), 
+				C3DFVector(0,0,1), C3DFVector(0,0,-1)}); 
+	
+	for_each(filtered_mesh->vertices_begin(), filtered_mesh->vertices_end(), 
+		 [&expect_vertices](const C3DFVector& x) {BOOST_CHECK(expect_vertices.find(x) != expect_vertices.end());}); 
+
+	typedef CTriangleMesh::triangle_type Triangle; 
+	
+	
+	set<Triangle, compare_vertex_ordered<unsigned int>> 
+                expect_triangles({Triangle(5, 3, 4), Triangle(5, 4, 2), 
+                                        Triangle(5, 2, 1), Triangle(5, 1, 3), 
+                                        Triangle(0, 4, 3), Triangle(0, 2, 4), 
+                                        Triangle(0, 1, 2), Triangle(0, 3, 1)}); 
+        
+	for_each(filtered_mesh->triangles_begin(), filtered_mesh->triangles_end(), 
+		 [&expect_triangles](const Triangle& x) {BOOST_CHECK(expect_triangles.find(x) != expect_triangles.end());});
+}
+
+
+
+DefineMeshFixture::DefineMeshFixture()
+{
+	auto vertices = CTriangleMesh::PVertexfield(
+		new CTriangleMesh::CVertexfield(
+			{C3DFVector(2,0,0), C3DFVector(-2,0,0), 
+					C3DFVector(0,2,0), C3DFVector(0,-2,0), 
+					C3DFVector(0,0,1), C3DFVector(0,0,-1), 
+                                        C3DFVector(0,3,1), C3DFVector(3,0,1), 
+                                        C3DFVector(0,0,3)
+                                        })); 
+	
+	typedef CTriangleMesh::triangle_type Triangle; 
+	
+	auto triangles = CTriangleMesh::PTrianglefield(
+		new CTriangleMesh::CTrianglefield(
+			{Triangle(4, 0, 2), Triangle(4, 2, 1), 
+					Triangle(4, 1, 3), Triangle(4, 3, 0), 
+					Triangle(5, 2, 0), Triangle(5, 1, 2), 
+					Triangle(5, 3, 1), Triangle(5, 0, 3), 
+                                        Triangle(6, 7 ,8)
+                                        }));
+	
+	mesh = make_shared<CTriangleMesh>(triangles, vertices); 
+}
diff --git a/mia/mesh/filter/test_vtxsort.cc b/mia/mesh/filter/test_vtxsort.cc
index db4cafd..96868ae 100644
--- a/mia/mesh/filter/test_vtxsort.cc
+++ b/mia/mesh/filter/test_vtxsort.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/mesh/filter/vtxsort.cc b/mia/mesh/filter/vtxsort.cc
index 138bbeb..a797434 100644
--- a/mia/mesh/filter/vtxsort.cc
+++ b/mia/mesh/filter/vtxsort.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/mesh/filter/vtxsort.hh b/mia/mesh/filter/vtxsort.hh
index 0c803a7..c1f3872 100644
--- a/mia/mesh/filter/vtxsort.hh
+++ b/mia/mesh/filter/vtxsort.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/mesh/io/CMakeLists.txt b/mia/mesh/io/CMakeLists.txt
index a3a6a53..da7b8f7 100644
--- a/mia/mesh/io/CMakeLists.txt
+++ b/mia/mesh/io/CMakeLists.txt
@@ -1,6 +1,6 @@
 #
 # This file is part of MIA - a toolbox for medical image analysis 
-# Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+# 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
diff --git a/mia/mesh/io/gts.cc b/mia/mesh/io/gts.cc
index db0fc9c..f1591e4 100644
--- a/mia/mesh/io/gts.cc
+++ b/mia/mesh/io/gts.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/mesh/io/off.cc b/mia/mesh/io/off.cc
index eff9dd5..645985a 100644
--- a/mia/mesh/io/off.cc
+++ b/mia/mesh/io/off.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/mesh/io/ply.cc b/mia/mesh/io/ply.cc
index ea1cc02..3b8f552 100644
--- a/mia/mesh/io/ply.cc
+++ b/mia/mesh/io/ply.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/mesh/io/stl.cc b/mia/mesh/io/stl.cc
index 1e39daa..ea50e07 100644
--- a/mia/mesh/io/stl.cc
+++ b/mia/mesh/io/stl.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/mesh/test_triangle_neighbourhood.cc b/mia/mesh/test_triangle_neighbourhood.cc
new file mode 100644
index 0000000..033ca40
--- /dev/null
+++ b/mia/mesh/test_triangle_neighbourhood.cc
@@ -0,0 +1,74 @@
+/* -*- mia-c++  -*-
+ *
+ * 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 MIA; if not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <mia/internal/autotest.hh>
+#include <mia/mesh/triangle_neighbourhood.hh>
+
+using namespace std; 
+using namespace mia; 
+
+static void check_sets_equal(const set<unsigned>& lhs, const set<unsigned>& rhs) 
+{
+        BOOST_CHECK_EQUAL(lhs.size(), rhs.size()); 
+
+        for (auto k: lhs)
+                BOOST_CHECK(rhs.find(k) != rhs.end()); 
+}
+
+BOOST_AUTO_TEST_CASE(test_neighborhood) 
+{
+        auto vertices = CTriangleMesh::PVertexfield(new CTriangleMesh::CVertexfield({C3DFVector(2,0,0), C3DFVector(-2,0,0), 
+                                        C3DFVector(0,2,0), C3DFVector(0,-2,0), 
+                                        C3DFVector(0,0,1), C3DFVector(0,0,-1)})); 
+	
+	typedef CTriangleMesh::triangle_type Triangle; 
+	
+	auto triangles = CTriangleMesh::PTrianglefield(
+		new CTriangleMesh::CTrianglefield(
+			{Triangle(4, 0, 2), Triangle(4, 2, 1), 
+			 Triangle(4, 1, 3), Triangle(4, 3, 0), 
+			 Triangle(5, 2, 0), Triangle(5, 1, 2), 
+			 Triangle(5, 3, 1), Triangle(5, 0, 3)})); 
+	
+	CTriangleMesh mesh(triangles, vertices);
+
+        CTrianglesWithAdjacentList adj(mesh); 
+        
+        set<unsigned> toadj0({3, 4, 1}); 
+        set<unsigned> toadj1({0, 5, 2}); 
+        set<unsigned> toadj2({1, 6, 3}); 
+        set<unsigned> toadj3({2, 0, 7}); 
+
+        set<unsigned> toadj4({7, 5, 0}); 
+        set<unsigned> toadj5({4, 1, 6}); 
+        set<unsigned> toadj6({5, 7, 2}); 
+        set<unsigned> toadj7({6, 4, 3}); 
+        
+        check_sets_equal(adj[0], toadj0); 
+        check_sets_equal(adj[1], toadj1); 
+        check_sets_equal(adj[2], toadj2); 
+        check_sets_equal(adj[3], toadj3); 
+        check_sets_equal(adj[4], toadj4); 
+        check_sets_equal(adj[5], toadj5); 
+        check_sets_equal(adj[6], toadj6); 
+        check_sets_equal(adj[7], toadj7);
+        
+
+}
diff --git a/mia/mesh/test_triangulate.cc b/mia/mesh/test_triangulate.cc
index d613d69..bc2550b 100644
--- a/mia/mesh/test_triangulate.cc
+++ b/mia/mesh/test_triangulate.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/mesh/triangle_neighbourhood.cc b/mia/mesh/triangle_neighbourhood.cc
new file mode 100644
index 0000000..f1e9639
--- /dev/null
+++ b/mia/mesh/triangle_neighbourhood.cc
@@ -0,0 +1,94 @@
+/* -*- mia-c++  -*-
+ *
+ * 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 MIA; if not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+#include <mia/mesh/triangle_neighbourhood.hh>
+#include <map>
+
+NS_MIA_BEGIN
+
+using namespace std; 
+
+struct Edge {
+        unsigned a; 
+        unsigned b;
+        Edge(unsigned _a, unsigned _b); 
+        void add_triangle(unsigned t); 
+}; 
+
+
+Edge::Edge(unsigned _a, unsigned _b):
+        a(_a), b(_b)
+{
+        if (a > b) 
+                swap(a,b); 
+}
+
+
+struct compare_edge {
+        bool operator () ( const Edge& lhs, const Edge& rhs) const {
+                return (lhs.a < rhs.a) || ((lhs.a == rhs.a) && lhs.b < rhs.b); 
+        }
+}; 
+
+CTrianglesWithAdjacentList::CTrianglesWithAdjacentList(const CTriangleMesh& mesh):
+m_triangle_neighborhood(mesh.triangle_size())
+{
+        // collect the edges and adjacent triangles 
+
+        map<Edge, set<unsigned>, compare_edge> edges;
+
+        auto add_edge = [&edges](unsigned a, unsigned b, unsigned t) {
+                Edge e(a,b); 
+                auto ie = edges.find(e); 
+                if (ie == edges.end()) {
+                        set<unsigned> n({t}); 
+                        edges[e] = n;
+                        
+                } else 
+                        ie->second.insert(t);
+        }; 
+
+        // collect all edges and 
+        for (unsigned it = 0; it < mesh.triangle_size(); ++it) {
+                auto t = mesh.triangle_at(it); 
+                add_edge(t.x, t.y, it); 
+                add_edge(t.y, t.z, it); 
+                add_edge(t.z, t.x, it); 
+        }
+
+        // now collect the adjesent triangles
+        for (auto e : edges) {
+                for (auto t1 : e.second) {
+                        for (auto t2 : e.second) {
+                                if (t1 != t2) {
+                                        m_triangle_neighborhood[t1].insert(t2); 
+                                        m_triangle_neighborhood[t2].insert(t1);
+                                }
+                        }
+                }
+        }
+}
+        
+const std::set<unsigned>& CTrianglesWithAdjacentList::operator [](unsigned idx) const
+{
+        assert(idx < m_triangle_neighborhood.size()); 
+        return m_triangle_neighborhood[idx]; 
+}
+
+NS_MIA_END
diff --git a/mia/2d/trackpoint.hh b/mia/mesh/triangle_neighbourhood.hh
similarity index 62%
copy from mia/2d/trackpoint.hh
copy to mia/mesh/triangle_neighbourhood.hh
index 15bca70..c7d12e7 100644
--- a/mia/2d/trackpoint.hh
+++ b/mia/mesh/triangle_neighbourhood.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 David Pastor, Gert Wollny
+ * 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
@@ -18,24 +18,25 @@
  *
  */
 
-#ifndef mia_2d_trackpoint_hh
-#define mia_2d_trackpoint_hh
+#ifndef mia_mesh_triangleneighborhood_hh
+#define mia_mesh_triangleneighborhood_hh
 
-#include <mia/2d/transform.hh>
-#include <mia/template/trackpoint.hh>
+#include <mia/mesh/triangularMesh.hh>
 
 NS_MIA_BEGIN
 
+class EXPORT_MESH  CTrianglesWithAdjacentList {
+public: 
+        CTrianglesWithAdjacentList(const CTriangleMesh& mesh); 
 
+        const std::set<unsigned>& operator [](unsigned idx) const; 
 
-/**
-   \brief Class to track pixel movement based on a transformation
+private: 
 
-   This class holds the information to track a single pixel in 2D space 
-   over time and with a given transformation.  
-*/
+        std::vector<std::set<unsigned> > m_triangle_neighborhood; 
 
-typedef TTrackPoint<C2DTransformation>  C2DTrackPoint; 
+        
+}; 
 
 
 NS_MIA_END
diff --git a/mia/mesh/triangularMesh.cc b/mia/mesh/triangularMesh.cc
index 393ad29..733fba1 100644
--- a/mia/mesh/triangularMesh.cc
+++ b/mia/mesh/triangularMesh.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -22,11 +22,19 @@
 
 #define _USE_MATH_DEFINES
 #include <cmath>
+#include <set>
 #include <mia/mesh/triangularMesh.hh>
 
+#include <tbb/parallel_for.h>
+#include <tbb/parallel_reduce.h>
+#include <tbb/blocked_range.h>
+
+#include <mia/core/threadedmsg.hh>
+
 
 NS_MIA_BEGIN
 
+using namespace tbb;
 using namespace std;
 using namespace boost;
 
@@ -127,7 +135,6 @@ void CTriangleMeshData::evaluate_normals()
 		// before overwriting the normales, make sure we work on this set
 		ensure_single_refered(m_normals);
 	// zero out normals
-	fill(m_normals->begin(), m_normals->end(), C3DFVector::_0); 
 
 	// the writable iterators, index operators  do check against multiple referencing of the data.
 	// We only need read access, therefore a const reference makes sure,
@@ -136,42 +143,73 @@ void CTriangleMeshData::evaluate_normals()
 	//const CTriangleMesh::vertexfield&    cvertices = *m_vertices;
 
 	cvdebug() << "Mesh has " << ctriangles.size() << " triangles\n";
-	// run overall triangles
-	auto t = ctriangles.begin();
-	auto et = ctriangles.end();
-
-	int i = 0; 
-	while (t != et) {
-		C3DFVector e1 = (*m_vertices)[t->x] - (*m_vertices)[t->y];
-		C3DFVector e2 = (*m_vertices)[t->z] - (*m_vertices)[t->y];
-		C3DFVector e3 = (*m_vertices)[t->z] - (*m_vertices)[t->x];
-		C3DFVector help_normal = e2 ^ e1;
-		if (help_normal.norm2() > 0) {
-			float weight1 = acos((dot(e1,e2)) / (e1.norm() * e2.norm()));
-			float weight2 = acos((dot(e3,e2)) / (e3.norm() * e2.norm()));
-			(*m_normals)[t->y] += weight1 * help_normal;
-			(*m_normals)[t->z] += weight2 * help_normal;
-			
-			float weight3 = M_PI - weight1  - weight2;
-			
-			(*m_normals)[t->x] += weight3 * help_normal;
-		}else {
-			cverr() <<"CTriangleMeshData::evaluate_normals(): triangle " << i << ":" << *t << " with corners [" 
-				<< e1 << e2 << e3 << "] has zero normal\n";
-		}
-		++t;
-		++i; 
-	}
 
-	cvdebug() << "normalize " << m_normals->size() << " normals\n"; 
-	// normalize the normals
-	for_each(m_normals->begin(), m_normals->end(), 
-		 [](C3DFVector& n) -> void {
-			 float norm = n.norm();
-			 if (norm > 0) {
-				 n /= norm;
-			 }
-		 }); 
+
+	auto normalize = [](C3DFVector& x) {
+		float xn = x.norm(); 
+		if (xn > 0) 
+			x /= xn; 
+	}; 
+
+	typedef CTriangleMesh::normal_type normal_type; 
+	typedef CTriangleMesh::triangle_type triangle_type; 
+
+	auto run_triangles = [this, &ctriangles, &normalize](const blocked_range<unsigned>& range, 
+						 const vector<normal_type>& cnormals) {
+		vector<normal_type> normals(cnormals); 
+		CThreadMsgStream thread_stream;
+		for (auto i = range.begin(); i != range.end(); ++i) {
+			triangle_type t = ctriangles[i]; 
+			C3DFVector e1 = (*m_vertices)[t.x] - (*m_vertices)[t.y];
+			C3DFVector e2 = (*m_vertices)[t.z] - (*m_vertices)[t.y];
+			C3DFVector e3 = (*m_vertices)[t.z] - (*m_vertices)[t.x];
+			C3DFVector help_normal = cross(e2, e1);
+			if (help_normal.norm2() > 0) {
+				normalize(e1); 
+				normalize(e2); 
+				normalize(e3); 
+				float weight1 = acos(dot(e1,e2));
+				float weight2 = acos(dot(e3,e2));
+				
+				normals[t.y] += weight1 * help_normal;
+				normals[t.z] += weight2 * help_normal;
+				
+				float weight3 = M_PI - weight1  - weight2;
+				
+				normals[t.x] += weight3 * help_normal;
+			}else {
+				cverr() <<"CTriangleMeshData::evaluate_normals(): triangle " << i 
+					<< ":" << t << " with corners [" 
+					<< e1 << e2 << e3 << "] has zero normal\n";
+			}
+		}
+		return normals; 
+	}; 
+	
+	auto reduce_normals = [](const vector<normal_type>& lhs, const vector<normal_type>& rhs) -> vector<normal_type> {
+		vector<normal_type> result(lhs); 
+		parallel_for(blocked_range<unsigned>(0,result.size()), 
+			     [&result, &rhs](const blocked_range<unsigned>& range) {
+				     for (auto i= range.begin(); i != range.end(); ++i) 
+					     result[i] += rhs[i]; 
+			     }); 
+		return result; 
+	}; 
+
+	vector<normal_type> normals_accumulator(m_normals->size());
+	
+	normals_accumulator = parallel_reduce(blocked_range<unsigned>(0, ctriangles.size(), 100), normals_accumulator, 
+					      run_triangles, reduce_normals);
+
+	parallel_for(blocked_range<unsigned>(0, normals_accumulator.size()),
+		     [this, &normals_accumulator](const blocked_range<unsigned>& range){
+			     for (auto i= range.begin(); i != range.end(); ++i) {
+				     C3DFVector n = normals_accumulator[i];
+				     auto nn = n.norm2();
+				     (*m_normals)[i] = (nn > 0) ? n / sqrt(nn) : C3DFVector::_0; 
+			     }
+		     });
+	
 }
 
 
@@ -457,6 +495,87 @@ void CTriangleMesh::evaluate_normals()
 }
 
 
+struct VertexWithIndex {
+	unsigned idx;
+	C3DFVector v; 
+
+	VertexWithIndex(const CTriangleMesh& mesh, unsigned i):
+		idx(i), 
+		v(mesh.vertex_at(i)){
+		
+	}
+}; 
+
+struct compare_vertex  {
+	bool operator () (const VertexWithIndex& lhs, const VertexWithIndex& rhs) {
+		return (lhs.v.z < rhs.v.z) || 
+			((lhs.v.z == rhs.v.z) && ((lhs.v.y < rhs.v.y) ||
+						  ((lhs.v.y == rhs.v.y) && (lhs.v.x < rhs.v.x)))); 
+	}
+}; 
+
+
+PTriangleMesh EXPORT_MESH get_sub_mesh(const CTriangleMesh& mesh, const vector<unsigned>& triangle_indices) 
+{
+
+	auto new_triangles = make_shared<CTriangleMesh::CTrianglefield>(triangle_indices.size()); 
+	transform(triangle_indices.begin(),  triangle_indices.end(),  
+		  new_triangles->begin(), [mesh](unsigned idx){return mesh.triangle_at(idx);}); 
+	
+	// collect the vertices 
+	set<VertexWithIndex, compare_vertex> vtxset;
+	for (auto t = new_triangles->begin(); new_triangles->end() != t; ++t) {
+		vtxset.insert(VertexWithIndex(mesh, t->x)); 
+		vtxset.insert(VertexWithIndex(mesh, t->y)); 
+		vtxset.insert(VertexWithIndex(mesh, t->z)); 
+	}
+
+	vector<unsigned> reindex(mesh.vertices_size(), mesh.vertices_size()); 
+	unsigned out_index = 0; 
+
+	auto new_vertices = make_shared<CTriangleMesh::CVertexfield>(); 
+	new_vertices->reserve(vtxset.size()); 
+	
+	for (auto iv = vtxset.begin(); iv != vtxset.end(); ++iv) {
+		new_vertices->push_back(iv->v); 
+		cvdebug() << "vertex[" << out_index << "]=" <<iv->v << "\n"; 
+		reindex[iv->idx] = out_index++; 
+	}
+	
+	// re-index the triangles 
+	for_each(new_triangles->begin(), new_triangles->end(), [&reindex](CTriangleMesh::triangle_type& t){
+			t.x = reindex[t.x]; 
+			t.y = reindex[t.y]; 
+			t.z = reindex[t.z]; 
+			cvdebug() << "triangle:" << t << "\n"; 
+		}); 
+
+	auto result = make_shared<CTriangleMesh>(new_triangles, new_vertices);
+
+	if (mesh.get_available_data() & CTriangleMesh::ed_normal) {
+		auto in = result->normals_begin(); 
+		for (auto iv = vtxset.begin(); iv != vtxset.end(); ++iv, ++in) {
+			*in = mesh.normal_at(iv->idx); 
+		}
+	}
+
+	if (mesh.get_available_data() & CTriangleMesh::ed_scale) {
+		auto is = result->scale_begin(); 
+		for (auto iv = vtxset.begin(); iv != vtxset.end(); ++iv, ++is) {
+			*is = mesh.scale_at(iv->idx); 
+		}
+	}
+
+	if (mesh.get_available_data() & CTriangleMesh::ed_color) {
+		auto ic = result->color_begin(); 
+		for (auto iv = vtxset.begin(); iv != vtxset.end(); ++iv, ++ic) {
+			*ic = mesh.color_at(iv->idx); 
+		}
+	}
+	
+	return result; 
+}
+
 
 const char *CTriangleMesh::data_descr = "mesh";
 NS_MIA_END
diff --git a/mia/mesh/triangularMesh.hh b/mia/mesh/triangularMesh.hh
index cdc2223..6a430b3 100644
--- a/mia/mesh/triangularMesh.hh
+++ b/mia/mesh/triangularMesh.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -278,6 +278,10 @@ private:
 /// Pointer type of the CTriangle mesh class
 typedef CTriangleMesh::Pointer PTriangleMesh;
 
+
+PTriangleMesh EXPORT_MESH get_sub_mesh(const CTriangleMesh& mesh, const std::vector<unsigned>& triangle_indices); 
+	
+
 /** This function is used to generate  the deformation scale of a mesh as the
     scalar product of the surface normal and a deformation field.
     if neccessary the normals are evaluated
diff --git a/mia/mesh/triangulate.hh b/mia/mesh/triangulate.hh
index c8a6f91..69fcbe3 100644
--- a/mia/mesh/triangulate.hh
+++ b/mia/mesh/triangulate.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/template/CMakeLists.txt b/mia/template/CMakeLists.txt
index 3afb8d0..f40c179 100644
--- a/mia/template/CMakeLists.txt
+++ b/mia/template/CMakeLists.txt
@@ -1,6 +1,6 @@
 #
 # This file is part of MIA - a toolbox for medical image analysis 
-# Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+# 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
@@ -35,6 +35,8 @@ fullcost.hh
 invert.cxx
 invert.hh
 lsd.hh
+labelmap.hh
+labelmap.cxx
 masked_cost.hh
 masked_cost.cxx
 mi.hh
diff --git a/mia/template/bandpass.cxx b/mia/template/bandpass.cxx
index 2b1c8f4..5a26405 100644
--- a/mia/template/bandpass.cxx
+++ b/mia/template/bandpass.cxx
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -63,10 +63,8 @@ TBandPassFilterPlugin<Image>::TBandPassFilterPlugin():
 	m_min(0), 
 	m_max(std::numeric_limits<float>::max())
 {
-	this->add_parameter("min", new CFloatParameter(m_min, -std::numeric_limits<float>::max(), 
-						       std::numeric_limits<float>::max(), false, "minimum of the band")); 
-	this->add_parameter("max", new CFloatParameter(m_max, -std::numeric_limits<float>::max(), 
-						       std::numeric_limits<float>::max(), false, "maximum of the band")); 
+	this->add_parameter("min", make_param(m_min, false, "minimum of the band")); 
+	this->add_parameter("max", make_param(m_max, false, "maximum of the band")); 
 }
 
 template <class Image> 
diff --git a/mia/template/bandpass.hh b/mia/template/bandpass.hh
index e142a86..d807da2 100644
--- a/mia/template/bandpass.hh
+++ b/mia/template/bandpass.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -24,7 +24,6 @@
 #include <limits>
 #include <mia/core/filter.hh>
 #include <mia/core/msgstream.hh>
-#include <mia/core/filter.hh>
 
 NS_MIA_BEGIN
 
diff --git a/mia/template/binarize.cxx b/mia/template/binarize.cxx
index 6175c83..231b6f3 100644
--- a/mia/template/binarize.cxx
+++ b/mia/template/binarize.cxx
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -91,11 +91,8 @@ TBinarizeImageFilterFactory<Image>::TBinarizeImageFilterFactory():
 	m_min(0), 
 	m_max(std::numeric_limits<float>::max())
 {
-	this->add_parameter("min", new CFloatParameter(m_min, 0, std::numeric_limits<float>::max(), 
-						 false, "minimum of accepted range")); 
-	this->add_parameter("max", new CFloatParameter(m_max, 0, std::numeric_limits<float>::max(), 
-						 false, "maximum of accepted range")); 
-
+	this->add_parameter("min", make_param(m_min, false, "minimum of accepted range")); 
+	this->add_parameter("max", make_param(m_max, false, "maximum of accepted range")); 
 }
 
 template <class Image> 
diff --git a/mia/template/binarize.hh b/mia/template/binarize.hh
index aa8c8f7..75103be 100644
--- a/mia/template/binarize.hh
+++ b/mia/template/binarize.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/template/combiner.cxx b/mia/template/combiner.cxx
index 3850413..249edea 100644
--- a/mia/template/combiner.cxx
+++ b/mia/template/combiner.cxx
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/template/combiner.hh b/mia/template/combiner.hh
index 82ed855..9a1d6cc 100644
--- a/mia/template/combiner.hh
+++ b/mia/template/combiner.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/template/combiner_filter.hh b/mia/template/combiner_filter.hh
index c3d8906..c09da0d 100644
--- a/mia/template/combiner_filter.hh
+++ b/mia/template/combiner_filter.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/template/convert.cxx b/mia/template/convert.cxx
index aa225c0..c3ca2cf 100644
--- a/mia/template/convert.cxx
+++ b/mia/template/convert.cxx
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -207,12 +207,8 @@ TConvertFilterPlugin<Image>::TConvertFilterPlugin():
 	m_a(1.0), 
 	m_b(0.0)
 {
-	this->add_parameter("a", new CFloatParameter(m_a, -std::numeric_limits<float>::max(), 
-					       std::numeric_limits<float>::max(), false, 
-					       "linear conversion parameter a")); 
-	this->add_parameter("b", new CFloatParameter(m_b, -std::numeric_limits<float>::max(), 
-					       std::numeric_limits<float>::max(), false, 
-					       "linear conversion parameter b")); 
+	this->add_parameter("a", make_param(m_a, false, "linear conversion parameter a")); 
+	this->add_parameter("b", make_param(m_b, false, "linear conversion parameter b")); 
 	this->add_parameter("repn",new CDictParameter<EPixelType>(m_pixeltype, CPixelTypeDict, "output pixel type")); 
 	this->add_parameter("map", new CDictParameter<EPixelConversion>(m_convert, CPixelConversionDict, "conversion mapping"));
 
diff --git a/mia/template/convert.hh b/mia/template/convert.hh
index 5d7ae93..29f7634 100644
--- a/mia/template/convert.hh
+++ b/mia/template/convert.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/template/cvd_io_trait.hh b/mia/template/cvd_io_trait.hh
index f54f246..2e645d6 100644
--- a/mia/template/cvd_io_trait.hh
+++ b/mia/template/cvd_io_trait.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/template/dimtrait.hh b/mia/template/dimtrait.hh
index fe6880f..8b099c9 100644
--- a/mia/template/dimtrait.hh
+++ b/mia/template/dimtrait.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/template/divcurl.cxx b/mia/template/divcurl.cxx
index 89ccc31..0486126 100644
--- a/mia/template/divcurl.cxx
+++ b/mia/template/divcurl.cxx
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/template/divcurl.hh b/mia/template/divcurl.hh
index 7dd587c..d8c0a22 100644
--- a/mia/template/divcurl.hh
+++ b/mia/template/divcurl.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/template/filter_chain.hh b/mia/template/filter_chain.hh
index 9710d71..770a6d0 100644
--- a/mia/template/filter_chain.hh
+++ b/mia/template/filter_chain.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/template/filtertest.hh b/mia/template/filtertest.hh
index 960b673..86077aa 100644
--- a/mia/template/filtertest.hh
+++ b/mia/template/filtertest.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/template/fullcost.cxx b/mia/template/fullcost.cxx
index 403c23b..688952c 100644
--- a/mia/template/fullcost.cxx
+++ b/mia/template/fullcost.cxx
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -104,8 +104,7 @@ TFullCostPlugin<T>::TFullCostPlugin(const char *name):
 	TFactory<TFullCost<T> >(name), 
 	m_weight(1.0)
 {
-	this->add_parameter("weight", new CFloatParameter(m_weight, -1e+10f, 1e+10f,
-						    false, "weight of cost function"));
+	this->add_parameter("weight", new CTParameter<float>(m_weight, false, "weight of cost function"));
 }
 	
 template <typename T> 
diff --git a/mia/template/fullcost.hh b/mia/template/fullcost.hh
index 7868037..94cbe02 100644
--- a/mia/template/fullcost.hh
+++ b/mia/template/fullcost.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/template/invert.cxx b/mia/template/invert.cxx
index ffafc33..1f80af7 100644
--- a/mia/template/invert.cxx
+++ b/mia/template/invert.cxx
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/template/invert.hh b/mia/template/invert.hh
index 815c5d8..0260629 100644
--- a/mia/template/invert.hh
+++ b/mia/template/invert.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/template/labelmap.cxx b/mia/template/labelmap.cxx
new file mode 100644
index 0000000..afa2f3d
--- /dev/null
+++ b/mia/template/labelmap.cxx
@@ -0,0 +1,110 @@
+/* -*- mia-c++  -*-
+ *
+ * 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 MIA; if not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <stdexcept>
+#include <istream>
+#include <fstream>
+#include <mia/template/labelmap.hh>
+
+NS_MIA_BEGIN;
+
+template <class Image>
+TLabelMapFilter<Image>::TLabelMapFilter(const CLabelMap& lmap)
+{
+
+	for (auto i = lmap.begin(), e = lmap.end(); 
+	     i != e; ++i)
+		m_map[i->first] = i->second; 
+}
+
+
+template <class Image>
+typename TLabelMapFilter<Image>::result_type TLabelMapFilter<Image>::do_filter(const Image& image) const
+{
+	return mia::filter(*this, image); 
+}
+
+template <typename Image, bool is_integer> 
+struct dispatch_label_map {
+	typedef typename Image::value_type value_type; 
+	typedef std::map<size_t, size_t> LabelMap; 
+
+	static 
+	typename TLabelMapFilter<Image>::result_type 
+	apply(const Image& /*image*/, const LabelMap& /*lmap*/){
+		throw std::invalid_argument("Labelmap: Floating pount values are nor supported");
+	}
+};
+
+template <typename Image> 
+struct dispatch_label_map<Image, true> {
+	typedef  typename Image::value_type value_type; 
+	typedef std::map<size_t, size_t> LabelMap; 
+	typedef typename TLabelMapFilter<Image>::result_type result_type; 
+
+	static result_type apply(const Image& image, const LabelMap& lmap){
+		Image *result = new Image(image.get_size(), image); 
+		transform(image.begin(), image.end(), result->begin(), 
+			  [&lmap](value_type x){ 
+				  auto iy = lmap.find(x); 
+				  return iy != lmap.end() ? static_cast<value_type>(iy->second) : x;
+			  });
+		return result_type(result); 
+	}
+};
+
+template <class Image>
+template <class TImage>
+typename TLabelMapFilter<Image>::result_type TLabelMapFilter<Image>::operator () (const TImage& data) const
+{
+	return dispatch_label_map<TImage, std::numeric_limits<typename TImage::value_type>::is_integer>::apply(data, m_map); 
+	
+}
+
+template <class Image>
+TLabelMapFilterPlugin<Image>::TLabelMapFilterPlugin():
+	TDataFilterPlugin<Image>("labelmap")
+{
+	this->add_parameter("map", new CStringParameter(m_map, CCmdOptionFlags::required_input, "Label mapping file")) ;
+}
+
+
+template <class Image>
+TDataFilter<Image> *TLabelMapFilterPlugin<Image>::do_create() const
+{
+	std::ifstream is(m_map.c_str()); 
+
+	if (!is.good())
+		throw create_exception<std::runtime_error>("C2DLabelMapFilterPlugin::load_label_map:"
+					    "Unable to open file '", m_map, "'"); 
+	
+	CLabelMap map(is);
+	return new TLabelMapFilter<Image>(map); 
+}
+
+template <class Image>
+const std::string TLabelMapFilterPlugin<Image>::do_get_descr()const
+{
+	return "Image filter to remap label id's. Only applicable to "
+		"images with integer valued intensities/labels."; 
+}
+
+
+NS_END
diff --git a/mia/template/invert.hh b/mia/template/labelmap.hh
similarity index 56%
copy from mia/template/invert.hh
copy to mia/template/labelmap.hh
index 815c5d8..2edc2c8 100644
--- a/mia/template/invert.hh
+++ b/mia/template/labelmap.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -18,39 +18,43 @@
  *
  */
 
-#ifndef __mia_internal_invert_hh
-#define __mia_internal_invert_hh
+#ifndef mia_template_labelmap_hh
+#define mia_template_labelmap_hh
 
-#include <limits>
-#include <mia/core/filter.hh>
-#include <mia/core/msgstream.hh>
 #include <mia/core/filter.hh>
+#include <mia/core/labelmap.hh>
+#include <map>
 
 NS_MIA_BEGIN
 
-///  @cond DOC_PLUGINS 
-template <class Image> 
-class TInvert: public TDataFilter<Image> {
-public: 	
+template <class Image>       
+class TLabelMapFilter: public TDataFilter<Image> {
+	std::map<size_t, size_t>  m_map;
+public:
+
 	typedef typename TDataFilter<Image>::result_type result_type; 
-	TInvert(); 
+	
+	TLabelMapFilter(const CLabelMap& lmap); 
+	
+	template <class TImage>
+	typename TLabelMapFilter<Image>::result_type operator () (const TImage& data) const ;
 
-	template <class  T>
-	typename TInvert::result_type operator () (const T& data) const;
 private: 
-	typename TInvert::result_type do_filter(const Image& image) const;
+	virtual typename TLabelMapFilter<Image>::result_type do_filter(const Image& image) const;
+
 };
 
 template <class Image> 
-class TInvertFilterPlugin: public TDataFilterPlugin<Image>  {
+class TLabelMapFilterPlugin: public TDataFilterPlugin<Image> {
 public: 
-	TInvertFilterPlugin();
-	virtual TDataFilter<Image> *do_create()const;
+	TLabelMapFilterPlugin();
+	virtual TDataFilter<Image> *do_create()const; 
 	virtual const std::string do_get_descr()const; 
-};
 
-///  @endcond 
-NS_MIA_END
+private: 
+	std::string m_map; 
+};
 
+NS_END
 
-#endif
+#endif 
diff --git a/mia/template/lsd.hh b/mia/template/lsd.hh
index fda8020..143298e 100644
--- a/mia/template/lsd.hh
+++ b/mia/template/lsd.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/template/masked_cost.cxx b/mia/template/masked_cost.cxx
index 0f1a37b..a2c634f 100644
--- a/mia/template/masked_cost.cxx
+++ b/mia/template/masked_cost.cxx
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/template/masked_cost.hh b/mia/template/masked_cost.hh
index f13c0ef..7ea7ba6 100644
--- a/mia/template/masked_cost.hh
+++ b/mia/template/masked_cost.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/template/mi.hh b/mia/template/mi.hh
index c306b30..15ccd55 100644
--- a/mia/template/mi.hh
+++ b/mia/template/mi.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -154,10 +154,10 @@ TMIImageCostPlugin<CP,C>::TMIImageCostPlugin():
 {
 	TRACE("TMIImageCostPlugin<CP,C>::TMIImageCostPlugin()"); 
 	this->add_property(::mia::property_gradient); 
-	this->add_parameter("rbins", new mia::CUIntParameter(m_rbins, 1, 256, false, 
-				     "Number of histogram bins used for the reference image")); 
+	this->add_parameter("rbins", mia::make_ci_param(m_rbins, 1u, 256u, false, 
+							 "Number of histogram bins used for the reference image")); 
 
-	this->add_parameter("mbins", new mia::CUIntParameter(m_mbins, 1, 256, false, 
+	this->add_parameter("mbins", mia::make_ci_param(m_mbins, 1u, 256u, false, 
 				     "Number of histogram bins used for the moving image")); 
 	
 	this->add_parameter("rkernel", mia::make_param(m_rkernel, "bspline:d=0", false, 
@@ -166,9 +166,9 @@ TMIImageCostPlugin<CP,C>::TMIImageCostPlugin():
 	this->add_parameter("mkernel", mia::make_param(m_mkernel, "bspline:d=3", false, 
 						  "Spline kernel for moving image parzen hinstogram"));  
 
-	this->add_parameter("cut", new mia::CFloatParameter(m_histogram_cut, 0.0f, 40.0f, false, 
-							    "Percentage of pixels to cut at high and low "
-							    "intensities to remove outliers")); 
+	this->add_parameter("cut", mia::make_ci_param(m_histogram_cut, 0.0f, 40.0f,
+						      false, "Percentage of pixels to cut at high and low "
+						      "intensities to remove outliers")); 
 }
 
 /**
diff --git a/mia/template/mi_masked.cxx b/mia/template/mi_masked.cxx
index 00a59c8..3c818f4 100644
--- a/mia/template/mi_masked.cxx
+++ b/mia/template/mi_masked.cxx
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -125,21 +125,21 @@ TMIMaskedImageCostPlugin<CP,C>::TMIMaskedImageCostPlugin():
 {
 	TRACE("TMIMaskedImageCostPlugin<CP,C>::TMIMaskedImageCostPlugin()"); 
 	this->add_property(::mia::property_gradient); 
-	this->add_parameter("rbins", new mia::CUIntParameter(m_rbins, 1, 256, false, 
-				     "Number of histogram bins used for the reference image")); 
-
-	this->add_parameter("mbins", new mia::CUIntParameter(m_mbins, 1, 256, false, 
-				     "Number of histogram bins used for the moving image")); 
+	this->add_parameter("rbins", mia::make_ci_param(m_rbins, 1, 256, false, 
+							"Number of histogram bins used for the reference image")); 
+	
+	this->add_parameter("mbins", mia::make_ci_param(m_mbins, 1, 256, false, 
+							"Number of histogram bins used for the moving image")); 
 	
 	this->add_parameter("rkernel", mia::make_param(m_rkernel, "bspline:d=0", false, 
-						  "Spline kernel for reference image parzen hinstogram")); 
+						       "Spline kernel for reference image parzen hinstogram")); 
 	
 	this->add_parameter("mkernel", mia::make_param(m_mkernel, "bspline:d=3", false, 
-						  "Spline kernel for moving image parzen hinstogram"));  
+						       "Spline kernel for moving image parzen hinstogram"));  
 
-	this->add_parameter("cut", new mia::CFloatParameter(m_histogram_cut, 0.0f, 40.0f, false, 
-							    "Percentage of pixels to cut at high and low "
-							    "intensities to remove outliers")); 
+	this->add_parameter("cut", mia::make_ci_param(m_histogram_cut, 0.0f, 40.0f, false, 
+						      "Percentage of pixels to cut at high and low "
+						      "intensities to remove outliers")); 
 }
 
 /**
diff --git a/mia/template/mi_masked.hh b/mia/template/mi_masked.hh
index 1075170..c0e49d0 100644
--- a/mia/template/mi_masked.hh
+++ b/mia/template/mi_masked.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/template/multicost.cxx b/mia/template/multicost.cxx
index 69e4c4d..0905738 100644
--- a/mia/template/multicost.cxx
+++ b/mia/template/multicost.cxx
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/template/multicost.hh b/mia/template/multicost.hh
index 6c47bfe..2c30bcc 100644
--- a/mia/template/multicost.hh
+++ b/mia/template/multicost.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/template/nonrigidregister.cxx b/mia/template/nonrigidregister.cxx
index 1ab333a..fa76e61 100644
--- a/mia/template/nonrigidregister.cxx
+++ b/mia/template/nonrigidregister.cxx
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -158,13 +158,15 @@ public:
 		auto ia = a.begin(); 
 		
 		for(auto ib = b.begin(); ia != a.end(); ++ia, ++ib) {
-			sum += *ia + *ib; 
-			sum2 += *ia * *ia + *ib * *ib;
+			double fa = *ia; 
+			double fb = *ib; 
+			sum += fa + fb; 
+			sum2 += fa * fa + fb * fb;
 		}
 		
 		double mean = sum / n; 
 		double sigma = sqrt((sum2 - sum * sum / n) / (n - 1));
-
+		
 		// both images are of the same single color 
 		if (sigma == 0.0) 
 			return result_type(); 
diff --git a/mia/template/nonrigidregister.hh b/mia/template/nonrigidregister.hh
index c52c00e..790c542 100644
--- a/mia/template/nonrigidregister.hh
+++ b/mia/template/nonrigidregister.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/template/normalize.hh b/mia/template/normalize.hh
index d789f0e..86f39a1 100644
--- a/mia/template/normalize.hh
+++ b/mia/template/normalize.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/template/seededwatershed.hh b/mia/template/seededwatershed.hh
index 49055db..af75a50 100644
--- a/mia/template/seededwatershed.hh
+++ b/mia/template/seededwatershed.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/template/similarity_profile.cxx b/mia/template/similarity_profile.cxx
index 49e53ea..bad7573 100644
--- a/mia/template/similarity_profile.cxx
+++ b/mia/template/similarity_profile.cxx
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/template/similarity_profile.hh b/mia/template/similarity_profile.hh
index ed1aedc..3770608 100644
--- a/mia/template/similarity_profile.hh
+++ b/mia/template/similarity_profile.hh
@@ -2,7 +2,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/template/ssd-automask.cxx b/mia/template/ssd-automask.cxx
index 4e0dabf..3673d40 100644
--- a/mia/template/ssd-automask.cxx
+++ b/mia/template/ssd-automask.cxx
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -164,15 +164,16 @@ double TSSDAutomaskCost<TCost>::do_evaluate_force(const Data& a, const Data& b,
 */
 template <typename CP, typename C> 
 TSSDAutomaskCostPlugin<CP,C>::TSSDAutomaskCostPlugin():
-	CP("ssd-automask")
+	CP("ssd-automask"),
+	m_src_mask_thresh(0.0), 
+	m_ref_mask_thresh(0.0)
 {
 	TRACE("TSSDAutomaskCostPlugin<CP,C>::TSSDAutomaskCostPlugin()"); 
 	this->add_property(::mia::property_gradient); 
-	const double limits = std::numeric_limits<double>::max(); 
-	this->add_parameter("rthresh", new mia::CDoubleParameter(m_ref_mask_thresh, -limits, limits, false, 
-								 "Threshold intensity value for reference image")); 
-
-	this->add_parameter("sthresh", new mia::CDoubleParameter(m_src_mask_thresh, -limits, limits, false, 
+	this->add_parameter("rthresh", new mia::CTParameter<double>(m_ref_mask_thresh, false, 
+								    "Threshold intensity value for reference image")); 
+	
+	this->add_parameter("sthresh", new mia::CTParameter<double>(m_src_mask_thresh, false, 
 								    "Threshold intensity value for source image")); 
 
 }
diff --git a/mia/template/ssd-automask.hh b/mia/template/ssd-automask.hh
index a3a1ee9..5129556 100644
--- a/mia/template/ssd-automask.hh
+++ b/mia/template/ssd-automask.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/template/ssd.hh b/mia/template/ssd.hh
index 725c9df..621a442 100644
--- a/mia/template/ssd.hh
+++ b/mia/template/ssd.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -210,9 +210,9 @@ TSSDCostPlugin<CP,C>::TSSDCostPlugin():
 	this->add_parameter("norm", new mia::CBoolParameter(m_normalize, false, 
 			    "Set whether the metric should be normalized by the number of image pixels")
 		); 
-	this->add_parameter("autothresh", new mia::CFloatParameter(m_automask_thresh, 0, 1000, false, 
-			"Use automatic masking of the moving image by only takeing intensity values "
-								   "into accound that are larger than the given threshold"));  
+	this->add_parameter("autothresh", mia::make_ci_param(m_automask_thresh, 0.0f, 1000.0f, false, 
+							     "Use automatic masking of the moving image by only takeing "
+							     "intensity values into accound that are larger than the given threshold"));  
 
 }
 
diff --git a/mia/template/ssd_masked.cxx b/mia/template/ssd_masked.cxx
index ec3f8e5..11f130a 100644
--- a/mia/template/ssd_masked.cxx
+++ b/mia/template/ssd_masked.cxx
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/template/ssd_masked.hh b/mia/template/ssd_masked.hh
index 21c4584..350065e 100644
--- a/mia/template/ssd_masked.hh
+++ b/mia/template/ssd_masked.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/template/trackpoint.cxx b/mia/template/trackpoint.cxx
index cbecc09..611b079 100644
--- a/mia/template/trackpoint.cxx
+++ b/mia/template/trackpoint.cxx
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/template/trackpoint.hh b/mia/template/trackpoint.hh
index 0f50f03..6279244 100644
--- a/mia/template/trackpoint.hh
+++ b/mia/template/trackpoint.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/template/transformfactory.cxx b/mia/template/transformfactory.cxx
index 1ef2dbc..326f6e7 100644
--- a/mia/template/transformfactory.cxx
+++ b/mia/template/transformfactory.cxx
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/template/transformfactory.hh b/mia/template/transformfactory.hh
index d81869a..8a74838 100644
--- a/mia/template/transformfactory.hh
+++ b/mia/template/transformfactory.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/mia/template/watershed.hh b/mia/template/watershed.hh
index 38b071c..6fbdbce 100644
--- a/mia/template/watershed.hh
+++ b/mia/template/watershed.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -322,10 +322,11 @@ TWatershedFilterPlugin<dim>::TWatershedFilterPlugin():
 {
 	this->add_parameter("n", make_param(m_neighborhood, "sphere:r=1", false, "Neighborhood for watershead region growing")); 
 	this->add_parameter("mark", new mia::CBoolParameter(m_with_borders, false, "Mark the segmented watersheds with a special gray scale value")); 
-	this->add_parameter("thresh", new mia::CFloatParameter(m_thresh, 0, 1.0, false, "Relative gradient norm threshold. The actual value threshhold value "
-							       "is thresh * (max_grad - min_grad) + min_grad. Bassins separated by gradients "
-							       "with a lower norm will be joined"));  
-	this->add_parameter("evalgrad", new mia::CBoolParameter(m_eval_grad, false, "Set to 1 if the input image does not represent a gradient norm image")); 
+	this->add_parameter("thresh", make_coi_param(m_thresh, 0, 1.0, false, "Relative gradient norm threshold. The actual value "
+						     "threshhold value is thresh * (max_grad - min_grad) + min_grad. Bassins "
+						     "separated by gradients with a lower norm will be joined"));  
+	this->add_parameter("evalgrad", new mia::CBoolParameter(m_eval_grad, false, "Set to 1 if the input image does "
+								"not represent a gradient norm image")); 
 }
 
 template <int dim>
diff --git a/mia/test/testhelpers.hh b/mia/test/testhelpers.hh
index 736bdd9..59bd1f0 100644
--- a/mia/test/testhelpers.hh
+++ b/mia/test/testhelpers.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/miacore.pc.cmake b/miacore.pc.cmake
index 050befb..392a7de 100644
--- a/miacore.pc.cmake
+++ b/miacore.pc.cmake
@@ -14,7 +14,6 @@ Name: miacore
 Description: A library for 2D/3D grayscale image processing 
 Version: @PACKAGE_VERSION@
 Conflicts:
-Requires: libxml++-2.6
 Requires.private: @PKG_CONFIG_DEPS@ 
-Libs: -lmiacore- at VERSION@  -L${prefix}/@LIBRARY_INSTALL_PATH@ -lboost_system 
+Libs: -lmiacore- at VERSION@  -L${prefix}/@LIBRARY_INSTALL_PATH@
 Cflags: -I${prefix}/@INCLUDE_INSTALL_PATH@ -I at LIB_INCLUDE_INSTALL_PATH@
diff --git a/octave/CMakeLists.txt b/octave/CMakeLists.txt
index 44ff1c3..58fb87e 100644
--- a/octave/CMakeLists.txt
+++ b/octave/CMakeLists.txt
@@ -1,6 +1,6 @@
 #
 # This file is part of MIA - a toolbox for medical image analysis 
-# Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+# 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
diff --git a/octave/miaoct.cc b/octave/miaoct.cc
index 52becc5..56b4b50 100644
--- a/octave/miaoct.cc
+++ b/octave/miaoct.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/scripts/brainmask.sh b/scripts/brainmask.sh
index d0eb858..51666c4 100755
--- a/scripts/brainmask.sh
+++ b/scripts/brainmask.sh
@@ -2,7 +2,7 @@
 #
 #
 # This file is part of MIA - a toolbox for medical image analysis 
-# Copyright (c) Leipzig, Madrid 1999-2013 Gert Wollny
+# 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
diff --git a/scripts/extract_boundary.sh b/scripts/extract_boundary.sh
index 654a307..d6534d5 100755
--- a/scripts/extract_boundary.sh
+++ b/scripts/extract_boundary.sh
@@ -2,7 +2,7 @@
 #
 #
 # This file is part of MIA - a toolbox for medical image analysis 
-# Copyright (c) Leipzig, Madrid 1999-2013 Gert Wollny
+# 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
diff --git a/scripts/filter_stack.sh b/scripts/filter_stack.sh
index 093ab2d..8faec68 100755
--- a/scripts/filter_stack.sh
+++ b/scripts/filter_stack.sh
@@ -2,7 +2,7 @@
 #
 #
 # This file is part of MIA - a toolbox for medical image analysis 
-# Copyright (c) Leipzig, Madrid 1999-2013 Gert Wollny
+# 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
diff --git a/scripts/segment_stack.sh b/scripts/segment_stack.sh
index 887e450..3a030f0 100755
--- a/scripts/segment_stack.sh
+++ b/scripts/segment_stack.sh
@@ -1,7 +1,7 @@
 #!/bin/sh 
 #
 # This file is part of MIA - a toolbox for medical image analysis 
-# Copyright (c) Leipzig, Madrid 1999-2013 Gert Wollny
+# 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
diff --git a/src/2davgmasked.cc b/src/2davgmasked.cc
index c91aa1e..d4297a9 100644
--- a/src/2davgmasked.cc
+++ b/src/2davgmasked.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/src/2dbinarycombine.cc b/src/2dbinarycombine.cc
index a3d0251..c4b6148 100644
--- a/src/2dbinarycombine.cc
+++ b/src/2dbinarycombine.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/src/2dcost.cc b/src/2dcost.cc
index e00830b..c820cf5 100644
--- a/src/2dcost.cc
+++ b/src/2dcost.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/src/2ddeform.cc b/src/2ddeform.cc
index 121270f..994e9cc 100644
--- a/src/2ddeform.cc
+++ b/src/2ddeform.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/src/2ddistance.cc b/src/2ddistance.cc
index db67d4a..a3ba659 100644
--- a/src/2ddistance.cc
+++ b/src/2ddistance.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/src/2deval-transformquantity.cc b/src/2deval-transformquantity.cc
index 1fcef72..9e17ba4 100644
--- a/src/2deval-transformquantity.cc
+++ b/src/2deval-transformquantity.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/src/2dforce.cc b/src/2dforce.cc
index 581ec6a..4f760f7 100644
--- a/src/2dforce.cc
+++ b/src/2dforce.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/src/2dfuzzysegment.cc b/src/2dfuzzysegment.cc
index a20e107..8e161c3 100644
--- a/src/2dfuzzysegment.cc
+++ b/src/2dfuzzysegment.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/src/2dgrayimage-combine-to-rgb.cc b/src/2dgrayimage-combine-to-rgb.cc
index ca75501..a15ebfc 100644
--- a/src/2dgrayimage-combine-to-rgb.cc
+++ b/src/2dgrayimage-combine-to-rgb.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/src/2dgroundtruthreg.cc b/src/2dgroundtruthreg.cc
index 3988b97..55462eb 100644
--- a/src/2dgroundtruthreg.cc
+++ b/src/2dgroundtruthreg.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/src/2dimagecombine-dice.cc b/src/2dimagecombine-dice.cc
index d077581..21520e7 100644
--- a/src/2dimagecombine-dice.cc
+++ b/src/2dimagecombine-dice.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/src/2dimagecombiner.cc b/src/2dimagecombiner.cc
index 8a6a880..04a3118 100644
--- a/src/2dimagecombiner.cc
+++ b/src/2dimagecombiner.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/src/2dimagecreator.cc b/src/2dimagecreator.cc
index 4052234..ddec5e6 100644
--- a/src/2dimagecreator.cc
+++ b/src/2dimagecreator.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/src/2dimagefilter.cc b/src/2dimagefilter.cc
index e8d75ef..4b713a4 100644
--- a/src/2dimagefilter.cc
+++ b/src/2dimagefilter.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/src/2dimagefilterstack.cc b/src/2dimagefilterstack.cc
index 5a4eb56..0427a73 100644
--- a/src/2dimagefilterstack.cc
+++ b/src/2dimagefilterstack.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/src/2dimagefullstats.cc b/src/2dimagefullstats.cc
index f5c703f..ae031f6 100644
--- a/src/2dimagefullstats.cc
+++ b/src/2dimagefullstats.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/src/2dimageregistration.cc b/src/2dimageregistration.cc
index e81d13d..a67fca4 100644
--- a/src/2dimageregistration.cc
+++ b/src/2dimageregistration.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/src/2dimageselect.cc b/src/2dimageselect.cc
index 25e6016..61cfe0f 100644
--- a/src/2dimageselect.cc
+++ b/src/2dimageselect.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/src/2dimageseries-maximum-intensity-projection.cc b/src/2dimageseries-maximum-intensity-projection.cc
index 27f3317..709d8df 100644
--- a/src/2dimageseries-maximum-intensity-projection.cc
+++ b/src/2dimageseries-maximum-intensity-projection.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/src/2dimagestack-cmeans.cc b/src/2dimagestack-cmeans.cc
new file mode 100644
index 0000000..08b1749
--- /dev/null
+++ b/src/2dimagestack-cmeans.cc
@@ -0,0 +1,263 @@
+/* -*- mia-c++  -*-
+ *
+ * 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 MIA; if not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <sstream>
+#include <ostream>
+#include <fstream>
+#include <mia/core.hh>
+#include <mia/core/cmeans.hh>
+#include <mia/core/cmdlineparser.hh>
+#include <mia/internal/main.hh>
+#include <mia/2d.hh>
+
+NS_MIA_USE;
+using namespace std;
+
+const SProgramDescription g_description = {
+	
+	{pdi_group, "Processing of series of 2D images in a 3D fashion (out-of-core)"}, 
+	{pdi_short, "Calculate the c-means classification for a series of images."}, 
+	
+	
+	{pdi_description, "This program first evaluates a sparse histogram of an input image "
+         "series, then runs a c-means classification over the histogram and then writes the "
+	 "probability mapping for thr original intensity values"
+        }, 
+	
+	{pdi_example_descr,"Run the program over images imageXXXX.png with the sparse histogram, "
+         "threshold the lower 5% bins (if available), run cmeans with three classes on the non-zero "
+         "pixels."}, 
+	
+	{pdi_example_code, "-i image0000.png -o cmeans,txt --histogram-tresh=5 --classes 3"}
+}; 
+
+class CFullHistogram : public TFilter<size_t> {
+        
+public: 
+        CFullHistogram();
+
+        template <typename T>
+        size_t operator ()(const T2DImage<T>& image); 
+
+        vector<pair<int, unsigned long>> get_compressed_histogram()const; 
+ 
+	
+private: 
+        
+        vector<unsigned long> m_histogram; 
+
+        int m_shift; 
+        EPixelType m_pixeltype; 
+
+        
+        
+}; 
+
+template <typename T> 
+struct dispatch_by_pixeltype {
+        static void apply(const T2DImage<T>& MIA_PARAM_UNUSED(image), vector<unsigned long>& MIA_PARAM_UNUSED(histogram)){
+                throw invalid_argument("Input pixel type not supported"); 
+        }
+}; 
+
+template <> 
+struct dispatch_by_pixeltype<unsigned char> {
+        static void apply(const C2DUBImage& image, vector<unsigned long>& histogram){
+                for (auto p: image) {
+                        ++histogram[p]; 
+                }
+        }
+}; 
+
+template <> 
+struct dispatch_by_pixeltype<unsigned short> {
+        static void apply(const C2DUSImage& image, vector<unsigned long>& histogram){
+                for (auto p: image) {
+                        ++histogram[p]; 
+                }
+        }
+}; 
+
+template <> 
+struct dispatch_by_pixeltype<signed char> {
+        static void apply(const C2DSBImage& image, vector<unsigned long>& histogram){
+		int shift = -numeric_limits<signed char>::min(); 
+                for (auto p: image) {
+                        ++histogram[shift + p]; 
+                }
+        }
+}; 
+
+template <> 
+struct dispatch_by_pixeltype<signed short> {
+        static void apply(const C2DSSImage& image, vector<unsigned long>& histogram){
+                int shift = -numeric_limits<signed short>::min(); 
+                for (auto p: image) {
+                        ++histogram[shift + p]; 
+                }
+        }
+}; 
+
+CFullHistogram::CFullHistogram():
+        m_shift(0), 
+        m_pixeltype(it_none)
+{
+}
+
+template <typename T>
+size_t CFullHistogram::operator ()(const T2DImage<T>& image)
+{
+        if (m_pixeltype ==it_none) {
+                m_pixeltype = image.get_pixel_type();
+		m_shift = -numeric_limits<T>::min(); 
+                switch (m_pixeltype) {
+                case it_sbyte:
+                case it_ubyte:
+                        m_histogram.resize(256);
+                        break; 
+                case it_sshort:
+                case it_ushort:
+                        m_histogram.resize(65536);
+                        break; 
+                default:
+                        throw create_exception<invalid_argument>("Input pixel type '", CPixelTypeDict.get_name(m_pixeltype),
+                                                                 "' not supported."); 
+                }
+                        
+        } else if (m_pixeltype != image.get_pixel_type()){
+                throw create_exception<invalid_argument>("Input pixels not of consisted type, started with ",
+                                                         CPixelTypeDict.get_name(m_pixeltype), ", but got now ",
+                                                         CPixelTypeDict.get_name(image.get_pixel_type())); 
+        }
+
+        dispatch_by_pixeltype<T>::apply(image, m_histogram);
+
+        return image.size(); 
+}
+
+vector<pair<int, unsigned long>> CFullHistogram::get_compressed_histogram()const
+{
+
+        int nonzero_bins = 0;
+        for (auto b: m_histogram) {
+                if (b > 0)
+                        ++nonzero_bins; 
+        }
+
+        vector<pair<int, unsigned long>> result;
+        result.reserve(nonzero_bins);
+        for (unsigned i = 0; i < m_histogram.size(); ++i) {
+                if (m_histogram[i] != 0)
+                        result.push_back(make_pair(i - m_shift, m_histogram[i])); 
+        }
+        return result; 
+}
+
+
+int do_main( int argc, char *argv[] )
+{
+	string out_probmap;
+	string in_filename;
+
+        float histogram_thresh = 5;
+	
+	CMeans::PInitializer class_center_initializer;
+
+	
+	const C2DImageIOPluginHandler::Instance& imageio = C2DImageIOPluginHandler::instance();
+
+	CCmdOptionList options(g_description);
+
+        options.set_group("File-IO"); 
+	options.add(make_opt( in_filename, "in-file", 'i', "input image(s) to be filtered", 
+			      CCmdOptionFlags::required_input, &imageio));
+	options.add(make_opt( out_probmap, "out-probmap", 'o', "Save probability map to this file", 
+			      CCmdOptionFlags::required_output));
+
+	
+        options.set_group("Parameters");
+        options.add(make_opt( histogram_thresh, EParameterBounds::bf_closed_interval, {0,50},
+			      "histogram-thresh", 'T',
+                              "Percent of the extrem parts of the histogram to be collapsed "
+			      "into the respective last histogram bin."));
+        
+        options.add(make_opt( class_center_initializer, "kmeans:nc=3", "classes", 'C',
+			      "C-means class initializer"));
+       
+	 
+	if (options.parse(argc, argv) != CCmdOptionList::hr_no)
+		return EXIT_SUCCESS; 
+	
+	size_t start_filenum = 0;
+	size_t end_filenum  = 0;
+	size_t format_width = 0;
+
+	string src_basename = get_filename_pattern_and_range(in_filename, start_filenum, end_filenum, format_width);
+		
+	if (start_filenum >= end_filenum)
+		throw invalid_argument(string("no files match pattern ") + src_basename);
+
+
+        CFullHistogram histo;
+        size_t n_pixels = 0; 
+        for (size_t i = start_filenum; i < end_filenum; ++i) {
+                string src_name = create_filename(src_basename.c_str(), i);
+                C2DImageIOPluginHandler::Instance::PData  in_image_list = imageio.load(src_name);
+                cvmsg() << "Read:" << src_name << "\r";
+                if (in_image_list.get() && in_image_list->size()) {
+                        for (auto k = in_image_list->begin(); k != in_image_list->end(); ++k)
+                                n_pixels += accumulate(histo, **k);
+                }
+        }
+	
+        auto chistogram = histo.get_compressed_histogram();
+	
+        size_t n_cut_off = static_cast<size_t>(floor(n_pixels / 100.0 * histogram_thresh));
+	
+	
+	size_t ni = 0; 
+	auto ii = chistogram.begin(); 
+        while ( ni < n_cut_off && ii != chistogram.end()) {
+		ni += ii->second;
+                ++ii; 
+        }
+	
+	size_t ne = 0; 
+	auto ie = chistogram.end() - 1;
+        while ( ne < n_cut_off && ie !=  ii) {
+		ne += ie->second;
+                --ie;
+        }
+
+        vector<pair<int, unsigned long>> threshed_histo(ii, ie);
+
+	CMeans::DVector class_centers; 
+	
+	CMeans cmeans(0.01, 0.00001, class_center_initializer);
+	CMeans::SparseProbmap pv = cmeans.run(threshed_histo,  class_centers);
+
+	pv.save(out_probmap); 
+	
+	return EXIT_SUCCESS;
+}
+
+MIA_MAIN(do_main); 
+
+        
diff --git a/src/2dimagestats.cc b/src/2dimagestats.cc
index 1decee1..349adea 100644
--- a/src/2dimagestats.cc
+++ b/src/2dimagestats.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -20,6 +20,7 @@
 
 #include <sstream>
 #include <mia/core.hh>
+#include <mia/core/meanvar.hh>
 #include <mia/2d.hh>
 #include <mia/internal/main.hh>
 
@@ -86,6 +87,33 @@ private:
 	float m_max; 
 };
 
+struct FFullAccumulater: public TFilter<bool> {
+	FFullAccumulater(float thresh):m_thresh(thresh){}; 
+
+	template <typename T>
+	bool operator () (const T2DImage<T>& image) {
+		for (auto i = image.begin(); i != image.end(); ++i) {
+			if (*i > m_thresh)
+				m_acc.push_back(*i);
+		}
+		return true;
+	}
+	void print_stats()
+	{
+		sort( m_acc.begin(), m_acc.end()); 
+		auto mv = mean_var(m_acc.begin(), m_acc.end()); 
+		auto minmax = minmax_element(m_acc.begin(), m_acc.end()); 
+		cout << mv.first << " " 
+		     << mv.second << " " 
+		     << m_acc[m_acc.size() / 2] << " " 
+		     << *minmax.first << " " 
+		     << *minmax.second << "\n"; 
+	}
+	
+private: 
+	float m_thresh; 
+	vector<float> m_acc; 
+}; 
 
 
 int do_main( int argc, char *argv[] )
@@ -94,7 +122,7 @@ int do_main( int argc, char *argv[] )
 	string in_filename;
 	float thresh = 10.0;
 	float high_thresh = 0.05;
-
+	bool use_histogram = false; 
 	
 	const auto& imageio = C2DImageIOPluginHandler::instance();
 	
@@ -104,6 +132,8 @@ int do_main( int argc, char *argv[] )
 			      CCmdOptionFlags::required_input, &imageio));
 	options.add(make_opt( thresh, "thresh", 't', "intensity thresh to ignore"));
 	options.add(make_opt( high_thresh, "high-thresh", 'g', "upper histogram percentage to ignore"));
+	options.add(make_opt( use_histogram, "use-histogram", 0, "Use a histogram to accumulate statistics"));
+
 	options.set_stdout_is_result();
 	
 	if (options.parse(argc, argv) != CCmdOptionList::hr_no)
@@ -112,11 +142,19 @@ int do_main( int argc, char *argv[] )
 	
 	C2DImageIOPluginHandler::Instance::PData  in_image_list = imageio.load(in_filename);
 	if (in_image_list.get() && in_image_list->size()) {
-		CHistAccumulator histo(0, 4096, 1024, thresh);
-		for (C2DImageIOPluginHandler::Instance::Data::iterator i = in_image_list->begin();
-		     i != in_image_list->end(); ++i)
-			accumulate(histo, **i);
-		histo.print_stats(high_thresh);
+		if (use_histogram) {
+			CHistAccumulator histo(0, 4096, 1024, thresh);
+			for (auto i = in_image_list->begin(); i != in_image_list->end(); ++i)
+				accumulate(histo, **i);
+			histo.print_stats(high_thresh);
+		}else{
+			vector<float> result;
+			FFullAccumulater acc(thresh); 
+			for (auto i = in_image_list->begin(); i != in_image_list->end(); ++i)
+				accumulate(acc, **i);
+			acc.print_stats();
+			
+		}
 	}else
 		throw runtime_error(string("No errors found in ") + in_filename);
 	
diff --git a/src/2dlerp.cc b/src/2dlerp.cc
index 8df5d50..7e58b34 100644
--- a/src/2dlerp.cc
+++ b/src/2dlerp.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/src/2dmany2one-nonrigid.cc b/src/2dmany2one-nonrigid.cc
index 52e0465..236fc0a 100644
--- a/src/2dmany2one-nonrigid.cc
+++ b/src/2dmany2one-nonrigid.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -66,13 +66,11 @@ C2DFullCostList create_costs(const std::vector<string>& costs, int idx)
 	for (auto c = costs.begin(); c != costs.end(); ++c) {
 		string cc(*c); 
 
-		if (cc.find("image") == 0) {
-			if (cc.find("src") != string::npos  || cc.find("ref") != string::npos) {
-				throw create_exception<invalid_argument>( "image cost functions '", cc, 
-								"' must not set the 'src' or 'ref' parameter explicitly");
-			}
-			cc.append(cost_descr.str()); 
+		if (cc.find("src") != string::npos  || cc.find("ref") != string::npos) {
+			throw create_exception<invalid_argument>( "image cost functions '", cc, 
+								  "' must not set the 'src' or 'ref' parameter explicitly");
 		}
+		cc.append(cost_descr.str()); 
 		cvdebug() << "create cost:"  << *c << " as " << cc << "\n"; 
 		auto imagecost = C2DFullCostPluginHandler::instance().produce(cc);
 		result.push(imagecost); 
diff --git a/src/2dmulti-force.cc b/src/2dmulti-force.cc
index bf82ac8..a8f3cd6 100644
--- a/src/2dmulti-force.cc
+++ b/src/2dmulti-force.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -38,7 +38,7 @@ const SProgramDescription g_description = {
 	 "The input images must be of the same dimensions and gray scale (whatever bit-depth)."}, 
 	{pdi_example_descr, "Evaluate the force normimage weighted sum of costs SSD and NGF of "
 	 "image1.v and image2.v. and store the result to force.v."}, 
-	{pdi_example_code, "-o force.v image:cost=ssd,src=image1.v,ref=image2.v,weight=0.1 "
+	{pdi_example_code, "-o force.v \n image:cost=ssd,src=image1.v,ref=image2.v,weight=0.1\n "
 	 "image:cost=ngf,src=image1.v,ref=image2.v,weight=2.0"}
 }; 
 
@@ -99,7 +99,7 @@ int do_main(int argc, char **argv)
 	std::fill(params.begin(), params.end(), 0.0); 
 	t->set_parameters(params); 
 
-	double cost_value = cost_list.evaluate(*t, params);
+	cost_list.evaluate(*t, params);
 
 	C2DFImage *result = new C2DFImage(size);
 	int i = 0; 
diff --git a/src/2dmulti-nrreg.cc b/src/2dmulti-nrreg.cc
index 1dbf119..6059995 100644
--- a/src/2dmulti-nrreg.cc
+++ b/src/2dmulti-nrreg.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/src/2dmultiimageregistration.cc b/src/2dmultiimageregistration.cc
index ac1258a..0cd7325 100644
--- a/src/2dmultiimageregistration.cc
+++ b/src/2dmultiimageregistration.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -47,7 +47,7 @@ const SProgramDescription g_description = {
 	 "Use two multiresolution levels, ssd as image cost function and divcurl weighted by 10.0 "
 	 "as transformation smoothness penalty. The resulting transformation is saved in reg.vf."},
 
-	{pdi_example_code, "-o reg.vf -l 2 -f spline:rate=3,penalty=divcurl image:cost=ssd,src=test.v,ref=ref.v"}
+	{pdi_example_code, "-o reg.vf -l 2\n -f spline:rate=3,penalty=divcurl\n image:cost=ssd,src=test.v,ref=ref.v"}
 };
 
 
diff --git a/src/2dmultiimageto3d.cc b/src/2dmultiimageto3d.cc
index 9e74af4..91a09d1 100644
--- a/src/2dmultiimageto3d.cc
+++ b/src/2dmultiimageto3d.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/src/2dmultiimagevar.cc b/src/2dmultiimagevar.cc
index ffb837b..9dab501 100644
--- a/src/2dmultiimagevar.cc
+++ b/src/2dmultiimagevar.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/src/2dmyocard-ica.cc b/src/2dmyocard-ica.cc
index ab11e91..54e66a0 100644
--- a/src/2dmyocard-ica.cc
+++ b/src/2dmyocard-ica.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/src/2dmyocard-icaseries.cc b/src/2dmyocard-icaseries.cc
index d5aa747..f344407 100644
--- a/src/2dmyocard-icaseries.cc
+++ b/src/2dmyocard-icaseries.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -33,7 +33,6 @@
 
 
 #include <mia/core.hh>
-#include <mia/core/bfsv23dispatch.hh>
 #include <mia/2d/imageio.hh>
 #include <mia/2d/filter.hh>
 #include <mia/2d/ica.hh>
@@ -190,7 +189,7 @@ int do_main( int argc, char *argv[] )
 		bfs::path reff(reference_filename);
 		reff.replace_extension(); 
 		input_set.set_images(references);  
-		input_set.rename_base(__bfs_get_filename(reff)); 
+		input_set.rename_base(reff.filename().string()); 
 		input_set.save_images(reference_filename);
 		
 		
diff --git a/src/2dmyocard-segment.cc b/src/2dmyocard-segment.cc
index 2b8804a..ec57817 100644
--- a/src/2dmyocard-segment.cc
+++ b/src/2dmyocard-segment.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -33,7 +33,6 @@
 
 #include <mia/core.hh>
 #include <mia/core/meanvar.hh>
-#include <mia/core/bfsv23dispatch.hh>
 #include <mia/core/tools.hh>
 #include <mia/2d/imageio.hh>
 #include <mia/2d/filter.hh>
diff --git a/src/2dmyocard-upsloap.cc b/src/2dmyocard-upsloap.cc
index 100e77f..9092126 100644
--- a/src/2dmyocard-upsloap.cc
+++ b/src/2dmyocard-upsloap.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -32,7 +32,6 @@
 
 
 #include <mia/core.hh>
-#include <mia/core/bfsv23dispatch.hh>
 #include <mia/2d/imageio.hh>
 #include <mia/2d/filter.hh>
 #include <mia/2d/ica.hh>
diff --git a/src/2dmyoica-full.cc b/src/2dmyoica-full.cc
index 2d9a057..7237527 100644
--- a/src/2dmyoica-full.cc
+++ b/src/2dmyoica-full.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -28,7 +28,6 @@
 #include <mia/core/cmdlineparser.hh>
 #include <mia/core/errormacro.hh>
 #include <mia/core/minimizer.hh>
-#include <mia/core/bfsv23dispatch.hh>
 #include <mia/core/attribute_names.hh>
 #include <mia/2d/nonrigidregister.hh>
 #include <mia/2d/perfusion.hh>
@@ -36,6 +35,9 @@
 #include <mia/2d/segsetwithimages.hh>
 #include <mia/2d/transformfactory.hh>
 
+#include <boost/filesystem/path.hpp>
+
+#include <libxml++/libxml++.h> 
 #include <tbb/parallel_for.h>
 #include <tbb/parallel_reduce.h>
 #include <tbb/blocked_range.h>
@@ -573,7 +575,7 @@ int do_main( int argc, char *argv[] )
 	if (!cropped_filename.empty()) {
 		bfs::path cf(cropped_filename);
 		cf.replace_extension(); 
-		input_set.rename_base(__bfs_get_filename(cf)); 
+		input_set.rename_base(cf.filename().string()); 
 		input_set.save_images(cropped_filename);
 
 		unique_ptr<xmlpp::Document> test_cropset(input_set.write());
diff --git a/src/2dmyoica-nonrigid-parallel.cc b/src/2dmyoica-nonrigid-parallel.cc
index 6cb539f..ed49328 100644
--- a/src/2dmyoica-nonrigid-parallel.cc
+++ b/src/2dmyoica-nonrigid-parallel.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -30,7 +30,6 @@
 #include <mia/core/cmdlineparser.hh>
 #include <mia/core/errormacro.hh>
 #include <mia/core/minimizer.hh>
-#include <mia/core/bfsv23dispatch.hh>
 #include <mia/core/attribute_names.hh>
 #include <mia/2d/nonrigidregister.hh>
 #include <mia/2d/perfusion.hh>
@@ -38,6 +37,8 @@
 #include <mia/2d/segsetwithimages.hh>
 #include <mia/2d/transformfactory.hh>
 
+#include <boost/filesystem.hpp>
+
 #include <tbb/parallel_for.h>
 #include <tbb/blocked_range.h>
 using namespace tbb;
@@ -389,7 +390,7 @@ int do_main( int argc, char *argv[] )
 	if (!cropped_filename.empty()) {
 		bfs::path cf(cropped_filename);
 		cf.replace_extension(); 
-		input_set.rename_base(__bfs_get_filename(cf)); 
+		input_set.rename_base(cf.filename().string()); 
 		input_set.save_images(cropped_filename);
 
 		unique_ptr<xmlpp::Document> test_cropset(input_set.write());
diff --git a/src/2dmyoica-nonrigid.cc b/src/2dmyoica-nonrigid.cc
index 768e7f4..3efa899 100644
--- a/src/2dmyoica-nonrigid.cc
+++ b/src/2dmyoica-nonrigid.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -30,7 +30,6 @@
 #include <mia/core/cmdlineparser.hh>
 #include <mia/core/errormacro.hh>
 #include <mia/core/minimizer.hh>
-#include <mia/core/bfsv23dispatch.hh>
 #include <mia/core/attribute_names.hh>
 #include <mia/2d/nonrigidregister.hh>
 #include <mia/2d/perfusion.hh>
@@ -327,7 +326,7 @@ int do_main( int argc, char *argv[] )
 	if (!cropped_filename.empty()) {
 		bfs::path cf(cropped_filename);
 		cf.replace_extension(); 
-		input_set.rename_base(__bfs_get_filename(cf)); 
+		input_set.rename_base(cf.filename().string()); 
 		input_set.save_images(cropped_filename);
 
 		unique_ptr<xmlpp::Document> test_cropset(input_set.write());
diff --git a/src/2dmyoica-nonrigid2.cc b/src/2dmyoica-nonrigid2.cc
index 938a387..5c341ea 100644
--- a/src/2dmyoica-nonrigid2.cc
+++ b/src/2dmyoica-nonrigid2.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -29,7 +29,6 @@
 #include <mia/core/cmdlineparser.hh>
 #include <mia/core/errormacro.hh>
 #include <mia/core/minimizer.hh>
-#include <mia/core/bfsv23dispatch.hh>
 #include <mia/2d/nonrigidregister.hh>
 #include <mia/2d/perfusion.hh>
 #include <mia/2d/segsetwithimages.hh>
@@ -266,7 +265,7 @@ int do_main( int argc, char *argv[] )
 	if (!cropped_filename.empty()) {
 		bfs::path cf(cropped_filename);
 		cf.replace_extension(); 
-		input_set.rename_base(__bfs_get_filename(cf)); 
+		input_set.rename_base(cf.filename().string()); 
 		input_set.save_images(cropped_filename);
 
 		unique_ptr<xmlpp::Document> test_cropset(input_set.write());
diff --git a/src/2dmyoicapgt.cc b/src/2dmyoicapgt.cc
index 425a1c4..56aadec 100644
--- a/src/2dmyoicapgt.cc
+++ b/src/2dmyoicapgt.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -28,7 +28,6 @@
 #include <mia/core/cmdlineparser.hh>
 #include <mia/core/errormacro.hh>
 #include <mia/core/minimizer.hh>
-#include <mia/core/bfsv23dispatch.hh>
 #include <mia/core/attribute_names.hh>
 #include <mia/2d/nonrigidregister.hh>
 #include <mia/2d/perfusion.hh>
@@ -36,6 +35,8 @@
 #include <mia/2d/segsetwithimages.hh>
 #include <mia/2d/transformfactory.hh>
 #include <mia/2d/ground_truth_evaluator.hh>
+#include <libxml++/libxml++.h> 
+#include <boost/filesystem/path.hpp>
 
 #include <tbb/parallel_for.h>
 #include <tbb/parallel_reduce.h>
@@ -560,7 +561,7 @@ int do_main( int argc, char *argv[] )
 	if (!cropped_filename.empty()) {
 		bfs::path cf(cropped_filename);
 		cf.replace_extension(); 
-		input_set.rename_base(__bfs_get_filename(cf)); 
+		input_set.rename_base(cf.filename().string()); 
 		input_set.save_images(cropped_filename);
 
 		unique_ptr<xmlpp::Document> test_cropset(input_set.write());
diff --git a/src/2dmyomilles.cc b/src/2dmyomilles.cc
index 732400d..be9c64e 100644
--- a/src/2dmyomilles.cc
+++ b/src/2dmyomilles.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -30,7 +30,6 @@
 #include <mia/core/cmdlineparser.hh>
 #include <mia/core/errormacro.hh>
 #include <mia/core/minimizer.hh>
-#include <mia/core/bfsv23dispatch.hh>
 #include <mia/2d/rigidregister.hh>
 #include <mia/2d/perfusion.hh>
 #include <mia/2d/imageio.hh>
@@ -274,7 +273,7 @@ int do_main( int argc, char *argv[] )
 	if (!cropped_filename.empty()) {
 		bfs::path cf(cropped_filename);
 		cf.replace_extension(); 
-		input_set.rename_base(__bfs_get_filename(cf)); 
+		input_set.rename_base(cf.filename().string()); 
 		input_set.save_images(cropped_filename);
 
 		unique_ptr<xmlpp::Document> test_cropset(input_set.write());
diff --git a/src/2dmyoperiodic-nonrigid.cc b/src/2dmyoperiodic-nonrigid.cc
index f2bdb51..8a3668e 100644
--- a/src/2dmyoperiodic-nonrigid.cc
+++ b/src/2dmyoperiodic-nonrigid.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/src/2dmyopgt-nonrigid.cc b/src/2dmyopgt-nonrigid.cc
index 358f29a..ab47cc2 100644
--- a/src/2dmyopgt-nonrigid.cc
+++ b/src/2dmyopgt-nonrigid.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/src/2dmyoserial-nonrigid.cc b/src/2dmyoserial-nonrigid.cc
index 71e0db7..c07c9c9 100644
--- a/src/2dmyoserial-nonrigid.cc
+++ b/src/2dmyoserial-nonrigid.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/src/2dmyoseries-compdice.cc b/src/2dmyoseries-compdice.cc
index 7afa835..c609856 100644
--- a/src/2dmyoseries-compdice.cc
+++ b/src/2dmyoseries-compdice.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/src/2dmyoseries-dice.cc b/src/2dmyoseries-dice.cc
index cda9eb0..0e9101d 100644
--- a/src/2dmyoseries-dice.cc
+++ b/src/2dmyoseries-dice.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/src/2dmyoset-all2one-nonrigid.cc b/src/2dmyoset-all2one-nonrigid.cc
index aca1a02..6cc1f5e 100644
--- a/src/2dmyoset-all2one-nonrigid.cc
+++ b/src/2dmyoset-all2one-nonrigid.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -64,9 +64,7 @@ C2DFullCostList create_costs(const vector<string>& costs, int idx)
 
 	for (auto c = costs.begin(); c != costs.end(); ++c) {
 		string cc(*c); 
-
-		if (cc.find("image") == 0) 
-			cc.append(cost_descr.str()); 
+		cc.append(cost_descr.str()); 
 		cvdebug() << "create cost:"  << *c << " as " << cc << "\n"; 
 		auto imagecost = C2DFullCostPluginHandler::instance().produce(cc);
 		result.push(imagecost); 
diff --git a/src/2dnrreg.cc b/src/2dnrreg.cc
index 83ecd7e..175817f 100644
--- a/src/2dnrreg.cc
+++ b/src/2dnrreg.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/src/2dsegcompare.cc b/src/2dsegcompare.cc
index c8adaf7..6ce21e2 100644
--- a/src/2dsegcompare.cc
+++ b/src/2dsegcompare.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/src/2dseghausdorff.cc b/src/2dseghausdorff.cc
index c400dfd..9b32100 100644
--- a/src/2dseghausdorff.cc
+++ b/src/2dseghausdorff.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/src/2dsegment-ahmed.cc b/src/2dsegment-ahmed.cc
index ec86988..910a09a 100644
--- a/src/2dsegment-ahmed.cc
+++ b/src/2dsegment-ahmed.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -267,7 +267,7 @@ void CSegment2d::evaluate_probabilities(C2DFImageVec& prob)const
 		else {// must be a bright value, otherwise, class[0] would catch it
 			for (size_t i = 0; i < _M_nClasses - 1; ++i)
 				*pi[i]++ = 0.0;
-			*pi[_M_nClasses - 1] = 1.0; 
+			*pi[_M_nClasses - 1]++ = 1.0; 
 		}
 	}
 }
@@ -339,7 +339,7 @@ CSegment2d::process(const C2DFImage& image,
 	
 	C2DFImage tmp(image.get_size());                                        // 4Bpp
 
-	auto_ptr<C2DFImage> bg_image(NULL);                                              
+	unique_ptr<C2DFImage> bg_image;                                              
 
 	
 	if (_M_bg_correct) {
diff --git a/src/2dsegment-fuzzyw.cc b/src/2dsegment-fuzzyw.cc
index 1cdf8fa..243973c 100644
--- a/src/2dsegment-fuzzyw.cc
+++ b/src/2dsegment-fuzzyw.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/src/2dsegmentcropbox.cc b/src/2dsegmentcropbox.cc
index 692ea42..6fa7574 100644
--- a/src/2dsegmentcropbox.cc
+++ b/src/2dsegmentcropbox.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -123,7 +123,7 @@ int do_main(int argc, char *argv[])
 	}
 
 	// save output
-	auto_ptr<xmlpp::Document> outset(cropped.write());
+	unique_ptr<xmlpp::Document> outset(cropped.write());
 
 	ofstream outfile(out_filename.c_str(), ios_base::out );
 	if (outfile.good())
diff --git a/src/2dsegseriesstats.cc b/src/2dsegseriesstats.cc
index 965ff09..d99be5e 100644
--- a/src/2dsegseriesstats.cc
+++ b/src/2dsegseriesstats.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/src/2dsegshift.cc b/src/2dsegshift.cc
index 9b8f36c..474c998 100644
--- a/src/2dsegshift.cc
+++ b/src/2dsegshift.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -93,7 +93,7 @@ int do_main(int argc, char *argv[])
 	cvinfo() << "shift by " << shift << ", skip " << skip << " and rename to base " << shift_filename << "\n";
 	CSegSet shifted = src_segset.shift_and_rename(skip, shift, shift_filename);
 
-	auto_ptr<xmlpp::Document> outset(shifted.write());
+	unique_ptr<xmlpp::Document> outset(shifted.write());
 
 	ofstream outfile(out_filename.c_str(), ios_base::out );
 	if (outfile.good())
diff --git a/src/2dsegshiftperslice.cc b/src/2dsegshiftperslice.cc
index c27be14..8bc827d 100644
--- a/src/2dsegshiftperslice.cc
+++ b/src/2dsegshiftperslice.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -30,7 +30,6 @@
 #include <libxml++/libxml++.h>
 
 #include <mia/core.hh>
-#include <mia/core/bfsv23dispatch.hh>
 #include <mia/2d/segset.hh>
 #include <mia/2d/imageio.hh>
 #include <mia/2d/filter.hh>
@@ -68,7 +67,7 @@ CSegSet load_segmentation(const string& s)
 static string get_number(const string& fname)
 {
 	bfs::path f(fname);
-	string the_stem = __bfs_get_stem(f);
+	string the_stem = f.stem().string();
 	auto rs = the_stem.rbegin();
 	string result;
 	while (rs != the_stem.rend() && isdigit(*rs))
@@ -111,7 +110,7 @@ int do_main(int argc, char *argv[])
 	}
 
 
-	auto_ptr<xmlpp::Document> outset(src_segset.write());
+	unique_ptr<xmlpp::Document> outset(src_segset.write());
 
 	ofstream outfile(out_filename.c_str(), ios_base::out );
 	if (outfile.good())
diff --git a/src/2dseries-mincorr.cc b/src/2dseries-mincorr.cc
index b4a87b8..373b364 100644
--- a/src/2dseries-mincorr.cc
+++ b/src/2dseries-mincorr.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/src/2dseries-sectionmask.cc b/src/2dseries-sectionmask.cc
index 8de3542..4f73943 100644
--- a/src/2dseries-sectionmask.cc
+++ b/src/2dseries-sectionmask.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/src/2dseries-segdistance.cc b/src/2dseries-segdistance.cc
index 4824378..31fceed 100644
--- a/src/2dseries-segdistance.cc
+++ b/src/2dseries-segdistance.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/src/2dseries2dordermedian.cc b/src/2dseries2dordermedian.cc
index df82799..99cab7c 100644
--- a/src/2dseries2dordermedian.cc
+++ b/src/2dseries2dordermedian.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/src/2dseries2sets.cc b/src/2dseries2sets.cc
index 266938c..efed751 100644
--- a/src/2dseries2sets.cc
+++ b/src/2dseries2sets.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -22,7 +22,6 @@
 #include <fstream>
 #include <libxml++/libxml++.h>
 #include <mia/core/cmdlineparser.hh>
-#include <mia/core/bfsv23dispatch.hh>
 #include <mia/core/attribute_names.hh>
 #include <mia/2d/imageio.hh>
 #include <mia/2d/segsetwithimages.hh>
@@ -145,7 +144,7 @@ bool save_series(int index, const C2DImageVectorWithName& series, const string&
 			frame.set_imagename(i->second);
 		else {
 			bfs::path infile(i->second); 
-			string filename = __bfs_get_filename(infile);
+			string filename = infile.filename().string();
 			frame.set_imagename(filename);
 			mia_copy_file(infile, outpath / bfs::path(filename)); 
 		}
diff --git a/src/2dseriescorr.cc b/src/2dseriescorr.cc
index c01b2b2..85414c6 100644
--- a/src/2dseriescorr.cc
+++ b/src/2dseriescorr.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/src/2dseriesgradMAD.cc b/src/2dseriesgradMAD.cc
index bca179c..1cb1afd 100644
--- a/src/2dseriesgradMAD.cc
+++ b/src/2dseriesgradMAD.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/src/2dseriesgradvariation.cc b/src/2dseriesgradvariation.cc
index 3670a21..ffc2ca4 100644
--- a/src/2dseriesgradvariation.cc
+++ b/src/2dseriesgradvariation.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/src/2dserieshausdorff.cc b/src/2dserieshausdorff.cc
index a6bb371..5053728 100644
--- a/src/2dserieshausdorff.cc
+++ b/src/2dserieshausdorff.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/src/2dseriessmoothgradMAD.cc b/src/2dseriessmoothgradMAD.cc
index 87019d5..4893ccb 100644
--- a/src/2dseriessmoothgradMAD.cc
+++ b/src/2dseriessmoothgradMAD.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/src/2dseriestovolume.cc b/src/2dseriestovolume.cc
index 21ada94..bf39234 100644
--- a/src/2dseriestovolume.cc
+++ b/src/2dseriestovolume.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/src/2dstack-cmeans-presegment.cc b/src/2dstack-cmeans-presegment.cc
new file mode 100644
index 0000000..de24823
--- /dev/null
+++ b/src/2dstack-cmeans-presegment.cc
@@ -0,0 +1,433 @@
+/* -*- mia-c++  -*-
+ *
+ * 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 MIA; if not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <sstream>
+#include <ostream>
+#include <fstream>
+#include <mia/core.hh>
+#include <mia/core/cmeans.hh>
+#include <mia/core/cmdlineparser.hh>
+#include <mia/internal/main.hh>
+#include <mia/2d.hh>
+
+NS_MIA_USE;
+using namespace std;
+
+const SProgramDescription g_description = {
+	
+	{pdi_group, "Processing of series of 2D images in a 3D fashion (out-of-core)"}, 
+	{pdi_short, "Pre-classify the input image series by using a c-means estimator"}, 
+	
+	
+	{pdi_description, "This program first evaluates a sparse histogram of an input image "
+         "series, then runs a c-means classification over the histogram, and then estimates a "
+         "per image seeds for later segmentation based on class probabilities. "
+         "This program accepts only images of eight or 16 bit integer pixels."
+        }, 
+	
+	{pdi_example_descr,"Run the program over images imageXXXX.png with the sparse histogram, "
+         "threshold the lower 30% bins (if available), run cmeans with two classes on the non-zero "
+         "pixels and then create the seeds mask as seedXXXX.png."}, 
+	
+	{pdi_example_code, "-i image.png -o seed -t png --histogram-tresh=30 --classes 2"}
+}; 
+
+class CFullHistogram : public TFilter<size_t> {
+        
+public: 
+        CFullHistogram();
+
+        template <typename T>
+        size_t operator ()(const T2DImage<T>& image); 
+
+        vector<pair<int, unsigned long>> get_compressed_histogram()const; 
+        
+private: 
+        
+        vector<unsigned long> m_histogram; 
+
+        int m_shift; 
+        EPixelType m_pixeltype; 
+
+        
+        
+}; 
+
+template <typename T> 
+struct dispatch_by_pixeltype {
+        static void apply(const T2DImage<T>& MIA_PARAM_UNUSED(image), vector<unsigned long>& MIA_PARAM_UNUSED(histogram)){
+                throw invalid_argument("Input pixel type not supported"); 
+        }
+}; 
+
+template <> 
+struct dispatch_by_pixeltype<unsigned char> {
+        static void apply(const C2DUBImage& image, vector<unsigned long>& histogram){
+                for (auto p: image) {
+                        ++histogram[p]; 
+                }
+        }
+}; 
+
+template <> 
+struct dispatch_by_pixeltype<unsigned short> {
+        static void apply(const C2DUSImage& image, vector<unsigned long>& histogram){
+                for (auto p: image) {
+                        ++histogram[p]; 
+                }
+        }
+}; 
+
+template <> 
+struct dispatch_by_pixeltype<signed char> {
+        static void apply(const C2DSBImage& image, vector<unsigned long>& histogram){
+		int shift = -numeric_limits<signed char>::min(); 
+                for (auto p: image) {
+                        ++histogram[shift + p]; 
+                }
+        }
+}; 
+
+template <> 
+struct dispatch_by_pixeltype<signed short> {
+        static void apply(const C2DSSImage& image, vector<unsigned long>& histogram){
+                int shift = -numeric_limits<signed short>::min(); 
+                for (auto p: image) {
+                        ++histogram[shift + p]; 
+                }
+        }
+}; 
+
+CFullHistogram::CFullHistogram():
+        m_shift(0), 
+        m_pixeltype(it_none)
+{
+}
+
+template <typename T>
+size_t CFullHistogram::operator ()(const T2DImage<T>& image)
+{
+        if (m_pixeltype ==it_none) {
+                m_pixeltype = image.get_pixel_type();
+		m_shift = -numeric_limits<T>::min(); 
+                switch (m_pixeltype) {
+                case it_sbyte:
+                case it_ubyte:
+                        m_histogram.resize(256);
+                        break; 
+                case it_sshort:
+                case it_ushort:
+                        m_histogram.resize(65536);
+                        break; 
+                default:
+                        throw create_exception<invalid_argument>("Input pixel type '", CPixelTypeDict.get_name(m_pixeltype),
+                                                                 "' not supported."); 
+                }
+                        
+        } else if (m_pixeltype != image.get_pixel_type()){
+                throw create_exception<invalid_argument>("Input pixels not of consisted type, started with ",
+                                                         CPixelTypeDict.get_name(m_pixeltype), ", but got now ",
+                                                         CPixelTypeDict.get_name(image.get_pixel_type())); 
+        }
+
+        dispatch_by_pixeltype<T>::apply(image, m_histogram);
+
+        return image.size(); 
+}
+
+vector<pair<int, unsigned long>> CFullHistogram::get_compressed_histogram()const
+{
+
+        int nonzero_bins = 0;
+        for (auto b: m_histogram) {
+                if (b > 0)
+                        ++nonzero_bins; 
+        }
+
+        vector<pair<int, unsigned long>> result;
+        result.reserve(nonzero_bins);
+        for (unsigned i = 0; i < m_histogram.size(); ++i) {
+                if (m_histogram[i] != 0)
+                        result.push_back(make_pair(i - m_shift, m_histogram[i])); 
+        }
+        return result; 
+}
+
+typedef map<double, CMeans::DVector> Probmap; 
+
+class FGetFlowImages: public TFilter<pair<C2DFImage, C2DFImage>> {
+public: 
+	FGetFlowImages(const Probmap& map,
+		       int low_end, int low_label, int high_end, int high_label,  
+		       const vector<int>& sink_labels,
+		       const vector<int>& source_labels, float thresh_prob, float flow_scale);
+
+	template <typename T> 
+	pair<C2DFImage, C2DFImage> operator() (const T2DImage<T>& image) const;   
+private:
+	template <typename T>
+	void add_flows(C2DFImage& flow, int label, const T2DImage<T>& image) const;
+
+	const Probmap& m_map;
+
+	int m_low_end;
+	int m_low_label;
+	int m_high_end;
+	int m_high_label;  
+	
+	vector<int> m_sink_labels;
+	vector<int> m_source_labels; 
+	
+	float m_thresh_prob; 
+	float m_flow_scale; 
+}; 
+
+
+FGetFlowImages::FGetFlowImages(const Probmap& map,
+			       int low_end, int low_label, int high_end, int high_label,
+			       const vector<int>& sink_labels,
+			       const vector<int>& source_labels, float thresh_prob, float flow_scale):
+	m_map(map),
+	m_low_end(low_end),
+	m_low_label(low_label),
+	m_high_end(high_end),
+	m_high_label(high_label),  
+	m_sink_labels(sink_labels),
+	m_source_labels(source_labels),
+	m_thresh_prob(thresh_prob), 
+	m_flow_scale(flow_scale)
+{
+}
+
+template <typename T>
+void FGetFlowImages::add_flows(C2DFImage& flow, int label, const T2DImage<T>& image) const
+{
+	auto iflow = flow.begin();
+	auto ii = image.begin();
+	auto ie = image.end();
+
+	while (ii != ie) {
+		if (*ii <= m_low_end)  {
+			if (m_low_label == label)
+				*iflow = 1.0f;
+		} else if (*ii >= m_high_end){
+			if (m_high_label == label)
+				*iflow = 1.0f;
+		} else {
+			auto l = m_map.find(*ii);
+			if (l != m_map.end()) {
+				if (l->second[label] >= m_thresh_prob && l->second[label] > *iflow)
+					*iflow = l->second[label];			       
+			} else {
+				// this should not happen and 
+				cvwarn() << "Unmapped value " << *ii << "\n";
+			}
+		}
+		//  should be a parameter
+		*iflow *= m_flow_scale; 
+		
+		++iflow;
+		++ii; 
+	}
+	
+}
+						    
+template <typename T> 
+pair<C2DFImage, C2DFImage> FGetFlowImages::operator() (const T2DImage<T>& image) const
+{
+	
+	C2DFImage sink_flow(image.get_size());
+	C2DFImage source_flow(image.get_size());
+
+
+	for (auto sink_label: m_sink_labels) {
+		add_flows(sink_flow, sink_label, image); 
+	}
+
+	for (auto source_label: m_source_labels) {
+		add_flows(source_flow, source_label, image); 
+	}
+	
+	return make_pair(sink_flow, source_flow); 
+	
+}
+
+int do_main( int argc, char *argv[] )
+{
+        string out_labels;
+	string out_probmap;
+	string in_filename;
+	string flow_fileprefix; 
+        string out_type("png");
+
+	float seed_threshold = 0.9; 
+        float histogram_thresh = 5;
+	float flow_prob_thresh = 0.5; 
+	float flow_scale = 100.0f; 
+	
+	CMeans::PInitializer class_center_initializer;
+
+	
+	const C2DImageIOPluginHandler::Instance& imageio = C2DImageIOPluginHandler::instance();
+
+	CCmdOptionList options(g_description);
+
+        options.set_group("File-IO"); 
+	options.add(make_opt( in_filename, "in-file", 'i', "input image(s) to be filtered", 
+			      CCmdOptionFlags::required_input, &imageio));
+	options.add(make_opt( out_probmap, "out-probmap", 'p', "Save probability map to this file", 
+			      CCmdOptionFlags::output));
+        options.add(make_opt( out_type, "type", 't', "output file name type"));
+
+	options.add(make_opt( out_labels, "out-labels", 'o', "output file name base", 
+			      CCmdOptionFlags::required_output));
+
+	options.add(make_opt( flow_fileprefix, "out-flow", 'f',
+			      "prefix for flow initialization images", CCmdOptionFlags::output)); 
+	
+        options.set_group("Parameters");
+        options.add(make_opt( histogram_thresh, EParameterBounds::bf_closed_interval, {0,50}, "histogram-thresh", 'T',
+                              "Percent of the extrem parts of the histogram to be collapsed into the respective last histogram bin."));
+        
+        options.add(make_opt( class_center_initializer, "kmeans:nc=3", "classes", 'C', "C-means class initializer"));
+	
+	options.add(make_opt( seed_threshold, EParameterBounds::bf_open_interval, {0.0f,1.0f}, "seed-threshold", 'S',
+                              "Probability threshold value to consider a pixel as seed pixel."));
+
+	options.add(make_opt( flow_prob_thresh, EParameterBounds::bf_min_closed | EParameterBounds::bf_max_open,
+			      {0.0f, 1.0f}, "flow-prob-thresh", 'F', "Class probability threshold to cut the flow "
+			      "to zero for the source/sink flow connectivity creation")); 
+	options.add(make_opt( flow_scale, EParameterBounds::bf_min_open, {0.0f}, "flow-scale", 'W',
+                              "Scaling factor to adjust the flow evaluated from the initial c-means segmentation."));
+
+	
+        
+	if (options.parse(argc, argv) != CCmdOptionList::hr_no)
+		return EXIT_SUCCESS; 
+	
+	size_t start_filenum = 0;
+	size_t end_filenum  = 0;
+	size_t format_width = 0;
+
+	string src_basename = get_filename_pattern_and_range(in_filename, start_filenum, end_filenum, format_width);
+		
+	if (start_filenum >= end_filenum)
+		throw invalid_argument(string("no files match pattern ") + src_basename);
+
+
+        CFullHistogram histo;
+        size_t n_pixels = 0; 
+        for (size_t i = start_filenum; i < end_filenum; ++i) {
+                string src_name = create_filename(src_basename.c_str(), i);
+                C2DImageIOPluginHandler::Instance::PData  in_image_list = imageio.load(src_name);
+                cvmsg() << "Read:" << src_name << "\r";
+                if (in_image_list.get() && in_image_list->size()) {
+                        for (auto k = in_image_list->begin(); k != in_image_list->end(); ++k)
+                                n_pixels += accumulate(histo, **k);
+                }
+        }
+	
+        auto chistogram = histo.get_compressed_histogram();
+	
+        size_t n_cut_off = static_cast<size_t>(floor(n_pixels / 100.0 * histogram_thresh));
+	
+	
+	size_t ni = 0; 
+	auto ii = chistogram.begin(); 
+        while ( ni < n_cut_off && ii != chistogram.end()) {
+		ni += ii->second;
+                ++ii; 
+        }
+	
+	size_t ne = 0; 
+	auto ie = chistogram.end() - 1;
+        while ( ne < n_cut_off && ie !=  ii) {
+		ne += ie->second;
+                --ie;
+        }
+
+        vector<pair<int, unsigned long>> threshed_histo(ii, ie);
+
+	CMeans::DVector class_centers; 
+	
+	CMeans cmeans(0.01, 0.00001, class_center_initializer);
+	CMeans::SparseProbmap pv = cmeans.run(threshed_histo,  class_centers);
+
+	Probmap pmap; 
+	for(auto ipv : pv) {
+		pmap[ipv.first] = ipv.second; 
+	}
+	
+	
+	if ( ! out_probmap.empty() ) {
+		ofstream outstr(out_probmap.c_str());
+		for (auto ipv: pv) {
+			outstr << ipv.first << " " << ipv.second << "\n"; 
+		}
+	}
+	
+	// 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);
+	
+	P2DFilter maxflow = produce_2dimage_filter("maxflow:sink-flow=sink.@,source-flow=source.@"); 
+	
+        for (size_t i = start_filenum; i < end_filenum; ++i) {
+                string src_name = create_filename(src_basename.c_str(), i);
+                C2DImageIOPluginHandler::Instance::PData  in_image_list = imageio.load(src_name);
+                cvmsg() << "Read:" << src_name << "\r";
+                if (in_image_list.get() && in_image_list->size()) {
+                        for (auto k = in_image_list->begin(); k != in_image_list->end(); ++k) {
+				// create label image
+
+				auto flow_images = mia::filter (get_flow_images, **k);
+				if (!flow_fileprefix.empty()) {
+					stringstream ssinkfn; 
+					ssinkfn << flow_fileprefix << "-sink"
+						<< setw(format_width) << setfill('0') << i
+						<< ".v";
+					save_image(ssinkfn.str(), flow_images.first);
+
+					stringstream sssourcefn; 
+					sssourcefn << flow_fileprefix << "-source"
+						   << setw(format_width) << setfill('0') << i
+						   << ".v";
+					save_image(sssourcefn.str(), flow_images.second);
+					
+				}
+				
+				save_image("sink.@", flow_images.first);
+				save_image("source.@", flow_images.second);
+				
+				auto label = maxflow->filter(**k);
+				*k = label; 
+			}
+                }
+		stringstream ss;
+		ss << out_labels << setw(format_width) << setfill('0') << i << "." << out_type;
+		
+		imageio.save(ss.str(), *in_image_list);
+        }
+	return EXIT_SUCCESS;
+}
+
+MIA_MAIN(do_main); 
+
+        
diff --git a/src/2dstackfilter.cc b/src/2dstackfilter.cc
index 60c6c31..5f83dd4 100644
--- a/src/2dstackfilter.cc
+++ b/src/2dstackfilter.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/src/2dto3dimage.cc b/src/2dto3dimage.cc
index ee1178b..84f0f28 100644
--- a/src/2dto3dimage.cc
+++ b/src/2dto3dimage.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/src/2dto3dimageb.cc b/src/2dto3dimageb.cc
index 6730997..09a80af 100644
--- a/src/2dto3dimageb.cc
+++ b/src/2dto3dimageb.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/src/2dtrackpixelmovement.cc b/src/2dtrackpixelmovement.cc
index 95ae4dc..38b49cd 100644
--- a/src/2dtrackpixelmovement.cc
+++ b/src/2dtrackpixelmovement.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/src/2dtransform.cc b/src/2dtransform.cc
index 8e1c3d0..1d5b1a1 100644
--- a/src/2dtransform.cc
+++ b/src/2dtransform.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/src/2dtransformation-to-strain.cc b/src/2dtransformation-to-strain.cc
index 28e9dd4..7f2340c 100644
--- a/src/2dtransformation-to-strain.cc
+++ b/src/2dtransformation-to-strain.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/src/3dbinarycombine.cc b/src/3dbinarycombine.cc
index d3ff303..63eee7b 100644
--- a/src/3dbinarycombine.cc
+++ b/src/3dbinarycombine.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/src/3dbrainextractT1.cc b/src/3dbrainextractT1.cc
index abcda8e..640a57b 100644
--- a/src/3dbrainextractT1.cc
+++ b/src/3dbrainextractT1.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/src/3dcombine-imageseries.cc b/src/3dcombine-imageseries.cc
new file mode 100644
index 0000000..a58745e
--- /dev/null
+++ b/src/3dcombine-imageseries.cc
@@ -0,0 +1,192 @@
+/* -*- mia-c++  -*-
+ *
+ * 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 MIA; if not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#include <mia/3d/imageio.hh>
+#include <mia/core/pixeltype.hh>
+#include <mia/core/cmdlineparser.hh>
+#include <mia/3d/filter.hh>
+
+using namespace mia;
+using namespace std;
+
+const SProgramDescription g_description = {
+        {pdi_group, "Analysis, filtering, combining, and segmentation of 3D images"}, 
+	{pdi_short, "Combine images."}, 
+	{pdi_description, "This programs takes various input images of the same dimensions "
+         "and creates a combined output images that uses the define operation for the combination." 
+	}
+}; 
+
+struct pixel_combiner {
+        virtual double apply (double x, double y) = 0; 
+        virtual double finalize(double x, double n) = 0; 
+}; 
+
+struct pixel_mean: public pixel_combiner {
+        virtual double apply (double x, double y) {
+                return x + y; 
+        }
+        virtual double finalize(double x, double n) {
+                return x / n; 
+        }
+};
+
+struct pixel_max : public pixel_combiner{
+        virtual double apply(double x, double y) {
+                return x > y ? x : y; 
+        }
+        virtual double finalize(double x, double MIA_PARAM_UNUSED(n)) {
+                return x; 
+        }
+};
+
+struct pixel_add : public pixel_combiner{
+        virtual double apply(double x, double y) {
+                return x + y; 
+        }
+        virtual double finalize(double x, double MIA_PARAM_UNUSED(n)) {
+                return x; 
+        }
+};
+
+enum ECombineops {
+        co_mean, 
+        co_max, 
+	co_add, 
+        co_unknown
+}; 
+
+const TDictMap<ECombineops>::Table l_combops_table[] = {
+	{"mean", co_mean, "mean image intensities"}, 
+	{"max", co_max, "select max per pixel intensity"}, 
+	{"add", co_add, "add pixel intensities"}, 
+	{NULL, co_unknown, ""}
+}; 
+
+const TDictMap<ECombineops> g_combops_dict(l_combops_table);
+
+class FImageSeriesCombiner : public TFilter<bool> {
+public: 
+        FImageSeriesCombiner(const C3DImage& prototype, pixel_combiner *op);  
+
+        template <typename T> 
+        bool operator () (const T3DImage<T>& image); 
+
+        P3DImage get_result(unsigned n, EPixelType pixeltype) const; 
+private: 
+        C3DDImage m_buffer; 
+        unique_ptr<pixel_combiner> m_op; 
+}; 
+
+FImageSeriesCombiner create_combiner(const C3DImage& prototype, ECombineops op)
+{
+        switch (op) { 
+        case co_mean: return FImageSeriesCombiner(prototype, new pixel_mean());
+        case co_max: return FImageSeriesCombiner(prototype, new pixel_max());
+        case co_add: return FImageSeriesCombiner(prototype, new pixel_add());
+        default: 
+                throw invalid_argument("Unknown combiner requested"); 
+        }
+}
+
+int do_main( int argc, char *argv[] )
+{
+	string out_filename;
+        ECombineops op = co_mean; 
+        EPixelType out_pixeltype = it_none; 
+        
+
+
+	const auto& imageio = C3DImageIOPluginHandler::instance();
+
+	CCmdOptionList options(g_description);
+	options.add(make_opt( out_filename, "out-file", 'o', "output file that contains the combined image.", 
+			      CCmdOptionFlags::required_output, &imageio));
+
+        options.add(make_opt(op, g_combops_dict, "operation", 'p', "Operation to be applied when combining the images"));
+        options.add(make_opt(out_pixeltype, CPixelTypeDict, "repn", 'r', "Output pixel representation (if not given, "
+                             "then the representation of the first input image will be used"));
+        
+	if (options.parse(argc, argv, "images", &imageio) != CCmdOptionList::hr_no)
+		return EXIT_SUCCESS; 
+
+	auto in_image_files = options.get_remaining();
+
+	if (in_image_files.empty()) {
+		throw invalid_argument("Nothing to do, since no input image were given"); 
+	}
+	
+	const auto n_images = in_image_files.size(); 
+        
+        // load the first image and create the combination filter
+        auto first_image = load_image3d(in_image_files[0]); 
+        
+        auto combiner = create_combiner(*first_image, op); 
+                
+        accumulate(combiner, *first_image); 
+        
+        for (unsigned i = 1; i < n_images; ++i)  {
+                auto image = load_image3d(in_image_files[i]); 
+                accumulate(combiner, *image);
+        }
+
+        if (out_pixeltype == it_none)
+                out_pixeltype = first_image->get_pixel_type(); 
+        
+        auto result = combiner.get_result(n_images, out_pixeltype); 
+
+	return save_image(out_filename, result)? EXIT_SUCCESS : EXIT_FAILURE; 
+}
+
+#include <mia/internal/main.hh>
+MIA_MAIN(do_main)
+
+FImageSeriesCombiner::FImageSeriesCombiner(const C3DImage& prototype, pixel_combiner *op):
+        m_buffer(prototype.get_size(), prototype), 
+        m_op(op)
+{
+}
+        
+
+template <typename T> 
+bool FImageSeriesCombiner::operator () (const T3DImage<T>& image)
+{
+        if (image.get_size() != m_buffer.get_size()) {
+                throw create_exception<invalid_argument>("The input images differ in size, expect [", 
+                                                         m_buffer.get_size(), "] but got [", image.get_size(), 
+                                                         "], aborting");
+        }
+        transform(m_buffer.begin(), m_buffer.end(), image.begin(), m_buffer.begin(), 
+                  [this](double x, T y){return m_op->apply(x,y);}); 
+        return true; 
+}
+
+P3DImage FImageSeriesCombiner::get_result(unsigned n, EPixelType pixeltype) const
+{
+        C3DDImage help(m_buffer.get_size(), m_buffer); 
+        
+        transform(m_buffer.begin(), m_buffer.end(), help.begin(), 
+                  [this, n](double x){return m_op->finalize(x, n);}); 
+        
+        stringstream convert_descr; 
+        convert_descr << "convert:map=copy,repn=" << CPixelTypeDict.get_name(pixeltype); 
+        return run_filter(help, convert_descr.str().c_str());
+}
diff --git a/src/3dcombine-mr-segmentations.cc b/src/3dcombine-mr-segmentations.cc
index 7fcf6e0..17968f4 100644
--- a/src/3dcombine-mr-segmentations.cc
+++ b/src/3dcombine-mr-segmentations.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/src/3dcost-translatedgrad.cc b/src/3dcost-translatedgrad.cc
index aff25ae..4116cf4 100644
--- a/src/3dcost-translatedgrad.cc
+++ b/src/3dcost-translatedgrad.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/src/3dcost.cc b/src/3dcost.cc
index 02a9c39..c622f73 100644
--- a/src/3dcost.cc
+++ b/src/3dcost.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/src/3dcrispsegment.cc b/src/3dcrispsegment.cc
index 44fc33f..55c8657 100644
--- a/src/3dcrispsegment.cc
+++ b/src/3dcrispsegment.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/src/3ddeform.cc b/src/3ddeform.cc
index 3faa71b..2d92db3 100644
--- a/src/3ddeform.cc
+++ b/src/3ddeform.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/src/3ddistance-stats.cc b/src/3ddistance-stats.cc
index 62f123a..9b52c6f 100644
--- a/src/3ddistance-stats.cc
+++ b/src/3ddistance-stats.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/src/3ddistance.cc b/src/3ddistance.cc
index 7479cb8..c037d02 100644
--- a/src/3ddistance.cc
+++ b/src/3ddistance.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/src/3deval-transformquantity.cc b/src/3deval-transformquantity.cc
index 509871e..bc0d858 100644
--- a/src/3deval-transformquantity.cc
+++ b/src/3deval-transformquantity.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/src/3dfield2norm.cc b/src/3dfield2norm.cc
index 918e867..525f737 100644
--- a/src/3dfield2norm.cc
+++ b/src/3dfield2norm.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/src/3dforce.cc b/src/3dforce.cc
index b06bf19..bc731aa 100644
--- a/src/3dforce.cc
+++ b/src/3dforce.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/src/3dfuzzysegment.cc b/src/3dfuzzysegment.cc
index 067d878..924dc70 100644
--- a/src/3dfuzzysegment.cc
+++ b/src/3dfuzzysegment.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/src/3dgetsize.cc b/src/3dgetsize.cc
index c7e0c74..e378d79 100644
--- a/src/3dgetsize.cc
+++ b/src/3dgetsize.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/src/3dgetslice.cc b/src/3dgetslice.cc
index 5289c60..94759ff 100644
--- a/src/3dgetslice.cc
+++ b/src/3dgetslice.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/src/3dimageaddattributes.cc b/src/3dimageaddattributes.cc
index 7b450ee..23f57a5 100644
--- a/src/3dimageaddattributes.cc
+++ b/src/3dimageaddattributes.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/src/3dimagecombine.cc b/src/3dimagecombine.cc
index 5c35f19..a64a03b 100644
--- a/src/3dimagecombine.cc
+++ b/src/3dimagecombine.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -56,7 +56,7 @@ int do_main( int argc, char *argv[] )
 	options.add(make_opt( in_image2, "image2", '2', "input image  2 to be combined", 
 			      CCmdOptionFlags::required_input, &imageio));
 	options.add(make_opt( combiner, "add", "combiner", 'c', "combiner operation", CCmdOptionFlags::required));
-	options.add(make_opt( out_filename, "out-image", 'o', "output file", CCmdOptionFlags::required_output, &imageio));
+	options.add(make_opt( out_filename, "out-file", 'o', "output image file", CCmdOptionFlags::required_output, &imageio));
 	
 	if (options.parse(argc, argv) != CCmdOptionList::hr_no)
 		return EXIT_SUCCESS; 
diff --git a/src/3dimagecreator.cc b/src/3dimagecreator.cc
index 600c783..5c66135 100644
--- a/src/3dimagecreator.cc
+++ b/src/3dimagecreator.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/src/3dimagefilter.cc b/src/3dimagefilter.cc
index 5ae446f..da8319f 100644
--- a/src/3dimagefilter.cc
+++ b/src/3dimagefilter.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/src/3dimagefilterstack.cc b/src/3dimagefilterstack.cc
index e8aa3d8..dc36f0c 100644
--- a/src/3dimagefilterstack.cc
+++ b/src/3dimagefilterstack.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/src/3dimageselect.cc b/src/3dimageselect.cc
index 7f33f5e..8c67852 100644
--- a/src/3dimageselect.cc
+++ b/src/3dimageselect.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/src/3dimagestatistics-in-mask.cc b/src/3dimagestatistics-in-mask.cc
new file mode 100644
index 0000000..6fbb8c2
--- /dev/null
+++ b/src/3dimagestatistics-in-mask.cc
@@ -0,0 +1,215 @@
+/* -*- mia-c++  -*-
+ *
+ * This file is part of MIA - a toolbox for medical image analysis 
+ * 
+ * Copyright (c) Leipzig, Madrid 1999-2015 Gert Wollny
+ *
+ *
+ * pez-tools 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 pez-tools; if not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#include <mia/internal/main.hh>
+#include <mia/core/cmdlineparser.hh>
+#include <mia/core/meanvar.hh>
+#include <mia/core/filter.hh>
+#include <mia/core/histogram.hh>
+#include <mia/core/errormacro.hh>
+#include <mia/3d/imageio.hh>
+
+
+
+
+
+using namespace mia; 
+using namespace std; 
+
+const SProgramDescription g_description = {
+        {pdi_group, "Analysis, filtering, combining, and segmentation of 3D images"}, 
+	{pdi_short, "Evaluate statistics within a masked region of the input data."}, 
+	{pdi_description, "This program evaluates the statistics of an image within a masked "
+         "region of the image. Possible outputs are a summary statistics and a histogram of "
+         "the values."
+        }, 
+	{pdi_example_descr, "evaluate the summary statistics on the input and a histogram with 10 bins and "
+         "automtically evaluated boundaries. Save summary in summary.txt and the histogram in hist.txt"}, 
+	{pdi_example_code, "--image image.v.gz --mask mask.v.gz --summary summary.txt --histogram hist.txt"}
+}; 
+
+struct SHistogramParams {
+	string struct_name; 
+        size_t bins; 
+        float range_min; 
+        float range_max; 
+        
+}; 
+
+struct FPixelAccumulator : public TFilter<size_t> {
+public: 
+        FPixelAccumulator(const C3DBitImage& mask):m_mask(mask) {
+                size_t count = 0; 
+                for(auto m : mask) 
+                        if (m) 
+                                ++count; 
+                m_pixels.reserve(count); 
+        }
+        
+        template <typename T>
+        size_t operator () (const T3DImage<T>& image) {
+                assert(image.get_size() == m_mask.get_size()); 
+                
+                auto im = m_mask.begin();
+                auto ii = image.begin(); 
+                auto ie = image.end(); 
+                
+                while (ii != ie) {
+                        if (*im)
+                                m_pixels.push_back(*ii); 
+			++ii; ++im; 
+                }
+                sort(m_pixels.begin(), m_pixels.end()); 
+                return m_pixels.size(); 
+        }
+        
+        void get_summary(ostream& os) const {
+                double min_val = m_pixels[0]; 
+                double max_val = m_pixels[m_pixels.size() - 1];                
+                double median = m_pixels[m_pixels.size() / 2];
+                auto meanvar =  mean_var(m_pixels.begin(), m_pixels.end()); 
+                os << "#   mean   |  variation |   median   |    min    |    max\n"; 
+                os << meanvar.first << " " << meanvar.second << " " 
+                   << median << " " << min_val << " " << max_val; 
+        }
+        
+        void get_histogram(SHistogramParams params, ostream& os) const {
+                if (params.range_min >= params.range_max)  {
+                        params.range_min = m_pixels[0];
+                        params.range_max = m_pixels[m_pixels.size() - 1];
+                }
+                THistogram<THistogramFeeder<double > > histo(THistogramFeeder<double >(params.range_min, params.range_max, params.bins)); 
+                histo.push_range(m_pixels.begin(), m_pixels.end());
+                os << "#histogram\n"; 
+                os << "struct=" << params.struct_name << '\n'; 
+                os << "min=" << params.range_min << '\n'; 
+                os << "max=" << params.range_max << '\n'; 
+                os << "step=" << ( params.range_max - params.range_min ) / double(params.bins - 1) << '\n';
+                os << "values="; 
+                for (auto ih = histo.begin(); ih != histo.end(); ++ih) 
+                        os << *ih << " "; 
+                os << "\n"; 
+        }
+
+private: 
+        const C3DBitImage& m_mask; 
+        vector<double> m_pixels; 
+}; 
+
+int do_main( int argc, char *argv[] )
+{
+
+	string in_filename;
+        string mask_filename;
+
+        string summary_filename;
+        string histogram_filename;
+
+        unsigned pixel_limit = 20; 
+
+        SHistogramParams hparams = {"undefined", 8, 0.0f, 0.0f}; 
+        
+	const C3DImageIOPluginHandler::Instance& imageio = C3DImageIOPluginHandler::instance();
+
+	CCmdOptionList options(g_description);
+
+        options.set_group("File-IO");         
+	options.add(make_opt( in_filename, "image", 'i', "input image to be analyzed", 
+			      CCmdOptionFlags::required_input, &imageio));
+        options.add(make_opt( mask_filename, "mask", 'm', "mask image to use to restrict the analysis", 
+                              CCmdOptionFlags::required_input, &imageio));
+
+	options.add(make_opt( summary_filename, "summary", 's', "File to write the summary statistics to as plain text.", 
+			      CCmdOptionFlags::output));
+        options.add(make_opt( histogram_filename, "histogram", 'H', "File to write the histogram to",
+                              CCmdOptionFlags::output));
+        
+        options.set_group("Parameters");
+
+	options.add(make_opt(hparams.struct_name, "struct-name", 0, "Name of the structure the statistics are evaluated for")); 
+        options.add(make_opt(pixel_limit, EParameterBounds::bf_min_closed, {20}, "limit", 'l', 
+                             "Number of pixels the mask should at least contain.")); 
+        options.add(make_opt(hparams.bins, EParameterBounds::bf_min_closed, {4}, "bins", 'b', 
+                             "number of histogram bins to be used")); 
+        options.add(make_opt(hparams.range_min, "hmin", 0, "lower bound for the histogram mapping. All values below this value"
+                             " will be mapped into the lowest bin. If this parameter is equal or larger than hmax, the "
+                             "histogram range is evaluated automatically.")); 
+        options.add(make_opt(hparams.range_max, "hmax", 0, "hpper bound for the histogram mapping. All values above this value"
+                             "will be mapped into the highest bin. If this parameter is equal or smaller than hmin, the "
+                             "histogram range is evaluated automatically."));
+        
+        
+	if (options.parse(argc, argv) != CCmdOptionList::hr_no)
+		return EXIT_SUCCESS; 
+        
+        if (summary_filename.empty() && histogram_filename.empty())
+                throw invalid_argument("At least one option of '--summary' and '--histogram' must be given");
+        
+        auto image = load_image3d(in_filename); 
+        auto mask_image = load_image3d(mask_filename); 
+        
+        if ( mask_image->get_pixel_type() != it_bit)  {
+                throw create_exception<invalid_argument>("Mask image must be binary, but image in '", 
+                                                          mask_filename, "' is of type '", 
+                                                          CPixelTypeDict.get_name(mask_image->get_pixel_type()), "'");
+        }
+
+        if (mask_image->get_size() != image->get_size()) {
+                throw create_exception<invalid_argument>("Mask image '", mask_filename, "(", mask_image->get_size(), ")'",
+                                                          "and value image '", in_filename, "(", image->get_size(), ")'", 
+                                                          "are of different size."); 
+        }
+
+        auto& mask = static_cast<const C3DBitImage&>(*mask_image); 
+        
+        FPixelAccumulator pa(mask); 
+        
+        auto counted_pixels = mia::accumulate(pa, *image); 
+        if (counted_pixels < pixel_limit) {
+                throw create_exception<runtime_error>("Resquested at least ", pixel_limit, " valid pixel, "
+                                                      "but mask only contained ", counted_pixels); 
+        }
+        
+        if (!summary_filename.empty()) { 
+                // obtain summary stratistics 
+                ofstream  os; 
+                os.exceptions( std::ofstream::failbit | std::ofstream::badbit ); 
+                os.open(summary_filename.c_str()); 
+
+                pa.get_summary(os); 
+        }
+         
+        if (!histogram_filename.empty()) { 
+                // obtain summary stratistics 
+                ofstream  os; 
+                os.exceptions( std::ofstream::failbit | std::ofstream::badbit ); 
+                os.open(histogram_filename.c_str()); 
+                pa.get_histogram(hparams, os); 
+        }
+
+        return EXIT_SUCCESS; 
+}
+
+#include <mia/internal/main.hh>
+MIA_MAIN(do_main)
+
diff --git a/src/3dimagestats.cc b/src/3dimagestats.cc
index e509580..7dd38ca 100644
--- a/src/3dimagestats.cc
+++ b/src/3dimagestats.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/src/3dlandmarks-distances.cc b/src/3dlandmarks-distances.cc
index ec192ee..c8a14ca 100644
--- a/src/3dlandmarks-distances.cc
+++ b/src/3dlandmarks-distances.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/src/3dlandmarks-transform.cc b/src/3dlandmarks-transform.cc
index 48c9b90..b743835 100644
--- a/src/3dlandmarks-transform.cc
+++ b/src/3dlandmarks-transform.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/src/3dlerp.cc b/src/3dlerp.cc
index 7c5e128..134214a 100644
--- a/src/3dlerp.cc
+++ b/src/3dlerp.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/src/3dmany2one-nonrigid.cc b/src/3dmany2one-nonrigid.cc
index ef1421c..383cbe0 100644
--- a/src/3dmany2one-nonrigid.cc
+++ b/src/3dmany2one-nonrigid.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/src/3dmaskseeded.cc b/src/3dmaskseeded.cc
index b6dde98..751cbf5 100644
--- a/src/3dmaskseeded.cc
+++ b/src/3dmaskseeded.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/src/3dmotioncompica-nonrigid.cc b/src/3dmotioncompica-nonrigid.cc
index 5a1633b..aaf8b83 100644
--- a/src/3dmotioncompica-nonrigid.cc
+++ b/src/3dmotioncompica-nonrigid.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -31,7 +31,6 @@
 #include <mia/core/filetools.hh>
 #include <mia/core/errormacro.hh>
 #include <mia/core/minimizer.hh>
-#include <mia/core/bfsv23dispatch.hh>
 #include <mia/3d/nonrigidregister.hh>
 #include <mia/3d/imageio.hh>
 #include <mia/3d/filter.hh>
diff --git a/src/3dmulti-nrreg.cc b/src/3dmulti-nrreg.cc
index 02e02aa..1f4dbba 100644
--- a/src/3dmulti-nrreg.cc
+++ b/src/3dmulti-nrreg.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/src/3dnonrigidreg-alt.cc b/src/3dnonrigidreg-alt.cc
index 8970882..a035465 100644
--- a/src/3dnonrigidreg-alt.cc
+++ b/src/3dnonrigidreg-alt.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/src/3dnonrigidreg.cc b/src/3dnonrigidreg.cc
index dd43467..2de5f1a 100644
--- a/src/3dnonrigidreg.cc
+++ b/src/3dnonrigidreg.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/src/3dnrreg.cc b/src/3dnrreg.cc
index 80750cd..ff61308 100644
--- a/src/3dnrreg.cc
+++ b/src/3dnrreg.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/src/3dprealign-nonrigid.cc b/src/3dprealign-nonrigid.cc
index 5bdea2e..f3439c0 100644
--- a/src/3dprealign-nonrigid.cc
+++ b/src/3dprealign-nonrigid.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/src/3dpropose-boundingbox.cc b/src/3dpropose-boundingbox.cc
new file mode 100644
index 0000000..dc56c45
--- /dev/null
+++ b/src/3dpropose-boundingbox.cc
@@ -0,0 +1,141 @@
+/* -*- mia-c++  -*-
+ *
+ * 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 MIA; if not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <iostream>
+#include <string>
+#include <stdexcept>
+#include <sstream>
+
+#include <mia/3d/filter.hh>
+#include <mia/3d/imageio.hh>
+#include <mia/core.hh>
+
+
+using namespace std;
+NS_MIA_USE;
+
+const SProgramDescription g_description = {
+        {pdi_group, "Analysis, filtering, combining, and segmentation of 3D images"}, 
+	{pdi_short, "Evaluate a bounding box for the image."}, 
+	{pdi_description, "This program evaluates a box that contains all the pixels "
+         "of a given mask image. If the input image is not a binary image, a pre-filter "
+         "must be applied that converts the imput image into a mask."}, 
+	{pdi_example_descr, "Evaluate a bounding box with boundary padding of 5 of a mask "
+         "resulting from a binarization with a minimum value 10."
+         "10 and a boundary padding of 5 from image image.v ."}, 
+	{pdi_example_code, "-i image.v -f binarize:min=10 -p 5" }
+}; 
+
+
+inline void pad_down( unsigned& inout, unsigned pad) 
+{
+        if (inout > pad) 
+                inout -= pad; 
+        else 
+                inout = 0; 
+}; 
+
+inline void pad_up(unsigned& inout, unsigned pad, unsigned maximum)
+{
+        inout += pad; 
+        if (inout > maximum)
+                inout = maximum; 
+}
+
+int do_main( int argc, char *argv[] )
+{
+	string in_filename;
+        P3DFilter prefilter; 
+        unsigned padding = 0; 
+
+	const auto& imageio = C3DImageIOPluginHandler::instance();
+
+	CCmdOptionList options(g_description);
+        options.set_group("File-IO"); 
+	options.add(make_opt( in_filename, "in-file", 'i', "input image(s) to be filtered", 
+			      CCmdOptionFlags::required_input, &imageio));
+
+        options.set_group("Parameters"); 
+	options.add(make_opt( prefilter, "", "filter", 'f', "Filter to be applied to the image before the "
+                              "bounding box is evaluated. Must return a bit-valued image."));
+        options.add(make_opt( padding, EParameterBounds::bf_min_closed, {0}, "padding", 'p', 
+                              "Padding of boundaries."));
+        
+	options.set_stdout_is_result(); 
+        
+
+	if (options.parse(argc, argv) != CCmdOptionList::hr_no)
+		return EXIT_SUCCESS; 
+
+        auto image = load_image3d(in_filename); 
+
+        if (prefilter) 
+                image = prefilter->filter(*image); 
+        
+        if (image->get_pixel_type() != it_bit) {
+                if (!prefilter) 
+                        throw invalid_argument("The input image is not binary, and you didn't specify a prefilter "
+                                               "that extracts a binary mask from the image"); 
+                else
+                        throw invalid_argument("The prefilter doesn't create a binary image."); 
+        }
+        
+        const C3DBitImage& mask = dynamic_cast<const C3DBitImage&>(*image); 
+        
+        C3DBounds mask_start =  mask.get_size();
+        C3DBounds mask_end = C3DBounds::_0;
+
+        auto im = mask.begin_range(C3DBounds::_0, mask.get_size());
+        auto em = mask.end_range(C3DBounds::_0, mask.get_size());
+        
+        while (im != em) {
+                if (*im) {
+                        if (mask_end.x <= im.pos().x) mask_end.x = im.pos().x + 1; 
+                        if (mask_end.y <= im.pos().y) mask_end.y = im.pos().y + 1; 
+                        if (mask_end.z <= im.pos().z) mask_end.z = im.pos().z + 1; 
+
+                        if (mask_start.x > im.pos().x) mask_start.x = im.pos().x; 
+                        if (mask_start.y > im.pos().y) mask_start.y = im.pos().y; 
+                        if (mask_start.z > im.pos().z) mask_start.z = im.pos().z; 
+                }
+                ++im; 
+        }
+        
+        if (padding > 0) {
+                
+                pad_down(mask_start.x, padding); 
+                pad_down(mask_start.y, padding); 
+                pad_down(mask_start.z, padding);
+                
+                pad_up(mask_end.x, padding, mask.get_size().x); 
+                pad_up(mask_end.y, padding, mask.get_size().y); 
+                pad_up(mask_end.z, padding, mask.get_size().z);
+                
+        }
+        
+        std::cout << mask_start.x << " " << mask_start.y << " " << mask_start.z << " " 
+                  <<mask_end.x << " " << mask_end.y << " " << mask_end.z << "\n"; 
+        
+	return EXIT_SUCCESS;
+
+}
+
+#include <mia/internal/main.hh>
+MIA_MAIN(do_main)
diff --git a/src/3drigidreg.cc b/src/3drigidreg.cc
index 8a9ca13..51ead53 100644
--- a/src/3drigidreg.cc
+++ b/src/3drigidreg.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/src/3dsegment-ahmed.cc b/src/3dsegment-ahmed.cc
index 0a6853c..96b57e1 100644
--- a/src/3dsegment-ahmed.cc
+++ b/src/3dsegment-ahmed.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -63,7 +63,7 @@ const SProgramDescription g_description = {
 
 class CSegment3d  {
 public: 
-	typedef C3DImageVector result_type; 
+	typedef pair<P3DImage, C3DImageVector> result_type; 
 
 	CSegment3d(bool bg_correct, int ncc,
 		   const vector<float>& icc, float k); 
@@ -72,9 +72,9 @@ public:
 	CSegment3d::result_type operator()(const T3DImage<T>& image); 
 
 private: 
-	void process(const C3DFImage& image, 
-		     vector<float>& class_centers, 
-		     C3DFImageVec& prob)const; 
+	C3DFImage process(const C3DFImage& image, 
+			 vector<float>& class_centers, 
+			 C3DFImageVec& prob)const; 
 
 	float update_class_centers(C3DFImage& image, C3DFImageVec& prob, vector<float>& class_centers)const; 
 	
@@ -203,10 +203,7 @@ CSegment3d::result_type CSegment3d::operator()(const T3DImage<T>& image)
 		
 		// print out the new class centers
 	}
-	cvmsg() << " initial classes ["; 
-	for (size_t j = 0; j < _M_nClasses; ++j)
-		cvmsg() << _M_class_centers[j] << " "; 
-	cvmsg() << "]" << endl;
+	cvmsg() << " initial classes [" << _M_class_centers << "\n"; 
 	
 	C3DFImage log_image(image.get_size()); 	                                 // 4 Bpp
 	vector<float> log_class_centers(_M_nClasses); 
@@ -225,22 +222,35 @@ CSegment3d::result_type CSegment3d::operator()(const T3DImage<T>& image)
 	}
 
 	
-	process(log_image, log_class_centers, prob); 
+	auto b0_image = process(log_image, log_class_centers, prob); 
 	
 	
 	CExpTransform exptrans(minh, maxh); 
 	transform(log_class_centers.begin(), log_class_centers.end(), 
 		       _M_class_centers.begin(), exptrans); 
 
-	C3DImageVector result;  
+	P3DImage pb0_corrected; 
+	if ( _M_bg_correct ) {
+		T3DImage<T> *b0_corrected = new T3DImage<T>(image);
+		transform(b0_image.begin(), b0_image.end(), b0_corrected->begin(), 
+			  [&exptrans](float x){
+				  return mia_round_clamped<T>(exptrans(x)); 
+			  }); 
+		pb0_corrected.reset(b0_corrected); 
+	}
+		
+	transform(log_class_centers.begin(), log_class_centers.end(), 
+		       _M_class_centers.begin(), exptrans); 
+
+	C3DImageVector class_images;  
 
 	for (size_t j = 0; j < _M_nClasses; ++j) {
 		C3DFImage *r = new C3DFImage(image.get_size(), image); 
 		transform(prob[j].begin(), prob[j].end(), r->begin(), 
 			  [](float x){return sqrt(x);}); 
-		result.push_back(P3DImage(r)); 
+		class_images.push_back(P3DImage(r)); 
 	}
-	return result; 
+	return make_pair(pb0_corrected, class_images); 
 }
 		
 
@@ -267,7 +277,7 @@ void CSegment3d::evaluate_probabilities(C3DFImageVec& prob)const
 		else {// must be a bright value, otherwise, class[0] would catch it
 			for (size_t i = 0; i < _M_nClasses - 1; ++i)
 				*pi[i]++ = 0.0;
-			*pi[_M_nClasses - 1] = 1.0; 
+			*pi[_M_nClasses - 1]++ = 1.0; 
 		}
 	}
 }
@@ -327,8 +337,7 @@ float CSegment3d::update_class_centers(C3DFImage& image, C3DFImageVec& prob, vec
 
 
 
-void
-CSegment3d::process(const C3DFImage& image, 
+C3DFImage CSegment3d::process(const C3DFImage& image, 
 			 vector<float>& class_centers, 
 			 C3DFImageVec& prob)const
 {
@@ -340,13 +349,11 @@ CSegment3d::process(const C3DFImage& image,
 	C3DFImage tmp(image.get_size());                                        // 4Bpp
 
 	unique_ptr<C3DFImage> bg_image;
-
 	
 	if (_M_bg_correct) {
 		bg_image.reset(new C3DFImage(image.get_size())); 
 		fill(bg_image->begin(), bg_image->end(), 1.0); 
 	}
-
 	
 	float residuum = 100; 
 	// these conditions have to be exported 
@@ -381,7 +388,8 @@ CSegment3d::process(const C3DFImage& image,
 		evaluate_probabilities(prob);
 
 		if (_M_bg_correct)
-			transform(image.begin(), image.end(), bg_image->begin(), tmp.begin(), minus<float>()); 
+			transform(image.begin(), image.end(), bg_image->begin(), tmp.begin(), 
+				  [](float x, float y){return x * y;}); 
 		else
 			copy(image.begin(), image.end(), tmp.begin()); 
 		
@@ -390,8 +398,8 @@ CSegment3d::process(const C3DFImage& image,
 		// print out the new class centers
 		cvmsg() << n_iterations << ": classes ["; 
 		for (size_t j = 0; j < _M_nClasses; ++j)
-			cvmsg() << exptrans(class_centers[j]) << " "; 
-		cvmsg() << "]" << endl; 
+			cverb << exptrans(class_centers[j]) << " "; 
+		cverb << "]" << endl; 
 		
 		// update field correction 
 		// this certainly needs a methodological review
@@ -426,6 +434,7 @@ CSegment3d::process(const C3DFImage& image,
 		}// end update bg field
 
 	} // end main while loop
+	return tmp; 
 }
 
 int do_main(int argc, char *argv[])
@@ -433,7 +442,7 @@ int do_main(int argc, char *argv[])
 
 	string in_filename; 
 	string cls_filename; 
-	string out_filename; 
+	string bias_filename; 
 	int n_classes = 3; 
 	bool bg_correct = false; 
 	string neighborhood_filter; 
@@ -443,12 +452,20 @@ int do_main(int argc, char *argv[])
 	const auto& image3dio = C3DImageIOPluginHandler::instance();
 
 	CCmdOptionList opts(g_description);
+
+	opts.set_group("File-IO"); 
 	opts.add(make_opt( in_filename, "in-file", 'i', "image to be segmented", CCmdOptionFlags::required_input, &image3dio )); 
-	opts.add(make_opt( cls_filename, "out-file", 'o', "class probability images, the image type "
-			   "must support multiple images and floating point values", CCmdOptionFlags::required_output, &image3dio )); 
-	opts.add(make_opt( n_classes, "no-of-classes", 'a', "number of classes"));
-	opts.add(make_opt( bg_correct, "bias-correct", 'b', "apply bias field correction"));
-	opts.add(make_opt( initial_class_centres, "class-centres", 'c', "initial class centers"));
+	opts.add(make_opt( cls_filename, "class-file", 'c', "class probability images, the image type "
+			   "must support multiple images and floating point values", 
+			   CCmdOptionFlags::required_output, &image3dio )); 
+	opts.add(make_opt( bias_filename, "out-file", 'b', "Bias corrected image will be of the same type like "
+			   "the input image. If this parameter is not given, then the bias correction will not be applied.", 
+			   CCmdOptionFlags::output, &image3dio )); 
+		 
+	opts.set_group("Parameters"); 
+	opts.add(make_opt( n_classes, "no-of-classes", 'n', "number of classes"));
+	opts.add(make_opt( initial_class_centres, "class-centres", 'C', "initial class centers, this parameter overrides "
+			   "'no-of-clases'."));
 	opts.add(make_opt( spread, "spread", 's', "spread parameter describing the strength of mattar distinction")); 
 	
 	if (opts.parse(argc, argv) != CCmdOptionList::hr_no)
@@ -461,8 +478,11 @@ int do_main(int argc, char *argv[])
 			throw invalid_argument("at least two classes need to be requested"); 
 	}else {
 		cvdebug() << "Initially classes: " << initial_class_centres.size() << "\n"; 
+		n_classes = initial_class_centres.size(); 
 	}
 	
+	bg_correct = !bias_filename.empty(); 
+
 	// initialize the functor
 	CSegment3d Segment(bg_correct, n_classes, 
 			   initial_class_centres, spread);
@@ -470,15 +490,19 @@ int do_main(int argc, char *argv[])
 	
 	auto in_image = load_image3d(in_filename); 
 	
-	auto seg_list = mia::accumulate (Segment, *in_image);
-	C3DImageIOPluginHandler::Instance::Data out_image_list(seg_list);
+	auto result = mia::accumulate (Segment, *in_image);
+//	C3DImageIOPluginHandler::Instance::Data out_image_list(result.second);
 	
 	
-		//CHistory::instance().append(argv[0], revision, opts);
+	//CHistory::instance().append(argv[0], revision, opts);
 	
-	if ( !C3DImageIOPluginHandler::instance().save(cls_filename, seg_list) ){
-		string not_save = ("unable to save result to ") + cls_filename;
-		throw runtime_error(not_save);
+	if ( !image3dio.save(cls_filename, result.second) ) {
+		throw create_exception<runtime_error>("unable to save class images to '", cls_filename, "'");
+	}
+
+	if (!bias_filename.empty()) {
+		if (!save_image(bias_filename, result.first)) 
+			throw create_exception<runtime_error>("unable to save bias-corrected image '", bias_filename, "'");
 	}
 	
 	return EXIT_SUCCESS; 
diff --git a/src/3dserial-nonrigid.cc b/src/3dserial-nonrigid.cc
index 1f73f6f..be623d3 100644
--- a/src/3dserial-nonrigid.cc
+++ b/src/3dserial-nonrigid.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/src/3dseries-track-intensity.cc b/src/3dseries-track-intensity.cc
index 481fa44..91e3ecb 100644
--- a/src/3dseries-track-intensity.cc
+++ b/src/3dseries-track-intensity.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/src/3dtrackpixelmovement.cc b/src/3dtrackpixelmovement.cc
index 34e1225..18e7602 100644
--- a/src/3dtrackpixelmovement.cc
+++ b/src/3dtrackpixelmovement.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/src/3dtransform.cc b/src/3dtransform.cc
index 6a596e5..7dbc7dd 100644
--- a/src/3dtransform.cc
+++ b/src/3dtransform.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/src/3dtransform2vf.cc b/src/3dtransform2vf.cc
index b698310..e4a3e45 100644
--- a/src/3dtransform2vf.cc
+++ b/src/3dtransform2vf.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/src/3dvectorfieldcreate.cc b/src/3dvectorfieldcreate.cc
index d9c7f64..d578050 100644
--- a/src/3dvectorfieldcreate.cc
+++ b/src/3dvectorfieldcreate.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/src/3dvf2transform.cc b/src/3dvf2transform.cc
index 05de739..e2161c9 100644
--- a/src/3dvf2transform.cc
+++ b/src/3dvf2transform.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/src/3dvfcompare.cc b/src/3dvfcompare.cc
index 2ac9a05..9d2b9ee 100644
--- a/src/3dvfcompare.cc
+++ b/src/3dvfcompare.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index b36b275..31c229e 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1,6 +1,6 @@
 #
 # This file is part of MIA - a toolbox for medical image analysis 
-# Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+# 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
@@ -116,6 +116,8 @@ DEFEXE(2dtrackpixelmovement mia2d )
 
 DEFCHKEXE(3dlerp mia3d )
 
+DEFEXE(2dstack-cmeans-presegment  mia3d )
+
 DEFEXE(2dmultiimageto3d   mia3d )
 DEFEXE(3dimagestats       mia3d )
 DEFEXE(3dcost             mia3d )
@@ -124,6 +126,7 @@ DEFEXE(3dimagefilter      mia3d )
 DEFEXE(3dimagecombine     mia3d )
 DEFEXE(3dimagecreator     mia3d )
 DEFEXE(3dimagefilterstack mia3d )
+DEFEXE(2dimagestack-cmeans mia3d )
 DEFEXE(raw2volume         mia3d )
 DEFEXE(3dcrispsegment     mia3d )
 DEFEXE(3ddeform           mia3d )
@@ -158,6 +161,9 @@ DEFEXE(3deval-transformquantity mia3d)
 DEFEXE(3dcost-translatedgrad mia3d)
 DEFEXE(3dsegment-ahmed    mia3d)
 DEFEXE(3dcombine-mr-segmentations mia3d)
+DEFEXE(3dcombine-imageseries mia3d)
+DEFEXE(3dpropose-boundingbox mia3d)
+DEFEXE(3dimagestatistics-in-mask mia3d)
 
 DEFEXE(3dlandmarks-transform mia3d)
 DEFEXE(3dlandmarks-distances mia3d)
@@ -165,6 +171,8 @@ DEFEXE(3dlandmarks-distances mia3d)
 DEFEXE(plugin-help miamesh )
 DEFEXE(meshdistance-to-stackmask miamesh )
 DEFEXE(meshfilter miamesh )
+DEFEXE(mesh-deformable-model miamesh )
+DEFEXE(mesh-to-maskimage  miamesh)
 
 ADD_EXECUTABLE(mia-test-plugins-as-installed test_plugins_as_installed.cc)  
 TARGET_LINK_LIBRARIES(mia-test-plugins-as-installed miamesh)
diff --git a/src/cmeans.cc b/src/cmeans.cc
index 02851d8..29e3cbe 100644
--- a/src/cmeans.cc
+++ b/src/cmeans.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/src/distance-mesh2mask.cc b/src/distance-mesh2mask.cc
index dd5d29b..c68e3e9 100644
--- a/src/distance-mesh2mask.cc
+++ b/src/distance-mesh2mask.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/src/filenumberpattern.cc b/src/filenumberpattern.cc
index 3f41e00..ca1bafc 100644
--- a/src/filenumberpattern.cc
+++ b/src/filenumberpattern.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/src/fluid2d/CMakeLists.txt b/src/fluid2d/CMakeLists.txt
index e482e4f..e4962d8 100644
--- a/src/fluid2d/CMakeLists.txt
+++ b/src/fluid2d/CMakeLists.txt
@@ -1,6 +1,6 @@
 #
 # This file is part of MIA - a toolbox for medical image analysis 
-# Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+# 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
diff --git a/src/fluid2d/NR2DMatrix.hh b/src/fluid2d/NR2DMatrix.hh
index f39cab8..858a14f 100644
--- a/src/fluid2d/NR2DMatrix.hh
+++ b/src/fluid2d/NR2DMatrix.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/src/fluid2d/Pixel.hh b/src/fluid2d/Pixel.hh
index 007e031..edba83b 100644
--- a/src/fluid2d/Pixel.hh
+++ b/src/fluid2d/Pixel.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/src/fluid2d/elast.cc b/src/fluid2d/elast.cc
index 382ba60..77556a4 100644
--- a/src/fluid2d/elast.cc
+++ b/src/fluid2d/elast.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/src/fluid2d/elast.hh b/src/fluid2d/elast.hh
index 793f1e5..6e709ee 100644
--- a/src/fluid2d/elast.hh
+++ b/src/fluid2d/elast.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/src/fluid2d/helpers.cc b/src/fluid2d/helpers.cc
index 5e1ac7a..02a7836 100644
--- a/src/fluid2d/helpers.cc
+++ b/src/fluid2d/helpers.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/src/fluid2d/helpers.hh b/src/fluid2d/helpers.hh
index b1bd0c8..1b10fb8 100644
--- a/src/fluid2d/helpers.hh
+++ b/src/fluid2d/helpers.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/src/fluid2d/main.cc b/src/fluid2d/main.cc
index 05d0001..e21c3a4 100644
--- a/src/fluid2d/main.cc
+++ b/src/fluid2d/main.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/src/fluid2d/types.hh b/src/fluid2d/types.hh
index c4e5784..a6c752a 100644
--- a/src/fluid2d/types.hh
+++ b/src/fluid2d/types.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/src/fluid2d/vfluid.cc b/src/fluid2d/vfluid.cc
index f5af17e..7ff25de 100644
--- a/src/fluid2d/vfluid.cc
+++ b/src/fluid2d/vfluid.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/src/fluid2d/vfluid.hh b/src/fluid2d/vfluid.hh
index 52f828f..cc8ebd2 100644
--- a/src/fluid2d/vfluid.hh
+++ b/src/fluid2d/vfluid.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/src/fluid3d/CMakeLists.txt b/src/fluid3d/CMakeLists.txt
index 4a1eb46..cfee179 100644
--- a/src/fluid3d/CMakeLists.txt
+++ b/src/fluid3d/CMakeLists.txt
@@ -1,6 +1,6 @@
 #
 # This file is part of MIA - a toolbox for medical image analysis 
-# Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+# 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
diff --git a/src/fluid3d/eqn_solver.cc b/src/fluid3d/eqn_solver.cc
index 10a239e..6981074 100644
--- a/src/fluid3d/eqn_solver.cc
+++ b/src/fluid3d/eqn_solver.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/src/fluid3d/eqn_solver.hh b/src/fluid3d/eqn_solver.hh
index 22c8968..0e0233c 100644
--- a/src/fluid3d/eqn_solver.hh
+++ b/src/fluid3d/eqn_solver.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/src/fluid3d/main.cc b/src/fluid3d/main.cc
index bb853d2..163237f 100644
--- a/src/fluid3d/main.cc
+++ b/src/fluid3d/main.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/src/fluid3d/sor_solver.cc b/src/fluid3d/sor_solver.cc
index d3a696c..22218ea 100644
--- a/src/fluid3d/sor_solver.cc
+++ b/src/fluid3d/sor_solver.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/src/fluid3d/sor_solver.hh b/src/fluid3d/sor_solver.hh
index 79890c4..62dcd5e 100644
--- a/src/fluid3d/sor_solver.hh
+++ b/src/fluid3d/sor_solver.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/src/fluid3d/typedefs.hh b/src/fluid3d/typedefs.hh
index 7c6b8ae..9573858 100644
--- a/src/fluid3d/typedefs.hh
+++ b/src/fluid3d/typedefs.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/src/fluid3d/vfluid.cc b/src/fluid3d/vfluid.cc
index 6ad1a15..e01ce8f 100644
--- a/src/fluid3d/vfluid.cc
+++ b/src/fluid3d/vfluid.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/src/fluid3d/vfluid.hh b/src/fluid3d/vfluid.hh
index 8260997..853e742 100644
--- a/src/fluid3d/vfluid.hh
+++ b/src/fluid3d/vfluid.hh
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/src/isosurface/CMakeLists.txt b/src/isosurface/CMakeLists.txt
index 6818aa2..de416b2 100644
--- a/src/isosurface/CMakeLists.txt
+++ b/src/isosurface/CMakeLists.txt
@@ -1,6 +1,6 @@
 #
 # This file is part of MIA - a toolbox for medical image analysis 
-# Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+# 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
diff --git a/src/isosurface/iso.cc b/src/isosurface/iso.cc
index 6f32185..c24040b 100644
--- a/src/isosurface/iso.cc
+++ b/src/isosurface/iso.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -72,8 +72,8 @@ int do_main (int argc, char * argv[])
 
 	CCmdOptionList options(g_description);
 	options.set_group("File-IO"); 
-	options.add(make_opt(  in_filename, "in-image", 'i', "input image", CCmdOptionFlags::required_input, &imageio )); 
-	options.add(make_opt(  out_filename, "out-image", 'o', "output mesh", CCmdOptionFlags::required_output, &meshio )); 
+	options.add(make_opt(  in_filename, "in-file", 'i', "input image", CCmdOptionFlags::required_input, &imageio )); 
+	options.add(make_opt(  out_filename, "out-file", 'o', "output mesh", CCmdOptionFlags::required_output, &meshio )); 
 
 	options.set_group("Image options"); 
 	options.add(make_opt(  iso_value, "iso-value", 's', "iso-value of iso surface to be extracted")); 
diff --git a/src/isosurface/iso_backend.cc b/src/isosurface/iso_backend.cc
index 596a221..f91c040 100644
--- a/src/isosurface/iso_backend.cc
+++ b/src/isosurface/iso_backend.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/src/isosurface/iso_from_slices.cc b/src/isosurface/iso_from_slices.cc
index 6732d07..8772b56 100644
--- a/src/isosurface/iso_from_slices.cc
+++ b/src/isosurface/iso_from_slices.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/src/isosurface/mesh_convert.cc b/src/isosurface/mesh_convert.cc
index 1957c37..c08e10a 100644
--- a/src/isosurface/mesh_convert.cc
+++ b/src/isosurface/mesh_convert.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/src/labelsort.cc b/src/labelsort.cc
index 706785d..f52a98e 100644
--- a/src/labelsort.cc
+++ b/src/labelsort.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/src/mesh-deformable-model.cc b/src/mesh-deformable-model.cc
new file mode 100644
index 0000000..55f6448
--- /dev/null
+++ b/src/mesh-deformable-model.cc
@@ -0,0 +1,296 @@
+/* -*- mia-c++  -*-
+ *
+ * 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 MIA; if not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <mia/core.hh>
+#include <mia/mesh/triangularMesh.hh>
+#include <mia/3d/imageio.hh>
+#include <mia/3d/filter.hh>
+#include <mia/3d/interpolator.hh>
+#include <mia/internal/main.hh>
+
+#include <mia/core/threadedmsg.hh>
+#include <mia/core/nccsum.hh>
+#include <tbb/parallel_reduce.h>
+#include <tbb/blocked_range.h>
+
+NS_MIA_USE;
+using namespace std;
+
+
+const SProgramDescription g_general_help = {
+        {pdi_group, "Creation, analysis, and filtering of triangular 3D meshes"}, 
+	{pdi_short, "Fit a mesh by using a deformable model."}, 
+	{pdi_description, "This program runs a deformable model to adapt a mesh to an iso-value "
+	 "within a given image. <FIXME: Reference>"}, 
+	{pdi_example_descr, "Run the deforemable model on input.vmesh with 200 iterations adapting to a value of 128 "
+         "in the image ref.v and save the result to deformed.vmesh"}, 
+	{pdi_example_code, "-i input.vmesh -o deformed.vmesh --iso 128 --maxiter 200"}
+}; 
+
+class DeformableModel {
+public: 
+        DeformableModel(); 
+
+        void add_options(CCmdOptionList& options); 
+        
+        PTriangleMesh run(const CTriangleMesh& mesh, const C3DFImage& reference);
+
+private: 
+
+        typedef set<unsigned int> CNeighbors; 
+        struct SLocation {
+                SLocation(CTriangleMesh::normal_type& n):m_normal(&n){}; 
+                SLocation(const SLocation& other) = default; 
+                SLocation():m_normal(nullptr){}
+                
+                const CTriangleMesh::normal_type& normal()const {return *m_normal;}
+                CTriangleMesh::normal_type *m_normal; 
+                CNeighbors vertices; 
+
+        };
+
+        typedef vector<SLocation> CModel; 
+
+        CModel prepare_model(CTriangleMesh& mesh); 
+
+        float m_iso_value; 
+        float m_smoothing_weight;  
+        float m_gradient_weight; 
+        float m_intensity_weight; 
+        float m_intensity_scaling; 
+        unsigned m_maxiter; 
+        float m_epsilon; 
+	bool m_reorient_mesh; 
+}; 
+
+DeformableModel::DeformableModel():
+        m_iso_value(64.0f), 
+        m_smoothing_weight(.04f),  
+        m_gradient_weight(.04f), 
+        m_intensity_weight(.02f), 
+        m_intensity_scaling(1.0f),
+        m_maxiter(200),
+        m_epsilon(0.001f), 
+	m_reorient_mesh(false)
+{
+}
+
+
+void DeformableModel::add_options(CCmdOptionList& options)
+{
+        options.set_group("Model parameters"); 
+        options.add(make_opt(m_smoothing_weight, EParameterBounds::bf_min_closed, {0}, "smoothing-weight", 0,
+                             "Weight of the inner force used to smooth the mesh"));
+        options.add(make_opt(m_gradient_weight, "gradient-weight", 0, "Weight of the gradient force drive the mesh deformation. "
+                             "Use a negative value to invert the search direction.")); 
+        options.add(make_opt(m_intensity_weight, EParameterBounds::bf_min_closed, {0}, 
+                             "intensity-weight", 0, "Weight of the force resulting from the intensity difference "
+                             "at the vertex position versus the reference intensity 'iso'.")); 
+        options.add(make_opt(m_intensity_scaling, EParameterBounds::bf_min_open, {0}, "intensity-scaling", 0, 
+                             "Scaling of the raw intensity difference."));
+        options.add(make_opt(m_iso_value, "iso", 's', "Intensity value the mesh verices should adapt to.")); 
+
+       
+        options.set_group("Processing"); 
+        options.add(make_opt(m_maxiter, EParameterBounds::bf_min_open, {0}, "maxiter", 'm', 
+                             "Maximum number of iterations."));
+        options.add(make_opt(m_epsilon, EParameterBounds::bf_min_open, {0}, "epsilon", 'e', 
+                             "Stop iteration when the maximum shift of the vertices falls below this value")); 
+	options.add(make_opt(m_reorient_mesh, "reorient", 0, "Reorientate the mesh triangles")); 
+}
+
+PTriangleMesh DeformableModel::run(const CTriangleMesh& mesh, const C3DFImage& reference)
+{
+
+	C3DInterpolatorFactory ipf("bspline:d=1", "zero");
+	
+        unique_ptr<T3DConvoluteInterpolator<float>> R(ipf.create(reference.data())); 
+        const auto gradient = get_gradient(reference);
+
+
+        PTriangleMesh result(new CTriangleMesh(mesh)); 
+	if (m_reorient_mesh) {
+		for_each(result->triangles_begin(), result->triangles_end(), 
+			  [](CTriangleMesh::triangle_type& t) {swap(t.x, t.y);}); 
+	}
+
+        result->evaluate_normals();
+        
+        CModel model = prepare_model(*result); 
+        
+        float max_shift = numeric_limits<float>::max(); 
+        unsigned  iter = 0; 
+
+        vector<C3DFVector> out_vertex(model.size()); 
+
+	typedef pair<float, float> result_t; 
+	
+	auto apply =[this, &out_vertex, &result, &model, &gradient, &R]
+		(const tbb::blocked_range<size_t>& range, result_t res) -> result_t {
+		CThreadMsgStream msks; 
+		for (auto i = range.begin(); i != range.end(); ++i) {
+			auto& vertex = result->vertex_at(i); 
+			const auto& n = model[i].normal(); 
+			
+			// values for external forces
+			float iso_delta = (m_iso_value - (*R)(vertex))/m_intensity_scaling; 
+			
+			float grad_scale =  dot(gradient(vertex), n);
+			float f3 = tanh( iso_delta );
+			float f2 = grad_scale * f3 / 100.0;
+			float f1 = m_gradient_weight * f2 + m_intensity_weight * f3;
+			
+                        C3DFVector shift = f1 * n; 
+                        
+                        // evaluate internal force 
+			C3DFVector center = C3DFVector::_0; 
+			
+                        int n_neightbors = model[i].vertices.size(); 
+                        if ( n_neightbors > 0) {
+				
+                                for (auto iv : model[i].vertices)
+                                        center += result->vertex_at(iv); 
+                                
+				center /= n_neightbors; 
+                                shift += m_smoothing_weight * (center - vertex); 
+			}
+                        
+			res.first += iso_delta > 0 ? iso_delta : -iso_delta;
+			
+			out_vertex[i] = vertex + shift; 
+			
+			float snorm = shift.norm();
+			
+			if (res.second < snorm)
+				res.second = snorm;
+		}
+		return res; 
+	}; 
+        
+        while (iter++ < m_maxiter && max_shift > m_epsilon) {
+                
+		result_t r{0.0f, 0.0f}; 
+
+		
+		r = parallel_reduce(tbb::blocked_range<size_t>(0, model.size(), model.size() / 1000 ), r, apply, 
+				[](const result_t& a, const result_t& b) -> result_t {
+					result_t r; 
+					r.first = a.first + b.first; 
+					r.second = a.second > b.second ? a.second : b.second; 
+					return r; 
+				});
+                
+                copy(out_vertex.begin(), out_vertex.end(), result->vertices_begin()); 
+		result->evaluate_normals();
+                
+		cvmsg() << "[" << iter << "]: distance = " 
+                        << r.first << "; max shift = " 
+                        << r.second << "\n"; 
+		max_shift = r.second; 
+	}
+	cvmsg() << endl; 
+        return result; 
+}
+
+DeformableModel::CModel DeformableModel::prepare_model(CTriangleMesh& mesh)
+{
+	CModel model(mesh.vertices_size()); 
+        
+	CTriangleMesh::normal_iterator nb = mesh.normals_begin();
+
+        for (size_t i = 0; i < mesh.vertices_size(); ++i, ++nb) {
+                model[i] = SLocation(*nb); 
+        }
+	
+	CTriangleMesh::triangle_iterator tb = mesh.triangles_begin();
+	CTriangleMesh::triangle_iterator te = mesh.triangles_end();
+	
+	while (tb != te) {
+		SLocation& nx = model[tb->x];
+		nx.vertices.insert(tb->x); 
+		nx.vertices.insert(tb->y); 
+		nx.vertices.insert(tb->z);
+		
+		SLocation& ny = model[tb->y];
+ 		ny.vertices.insert(tb->x); 
+ 		ny.vertices.insert(tb->y); 
+		ny.vertices.insert(tb->z);
+
+                SLocation& nz = model[tb->z];
+		nz.vertices.insert(tb->x); 
+ 		nz.vertices.insert(tb->y); 
+		nz.vertices.insert(tb->z);
+		
+		++tb; 
+	}
+        return model; 
+}
+
+int do_main( int argc, char *argv[] )
+{
+
+	string in_filename;
+	string out_filename;
+        string ref_filename;
+        
+        DeformableModel model; 
+
+        P3DFilter smoothing; 
+        
+	const auto& meshio = CMeshIOPluginHandler::instance(); 
+	const auto& imgio = C3DImageIOPluginHandler::instance(); 
+
+	CCmdOptionList options(g_general_help);
+        options.set_group("File I/O"); 
+	options.add(make_opt( in_filename, "in-file", 'i', "input mesh to be adapted", 
+                              CCmdOptionFlags::required_input, &meshio));
+	options.add(make_opt( out_filename, "out-file", 'o', "output mesh that has been deformed", 
+                              CCmdOptionFlags::required_output, &meshio));
+        options.add(make_opt( ref_filename, "ref-file", 'r', "reference image", 
+                              CCmdOptionFlags::required_input, &imgio));
+
+        model.add_options(options); 
+
+        options.set_group("Preprocessing"); 
+        options.add(make_opt(smoothing, "gauss:w=2", "image-smoothing", 0, 
+                             "Prefilter to smooth the reference image."));
+        
+        if (options.parse(argc, argv) != CCmdOptionList::hr_no)
+		return EXIT_SUCCESS; 
+
+
+        auto mesh = meshio.load(in_filename); 
+	if (!mesh) 
+		throw create_exception<invalid_argument>( "No mesh found in '", in_filename, "'"); 
+        
+        auto ref = load_image3d(ref_filename); 
+        ref = run_filters(ref, "convert:map=copy,repn=float", smoothing); 
+        const C3DFImage& reference = dynamic_cast<const C3DFImage&>(*ref); 
+        
+        auto deformed = model.run(*mesh,  reference);
+        
+        if ( !meshio.save(out_filename, *deformed) )
+		throw create_exception<runtime_error>( "Unable to save result to '", out_filename, "'");
+        
+	return EXIT_SUCCESS;
+
+}
+
+MIA_MAIN(do_main); 
diff --git a/src/mesh-to-maskimage.cc b/src/mesh-to-maskimage.cc
new file mode 100644
index 0000000..f24debc
--- /dev/null
+++ b/src/mesh-to-maskimage.cc
@@ -0,0 +1,121 @@
+/* -*- mia-c++  -*-
+ *
+ * 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 MIA; if not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <mia/core.hh>
+#include <mia/internal/main.hh>
+#include <mia/mesh/triangularMesh.hh>
+#include <mia/3d/imageio.hh>
+#include <mia/3d/imagedraw.hh>
+
+NS_MIA_USE;
+using namespace std;
+
+
+const SProgramDescription g_general_help = {
+        {pdi_group, "Creation, analysis, and filtering of triangular 3D meshes"}, 
+	{pdi_short, "Create a binary mask from the mesh surfac."}, 
+	{pdi_description, "This program converts a 3D mesh into a binary mask comprising the mesh surface. "
+         "The output image size is either given on the command line or deducted from the mesh dimensions."}, 
+	{pdi_example_descr, "The input mesh input.vmesh is converted into the binary mask mask.v. "
+         "The image size is set to 50,50,50 and the size is obtained automatically to include the whole mesh"}, 
+	{pdi_example_code, "-i input.vmesh -o mask.v --origin 0,0,0"}
+}; 
+
+
+
+
+
+int do_main( int argc, char *argv[] )
+{
+
+	string in_filename;
+	string out_filename;
+        C3DFVector origin = C3DFVector::_0; 
+        C3DFVector spacing = C3DFVector::_1;
+        C3DBounds size = C3DBounds::_0; 
+
+	const auto& meshio = CMeshIOPluginHandler::instance(); 
+	const auto& imgio = C3DImageIOPluginHandler::instance(); 
+
+
+        CCmdOptionList options(g_general_help);
+        options.set_group("File I/O"); 
+	options.add(make_opt( in_filename, "in-file", 'i', "input mesh to be adapted", 
+                              CCmdOptionFlags::required_input, &meshio));
+	options.add(make_opt( out_filename, "out-file", 'o', "output image containing the binary mask", 
+                              CCmdOptionFlags::required_output, &imgio));
+
+        options.set_group("Properties"); 
+        
+        options.add(make_opt(origin, "origin", 0, "coordinate of pixel at index 0,0,0"));
+        options.add(make_opt(spacing, "spacing", 0, "voxel spacing in the output image, all values must be positive."));
+        options.add(make_opt(size, "size", 0, "size of the output image (0,0,0 = deduct)"));
+        
+                
+        if (options.parse(argc, argv) != CCmdOptionList::hr_no)
+		return EXIT_SUCCESS; 
+        
+        auto mesh = meshio.load(in_filename); 
+	if (!mesh) 
+		throw create_exception<invalid_argument>( "No mesh found in '", in_filename, "'"); 
+
+        if (spacing.x <= 0.0f || spacing.y <= 0.0f || spacing.z <= 0.0f) 
+                throw create_exception<invalid_argument>("Voxel spacing must  be positive, but you gave ", spacing); 
+
+	
+
+
+        if (size == C3DBounds::_0) {
+                // evaluate required output size i.e. find larest vertex coordinates and their 
+                // distance from the origin, and multipyl this with the spacing. 
+                C3DFVector d = origin; 
+                for_each(mesh->vertices_begin(), mesh->vertices_end(), [&origin, &d](const C3DFVector v) {
+                                if (d.x < v.x) d.x = v.x; 
+                                if (d.z < v.z) d.z = v.z; 
+                                if (d.y < v.y) d.y = v.y; 
+                        }); 
+                d *= spacing; 
+                d.x = ceil(d.x); 
+                d.y = ceil(d.y); 
+                d.z = ceil(d.z); 
+                
+                size = C3DBounds(d) + C3DBounds::_1;
+        }
+        
+        C3DBitImageDrawTarget output(size, origin, spacing);
+	
+	typedef CTriangleMesh::triangle_type CTriangle; 
+
+	for_each(mesh->triangles_begin(), mesh->triangles_end(), 
+		 [&output, &mesh](const CTriangle& t) {
+			 cvdebug() << "Prepare triangle " << t << "\n"; 
+			 output.draw_triangle(mesh->vertex_at(t.x), 
+					      mesh->vertex_at(t.y), 
+					      mesh->vertex_at(t.z));});
+	
+	auto image = output.get_image(); 
+	save_image(out_filename, image); 
+        
+	return EXIT_SUCCESS;
+
+}
+
+MIA_MAIN(do_main); 
+
diff --git a/src/meshdistance-to-stackmask.cc b/src/meshdistance-to-stackmask.cc
index 420d9f4..0a9d3a9 100644
--- a/src/meshdistance-to-stackmask.cc
+++ b/src/meshdistance-to-stackmask.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/src/meshfilter.cc b/src/meshfilter.cc
index 4aaa6fa..59bc833 100644
--- a/src/meshfilter.cc
+++ b/src/meshfilter.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/src/multihist.cc b/src/multihist.cc
index 3c5f34a..1dad1af 100644
--- a/src/multihist.cc
+++ b/src/multihist.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -44,7 +44,72 @@ const SProgramDescription g_description = {
 	{pdi_example_code, "-i input0000.exr -o histo.txt --min 0 --max 256 --bins 64"}
 }; 
 
+class CAutoHistogramAccumulator : public TFilter<bool> {
+public: 
+	template <typename T>
+	bool operator () (const T2DImage<T>& image) {
+		for(auto i = image.begin(); i != image.end(); ++i) {
+			auto slot = m_hist.find(*i);
+			if (slot == m_hist.end()) {
+				m_hist[*i] = 1; 
+			}else{
+				++m_hist[*i];
+			}
+		}
+		return true;
+	}
+
+	bool save(const string& fname)const
+	{
+		ofstream file(fname.c_str());
+		for (auto ih :m_hist) {
+			file << ih.first << " " << ih.second << "\n";
+		}
+		return file.good();
+	}
+
+	int propose_threshold()const {
+		assert(!m_hist.empty());
+		
+		float min_val = m_hist.begin()->first; 
+		float max_val = m_hist.rbegin()->first; 
+
+		float down_start_search = (max_val - min_val) / 10 + min_val; 
+		float up_end_search = (max_val - min_val) / 6 + min_val; 
+
+		auto i = m_hist.begin(); 
+		
+		while (i->first < down_start_search) 
+			++i; 
+		
+		auto val = i->second;
+		
+		auto pos = i; 
+		while (i !=  m_hist.begin()) {
+			if (val > i->second) {
+				val = i->second; 
+				pos = i; 
+			}
+			--i; 
+		}
+		
+		while (i->first < up_end_search) {
+			if (val > i->second) {
+				val = i->second; 
+				pos = i; 
+			}
+			++i; 
+		}
+		
+		return pos->first; 
+	}
+	
+private: 
+	map<float, size_t> m_hist; 
+}; 
+
 class CHistAccumulator : public TFilter<bool> {
+
 public:
 	CHistAccumulator(float min, float max, size_t bins):
 		m_histo(THistogramFeeder<float>(min, max, bins)), 
@@ -119,7 +184,9 @@ int do_main( int argc, char *argv[] )
 			      CCmdOptionFlags::required_output));
 	options.add(make_opt( hmin, "min", 0, "minimum of histogram range"));
 	options.add(make_opt( hmax, "max", 0, "maximum of histogram range"));
-	options.add(make_opt( bins, "bins", 0, "number of histogram bins"));
+	options.add(make_opt( bins, "bins", 0, "number of histogram bins, set to zero to create a bin for "
+			      "each intensity value availabe in the input data. In this case the histogram "
+			      "range is also evaluated automatically"));
 		
 	if (options.parse(argc, argv) != CCmdOptionList::hr_no)
 		return EXIT_SUCCESS; 
@@ -136,27 +203,45 @@ int do_main( int argc, char *argv[] )
 	if (start_filenum >= end_filenum)
 		throw invalid_argument(string("no files match pattern ") + src_basename);
 
-
-	CHistAccumulator histo_accu(hmin, hmax, bins);
-	for (size_t i = start_filenum; i < end_filenum; ++i) {
-		string src_name = create_filename(src_basename.c_str(), i);
-		C2DImageIOPluginHandler::Instance::PData  in_image_list = imageio.load(src_name);
-		cvmsg() << "Read:" << src_name << "\r";
-		if (in_image_list.get() && in_image_list->size()) {
-			for (auto k = in_image_list->begin(); k != in_image_list->end(); ++k)
-				accumulate(histo_accu, **k);
+	if (bins > 0) {
+		CHistAccumulator histo_accu(hmin, hmax, bins);
+		for (size_t i = start_filenum; i < end_filenum; ++i) {
+			string src_name = create_filename(src_basename.c_str(), i);
+			C2DImageIOPluginHandler::Instance::PData  in_image_list = imageio.load(src_name);
+			cvmsg() << "Read:" << src_name << "\r";
+			if (in_image_list.get() && in_image_list->size()) {
+				for (auto k = in_image_list->begin(); k != in_image_list->end(); ++k)
+					accumulate(histo_accu, **k);
+			}
 		}
-	}
-	cvmsg() << "\n";
+		cvmsg() << "\n";
 		
-	histo_accu.resize(); 
+		histo_accu.resize(); 
 		
-	if (!histo_accu.save(out_filename))
-		throw runtime_error(string("Error writing output file:") + out_filename);
+		if (!histo_accu.save(out_filename))
+			throw runtime_error(string("Error writing output file:") + out_filename);
+		cout << histo_accu.propose_threshold(); 
 		
+	}else{
+		CAutoHistogramAccumulator histo; 
+		for (size_t i = start_filenum; i < end_filenum; ++i) {
+			string src_name = create_filename(src_basename.c_str(), i);
+			C2DImageIOPluginHandler::Instance::PData  in_image_list = imageio.load(src_name);
+			cvmsg() << "Read:" << src_name << "\r";
+			if (in_image_list.get() && in_image_list->size()) {
+				for (auto k = in_image_list->begin(); k != in_image_list->end(); ++k)
+					accumulate(histo, **k);
+			}
+		}
+		cvmsg() << "\n";
 		
-
-	cout << histo_accu.propose_threshold(); 
+		
+		if (!histo.save(out_filename))
+			throw runtime_error(string("Error writing output file:") + out_filename);
+		
+		cout << histo.propose_threshold(); 
+	}
+	
 	return EXIT_SUCCESS;
 
 }
diff --git a/src/multiimage-cmeans.cc b/src/multiimage-cmeans.cc
new file mode 100644
index 0000000..02a2998
--- /dev/null
+++ b/src/multiimage-cmeans.cc
@@ -0,0 +1,90 @@
+/* -*- mia-c++  -*-
+ *
+ * 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 MIA; if not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdexcept>
+#include <cmath>
+#include <cassert>
+#include <numeric>
+#include <fstream>
+
+
+#include <mia/core/msgstream.hh>
+#include <mia/core/cmdlineparser.hh>
+
+
+const SProgramDescription g_description = {
+	{pdi_group,"Processing of series of 2D images in a 3D fashion (out-of-core)"}, 
+	{pdi_short,"C-means of intensities of an image series."}, 
+	{pdi_description, "This programs reads a series of images and does a c-means "
+         "classification of the intensities. The output is a map from intensity ranges"
+         " to the class probabilities like follows:\n"
+         "  min max prob1 prob2 prob3 ...\n"}, 
+	{pdi_example_descr, "Read al images from the series imageXXXX.exr, classify into 3 classes, "
+         "and save the result into probmap.txt."}, 
+	{pdi_example_code, "-i image0000.exr -o probmap.txt --classes 3"}
+}; 
+
+
+class CMeansParameterTranslater : public CValueTranslator {
+        
+}; 
+
+int do_main(int argc, char *argv[])
+{
+	string in_filename;
+        string out_filename;
+
+        unsigned nclasses = 0; 
+        unsigned max_iter = 100; 
+        
+        string class_centers = "even"; 
+        
+
+        const C2DImageIOPluginHandler::Instance& imageio = C2DImageIOPluginHandler::instance();
+        CCmdOptionList options(g_description);
+        
+	options.set_group("File-IO"); 
+        options.add(make_opt( in_filename, "in-file", 'i', "input image(s) to be read from",
+                              CCmdOptionFlags::required_input, &imageio));
+        options.add(make_opt( in_filename, "out-file", 'o', "output map to write the class probability map to",
+                              CCmdOptionFlags::required_input, &imageio));
+        
+        
+        options.add(make_opt( nclasses, "nclasses", 'n', "number of classes to partition into")); 
+	options.add(make_opt( max_iter, "max-iter", 'm', "maximum number of iterations")); 
+	options.add(make_opt( class_centers, "class-centers", 'c', "initial class centers")); 
+
+        
+        
+        
+
+}
+
+
+#include <mia/internal/main.hh>
+MIA_MAIN(do_main); 
+
+
+
+
diff --git a/src/myowavelettest.cc b/src/myowavelettest.cc
index 5cb8a1d..dc91712 100644
--- a/src/myowavelettest.cc
+++ b/src/myowavelettest.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/src/plugin-help.cc b/src/plugin-help.cc
index 9cc3a07..8693b15 100644
--- a/src/plugin-help.cc
+++ b/src/plugin-help.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/src/raw2image.cc b/src/raw2image.cc
index 15563a3..a337ba3 100644
--- a/src/raw2image.cc
+++ b/src/raw2image.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/src/raw2volume.cc b/src/raw2volume.cc
index 9a0b1ff..95deaf0 100644
--- a/src/raw2volume.cc
+++ b/src/raw2volume.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/src/test_plugins_as_installed.cc b/src/test_plugins_as_installed.cc
index c022c0b..bbaf29c 100644
--- a/src/test_plugins_as_installed.cc
+++ b/src/test_plugins_as_installed.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
@@ -35,7 +35,7 @@ struct PluginTestFixture {
 
 BOOST_FIXTURE_TEST_CASE(test_C3DFullCostPluginHandler,PluginTestFixture) 
 { 
-	set<string> test_data = { "image", "maskedimage", "taggedssd"}; 
+	set<string> test_data = { "image", "maskedimage", "taggedssd", "labelimage"}; 
 
 	test(C3DFullCostPluginHandler::instance().get_set(), test_data); 
 }
@@ -51,7 +51,7 @@ BOOST_FIXTURE_TEST_CASE(test_C3DFilterPluginHandler,PluginTestFixture)
 	set<string> test_data = {
 		"binarize", "bandpass", "combiner", "convert","close", "crop", "dilate", "distance", "downscale", 
 		"erode", "gauss", "gradnorm", "growmask", "invert", "isovoxel", "kmeans",  
-		"label", "load", "lvdownscale", "mask", "mean", "median", "mlv", "msnormalizer", "open",  "resize",
+		"label", "labelmap", "labelscale", "load", "lvdownscale", "mask", "mean", "median", "mlv", "msnormalizer", "open",  "resize", "reorient", 
 		"sandp", "scale", "selectbig", "sepconv", "sws", "tee", "thinning", 
 		"transform", "variance", "ws" 
 	}; 
@@ -203,7 +203,7 @@ BOOST_FIXTURE_TEST_CASE(test_CNoiseGeneratorPluginHandler,PluginTestFixture)
 BOOST_FIXTURE_TEST_CASE(test_C1DSpacialKernelPluginHandler,PluginTestFixture) 
 {
 	set<string> test_data = {
-		"gauss"
+		"gauss", "cdiff"
 	}; 
 	test(C1DSpacialKernelPluginHandler::instance().get_set(), test_data); 
 }
@@ -264,9 +264,14 @@ BOOST_FIXTURE_TEST_CASE(test_C2DFilterPluginHandler,PluginTestFixture)
 		"downscale", "erode", "gauss", "gradnorm", "invert", "kmeans", 
 		"label", "labelmap", "labelscale", "load", "mask", "mean", "median", "mlv", 
 		"ngfnorm", "noise", "open", "pruning", "regiongrow", "sandp", 
-		"scale", "selectbig", "sepconv", "shmean", "sort-label", "sws", 
-		"tee", "thinning", "thresh", "transform", "ws"
-	}; 
+		"scale", "selectbig", "sepconv", "shmean", "sobel",
+		"sort-label", "sws", "tee", "thinning", "thresh",
+		"transform", "ws"
+	};
+#ifdef HAVE_MAXFLOW
+	test_data.insert("maxflow"); 
+#endif 
+
 	test(C2DFilterPluginHandler::instance().get_set(), test_data); 
 }
 
diff --git a/src/wavelettrans.cc b/src/wavelettrans.cc
index c1832b2..20186d5 100644
--- a/src/wavelettrans.cc
+++ b/src/wavelettrans.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 78a2616..54dcc73 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -1,6 +1,6 @@
 #
 # This file is part of MIA - a toolbox for medical image analysis 
-# Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+# 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
diff --git a/test/test_ioplugins.cc b/test/test_ioplugins.cc
index 8d107c9..2a0f0a1 100644
--- a/test/test_ioplugins.cc
+++ b/test/test_ioplugins.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/test/test_minimizer.cc b/test/test_minimizer.cc
index a7d14b5..f189b8c 100644
--- a/test/test_minimizer.cc
+++ b/test/test_minimizer.cc
@@ -1,7 +1,7 @@
 /* -*- mia-c++  -*-
  *
  * This file is part of MIA - a toolbox for medical image analysis 
- * Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+ * 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
diff --git a/testdata/CMakeLists.txt b/testdata/CMakeLists.txt
index 1560b8a..200e40c 100644
--- a/testdata/CMakeLists.txt
+++ b/testdata/CMakeLists.txt
@@ -1,6 +1,6 @@
 #
 # This file is part of MIA - a toolbox for medical image analysis 
-# Copyright (c) Leipzig, Madrid 1999-2014 Gert Wollny
+# 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

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