[med-svn] [mia] 01/03: New upstream version 2.4.6
Gert Wollny
gewo at moszumanska.debian.org
Mon Nov 6 08:10:37 UTC 2017
This is an automated email from the git hooks/post-receive script.
gewo pushed a commit to branch master
in repository mia.
commit 48dee2f94c8d4d04ee40c8ddd78a1c78cd05ee21
Author: Gert Wollny <gw.fossdev at gmail.com>
Date: Sun Nov 5 17:57:55 2017 +0100
New upstream version 2.4.6
---
.travis.yml | 72 +-
CMakeLists.txt | 140 +--
ChangeLog | 43 +
addons/CMakeLists.txt | 1 +
addons/dicom/CMakeLists.txt | 1 -
addons/dicom/dcm2d.cc | 2 +-
addons/dicom/dcm2d.hh | 2 +-
addons/dicom/dcm3d.cc | 22 +-
addons/dicom/dcm3d.hh | 2 +-
addons/dicom/dicom4mia.cc | 4 +-
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/hdf5_3dimage.cc | 6 +-
addons/hdf5/hdf5_3dimage.hh | 2 +-
addons/hdf5/hdf5a_mia.cc | 22 +-
addons/hdf5/hdf5a_mia.hh | 2 +-
addons/hdf5/hdf5mia.cc | 12 +-
addons/hdf5/hdf5mia.hh | 26 +-
addons/hdf5/test_hdf5_3dimage.cc | 36 +-
addons/hdf5/test_hdf5mia.cc | 66 +-
addons/itpp/CMakeLists.txt | 52 +
{mia/core => addons/itpp}/ica.cc | 117 +--
{mia/core => addons/itpp}/ica.hh | 69 +-
{mia/core => addons/itpp}/test_ica.cc | 77 +-
addons/jpg/jpeg-common.hh | 2 +-
addons/jpg/jpg-gray.cc | 3 +-
addons/jpg/jpg-rgb.cc | 3 +-
addons/jpg/test_jpg.cc | 2 +-
addons/maxflow/2dmaxflow.cc | 2 +-
addons/maxflow/2dmaxflow.hh | 2 +-
addons/maxflow/test_2dmaxflow.cc | 2 +-
addons/nifti/CMakeLists.txt | 14 +-
addons/nifti/niftiimage.cc | 19 +-
addons/nifti/niftiimage.hh | 2 +-
addons/nifti/test_niftiimage.cc | 106 +-
addons/nlopt/nlopt.cc | 2 +-
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 | 8 +-
addons/openexr/test_openexr.cc | 34 +-
addons/png/png-gray.cc | 2 +-
addons/png/png-rgb.cc | 2 +-
addons/png/test_png.cc | 2 +-
addons/tiff/test_tiff.cc | 2 +-
addons/tiff/tiff.cc | 40 +-
addons/vistaio/2dtrans.cc | 2 +-
addons/vistaio/2dtrans.hh | 2 +-
addons/vistaio/2dvfvistaio.cc | 2 +-
addons/vistaio/2dvistaio.cc | 2 +-
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/test_2dtrans.cc | 2 +-
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/test_vistaio.cc | 2 +-
addons/vistaio/vista4mia.cc | 2 +-
addons/vistaio/vista4mia.hh | 16 +-
addons/vistaio/vistamesh.cc | 6 +-
addons/vtk/test_vtkimage.cc | 9 +-
addons/vtk/test_vtkmesh.cc | 2 +-
addons/vtk/test_vtkvf.cc | 2 +-
addons/vtk/vtkimage.cc | 56 +-
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/FindDCMTKnew.cmake | 2 +-
cmake/checkITPPBoolseparate.cmake | 17 +-
cmake/macros.cmake | 81 +-
cmake/pluginmacro.cmake | 116 +--
config.h.cmake | 2 +-
coverage.sh | 6 +-
doc/CMakeLists.txt | 2 +-
doc/MiaDoctools.cmake | 88 +-
doc/miareadxml.py | 135 +--
doc/miawritprogram.py | 10 +-
doc/miaxml2man.py | 105 +-
doc/miaxml2nipype.py | 21 +-
doc/miaxml2sgml.py | 47 +-
doc/reference.dox.cmake | 3 +-
mia/2d.hh | 2 +-
mia/2d/CMakeLists.txt | 55 +-
mia/2d/angle.cc | 2 +-
mia/2d/angle.hh | 2 +-
mia/2d/boundingbox.cc | 2 +-
mia/2d/boundingbox.hh | 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/gncc.cc | 2 +-
mia/2d/cost/gncc.hh | 2 +-
mia/2d/cost/lncc.cc | 26 +-
mia/2d/cost/lncc.hh | 6 +-
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 | 127 +--
mia/2d/cost/ncc.hh | 6 +-
mia/2d/cost/ngf.cc | 4 +-
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_gncc.cc | 2 +-
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/circle.cc | 2 +-
mia/2d/creator/circle.hh | 2 +-
mia/2d/creator/test_circle.cc | 2 +-
mia/2d/cstkernel.cc | 2 +-
mia/2d/cstkernel.hh | 2 +-
mia/2d/datafield.cc | 48 +-
mia/2d/datafield.cxx | 184 ++--
mia/2d/datafield.hh | 199 +++-
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/fftkernel.cc | 2 +-
mia/2d/fftkernel.hh | 2 +-
mia/2d/filter.cc | 2 +-
mia/2d/filter.hh | 3 +-
mia/2d/filter/adaptmed.cc | 2 +-
mia/2d/filter/adaptmed.hh | 2 +-
mia/2d/filter/admean.cc | 2 +-
mia/2d/filter/admean.hh | 2 +-
mia/2d/filter/aniso.cc | 2 +-
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 | 2 +-
mia/2d/filter/crop.hh | 2 +-
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 | 2 +-
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 | 2 +-
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 | 2 +-
mia/2d/filter/labelmap.hh | 2 +-
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 | 2 +-
mia/2d/filter/mean.hh | 2 +-
mia/2d/filter/meanvar.cc | 6 +-
mia/2d/filter/meanvar.hh | 2 +-
mia/2d/filter/median.cc | 2 +-
mia/2d/filter/median.hh | 2 +-
mia/2d/filter/medianmad.cc | 6 +-
mia/2d/filter/medianmad.hh | 2 +-
mia/2d/filter/midpoint.cc | 2 +-
mia/2d/filter/mlv.cc | 2 +-
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 | 2 +-
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 | 2 +-
mia/2d/filter/sepconv.hh | 2 +-
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 | 4 +-
mia/2d/filter/test_convert.cc | 2 +-
mia/2d/filter/test_crop.cc | 2 +-
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 | 2 +-
mia/2d/filter/test_labelmap.cc | 2 +-
mia/2d/filter/test_labelscale.cc | 2 +-
mia/2d/filter/test_load.cc | 4 +-
mia/2d/filter/test_mask.cc | 2 +-
mia/2d/filter/test_mean.cc | 2 +-
mia/2d/filter/test_meanvar.cc | 2 +-
mia/2d/filter/test_median.cc | 2 +-
mia/2d/filter/test_medianmad.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 | 2 +-
mia/2d/filter/test_shaped_mean.cc | 2 +-
mia/2d/filter/test_sortlabel.cc | 2 +-
mia/2d/filter/test_tee.cc | 4 +-
mia/2d/filter/test_thinning.cc | 2 +-
mia/2d/filter/test_thresh.cc | 2 +-
mia/2d/filter/test_tmean.cc | 2 +-
mia/2d/filter/test_transform.cc | 2 +-
mia/2d/filter/test_watershed.cc | 2 +-
mia/2d/filter/thinning.cc | 2 +-
mia/2d/filter/thinning.hh | 2 +-
mia/2d/filter/thresh.cc | 2 +-
mia/2d/filter/thresh.hh | 2 +-
mia/2d/filter/tmean.cc | 6 +-
mia/2d/filter/tmean.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.hh | 2 +-
mia/2d/filtertest.cc | 2 +-
mia/2d/filtertest.hh | 2 +-
mia/2d/fullcost.cc | 4 +-
mia/2d/fullcost.hh | 2 +-
mia/2d/fullcost/image.cc | 4 +-
mia/2d/fullcost/image.hh | 2 +-
mia/2d/fullcost/label.cc | 4 +-
mia/2d/fullcost/label.hh | 2 +-
mia/2d/fullcost/maskedimage.cc | 4 +-
mia/2d/fullcost/maskedimage.hh | 2 +-
mia/2d/fullcost/test_image.cc | 2 +-
mia/2d/fullcost/test_label.cc | 2 +-
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 | 70 +-
mia/2d/image.hh | 72 +-
mia/2d/imageio.cc | 2 +-
mia/2d/imageio.hh | 2 +-
mia/2d/imageiotest.cc | 20 +-
mia/2d/imageiotest.hh | 2 +-
mia/2d/imagetest.cc | 2 +-
mia/2d/imagetest.hh | 2 +-
mia/2d/interpolator.cc | 96 +-
mia/2d/interpolator.cxx | 184 ++--
mia/2d/interpolator.hh | 75 +-
mia/2d/io/bmp.cc | 2 +-
mia/2d/io/raw.cc | 2 +-
mia/2d/io/test_xml.cc | 36 +-
mia/2d/io/xml.cc | 43 +-
mia/2d/io/xml.hh | 2 +-
mia/2d/iterator.cxx | 2 +-
mia/2d/iterator.hh | 24 +-
mia/2d/kernel/curv.cc | 2 +-
mia/2d/maskedcost.cc | 2 +-
mia/2d/maskedcost.hh | 2 +-
mia/2d/maskedcost/lncc.cc | 329 ++++---
mia/2d/maskedcost/lncc.hh | 5 +-
mia/2d/maskedcost/mi.cc | 2 +-
mia/2d/maskedcost/mi.hh | 2 +-
mia/2d/maskedcost/ncc.cc | 215 ++--
mia/2d/maskedcost/ncc.hh | 6 +-
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/identity.cc | 2 +-
mia/2d/model/identity.hh | 2 +-
mia/2d/model/navier.cc | 2 +-
mia/2d/model/navier.hh | 2 +-
mia/2d/model/naviera.cc | 2 +-
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 | 37 +-
mia/2d/perfusion.hh | 8 +-
mia/2d/polygon.cc | 2 +-
mia/2d/polygon.hh | 2 +-
mia/2d/ppmatrix.cc | 2 +-
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/bmp.cc | 2 +-
mia/2d/rigidregister.cc | 2 +-
mia/2d/rigidregister.hh | 2 +-
mia/2d/segframe.cc | 63 +-
mia/2d/segframe.hh | 6 +-
mia/2d/segpoint.cc | 41 +-
mia/2d/segpoint.hh | 21 +-
mia/2d/segsection.cc | 66 +-
mia/2d/segsection.hh | 6 +-
mia/2d/segset.cc | 121 ++-
mia/2d/segset.hh | 15 +-
mia/2d/segsetwithimages.cc | 4 +-
mia/2d/segsetwithimages.hh | 10 +-
mia/2d/segstar.cc | 44 +-
mia/2d/segstar.hh | 6 +-
mia/2d/shape.cc | 2 +-
mia/2d/shape.hh | 4 +-
mia/2d/shapes/basic_shapes.cc | 2 +-
mia/2d/shapes/basic_shapes.hh | 2 +-
mia/2d/shapes/rect.cc | 2 +-
mia/2d/shapes/rect.hh | 2 +-
mia/2d/shapes/sphere.cc | 2 +-
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/divcurl.cc | 2 +-
mia/2d/splinepenalty/divcurl.hh | 2 +-
mia/2d/splinepenalty/test_divcurl.cc | 10 +-
mia/2d/splinetransformpenalty.cc | 4 +-
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 | 2 +-
mia/2d/test_correlation_weight.cc | 2 +-
mia/2d/test_cost.cc | 2 +-
mia/2d/test_datafield.cc | 5 +-
mia/2d/test_distance.cc | 2 +-
mia/2d/test_divcurlmatrix.cc | 2 +-
mia/2d/test_filter.cc | 4 +-
mia/2d/test_filter_cast.cc | 29 +-
mia/2d/test_fullcost.cc | 2 +-
mia/2d/test_fullcost_mi_spline.cc | 2 +-
mia/2d/test_groundtruthproblem.cc | 2 +-
mia/2d/test_ica.cc | 33 +-
mia/2d/test_image.cc | 67 +-
mia/2d/test_imagecostbase.cc | 2 +-
mia/2d/test_imageio.cc | 2 +-
mia/2d/test_interpol.cc | 22 +-
mia/2d/test_iterator.cc | 7 +-
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 | 57 +-
mia/2d/test_polygon.cc | 2 +-
mia/2d/test_ppmatrix.cc | 42 +-
mia/2d/test_register.cc | 2 +-
mia/2d/test_regplugins.cc | 2 +-
mia/2d/test_rigidregister.cc | 2 +-
mia/2d/test_segframe.cc | 154 ++-
mia/2d/test_segmentation.cc | 384 ++++----
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 | 6 +-
mia/2d/test_trackpoint.cc | 2 +-
mia/2d/test_transform.cc | 2 +-
mia/2d/test_transformfactory.cc | 2 +-
mia/2d/test_transio.cc | 2 +-
mia/2d/test_vector.cc | 2 +-
...orfield_interpolator.cc => test_vectorfield.cc} | 71 +-
mia/2d/test_vectorfield_interpolator.cc | 17 +-
mia/2d/test_vfio.cc | 2 +-
mia/2d/timestep.cc | 2 +-
mia/2d/timestep.hh | 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 | 10 +-
mia/2d/transform/affine.cc | 24 +-
mia/2d/transform/affine.hh | 6 +-
mia/2d/transform/rigid.cc | 16 +-
mia/2d/transform/rigid.hh | 4 +-
mia/2d/transform/rotation.cc | 16 +-
mia/2d/transform/rotation.hh | 4 +-
mia/2d/transform/spline.cc | 8 +-
mia/2d/transform/spline.hh | 4 +-
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 | 10 +-
mia/2d/transform/test_translate.cc | 2 +-
mia/2d/transform/test_vectorfield.cc | 10 +-
mia/2d/transform/translate.cc | 6 +-
mia/2d/transform/translate.hh | 4 +-
mia/2d/transform/vectorfield.cc | 6 +-
mia/2d/transform/vectorfield.hh | 6 +-
mia/2d/transformfactory.cc | 2 +-
mia/2d/transformfactory.hh | 2 +-
mia/2d/transformio.cc | 2 +-
mia/2d/transformio.hh | 2 +-
mia/2d/transformmock.cc | 6 +-
mia/2d/transformmock.hh | 4 +-
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 | 102 +-
mia/2d/vectorfield.hh | 52 +-
mia/2d/vfio.cc | 2 +-
mia/2d/vfio.hh | 2 +-
mia/2d/vfiotest.cc | 2 +-
mia/2d/vfregularizer.cc | 72 ++
mia/2d/vfregularizer.hh | 107 ++
mia/2d/vfregularizer/CMakeLists.txt | 8 +
mia/2d/vfregularizer/fluid.cc | 196 ++++
.../vfregularizer/fluid.hh} | 34 +-
mia/2d/vfregularizer/sor.cc | 147 +++
mia/2d/vfregularizer/sor.hh | 67 ++
mia/2d/vfregularizer/test_sor.cc | 187 ++++
mia/2d/vfregularizerkernel.cc | 145 +++
mia/2d/vfregularizerkernel.hh | 176 ++++
mia/2d/vfregularizerkernel/CMakeLists.txt | 9 +
mia/2d/vfregularizerkernel/fluid-generic.cc | 244 +++++
mia/2d/vfregularizerkernel/fluid-generic.hh | 74 ++
mia/2d/vfregularizerkernel/test_fluid-generic.cc | 202 ++++
mia/3d.hh | 2 +-
mia/3d/.gitignore | 3 -
mia/3d/2dimagefifofilter.cc | 4 +-
mia/3d/2dimagefifofilter.hh | 2 +-
mia/3d/CMakeLists.txt | 36 +-
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/labelxmap.cc | 2 +-
mia/3d/combiner/labelxmap.hh | 2 +-
mia/3d/combiner/ops.cc | 2 +-
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 | 11 +-
mia/3d/cost.hh | 5 +-
mia/3d/cost/lncc.cc | 26 +-
mia/3d/cost/lncc.hh | 6 +-
mia/3d/cost/mi.cc | 2 +-
mia/3d/cost/mi.hh | 2 +-
mia/3d/cost/ncc.cc | 60 +-
mia/3d/cost/ncc.hh | 6 +-
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/lattic.cc | 2 +-
mia/3d/creator/lattic.hh | 2 +-
mia/3d/creator/sphere.cc | 2 +-
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 | 48 +-
mia/3d/datafield.cxx | 137 +--
mia/3d/datafield.hh | 134 ++-
mia/3d/defines3d.hh | 2 +-
mia/3d/deformer.hh | 2 +-
mia/3d/distance.cc | 2 +-
mia/3d/distance.hh | 2 +-
mia/3d/fifof/byslice.cc | 2 +-
mia/3d/fifof/byslice.hh | 2 +-
mia/3d/fifof/gauss.cc | 2 +-
mia/3d/fifof/gauss.hh | 2 +-
mia/3d/fifof/label.cc | 2 +-
mia/3d/fifof/label.hh | 2 +-
mia/3d/fifof/median.cc | 2 +-
mia/3d/fifof/median.hh | 2 +-
mia/3d/fifof/mlv.cc | 2 +-
mia/3d/fifof/mlv.hh | 2 +-
mia/3d/fifof/morphological.cc | 2 +-
mia/3d/fifof/morphological.hh | 2 +-
mia/3d/fifof/regiongrow.cc | 4 +-
mia/3d/fifof/regiongrow.hh | 2 +-
mia/3d/fifof/rgg.cc | 6 +-
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 | 2 +-
mia/3d/fifof/test_regiongrow.cc | 2 +-
mia/3d/fifotestfixture.cc | 2 +-
mia/3d/fifotestfixture.hh | 2 +-
mia/3d/filter.cc | 2 +-
mia/3d/filter.hh | 2 +-
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 | 2 +-
mia/3d/filter/crop.hh | 2 +-
mia/3d/filter/distance.cc | 2 +-
mia/3d/filter/distance.hh | 2 +-
mia/3d/filter/downscale.cc | 2 +-
mia/3d/filter/downscale.hh | 2 +-
mia/3d/filter/gradnorm.cc | 2 +-
mia/3d/filter/gradnorm.hh | 2 +-
mia/3d/filter/growmask.cc | 4 +-
mia/3d/filter/growmask.hh | 2 +-
mia/3d/filter/invert.cc | 2 +-
mia/3d/filter/invert.hh | 2 +-
mia/3d/filter/kmeans.cc | 2 +-
mia/3d/filter/kmeans.hh | 2 +-
mia/3d/filter/label.cc | 2 +-
mia/3d/filter/label.hh | 2 +-
mia/3d/filter/labelmap.cc | 2 +-
mia/3d/filter/labelmap.hh | 2 +-
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 | 2 +-
mia/3d/filter/mean.hh | 2 +-
mia/3d/filter/median.cc | 2 +-
mia/3d/filter/median.hh | 2 +-
mia/3d/filter/mlv.cc | 2 +-
mia/3d/filter/mlv.hh | 2 +-
mia/3d/filter/morphological.cc | 2 +-
mia/3d/filter/morphological.hh | 2 +-
mia/3d/filter/msnormalizer.cc | 2 +-
mia/3d/filter/msnormalizer.hh | 2 +-
mia/3d/filter/reorient.cc | 2 +-
mia/3d/filter/reorient.hh | 2 +-
mia/3d/filter/resize.cc | 2 +-
mia/3d/filter/resize.hh | 2 +-
mia/3d/filter/scale.cc | 2 +-
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 | 74 +-
mia/3d/filter/sepconv.hh | 24 +-
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 | 4 +-
mia/3d/filter/test_convert.cc | 2 +-
mia/3d/filter/test_crop.cc | 2 +-
mia/3d/filter/test_distance.cc | 2 +-
mia/3d/filter/test_downscale.cc | 7 +-
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/3d/filter/test_labelmap.cc | 2 +-
mia/3d/filter/test_labelscale.cc | 2 +-
mia/3d/filter/test_load.cc | 4 +-
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 | 2 +-
mia/3d/filter/test_msnormalizer.cc | 2 +-
mia/3d/filter/test_reorient.cc | 2 +-
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 | 155 ++-
mia/3d/filter/test_tee.cc | 4 +-
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/image.cc | 4 +-
mia/3d/fullcost/image.hh | 2 +-
mia/3d/fullcost/label.cc | 4 +-
mia/3d/fullcost/label.hh | 2 +-
mia/3d/fullcost/maskedimage.cc | 4 +-
mia/3d/fullcost/maskedimage.hh | 2 +-
mia/3d/fullcost/taggedssd.cc | 4 +-
mia/3d/fullcost/taggedssd.hh | 2 +-
mia/3d/fullcost/test_image.cc | 2 +-
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 | 62 +-
mia/3d/image.hh | 50 +-
mia/3d/imagecollect.cc | 2 +-
mia/3d/imagecollect.hh | 2 +-
mia/3d/imagedraw.cc | 2 +-
mia/3d/imagedraw.cxx | 2 +-
mia/3d/imagedraw.hh | 2 +-
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 | 21 +-
mia/3d/interpolator.cxx | 2 +-
mia/3d/interpolator.hh | 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 | 12 +-
mia/3d/landmark.cc | 2 +-
mia/3d/landmark.hh | 2 +-
mia/3d/landmarklist.cc | 2 +-
mia/3d/landmarklist.hh | 2 +-
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/lmx.cc | 251 ++---
mia/3d/maskedcost.cc | 2 +-
mia/3d/maskedcost.hh | 2 +-
mia/3d/maskedcost/lncc.cc | 25 +-
mia/3d/maskedcost/lncc.hh | 6 +-
mia/3d/maskedcost/mi.cc | 2 +-
mia/3d/maskedcost/mi.hh | 2 +-
mia/3d/maskedcost/ncc.cc | 40 +-
mia/3d/maskedcost/ncc.hh | 4 +-
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 | 2 +-
mia/3d/matrix.hh | 2 +-
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 | 16 +-
mia/3d/orientation.hh | 2 +-
mia/3d/ppmatrix.cc | 12 +-
mia/3d/ppmatrix.hh | 2 +-
mia/3d/quaternion.cc | 2 +-
mia/3d/quaternion.hh | 2 +-
mia/3d/reg3d/direct.cc | 2 +-
mia/3d/reg3d/fluid.cc | 2 +-
mia/3d/reg3d/navier.cc | 2 +-
mia/3d/reg3d/naviera.cc | 2 +-
mia/3d/reg3d/navierasse.cc | 2 +-
mia/3d/reg3d/navierpsse.cc | 2 +-
mia/3d/register.cc | 2 +-
mia/3d/register.hh | 2 +-
mia/3d/rigidregister.cc | 2 +-
mia/3d/rigidregister.hh | 2 +-
mia/3d/rot.cc | 2 +-
mia/3d/rot.hh | 2 +-
mia/3d/shape.cc | 2 +-
mia/3d/shape.hh | 2 +-
mia/3d/shapes/CMakeLists.txt | 39 +-
mia/3d/shapes/basic_shapes.cc | 2 +-
mia/3d/shapes/basic_shapes.hh | 2 +-
mia/3d/shapes/sphere.cc | 2 +-
mia/3d/shapes/sphere.hh | 2 +-
mia/3d/shapes/test_shapes.cc | 2 +-
mia/3d/similarity_profile.cc | 2 +-
mia/3d/similarity_profile.hh | 2 +-
mia/3d/splinepenalty/divcurl.cc | 2 +-
mia/3d/splinepenalty/divcurl.hh | 2 +-
mia/3d/splinepenalty/test_divcurl.cc | 2 +-
mia/3d/splinetransformpenalty.cc | 4 +-
mia/3d/splinetransformpenalty.hh | 2 +-
mia/3d/stackdisttrans.cc | 2 +-
mia/3d/stackdisttrans.hh | 2 +-
mia/3d/test_2dimagefifofilter.cc | 2 +-
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_critical_points.cc | 2 +-
mia/3d/test_datafield.cc | 9 +-
mia/3d/test_deform.cc | 2 +-
mia/3d/test_distance.cc | 2 +-
mia/3d/test_fullcost.cc | 2 +-
mia/3d/test_ica.cc | 35 +-
mia/3d/test_image.cc | 31 +-
mia/3d/test_imagecollect.cc | 2 +-
mia/3d/test_imagedraw.cc | 2 +-
mia/3d/test_imageio.cc | 2 +-
mia/3d/test_interpol.cc | 26 +-
mia/3d/test_iterator.cc | 2 +-
mia/3d/test_landmark.cc | 2 +-
mia/3d/test_landmarklistio.cc | 6 +-
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 | 6 +-
mia/3d/test_stackdisttrans.cc | 2 +-
mia/3d/test_trackpoint.cc | 2 +-
mia/3d/test_transform.cc | 2 +-
mia/3d/test_transformfactory.cc | 2 +-
mia/3d/test_transio.cc | 2 +-
mia/3d/test_vector.cc | 2 +-
mia/3d/test_vectorfield.cc | 195 +++-
mia/3d/test_vfio.cc | 2 +-
mia/3d/timestep.cc | 2 +-
mia/3d/timestep.hh | 2 +-
mia/3d/trackpoint.cc | 2 +-
mia/3d/trackpoint.hh | 2 +-
mia/3d/trait.hh | 2 +-
mia/3d/transform.cc | 7 +-
mia/3d/transform.hh | 12 +-
mia/3d/transform/affine.cc | 26 +-
mia/3d/transform/affine.hh | 4 +-
mia/3d/transform/axisrot.cc | 26 +-
mia/3d/transform/axisrot.hh | 4 +-
mia/3d/transform/raffine.cc | 26 +-
mia/3d/transform/raffine.hh | 4 +-
mia/3d/transform/rigid.cc | 26 +-
mia/3d/transform/rigid.hh | 4 +-
mia/3d/transform/rotation.cc | 14 +-
mia/3d/transform/rotation.hh | 4 +-
mia/3d/transform/rotbend.cc | 28 +-
mia/3d/transform/rotbend.hh | 4 +-
mia/3d/transform/spline.cc | 8 +-
mia/3d/transform/spline.hh | 4 +-
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 | 8 +-
mia/3d/transform/test_translate.cc | 2 +-
mia/3d/transform/test_vectorfield.cc | 29 +-
mia/3d/transform/translate.cc | 4 +-
mia/3d/transform/translate.hh | 4 +-
mia/3d/transform/vectorfield.cc | 11 +-
mia/3d/transform/vectorfield.hh | 8 +-
mia/3d/transformfactory.cc | 2 +-
mia/3d/transformfactory.hh | 2 +-
mia/3d/transformio.cc | 2 +-
mia/3d/transformio.hh | 2 +-
mia/3d/transformmock.cc | 6 +-
mia/3d/transformmock.hh | 4 +-
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 | 348 ++++++-
mia/3d/vectorfield.hh | 62 +-
mia/3d/vfio.cc | 8 +-
mia/3d/vfio.hh | 19 +-
mia/3d/vfiotest.cc | 2 +-
mia/3d/vfiotest.hh | 2 +-
mia/3d/vfregularizer.cc | 72 ++
mia/3d/vfregularizer.hh | 107 ++
mia/3d/vfregularizer/CMakeLists.txt | 8 +
mia/3d/vfregularizer/fluid.cc | 196 ++++
.../vfregularizer/fluid.hh} | 34 +-
mia/3d/vfregularizer/sor.cc | 152 +++
mia/3d/vfregularizer/sor.hh | 67 ++
mia/3d/vfregularizer/test_sor.cc | 127 ++-
mia/3d/vfregularizerkernel.cc | 146 +++
mia/3d/vfregularizerkernel.hh | 176 ++++
mia/3d/vfregularizerkernel/CMakeLists.txt | 9 +
mia/3d/vfregularizerkernel/fluid-generic.cc | 302 ++++++
mia/3d/vfregularizerkernel/fluid-generic.hh | 74 ++
mia/3d/vfregularizerkernel/test_fluid-generic.cc | 262 +++++
mia/core.hh | 2 +-
mia/core/CMakeLists.txt | 52 +-
mia/core/attribute_names.cc | 2 +-
mia/core/attribute_names.hh | 2 +-
mia/core/attributes.cc | 52 +-
mia/core/attributes.cxx | 2 +-
mia/core/attributes.hh | 46 +-
mia/core/attributetype.hh | 20 +-
mia/core/boundary_conditions.cc | 2 +-
mia/core/boundary_conditions.hh | 5 +-
mia/core/callback.cc | 2 +-
mia/core/callback.hh | 2 +-
mia/core/cmdbooloption.cc | 3 +-
mia/core/cmdbooloption.hh | 2 +-
mia/core/cmdlineparser.cc | 20 +-
mia/core/cmdlineparser.hh | 2 +-
mia/core/cmdoption.cc | 14 +-
mia/core/cmdoption.hh | 8 +-
mia/core/cmdoptionflags.hh | 2 +-
mia/core/cmdparamoption.hh | 8 +-
mia/core/cmdstringoption.cc | 3 +-
mia/core/cmdstringoption.hh | 2 +-
mia/core/cmdtranslateroption.cc | 2 +-
mia/core/cmdtranslateroption.hh | 2 +-
mia/core/cmeans.cc | 16 +-
mia/core/cmeans.hh | 2 +-
mia/core/cmeansinit/kmeans.cc | 2 +-
mia/core/cmeansinit/kmeans.hh | 2 +-
mia/core/cmeansinit/static.cc | 2 +-
mia/core/cmeansinit/static.hh | 2 +-
mia/core/cmeansinit/test_kmeans.cc | 2 +-
mia/core/cmeansinit/test_static.cc | 2 +-
mia/core/combiner.cc | 2 +-
mia/core/combiner.hh | 2 +-
mia/core/convergence_measure.cc | 85 ++
mia/core/convergence_measure.hh | 85 ++
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 | 15 +-
mia/core/datapool.hh | 9 +-
mia/core/defines.hh | 2 +-
mia/core/delayedparameter.hh | 4 +-
mia/core/dictmap.hh | 2 +-
mia/core/distance.cc | 2 +-
mia/core/distance.hh | 2 +-
mia/core/dlloader.cc | 2 +-
mia/core/dlloader.hh | 2 +-
mia/core/dummyhandler.cc | 2 +-
mia/core/dummyhandler.hh | 5 +-
mia/core/errormacro.cc | 94 ++
mia/core/errormacro.hh | 11 +-
mia/core/export_handler.hh | 2 +-
mia/core/factory.hh | 11 +-
mia/core/factory_trait.hh | 2 +-
mia/core/fastica.cc | 567 -----------
mia/core/fastica/CMakeLists.txt | 10 +-
mia/core/fastica/deflationnonlinearity.cc | 2 +-
mia/core/fastica/deflationnonlinearity.hh | 2 +-
mia/core/fastica/fastica.cc | 1037 ++++++++++++++++++++
mia/core/{ => fastica}/fastica.hh | 161 ++-
mia/core/fastica/test_deflationnonlinearity.cc | 2 +-
mia/core/{test_ica.cc => fastica/test_fastica.cc} | 340 ++++---
mia/core/fastica_nonlinearity.cc | 2 +-
mia/core/fastica_nonlinearity.hh | 2 +-
mia/core/fft1d_r2c.cc | 2 +-
mia/core/fft1d_r2c.hh | 2 +-
mia/core/fftslopeclassifier.cc | 4 +-
mia/core/fftslopeclassifier.hh | 2 +-
mia/core/fifofilter.cxx | 2 +-
mia/core/fifofilter.hh | 2 +-
mia/core/file.cc | 2 +-
mia/core/file.hh | 2 +-
mia/core/filetools.cc | 3 +-
mia/core/filetools.hh | 2 +-
mia/core/filter.cc | 2 +-
mia/core/filter.hh | 48 +-
mia/core/fixedwidthoutput.cc | 2 +-
mia/core/fixedwidthoutput.hh | 2 +-
mia/core/flags.hh | 2 +-
mia/core/flagstring.cc | 2 +-
mia/core/flagstring.hh | 2 +-
mia/core/fullstats.cc | 2 +-
mia/core/fullstats.hh | 2 +-
mia/core/gsl_defines.hh | 2 +-
mia/core/gsl_iterator.hh | 2 +-
mia/core/gsl_matrix.cc | 46 +-
mia/core/gsl_matrix.hh | 19 +-
mia/core/gsl_matrix_vector_ops.cc | 2 +-
mia/core/gsl_matrix_vector_ops.hh | 2 +-
mia/core/gsl_multimin.cc | 2 +-
mia/core/gsl_multimin.hh | 2 +-
mia/core/gsl_pca.cc | 2 +-
mia/core/gsl_pca.hh | 2 +-
mia/core/gsl_vector.cc | 50 +-
mia/core/gsl_vector.hh | 19 +-
mia/core/gsl_vector_dispatch.hh | 2 +-
mia/core/gsl_wavelet.cc | 2 +-
mia/core/gsl_wavelet.hh | 2 +-
mia/core/handler.cxx | 8 +-
mia/core/handler.hh | 4 +-
mia/core/handlerbase.cc | 3 +-
mia/core/handlerbase.hh | 5 +-
mia/core/histogram.hh | 2 +-
mia/core/history.cc | 2 +-
mia/core/history.hh | 2 +-
mia/core/hwcap.cc | 59 ++
mia/core/hwcap.hh | 49 +
mia/core/ica.cc | 485 +--------
mia/core/ica.hh | 202 ++--
mia/core/ica_template.cxx | 6 +-
mia/core/ica_template.hh | 12 +-
mia/core/icaanalysisbase.cc | 36 -
mia/core/icaanalysisbase.hh | 189 ----
mia/core/import_handler.hh | 2 +-
mia/core/index.cc | 2 +-
mia/core/index.hh | 4 +-
mia/core/info.cc | 4 +-
mia/core/interpolator1d.cc | 20 +-
mia/core/interpolator1d.cxx | 2 +-
mia/core/interpolator1d.hh | 2 +-
mia/core/iodata.cc | 2 +-
mia/core/iodata.hh | 2 +-
mia/core/iohandler.cxx | 2 +-
mia/core/iohandler.hh | 4 +-
mia/core/ioplugin.cc | 2 +-
mia/core/ioplugin.cxx | 3 +-
mia/core/ioplugin.hh | 2 +-
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/gdas.cc | 6 +-
mia/core/minimizer/gdas.hh | 2 +-
mia/core/minimizer/gdsq.cc | 2 +-
mia/core/minimizer/gdsq.hh | 2 +-
mia/core/minimizer/gsl.cc | 4 +-
mia/core/minimizer/gsl.hh | 2 +-
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 | 2 +-
mia/core/module.hh | 2 +-
mia/core/msgstream.cc | 2 +-
mia/core/msgstream.hh | 2 +-
mia/core/nccsum.cc | 2 +-
mia/core/nccsum.hh | 2 +-
mia/core/noise/gauss.cc | 2 +-
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 | 2 +-
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 | 3 +-
mia/core/optparam.hh | 6 +-
mia/core/parallel.hh | 2 +-
mia/core/parallelcxx11.cc | 2 +-
mia/core/parallelcxx11.hh | 16 +-
mia/core/paramarray.hh | 90 ++
mia/core/parameter.cc | 147 ++-
mia/core/parameter.cxx | 9 +-
mia/core/parameter.hh | 106 +-
mia/core/paramoption.cc | 6 +-
mia/core/paramoption.hh | 2 +-
mia/core/paramtranslator.cc | 3 +-
mia/core/paramtranslator.hh | 2 +-
mia/core/pixeltype.cc | 4 +-
mia/core/pixeltype.hh | 22 +-
mia/core/plugin_base.cc | 4 +-
mia/core/plugin_base.cxx | 2 +-
mia/core/plugin_base.hh | 2 +-
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 | 4 +-
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 | 29 +-
mia/core/searchpath.hh | 2 +-
mia/core/selftestcmdoption.cc | 2 +-
mia/core/selftestcmdoption.hh | 2 +-
mia/core/seriesstats.cc | 2 +-
mia/core/seriesstats.hh | 2 +-
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 | 27 +-
mia/core/slopeclassifier.cc | 2 +-
mia/core/slopeclassifier.hh | 4 +-
mia/core/slopestatistics.cc | 2 +-
mia/core/slopestatistics.hh | 2 +-
mia/core/slopevector.hh | 2 +-
mia/core/spacial_kernel.cc | 2 +-
mia/core/spacial_kernel.hh | 5 +-
mia/core/spacialkernel/cdiff.cc | 2 +-
mia/core/spacialkernel/cdiff.hh | 2 +-
mia/core/spacialkernel/gauss.cc | 2 +-
mia/core/spacialkernel/gauss.hh | 2 +-
mia/core/spacialkernel/test_cdiff.cc | 2 +-
mia/core/spacialkernel/test_gauss.cc | 20 +-
mia/core/sparse_histogram.cc | 2 +-
mia/core/sparse_histogram.hh | 16 +-
mia/core/sparse_solver.hh | 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 | 5 +-
mia/core/splinekernel/bspline.cc | 2 +-
mia/core/splinekernel/bspline.hh | 2 +-
mia/core/splinekernel/test_bspline.cc | 2 +-
mia/core/splineparzenmi.cc | 2 +-
mia/core/splineparzenmi.hh | 8 +-
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 | 34 +-
mia/core/test_boundary_conditions.cc | 2 +-
mia/core/test_callback.cc | 2 +-
mia/core/test_cmdlineparser.cc | 28 +-
mia/core/test_cmdlineparseroutput.cc | 159 +--
mia/core/test_cmdoptionflags.cc | 2 +-
mia/core/test_cmdparamoption.cc | 2 +-
mia/core/test_cmdtranslatoroption.cc | 2 +-
mia/core/test_cmdxmlhelp.cc | 23 +-
mia/core/test_cmeans.cc | 2 +-
mia/core/test_convergence_measure.cc | 123 +++
mia/core/test_core.cc | 7 +-
mia/core/test_cost.cc | 2 +-
mia/core/test_cstplan.cc | 2 +-
mia/core/test_datapool.cc | 10 +-
mia/core/test_delayedparameter.cc | 2 +-
mia/core/test_dictmap.cc | 2 +-
mia/core/test_distance.cc | 2 +-
mia/core/test_factoryoption.cc | 5 +-
mia/core/test_fastica.cc | 184 ----
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 | 68 +-
mia/core/test_fixedwidthoutput.cc | 2 +-
mia/core/test_flagstring.cc | 2 +-
mia/core/test_fullstats.cc | 2 +-
mia/core/test_gsl_matrix.cc | 38 +-
mia/core/test_gsl_matrix_vector_ops.cc | 2 +-
mia/core/test_gsl_multimin.cc | 2 +-
mia/core/test_gsl_pca.cc | 2 +-
mia/core/test_gsl_vector.cc | 40 +-
mia/core/test_handler.cc | 2 +-
mia/core/test_helpers.hh | 2 +-
mia/core/test_histogram.cc | 2 +-
mia/core/test_history.cc | 2 +-
mia/core/test_index.cc | 2 +-
mia/core/test_interpol.cc | 2 +-
mia/core/test_interpolator1d.cc | 6 +-
mia/core/test_iohandler.cc | 2 +-
mia/core/test_kernels.cc | 2 +-
mia/core/test_kmeans.cc | 6 +-
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 | 2 +-
mia/core/test_parallelcxx11.cc | 2 +-
mia/core/test_parameter.cc | 75 +-
mia/core/test_parseroutput.cc | 2 +-
mia/core/test_pixeltype.cc | 9 +-
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 | 9 +-
mia/core/test_slopeclassifier.cc | 2 +-
mia/core/test_slopestatistics.cc | 2 +-
mia/core/test_sparse_histogram.cc | 2 +-
mia/core/test_sparse_solver.cc | 2 +-
mia/core/test_splinekernel.cc | 2 +-
mia/core/test_splineparzenmi.cc | 2 +-
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 | 4 +-
mia/core/test_waveletslopeclassifier.cc | 2 +-
mia/core/test_xmlinterface.cc | 182 +++-
mia/core/testplug/dummy1.cc | 2 +-
mia/core/testplug/dummy2.cc | 2 +-
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 | 30 +-
mia/core/typedescr.hh | 30 +-
mia/core/utils.cc | 75 +-
mia/core/utils.hh | 2 +-
mia/core/vector.hh | 8 +-
mia/core/watch.cc | 56 +-
mia/core/watch.hh | 24 +-
mia/core/waveletslopeclassifier.cc | 21 +-
mia/core/waveletslopeclassifier.hh | 9 +-
mia/core/xmlinterface.cc | 324 +++++-
mia/core/xmlinterface.hh | 111 ++-
mia/internal/autotest.hh | 2 +-
mia/internal/main.hh | 2 +-
mia/internal/pluginsettest.hh | 4 +-
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/addscale.cc | 2 +-
mia/mesh/filter/addscale.hh | 2 +-
mia/mesh/filter/deltrianglesbynormal.cc | 2 +-
mia/mesh/filter/deltrianglesbynormal.hh | 2 +-
mia/mesh/filter/scale.cc | 2 +-
mia/mesh/filter/scale.hh | 2 +-
mia/mesh/filter/selectbig.cc | 2 +-
mia/mesh/filter/selectbig.hh | 2 +-
mia/mesh/filter/test_addscale.cc | 2 +-
mia/mesh/filter/test_deltrianglesbynormal.cc | 2 +-
mia/mesh/filter/test_scale.cc | 2 +-
mia/mesh/filter/test_selectbig.cc | 2 +-
mia/mesh/filter/test_vtxsort.cc | 2 +-
mia/mesh/filter/vtxsort.cc | 2 +-
mia/mesh/filter/vtxsort.hh | 2 +-
mia/mesh/io/gts.cc | 2 +-
mia/mesh/io/off.cc | 11 +-
mia/mesh/io/ply.cc | 64 +-
mia/mesh/io/stl.cc | 15 +-
mia/mesh/io/test_meshio.cc | 40 +-
mia/mesh/test_triangle_neighbourhood.cc | 2 +-
mia/mesh/test_triangulate.cc | 2 +-
mia/mesh/triangle_neighbourhood.cc | 2 +-
mia/mesh/triangle_neighbourhood.hh | 2 +-
mia/mesh/triangularMesh.cc | 2 +-
mia/mesh/triangularMesh.hh | 2 +-
mia/mesh/triangulate.hh | 2 +-
mia/template/bandpass.cxx | 2 +-
mia/template/bandpass.hh | 2 +-
mia/template/binarize.cxx | 2 +-
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 | 50 +-
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 | 2 +-
mia/template/fullcost.hh | 2 +-
mia/template/invert.cxx | 2 +-
mia/template/invert.hh | 2 +-
mia/template/labelmap.cxx | 2 +-
mia/template/labelmap.hh | 2 +-
mia/template/lsd.hh | 2 +-
mia/template/masked_cost.cxx | 2 +-
mia/template/masked_cost.hh | 2 +-
mia/template/mi.hh | 2 +-
mia/template/mi_masked.cxx | 2 +-
mia/template/mi_masked.hh | 2 +-
mia/template/multicost.cxx | 2 +-
mia/template/multicost.hh | 2 +-
mia/template/nonrigidregister.cxx | 2 +-
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 | 2 +-
mia/template/ssd-automask.hh | 2 +-
mia/template/ssd.hh | 2 +-
mia/template/ssd_masked.cxx | 2 +-
mia/template/ssd_masked.hh | 2 +-
mia/template/trackpoint.cxx | 4 +-
mia/template/trackpoint.hh | 2 +-
mia/template/transformfactory.cxx | 2 +-
mia/template/transformfactory.hh | 2 +-
mia/template/watershed.hh | 2 +-
mia/test/testhelpers.hh | 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 | 4 +-
src/2dfluid-syn-registration.cc | 464 +++++++++
src/2dforce.cc | 2 +-
src/2dfuzzysegment.cc | 2 +-
src/2dgrayimage-combine-to-rgb.cc | 2 +-
src/2dgroundtruthreg.cc | 8 +-
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 | 2 +-
src/2dimagestats.cc | 2 +-
src/2dlerp.cc | 2 +-
src/2dmany2one-nonrigid.cc | 4 +-
src/2dmulti-force.cc | 2 +-
src/2dmulti-nrreg.cc | 2 +-
src/2dmultiimageregistration.cc | 2 +-
src/2dmultiimageto3d.cc | 2 +-
src/2dmultiimagevar.cc | 2 +-
src/2dmyocard-ica.cc | 25 +-
src/2dmyocard-icaseries.cc | 21 +-
src/2dmyocard-segment.cc | 15 +-
src/2dmyocard-upsloap.cc | 8 +-
src/2dmyoica-full.cc | 136 +--
src/2dmyoica-nonrigid-parallel.cc | 38 +-
src/2dmyoica-nonrigid.cc | 38 +-
src/2dmyoica-nonrigid2.cc | 30 +-
src/2dmyoicapgt.cc | 37 +-
src/2dmyomilles.cc | 30 +-
src/2dmyoperiodic-nonrigid.cc | 6 +-
src/2dmyopgt-nonrigid.cc | 8 +-
src/2dmyoserial-nonrigid.cc | 7 +-
src/2dmyoseries-compdice.cc | 7 +-
src/2dmyoseries-dice.cc | 5 +-
src/2dmyoset-all2one-nonrigid.cc | 6 +-
src/2dnrreg.cc | 2 +-
src/2dsegcompare.cc | 16 +-
src/2dseghausdorff.cc | 13 +-
src/2dsegment-ahmed.cc | 2 +-
src/2dsegment-fuzzyw.cc | 2 +-
src/2dsegment-local-cmeans.cc | 9 +-
src/2dsegment-local-kmeans.cc | 8 +-
src/2dsegment-per-pixel-kmeans.cc | 8 +-
src/2dsegmentcropbox.cc | 9 +-
src/2dsegseriesstats.cc | 8 +-
src/2dsegshift.cc | 18 +-
src/2dsegshiftperslice.cc | 18 +-
src/2dseries-mincorr.cc | 2 +-
src/2dseries-sectionmask.cc | 14 +-
src/2dseries-segdistance.cc | 4 +-
src/2dseries2dordermedian.cc | 2 +-
src/2dseries2sets.cc | 25 +-
src/2dseriescorr.cc | 2 +-
src/2dseriesgradMAD.cc | 2 +-
src/2dseriesgradvariation.cc | 2 +-
src/2dserieshausdorff.cc | 23 +-
src/2dseriessmoothgradMAD.cc | 2 +-
src/2dseriestovolume.cc | 4 +-
src/2dstack-cmeans-presegment.cc | 2 +-
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 | 2 +-
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 | 4 +-
src/3ddistance.cc | 2 +-
src/3deval-transformquantity.cc | 4 +-
src/3dfield2norm.cc | 2 +-
src/3dfluid-syn-registration.cc | 464 +++++++++
src/3dforce.cc | 2 +-
src/3dfuzzysegment.cc | 2 +-
src/3dgetsize.cc | 2 +-
src/3dgetslice.cc | 2 +-
src/3dimageaddattributes.cc | 2 +-
src/3dimagecombine.cc | 2 +-
src/3dimagecreator.cc | 2 +-
src/3dimagefilter.cc | 2 +-
src/3dimagefilterstack.cc | 2 +-
src/3dimageselect.cc | 2 +-
src/3dimagestatistics-in-mask.cc | 2 +-
src/3dimagestats.cc | 2 +-
src/3dlandmarks-distances.cc | 4 +-
src/3dlandmarks-transform.cc | 2 +-
src/3dlerp.cc | 2 +-
src/3dmany2one-nonrigid.cc | 4 +-
src/3dmaskseeded.cc | 2 +-
src/3dmotioncompica-nonrigid.cc | 19 +-
src/3dmulti-nrreg.cc | 2 +-
src/3dnonrigidreg-alt.cc | 2 +-
src/3dnonrigidreg.cc | 2 +-
src/3dnrreg.cc | 2 +-
src/3dprealign-nonrigid.cc | 3 +-
src/3dpropose-boundingbox.cc | 2 +-
src/3drigidreg.cc | 2 +-
src/3dsegment-ahmed.cc | 2 +-
src/3dsegment-local-cmeans.cc | 561 +++++++++++
src/3dserial-nonrigid.cc | 4 +-
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 | 28 +-
src/cmeans.cc | 2 +-
src/distance-mesh2mask.cc | 2 +-
src/filenumberpattern.cc | 2 +-
src/fluid2d/NR2DMatrix.hh | 2 +-
src/fluid2d/Pixel.hh | 2 +-
src/fluid2d/elast.cc | 4 +-
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/eqn_solver.cc | 3 +-
src/fluid3d/eqn_solver.hh | 2 +-
src/fluid3d/main.cc | 8 +-
src/fluid3d/sor_solver.cc | 2 +-
src/fluid3d/sor_solver.hh | 2 +-
src/fluid3d/typedefs.hh | 2 +-
src/fluid3d/vfluid.cc | 9 +-
src/fluid3d/vfluid.hh | 4 +-
src/isosurface/CMakeLists.txt | 4 +-
src/isosurface/iso.cc | 2 +-
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 | 5 +-
src/mesh-to-maskimage.cc | 2 +-
src/meshdistance-to-stackmask.cc | 2 +-
src/meshfilter.cc | 2 +-
src/multihist.cc | 4 +-
src/multiimage-cmeans.cc | 2 +-
src/myowavelettest.cc | 2 +-
src/plugin-help.cc | 4 +-
src/raw2image.cc | 2 +-
src/raw2volume.cc | 2 +-
src/test_plugins_as_installed.cc | 2 +-
src/wavelettrans.cc | 2 +-
1511 files changed, 14736 insertions(+), 7114 deletions(-)
diff --git a/.travis.yml b/.travis.yml
index 8dabbaa..acf0bea 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,38 +1,68 @@
-sudo: required
+sudo: false
dist: trusty
language: generic
env:
matrix:
- - COVERAGE=ON EXTRA=OFF
- - COVERAGE=OFF EXTRA=ON
+ - COVERAGE=ON EXTRA=OFF BUILD_TYPE=Debug
+ - COVERAGE=OFF EXTRA=ON BUILD_TYPE=Debug
+ - COVERAGE=OFF EXTRA=ON BUILD_TYPE=Release
global:
- CTEST_PARALLEL_LEVEL=2
- secure: GJh7knKOeyjofQFswCHI4H1VeRBYDmGrZjBiW/yNoGqLvvAZi32HF2d5gHj2vrsGBqto/5mQrydo1rH6Q85VuZ7ZNZmcmiMVA5htv61WKfxzc50mSrkSfvDTb0MOmR8QcpWpK4YAfCYd4r8drPfpbRdHUvTfEk9tS8I/1LGLuos3cLRU+OojEuvndUC8rGHtCRtDswFmngbc96gkAuHfAd7LiaJ5EY+pqOmHY4xMgi5Ev4FnGdkUczUcpisxee/48QIite9lw5E0pemPepKuhrwUJRvnzb9Tgsp94R42mzymvnKyLsttdUQtUItTQshTqEtWSFf/6GO9GPyUXAgR+BDsQ9ODlxOC6+Cip0HqxCvgDfIZarVaj5/2/ZwiyjocEinhSzFiIJF9SShpqSpP9MUgS/ZL/9y6GMiDXx19zkxBJ9kXP+7vH/G/7qFZ6f1aVuDemgKit5styDQDnLyd/FlBrz3oWftj [...]
-install:
-- sudo add-apt-repository ppa:gert-die/trusty-mia -y
-- sudo apt-get update -qq
-- sudo apt-get install -o APT::Get::Install-Recommends=false -o APT::Get::Install-Suggests=false -y libmaxflow-dev libdcmtk2-dev libeigen3-dev libfftw3-dev libgsl0-dev libgts-dev libhdf5-dev libitpp-dev libnifti-dev libnlopt-dev libopenexr-dev libpng-dev libtbb-dev libtiff-dev libvtk6-dev libvistaio-dev libxml++2.6-dev xsltproc docbook-xsl doxygen graphviz libblas-dev libboost-filesystem-dev libboost-regex-dev libboost-serialization-dev libboost-system-dev libboost-test-dev python-lxml
-- pip install --user cpp-coveralls
-before_script:
-- mkdir build
-- cd build
-- echo COVERAGE=$COVERAGE EXTRA=$EXTRA
-- cmake .. -DALWAYS_CREATE_DOC=$EXTRA -DSTRICT_DEPENDECIES=ON -DMIA_CREATE_MANPAGES=$EXTRA -DMIA_CREATE_NIPYPE_INTERFACES=$EXTRA -DENABLE_COVERAGE=$COVERAGE -DDISABLE_PROGRAMS=$COVERAGE -DUSE_MATHJAX=YES
-script:
-- make -j2
-after_success:
-- make test
-- cd ..
-- if test "x$COVERAGE" = "xON"; then coveralls --exclude CMakeFiles --exclude src --gcov-options '\-lp' -b $(pwd)/build 2>&1 >/dev/null ; fi
-
addons:
+ apt:
+ sources:
+ - sourceline: 'ppa:gert-die/trusty-mia'
+ packages:
+ - libmaxflow-dev
+ - libdcmtk2-dev
+ - libeigen3-dev
+ - libfftw3-dev
+ - libgsl0-dev
+ - libgts-dev
+ - libhdf5-dev
+ - libitpp-dev
+ - libnifti-dev
+ - libnlopt-dev
+ - libopenexr-dev
+ - libpng-dev
+ - libtbb-dev
+ - libtiff-dev
+ - libvtk6-dev
+ - libvistaio-dev
+ - libxml2-dev
+ - xsltproc
+ - docbook-xsl
+ - doxygen
+ - graphviz
+ - libblas-dev
+ - libboost-filesystem-dev
+ - libboost-regex-dev
+ - libboost-serialization-dev
+ - libboost-system-dev
+ - libboost-test-dev
+ - python-lxml
coverity_scan:
project:
name: gerddie/mia
version: 2.2.7+
description: Medical imaga analysis library
notification_email: gw.fossdev at gmail.com
- build_command: make -j3
+ build_command: make -j3
branch_pattern: coverity_scan
+
+before_script:
+- mkdir build
+- cd build
+- echo COVERAGE=$COVERAGE EXTRA=$EXTRA
+- cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DALWAYS_CREATE_DOC=$EXTRA -DSTRICT_DEPENDECIES=ON -DMIA_CREATE_MANPAGES=$EXTRA -DMIA_CREATE_NIPYPE_INTERFACES=$EXTRA -DENABLE_COVERAGE=$COVERAGE -DDISABLE_PROGRAMS=$COVERAGE -DUSE_MATHJAX=YES -DMIA_USE_BOOST_REGEX=YES
+script:
+- cat /proc/cpuinfo
+- free -h
+- make -j3
+after_success:
+- make test
+- cd ..
+- if test "x$COVERAGE" = "xON"; then pip install --user cpp-coveralls; coveralls --exclude CMakeFiles --exclude src --gcov-options '\-lp' -b $(pwd)/build 2>&1 >/dev/null ; fi
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2bd89a3..857d1c1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -53,7 +53,7 @@ SET(VENDOR "Gert Wollny")
SET(PACKAGE_NAME "mia")
SET(MAJOR_VERSION 2)
SET(MINOR_VERSION 4)
-SET(MICRO_VERSION 2)
+SET(MICRO_VERSION 6)
SET(INTERFACE_AGE 0)
SET(BINARY_AGE 0)
@@ -82,6 +82,9 @@ OPTION(ENABLE_DEBUG_MESSAGES "Enable debug and trace outputs" TRUE)
OPTION(ENABLE_COVERAGE "Enable code coverage tests" FALSE)
OPTION(DISABLE_PROGRAMS "Don't build the programs nor documentation (only for testing purposes)" FALSE)
OPTION(MIA_CREATE_USERDOC "Enable creation of html user documentation" TRUE)
+OPTION(MIA_ENABLE_TESTING "Enable compiling and running the test suite" TRUE)
+
+
INCLUDE(GNUInstallDirs)
@@ -90,10 +93,27 @@ INCLUDE (TestBigEndian)
INCLUDE (${CMAKE_CURRENT_SOURCE_DIR}/cmake/macros.cmake)
INCLUDE (${CMAKE_CURRENT_SOURCE_DIR}/cmake/pluginmacro.cmake)
INCLUDE (CheckTypeSize)
+INCLUDE (CheckIncludeFileCXX)
include(CheckCXXCompilerFlag)
-IF(UNIX)
+
+MESSAGE(STATUS "Compiler is ${CMAKE_CXX_COMPILER_ID} version ${CMAKE_CXX_COMPILER_VERSION}")
+
+IF (((${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU") AND
+ (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 5.3.0)) OR
+ ((${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang") AND
+ (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 3.3.0)))
+ MESSAGE(STATUS "Compiler has full c++11 support")
+
+ # g++ >= 6.0 sets std=c++14 by default
+ IF ((${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU") AND
+ (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 6.0.0))
+ SET(CXX_11_FLAG "-std=c++11")
+ ENDIF()
+
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CXX_11_FLAG} -fvisibility=hidden")
+ELSE()
CHECK_CXX_COMPILER_FLAG("-std=c++11" HAS_GNU_CXX11_FLAG)
IF(HAS_GNU_CXX11_FLAG)
SET(CXX_11_FLAG "-std=c++11")
@@ -105,9 +125,29 @@ IF(UNIX)
MESSAGE(WARNING "Don't know how to enable C++11, if you are lucky, they are enabled by default")
ENDIF(HAS_GNU_CXX0X_FLAG)
ENDIF(HAS_GNU_CXX11_FLAG)
-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CXX_11_FLAG} -fvisibility=hidden")
-ENDIF(UNIX)
+ INCLUDE (${CMAKE_CURRENT_SOURCE_DIR}/cmake/checkCpp0xAuto.cmake)
+ INCLUDE (${CMAKE_CURRENT_SOURCE_DIR}/cmake/checkCpp0xLambda.cmake)
+ IF(NOT "${CXX_HAS_CXX_0X_AUTO}" OR NOT CXX_HAS_CXX_0X_LAMBDA)
+ MESSAGE(FATAL_ERROR
+ "This source code requires the C++0x auto type and lambda features. "
+ "If your compiler is supposed to support this feature, "
+ "please enable the appropriate flags and delete the CMakeCache.txt file before "
+ "re-running cmake.\n"
+ "For g++ >= 4.8 this is '-std=c++0x' ")
+ ENDIF(NOT "${CXX_HAS_CXX_0X_AUTO}" OR NOT CXX_HAS_CXX_0X_LAMBDA)
+ENDIF()
+
+# older versions of g++ libstdc++ don't implement regex sufficiently good
+# to be useful
+IF ((${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU") AND
+ (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 5.3.0))
+ SET(MIA_USE_BOOST_REGEX_PRESET FALSE)
+ELSE()
+ SET(MIA_USE_BOOST_REGEX_PRESET TRUE)
+ENDIF()
+
+OPTION(MIA_USE_BOOST_REGEX "Use the boost::regex library (instead of c++11 build in) " ${MIA_USE_BOOST_REGEX_PRESET})
IF (ENABLE_COVERAGE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --coverage -O0 -g -DMIA_COVERAGE")
@@ -116,20 +156,8 @@ IF (ENABLE_COVERAGE)
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} --coverage")
ENDIF()
-INCLUDE (${CMAKE_CURRENT_SOURCE_DIR}/cmake/checkCpp0xAuto.cmake)
-INCLUDE (${CMAKE_CURRENT_SOURCE_DIR}/cmake/checkCpp0xLambda.cmake)
INCLUDE (${CMAKE_CURRENT_SOURCE_DIR}/cmake/checkSSEAttributeVectorCanUseSubscript.cmake)
-
-IF(NOT "${CXX_HAS_CXX_0X_AUTO}" OR NOT CXX_HAS_CXX_0X_LAMBDA)
- MESSAGE(FATAL_ERROR
- "This source code requires the C++0x auto type and lambda features. "
- "If your compiler is supposed to support this feature, "
- "please enable the appropriate flags and delete the CMakeCache.txt file before "
- "re-running cmake.\n"
- "For g++ >= 4.6 this is '-std=c++0x' ")
-ENDIF(NOT "${CXX_HAS_CXX_0X_AUTO}" OR NOT CXX_HAS_CXX_0X_LAMBDA)
-
INCLUDE (${CMAKE_CURRENT_SOURCE_DIR}/cmake/checkAltivecEnabled.cmake)
INCLUDE (${CMAKE_CURRENT_SOURCE_DIR}/cmake/checkSSEEnabled.cmake)
@@ -151,6 +179,11 @@ ENDIF(${LONG_TYPE_SIZE} EQUAL 8)
TEST_BIG_ENDIAN(WORDS_BIGENDIAN)
CHECK_INCLUDE_FILES (unistd.h HAVE_UNISTD_H)
CHECK_INCLUDE_FILES (sys/ioctl.h HAVE_SYS_IOCTL_H)
+CHECK_INCLUDE_FILES (execinfo.h HAVE_EXEINFO_H)
+
+
+CHECK_INCLUDE_FILE_CXX (cxxabi.h HAVE_CXXABI_H)
+
# find additional packages
#
@@ -216,7 +249,12 @@ MACRO(GET_BOOST_LINKERFLAG VAR LIBNAMES)
SET(${VAR} "${flags}")
ENDMACRO(GET_BOOST_LINKERFLAG)
-SET(BOOST_COMPONENTS filesystem regex unit_test_framework serialization system)
+SET(BOOST_COMPONENTS filesystem unit_test_framework serialization system)
+
+IF (MIA_USE_BOOST_REGEX)
+ SET(BOOST_COMPONENTS ${BOOST_COMPONENTS} regex)
+ENDIF()
+
IF (WIN32)
SET(BOOST_COMPONENTS ${BOOST_COMPONENTS} date_time)
ENDIF(WIN32)
@@ -231,7 +269,12 @@ LINK_DIRECTORIES(${Boost_LIBRARY_DIRS})
ADD_DEFINITIONS(-DBOOST_ALL_DYN_LINK)
ADD_DEFINITIONS(-DBOOST_FILESYSTEM_VERSION=3)
-SET(BOOST_DEPS ${Boost_REGEX_LIBRARY} ${Boost_FILESYSTEM_LIBRARY} ${Boost_SYSTEM_LIBRARY})
+IF (MIA_USE_BOOST_REGEX)
+ SET(BOOST_DEPS ${Boost_REGEX_LIBRARY} ${Boost_FILESYSTEM_LIBRARY} ${Boost_SYSTEM_LIBRARY})
+ELSE()
+ SET(BOOST_DEPS ${Boost_FILESYSTEM_LIBRARY} ${Boost_SYSTEM_LIBRARY})
+ENDIF()
+
SET(BOOST_UNITTEST ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY})
IF (WIN32 AND NOT UNIX)
@@ -378,60 +421,16 @@ ENDIF(WITH_FFTWD)
# add xml library for loading/storing segmentations and document creation
# search it olny once
#
-pkg_check_modules(XMLPP libxml++-3.0)
-
-IF (NOT XMLPP_FOUND)
- pkg_check_modules(XMLPP libxml++-2.6 REQUIRED)
-ENDIF()
+pkg_check_modules(XML libxml-2.0 REQUIRED)
+INCLUDE_DIRECTORIES(${XML_INCLUDE_DIRS})
+LINK_DIRECTORIES(${XML_LIBRARY_DIRS})
-IF (XMLPP_FOUND)
-STRING(REGEX MATCH "[0-9]*" XMLPP_MAJOR_VERSION "${XMLPP_VERSION}")
- SET(LIBXMLPP_VERSION ${XMLPP_MAJOR_VERSION})
- INCLUDE_DIRECTORIES(${XMLPP_INCLUDE_DIRS})
- LINK_DIRECTORIES(${XMLPP_LIBRARY_DIRS})
-ENDIF (XMLPP_FOUND)
#
# end XML
#
###################################################################################
-###################################################################################
-#
-# Look for IT++ for FastICA
-#
-OPTION(WITH_ITPP "Use IT++ for some additional features" ${SEARCH_LIBS_DEFAULT})
-IF(WITH_ITPP)
-
- IF (STRICT_DEPENDECIES)
- pkg_check_modules(ITPP itpp REQUIRED)
- ELSE (STRICT_DEPENDECIES)
- pkg_check_modules(ITPP itpp)
- ENDIF(STRICT_DEPENDECIES)
-
- IF(ITPP_FOUND)
- INCLUDE_DIRECTORIES(${ITPP_INCLUDE_DIRS})
- LINK_DIRECTORIES(${ITPP_LIBRARY_DIRS})
- SET(PKG_CONFIG_DEPS "${PKG_CONFIG_DEPS} itpp")
- SET(CMAKE_REQUIRED_LIBRARIES ${ITPP_LIBRARIES})
- #if ITPP was found check if it supports the return value in separate
- INCLUDE (${CMAKE_CURRENT_SOURCE_DIR}/cmake/checkITPPBoolseparate.cmake)
- IF(NOT ITPP_FASTICA_SEPARATE_HAS_RETURNVALUE)
- MESSAGE(WARNING "You are using an unpatched version of IT++. "
- "In this version using APPROACH_DEFL may run forever, and FastICA::separate "
- "doesn't return a value indicating success, "
- "therefore, APPROACH_DEFL will not be used. See also: "
- "https://sourceforge.net/tracker/?func=detail&aid=3028968&group_id=37044&atid=418758")
- SET(ICA_ALWAYS_USE_SYMM 1)
- ELSE(NOT ITPP_FASTICA_SEPARATE_HAS_RETURNVALUE)
- SET(ICA_ALWAYS_USE_SYMM 0)
- ENDIF(NOT ITPP_FASTICA_SEPARATE_HAS_RETURNVALUE)
- ENDIF(ITPP_FOUND)
-ENDIF(WITH_ITPP)
-#
-# End looking for IT++
-#
-##################################################################################
ADD_DEFINITIONS(-DHAVE_CONFIG_H)
@@ -439,8 +438,9 @@ ADD_DEFINITIONS(-DHAVE_CONFIG_H)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
-
-ENABLE_TESTING()
+IF(MIA_ENABLE_TESTING)
+ ENABLE_TESTING()
+ENDIF()
SET(PLUGIN_TEST_ROOT ${CMAKE_CURRENT_BINARY_DIR}/plugintest)
@@ -482,18 +482,18 @@ ENDIF()
# define plug-in related values and directories and add the test directory link target
#
-DEFINE_PLUGIN_NAMES( fastica "deflation;symmetric" ${PLUGIN_INSTALL_PATH})
+DEFINE_PLUGIN_NAMES( fastica "deflation;symmetric;implementation" ${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})
DEFINE_PLUGIN_NAMES( 2dstack "filter" ${PLUGIN_INSTALL_PATH})
DEFINE_PLUGIN_NAMES( 2dtransform "io;splinepenalty" ${PLUGIN_INSTALL_PATH})
-DEFINE_PLUGIN_NAMES( 2dvf "io" ${PLUGIN_INSTALL_PATH})
+DEFINE_PLUGIN_NAMES( 2dvf "io;regularizer;regularizerkernel" ${PLUGIN_INSTALL_PATH})
DEFINE_PLUGIN_NAMES( 3dimage "combiner;cost;creator;filter;fullcost;io;maskedcost;model;shape;timestep;transform" ${PLUGIN_INSTALL_PATH})
DEFINE_PLUGIN_NAMES( 3dlandmarklist "io" ${PLUGIN_INSTALL_PATH})
DEFINE_PLUGIN_NAMES( 3dtransform "io;splinepenalty" ${PLUGIN_INSTALL_PATH})
-DEFINE_PLUGIN_NAMES( 3dvf "io" ${PLUGIN_INSTALL_PATH})
+DEFINE_PLUGIN_NAMES( 3dvf "io;regularizer;regularizerkernel" ${PLUGIN_INSTALL_PATH})
DEFINE_PLUGIN_NAMES( generator "noise" ${PLUGIN_INSTALL_PATH})
DEFINE_PLUGIN_NAMES( mesh "filter;io" ${PLUGIN_INSTALL_PATH})
DEFINE_PLUGIN_NAMES( minimizer "singlecost" ${PLUGIN_INSTALL_PATH})
diff --git a/ChangeLog b/ChangeLog
index 6ea63c3..5419949 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,46 @@
+2.4.6
+
+ * Fix building with boost-1.65
+
+2.4.5
+
+ * Fix that mia-3dsegment-local-cmeans would fail when the number of
+ slices N was relatwed to the grid size G according to k*G+1
+ (k integer)
+ * Reduce the amount of template instanciations created by the *ncc cost
+ functions. This should reduce the memory requirements during build time.
+
+2.4.4
+ Issues fixed:
+
+ #129: Move all optional parts to addon
+ #167: Add alternative FastICA implementation and
+ move IT++ based version to addons
+ #191: Use C11 integer data types for consistent sizes
+ #192_ Replace lazy copy by move semantics
+ #193: Make documentation creation and nipype interfaces compatible
+ with python3
+ #194: Create a complete facate for XML handling
+ - remove dependency from libxml++ (use libxml directly)
+ #195: Correct errors in Nifti s-form handlig
+
+ Additional changes:
+
+ * New SO-version
+ * Add tools for localized c-means segmentation
+ * Add fluid-symetric registration
+ * Fix lots of coverity reported problems
+ * Make VTKIO compatible with VTK-7
+ * Add Sobel and Scharr filters
+ * Improve test coverage
+
+2.4.3
+
+ * m/c/utils.cc: Always define PATH_MAX when it is not defined by
+ system headers
+ * Correct spellings
+ * Replace use of boost::regex by std::regex
+
2.4.2
* correct installed headers
diff --git a/addons/CMakeLists.txt b/addons/CMakeLists.txt
index 4d2f022..0cb4e51 100644
--- a/addons/CMakeLists.txt
+++ b/addons/CMakeLists.txt
@@ -19,6 +19,7 @@
INCLUDE_DIRECTORIES("${CMAKE_CURRENT_SOURCE_DIR}")
ADD_SUBDIRECTORY( dicom )
+ADD_SUBDIRECTORY( itpp )
ADD_SUBDIRECTORY( jpg )
ADD_SUBDIRECTORY( hdf5 )
ADD_SUBDIRECTORY( openexr )
diff --git a/addons/dicom/CMakeLists.txt b/addons/dicom/CMakeLists.txt
index 97029ee..8ccd8ee 100644
--- a/addons/dicom/CMakeLists.txt
+++ b/addons/dicom/CMakeLists.txt
@@ -49,4 +49,3 @@ ENDIF(WITH_DCMTK)
-
diff --git a/addons/dicom/dcm2d.cc b/addons/dicom/dcm2d.cc
index 6f0529a..9b8eb90 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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.hh b/addons/dicom/dcm2d.hh
index b2c052d..25e8789 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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 33f1cf8..d9c9b84 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,17 @@
#include <map>
#include <queue>
#include <boost/filesystem.hpp>
+
+#if __cplusplus >= 201103
+#include <regex>
+using std::regex;
+using std::regex_match;
+#else
#include <boost/regex.hpp>
+using boost::regex;
+using boost::regex_match;
+#endif
+
#include <mia/core/errormacro.hh>
#include <mia/core/file.hh>
@@ -78,7 +88,7 @@ struct image_instance_less {
typedef priority_queue<P2DImage, vector<P2DImage>, image_instance_less> CImageInstances;
typedef map<PAttribute, CImageInstances, attr_less> CImageSeries;
-typedef map<PAttribute, CImageSeries, attr_less> CAquisitions;
+typedef map<PAttribute, CImageSeries, attr_less> CAcquisitions;
struct C3DImageCreator: public TFilter<bool> {
C3DImageCreator(size_t nz): m_nz(nz),
@@ -184,7 +194,7 @@ C3DImageIOPlugin::PData CDicom3DImageIOPlugin::get_images(const vector<P2DImage>
PData result(new Data);
- CAquisitions acc;
+ CAcquisitions acc;
// read all the images into a map
for(auto i = candidates.begin(); i != candidates.end(); ++i) {
@@ -195,7 +205,7 @@ C3DImageIOPlugin::PData CDicom3DImageIOPlugin::get_images(const vector<P2DImage>
[(*i)->get_attribute(IDSeriesNumber)].push(*i);
}else{
cvwarn() << "Discard image because of no "
- << ((*i)->has_attribute(IDAcquisitionNumber) ? "" : "aquisition")
+ << ((*i)->has_attribute(IDAcquisitionNumber) ? "" : "acquisition")
<< ((*i)->has_attribute(IDInstanceNumber) ? "" : "instance")
<< ((*i)->has_attribute(IDSeriesNumber) ? "" : "series")
<< " number\n";
@@ -231,12 +241,12 @@ static void add_images(const string& fname, const string& study_id, vector<P2DIm
stringstream pattern;
pattern << ".*\\" << ext;
- boost::regex pat_expr(pattern.str());
+ regex pat_expr(pattern.str());
bfs::directory_iterator di(dir);
bfs::directory_iterator dend;
while (di != dend) {
- if (boost::regex_match(di->path().filename().string(), pat_expr) &&
+ if (regex_match(di->path().filename().string(), pat_expr) &&
di->path().filename().string() != fname) {
bfs::path f = di->path();
cvdebug() << "read file '" << f << "'\n";
diff --git a/addons/dicom/dcm3d.hh b/addons/dicom/dcm3d.hh
index ccee824..c941e85 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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 4316f90..6a1b34c 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -451,7 +451,7 @@ void CDicomReaderData::getAcquisitionTimeIfAvailable(CAttributedData& image)
OFTime of_time;
success = dcm_time->getOFTime(of_time);
if (!success.good()) {
- cverr() << "CDicomReader: Could not retrive OFTime string from DcmTime Element\n";
+ cverr() << "CDicomReader: Could not retrieve OFTime string from DcmTime Element\n";
return;
}
image.set_attribute(IDAcquisitionTime, of_time.getTimeInSeconds());
diff --git a/addons/dicom/dicom4mia.hh b/addons/dicom/dicom4mia.hh
index 53ab1ea..e3af8a0 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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 61061a7..87b9bfc 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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 9dd319c..5577c87 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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 3383f4a..50b0003 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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 e09bed6..7743a39 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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 0b6a17e..99ec7b4 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -43,10 +43,8 @@ CHDF53DImageIOPlugin::CHDF53DImageIOPlugin():
add_supported_type(it_ushort);
add_supported_type(it_sint);
add_supported_type(it_uint);
-#ifdef LONG_64BIT
add_supported_type(it_slong);
add_supported_type(it_ulong);
-#endif
add_supported_type(it_float);
add_supported_type(it_double);
@@ -129,14 +127,12 @@ herr_t hdf5_walk (hid_t loc_id, const char *name, const H5L_info_t *MIA_PARAM_UN
case EAttributeType::attr_sint:
new_image = read_image<C3DSIImage>(bsize, dataset);
break;
-#ifdef LONG_64BIT
case EAttributeType::attr_ulong:
new_image = read_image<C3DULImage>(bsize, dataset);
break;
case EAttributeType::attr_slong:
new_image = read_image<C3DSLImage>(bsize, dataset);
break;
-#endif
case EAttributeType::attr_float:
new_image = read_image<C3DFImage>(bsize, dataset);
break;
diff --git a/addons/hdf5/hdf5_3dimage.hh b/addons/hdf5/hdf5_3dimage.hh
index 7e8493d..5ef7bd6 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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 252516a..5f6de7e 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,18 +33,16 @@ using std::invalid_argument;
using std::runtime_error;
-typedef boost::mpl::vector<signed char,
- unsigned char,
- signed short,
- unsigned short,
- signed int,
- float,
- unsigned int,
-#ifdef LONG_64BIT
- signed long,
- unsigned long,
-#endif
+typedef boost::mpl::vector<int8_t,
+ uint8_t,
+ int16_t,
+ uint16_t,
+ int32_t,
+ uint32_t,
+ int64_t,
+ uint64_t,
+ float,
double
> HDF5BasicPixelTypes;
diff --git a/addons/hdf5/hdf5a_mia.hh b/addons/hdf5/hdf5a_mia.hh
index 6207c9a..58a9766 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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 b0dbd00..0cf5312 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -155,6 +155,10 @@ H5Base::operator hid_t() const
template <typename I>
static void check_id(hid_t id, const char *domain, const char *action, I info)
{
+ cvdebug() << "Checking id=" << id
+ << ", domain=" << domain
+ << ", action=" << action
+ << ", info=" << info << "\n";
if (id < 0) {
throw create_exception<invalid_argument>(domain, ": error in ", action, ":", info);
}
@@ -340,12 +344,12 @@ int H5Type::get_mia_type_id() const
size_t size = H5Tget_size(*this);
switch (cls) {
- case H5T_INTEGER:
+ case H5T_INTEGER:
switch (size) {
case 1: return 2 | H5Tget_sign(*this );
case 2: return 4 | H5Tget_sign(*this );
case 4: return 6 | H5Tget_sign(*this );
- case 8: return 8 | H5Tget_sign(*this );
+ case 8: return 8 | H5Tget_sign(*this );
default:
return EAttributeType::attr_unknown;
}
@@ -440,7 +444,7 @@ H5Dataset H5Dataset::open(const H5Base& parent, const char *name)
auto id = H5Dopen(p, relative_name.c_str(), H5P_DEFAULT);
check_id(id, "H5Dataset", "open", relative_name);
- int space_id = H5Dget_space(id);
+ auto space_id = H5Dget_space(id);
check_id(space_id, "H5Dataset", "get space", name);
H5Space space(space_id);
diff --git a/addons/hdf5/hdf5mia.hh b/addons/hdf5/hdf5mia.hh
index 6bdeaa6..ae51d2a 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -225,19 +225,17 @@ struct Mia_to_h5_types {
static hid_t mem_datatype(){ return MEM_TYPE;} \
}; \
-MIA_TO_H5_TYPE(bool, H5T_STD_B8LE, H5T_NATIVE_B8);
-MIA_TO_H5_TYPE(signed char, H5T_STD_I8LE, H5T_NATIVE_SCHAR);
-MIA_TO_H5_TYPE(unsigned char, H5T_STD_U8LE, H5T_NATIVE_UCHAR);
-MIA_TO_H5_TYPE(signed short, H5T_STD_I16LE, H5T_NATIVE_SHORT);
-MIA_TO_H5_TYPE(unsigned short, H5T_STD_U16LE, H5T_NATIVE_USHORT);
-MIA_TO_H5_TYPE(signed int, H5T_STD_I32LE, H5T_NATIVE_INT);
-MIA_TO_H5_TYPE(unsigned int, H5T_STD_U32LE, H5T_NATIVE_UINT);
-#ifdef LONG_64BIT
-MIA_TO_H5_TYPE(signed long, H5T_STD_I64LE, H5T_NATIVE_LONG);
-MIA_TO_H5_TYPE(unsigned long, H5T_STD_U64LE, H5T_NATIVE_ULONG);
-#endif
-MIA_TO_H5_TYPE(float, H5T_IEEE_F32LE, H5T_NATIVE_FLOAT);
-MIA_TO_H5_TYPE(double, H5T_IEEE_F64LE, H5T_NATIVE_DOUBLE);
+MIA_TO_H5_TYPE(bool, H5T_STD_B8LE, H5T_NATIVE_B8);
+MIA_TO_H5_TYPE(int8_t, H5T_STD_I8LE, H5T_NATIVE_SCHAR);
+MIA_TO_H5_TYPE(uint8_t, H5T_STD_U8LE, H5T_NATIVE_UCHAR);
+MIA_TO_H5_TYPE(int16_t, H5T_STD_I16LE, H5T_NATIVE_SHORT);
+MIA_TO_H5_TYPE(uint16_t, H5T_STD_U16LE, H5T_NATIVE_USHORT);
+MIA_TO_H5_TYPE(int32_t, H5T_STD_I32LE, H5T_NATIVE_INT);
+MIA_TO_H5_TYPE(uint32_t, H5T_STD_U32LE, H5T_NATIVE_UINT);
+MIA_TO_H5_TYPE(int64_t, H5T_STD_I64LE, H5T_NATIVE_LLONG);
+MIA_TO_H5_TYPE(uint64_t, H5T_STD_U64LE, H5T_NATIVE_ULLONG);
+MIA_TO_H5_TYPE(float, H5T_IEEE_F32LE, H5T_NATIVE_FLOAT);
+MIA_TO_H5_TYPE(double, H5T_IEEE_F64LE, H5T_NATIVE_DOUBLE);
#undef MIA_TO_H5_TYPE
diff --git a/addons/hdf5/test_hdf5_3dimage.cc b/addons/hdf5/test_hdf5_3dimage.cc
index 281211f..40d7c1c 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,25 +51,21 @@ struct __fill_image<bool> {
}
};
-
-typedef boost::mpl::vector<
- bool,
- signed char,
- unsigned char,
- signed short,
- unsigned short,
- signed int,
- unsigned int,
-#ifdef LONG_64BIT
- signed long,
- unsigned long,
-#endif
- float,
- double
- > test_pixeltypes;
-
-
-BOOST_AUTO_TEST_CASE_TEMPLATE( test_simple_write_read, T, test_pixeltypes )
+typedef boost::mpl::vector<bool,
+ int8_t,
+ uint8_t,
+ int16_t,
+ uint16_t,
+ int32_t,
+ uint32_t,
+ int64_t,
+ uint64_t,
+ float,
+ double
+ > test_types;
+
+
+BOOST_AUTO_TEST_CASE_TEMPLATE( test_simple_write_read, T, test_types )
{
C3DBounds size (2,3,4);
T3DImage<T> *image = new T3DImage<T>(size);
diff --git a/addons/hdf5/test_hdf5mia.cc b/addons/hdf5/test_hdf5mia.cc
index ec7ad3c..9715398 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,21 +30,19 @@
NS_MIA_USE
using namespace std;
-
-typedef boost::mpl::vector<signed char,
- unsigned char,
- signed short,
- unsigned short,
- signed int,
- unsigned int,
-#ifdef LONG_64BIT
- signed long,
- unsigned long,
-#endif
- float,
- double
- > test_pixel_types;
-
+namespace bmpl=boost::mpl;
+
+typedef bmpl::vector<int8_t,
+ uint8_t,
+ int16_t,
+ uint16_t,
+ int32_t,
+ uint32_t,
+ int64_t,
+ uint64_t,
+ float,
+ double
+ > test_types;
class HDF5CoreFileFixture {
@@ -92,24 +90,38 @@ BOOST_FIXTURE_TEST_CASE(test_core_hdf5_io_driver, HDF5CoreFileFixture)
BOOST_FIXTURE_TEST_CASE(test_simple_dataset, HDF5CoreFileFixture)
{
hsize_t dims[2] = {2,3};
- vector<int> data = {1,2,3,4,5,6};
- auto mem_type_in = Mia_to_h5_types<int>::mem_datatype();
+ vector<int32_t> data = {1,2,3,4,5,6};
+ auto mem_type_in = Mia_to_h5_types<int32_t>::mem_datatype();
// write the data set
{
- auto file_type = Mia_to_h5_types<int>::file_datatype();
+ auto file_type = Mia_to_h5_types<int32_t>::file_datatype();
auto space = H5Space::create(2, dims);
auto dataset = H5Dataset::create(get_file(), "/testset", file_type, space);
- dataset.write_data(data, int());
+ dataset.write_data(data, int32_t());
+
+
+ cvdebug() << "Get the data set back (first)\n";
+
+ auto dataset2 = H5Dataset::open(get_file(), "/testset");
+ auto size = dataset2.get_size();
+
+ BOOST_CHECK_EQUAL(size.size(), 2u);
+ BOOST_CHECK_EQUAL(size[0],2u);
+ BOOST_CHECK_EQUAL(size[1],3u);
+
}
- // close data set automatically, and now reopen it
+ // close data set automatically, and now reopen it
+ cvdebug() << "second part\n";
{
auto dataset = H5Dataset::open(get_file(), "/testset");
- auto size = dataset.get_size();
+
+ auto size = dataset.get_size();
+
BOOST_CHECK_EQUAL(size.size(), 2u);
BOOST_CHECK_EQUAL(size[0],2u);
BOOST_CHECK_EQUAL(size[1],3u);
@@ -119,9 +131,9 @@ BOOST_FIXTURE_TEST_CASE(test_simple_dataset, HDF5CoreFileFixture)
BOOST_CHECK(H5Tequal( mem_type, mem_type_in ) > 0);
- vector<int> read_data(6);
+ vector<int32_t> read_data(6);
- dataset.read_data(read_data, int());
+ dataset.read_data(read_data, int32_t());
for (int i = 0; i < 6; ++i)
BOOST_CHECK_EQUAL(read_data[i], data[i]);
@@ -245,7 +257,7 @@ void TestDatasetIOInGroupFixture<T>::run()
this->test(path, dims, data);
}
-BOOST_AUTO_TEST_CASE_TEMPLATE( test_dataset_io, T , test_pixel_types )
+BOOST_AUTO_TEST_CASE_TEMPLATE( test_dataset_io, T , test_types )
{
TestDatasetIOInGroupFixture<T>().run();
}
@@ -281,7 +293,7 @@ void TestAttrfixture<T>::run()
BOOST_CHECK_EQUAL(*rattr, value);
}
-BOOST_AUTO_TEST_CASE_TEMPLATE( test_attributes , T , test_pixel_types )
+BOOST_AUTO_TEST_CASE_TEMPLATE( test_attributes , T , test_types )
{
TestAttrfixture<T>().run();
}
@@ -323,7 +335,7 @@ void TestVectorAttrfixture<T>::run()
-BOOST_AUTO_TEST_CASE_TEMPLATE( test_vector_attributes , T , test_pixel_types )
+BOOST_AUTO_TEST_CASE_TEMPLATE( test_vector_attributes , T , test_types )
{
TestVectorAttrfixture<T>().run();
}
diff --git a/addons/itpp/CMakeLists.txt b/addons/itpp/CMakeLists.txt
new file mode 100644
index 0000000..2ddb8ef
--- /dev/null
+++ b/addons/itpp/CMakeLists.txt
@@ -0,0 +1,52 @@
+###################################################################################
+#
+# Look for IT++ for FastICA
+#
+OPTION(WITH_ITPP "Use IT++ for alternative FastICA implementation" ${SEARCH_LIBS_DEFAULT})
+IF(WITH_ITPP)
+
+ IF (STRICT_DEPENDECIES)
+ pkg_check_modules(ITPP itpp REQUIRED)
+ ELSE (STRICT_DEPENDECIES)
+ pkg_check_modules(ITPP itpp)
+ ENDIF(STRICT_DEPENDECIES)
+
+ IF(ITPP_FOUND)
+ INCLUDE_DIRECTORIES(${ITPP_INCLUDE_DIRS})
+ LINK_DIRECTORIES(${ITPP_LIBRARY_DIRS})
+ #if ITPP was found check if it supports the return value in separate
+ SET(CMAKE_REQUIRED_LIBRARIES ${ITPP_LIBRARIES})
+ CHECK_CXX_SOURCE_COMPILES(
+"#include <itpp/signal/fastica.h>
+
+int main(int argc, char *args[])
+{
+ itpp::mat m_Signal(1,1);
+ itpp::Fast_ICA ica(m_Signal);
+ if (ica.separate())
+ return 0;
+ else
+ return -1;
+}
+" ITPP_FASTICA_SEPARATE_HAS_RETURNVALUE)
+
+ IF(NOT ITPP_FASTICA_SEPARATE_HAS_RETURNVALUE)
+ MESSAGE(WARNING "You are using an unpatched version of IT++. "
+ "In this version using APPROACH_DEFL may run forever, and FastICA::separate "
+ "doesn't return a value indicating success, "
+ "therefore, APPROACH_DEFL will not be used. See also: "
+ "https://sourceforge.net/tracker/?func=detail&aid=3028968&group_id=37044&atid=418758")
+ SET(ICA_ALWAYS_USE_SYMM 1)
+ ELSE(NOT ITPP_FASTICA_SEPARATE_HAS_RETURNVALUE)
+ SET(ICA_ALWAYS_USE_SYMM 0)
+ ENDIF(NOT ITPP_FASTICA_SEPARATE_HAS_RETURNVALUE)
+
+ SET( FAST_ICA_LIBRARIES ${ITPP_LIBRARIES} miacore)
+ PLUGINGROUP_WITH_TEST_AND_PREFIX2("fastica" "implementation" "ica" "${FAST_ICA_LIBRARIES}")
+
+ ENDIF(ITPP_FOUND)
+ENDIF(WITH_ITPP)
+#
+# End looking for IT++
+#
+##################################################################################
diff --git a/mia/core/ica.cc b/addons/itpp/ica.cc
similarity index 85%
copy from mia/core/ica.cc
copy to addons/itpp/ica.cc
index 20c8e76..a15ae43 100644
--- a/mia/core/ica.cc
+++ b/addons/itpp/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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,14 +23,16 @@
#include <stdexcept>
#include <memory>
#include <miaconfig.h>
-#include <mia/core/ica.hh>
+#include <addons/itpp/ica.hh>
#include <mia/core/errormacro.hh>
#include <mia/core/msgstream.hh>
+#include <itpp/base/random.h>
-NS_MIA_BEGIN
+namespace itpp_fastica {
using namespace std;
+using namespace mia;
struct CICAAnalysisITPPImpl {
@@ -89,7 +91,7 @@ void CICAAnalysisITPP::set_row_internal(unsigned row, const std::vector<double>&
assert(row < static_cast<unsigned>(impl->m_Signal.rows()));
assert(buffer.size() == static_cast<unsigned>(impl->m_Signal.cols()));
- itppvector buf(static_cast<signed>(buffer.size()));
+ itpp::Vec<itpp::mat::value_type> buf(static_cast<signed>(buffer.size()));
for (auto i= 0; static_cast<unsigned>(i) < buffer.size(); ++i)
buf[i] = buffer[static_cast<unsigned>(i)];
@@ -111,6 +113,12 @@ void CICAAnalysisITPP::set_approach(EApproach approach)
}
+void CICAAnalysisITPP::set_deterministic_seed( int seed )
+{
+ if (seed >= 0)
+ itpp::GlobalRNG_reset(seed);
+}
+
bool CICAAnalysisITPP::run(unsigned int nica, vector<vector<float> > guess)
{
TRACE_FUNCTION;
@@ -192,37 +200,6 @@ void CICAAnalysisITPP::set_mixing_series(unsigned int index, const std::vector<f
impl->set_mixing_series(index, filtered_series);
}
-
-float correlation(const CICAAnalysisITPP::itppvector& a, const CICAAnalysisITPP::itppvector& b)
-{
- assert(a.size() > 0);
- assert(a.size() == b.size());
-
- float sxx = 0.0;
- float syy = 0.0;
- float sxy = 0.0;
- float sx = 0.0;
- float sy = 0.0;
-
- for (int i = 0; i < a.size(); ++i) {
- sx += a[i];
- sy += b[i];
- sxx += a[i] * a[i];
- syy += b[i] * b[i];
- sxy += a[i] * b[i];
- }
- const float ssxy = sxy - sx * sy / a.size();
- const float ssxx = sxx - sx * sx / a.size();
- const float ssyy = syy - sy * sy / a.size();
- if (sxx < 1e-10 && syy < 1e-10 )
- return 1.0;
-
- if (sxx < 1e-10 || syy < 1e-10 )
- return 0.0;
-
- return (ssxy * ssxy) / (ssxx * ssyy);
-}
-
void CICAAnalysisITPPImpl::set_mixing_series(unsigned int index, const std::vector<float>& series)
{
TRACE_FUNCTION;
@@ -375,7 +352,6 @@ void CICAAnalysisITPPImpl::check_set(const CICAAnalysisITPP::IndexSet& s) const
void CICAAnalysisITPPImpl::normalize_ICs()
{
-#if 1
if (m_nlength < 2)
throw invalid_argument("ICAAnalysis: input should have at least two pixels");
@@ -416,48 +392,6 @@ void CICAAnalysisITPPImpl::normalize_ICs()
}
}
-#else
- // scale all ICs to have a range of 2.0 and are shifted to the mean
- for (unsigned int c = 0; c < m_ncomponents; ++c) {
- // evaluate range of IC
- double min_val = m_ICs(c, 0);
- double max_val = m_ICs(c, 0);
-
- double sum = m_ICs(c, 0);
- for (unsigned int k = 0; k < m_nlength; ++k) {
- const double v = m_ICs(c, k);
- if (min_val > v)
- min_val = v;
- if (max_val < v)
- max_val = v;
- sum += v;
- }
- assert(min_val != max_val);
-
-
- // we want to start all slopes with the negative value
- // makes only truely sense, if the 1allover mean was stripped
- float invert = 1.0;
- if (m_Mix(0, c) > 0) {
- cvdebug() << "Component " << c << " invert sign\n";
- invert = -1.0;
- }
-
- const double ic_factor = invert * 2.0 / (max_val - min_val);
- const double mix_factor = 1.0 / ic_factor;
-
-
- const double ic_shift = sum / m_nlength;
-
- for (unsigned int k = 0; k < m_nlength; ++k)
- m_ICs(c, k) = (m_ICs(c, k) - ic_shift) * ic_factor;
-
- for (unsigned int r = 0; r < m_rows; ++r) {
- m_mean[r] += m_Mix(r, c) * ic_shift;
- m_Mix(r, c) *= mix_factor;
- }
- }
-#endif
}
std::vector<float> CICAAnalysisITPPImpl::normalize_Mix()
@@ -494,9 +428,30 @@ void CICAAnalysisITPP::set_max_iterations(int n)
impl->m_max_iterations = n;
}
-PICAAnalysis CICAAnalysisITPPFactory::create() const
+CIndepCompAnalysis *CICAAnalysisITPPFactory::do_create() const
+{
+ return new CICAAnalysisITPP;
+}
+
+
+CICAAnalysisITPPFactoryPlugin::CICAAnalysisITPPFactoryPlugin():
+ CIndepCompAnalysisFactoryPlugin("itpp")
+{
+}
+
+CIndepCompAnalysisFactory *CICAAnalysisITPPFactoryPlugin::do_create() const
+{
+ return new CICAAnalysisITPPFactory;
+}
+
+const std::string CICAAnalysisITPPFactoryPlugin::do_get_descr()const
+{
+ return "This is the IT++ implementation of the FastICA algorithm.";
+}
+
+extern "C" EXPORT CPluginBase *get_plugin_interface()
{
- return PICAAnalysis(new CICAAnalysisITPP);
+ return new CICAAnalysisITPPFactoryPlugin;
}
-NS_MIA_END
+} // end namespace itpp_fastica
diff --git a/mia/core/ica.hh b/addons/itpp/ica.hh
similarity index 74%
copy from mia/core/ica.hh
copy to addons/itpp/ica.hh
index fa089b9..9042b2a 100644
--- a/mia/core/ica.hh
+++ b/addons/itpp/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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,8 +18,8 @@
*
*/
-#ifndef mia_core_ica_hh
-#define mia_core_ica_hh
+#ifndef addons_itpp_ica_hh
+#define addons_itpp_ica_hh
#include <set>
#include <vector>
@@ -27,13 +27,10 @@
#include <mia/core/defines.hh>
#include <mia/core/slopevector.hh>
-#include <mia/core/icaanalysisbase.hh>
+#include <mia/core/ica.hh>
-#include <boost/concept/requires.hpp>
-#include <boost/concept_check.hpp>
-
-NS_MIA_BEGIN
+namespace itpp_fastica {
/**
\ingroup perf
@@ -41,13 +38,11 @@ NS_MIA_BEGIN
This class implements basic operations for of ICA. It makes use of the ITPP implementation of FastICA.
*/
-class EXPORT_CORE CICAAnalysisITPP : public CICAAnalysis {
+class EXPORT_CORE CICAAnalysisITPP : public mia::CIndepCompAnalysis {
public:
- typedef CICAAnalysis::IndexSet IndexSet;
+ typedef mia::CIndepCompAnalysis::IndexSet IndexSet;
- /// The type of a vector as used by IT++
- typedef itpp::Vec<itpp::mat::value_type> itppvector;
/**
Initialize an ICA based of predefined data - this is only used for test cases.
*/
@@ -65,7 +60,7 @@ public:
\param slice_size number of elements each set containes
*/
- void initialize(unsigned int series_length, unsigned int slice_size);
+ void initialize(unsigned int series_length, unsigned int slice_size) override;
/**
@@ -74,17 +69,17 @@ public:
\param guess initial guess for the ICA, pass an empty vector of you
don't want to use this feature
*/
- bool run(unsigned int nica, std::vector<std::vector<float> > guess);
+ bool run(unsigned int nica, std::vector<std::vector<float> > guess) override;
/// \returns the feature vector of \a row
- std::vector<float> get_feature_row(unsigned int row)const;
+ std::vector<float> get_feature_row(unsigned int row)const override;
/// \returns the mixing signal curve of the feature \a row
- std::vector<float> get_mix_series(unsigned int row)const;
+ std::vector<float> get_mix_series(unsigned int row)const override;
/// \returns the complete mixed signal at series index \a idx
- std::vector<float> get_mix(unsigned int idx)const;
+ std::vector<float> get_mix(unsigned int idx)const override;
/** Evaluate an incomplete mixed signal. Here the features are given that are \a not to be used.
\sa get_partial_mix
@@ -92,7 +87,7 @@ public:
\param skip a set of feature indices that will be skipped when evaluating the mix
\returns the mixed signal
*/
- std::vector<float> get_incomplete_mix(unsigned int idx, const IndexSet& skip)const;
+ std::vector<float> get_incomplete_mix(unsigned int idx, const IndexSet& skip)const override;
/** Evaluate an incomplete mixed signal. Here the features are given that are \a used to create the mix.
\sa get_incomplete_mix
@@ -100,24 +95,24 @@ public:
\param use the set of feature indices that will be used to evaluate the mix
\returns an incolmplete mixed signal.
*/
- std::vector<float> get_partial_mix(unsigned int idx, const IndexSet& use)const;
+ std::vector<float> get_partial_mix(unsigned int idx, const IndexSet& use)const override;
/** Evaluate a mix of the feature signals by adding and subtractig individual features.
\param plus features o be added
\param minus features to be subtracted
\returns the feature mix
*/
- std::vector<float> get_delta_feature(const IndexSet& plus, const IndexSet& minus)const;
+ std::vector<float> get_delta_feature(const IndexSet& plus, const IndexSet& minus)const override;
/**
Replace a mixing signal curve
\param index of the curve to be replaced
\param series new data for mixing curve
*/
- void set_mixing_series(unsigned int index, const std::vector<float>& series);
+ void set_mixing_series(unsigned int index, const std::vector<float>& series) override;
/// \returns a vector containing all mixing curves
- CSlopeColumns get_mixing_curves() const;
+ mia::CSlopeColumns get_mixing_curves() const override;
/**
Normalize the ICs in the following manner:
@@ -125,45 +120,55 @@ public:
* Scale the mixing curved to compensate for the required scaling
* move the means of the time points to compensate for the shifting.
*/
- void normalize_ICs();
+ void normalize_ICs() override;
/**
Normalize the mixing curves to have a zero mean. As a result a mean image is created that
containes the sum of the ICs weighted by the required mean shift.
*/
- std::vector<float> normalize_Mix();
+ std::vector<float> normalize_Mix() override;
/// \returns the number of actual ICs
- unsigned int get_ncomponents() const;
+ unsigned int get_ncomponents() const override;
/**
sets the number of iterations in the ICA
\param n
*/
- void set_max_iterations(int n);
+ void set_max_iterations(int n) override;
/**
Set the ICA approach to either FICA_APPROACH_DEFL(default) or FICA_APPROACH_SYMM.
\param approach
*/
- void set_approach(EApproach approach);
+ void set_approach(EApproach approach) override;
+
+ void set_deterministic_seed(int seed) override;
private:
- void set_row_internal(unsigned row, const std::vector<double>& buffer, double mean);
+ void set_row_internal(unsigned row, const std::vector<double>& buffer, double mean) override;
struct CICAAnalysisITPPImpl *impl;
};
-class EXPORT_CORE CICAAnalysisITPPFactory: public CICAAnalysisFactory {
+class EXPORT_CORE CICAAnalysisITPPFactory: public mia::CIndepCompAnalysisFactory {
public:
- PICAAnalysis create() const;
+ mia::CIndepCompAnalysis *do_create() const override;
};
-typedef std::shared_ptr<CICAAnalysisITPPFactory> PICAAnalysisITPPFactory;
+class EXPORT_CORE CICAAnalysisITPPFactoryPlugin: public mia::CIndepCompAnalysisFactoryPlugin {
+public:
+ CICAAnalysisITPPFactoryPlugin();
+
+ mia::CIndepCompAnalysisFactory *do_create() const override;
+
+ const std::string do_get_descr()const override;
+};
+
-NS_MIA_END
+}
#endif
diff --git a/mia/core/test_ica.cc b/addons/itpp/test_ica.cc
similarity index 84%
copy from mia/core/test_ica.cc
copy to addons/itpp/test_ica.cc
index ab1bd1e..876b46c 100644
--- a/mia/core/test_ica.cc
+++ b/addons/itpp/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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,11 +24,12 @@
#include <cmath>
#include <iomanip>
-#include <mia/core/ica.hh>
+#include <addons/itpp/ica.hh>
using namespace std;
using namespace mia;
+using namespace itpp_fastica;
template <typename T>
@@ -43,23 +44,23 @@ ostream& operator << (ostream& os, const vector<T>& v)
BOOST_AUTO_TEST_CASE( test_mixing_ica_without_mean )
{
- const int rows = 5;
+ const int time_steps = 5;
const int elms = 10;
const int nica = 3;
- const double init_mix[nica * rows] = {
+ const double init_mix[nica * time_steps] = {
1, 2, 3, 4, 5,
1, 3, 5, 3, 1,
1, 1, 1, 1, 1
};
- const double init_ic[rows * elms] = {
+ const double init_ic[time_steps * elms] = {
1, 1, 1, 0, 0, 0, 0, 0, 0, 1,
0, 0, 0, 1, 2,-1, 0, 0, 0, 0,
0, 0, 1, 0, 0, 1, 4, 3, 2, 0
};
- double test_rows[rows][elms] = {
+ double test_time_steps[time_steps][elms] = {
{ 1, 1, 2, 1, 2, 0, 4, 3, 2, 1 } ,
{ 2, 2, 3, 3, 6, -2, 4, 3, 2, 2 } ,
{ 3, 3, 4, 5,10, -4, 4, 3, 2, 3 } ,
@@ -68,19 +69,19 @@ BOOST_AUTO_TEST_CASE( test_mixing_ica_without_mean )
};
- itpp::mat mix(init_mix, rows, nica, false);
- itpp::mat ic(init_ic, rows, elms, true);
- vector<double> mean(rows, 0.0);
+ itpp::mat mix(init_mix, time_steps, nica, false);
+ itpp::mat ic(init_ic, time_steps, elms, true);
+ vector<double> mean(time_steps, 0.0);
CICAAnalysisITPP ica(ic, mix, mean);
- for (int i = 0; i < rows; ++i) {
+ for (int i = 0; i < time_steps; ++i) {
vector<float> mixed = ica.get_mix(i);
for (int k = 0; k < elms; ++k) {
- if (mixed[k] != test_rows[i][k])
- cverr() << i << ", " << k << " expect " << test_rows[i][k]
+ if (mixed[k] != test_time_steps[i][k])
+ cverr() << i << ", " << k << " expect " << test_time_steps[i][k]
<< " get " << mixed[k] << "\n";
- BOOST_CHECK_CLOSE(mixed[k], test_rows[i][k], 0.001);
+ BOOST_CHECK_CLOSE(mixed[k], test_time_steps[i][k], 0.001);
}
}
}
@@ -119,7 +120,7 @@ BOOST_AUTO_TEST_CASE( test_mixing_ica_with_skip )
vector<double> mean(rows, 0.0);
CICAAnalysisITPP ica(ic, mix, mean);
- CICAAnalysis::IndexSet skip;
+ CIndepCompAnalysis::IndexSet skip;
skip.insert(skipnr);
for (int i = 0; i < rows; ++i) {
@@ -165,7 +166,7 @@ BOOST_AUTO_TEST_CASE( test_partial_ica_mix )
vector<double> mean(rows, 0.0);
CICAAnalysisITPP ica(ic, mix, mean);
- CICAAnalysis::IndexSet components;
+ CIndepCompAnalysis::IndexSet components;
components.insert(1);
components.insert(2);
@@ -208,11 +209,11 @@ BOOST_AUTO_TEST_CASE( test_delta_ica_mix )
vector<double> mean(rows, 0.0);
CICAAnalysisITPP ica(ic, mix, mean);
- CICAAnalysis::IndexSet plus_components;
+ CIndepCompAnalysis::IndexSet plus_components;
plus_components.insert(1);
plus_components.insert(2);
- CICAAnalysis::IndexSet minus_components;
+ CIndepCompAnalysis::IndexSet minus_components;
minus_components.insert(0);
vector<float> mixed = ica.get_delta_feature(plus_components, minus_components);
@@ -325,7 +326,7 @@ BOOST_AUTO_TEST_CASE( test_ica_with_some_mean_unknown_SYMM )
CICAAnalysisITPP ica;
ica.initialize(rows, elms);
- ica.set_approach(CICAAnalysis::appr_symm);
+ ica.set_approach(CIndepCompAnalysis::appr_symm);
for (int i = 0; i < rows; ++i)
ica.set_row(i, data_rows[i], data_rows[i] + elms);
@@ -464,45 +465,5 @@ BOOST_AUTO_TEST_CASE( test_ica_access_failtures )
}
-/**
- This test needs more data to work properly
-BOOST_AUTO_TEST_CASE( test_autorun )
-{
- const int comps = 3;
- const int rows = 10;
- const int elms = 40;
- double ic_rows[comps * elms] =
- { 1.1, -0.9, -1.9, 0.9, 2.1, 1.9, 6.1, -2.9, 0.9, 1.1,
- 1.1, 1.9, -1.1, 2.9, 3.1, 1.9, 0.1, 2.9, 1.9, 2.1,
- 2.3, -1.7, -2.7, -2.7, 6.3, -3.7, 6.3, -2.7, -0.7, 2.3,
- 2.3, -2.7, 2.2, 2.6, 6.4, -3.8, 6.2, -2.5, -0.6, 2.2,
-
- 2.3, -1.7, -2.7, -2.7, 6.3, -3.7, 6.3, -2.7, -0.7, 2.3,
- 2.3, -2.7, -2.2, -2.6, 6.4, -3.8, 6.2, -2.5, -0.6, 2.2,
- 2.3, -1.7, -2.7, -2.7, 6.3, -3.7, 6.3, -2.7, -0.7, 2.3,
- 2.3, -2.7, -2.2, -2.6, 6.4, -3.8, 6.2, -2.5, -0.6, 2.2 ,
-
- 2.3, -1.7, -2.7, -2.7, 6.3, -3.7, 6.3, -2.7, -0.7, 2.3,
- 2, 4.4, -5, 6, 9, -7, 5, -4, 2, 2,
- 1.1, 1.9, -1.1, 2.9, 3.1, 1.9, 0.1, 2.9, 1.9, 2.1,
- 2.1, 4.1, -5.2, 6.4, -9.2, -7.1, -5.3, 4.4, -2.1, 2.1
- };
-
- CICAAnalysis ica(rows, elms);
-
- for (int i = 0; i < rows; ++i) {
- vector <float> input(elms);
- for (int j = 0; j < elms; ++j)
- for (int k = 0; k < comps; ++k)
- input[j] += ic_rows[k * elms + j] * cos(i + k);
-
- ica.set_row(i, input.begin(), input.end());
- }
- ica.run_auto(6,2,0.9);
- BOOST_CHECK_EQUAL(ica.get_ncomponents(), comps);
-
-
-}
-*/
diff --git a/addons/jpg/jpeg-common.hh b/addons/jpg/jpeg-common.hh
index d2d573a..abfa53b 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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 deb18ae..1711845 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -127,7 +127,6 @@ bool CJpeg2DImageIOPlugin::do_save_jpeg(FILE *f, const C2DUBImage& image) const
miajpeg::JpegCompress compress;
- jpeg_create_compress(&compress.info);
compress.err.error_exit = mia_jpeg_save_error_exit;
diff --git a/addons/jpg/jpg-rgb.cc b/addons/jpg/jpg-rgb.cc
index f0e2860..ac9c4b2 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -129,7 +129,6 @@ bool CJpegRGB2DImageIOPlugin::do_save_jpeg(FILE *f, const CRGB2DImage& image) co
miajpeg::JpegCompress compress;
- jpeg_create_compress(&compress.info);
compress.err.error_exit = mia_jpeg_save_error_exit;
compress.info.image_width = image.get_size().x;
diff --git a/addons/jpg/test_jpg.cc b/addons/jpg/test_jpg.cc
index 5b3b30b..1610900 100644
--- a/addons/jpg/test_jpg.cc
+++ b/addons/jpg/test_jpg.cc
@@ -1,7 +1,7 @@
/* -*- mia-c++ -*-
*
* This file is part of MIA - a toolbox for medical image analysis
- * Copyright (c) Leipzig, Madrid 1999-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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
index 1eb8b77..f9656f7 100644
--- a/addons/maxflow/2dmaxflow.cc
+++ b/addons/maxflow/2dmaxflow.cc
@@ -1,7 +1,7 @@
/* -*- mia-c++ -*-
*
* This file is part of MIA - a toolbox for medical image analysis
- * Copyright (c) Leipzig, Madrid 1999-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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.hh b/addons/maxflow/2dmaxflow.hh
index 3ef40a1..631e631 100644
--- a/addons/maxflow/2dmaxflow.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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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/test_2dmaxflow.cc b/addons/maxflow/test_2dmaxflow.cc
index 3eac0f0..07c7832 100644
--- a/addons/maxflow/test_2dmaxflow.cc
+++ b/addons/maxflow/test_2dmaxflow.cc
@@ -1,7 +1,7 @@
/* -*- mia-c++ -*-
*
* This file is part of MIA - a toolbox for medical image analysis
- * Copyright (c) Leipzig, Madrid 1999-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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/CMakeLists.txt b/addons/nifti/CMakeLists.txt
index aca68eb..0948685 100644
--- a/addons/nifti/CMakeLists.txt
+++ b/addons/nifti/CMakeLists.txt
@@ -57,11 +57,13 @@ IF (WITH_NIFTI)
MESSAGE(FATAL_ERROR "NIFTI includes and or libraries not found and strict dependencies enabled")
endif (NOT NIFTI_FOUND AND STRICT_DEPENDECIES)
- INCLUDE_DIRECTORIES(${NIFTI_INCLUDE_DIR})
- INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIR})
-
- SET(imageio_path "${PLUGIN_INSTALL_PATH}/3dimage/io")
- SET(NIFTI_LINK_LIBS_3D ${NIFTIIO_LIBRARIES} mia3d)
- PLUGIN_WITH_TEST_AND_PREFIX2("3dimage" "io" niftiimage "${NIFTI_LINK_LIBS_3D}")
+ IF (NIFTI_FOUND)
+ INCLUDE_DIRECTORIES(${NIFTI_INCLUDE_DIR})
+ INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIR})
+
+ SET(imageio_path "${PLUGIN_INSTALL_PATH}/3dimage/io")
+ SET(NIFTI_LINK_LIBS_3D ${NIFTIIO_LIBRARIES} mia3d)
+ PLUGIN_WITH_TEST_AND_PREFIX2("3dimage" "io" niftiimage "${NIFTI_LINK_LIBS_3D}")
+ ENDIF()
ENDIF (WITH_NIFTI)
diff --git a/addons/nifti/niftiimage.cc b/addons/nifti/niftiimage.cc
index 9deabb9..f511abf 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -79,12 +79,8 @@ C3DImageIOPlugin("nifti")
add_supported_type(it_ushort);
add_supported_type(it_sint);
add_supported_type(it_uint);
-
-#ifdef LONG_64BIT
add_supported_type(it_slong);
add_supported_type(it_ulong);
-#endif
-
add_supported_type(it_float);
add_supported_type(it_double);
@@ -92,9 +88,9 @@ C3DImageIOPlugin("nifti")
add_suffix(".NII");
CVFloatTranslator::register_for(AttrID_nifti_sform);
- CSSTranslator::register_for(AttrID_nifti_sform_code);
- CSSTranslator::register_for(AttrID_nifti_qform_code);
- CSSTranslator::register_for(AttrID_nifti_intent_code);
+ CSITranslator::register_for(AttrID_nifti_sform_code);
+ CSITranslator::register_for(AttrID_nifti_qform_code);
+ CSITranslator::register_for(AttrID_nifti_intent_code);
CFloatTranslator::register_for("nifti-intent_p1");
CFloatTranslator::register_for("nifti-intent_p2");
@@ -184,7 +180,8 @@ void copy_attributes(C3DImage& image, const nifti_image& ni)
image.set_attribute(AttrID_nifti_intent_p1, ni.intent_p1);
image.set_attribute(AttrID_nifti_intent_p2, ni.intent_p2);
image.set_attribute(AttrID_nifti_intent_p3, ni.intent_p3);
- image.set_attribute(AttrID_nifti_intent_name, string(ni.intent_name));
+ if (strlen(ni.intent_name) > 0)
+ image.set_attribute(AttrID_nifti_intent_name, string(ni.intent_name));
image.set_attribute(IDRescaleSlope, ni.scl_slope);
image.set_attribute(IDRescaleIntercept, ni.scl_inter);
}
@@ -254,10 +251,8 @@ CNifti3DImageIOPlugin::PData CNifti3DImageIOPlugin::do_load(const std::string&
case DT_INT8: return read_images<C3DSBImage>(size, *image);
case DT_UINT16: return read_images<C3DUSImage>(size, *image);
case DT_UINT32: return read_images<C3DUIImage>(size, *image);
-#ifdef LONG_64BIT
case DT_INT64: return read_images<C3DSLImage>(size, *image);
case DT_UINT64: return read_images<C3DULImage>(size, *image);
-#endif
default:
throw create_exception<invalid_argument>("NIFTI: input format ", image->datatype, " not supported");
}
@@ -273,10 +268,8 @@ static int datatype_to_nifti(EPixelType ptype)
case it_ushort: return DT_UINT16;
case it_sint: return DT_INT32;
case it_uint: return DT_UINT32;
-#ifdef LONG_64BIT
case it_slong: return DT_INT64;
case it_ulong: return DT_UINT64;
-#endif
case it_float: return DT_FLOAT32;
case it_double: return DT_FLOAT64;
default:
diff --git a/addons/nifti/niftiimage.hh b/addons/nifti/niftiimage.hh
index 5c4057f..4828d74 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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 387ac7a..d1a480c 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,21 +35,20 @@ using namespace niftiimage;
namespace bmpl=boost::mpl;
-typedef bmpl::vector<
- unsigned char,
- signed short,
- unsigned short,
- signed int,
- unsigned int,
- float,
- double
-#ifdef LONG_64BIT
- ,long, unsigned long
-#endif
- > type;
+typedef bmpl::vector<int8_t,
+ uint8_t,
+ int16_t,
+ uint16_t,
+ int32_t,
+ uint32_t,
+ int64_t,
+ uint64_t,
+ float,
+ double
+ > test_types;
-BOOST_AUTO_TEST_CASE_TEMPLATE( test_simple_write_read_with_qform, T, type )
+BOOST_AUTO_TEST_CASE_TEMPLATE( test_simple_write_read_with_qform, T, test_types )
{
C3DBounds size(2,3,4);
T3DImage<T> *image = new T3DImage<T>(size);
@@ -69,12 +68,13 @@ BOOST_AUTO_TEST_CASE_TEMPLATE( test_simple_write_read_with_qform, T, type )
pimage->set_rotation(rot);
pimage->set_attribute("nifti-qform-code", 1);
+
CNifti3DImageIOPlugin io;
CNifti3DImageIOPlugin::Data images;
images.push_back(pimage);
stringstream filename;
- filename << "testimage-" << __type_descr<T>::value << ".nii";
+ filename << "testimage-sform-" << __type_descr<T>::value << ".nii";
cvdebug() << "test with " << filename.str() << "\n";
@@ -108,7 +108,83 @@ BOOST_AUTO_TEST_CASE_TEMPLATE( test_simple_write_read_with_qform, T, type )
BOOST_CHECK_CLOSE(qloaded.z(), rot.z(), 0.001);
BOOST_CHECK_CLOSE(qloaded.w(), rot.w(), 0.001);
+
+
+ unlink(filename.str().c_str());
+}
+
+BOOST_AUTO_TEST_CASE_TEMPLATE( test_simple_write_read_write_with_sform, T, test_types )
+{
+ C3DBounds size(2,3,4);
+ T3DImage<T> *image = new T3DImage<T>(size);
+ P3DImage pimage(image);
+
+ C3DFVector voxel(2.0,3.0,4.0);
+ C3DFVector origin(10,20,30);
+ Quaternion rot(0.5, 0.1, 0.5, 0.7);
+ auto iv = image->begin();
+ auto ev = image->end();
+ int i = 0;
+
+ while (iv != ev)
+ *iv++ = i++;
+ pimage->set_voxel_size(voxel);
+ pimage->set_origin(origin);
+ pimage->set_rotation(rot);
+ pimage->set_attribute("nifti-sform-code", 1);
+
+ vector<float> am = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15};
+ pimage->set_attribute("nifti-sform", am);
+
+ CNifti3DImageIOPlugin io;
+ CNifti3DImageIOPlugin::Data images;
+ images.push_back(pimage);
+
+ stringstream filename;
+ filename << "testimage-" << __type_descr<T>::value << ".nii";
+
+ cvdebug() << "test with " << filename.str() << "\n";
+
+ BOOST_REQUIRE(io.save(filename.str(), images));
+
+ auto loaded = io.load(filename.str());
+ BOOST_REQUIRE(loaded);
+
+ BOOST_REQUIRE(loaded->size() == 1u);
+ const auto& ploaded = dynamic_cast<const T3DImage<T>&>(*(*loaded)[0]);
+ iv = image->begin();
+
+
+ auto il = ploaded.begin();
+
+ while (iv != ev) {
+ BOOST_CHECK_EQUAL(*il, *iv);
+ ++iv;
+ ++il;
+ }
+
+ BOOST_CHECK_EQUAL(ploaded.get_voxel_size(), voxel);
+
+ BOOST_CHECK_CLOSE(ploaded.get_origin().x, origin.x, 0.001);
+ BOOST_CHECK_CLOSE(ploaded.get_origin().y, origin.y, 0.001);
+ BOOST_CHECK_CLOSE(ploaded.get_origin().z, origin.z, 0.001);
+
+ auto qloaded = ploaded.get_rotation().as_quaternion();
+
+
+ BOOST_CHECK_CLOSE(qloaded.x(), rot.x(), 0.001);
+ BOOST_CHECK_CLOSE(qloaded.y(), rot.y(), 0.001);
+ BOOST_CHECK_CLOSE(qloaded.z(), rot.z(), 0.001);
+ BOOST_CHECK_CLOSE(qloaded.w(), rot.w(), 0.001);
+
unlink(filename.str().c_str());
+
+
+ // try saving again to check attribute translation
+ BOOST_REQUIRE(io.save(filename.str(), *loaded));
+
+ unlink(filename.str().c_str());
+
}
diff --git a/addons/nlopt/nlopt.cc b/addons/nlopt/nlopt.cc
index c2b0727..b1c2747 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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.hh b/addons/nlopt/nlopt.hh
index 96690c8..7da6b12 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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 89f46bd..e95e8c4 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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 d844d13..18a99a0 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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 c20d4f4..41a239f 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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 7ce6bcf..8e822ac 100644
--- a/addons/openexr/CMakeLists.txt
+++ b/addons/openexr/CMakeLists.txt
@@ -44,14 +44,8 @@ IF(WITH_OpenEXR)
PLUGIN_WITH_PREFIX2("2dimage" "io" 2dimgexr "${DEPS2D}")
PLUGIN_WITH_PREFIX2("2dvf" "io" 2dvfexr "${DEPS2D}")
- # test programs
- ADD_EXECUTABLE(test-openexr test_openexr.cc)
-
SET(DEPLIBS mia2dtest mia2d ${BASELIBS})
- TARGET_LINK_LIBRARIES(test-openexr ${DEPLIBS} ${BOOST_UNITTEST})
-
- ADD_TEST(exr test-openexr)
-
+ NEW_TEST(openexr ${DEPLIBS})
ENDIF(EXR_LIBRARIES AND EXR_INCLUDE_DIRS)
diff --git a/addons/openexr/test_openexr.cc b/addons/openexr/test_openexr.cc
index 07f1b01..e864227 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,36 +31,20 @@ using namespace boost;
using namespace boost::unit_test;
namespace bfs = ::boost::filesystem;
-struct PathInitFixture {
- PathInitFixture();
-};
-
-PathInitFixture::PathInitFixture()
-{
- CPluginSearchpath searchpath(true);
- searchpath.add(".");
-
- C2DImageIOPluginHandler::set_search_path(searchpath);
- C2DVFIOPluginHandler::set_search_path(searchpath);
-}
-
-BOOST_FIXTURE_TEST_CASE(test_2dimage_plugin_handler, PathInitFixture)
+BOOST_AUTO_TEST_CASE(test_2dimage_plugin_handler)
{
const C2DImageIOPluginHandler::Instance& handler = C2DImageIOPluginHandler::instance();
- BOOST_REQUIRE(handler.size() == 2u);
- BOOST_REQUIRE(handler.get_plugin_names() == "datapool exr ");
+ BOOST_REQUIRE(handler.size() >= 2u);
+ auto plugins = handler.get_set();
+ BOOST_REQUIRE(plugins.find("exr") != plugins.end());
}
-BOOST_FIXTURE_TEST_CASE(test_2dvf_plugin_handler, PathInitFixture)
+BOOST_AUTO_TEST_CASE(test_2dvf_plugin_handler)
{
const C2DVFIOPluginHandler::Instance& handler = C2DVFIOPluginHandler::instance();
- BOOST_REQUIRE(handler.size() == 2u);
- BOOST_REQUIRE(handler.get_plugin_names() == "datapool exr ");
-}
-
-BOOST_FIXTURE_TEST_CASE(test_2dimage_plugin, PathInitFixture)
-{
- test_2dimageio_plugins();
+ BOOST_REQUIRE(handler.size() >= 2u);
+ auto plugins = handler.get_set();
+ BOOST_REQUIRE(plugins.find("exr") != plugins.end());
}
BOOST_AUTO_TEST_CASE ( test_2dvfio )
diff --git a/addons/png/png-gray.cc b/addons/png/png-gray.cc
index d6ec81c..7cae47a 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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 f60aeef..577437b 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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/test_png.cc b/addons/png/test_png.cc
index ed70d22..d5117f8 100644
--- a/addons/png/test_png.cc
+++ b/addons/png/test_png.cc
@@ -1,7 +1,7 @@
/* -*- mia-c++ -*-
*
* This file is part of MIA - a toolbox for medical image analysis
- * Copyright (c) Leipzig, Madrid 1999-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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/test_tiff.cc b/addons/tiff/test_tiff.cc
index 3fa3662..546f397 100644
--- a/addons/tiff/test_tiff.cc
+++ b/addons/tiff/test_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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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 6c1bff4..e022ccc 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,6 @@
NS_BEGIN(IMAGEIO_2D_TIFF)
NS_MIA_USE
using namespace std;
-using namespace boost;
enum EDataType {dt_8bit, dt_16bit, dt_32bit};
@@ -183,15 +182,11 @@ P2DImage read_bit_pixels(CTiffFile& tif, unsigned int width,
}
// deal with image photometric interpretion
- if (invert) {
- C2DBitImage::iterator ir = image->begin();
- C2DBitImage::iterator ie = image->end();
- while (ir != ie) {
- *ir = !*ir;
- ++ir;
- }
- }
-
+ if (invert)
+ transform(image->begin(), image->end(),
+ image->begin(), [](C2DBitImage::value_type x){
+ return !x;
+ });
return result;
}
@@ -227,13 +222,9 @@ P2DImage read_strip_pixels(CTiffFile& tif, unsigned int width,
// deal with image photometric interpretion
if (invert) {
- typename T2DImage<T>::iterator ii = result->begin();
- typename T2DImage<T>::iterator ie = result->end();
-
- while (ii != ie) {
- *ii = numeric_limits<T>::max( ) - *ii;
- ++ii;
- }
+ const T maxT = numeric_limits<T>::max();
+ transform(result->begin(), result->end(), result->begin(),
+ [maxT](T x) {return maxT - x;});
}
return presult;
@@ -271,7 +262,7 @@ CTiff2DImageIO::PData CTiff2DImageIO::do_load(string const& filename)const
}
cvdebug() << "TIFFTAG_IMAGEWIDTH:" << width << "\n";
- if (!TIFFGetField(tif,TIFFTAG_BITSPERSAMPLE, &bbs)){
+ if (!TIFFGetField(tif,TIFFTAG_BITSPERSAMPLE, &bbs)){
throw create_exception<runtime_error>("TIFF: Bits per samples not given in '", filename, "'");
}
cvdebug() << "TIFFTAG_BITSPERSAMPLE:" << bbs << "\n";
@@ -354,8 +345,8 @@ struct __dispatch_saver {
vector<typename Data2D::value_type> buf(rows_per_strip * image.get_size().x);
- typename Data2D::const_iterator cbuf_begin = image.begin();
- typename Data2D::const_iterator cbuf_end = cbuf_begin;
+ auto cbuf_begin = image.begin();
+ auto cbuf_end = cbuf_begin;
int nstrips = (image.get_size().y + rows_per_strip - 1) / rows_per_strip;
@@ -422,7 +413,8 @@ struct __dispatch_saver<C2DBitImage> {
size_t x = 0;
while ( x < image.get_size().x) {
int mask = 0x80;
- for (size_t bit = 0; bit < 8 && x < image.get_size().x; ++bit, mask>>=1, ++cbuf_begin, ++x) {
+ for (size_t bit = 0; bit < 8 && x < image.get_size().x;
+ ++bit, mask>>=1, ++cbuf_begin, ++x) {
if (*cbuf_begin)
*ibuf |= mask;
}
@@ -505,8 +497,8 @@ bool CTiff2DImageIO::do_save(string const& filename, const C2DImageVector& data)
CTiffImageSaver saver(tif, data.size());
- for (C2DImageVector::const_iterator iimg = data.begin(); iimg != data.end(); ++iimg)
- filter(saver, **iimg);
+ for (const auto& pimg: data)
+ filter(saver, *pimg);
cvdebug() << "CTiff2DImageIO::save end\n";
return true;
diff --git a/addons/vistaio/2dtrans.cc b/addons/vistaio/2dtrans.cc
index 86e44f9..7ac1097 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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 b01f204..338fc16 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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 575d3c7..507e648 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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/2dvistaio.cc b/addons/vistaio/2dvistaio.cc
index a3beb4b..98c0966 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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/2dvistaio.hh b/addons/vistaio/2dvistaio.hh
index 84b72d6..d622165 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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 3a1421a..4862e82 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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 1a17962..e5fbac1 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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 c9fe7f8..29ccfe0 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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 ee14c15..a0477cf 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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 40303b0..e2f0606 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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 9c78c52..807511c 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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_2dvistaio.cc b/addons/vistaio/test_2dvistaio.cc
index 4bb4aac..8c266fa 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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 d7bdcf1..db32118 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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 48ae716..3c01974 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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 6cfdd6b..4ee99a8 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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_vistaio.cc b/addons/vistaio/test_vistaio.cc
index e1ab621..732e5f9 100644
--- a/addons/vistaio/test_vistaio.cc
+++ b/addons/vistaio/test_vistaio.cc
@@ -1,7 +1,7 @@
/* -*- mia-c++ -*-
*
* This file is part of MIA - a toolbox for medical image analysis
- * Copyright (c) Leipzig, Madrid 1999-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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 d7cf2f1..4830eda 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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 19e5236..77051a9 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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/core.hh>
#include <mia/3d/vector.hh>
#include <vistaio/vistaio.h>
+#include <vistaio/vconfig.h>
#ifdef WIN32
#ifdef vista4mia_EXPORTS
@@ -87,6 +88,19 @@ struct vista_repnkind<unsigned int> {
typedef VistaIOLong type;
};
+#if VISTAIO_MAJOR_VERSION > 1 || \
+ VISTAIO_MAJOR_VERSION == 1 && VISTAIO_MINOR_VERSION > 2 || \
+ VISTAIO_MAJOR_VERSION == 1 && VISTAIO_MINOR_VERSION == 2 && VISTAIO_MICRO_VERSION > 19
+
+template <>
+struct vista_repnkind<int64_t> {
+ static const VistaIORepnKind value = VistaIOLong64Repn;
+ static const bool is_unsigned = false;
+ typedef VistaIOLong64 type;
+};
+#endif
+
+
template <>
struct vista_repnkind<float> {
static const VistaIORepnKind value = VistaIOFloatRepn;
diff --git a/addons/vistaio/vistamesh.cc b/addons/vistaio/vistamesh.cc
index 35b8948..1138011 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -150,7 +150,7 @@ static CTriangleMesh::PTrianglefield read_triangles(VistaIOGraph graph, size_t
// set triangle values
*t++ = node->t;
}else{
- cverr() <<"adressing vertexes " << node->t << "but have only"<<v_size<< "vertices\n";
+ cverr() <<"addressing vertexes " << node->t << " but have only "<<v_size<< "vertices\n";
cverr() <<"Bougus mesh: Triangle vertex out of bounds - bailing out\n";
return CTriangleMesh::PTrianglefield();
}
@@ -430,7 +430,7 @@ static VistaIOGraph create_vngraph(const CTriangleMesh& mesh)
static VistaIOGraph create_vsgraph(const CTriangleMesh& mesh)
{
- VistaIOGraph result = VistaIOCreateGraph(mesh.vertices_size(), 11, VistaIOFloatRepn, 0);
+ VistaIOGraph result = VistaIOCreateGraph(mesh.vertices_size(), 5, VistaIOFloatRepn, 0);
CTriangleMesh::const_vertex_iterator vi = mesh.vertices_begin();
CTriangleMesh::const_vertex_iterator ve = mesh.vertices_end();
CTriangleMesh::const_scale_iterator si = mesh.scale_begin();
diff --git a/addons/vtk/test_vtkimage.cc b/addons/vtk/test_vtkimage.cc
index 9a00e4f..0b0cc60 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,10 +236,7 @@ BOOST_AUTO_TEST_CASE_TEMPLATE( test_mhd_write_read, T, type_mhd )
}
-
-
-
-
+#if VTK_MAJOR_VERSION >= 7
BOOST_AUTO_TEST_CASE( test_simple_write_read_bool )
{
C3DBounds size(2,3,4);
@@ -285,3 +282,5 @@ BOOST_AUTO_TEST_CASE( test_simple_write_read_bool )
BOOST_CHECK_EQUAL(ploaded.get_voxel_size(), voxel);
// unlink(filename.str().c_str());
}
+
+#endif
diff --git a/addons/vtk/test_vtkmesh.cc b/addons/vtk/test_vtkmesh.cc
index b929e09..de1e1e5 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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 4decd75..6ab9ac7 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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 1b93492..f32515c 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,17 +77,20 @@ struct __vtk_data_array {
};
-VTK_ARRAY_TRANSLATE(bool, vtkBitArray, VTK_BIT);
- VTK_ARRAY_TRANSLATE(signed char, vtkSignedCharArray, VTK_SIGNED_CHAR);
-VTK_ARRAY_TRANSLATE(unsigned char, vtkUnsignedCharArray, VTK_UNSIGNED_CHAR);
-VTK_ARRAY_TRANSLATE(signed short, vtkShortArray, VTK_SHORT);
-VTK_ARRAY_TRANSLATE(unsigned short, vtkUnsignedShortArray, VTK_UNSIGNED_SHORT);
-VTK_ARRAY_TRANSLATE(signed int, vtkIntArray, VTK_INT);
-VTK_ARRAY_TRANSLATE(unsigned int, vtkUnsignedIntArray, VTK_UNSIGNED_INT);
+#if VTK_MAJOR_VERSION < 7
+VTK_ARRAY_TRANSLATE(bool, vtkBitArray, VTK_BIT);
+#endif
+
+VTK_ARRAY_TRANSLATE(int8_t, vtkSignedCharArray, VTK_SIGNED_CHAR);
+VTK_ARRAY_TRANSLATE(uint8_t, vtkUnsignedCharArray, VTK_UNSIGNED_CHAR);
+VTK_ARRAY_TRANSLATE(int16_t, vtkShortArray, VTK_SHORT);
+VTK_ARRAY_TRANSLATE(uint16_t, vtkUnsignedShortArray, VTK_UNSIGNED_SHORT);
+VTK_ARRAY_TRANSLATE(int32_t, vtkIntArray, VTK_INT);
+VTK_ARRAY_TRANSLATE(uint32_t, vtkUnsignedIntArray, VTK_UNSIGNED_INT);
#ifdef LONG_64BIT
-VTK_ARRAY_TRANSLATE(signed long, vtkLongArray, VTK_LONG);
-VTK_ARRAY_TRANSLATE(unsigned long, vtkUnsignedLongArray, VTK_UNSIGNED_LONG);
+VTK_ARRAY_TRANSLATE(int64_t, vtkLongArray, VTK_LONG);
+VTK_ARRAY_TRANSLATE(uint64_t, vtkUnsignedLongArray, VTK_UNSIGNED_LONG);
#endif
VTK_ARRAY_TRANSLATE(float, vtkFloatArray, VTK_FLOAT);
@@ -112,6 +115,7 @@ struct read_image {
}
};
+#if VTK_MAJOR_VERSION < 7
template <>
struct read_image<bool> {
static C3DImage *apply(const C3DBounds& size, void *scalars) {
@@ -139,6 +143,7 @@ struct read_image<bool> {
return result;
}
};
+#endif
static C3DImage *image_vtk_to_mia(vtkImageData *vtk_image, const string& fname)
{
@@ -160,16 +165,18 @@ static C3DImage *image_vtk_to_mia(vtkImageData *vtk_image, const string& fname)
C3DImage *result_image = nullptr;
switch (vtk_image->GetScalarType()) {
- case VTK_BIT: result_image=read_image<bool>::apply(size, array); break;
- case VTK_SIGNED_CHAR: result_image=read_image<signed char>::apply(size, array); break;
- case VTK_UNSIGNED_CHAR: result_image=read_image<unsigned char>::apply(size, array); break;
- case VTK_SHORT: result_image=read_image<signed short>::apply(size, array); break;
- case VTK_UNSIGNED_SHORT: result_image=read_image<unsigned short>::apply(size, array); break;
- case VTK_INT: result_image=read_image<signed int>::apply(size, array); break;
- case VTK_UNSIGNED_INT: result_image=read_image<unsigned int>::apply(size, array); break;
+#if VTK_MAJOR_VERSION < 7
+ case VTK_BIT: result_image=read_image<bool>::apply(size, array); break;
+#endif
+ case VTK_SIGNED_CHAR: result_image=read_image<int8_t>::apply(size, array); break;
+ case VTK_UNSIGNED_CHAR: result_image=read_image<uint8_t>::apply(size, array); break;
+ case VTK_SHORT: result_image=read_image<int16_t>::apply(size, array); break;
+ case VTK_UNSIGNED_SHORT: result_image=read_image<uint16_t>::apply(size, array); break;
+ case VTK_INT: result_image=read_image<int32_t>::apply(size, array); break;
+ case VTK_UNSIGNED_INT: result_image=read_image<uint32_t>::apply(size, array); break;
#ifdef LONG_64BIT
- case VTK_LONG: result_image=read_image<signed long>::apply(size, array); break;
- case VTK_UNSIGNED_LONG: result_image=read_image<unsigned long>::apply(size, array); break;
+ case VTK_LONG: result_image=read_image<int64_t>::apply(size, array); break;
+ case VTK_UNSIGNED_LONG: result_image=read_image<uint64_t>::apply(size, array); break;
#endif
case VTK_FLOAT: result_image=read_image<float>::apply(size, array); break;
case VTK_DOUBLE: result_image=read_image<double>::apply(size, array); break;
@@ -214,6 +221,7 @@ struct __dispatch_convert<T, true_type> {
}
};
+#if VTK_MAJOR_VERSION < 7
template <>
struct __dispatch_convert<bool, true_type> {
static void apply (vtkImageData *output, const T3DImage<bool>& input) {
@@ -224,9 +232,9 @@ struct __dispatch_convert<bool, true_type> {
output->SetNumberOfScalarComponents(1);
output->AllocateScalars();
#else
- output->AllocateScalars(__vtk_data_array<bool>::value, 1);
+ output->AllocateScalars(__vtk_data_array<bool>::value, 1);
#endif
- unsigned char *out_ptr = reinterpret_cast<unsigned char *>(output->GetScalarPointer());
+ unsigned char *out_ptr = reinterpret_cast<unsigned char *>(output->GetScalarPointer());
auto i = input.begin();
auto e = input.end();
@@ -251,7 +259,7 @@ struct __dispatch_convert<bool, true_type> {
}
}
};
-
+#endif
class FSetArray: public TFilter<void> {
public:
@@ -274,7 +282,7 @@ static vtkSmartPointer<vtkImageData> image_mia_to_vtk(const C3DImage& mia_image)
outimage->SetOrigin(origin.x,origin.y,origin.z);
auto dx = mia_image.get_voxel_size();
- outimage->SetSpacing(dx.x, dx.y, dx.z);
+ outimage->SetSpacing(dx.x, dx.y, dx.z);
outimage->SetDimensions(mia_image.get_size().x, mia_image.get_size().y, mia_image.get_size().z);
FSetArray set_array(outimage);
@@ -288,7 +296,9 @@ CVtk3DImageIOPlugin::CVtk3DImageIOPlugin():
C3DImageIOPlugin("vtk")
{
// indicate support for all pixel types available (only scalar types are possible)
+#if VTK_MAJOR_VERSION < 7
add_supported_type(it_bit);
+#endif
add_supported_type(it_sbyte);
add_supported_type(it_ubyte);
add_supported_type(it_sshort);
diff --git a/addons/vtk/vtkimage.hh b/addons/vtk/vtkimage.hh
index 1206642..06de974 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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 4da4b29..2b0ff72 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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 5b5693e..b65706f 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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 a9807d1..da11b42 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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 0d3da1a..0421e9f 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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 64a0930..b173f96 100644
--- a/cmake/FindDCMTKnew.cmake
+++ b/cmake/FindDCMTKnew.cmake
@@ -74,7 +74,7 @@ IF (ZLIB_FOUND)
${DCMTK_DIR}/lib
)
IF(NOT t_${n})
- MESSAGE(ERROR "Required library ${n} not found")
+ MESSAGE(STATUS "library ${n} not found")
ENDIF(NOT t_${n})
SET(files "${files}" "${t_${n}}")
ENDFOREACH(n)
diff --git a/cmake/checkITPPBoolseparate.cmake b/cmake/checkITPPBoolseparate.cmake
index 8ba6d7b..8d89b82 100644
--- a/cmake/checkITPPBoolseparate.cmake
+++ b/cmake/checkITPPBoolseparate.cmake
@@ -18,20 +18,13 @@
#
#
-#
-# check whether itpp FastICA::separate has a bool return value
-#
CHECK_CXX_SOURCE_COMPILES(
-"#include <itpp/signal/fastica.h>
-
+"#include <dcmtk/dcmdata/dcitem.h>
int main(int argc, char *args[])
{
- itpp::mat m_Signal(1,1);
- itpp::Fast_ICA ica(m_Signal);
- if (ica.separate())
- return 0;
- else
- return -1;
+ DcmTagKey tag(DCM_StudyDate);
+ DcmElement *test = DcmItem::newDicomElement(tag);
+ return test == 0;
}
-" ITPP_FASTICA_SEPARATE_HAS_RETURNVALUE)
\ No newline at end of file
+" CXX_HAS_CXX_0X_LAMBDA)
diff --git a/cmake/macros.cmake b/cmake/macros.cmake
index f70e00b..8c5352f 100644
--- a/cmake/macros.cmake
+++ b/cmake/macros.cmake
@@ -120,70 +120,6 @@ MACRO(ASSERT_SIZE NAME EXPECTED)
ENDIF(NOT ${${NAME}_TYPE_SIZE} EQUAL ${EXPECTED})
ENDMACRO(ASSERT_SIZE)
-
-
-#
-# This macro runs the program to create the XMLprogram descrition
-# that is used to create documentation and interfaced
-#
-MACRO(CREATE_EXE_XML_HELP name)
- ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_BINARY_DIR}/doc/mia-${name}.xml
- COMMAND MIA_PLUGIN_TESTPATH=${PLUGIN_TEST_ROOT}/${PLUGIN_INSTALL_PATH}
- ./mia-${name} --help-xml ${CMAKE_BINARY_DIR}/doc/mia-${name}.xml
- COMMAND rm -f ${CMAKE_SOURCE_DIR}/doc/userref.stamp
- DEPENDS mia-${name} )
-
- ADD_CUSTOM_TARGET(mia-${name}-xml DEPENDS ${CMAKE_BINARY_DIR}/doc/mia-${name}.xml)
- ADD_DEPENDENCIES(XMLDOC mia-${name}-xml)
-ENDMACRO(CREATE_EXE_XML_HELP)
-
-
-MACRO(CREATE_NIPYPE_FROM_XML name)
- IF(CREATE_NIPYPE_INTERFACES)
- STRING(REPLACE "-" "_" PythonName ${name})
-
- SET(${name}-nipype-interface ${CMAKE_CURRENT_BINARY_DIR}/mia_${PythonName}.py)
-
- ADD_CUSTOM_COMMAND(OUTPUT ${${name}-nipype-interface}
- COMMAND ${PYTHON_EXECUTABLE} ARGS ${CMAKE_SOURCE_DIR}/doc/miaxml2nipype.py
- -i ${CMAKE_BINARY_DIR}/doc/mia-${name}.xml -o ${${name}-nipype-interface}
- MAIN_DEPENDENCY ${CMAKE_BINARY_DIR}/doc/mia-${name}.xml)
-
- ADD_CUSTOM_TARGET(mia-${name}-nipype DEPENDS ${${name}-nipype-interface})
- ADD_DEPENDENCIES(nipypeinterfaces mia-${name}-nipype)
-
- INSTALL(FILES ${${name}-nipype-interface} DESTINATION ${NIPYPE_INTERFACE_DIR}/mia)
-
- ENDIF(CREATE_NIPYPE_INTERFACES)
-ENDMACRO(CREATE_NIPYPE_FROM_XML)
-#
-#
-# man pages can only be created if the python + lxml packages are available
-#
-MACRO(CREATE_MANPAGE_FROM_XML name)
- IF(CREATE_USERDOC)
-
- SET(${name}-manfile ${CMAKE_BINARY_DIR}/doc/man/mia-${name}.1)
-
- ADD_CUSTOM_COMMAND(OUTPUT ${${name}-manfile}
- COMMAND ${PYTHON_EXECUTABLE} ARGS ${CMAKE_SOURCE_DIR}/doc/miaxml2man.py
- ${CMAKE_BINARY_DIR}/doc/mia-${name}.xml >${${name}-manfile}
- MAIN_DEPENDENCY ${CMAKE_BINARY_DIR}/doc/mia-${name}.xml
- DEPENDS mandir mia-${name}-xml
- )
- ADD_CUSTOM_TARGET(mia-${name}-man DEPENDS ${${name}-manfile})
- add_dependencies(manpages mia-${name}-man)
- ENDIF(CREATE_USERDOC)
-
-ENDMACRO(CREATE_MANPAGE_FROM_XML)
-
-
-#MACRO(MIA_EXE_CREATE_DOCU_AND_INTERFACE name)
-# CREATE_EXE_XML_HELP(${name})
-# CREATE_MANPAGE_FROM_XML(${name})
-# CREATE_NIPYPE_FROM_XML(${name})
-# ENDMACRO(MIA_EXE_CREATE_DOCU_AND_INTERFACE)
-
MACRO(DEFEXE name libraries)
ADD_EXECUTABLE(mia-${name} ${name}.cc)
SET_TARGET_PROPERTIES(mia-${name} PROPERTIES COMPILE_FLAGS -DVSTREAM_DOMAIN='"${name}"')
@@ -217,7 +153,7 @@ MACRO(DEFCHKEXE name deps)
ADD_TEST(${name} mia-${name} -- --selftest)
SET_TESTS_PROPERTIES(${name}
- PROPERTIES ENVIRONMENT "MIA_PLUGIN_TESTPATH=${PLUGIN_TEST_ROOT}/${PLUGIN_INSTALL_PATH}")
+ PROPERTIES ENVIRONMENT "MIA_PLUGIN_TESTPATH=${PLUGIN_TEST_ROOT}")
ENDMACRO(DEFCHKEXE)
@@ -230,17 +166,18 @@ MACRO(NEW_TEST_BASE name libs)
TARGET_LINK_LIBRARIES(${EXENAME} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY})
ENDIF (NOT WIN32)
ADD_DEPENDENCIES(${EXENAME} plugin_test_links)
-
ENDMACRO(NEW_TEST_BASE)
MACRO(NEW_TEST name libs)
- NEW_TEST_BASE(${name} "${libs}")
- ADD_TEST(${name} ${EXENAME})
+ IF(MIA_ENABLE_TESTING)
+ NEW_TEST_BASE(${name} "${libs}")
+ ADD_TEST(${name} ${EXENAME})
+ ENDIF()
ENDMACRO(NEW_TEST)
MACRO(NEW_TEST_WITH_PARAM name libs param)
- NEW_TEST_BASE(${name} "${libs}")
- ADD_TEST(${name} ${EXENAME} ${param})
- SET_TESTS_PROPERTIES(${name}
- PROPERTIES ENVIRONMENT "MIA_PLUGIN_TESTPATH=${PLUGIN_TEST_ROOT}/${PLUGIN_INSTALL_PATH}")
+ IF(MIA_ENABLE_TESTING)
+ NEW_TEST_BASE(${name} "${libs}")
+ ADD_TEST(${name} ${EXENAME} ${param})
+ ENDIF()
ENDMACRO(NEW_TEST_WITH_PARAM)
diff --git a/cmake/pluginmacro.cmake b/cmake/pluginmacro.cmake
index 6ca9ff3..07df8f9 100644
--- a/cmake/pluginmacro.cmake
+++ b/cmake/pluginmacro.cmake
@@ -58,42 +58,47 @@ MACRO(CREATE_PLUGIN_COMMON plugname files)
# target_link_libraries(${plugname}-common ${libs})
ENDMACRO(CREATE_PLUGIN_COMMON plugname)
-MACRO(CREATE_PLUGIN_MODULE plugname libs)
-# add_library(${plugname} MODULE NO_SOURCE_FILES)
+MACRO(CREATE_PLUGIN_MODULE_OLD plugname libs)
add_library(${plugname} MODULE $<TARGET_OBJECTS:${plugname}-common>)
-# MESSAGE("Remark: Ignore this warning, calling ADD_LIBRARY without source files was done intentionally.")
set_target_properties(${plugname} PROPERTIES
PREFIX ""
SUFFIX ${PLUGSUFFIX})
- IF(NOT WIN32)
-# set_target_properties(${plugname} PROPERTIES
-# LINK_FLAGS "-Wl,--no-gc-sections -Wl,--undefined,get_plugin_interface"
-# )
- ENDIF(NOT WIN32)
target_link_libraries(${plugname} ${libs})
-# MESSAGE(STATUS "${plugname} depends on ${libs}")
+ENDMACRO(CREATE_PLUGIN_MODULE_OLD plugname)
+
+MACRO(CREATE_PLUGIN_MODULE plugname libs plugindir)
+ add_library(${plugname} MODULE $<TARGET_OBJECTS:${plugname}-common>)
+ set_target_properties(${plugname} PROPERTIES
+ PREFIX ""
+ SUFFIX ${PLUGSUFFIX}
+ LIBRARY_OUTPUT_DIRECTORY "${plugindir}"
+ )
+ target_link_libraries(${plugname} ${libs})
+ ADD_DEPENDENCIES(plugin_test_links ${plugname})
ENDMACRO(CREATE_PLUGIN_MODULE plugname)
+
MACRO(CREATE_PLUGIN_TEST plugname file libs)
- PARSE_ARGUMENTS(PLUGIN "TESTLIBS" "" ${ARGN})
- add_executable(test-${plugname} ${file} $<TARGET_OBJECTS:${plugname}-common>)
- IF(NOT WIN32)
- set_target_properties(test-${plugname} PROPERTIES
- COMPILE_FLAGS -DVSTREAM_DOMAIN='"${plugname}"'
- COMPILE_FLAGS -DBOOST_TEST_DYN_LINK)
- ELSE(NOT WIN32)
- set_target_properties(test-${plugname} PROPERTIES
- COMPILE_FLAGS -DBOOST_TEST_DYN_LINK)
- ENDIF(NOT WIN32)
-# target_link_libraries(test-${plugname} ${plugname}-common)
- target_link_libraries(test-${plugname} ${libs} ${BOOST_UNITTEST} "${PLUGIN_TESTLIBS}")
- add_test(${plugname} test-${plugname})
+ IF(MIA_ENABLE_TESTING)
+ PARSE_ARGUMENTS(PLUGIN "TESTLIBS" "" ${ARGN})
+ add_executable(test-${plugname} ${file} $<TARGET_OBJECTS:${plugname}-common>)
+ IF(NOT WIN32)
+ set_target_properties(test-${plugname} PROPERTIES
+ COMPILE_FLAGS -DVSTREAM_DOMAIN='"${plugname}"'
+ COMPILE_FLAGS -DBOOST_TEST_DYN_LINK)
+ ELSE(NOT WIN32)
+ set_target_properties(test-${plugname} PROPERTIES
+ COMPILE_FLAGS -DBOOST_TEST_DYN_LINK)
+ ENDIF(NOT WIN32)
+ target_link_libraries(test-${plugname} ${libs} ${BOOST_UNITTEST} "${PLUGIN_TESTLIBS}")
+ add_test(${plugname} test-${plugname})
+ ENDIF()
ENDMACRO(CREATE_PLUGIN_TEST plugname file)
-MACRO(PLUGIN_WITH_TEST plugname file libs)
+MACRO(PLUGIN_WITH_TEST plugname file libs plugindir)
PARSE_ARGUMENTS(PLUGIN "TESTLIBS" "" ${ARGN})
CREATE_PLUGIN_COMMON(${plugname} ${file} )
- CREATE_PLUGIN_MODULE(${plugname} "${libs}")
+ CREATE_PLUGIN_MODULE(${plugname} "${libs}" ${plugindir})
CREATE_PLUGIN_TEST(${plugname} test_${file} "${libs}" TESTLIBS "${PLUGIN_TESTLIBS}")
ENDMACRO(PLUGIN_WITH_TEST plugname file libs)
@@ -101,7 +106,7 @@ MACRO(PLUGIN_WITH_TEST_AND_PREFIX_NOINST prefix plugname libs)
PARSE_ARGUMENTS(PLUGIN "TESTLIBS" "" ${ARGN})
SET(name ${prefix}-${plugname})
CREATE_PLUGIN_COMMON(${name} ${plugname}.cc "${libs}")
- CREATE_PLUGIN_MODULE(${name})
+ CREATE_PLUGIN_MODULE_OLD(${name})
CREATE_PLUGIN_TEST(${name} test_${plugname}.cc TESTLIBS "${PLUGIN_TESTLIBS}")
ENDMACRO(PLUGIN_WITH_TEST_AND_PREFIX_NOINST prefix plugname file libs)
@@ -109,7 +114,7 @@ MACRO(DEFINE_PLUGIN_NAMES type data rootdir)
FOREACH(d ${data})
SET(${type}_${d}_prefix "${type}-${d}")
SET(${type}_${d}_dir "${rootdir}/${type}/${d}")
- ADD_CUSTOM_TARGET(${type}_${d}_testdir mkdir -p "${PLUGIN_TEST_ROOT}/${${type}_${d}_dir}")
+ SET(${type}_${d}_binary "${type}/${d}")
ENDFOREACH(d)
ENDMACRO(DEFINE_PLUGIN_NAMES type data rootdir)
@@ -118,19 +123,17 @@ MACRO(TEST_PREFIX type data)
string(COMPARE EQUAL "x${${type}_${data}_prefix}" "x" UNDEFINED_PREFIX)
IF(UNDEFINED_PREFIX)
MESSAGE(FATAL_ERROR "PLUGIN_WITH_TEST_AND_PREFIX2: the prefix for ${type}-${data} is not defined")
- ENDIF(UNDEFINED_PREFIX)
+ENDIF(UNDEFINED_PREFIX)
ENDMACRO(TEST_PREFIX type data)
MACRO(PLUGIN_WITH_PREFIX2 type data plugname libs)
TEST_PREFIX(${type} ${data})
SET(install_path ${${type}_${data}_dir})
+ SET(plugin_build_path ${${type}_${data}_binary})
PARSE_ARGUMENTS(PLUGIN "TESTLIBS" "" ${ARGN})
SET(name ${${type}_${data}_prefix}-${plugname})
CREATE_PLUGIN_COMMON(${name} ${plugname}.cc)
- CREATE_PLUGIN_MODULE(${name} "${libs}")
- ADD_CUSTOM_TARGET(${name}_test_link ln -sf "${CMAKE_CURRENT_BINARY_DIR}/${name}.mia"
- ${PLUGIN_TEST_ROOT}/${install_path}/ DEPENDS ${type}_${data}_testdir ${name})
- ADD_DEPENDENCIES(plugin_test_links ${name}_test_link)
+ CREATE_PLUGIN_MODULE(${name} "${libs}" ${PLUGIN_TEST_ROOT}/${plugin_build_path})
INSTALL(TARGETS ${name} LIBRARY DESTINATION ${install_path})
IF(WARN_MISSING_OR_OLD_PLUGINTESTS)
MESSAGE("WARNING: Plugin ${name} does provide no or only old-style testing")
@@ -141,15 +144,13 @@ ENDMACRO(PLUGIN_WITH_PREFIX2 type data plugname libs)
MACRO(PLUGIN_WITH_TEST_AND_PREFIX2 type data plugname libs)
TEST_PREFIX(${type} ${data})
SET(install_path ${${type}_${data}_dir})
+ SET(plugin_build_path ${${type}_${data}_binary})
PARSE_ARGUMENTS(PLUGIN "TESTLIBS" "" ${ARGN})
SET(name ${${type}_${data}_prefix}-${plugname})
CREATE_PLUGIN_COMMON(${name} ${plugname}.cc)
- CREATE_PLUGIN_MODULE(${name} "${libs}")
+ CREATE_PLUGIN_MODULE(${name} "${libs}" "${PLUGIN_TEST_ROOT}/${plugin_build_path}")
CREATE_PLUGIN_TEST(${name} test_${plugname}.cc "${libs}" TESTLIBS "${PLUGIN_TESTLIBS}")
- ADD_CUSTOM_TARGET(${name}_test_link ln -sf "${CMAKE_CURRENT_BINARY_DIR}/${name}.mia"
- ${PLUGIN_TEST_ROOT}/${install_path}/ DEPENDS ${type}_${data}_testdir ${name})
- ADD_DEPENDENCIES(plugin_test_links ${name}_test_link)
INSTALL(TARGETS ${name} LIBRARY DESTINATION ${install_path})
ENDMACRO(PLUGIN_WITH_TEST_AND_PREFIX2 type data plugname libs)
@@ -170,45 +171,50 @@ ENDMACRO(PLUGINGROUP_WITH_TEST_AND_PREFIX2)
MACRO(PLUGIN_WITH_TEST_MULTISOURCE name type data src libs)
+
PARSE_ARGUMENTS(PLUGIN "TESTLIBS" "" ${ARGN})
TEST_PREFIX(${type} ${data})
SET(install_path ${${type}_${data}_dir})
+ SET(plugin_build_path ${${type}_${data}_binary})
SET(plugname ${${type}_${data}_prefix}-${name})
# create common library
ADD_LIBRARY(${plugname}-common OBJECT ${src})
IF(NOT WIN32)
set_source_files_properties(${src} PROPERTIES COMPILE_FLAGS "-fPIC")
- set_target_properties(${plugname}-common PROPERTIES COMPILE_FLAGS -DVSTREAM_DOMAIN='"${plugname}"')
+ set_target_properties(${plugname}-common
+ PROPERTIES
+ COMPILE_FLAGS -DVSTREAM_DOMAIN='"${plugname}"')
ENDIF(NOT WIN32)
# create module
ADD_LIBRARY(${plugname} MODULE $<TARGET_OBJECTS:${plugname}-common>)
- SET_TARGET_PROPERTIES(${plugname} PROPERTIES PREFIX "" SUFFIX ${PLUGSUFFIX})
+ SET_TARGET_PROPERTIES(${plugname} PROPERTIES
+ PREFIX "" SUFFIX ${PLUGSUFFIX}
+ LIBRARY_OUTPUT_DIRECTORY "${PLUGIN_TEST_ROOT}/${plugin_build_path}")
IF(NOT WIN32)
# SET_TARGET_PROPERTIES(${plugname} PROPERTIES LINK_FLAGS "-Wl,--no-gc-sections -Wl,--undefined,get_plugin_interface")
ENDIF(NOT WIN32)
TARGET_LINK_LIBRARIES(${plugname} ${libs})
+ ADD_DEPENDENCIES(plugin_test_links ${plugname})
# create tests
- PARSE_ARGUMENTS(PLUGIN "TESTLIBS" "" ${ARGN})
-
- add_executable(test-${plugname} $<TARGET_OBJECTS:${plugname}-common> test_${name}.cc)
- IF(NOT WIN32)
- set_target_properties(test-${plugname} PROPERTIES
- COMPILE_FLAGS -DVSTREAM_DOMAIN='"${plugname}"'
- COMPILE_FLAGS -DBOOST_TEST_DYN_LINK)
- ELSE(NOT WIN32)
- set_target_properties(test-${plugname} PROPERTIES
- COMPILE_FLAGS -DBOOST_TEST_DYN_LINK)
- ENDIF(NOT WIN32)
- target_link_libraries(test-${plugname} ${libs})
- target_link_libraries(test-${plugname} ${BOOST_UNITTEST} "${PLUGIN_TESTLIBS}")
- add_test(${plugname} test-${plugname})
-
- ADD_CUSTOM_TARGET(${plugname}_test_link ln -sf "${CMAKE_CURRENT_BINARY_DIR}/${plugname}.mia"
- ${PLUGIN_TEST_ROOT}/${install_path}/ DEPENDS ${type}_${data}_testdir ${plugname})
- ADD_DEPENDENCIES(plugin_test_links ${plugname}_test_link)
+ IF(MIA_ENABLE_TESTING)
+ PARSE_ARGUMENTS(PLUGIN "TESTLIBS" "" ${ARGN})
+
+ add_executable(test-${plugname} $<TARGET_OBJECTS:${plugname}-common> test_${name}.cc)
+ IF(NOT WIN32)
+ set_target_properties(test-${plugname} PROPERTIES
+ COMPILE_FLAGS -DVSTREAM_DOMAIN='"${plugname}"'
+ COMPILE_FLAGS -DBOOST_TEST_DYN_LINK)
+ ELSE(NOT WIN32)
+ set_target_properties(test-${plugname} PROPERTIES
+ COMPILE_FLAGS -DBOOST_TEST_DYN_LINK)
+ ENDIF(NOT WIN32)
+ target_link_libraries(test-${plugname} ${libs})
+ target_link_libraries(test-${plugname} ${BOOST_UNITTEST} "${PLUGIN_TESTLIBS}")
+ add_test(${plugname} test-${plugname})
+ endif()
INSTALL(TARGETS ${plugname} LIBRARY DESTINATION ${install_path})
ENDMACRO(PLUGIN_WITH_TEST_MULTISOURCE)
diff --git a/config.h.cmake b/config.h.cmake
index 38d01bd..0dd3d7e 100644
--- a/config.h.cmake
+++ b/config.h.cmake
@@ -46,6 +46,6 @@
#cmakedefine HAVE_JPG 1
#cmakedefine HAVE_NLOPT 1
-
+#cmakedefine MIA_USE_BOOST_REGEX 1
#endif
diff --git a/coverage.sh b/coverage.sh
index 17a9230..934f64a 100755
--- a/coverage.sh
+++ b/coverage.sh
@@ -1,6 +1,10 @@
#!/bin/sh
-make -j8 && make test
+if [ -e Makefile ]; then
+ make -j8 && make test
+elif [-e rules.ninja ]; then
+ ninja && ninja test
+fi
if [ "x$?" = "x0" ]; then
diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt
index 2fa031b..c98386c 100644
--- a/doc/CMakeLists.txt
+++ b/doc/CMakeLists.txt
@@ -100,7 +100,7 @@ IF(MIA_CREATE_USERDOC)
####################################################
#
# installation of the user reference
- IF(ALWAYS_CREATE_DOC)
+ IF(ALWAYS_CREATE_DOC)
INSTALL(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/userref DESTINATION ${DOC_INSTALL_PATH}/)
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/mia2-doc.desktop.cmake ${CMAKE_CURRENT_BINARY_DIR}/mia2-doc.desktop)
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/mia2-doc.desktop DESTINATION ${CMAKE_INSTALL_PREFIX}/share/applications)
diff --git a/doc/MiaDoctools.cmake b/doc/MiaDoctools.cmake
index 332a5fe..b81164d 100644
--- a/doc/MiaDoctools.cmake
+++ b/doc/MiaDoctools.cmake
@@ -32,51 +32,53 @@ MACRO(MIA_PREPARE_AUTODOC prefix)
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)
+
+ # these targets require python
+ IF(MIA_CREATE_MANPAGES OR MIA_CREATE_NIPYPE_INTERFACES OR MIA_CREATE_USERDOC)
FIND_PACKAGE(PythonInterp REQUIRED)
EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} -c "import lxml" RESULT_VARIABLE LXML_ERR)
IF(LXML_ERR)
- MESSAGE(FATAL "Python found, but no pythonl-xml")
+ MESSAGE(STATUS "Python found, but no pythonl-xml, will not build user documentation")
+ SET(MIA_CREATE_MANPAGES FALSE)
+ SET(MIA_CREATE_NIPYPE_INTERFACES FALSE)
+ SET(MIA_CREATE_USERDOC FALSE)
ENDIF(LXML_ERR)
- IF(MIA_CREATE_MANPAGES)
- ADD_CUSTOM_TARGET(manpages ALL)
+ ENDIF()
+
+ IF(MIA_CREATE_MANPAGES)
+ ADD_CUSTOM_TARGET(manpages ALL)
+ ENDIF()
+
+ IF(MIA_CREATE_NIPYPE_INTERFACES)
+ file(WRITE ${NIPYPE_INTERFACE_INIT_FILE} "# Automatically generated file, do not edit\n")
+
+ STRING(COMPARE EQUAL "${CMAKE_INSTALL_PREFIX}" "/usr" INSTALLROOT_IS_USR)
+
+ IF(INSTALLROOT_IS_USR)
+ EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} -c "from distutils.sysconfig import get_python_lib\nimport sys\nsys.stdout.write(get_python_lib())"
+ RESULT_VARIABLE SITEPACKGE_ERR
+ OUTPUT_VARIABLE SITEPACKGE_BASE_PATH)
+ ELSE()
+ EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} -c "import site\nimport sys\nsys.stdout.write(site.getusersitepackages())"
+ RESULT_VARIABLE SITEPACKGE_ERR
+ OUTPUT_VARIABLE SITEPACKGE_BASE_PATH)
ENDIF()
- IF(MIA_CREATE_NIPYPE_INTERFACES)
- file(WRITE ${NIPYPE_INTERFACE_INIT_FILE} "# Automatically generated file, do not edit\n")
-
- STRING(COMPARE EQUAL "${CMAKE_INSTALL_PREFIX}" "/usr" INSTALLROOT_IS_USER)
-
- IF(INSTALLROOT_IS_USER)
- EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} -c "from distutils.sysconfig import get_python_lib\nimport sys\nsys.stdout.write(get_python_lib())"
- RESULT_VARIABLE SITEPACKGE_ERR
- OUTPUT_VARIABLE SITEPACKGE_BASE_PATH)
- ELSE()
- EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} -c "import site\nimport sys\nsys.stdout.write(site.getusersitepackages())"
- RESULT_VARIABLE SITEPACKGE_ERR
- OUTPUT_VARIABLE SITEPACKGE_BASE_PATH)
- ENDIF()
-
- IF(SITEPACKGE_ERR)
- MESSAGE(FATAL "Something went wrong identifying the nipype installation loaction")
- ENDIF()
-
- SET(NIPYPE_INTERFACE_DIR "${SITEPACKGE_BASE_PATH}/${prefix}/nipype/interfaces/")
-
-
-
- MESSAGE(STATUS "Will create nipype interfaces and install to " ${NIPYPE_INTERFACE_DIR})
-
- ADD_CUSTOM_TARGET(nipypeinterfaces ALL)
- INSTALL(FILES ${NIPYPE_INTERFACE_INIT_FILE} DESTINATION ${NIPYPE_INTERFACE_DIR})
+ IF(SITEPACKGE_ERR)
+ MESSAGE(FATAL "Something went wrong identifying the nipype installation loaction")
ENDIF()
+
+ SET(NIPYPE_INTERFACE_DIR "${SITEPACKGE_BASE_PATH}/${prefix}/nipype/interfaces/")
+ MESSAGE(STATUS "Will create nipype interfaces and install to " ${NIPYPE_INTERFACE_DIR})
+
+ ADD_CUSTOM_TARGET(nipypeinterfaces ALL)
+ INSTALL(FILES ${NIPYPE_INTERFACE_INIT_FILE} DESTINATION ${NIPYPE_INTERFACE_DIR})
+ # install empty init files
+ INSTALL(FILES ${MIA_DOCTOOLS_ROOT}/__init__.py DESTINATION ${SITEPACKGE_BASE_PATH}/${prefix})
+ INSTALL(FILES ${MIA_DOCTOOLS_ROOT}/__init__.py DESTINATION ${SITEPACKGE_BASE_PATH}/${prefix}/nipype)
ENDIF()
-
- # install empty init files
- INSTALL(FILES ${MIA_DOCTOOLS_ROOT}/__init__.py DESTINATION ${SITEPACKGE_BASE_PATH}/${prefix})
- INSTALL(FILES ${MIA_DOCTOOLS_ROOT}/__init__.py DESTINATION ${SITEPACKGE_BASE_PATH}/${prefix}/nipype)
ENDMACRO(MIA_PREPARE_AUTODOC)
@@ -89,7 +91,7 @@ ENDMACRO(MIA_PREPARE_AUTODOC)
#
MACRO(MIA_CREATE_EXE_XML_HELP prefix name)
ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_BINARY_DIR}/doc/${prefix}-${name}.xml
- COMMAND MIA_PLUGIN_TESTPATH=${PLUGIN_TEST_ROOT}/${PLUGIN_INSTALL_PATH} ./${prefix}-${name} --help-xml ${CMAKE_BINARY_DIR}/doc/${prefix}-${name}.xml
+ COMMAND MIA_PLUGIN_TESTPATH=${PLUGIN_TEST_ROOT} ./${prefix}-${name} --help-xml ${CMAKE_BINARY_DIR}/doc/${prefix}-${name}.xml
DEPENDS ${prefix}-${name})
ADD_CUSTOM_TARGET(${prefix}-${name}-xml DEPENDS ${CMAKE_BINARY_DIR}/doc/${prefix}-${name}.xml)
@@ -111,9 +113,11 @@ MACRO(MIA_CREATE_NIPYPE_FROM_XML prefix name)
COMMAND ${PYTHON_EXECUTABLE} ${MIA_DOCTOOLS_ROOT}/miaxml2nipype.py -i ${CMAKE_BINARY_DIR}/doc/${prefix}-${name}.xml -o ${${prefix}-${name}-nipype-interface}
MAIN_DEPENDENCY ${CMAKE_BINARY_DIR}/doc/${prefix}-${name}.xml)
+
FILE(APPEND ${NIPYPE_INTERFACE_INIT_FILE} "from .${prefix}_${PythonName} import ${prefix}_${PythonName}\n")
ADD_CUSTOM_TARGET(${prefix}-${name}-nipype DEPENDS ${${prefix}-${name}-nipype-interface})
+ ADD_DEPENDENCIES(${prefix}-${name}-nipype ${prefix}-${name}-xml)
ADD_DEPENDENCIES(nipypeinterfaces ${prefix}-${name}-nipype)
INSTALL(FILES ${${prefix}-${name}-nipype-interface} DESTINATION ${NIPYPE_INTERFACE_DIR})
@@ -128,11 +132,13 @@ MACRO(MIA_CREATE_MANPAGE_FROM_XML prefix name)
SET(${prefix}-${name}-manfile ${CMAKE_CURRENT_BINARY_DIR}/${prefix}-${name}.1)
ADD_CUSTOM_COMMAND(OUTPUT ${${prefix}-${name}-manfile}
COMMAND ${PYTHON_EXECUTABLE} ${MIA_DOCTOOLS_ROOT}/miaxml2man.py ${CMAKE_BINARY_DIR}/doc/${prefix}-${name}.xml >${${prefix}-${name}-manfile}
- MAIN_DEPENDENCY ${CMAKE_BINARY_DIR}/doc/${prefix}-${name}.xml
- )
- ADD_CUSTOM_TARGET(${prefix}-${name}-man DEPENDS ${${prefix}-${name}-manfile})
- add_dependencies(manpages ${prefix}-${name}-man)
- INSTALL(FILES ${${prefix}-${name}-manfile} DESTINATION "share/man/man1")
+ MAIN_DEPENDENCY ${CMAKE_BINARY_DIR}/doc/${prefix}-${name}.xml
+ DEPENDS ${prefix}-${name}-xml
+ )
+ ADD_CUSTOM_TARGET(${prefix}-${name}-man DEPENDS ${${prefix}-${name}-manfile})
+ ADD_DEPENDENCIES(${prefix}-${name}-man ${prefix}-${name}-xml)
+ add_dependencies(manpages ${prefix}-${name}-man)
+ INSTALL(FILES ${${prefix}-${name}-manfile} DESTINATION "share/man/man1")
ENDMACRO(MIA_CREATE_MANPAGE_FROM_XML)
diff --git a/doc/miareadxml.py b/doc/miareadxml.py
index 9be67c5..06d2e9a 100644
--- a/doc/miareadxml.py
+++ b/doc/miareadxml.py
@@ -16,13 +16,14 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
-
+from __future__ import print_function
import string
from lxml import etree
import re
+
xml_namespace = "http://docbook.org/ns/docbook"
-xmlns = "{%s}" % xml_namespace
+xmlns = "{{}}".format(xml_namespace)
# supported tags:
# program main tag
@@ -54,8 +55,8 @@ def get_text_node_simple(tag, text):
return node
-def escape_dash(text):
- return re.sub(r'-', r'\-', text)
+def escape_dash(text):
+ return re.sub(r'-', r'\-', text)
def get_dict_table(dictionary, tabletype):
entry = etree.Element(tabletype, frame="none")
@@ -82,7 +83,7 @@ def get_dict_table(dictionary, tabletype):
class CTextNode:
def __init__(self, node, expect = None):
if not expect is None and node.tag != expect:
- raise ValueError("expected '%s' got '%s'" % (expect, node.tag))
+ raise ValueError("expected '{}' got '{}'".format (expect, node.tag))
self.required = False
self.is_input = False
@@ -96,7 +97,7 @@ class CTextNode:
self.text = self.text + node.text
for child in node.iter("flags"):
- f = string.split(child.text)
+ f = child.text.split()
for ff in f:
self.flags.add(ff)
if child.tail is not None:
@@ -159,26 +160,26 @@ class COption(CTextNode):
else:
flagstring = flagstring + ', ' + f
if self.value_range is not None:
- print ".IP \"%s \-\-%s=(%s); %s in %s\""% (short, self.long, flagstring, self.type, self.value_range)
+ print(".IP \"{} \-\-{}=({}); {} in {}\"".format (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)
+ print( ".IP \"{} \-\-{}=({}); {}\"".format (short, self.long, flagstring, self.type))
else:
- print ".IP \"%s \-\-%s\""% (short, self.long)
+ print( ".IP \"{} \-\-{}\"".format (short, self.long))
else:
if not self.type == "bool":
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)
+ print( ".IP \"{} \-\-{}={}; {} in {}\"".format (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))
+ print( ".IP \"{} \-\-{}={}\"".format (short, self.long, escape_dash(self.default)))
else:
- print ".IP \"%s \-\-%s\""% (short, self.long)
- print escape_dash(self.text),
+ print( ".IP \"{} \-\-{}\"".format (short, self.long))
+ print( escape_dash(self.text), )
self.do_print_man()
def do_print_man(self):
- print ""
+ print( "" )
def write_xml(self, entry):
# create the terminal text
@@ -236,13 +237,13 @@ class CDictOption(COption):
def do_print_man(self):
if len(self.dict) > 0:
- print ""
+ print( "" )
for k in self.dict.keys():
- print ".RS 10"
- print ".I"
- print escape_dash(k)
- print "\(hy %s" % (self.dict[k])
- print ".RE"
+ print( ".RS 10" )
+ print( ".I" )
+ print( escape_dash(k) )
+ print( "\(hy {}".format (self.dict[k]) )
+ print( ".RE" )
def do_write_xml(self, parent):
@@ -267,15 +268,15 @@ class CSetOption(COption):
def do_print_man(self):
if len(self.set) > 0:
- print ""
- print ".RS 10"
- print ".I"
+ print( "" )
+ print( ".RS 10" )
+ print( ".I" )
- print "Supported values are:(",
+ print( "Supported values are:(", )
for k in self.set:
- print "%s, " % (escape_dash(k)),
- print ")"
- print ".RE"
+ print( "{}, ".format (escape_dash(k)), )
+ print( ")" )
+ print( ".RE" )
def do_write_xml(self, parent):
@@ -284,7 +285,7 @@ class CSetOption(COption):
str_list = [" Supported values are:("]
for k in self.set:
- str_list.append("%s, " % (k))
+ str_list.append("{}, ".format (k))
str_list.append(")")
e.text = ''.join(str_list)
@@ -302,7 +303,7 @@ class CIOOption(COption):
self.text = child.tail
def do_print_man(self):
- print " For supported file types see PLUGINS:%s" % (self.factory)
+ print( " For supported file types see PLUGINS:{}".format (self.factory) )
def do_write_xml(self, parent):
parent.text = parent.text + ". For supported file types see "
@@ -321,7 +322,7 @@ class CFactoryOption(COption):
self.text = child.tail
def do_print_man(self):
- print " For supported plugins see PLUGINS:%s" % (self.factory)
+ print( " For supported plugins see PLUGINS:{}".format (self.factory))
def do_write_xml(self, parent):
parent.text = parent.text + ". For supported plug-ins see "
@@ -337,13 +338,13 @@ class CExample(CTextNode):
if child.tag == "Code":
self.code.append(CTextNode(child, "Code"))
else:
- print "unexpected subnode '%s' in example"% (child.tag)
+ print( "unexpected subnode '{}' in example".format (child.tag) )
class CGroup:
def __init__(self, node):
if node.tag != "group":
- raise ValueError("expected 'group' got '%s'" % (node.tag))
+ raise ValueError("expected 'group' got '{}'".format (node.tag))
self.entry = node.tag
self.name = node.get("name")
@@ -359,18 +360,18 @@ class CGroup:
}.get(child.get("type"), lambda n: COption(n))(child)
self.options.append(p)
else:
- print "unexpected subnode '%s' in 'group'"% (child.tag)
+ print( "unexpected subnode '{}' in 'group'".format (child.tag) )
def get_text_element(root, name):
xname = etree.SubElement(root, name)
if xname is None:
- raise ValueError("Program description misses the tag %s"% (name))
+ raise ValueError("Program description misses the tag {}".format (name))
return xname.text
class CParam:
def __init__(self, node):
if node.tag != "param":
- raise ValueError("expected 'param' got '%s'" % (node.tag))
+ raise ValueError("expected 'param' got '{}'".format (node.tag))
self.name = node.get("name")
self.type = node.get("type")
self.default = node.get("default")
@@ -380,7 +381,7 @@ class CParam:
self.flags = set()
for child in node.iter("flags"):
- f = string.split(child.text)
+ f = child.text.split()
for ff in f:
self.flags.add(ff)
if child.tail is not None:
@@ -416,8 +417,8 @@ class CParam:
def print_man(self):
- print ".I"
- print self.name
+ print( ".I" )
+ print( self.name )
if len(self.flags) > 0:
@@ -430,19 +431,19 @@ class CParam:
else:
termtext = termtext + ', ' + f
- termtext = termtext + ", %s)"
- print termtext % (self.type)
+ termtext = termtext + ", {})"
+ print( termtext.format(self.type))
elif self.required:
- print "= (required); %s " % (self.type)
+ print( "= (required); {} ".format (self.type))
else:
- print "= %s; %s " % (escape_dash(self.default), self.type)
- print ".RS 2"
- print "%s." % (escape_dash(self.text))
+ print( "= {}; {} ".format (escape_dash(self.default), self.type))
+ print( ".RS 2" )
+ print( "{}.".format (escape_dash(self.text)) )
self.do_print_man()
- print ".RE"
+ print( ".RE" )
def do_print_man(self):
- print ""
+ print( "" )
def print_xml_help(self, root):
row = etree.SubElement(root, "row")
@@ -505,13 +506,13 @@ class CDictParam(CParam):
self.dict[v.get("name")] = v.text
def do_print_man(self):
- print "Supported values are:"
+ print( "Supported values are:" )
for k in self.dict.keys():
- print ".RS 4"
- print ".I"
- print escape_dash(k)
- print "\(hy %s" % (self.dict[k])
- print ".RE"
+ print( ".RS 4" )
+ print( ".I" )
+ print( escape_dash(k) )
+ print( "\(hy {}".format (self.dict[k]) )
+ print( ".RE" )
CParam.do_print_man(self)
def do_print_xml_help_description(self, row):
@@ -544,10 +545,10 @@ class CSetParam(CParam):
self.set.append(v.get("name"))
def do_print_man(self):
- print "Supported values are:(",
+ print( "Supported values are:(", )
for k in self.set:
- print "%s, " % (escape_dash(k)),
- print ")"
+ print( "{}, ".format (escape_dash(k)), )
+ print( ")" )
CParam.do_print_man(self)
def do_print_xml_help_description(self, row):
@@ -555,7 +556,7 @@ class CSetParam(CParam):
str_list = [self.text, " Supported values are:("]
for k in self.set:
- str_list.append("%s, " % (k))
+ str_list.append("{}, ".format (k))
str_list.append(")")
e.text = ''.join(str_list)
@@ -568,7 +569,7 @@ class CFactoryParam(CParam):
self.factory = n.get("name")
def do_print_man(self):
- print "For supported plug-ins see PLUGINS:%s" % (self.factory)
+ print( "For supported plug-ins see PLUGINS:{}".format (self.factory) )
CParam.do_print_man(self)
def do_print_xml_help_description(self, row):
@@ -578,10 +579,10 @@ class CFactoryParam(CParam):
def append_to_handler(self, handlers, link):
- if handlers.has_key(self.factory):
+ if self.factory in handlers:
handlers[self.factory].append_user(link)
else:
- raise RuntimeError("Handler %s is used by plugin %s, but is not available" % (self.factory, link))
+ raise RuntimeError("Handler {} is used by plugin {}, but is not available".format (self.factory, link))
class CIOParam(CParam):
@@ -593,7 +594,7 @@ class CIOParam(CParam):
self.factory = n.get("name")
def do_print_man(self):
- print "For supported file types see PLUGINS:%s" % (self.factory)
+ print( "For supported file types see PLUGINS:{}".format (self.factory) )
CParam.do_print_man(self)
def do_print_xml_help_description(self, row):
@@ -603,15 +604,15 @@ class CIOParam(CParam):
def append_to_handler(self, handlers, link):
- if handlers.has_key(self.factory):
+ if self.factory in handlers:
handlers[self.factory].append_user(link)
else:
- raise RuntimeError("Handler %s is used by plugin %s, but is not available" % (self.factory, link))
+ raise RuntimeError("Handler {} is used by plugin {}, but is not available".format (self.factory, link))
class CPlugin:
def __init__(self, node, handlername):
if node.tag != "plugin":
- raise ValueError("expected 'plugin' got '%s'" % (node.tag))
+ raise ValueError("expected 'plugin' got '{}'".format (node.tag))
self.name = node.get("name")
self.text = node.text
self.handlername = handlername
@@ -642,7 +643,7 @@ class CPlugin:
elif child.tag == "suffixes":
self.suffixes = child.text
else:
- print "unexpected subnode '%s' in 'plugin'"% (child.tag)
+ print( "unexpected subnode '{}' in 'plugin'".format (child.tag) )
def append_to_handler(self, handlers):
for p in self.params:
@@ -706,7 +707,7 @@ class CPlugin:
class CHandler:
def __init__(self, node):
if node.tag != "handler":
- raise ValueError("expected 'handler' got '%s'" % (node.tag))
+ raise ValueError("expected 'handler' got '{}'".format (node.tag))
self.entry = node.tag
self.name = node.get("name")
self.users = set([])
@@ -717,7 +718,7 @@ class CHandler:
if child.tag == "plugin":
self.plugins.append(CPlugin(child, self.name))
else:
- print "unexpected subnode '%s' in 'handler'" % (child.tag)
+ print( "unexpected subnode '{}' in 'handler'".format (child.tag) )
def append_user(self, user):
self.users.add(user)
@@ -762,7 +763,7 @@ class CDescription:
elif n.tag == "stdout-is-result":
self.stdout_is_result = True
else:
- print "unknown tag '%s'"% (n.tag)
+ print( "unknown tag '{}'".format (n.tag) )
self.anchor = make_sec_ancor("Sec", self.name)
self.link_handler_consumers()
diff --git a/doc/miawritprogram.py b/doc/miawritprogram.py
index 42a87c4..87ab29c 100644
--- a/doc/miawritprogram.py
+++ b/doc/miawritprogram.py
@@ -112,9 +112,9 @@ def get_program(program):
screen = etree.SubElement(section, "screen")
screen.text = program.name + " " + c.text
else:
- print "Warning: %s doesn't provide example text" % (program.name)
+ print( "Warning: {} doesn't provide example text".format (program.name) )
else:
- print "Warning: %s doesn't provide an example" % (program.name)
+ print( "Warning: {} doesn't provide an example".format (program.name) )
section.append(get_bridgehead("Author(s):"))
section.append(get_text_node_simple("para", program.author))
@@ -136,7 +136,7 @@ def get_section(name, sect):
if sect.description is not None:
descr = translate_descr(section, sect.description)
else:
- print "Warning: Section ", name, " doesn't have a description"
+ print( "Warning: Section ", name, " doesn't have a description" )
para = etree.SubElement(section, "para", role="sectiontoc")
@@ -156,7 +156,7 @@ def get_plugin(plugin):
return result
def get_plugins(name, handler):
-# print name
+# print( name )
section = make_section_root_node("section", "Plugin type: " + name)
para = etree.SubElement(section, "para", role="plugdescr")
para.text = handler.description
@@ -174,7 +174,7 @@ def get_plugins(name, handler):
handler_users = []
for u in handler.users:
handler_users.append(u)
- handler_users.sort()
+ handler_users = sorted(handler_users)
for u in handler_users:
etree.SubElement(para, "xref", linkend=u)
diff --git a/doc/miaxml2man.py b/doc/miaxml2man.py
index 77132ac..bdfd1a2 100644
--- a/doc/miaxml2man.py
+++ b/doc/miaxml2man.py
@@ -24,7 +24,13 @@ import sys
import time
import calendar
import string
-import htmlentitydefs
+
+python_version = sys.version_info.major
+if python_version >= 3:
+ from html.entities import name2codepoint
+else:
+ from htmlentitydefs import name2codepoint
+
import re
sys.dont_write_bytecode = True
@@ -37,7 +43,7 @@ from miareadxml import parse_file
def get_date_string():
lt = time.localtime(time.time())
- return "%d %s %d"% (lt.tm_mday, calendar.month_name[lt.tm_mon], lt.tm_year)
+ return "{} {} {}".format (lt.tm_mday, calendar.month_name[lt.tm_mon], lt.tm_year)
#taken from http://effbot.org/zone/re-sub.htm#unescape-html
@@ -56,7 +62,7 @@ def unescape(text):
else:
# named entity
try:
- text = unichr(htmlentitydefs.name2codepoint[text[1:-1]])
+ text = unichr(name2codepoint[text[1:-1]])
except KeyError:
pass
return text # leave as is
@@ -71,79 +77,78 @@ def clean (text):
def write_man_file(descr):
name = escape_dash(descr.name)
- print ".TH %s 1 \"v%s\" \"USER COMMANDS\"" %(escape_dash(descr.name), descr.version)
- print ".SH NAME"
- print name,
- print "\- %s" % (clean(descr.whatis))
- print ".SH SYNOPSIS"
- print ".B %s"% (clean(descr.basic_usage))
- print ".SH DESCRIPTION"
- print ".B %s"% (name)
- print descr.description
- print ".SH OPTIONS"
+ print(".TH {} 1 \"v{}\" \"USER COMMANDS\"".format(escape_dash(descr.name), descr.version))
+ print(".SH NAME")
+ print(name,)
+ print("\- {}".format (clean(descr.whatis)))
+ print(".SH SYNOPSIS")
+ print(".B {}".format (clean(descr.basic_usage)))
+ print(".SH DESCRIPTION")
+ print(".B {}".format (name))
+ print(descr.description)
+ print(".SH OPTIONS")
for g in descr.option_groups:
if len(g.name) > 0:
- print ".SS %s"% (g.name)
+ print(".SS {}".format(g.name))
- print ".RS"
+ print(".RS")
for o in g.options:
o.print_man()
- print ".RE"
+ print(".RE")
- handlerkeys = descr.handlers.keys()
- handlerkeys.sort()
+ handlerkeys = sorted(descr.handlers.keys())
for k in handlerkeys:
h = descr.handlers[k]
- print ".SH PLUGINS: %s" % (h.name)
+ print(".SH PLUGINS: {}".format (h.name))
for p in h.plugins:
- print ".TP 10"
- print ".B %s" % p.name
+ print(".TP 10")
+ print(".B {}".format(p.name))
if len(p.params) > 0:
- print "%s, supported parameters are: " % (p.text)
- print ".P"
+ print("{}, supported parameters are: ".format (p.text))
+ print(".P")
for o in p.params:
- print ".RS 14"
+ print(".RS 14")
o.print_man()
- print ".RE"
+ print(".RE")
else:
- print p.text
- print ".P"
+ print(p.text)
+ print(".P")
if not p.no_params_info:
- print ".RS 14"
- print "(no parameters)"
- print ".RE"
+ print(".RS 14")
+ print("(no parameters)")
+ print(".RE")
if p.suffixes is not None:
- print ".RS 14"
- print "Recognized file extensions: ", p.suffixes
- print ".RE"
- print " "
+ print(".RS 14")
+ print("Recognized file extensions: ", p.suffixes)
+ print(".RE")
+ print(" ")
if p.supported_types is not None:
- print ".RS 14"
- print "Supported element types: "
- print ".RS 2"
- print p.supported_types
- print ".RE"
- print " "
- print ".RE"
+ print(".RS 14")
+ print("Supported element types: ")
+ print(".RS 2")
+ print(p.supported_types)
+ print(".RE")
+ print(" ")
+ print(".RE")
if descr.Example.text is not None and len(descr.Example.text) > 0:
- print ".SH EXAMPLE"
- print clean(descr.Example.text)
+ print(".SH EXAMPLE")
+ print(clean(descr.Example.text))
for c in descr.Example.code:
- print ".HP"
- print "%s %s" % (name, clean(c.text))
+ print(".HP")
+ print("{} {}".format (name, clean(c.text)))
- print ".SH AUTHOR(s)"
- print clean(descr.author)
+ print(".SH AUTHOR(s)")
+ print(clean(descr.author))
- print ".SH COPYRIGHT"
- print """This software is Copyright (c) 1999\(hy2015 Leipzig, Germany and Madrid, Spain.
+ print(".SH COPYRIGHT")
+ 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'."""
+information run the program with the option '\-\-copyright'.""")
X=parse_file(sys.argv[1])
diff --git a/doc/miaxml2nipype.py b/doc/miaxml2nipype.py
index 62a8810..4bcdbde 100644
--- a/doc/miaxml2nipype.py
+++ b/doc/miaxml2nipype.py
@@ -24,10 +24,15 @@ import sys
import time
import calendar
import string
-import htmlentitydefs
import re
from os import path
+python_version = sys.version_info.major
+if python_version >= 3:
+ from html.entities import name2codepoint
+else:
+ from htmlentitydefs import name2codepoint
+
from argparse import ArgumentParser
from argparse import RawTextHelpFormatter
@@ -51,7 +56,7 @@ from miareadxml import parse_file
def get_date_string():
lt = time.localtime(time.time())
- return "%d %s %d"% (lt.tm_mday, calendar.month_name[lt.tm_mon], lt.tm_year)
+ return "{} {} {}".format(lt.tm_mday, calendar.month_name[lt.tm_mon], lt.tm_year)
#taken from http://effbot.org/zone/re-sub.htm#unescape-html
@@ -105,13 +110,21 @@ class NipypeOutput:
"vdouble" :lambda i : self.create_vfloat_param(i),
"vfloat" :lambda i : self.create_vfloat_param(i),
- "bool" : lambda i : self.create_Bool_param(i),
+ "bool" : lambda i : self.create_Bool_param(i),
+
"short" : lambda i : self.create_Integral_param(i),
"int" : lambda i : self.create_Integral_param(i),
"long" : lambda i : self.create_Integral_param(i),
"ushort": lambda i : self.create_Integral_param(i),
"uint" : lambda i : self.create_Integral_param(i),
- "ulong" : lambda i : self.create_Integral_param(i),
+ "ulong" : lambda i : self.create_Integral_param(i),
+
+ "int16_t" : lambda i : self.create_Integral_param(i),
+ "int32_t" : lambda i : self.create_Integral_param(i),
+ "int64_t" : lambda i : self.create_Integral_param(i),
+ "uint16_t": lambda i : self.create_Integral_param(i),
+ "uint32_t" : lambda i : self.create_Integral_param(i),
+ "uint64_t" : lambda i : self.create_Integral_param(i),
"float" : lambda i : self.create_Float_param(i),
"double": lambda i : self.create_Float_param(i),
diff --git a/doc/miaxml2sgml.py b/doc/miaxml2sgml.py
index ae0edf7..59ee837 100644
--- a/doc/miaxml2sgml.py
+++ b/doc/miaxml2sgml.py
@@ -32,10 +32,9 @@ import calendar
import string
from lxml import etree
import re
-from os.path import walk
+from os import listdir
from fnmatch import fnmatch
-
sys.dont_write_bytecode = True
modules = {'miareadxml' : [0, '', 'none://miareadxml.py' ],
@@ -60,24 +59,16 @@ def create_text_node(tag, text):
def get_date_string():
lt = time.localtime(time.time())
- return "%d %s %d"% (lt.tm_mday, calendar.month_name[lt.tm_mon], lt.tm_year)
-
-
-class CPatternCollector:
- def __init__(self, pattern):
- self.pattern = pattern
- self.files=[]
-
-
-def collect_files(arg, dirname, names):
- for f in names:
- if fnmatch(f, arg.pattern):
- arg.files.append(dirname + "/" + f)
-
+ return "{} {} {]".format(lt.tm_mday, calendar.month_name[lt.tm_mon], lt.tm_year)
+
def find_files(root, pattern):
- arg = CPatternCollector(pattern)
- walk(root, collect_files, arg)
- return arg.files
+ files = listdir(root)
+ outfiles = []
+ for f in files:
+ if fnmatch(f, pattern):
+ outfiles.append(f)
+
+ return outfiles
class CProgramSection:
def __init__(self, node=None, name=None, idx=0):
@@ -120,7 +111,7 @@ for f in files:
d = parse_file(f)
descriptions.append(d)
except ValueError as e:
- print e
+ print (e)
#
@@ -135,15 +126,15 @@ index = len(program_sections)
#
plugin_types = {}
for d in descriptions:
- if not program_sections.has_key(d.section):
+ if not d.section in program_sections:
program_sections[d.section] = CProgramSection(name=d.section, idx=index)
index = index + 1
- print "Warning: Program '%s' is listed in section '%s', but this section is not described in doc/sections.xml" % (d.name, d.section)
+ print( "Warning: Program '{}' is listed in section '{}', but this section is not described in doc/sections.xml".format(d.name, d.section))
program_sections[d.section].programs.append(d)
for h in d.handlers.keys():
k = d.handlers[h].name
- if not plugin_types.has_key(k):
+ if not k in plugin_types:
plugin_types[k] = d.handlers[h]
else:
plugin_types[k].merge_users(d.handlers[h].users)
@@ -165,15 +156,14 @@ sorted_sections = {}
for s in program_sections.keys():
sorted_sections[program_sections[s].sortindex] = s
-sorted_sections_keys = sorted_sections.keys()
-sorted_sections_keys.sort()
+sorted_sections_keys = sorted(sorted_sections.keys())
for i in sorted_sections_keys:
s = sorted_sections[i]
prog_xml.append(get_section(s, program_sections[s]))
programs_xml = etree.tostring(prog_xml, pretty_print=True)
-prog_file = open(outpath + "/program.xml", "w")
+prog_file = open(outpath + "/program.xml", "wb")
prog_file.write(programs_xml)
prog_file.close()
@@ -181,13 +171,12 @@ plug_xml = etree.Element("chapter", id="plugins", nsmap=NSMAP)
title = create_text_node("title", "Plugin Reference")
plug_xml.append(title)
-plugin_types_keys = plugin_types.keys()
-plugin_types_keys.sort()
+plugin_types_keys = sorted(plugin_types.keys())
for s in plugin_types_keys:
plug_xml.append(get_plugins(s, plugin_types[s]))
plugins_xml = etree.tostring(plug_xml, pretty_print=True)
-plug_file = open(outpath + "/plugins.xml", "w")
+plug_file = open(outpath + "/plugins.xml", "wb")
plug_file.write(plugins_xml)
plug_file.close()
diff --git a/doc/reference.dox.cmake b/doc/reference.dox.cmake
index 1dde5ec..da6b22f 100644
--- a/doc/reference.dox.cmake
+++ b/doc/reference.dox.cmake
@@ -72,7 +72,8 @@ COLS_IN_ALPHA_INDEX = 5
IGNORE_PREFIX =
GENERATE_HTML = YES
HTML_OUTPUT =
-HTML_FILE_EXTENSION = .html
+HTML_FILE_EXTENSION = .html
+HTML_TIMESTAMP = NO
HTML_HEADER =
HTML_FOOTER =
HTML_STYLESHEET =
diff --git a/mia/2d.hh b/mia/2d.hh
index 4bad3d2..2036193 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 a4d6198..1905b19 100644
--- a/mia/2d/CMakeLists.txt
+++ b/mia/2d/CMakeLists.txt
@@ -55,6 +55,8 @@ SET(MIA2D_SRC_BASE
transformfactory.cc
vectorfield.cc
vfio.cc
+ vfregularizer.cc
+ vfregularizerkernel.cc
)
@@ -75,45 +77,31 @@ SET(SEG_HEADER
segsetwithimages.hh
)
-IF(ITPP_FOUND)
- SET(ITPP_SRC
- ica.cc
- perfusion.cc
- )
- SET(ITPP_HEADER
- ica.hh
- perfusion.hh
- )
-ENDIF(ITPP_FOUND)
-
SET(MIA2D_SRC ${MIA2D_SRC_BASE} ${MIA2D_FFTW_CODE})
SET(MIA2D_HEADERS_BASE
angle.hh
- datafield.hh datafield.cxx
- filter.hh
- image.hh
- imageio.hh
- imageiotest.hh
- vector.hh
- vectorfield.hh
- vfio.hh
boundingbox.hh
cost.hh
correlation_weight.hh
creator.hh
cstkernel.hh
+ datafield.hh datafield.cxx
defines2d.hh
deformer.hh
distance.hh
- fullcost.hh
fftkernel.hh
+ filter.hh
+ fullcost.hh
fuzzyseg.hh
fuzzyclustersolver_sor.hh
fuzzyclustersolver_cg.hh
ground_truth_evaluator.hh
groundtruthproblem.hh
- interpolator.hh
+ image.hh
+ imageio.hh
+ imageiotest.hh
+ interpolator.hh interpolator.cxx
iterator.hh
iterator.cxx
matrix.hh
@@ -139,7 +127,11 @@ SET(MIA2D_HEADERS_BASE
transformmock.hh
transformio.hh
transformfactory.hh
- interpolator.hh interpolator.cxx
+ vector.hh
+ vectorfield.hh
+ vfio.hh
+ vfregularizer.hh
+ vfregularizerkernel.hh
)
SET(MIA2D_HEADERS ${MIA2D_HEADERS_BASE} ${SEG_HEADER} ${ITPP_HEADER})
@@ -181,6 +173,7 @@ MACRO(TEST_2DMIA file libs)
ADD_TEST(2d-${file} test-2d-${file})
ENDMACRO(TEST_2DMIA file)
+IF(MIA_ENABLE_TESTING)
TEST_2DMIA(angle mia2d)
TEST_2DMIA(datafield mia2dtest)
TEST_2DMIA(image mia2dtest)
@@ -202,7 +195,7 @@ TEST_2DMIA(polygon mia2dtest)
TEST_2DMIA(ppmatrix mia2dtest)
TEST_2DMIA(rigidregister mia2dtest)
TEST_2DMIA(transformfactory mia2dtest)
-TEST_2DMIA(vectorfield_interpolator mia2dtest)
+TEST_2DMIA(vectorfield mia2dtest)
TEST_2DMIA(similarity_profile mia2dtest)
TEST_2DMIA(transio mia2d)
TEST_2DMIA(transform mia2dtest)
@@ -213,6 +206,7 @@ TEST_2DMIA(sparse_image_solver mia2dtest)
TEST_2DMIA(filter_cast mia2d)
TEST_2DMIA(splinetransformpenalty mia2d)
TEST_2DMIA(trackpoint mia2dtest)
+ENDIF()
IF(CMAKE_BUILD_TYPE)
SET(CONFIG ${CMAKE_BUILD_TYPE})
@@ -232,18 +226,19 @@ INSTALL(FILES ${MIA2D_HEADERS} DESTINATION ${INCLUDE_INSTALL_PATH}/mia/2d)
SET(MIA2D_MYOCARDPERF_SRC
${SEG_SRC}
- ${ITPP_SRC}
ground_truth_evaluator.cc
groundtruthproblem.cc
-
-)
+ ica.cc
+ perfusion.cc
+ )
SET(MIA2D_MYOCARDPERF_HEADER
${SEG_HEADER}
- ${ITPP_HEADER}
ground_truth_evaluator.hh
groundtruthproblem.hh
-)
+ ica.hh
+ perfusion.hh
+ )
MIA_ADD_LIBRARY(mia2dmyocardperf "${MIA2D_MYOCARDPERF_SRC}" mia2d)
@@ -257,11 +252,13 @@ ENDIF(ITPP_FOUND)
set(testperflibs mia2dmyocardperf mia2dtest)
+IF(MIA_ENABLE_TESTING)
TEST_2DMIA(groundtruthproblem mia2dmyocardperf)
TEST_2DMIA(correlation_weight mia2dmyocardperf)
TEST_2DMIA(segmentation mia2dmyocardperf)
TEST_2DMIA(segframe "${testperflibs}")
TEST_2DMIA(segpoint mia2dmyocardperf)
+ENDIF()
#
@@ -284,3 +281,5 @@ ADD_SUBDIRECTORY(timestep )
ADD_SUBDIRECTORY(transform )
ADD_SUBDIRECTORY(transio )
ADD_SUBDIRECTORY(splinepenalty )
+ADD_SUBDIRECTORY(vfregularizer )
+ADD_SUBDIRECTORY(vfregularizerkernel )
diff --git a/mia/2d/angle.cc b/mia/2d/angle.cc
index 75df7a4..20fde9f 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 355561b..e6d52d2 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 d8ee67c..2d7c73a 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 47daa8c..6ea2da8 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 86aa726..2143a81 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 7b831fd..9ecf435 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 7f68cd0..25848a9 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 c674974..211dcf6 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 ba2dc09..d704a78 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 05d9009..5f6f9d7 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 3e41e15..259ec30 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 4ede905..625f79e 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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
index 88757e0..da9f692 100644
--- a/mia/2d/cost/gncc.cc
+++ b/mia/2d/cost/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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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.hh b/mia/2d/cost/gncc.hh
index 8028edf..b9781c6 100644
--- a/mia/2d/cost/gncc.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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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/lncc.cc b/mia/2d/cost/lncc.cc
index 5f90c1e..9a69101 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,6 +34,7 @@ using std::make_pair;
CLNCC2DImageCost::CLNCC2DImageCost(int hw):
m_hwidth(hw)
{
+ m_copy_to_double = produce_2dimage_filter("convert:repn=double,map=copy");
}
inline pair<C2DBounds, C2DBounds> prepare_range(const C2DBounds& size, int cx, int cy, int hw)
@@ -60,8 +61,7 @@ public:
m_hw(hw)
{}
- template <typename T, typename R>
- float operator () ( const T& mov, const R& ref) const {
+ float operator () ( const C2DDImage& mov, const C2DDImage& ref) const {
auto evaluate_local_cost = [this, &mov, &ref](const C1DParallelRange& range, const pair<float, int>& result) -> pair<float, int> {
CThreadMsgStream msks;
float lresult = 0.0;
@@ -106,8 +106,12 @@ public:
double CLNCC2DImageCost::do_value(const Data& a, const Data& b) const
{
- FEvalCost ecost(m_hwidth);
- return mia::filter(ecost, a, b);
+ FEvalCost ecost(m_hwidth);
+ auto a_double_ptr = m_copy_to_double->filter(a);
+ auto b_double_ptr = m_copy_to_double->filter(b);
+ const C2DDImage& mov = static_cast<const C2DDImage&>(*a_double_ptr);
+ const C2DDImage& ref = static_cast<const C2DDImage&>(*b_double_ptr);
+ return ecost(mov, ref);
}
@@ -120,8 +124,7 @@ public:
m_force(force)
{}
- template <typename T, typename R>
- float operator () ( const T& mov, const R& ref) const {
+ float operator () (const C2DDImage& mov, const C2DDImage& ref) const {
auto ag = get_gradient(mov);
auto evaluate_local_cost_force = [this, &mov, &ref, &ag](const C1DParallelRange& range,
const pair<float, int>& result) -> pair<float, int> {
@@ -175,8 +178,13 @@ public:
double CLNCC2DImageCost::do_evaluate_force(const Data& a, const Data& b, Force& force) const
{
- FEvalCostForce ecostforce(m_hwidth, force);
- return mia::filter(ecostforce, a, b);
+ FEvalCostForce ecostforce(m_hwidth, force);
+ auto a_double_ptr = m_copy_to_double->filter(a);
+ auto b_double_ptr = m_copy_to_double->filter(b);
+ const C2DDImage& mov = static_cast<const C2DDImage&>(*a_double_ptr);
+ const C2DDImage& ref = static_cast<const C2DDImage&>(*b_double_ptr);
+
+ return ecostforce(mov, ref);
}
diff --git a/mia/2d/cost/lncc.hh b/mia/2d/cost/lncc.hh
index 7a7f026..a210f2e 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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_2d_maskedcost_lncc_hh
#include <mia/2d/cost.hh>
+#include <mia/2d/filter.hh>
#define NS mia_2d_lncc
@@ -35,7 +36,8 @@ public:
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;
- int m_hwidth;
+ int m_hwidth;
+ mia::P2DFilter m_copy_to_double;
};
class CLNCC2DImageCostPlugin: public mia::C2DImageCostPlugin {
diff --git a/mia/2d/cost/lsd.cc b/mia/2d/cost/lsd.cc
index 0aee76a..df7e7ab 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 a25d9a6..ba614dc 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 29f1f95..edb5612 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 7ee95a0..750a23d 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 f9f7332..c71af6e 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,27 +31,25 @@ using namespace mia;
CNCC2DImageCost::CNCC2DImageCost()
{
+ m_copy_to_double = produce_2dimage_filter("convert:repn=double,map=copy");
}
-template <typename T, typename S>
struct FEvaluateNCCSum {
- FEvaluateNCCSum(const T& mov, const S& ref);
+ FEvaluateNCCSum(const C2DDImage& mov, const C2DDImage& ref);
NCCSums operator ()(const C1DParallelRange& range, const NCCSums& sumacc) const;
private:
- T m_mov;
- S m_ref;
+ const C2DDImage& m_mov;
+ const C2DDImage& m_ref;
};
-template <typename T, typename S>
-FEvaluateNCCSum<T,S>::FEvaluateNCCSum(const T& mov, const S& ref):
+FEvaluateNCCSum::FEvaluateNCCSum(const C2DDImage& mov, const C2DDImage& ref):
m_mov(mov), m_ref(ref)
{
}
-template <typename T, typename S>
-NCCSums FEvaluateNCCSum<T,S>::operator ()(const C1DParallelRange& range, const NCCSums& sumacc) const
+NCCSums FEvaluateNCCSum::operator ()(const C1DParallelRange& range, const NCCSums& sumacc) const
{
CThreadMsgStream msks;
@@ -69,79 +67,60 @@ NCCSums FEvaluateNCCSum<T,S>::operator ()(const C1DParallelRange& range, const N
return sum + sumacc;
};
-
-class FEvalCost : public TFilter<float> {
-public:
- template <typename T, typename R>
- float operator () ( const T& mov, const R& ref) const {
-
- FEvaluateNCCSum<T,R> ev(mov, ref);
- NCCSums sum;
- sum = preduce(C1DParallelRange(0, mov.get_size().y, 1), sum, ev,
- [](const NCCSums& x, const NCCSums& y){
- return x + y;
- });
- return sum.value();
- }
-};
-
-
double CNCC2DImageCost::do_value(const Data& a, const Data& b) const
{
- FEvalCost ecost;
- return mia::filter(ecost, a, b);
-}
+ auto a_double_ptr = m_copy_to_double->filter(a);
+ auto b_double_ptr = m_copy_to_double->filter(b);
+ const C2DDImage& a_double = static_cast<const C2DDImage&>(*a_double_ptr);
+ const C2DDImage& b_double = static_cast<const C2DDImage&>(*b_double_ptr);
+ FEvaluateNCCSum ev(a_double, b_double);
+ NCCSums sum;
+
+ sum = preduce(C1DParallelRange(0, a_double.get_size().y, 1), sum, ev,
+ [](const NCCSums& x, const NCCSums& y){
+ return x + y;
+ });
+ return sum.value();
+}
-class FEvalCostForce : public TFilter<float> {
- C2DFVectorfield& m_force;
-public:
- FEvalCostForce(C2DFVectorfield& force):
- m_force(force)
- {}
+double CNCC2DImageCost::do_evaluate_force(const Data& a, const Data& b, Force& force) const
+{
+ auto a_double_ptr = m_copy_to_double->filter(a);
+ auto b_double_ptr = m_copy_to_double->filter(b);
+ const C2DDImage& a_double = static_cast<const C2DDImage&>(*a_double_ptr);
+ const C2DDImage& b_double = static_cast<const C2DDImage&>(*b_double_ptr);
- template <typename T, typename R>
- float operator () ( const T& mov, const R& ref) const {
- CThreadMsgStream msks;
-
- NCCSums sum;
- FEvaluateNCCSum<T,R> ev(mov, ref);
- sum = preduce(C1DParallelRange(0, mov.get_size().y, 1), sum, ev,
- [](const NCCSums& x, const NCCSums& y){
- return x + y;
- });
-
- auto geval = sum.get_grad_helper();
-
- auto grad = get_gradient(mov);
- auto grad_eval = [this, &mov, &ref, &grad, &geval](const C1DParallelRange& range) {
- for (auto y = range.begin(); y != range.end(); ++y) {
- auto ig = grad.begin_at(0,y);
- auto iforce = m_force.begin_at(0,y);
- auto ia = mov.begin_at(0,y);
- auto ib = ref.begin_at(0,y);
- auto eb = ref.begin_at(0,y+1);
-
- while (ib != eb) {
- *iforce = geval.second.get_gradient_scale(*ia, *ib) * *ig;
- ++ig;
- ++iforce;
- ++ia; ++ib;
- }
- };
+ NCCSums sum;
+ FEvaluateNCCSum ev(a_double, b_double);
+ sum = preduce(C1DParallelRange(0, a_double.get_size().y, 1), sum, ev,
+ [](const NCCSums& x, const NCCSums& y){
+ return x + y;
+ });
+
+ auto geval = sum.get_grad_helper();
+
+ auto grad = get_gradient(a_double);
+ auto grad_eval = [&force, &a_double, &b_double, &grad, &geval](const C1DParallelRange& range) {
+ for (auto y = range.begin(); y != range.end(); ++y) {
+ auto ig = grad.begin_at(0,y);
+ auto iforce = force.begin_at(0,y);
+ auto ia = a_double.begin_at(0,y);
+ auto ib = b_double.begin_at(0,y);
+ auto eb = b_double.begin_at(0,y+1);
+
+ while (ib != eb) {
+ *iforce = geval.second.get_gradient_scale(*ia, *ib) * *ig;
+ ++ig;
+ ++iforce;
+ ++ia; ++ib;
+ }
};
+ };
- pfor(C1DParallelRange(0, mov.get_size().y, 1), grad_eval);
-
- return geval.first;
- }
+ pfor(C1DParallelRange(0, a_double.get_size().y, 1), grad_eval);
-};
-
-double CNCC2DImageCost::do_evaluate_force(const Data& a, const Data& b, Force& force) const
-{
- FEvalCostForce ecostforce(force);
- return mia::filter(ecostforce, a, b);
+ return geval.first;
}
diff --git a/mia/2d/cost/ncc.hh b/mia/2d/cost/ncc.hh
index 17f8389..d0f7883 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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_2d_cost_ncc_hh
#include <mia/2d/cost.hh>
+#include <mia/2d/filter.hh>
#define NS mia_2d_ncc
@@ -35,7 +36,8 @@ public:
CNCC2DImageCost();
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;
+ mia::P2DFilter m_copy_to_double;
};
class CNCC2DImageCostPlugin: public mia::C2DImageCostPlugin {
diff --git a/mia/2d/cost/ngf.cc b/mia/2d/cost/ngf.cc
index a2797ea..6e63f64 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -263,7 +263,7 @@ C2DImageCost *C2DNFGImageCostPlugin::do_create()const
const string C2DNFGImageCostPlugin::do_get_descr()const
{
return "This function evaluates the image similarity based on normalized gradient fields. "
- "Various evaluation kernels are availabe.";
+ "Various evaluation kernels are available.";
}
diff --git a/mia/2d/cost/ngf.hh b/mia/2d/cost/ngf.hh
index cb8ca1b..d05e32a 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 45999c5..ecc4e00 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 2dd1ccd..c7b2ba0 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 6f59f10..5f02665 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 e23ba43..4433103 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 e362983..5c97f99 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 13cac5d..2591740 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 406fd12..e1fcebb 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 01f3847..9fa49fe 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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_gncc.cc b/mia/2d/cost/test_gncc.cc
index 7594cf1..41660fd 100644
--- a/mia/2d/cost/test_gncc.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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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_lncc.cc b/mia/2d/cost/test_lncc.cc
index c14fe16..c4cd775 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 3243ba9..90edd2d 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 0d8e64a..e294808 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 ab09122..96824a5 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 0d4c760..dc57720 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 4554fcc..7afc0f1 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 7e075d9..55a52bf 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 83d8a56..76fcbb4 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 c08dc3b..505ce64 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 ed0cb28..6f2911c 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 07773ce..dea150a 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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.hh b/mia/2d/creator/circle.hh
index 8766947..3b06cce 100644
--- a/mia/2d/creator/circle.hh
+++ b/mia/2d/creator/circle.hh
@@ -1,7 +1,7 @@
/* -*- mia-c++ -*-
*
* This file is part of MIA - a toolbox for medical image analysis
- * Copyright (c) Leipzig, Madrid 1999-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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/test_circle.cc b/mia/2d/creator/test_circle.cc
index 8291d33..d72f0be 100644
--- a/mia/2d/creator/test_circle.cc
+++ b/mia/2d/creator/test_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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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.cc b/mia/2d/cstkernel.cc
index 42f0316..8e48911 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 c8994f8..98160d4 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 adc2128..2a1f862 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,37 +27,49 @@
NS_MIA_BEGIN
#define INSTANCIATE(TYPE) \
- template class EXPORT_2D EXPORT_2D T2DDatafield<TYPE>; \
- template class EXPORT_2D range2d_iterator<T2DDatafield<TYPE>::iterator>; \
- template class EXPORT_2D range2d_iterator<T2DDatafield<TYPE>::const_iterator>; \
- template class EXPORT_2D range2d_iterator_with_boundary_flag<T2DDatafield<TYPE>::iterator>; \
- template class EXPORT_2D range2d_iterator_with_boundary_flag<T2DDatafield<TYPE>::const_iterator>;
+ template class EXPORT_2D T2DDatafield<TYPE>; \
+ template class EXPORT_2D range2d_iterator<T2DDatafield<TYPE>::iterator>; \
+ template class EXPORT_2D range2d_iterator<T2DDatafield<TYPE>::const_iterator>; \
+ template class EXPORT_2D range2d_iterator_with_boundary_flag<T2DDatafield<TYPE>::iterator>; \
+ template class EXPORT_2D range2d_iterator_with_boundary_flag<T2DDatafield<TYPE>::const_iterator>;
+#ifdef __GNUC__
+#pragma GCC diagnostic push
+#ifndef __clang__
+#pragma GCC diagnostic ignored "-Wattributes"
+#endif
+#endif
-INSTANCIATE(float);
-#ifdef LONG_64BIT
-INSTANCIATE(signed long);
-INSTANCIATE(unsigned long);
-#endif
+INSTANCIATE(float);
INSTANCIATE(double);
-INSTANCIATE(unsigned int);
-INSTANCIATE(signed int);
-INSTANCIATE(unsigned short);
-INSTANCIATE(signed short);
-INSTANCIATE(unsigned char);
-INSTANCIATE(signed char);
+INSTANCIATE(int64_t);
+INSTANCIATE(uint64_t);
+INSTANCIATE(int32_t);
+INSTANCIATE(uint32_t);
+INSTANCIATE(int16_t);
+INSTANCIATE(uint16_t);
+INSTANCIATE(int8_t);
+INSTANCIATE(uint8_t);
+
+INSTANCIATE(C2DBounds);
+INSTANCIATE(C2DFVector)
+INSTANCIATE(C2DDVector)
+
template class EXPORT_2D T2DDatafield<bool>;
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 TTranslator<C2DFVector>;
template class EXPORT_2D TAttribute<C2DFVector>;
+#ifdef __GNUC__
+#pragma GCC diagnostic pop
+#endif
+
NS_MIA_END
diff --git a/mia/2d/datafield.cxx b/mia/2d/datafield.cxx
index 0a70fe0..a7b826c 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,44 +29,72 @@
NS_MIA_BEGIN
+template <class T> T2DDatafield<T>::T2DDatafield():
+ m_size(0,0)
+{
+}
+
template <class T>
-T2DDatafield<T>::T2DDatafield(const C2DBounds& _Size):
- m_size(_Size),
- m_data(new data_array(m_size.x * m_size.y))
+T2DDatafield<T>::T2DDatafield(const T2DDatafield<T>& org):
+ m_size(org.m_size),
+ m_data(org.m_data)
{
}
+
template <class T>
-T2DDatafield<T>::T2DDatafield():
- m_size(C2DBounds(0,0)),
- m_data(new data_array(0))
+T2DDatafield<T>& T2DDatafield<T>::operator = (const T2DDatafield<T>& org)
+{
+ if (this != &org) {
+ m_size = org.m_size;
+ m_data = org.m_data;
+ }
+ return *this;
+}
+
+
+template <class T>
+T2DDatafield<T>::T2DDatafield(T2DDatafield<T>&& org):
+ m_size(org.m_size),
+ m_data(std::move(org.m_data))
+{
+}
+
+template <class T>
+T2DDatafield<T>& T2DDatafield<T>::operator = (T2DDatafield<T>&& org)
+{
+ if (this != &org) {
+ m_size = org.m_size;
+ m_data = std::move(org.m_data);
+
+ }
+ return *this;
+}
+
+template <class T>
+T2DDatafield<T>::T2DDatafield(const C2DBounds& _Size):
+ m_size(_Size),
+ m_data(m_size.x * m_size.y)
{
}
template <class T>
T2DDatafield<T>::T2DDatafield(const C2DBounds& size,const T *_data):
m_size(size),
- m_data(new data_array(m_size.x * m_size.y))
+ m_data(m_size.x * m_size.y)
{
if (_data)
- ::std::copy(_data, _data + m_data->size(), m_data->begin());
+ ::std::copy(_data, _data + m_data.size(), m_data.begin());
else
- ::std::fill(m_data->begin(), m_data->end(), T());
+ ::std::fill(m_data.begin(), m_data.end(), T());
}
template <class T>
T2DDatafield<T>::T2DDatafield(const C2DBounds& size, const std::vector<T>& data):
m_size(size),
- m_data(new data_array(data.begin(), data.end()))
-{
- assert(m_data->size() == m_size.x * m_size.y);
-}
-
-template <class T>
-T2DDatafield<T>::T2DDatafield(const T2DDatafield<T>& org):
- m_size(org.m_size),
- m_data(org.m_data)
+ m_data(data.begin(), data.end())
{
+ assert(m_data.size() == m_size.x * m_size.y);
}
template <class T>
@@ -77,32 +105,13 @@ T2DDatafield<T>::~T2DDatafield()
template <class T>
void T2DDatafield<T>::make_single_ref()
{
- if (!m_data.unique())
- m_data = data_pointer(new data_array(*m_data));
+
}
template <class T>
typename T2DDatafield<T>::size_type T2DDatafield<T>::size() const
{
- return m_data->size();
-}
-
-template <class T>
-T T2DDatafield<T>::get_interpol_val_at(const C2DFVector& p) const
-{
- size_t x = (size_t )p.x;
- size_t y = (size_t )p.y;
- float xp = p.x - x; float xm = 1.0 - xp;
- float yp = p.y - y; float ym = 1.0 - yp;
-
- const T& H00 = (*this)(x ,y );
- const T& H01 = (*this)(x ,y+1);
- const T& H10 = (*this)(x+1,y );
- const T& H11 = (*this)(x+1,y+1);
-
- return T(ym * ( xm * H00 + xp * H10) +
- yp * ( xm * H01 + xp * H11));
-
+ return m_data.size();
}
template <class T>
@@ -114,7 +123,6 @@ const C2DBounds& T2DDatafield<T>::get_size() const
template <class T>
void T2DDatafield<T>::clear()
{
- make_single_ref();
std::fill(begin(), end(),T());
}
@@ -123,7 +131,7 @@ typename T2DDatafield<T>::reference
T2DDatafield<T>::operator()(size_t x, size_t y)
{
if (x < m_size.x && y < m_size.y){
- return (*m_data)[x + m_size.x * y ];
+ return m_data[x + m_size.x * y ];
}else{
//FORCECOREDUMP;
throw std::invalid_argument("T2DDatafield<T>::operator(x,y,z):Index out of bounds");
@@ -135,10 +143,8 @@ template <class T>
typename T2DDatafield<T>::const_reference
T2DDatafield<T>::operator()(size_t x, size_t y)const
{
- const data_array& cData = *m_data;
-
if ( x < m_size.x && y < m_size.y ){
- return cData[ x + m_size.x * y ];
+ return m_data[ x + m_size.x * y ];
}else{
return Zero;
}
@@ -147,10 +153,8 @@ template <class T>
typename T2DDatafield<T>::const_reference
T2DDatafield<T>::operator()(const C2DBounds& l)const
{
- const data_array& cData = *m_data;
-
if ( l.x < m_size.x && l.y < m_size.y ){
- return cData[ l.x + m_size.x * l.y ];
+ return m_data[ l.x + m_size.x * l.y ];
}else{
return Zero;
}
@@ -168,9 +172,8 @@ void T2DDatafield<T>::get_data_line_x(size_t y, std::vector<T>& buffer)const
{
assert(y < m_size.y);
buffer.resize(m_size.x);
-
- const data_array& d = *m_data;
- const_iterator b = d.begin();
+
+ const_iterator b = m_data.begin();
advance(b, y * m_size.x);
std::copy(b, b + m_size.x, buffer.begin());
@@ -181,9 +184,8 @@ void T2DDatafield<T>::get_data_line_y(size_t x, std::vector<T>& buffer)const
{
assert(x < m_size.x);
buffer.resize(m_size.y);
-
- const data_array& d = *m_data;
- const_iterator src = d.begin();
+
+ const_iterator src = m_data.begin();
advance(src,x);
typename std::vector<T>::iterator dest_i = buffer.begin();
typename std::vector<T>::iterator dest_e = buffer.end();
@@ -201,9 +203,8 @@ void T2DDatafield<T>::put_data_line_x(size_t y, const std::vector<T>& buffer)
{
assert(y < m_size.y);
assert(buffer.size() == m_size.x);
- make_single_ref();
- std::copy(buffer.begin(), buffer.end(), m_data->begin() + m_size.x * y );
+ std::copy(buffer.begin(), buffer.end(), m_data.begin() + m_size.x * y );
}
template <class T>
@@ -212,9 +213,8 @@ void T2DDatafield<T>::put_data_line_y(size_t x, const std::vector<T>& buffer)
assert(x < m_size.x);
assert(buffer.size() == m_size.y);
- make_single_ref();
- typename std::vector<T>::const_iterator src_i = buffer.begin();
- typename std::vector<T>::const_iterator src_e = buffer.end();
+ auto src_i = buffer.begin();
+ auto src_e = buffer.end();
iterator dest = begin();
advance(dest, x);
@@ -227,19 +227,21 @@ void T2DDatafield<T>::put_data_line_y(size_t x, const std::vector<T>& buffer)
}
}
-template <class T>
-T2DDatafield<T>& T2DDatafield<T>::operator = (const T2DDatafield<T>& org)
-
+template <typename T>
+typename T2DDatafield<T>::Range
+T2DDatafield<T>::get_range(const C2DBounds& start, const C2DBounds& end)
{
- if (&org == this){
- return *this;
- }
-
- m_size = org.m_size;
- m_data = org.m_data;
- return *this;
+ return Range(start, end, *this);
+}
+
+template <typename T>
+typename T2DDatafield<T>::ConstRange
+T2DDatafield<T>::get_range(const C2DBounds& start, const C2DBounds& end) const
+{
+ return ConstRange(start, end, *this);
}
+
template <typename T>
typename T2DDatafield<T>::range_iterator
T2DDatafield<T>::begin_range(const C2DBounds& begin, const C2DBounds& end)
@@ -272,6 +274,50 @@ T2DDatafield<T>::end_range(const C2DBounds& begin, const C2DBounds& end)const
begin_at(end.x, end.y));
}
+template <typename T>
+typename T2DDatafield<T>::Range::iterator T2DDatafield<T>::Range::begin()
+{
+ return m_begin;
+}
+
+template <typename T>
+typename T2DDatafield<T>::Range::iterator T2DDatafield<T>::Range::end()
+{
+ return m_end;
+}
+
+template <typename T>
+T2DDatafield<T>::Range::Range(const C2DBounds& start, const C2DBounds& end, T2DDatafield<T>& field):
+ m_begin(field.begin_range(start, end)), m_end(field.end_range(start, end))
+{
+}
+
+
+template <typename T>
+typename T2DDatafield<T>::ConstRange::iterator T2DDatafield<T>::ConstRange::begin() const
+{
+ return m_begin;
+}
+
+template <typename T>
+typename T2DDatafield<T>::ConstRange::iterator T2DDatafield<T>::ConstRange::end() const
+{
+ return m_end;
+}
+
+
+template <typename T>
+T2DDatafield<T>::ConstRange::ConstRange(const C2DBounds& start, const C2DBounds& end, const T2DDatafield<T>& field):
+ m_begin(field.begin_range(start, end)), m_end(field.end_range(start, end))
+{
+}
+
+template <typename T>
+T2DDatafield<T>::ConstRange::ConstRange(const Range& range):
+ m_begin(range.m_begin), m_end(range.m_end)
+{
+}
+
template <class T>
const typename T2DDatafield<T>::value_type T2DDatafield<T>::Zero = T();
diff --git a/mia/2d/datafield.hh b/mia/2d/datafield.hh
index ede6ee4..821a2a6 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,42 @@
NS_MIA_BEGIN
+#define DECLARE_EXTERN_ITERATORS(TYPE) \
+ extern template class EXPORT_2D range2d_iterator<std::vector<TYPE>::iterator>; \
+ extern template class EXPORT_2D range2d_iterator<std::vector<TYPE>::const_iterator>; \
+ extern template class EXPORT_2D range2d_iterator_with_boundary_flag<std::vector<TYPE>::iterator>; \
+ extern template class EXPORT_2D range2d_iterator_with_boundary_flag<std::vector<TYPE>::const_iterator>;
+
+#ifdef __GNUC__
+#pragma GCC diagnostic push
+#ifndef __clang__
+#pragma GCC diagnostic ignored "-Wattributes"
+#endif
+#endif
+
+DECLARE_EXTERN_ITERATORS(double);
+DECLARE_EXTERN_ITERATORS(float);
+DECLARE_EXTERN_ITERATORS(uint32_t);
+DECLARE_EXTERN_ITERATORS(int32_t);
+DECLARE_EXTERN_ITERATORS(int16_t);
+DECLARE_EXTERN_ITERATORS(uint16_t);
+DECLARE_EXTERN_ITERATORS(int8_t);
+DECLARE_EXTERN_ITERATORS(uint8_t);
+DECLARE_EXTERN_ITERATORS(bool);
+DECLARE_EXTERN_ITERATORS(int64_t);
+DECLARE_EXTERN_ITERATORS(uint64_t);
+
+DECLARE_EXTERN_ITERATORS(C2DBounds)
+DECLARE_EXTERN_ITERATORS(C2DFVector)
+DECLARE_EXTERN_ITERATORS(C2DDVector)
+
+#undef DECLARE_EXTERN_ITERATORS
+
+#ifdef __GNUC__
+#pragma GCC diagnostic pop
+#endif
+
+
/**
\ingroup basic
\brief A class to hold data on a regular 2D grid
@@ -57,8 +93,7 @@ public:
/// type for the flat reprentation of the 2D data field
typedef ::std::vector<typename __holder_type_dispatch<T>::type> data_array;
- /// pointer type
- typedef std::shared_ptr<data_array > data_pointer;
+
/// \cond SELFEXPLAINING
typedef typename data_array::iterator iterator;
@@ -81,19 +116,61 @@ public:
typedef C2DFVector coord_type;
/// \endcond
+ class EXPORT_2DDATAFIELD Range {
+ friend class T2DDatafield<T>;
+ friend class ConstRange;
+ public:
+
+ typedef T2DDatafield<T>::range_iterator iterator;
+
+ iterator begin();
+
+ iterator end();
+
+ private:
+ Range(const C2DBounds& start, const C2DBounds& end, T2DDatafield<T>& field);
+
+ iterator m_begin;
+ iterator m_end;
+ };
+
+ class EXPORT_2D ConstRange {
+ public:
+ friend class T2DDatafield<T>;
+
+ typedef T2DDatafield<T>::const_range_iterator iterator;
+
+ iterator begin() const;
+
+ iterator end() const;
+
+ private:
+ ConstRange(const C2DBounds& start, const C2DBounds& end, const T2DDatafield<T>& field);
+
+ ConstRange(const Range& range);
+
+ iterator m_begin;
+ iterator m_end;
+ };
+
+
T2DDatafield();
/**
Create a 2D data field with the given size
\param size
*/
- T2DDatafield(const C2DBounds& size);
+ explicit T2DDatafield(const C2DBounds& size);
/**
Create a 2D data field with the given size and initialize it with the given data
\param size
\param _data must at least be of size (size.x*size.y)
*/
+
+
+
+
T2DDatafield(const C2DBounds& size, const T *_data);
/**
@@ -103,37 +180,37 @@ public:
*/
T2DDatafield(const C2DBounds& size, const std::vector<T>& data);
- /** copy constructor, it does a shallow copy of the original, i.e.
- the data is not copied, only the shared pointer increases its reference count.
- If you want a truely unique copy, call make_single_ref() afterwards.
+ /** copy constructor, it does a deep copy.
+
*/
T2DDatafield(const T2DDatafield<T>& org);
/**
- Assignment operator, Just like the copy constructor this call does only increment
- the reference count to the data.
- If you want a truely unique copy, call make_single_ref() afterwards.
+ Assignment operator, does a deep copy.
*/
- T2DDatafield& operator = (const T2DDatafield& org);
+ T2DDatafield<T>& operator = (const T2DDatafield<T>& org);
+
+ /** move constructor */
+ T2DDatafield(T2DDatafield<T>&& org);
+
+ /** Assignment move operator */
+ T2DDatafield<T>& operator = (T2DDatafield<T>&& org);
+
virtual ~T2DDatafield();
-
- /// This function should really go away
- T get_interpol_val_at(const C2DFVector& p) const; // __attribute__((deprecated));
/**
Since the data is internally stored by a shared pointer, this
function ensures that the data is not shared with any other object
*/
- void make_single_ref();
+ void make_single_ref() __attribute__((deprecated));
/// \returns the size of the data field
const C2DBounds& get_size() const;
/**
- This function first ensures that the copy of the data is unique by calling make_single_ref()
- and then sets the elements of data to T().
+ This function sets the elements of data to T().
*/
void clear();
@@ -162,7 +239,7 @@ public:
\returns read-only reference to the data
*/
const_reference operator[](size_t idx) const{
- return (*m_data)[idx];
+ return m_data[idx];
}
/**
@@ -174,7 +251,7 @@ public:
\returns read-write reference to the data
*/
reference operator[](size_t idx){
- return (*m_data)[idx];
+ return m_data[idx];
}
/// \overload const_reference operator()(size_t x, size_t y) const;
@@ -219,14 +296,12 @@ public:
/// \returns a read-only iterator to the begin of the data field with x being the fastest changing index
const_iterator begin()const {
- const data_array& data = *m_data;
- return data.begin();
+ return m_data.begin();
}
/// \returns a read-only iterator to the end of the data field with x being the fastest changing index
const_iterator end()const {
- const data_array& data = *m_data;
- return data.end();
+ return m_data.end();
}
/** Get a read-write iterator to iterate over the whole field.
@@ -234,8 +309,7 @@ public:
\returns a read-write iterator to the begin of the data field
*/
iterator begin() {
- make_single_ref();
- return m_data->begin();
+ return m_data.begin();
}
/** Get a read-write iterator to iterate over the whole field.
@@ -244,8 +318,7 @@ public:
*/
iterator end() {
- make_single_ref();
- return m_data->end();
+ return m_data.end();
}
/** Get a read-write iterator to iterate over the field staring from the given position.
@@ -273,6 +346,11 @@ public:
return b;
}
+ Range get_range(const C2DBounds& start, const C2DBounds& end);
+
+ ConstRange get_range(const C2DBounds& start, const C2DBounds& 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 C2DBounds& begin, const C2DBounds& end);
@@ -291,7 +369,7 @@ public:
private:
C2DBounds m_size;
- data_pointer m_data;
+ data_array m_data;
const static value_type Zero;
};
@@ -302,29 +380,27 @@ typedef T2DDatafield<double> C2DDDatafield;
typedef T2DDatafield<float> C2DFDatafield;
/// 2D scalar field that holds unsigned int values
-typedef T2DDatafield<unsigned int> C2DUIDatafield;
+typedef T2DDatafield<uint32_t> C2DUIDatafield;
/// 2D scalar field that holds signed int values
-typedef T2DDatafield<signed int> C2DSIDatafield;
+typedef T2DDatafield<int32_t> C2DSIDatafield;
-#ifdef LONG_64BIT
-typedef T2DDatafield<unsigned long> C2DULDatafield;
+typedef T2DDatafield<uint64_t> C2DULDatafield;
/// long instanziation of a 2D data field
-typedef T2DDatafield<signed long> C2DSLDatafield;
-#endif
+typedef T2DDatafield<int64_t> C2DSLDatafield;
/// 2D scalar field that holds unsigned short values
-typedef T2DDatafield<unsigned short> C2DUSDatafield;
+typedef T2DDatafield<uint16_t> C2DUSDatafield;
/// 2D scalar field that holds signed short values
-typedef T2DDatafield<signed short> C2DSSDatafield;
+typedef T2DDatafield<int16_t> C2DSSDatafield;
/// 2D scalar field that holds unsigned char (=byte) values
-typedef T2DDatafield<unsigned char> C2DUBDatafield;
+typedef T2DDatafield<uint8_t> C2DUBDatafield;
/// 2D scalar field that holds signed char values
-typedef T2DDatafield<signed char> C2DSBDatafield;
+typedef T2DDatafield<int8_t> C2DSBDatafield;
/// 2D scalar field that holds bool values
typedef T2DDatafield<bool> C2DBitDatafield;
@@ -341,29 +417,44 @@ typedef TTranslator<C2DFVector> C2DFVectorTranslator;
/// @cond NEVER
#define DEFINE_2DFIELD_TEMPLATE(TYPE) \
- extern template class EXPORT_2D EXPORT_2D T2DDatafield<TYPE>; \
- extern template class EXPORT_2D range2d_iterator<T2DDatafield<TYPE>::iterator>; \
- extern template class EXPORT_2D range2d_iterator<T2DDatafield<TYPE>::const_iterator>; \
- extern template class EXPORT_2D range2d_iterator_with_boundary_flag<T2DDatafield<TYPE>::iterator>; \
- extern template class EXPORT_2D range2d_iterator_with_boundary_flag<T2DDatafield<TYPE>::const_iterator>;
+ extern template class EXPORT_2D T2DDatafield<TYPE>; \
+ extern template class EXPORT_2D range2d_iterator<T2DDatafield<TYPE>::iterator>; \
+ extern template class EXPORT_2D range2d_iterator<T2DDatafield<TYPE>::const_iterator>; \
+ extern template class EXPORT_2D range2d_iterator_with_boundary_flag<T2DDatafield<TYPE>::iterator>; \
+ extern template class EXPORT_2D range2d_iterator_with_boundary_flag<T2DDatafield<TYPE>::const_iterator>;
-DEFINE_2DFIELD_TEMPLATE(float);
-#ifdef LONG_64BIT
-DEFINE_2DFIELD_TEMPLATE(signed long);
-DEFINE_2DFIELD_TEMPLATE(unsigned long);
+#ifdef __GNUC__
+#pragma GCC diagnostic push
+#ifndef __clang__
+#pragma GCC diagnostic ignored "-Wattributes"
+#endif
#endif
-DEFINE_2DFIELD_TEMPLATE(double);
-DEFINE_2DFIELD_TEMPLATE(unsigned int);
-DEFINE_2DFIELD_TEMPLATE(signed int);
-DEFINE_2DFIELD_TEMPLATE(unsigned short);
-DEFINE_2DFIELD_TEMPLATE(signed short);
-DEFINE_2DFIELD_TEMPLATE(unsigned char);
-DEFINE_2DFIELD_TEMPLATE(signed char);
+DEFINE_2DFIELD_TEMPLATE(double);
+DEFINE_2DFIELD_TEMPLATE(float);
+DEFINE_2DFIELD_TEMPLATE(int64_t);
+DEFINE_2DFIELD_TEMPLATE(uint64_t);
+DEFINE_2DFIELD_TEMPLATE(uint32_t);
+DEFINE_2DFIELD_TEMPLATE(int32_t);
+DEFINE_2DFIELD_TEMPLATE(uint16_t);
+DEFINE_2DFIELD_TEMPLATE(int16_t);
+DEFINE_2DFIELD_TEMPLATE(uint8_t);
+DEFINE_2DFIELD_TEMPLATE(int8_t);
+
+DEFINE_2DFIELD_TEMPLATE(C2DBounds);
+DEFINE_2DFIELD_TEMPLATE(C2DFVector)
+DEFINE_2DFIELD_TEMPLATE(C2DDVector)
+
DECLARE_TYPE_DESCR(C2DBounds);
DECLARE_TYPE_DESCR(C2DFVector);
+DECLARE_TYPE_DESCR(C2DDVector);
+
+#ifdef __GNUC__
+#pragma GCC diagnostic pop
+#endif
+
extern template class EXPORT_2D CTParameter<C2DFVector>;
extern template class EXPORT_2D CTParameter<C2DBounds>;
diff --git a/mia/2d/defines2d.hh b/mia/2d/defines2d.hh
index 28dcfdf..cd44359 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 e5e5ac9..9902895 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 f15d828..09772af 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 e655964..6989e4d 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 3d91e45..924ed66 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 33e86c0..f0ace72 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 529f885..774529e 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 ecb3692..bacf249 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 687aa1f..e60868c 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,6 +125,7 @@ typedef TImageCombiner< C2DImage > C2DImageCombiner;
typedef std::shared_ptr<C2DImageCombiner> P2DImageCombiner;
typedef TFactory<C2DImageCombiner> C2DImageCombinerPlugin;
+
/// Plugin handler for image combiner plugins
typedef THandlerSingleton<TFactoryPluginHandler<C2DImageCombinerPlugin> >
C2DImageCombinerPluginHandler;
diff --git a/mia/2d/filter/adaptmed.cc b/mia/2d/filter/adaptmed.cc
index d8c40e6..876b601 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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.hh b/mia/2d/filter/adaptmed.hh
index cce72a8..5c96ef4 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 8e6df74..7ad486e 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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.hh b/mia/2d/filter/admean.hh
index 45adad0..461898e 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 03c224c..5ec2a9c 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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.hh b/mia/2d/filter/aniso.hh
index a898f20..b744e2b 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 b2e1651..abaf947 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 1fd3728..70a50f4 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 1f9dfa4..25b3fb4 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 e2427a2..73f4461 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 fd7467e..a005a59 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 8da113a..3138481 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 b5c8391..3e2f1fd 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 4f032c7..ba8fbfb 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 f09c239..1213d22 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 ff0ece2..a21472b 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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.hh b/mia/2d/filter/crop.hh
index e3d1029..b4067d6 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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.cc b/mia/2d/filter/cst.cc
index bf2d28f..1672259 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 6e8b336..d29948e 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 4d659e6..e640ae2 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 4bd9c23..436e0ba 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 d697053..2d7fd10 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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.hh b/mia/2d/filter/downscale.hh
index f9b45ec..7838c17 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 b6d3e2d..a6f2079 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 b70a062..4dbc359 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 d939ad8..a48cce8 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 001833e..bdc3066 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 c054af8..fa90d32 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 a028843..dd3ac9a 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 f513779..f476918 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 1ab2339..27a3bf1 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 00c92a2..6dc26d2 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 3e96e38..aae706f 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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.hh b/mia/2d/filter/kmeans.hh
index 85acf50..add2701 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 3e84cfa..1e602e8 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 8e720df..9d28c14 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 bdb9538..9aa2dde 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 f8e0e9d..babf6dc 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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.hh b/mia/2d/filter/labelmap.hh
index 6ea7f04..87e2db2 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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.cc b/mia/2d/filter/labelscale.cc
index 2573bb9..e9fdcbe 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 c1d3c7a..0daab67 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 d6fd61d..0c3357e 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 197456c..c98d00e 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 55d4fa4..6b71523 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 1d152a8..996d721 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 028dea1..7703f20 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 f83aba1..1aee478 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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.hh b/mia/2d/filter/mean.hh
index 69c1fab..6240553 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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/meanvar.cc b/mia/2d/filter/meanvar.cc
index f2055fd..7b5e891 100644
--- a/mia/2d/filter/meanvar.cc
+++ b/mia/2d/filter/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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -140,8 +140,8 @@ C2DMeanVarImageFilterFactory::C2DMeanVarImageFilterFactory():
m_thresh(0.0)
{
add_parameter("w", make_lc_param(m_hw, 1, false, "filter width parameter"));
- add_parameter("thresh", make_lc_param(m_thresh, 0.0, false, "Intensity threshholding parameter: Pixels with intensities "
- "below this threshhold will be set to zero, and also not used when evaluating mean "
+ add_parameter("thresh", make_lc_param(m_thresh, 0.0, false, "Intensity thresholding parameter: Pixels with intensities "
+ "below this threshold will be set to zero, and also not used when evaluating mean "
"and variation"));
add_parameter("varfile", new CStringParameter(m_varfilename, CCmdOptionFlags::required_output,
"name of the output file to save the variation image too.",
diff --git a/mia/2d/filter/meanvar.hh b/mia/2d/filter/meanvar.hh
index 6d18ca5..c5df2d6 100644
--- a/mia/2d/filter/meanvar.hh
+++ b/mia/2d/filter/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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 171468f..98e7eb9 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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.hh b/mia/2d/filter/median.hh
index e47d8f3..ee49532 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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/medianmad.cc b/mia/2d/filter/medianmad.cc
index 8ecabff..9e186f5 100644
--- a/mia/2d/filter/medianmad.cc
+++ b/mia/2d/filter/medianmad.cc
@@ -1,7 +1,7 @@
/* -*- mia-c++ -*-
*
* This file is part of MIA - a toolbox for medical image analysis
- * Copyright (c) Leipzig, Madrid 1999-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,8 +153,8 @@ C2DMedianMadImageFilterFactory::C2DMedianMadImageFilterFactory():
m_thresh(0.0)
{
add_parameter("w", make_lc_param(m_hw, 1, false, "filter width parameter"));
- add_parameter("thresh", make_lc_param(m_thresh, 0.0, false, "Intensity threshholding parameter: Pixels with intensities "
- "below this threshhold will be set to zero, and also not used when evaluating mean "
+ add_parameter("thresh", make_lc_param(m_thresh, 0.0, false, "Intensity thresholding parameter: Pixels with intensities "
+ "below this threshold will be set to zero, and also not used when evaluating mean "
"and variation"));
add_parameter("madfile", new CStringParameter(m_madfilename, CCmdOptionFlags::required_output,
"name of the output file to save the median absolute deviation image too.",
diff --git a/mia/2d/filter/medianmad.hh b/mia/2d/filter/medianmad.hh
index 762661b..1b5ba1e 100644
--- a/mia/2d/filter/medianmad.hh
+++ b/mia/2d/filter/medianmad.hh
@@ -1,7 +1,7 @@
/* -*- mia-c++ -*-
*
* This file is part of MIA - a toolbox for medical image analysis
- * Copyright (c) Leipzig, Madrid 1999-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 03aa016..4b550ea 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 ed70ce6..f9d0cca 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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.hh b/mia/2d/filter/mlv.hh
index 9f714c1..79818c9 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 6928944..c0e0b46 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 31a35c5..5b25380 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 f1194dd..0aaef40 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 c3559f6..4253e20 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 a6fe17e..f23d23a 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 e8c82e2..ea29615 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 6177f55..21f93d7 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 37a2192..5e39885 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 b008eca..99cf666 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 6905a86..f02cab9 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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.hh b/mia/2d/filter/scale.hh
index 526c237..0ae489a 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 dff8ccf..bcc854d 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 3abeaeb..8ff8a85 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 6d9fa5e..93848c8 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 522b50a..627f801 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 9529034..3517b75 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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.hh b/mia/2d/filter/sepconv.hh
index af0cf18..f9e2960 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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.cc b/mia/2d/filter/shaped_mean.cc
index 12546aa..2791e2c 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 32c418c..dcea95d 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 2c2651e..7bdfcd8 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 83e5749..805ba6b 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 48bd0ac..fcc333d 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 3b9656e..0bbc8ea 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 11efcfb..e9f15e2 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 69fdc69..a02c241 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 68fa526..2fcfde6 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 6eb3f18..4b6dd76 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 6ac1743..21b973c 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 59f12f2..3b83f97 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -95,7 +95,7 @@ Combiner2DFilterFixture::Combiner2DFilterFixture():
Combiner2DFilterFixture::~Combiner2DFilterFixture()
{
- boost::any dummy = CDatapool::instance().get_and_remove("other.@");
+ CDatapool::instance().remove("other.@");
}
diff --git a/mia/2d/filter/test_convert.cc b/mia/2d/filter/test_convert.cc
index 494de9b..9d95228 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 20d74fa..6c8b1af 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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_cst.cc b/mia/2d/filter/test_cst.cc
index 6f4b38e..d1d5756 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 52742c0..31ac1a1 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 cd50f38..10bec04 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 509ba75..ec8281e 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 b82648f..3ab19dd 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 cbed57a..1f5b32f 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 7b35ee4..4755ea3 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 32635a1..36b9d0b 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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/2d/filter/test_labelmap.cc
index 9b874df..85a7b77 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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_labelscale.cc b/mia/2d/filter/test_labelscale.cc
index 4c095e9..962beb2 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 28d3593..c144149 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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 @@ LoadFixture::LoadFixture()
LoadFixture::~LoadFixture()
{
- boost::any dummy = CDatapool::instance().get_and_remove("test.@");
+ CDatapool::instance().remove("test.@");
}
diff --git a/mia/2d/filter/test_mask.cc b/mia/2d/filter/test_mask.cc
index a65ce05..e8462b1 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 90d228e..1c6fd1b 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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_meanvar.cc b/mia/2d/filter/test_meanvar.cc
index bce802d..f97477c 100644
--- a/mia/2d/filter/test_meanvar.cc
+++ b/mia/2d/filter/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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 fe0b17f..30f7763 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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_medianmad.cc b/mia/2d/filter/test_medianmad.cc
index c9e6464..c4b13ad 100644
--- a/mia/2d/filter/test_medianmad.cc
+++ b/mia/2d/filter/test_medianmad.cc
@@ -1,7 +1,7 @@
/* -*- mia-c++ -*-
*
* This file is part of MIA - a toolbox for medical image analysis
- * Copyright (c) Leipzig, Madrid 1999-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 1d03321..b2e4a76 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 bb0ce8f..40e91a5 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 ccf54fb..6d093ff 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 36e8bd0..8c3acc4 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 c5f919f..e4869db 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 c8323c6..812cce4 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 5c5c5af..a8f3037 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 51cf153..5b22057 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 6414e27..f1c5c5d 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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_shaped_mean.cc b/mia/2d/filter/test_shaped_mean.cc
index 29d8c96..5e860ef 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 6418e7b..1445f7e 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 59dc356..ac2c82e 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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 @@ TeeFixture::TeeFixture()
TeeFixture::~TeeFixture()
{
- boost::any dummy = CDatapool::instance().get_and_remove("test.@");
+ CDatapool::instance().remove("test.@");
}
diff --git a/mia/2d/filter/test_thinning.cc b/mia/2d/filter/test_thinning.cc
index 8d059e0..c3ae64b 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 aec33ac..837f019 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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_tmean.cc b/mia/2d/filter/test_tmean.cc
index 348cd90..4fb476e 100644
--- a/mia/2d/filter/test_tmean.cc
+++ b/mia/2d/filter/test_tmean.cc
@@ -1,7 +1,7 @@
/* -*- mia-c++ -*-
*
* This file is part of MIA - a toolbox for medical image analysis
- * Copyright (c) Leipzig, Madrid 1999-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 0f49e91..9fedd07 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 9eed452..b7562bc 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 fc3f6ba..9d733ec 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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.hh b/mia/2d/filter/thinning.hh
index 13b0bef..b915d0a 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 811c55c..4456684 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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.hh b/mia/2d/filter/thresh.hh
index 08522a7..4b9f53b 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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/tmean.cc b/mia/2d/filter/tmean.cc
index 8ae27ee..88f0775 100644
--- a/mia/2d/filter/tmean.cc
+++ b/mia/2d/filter/tmean.cc
@@ -1,7 +1,7 @@
/* -*- mia-c++ -*-
*
* This file is part of MIA - a toolbox for medical image analysis
- * Copyright (c) Leipzig, Madrid 1999-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,8 +132,8 @@ C2DFilter *C2DTmeanFilterPlugin::do_create()const
const string C2DTmeanFilterPlugin::do_get_descr()const
{
return "2D image thresholded tmean filter: The output pixel value is zero if the input pixel "
- "value is below the given threshhold, otherwise the pixels in the evaluation windows "
- "are only considered if the input pixel intensity is above the threshhold.";
+ "value is below the given threshold, otherwise the pixels in the evaluation windows "
+ "are only considered if the input pixel intensity is above the threshold.";
}
extern "C" EXPORT CPluginBase *get_plugin_interface()
diff --git a/mia/2d/filter/tmean.hh b/mia/2d/filter/tmean.hh
index 088f1e4..3783bd9 100644
--- a/mia/2d/filter/tmean.hh
+++ b/mia/2d/filter/tmean.hh
@@ -1,7 +1,7 @@
/* -*- mia-c++ -*-
*
* This file is part of MIA - a toolbox for medical image analysis
- * Copyright (c) Leipzig, Madrid 1999-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 a94a2f5..c6f4acf 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 2df2bfd..b89d613 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 de92346..0c77b10 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 7cdb696..2e79e75 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 02662da..51ed32d 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 583432b..cf55eb8 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 e5c4744..38b7903 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 93b13da..4f8b867 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 c18de94..3ec0bf3 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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.hh b/mia/2d/filtertest.hh
index 04b25e3..1574334 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 fb32c91..03affba 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,7 +37,7 @@ TPluginHandler<C2DFullCostPlugin>::m_help =
"This class of cost functions evaluates the cost resulting from the "
"use of a certain transformation. This may include a penalty term that ensures "
"the smoothness of a transformation or the evaluation of a similarity measure "
- "between a transformed study data set and a refernce data set.";
+ "between a transformed study data set and a reference data set.";
EXPLICIT_INSTANCE_PLUGIN(C2DFullCost);
diff --git a/mia/2d/fullcost.hh b/mia/2d/fullcost.hh
index 22912a3..7cfaf15 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 c25d482..91a8ab9 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -150,7 +150,7 @@ void C2DImageFullCost::do_reinit()
throw runtime_error("C2DImageFullCost only works with images of equal size");
if (m_src->get_pixel_size() != m_ref->get_pixel_size()) {
- cvwarn() << "C2DImageFullCost: src and reference image are of differnet pixel dimensions:"
+ cvwarn() << "C2DImageFullCost: src and reference image are of different pixel dimensions:"
<< m_src->get_pixel_size() << " vs " << m_ref->get_pixel_size()
<< " This code doesn't honour this.\n";
}
diff --git a/mia/2d/fullcost/image.hh b/mia/2d/fullcost/image.hh
index 8985b42..576213e 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 b0bca34..20b9c84 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -272,7 +272,7 @@ void C2DLabelFullCost::do_reinit()
throw runtime_error("C2DLabelFullCost only works with images of equal size");
if (m_src->get_pixel_size() != m_ref->get_pixel_size()) {
- cvwarn() << "C2DLabelFullCost: src and reference image are of differnet pixel dimensions:"
+ cvwarn() << "C2DLabelFullCost: src and reference image are of different pixel dimensions:"
<< m_src->get_pixel_size() << " vs " << m_ref->get_pixel_size()
<< " This code doesn't honour this.\n";
}
diff --git a/mia/2d/fullcost/label.hh b/mia/2d/fullcost/label.hh
index 22eb705..9214f64 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 774d90c..d295d65 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -242,7 +242,7 @@ void C2DMaskedImageFullCost::do_reinit()
if (m_src->get_pixel_size() != m_ref->get_pixel_size()) {
- cvwarn() << "C2DMaskedImageFullCost: moving and reference image are of differnet pixel dimensions."
+ cvwarn() << "C2DMaskedImageFullCost: moving and reference image are of different pixel dimensions."
<< "unless you optimize a transformation that supports global scaling this might "
<< "not be what you want to do\n";
}
diff --git a/mia/2d/fullcost/maskedimage.hh b/mia/2d/fullcost/maskedimage.hh
index e44dbab..9f8d69c 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 7f38bd3..8ca1d5f 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 bd230a2..f937574 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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_maskedimage.cc b/mia/2d/fullcost/test_maskedimage.cc
index ec4de81..1719682 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 1158c45..56dd84e 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 ac0b0e2..3cc763a 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 8506018..04f302b 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 75a50c0..790e92c 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 4b9a9f8..01b2fc6 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 c410ffe..e19434a 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 3f98a3a..4c9e7de 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 2f36804..b5b58ec 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 f4bcbf1..db695c4 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 104bf1b..e798a72 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 4863044..d440e04 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 e0db8f0..8256536 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 a342ed0..4e83520 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -42,6 +42,27 @@ C2DImage::C2DImage(const CAttributedData& attributes, const C2DBounds& size, EPi
{
}
+C2DImage::C2DImage(C2DImage&& other):CAttributedData(other),
+ m_size(other.m_size),
+ m_pixel_type(other.m_pixel_type)
+{
+ other.m_size = C2DBounds::_0;
+ other.m_pixel_type = it_none;
+}
+
+C2DImage& C2DImage::operator = (C2DImage&& other)
+{
+ if (&other == this)
+ return *this;
+
+ CAttributedData::operator =(other);
+ m_size = other.m_size;
+ m_pixel_type = other.m_pixel_type;
+ other.m_size = C2DBounds::_0;
+ other.m_pixel_type = it_none;
+ return *this;
+}
+
C2DImage::~C2DImage()
{
}
@@ -161,6 +182,34 @@ T2DImage<T>::T2DImage(const T2DImage<T>& orig):
}
template <typename T>
+T2DImage<T>::T2DImage(T2DImage<T>&& orig):
+ C2DImage(std::move(orig)),
+ m_image(std::move(orig.m_image))
+{
+}
+
+template <typename T>
+T2DImage<T>& T2DImage<T>::operator = (T2DImage<T>&& orig)
+{
+ if (this != &orig) {
+ C2DImage::operator =(std::move(orig));
+ m_image= std::move(orig.m_image);
+ }
+ return *this;
+}
+
+
+template <typename T>
+T2DImage<T>& T2DImage<T>::operator = (const T2DImage<T>& orig)
+{
+ if (this != &orig) {
+ C2DImage::operator =(orig);
+ m_image= orig.m_image;
+ }
+ return *this;
+}
+
+template <typename T>
T2DImage<T>::T2DImage():
C2DImage(C2DBounds(0,0), (EPixelType)pixel_type<T>::value),
m_image(C2DBounds(0,0))
@@ -182,7 +231,6 @@ const T2DDatafield<T>& T2DImage<T>::data() const
template <typename T>
void T2DImage<T>::make_single_ref()
{
- m_image.make_single_ref();
}
template <typename T>
@@ -372,16 +420,14 @@ EXPORT_2D bool operator == (const C2DImage& a, const C2DImage& b)
}
template class T2DImage<bool>;
-template class T2DImage<signed char>;
-template class T2DImage<unsigned char>;
-template class T2DImage<signed short>;
-template class T2DImage<unsigned short>;
-template class T2DImage<signed int>;
-template class T2DImage<unsigned int>;
-#ifdef LONG_64BIT
-template class T2DImage<signed long>;
-template class T2DImage<unsigned long>;
-#endif
+template class T2DImage<int8_t>;
+template class T2DImage<uint8_t>;
+template class T2DImage<int16_t>;
+template class T2DImage<uint16_t>;
+template class T2DImage<int32_t>;
+template class T2DImage<uint32_t>;
+template class T2DImage<int64_t>;
+template class T2DImage<uint64_t>;
template class T2DImage<float>;
template class T2DImage<double>;
diff --git a/mia/2d/image.hh b/mia/2d/image.hh
index da39603..9eb2efa 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -85,23 +85,32 @@ public:
virtual std::pair<double, double> get_minmax_intensity() const = 0;
- virtual void make_single_ref() = 0;
+ virtual void make_single_ref() __attribute__((deprecated)) = 0;
protected:
- /** Constructor initializes the size and the pixel type
- */
- C2DImage(const C2DBounds& size, EPixelType type);
+ C2DImage(C2DImage&& other);
+ C2DImage& operator = (C2DImage&& other);
+
+ C2DImage(const C2DImage& other) = default;
- /** Constructor initializes from the attributes, the size and the pixel type
- */
- C2DImage(const CAttributedData& attributes, const C2DBounds& size, EPixelType type);
- /** standard constructor initializes the size to (0,0), and the pixel type
- to "unknown"
+ C2DImage& operator = (const C2DImage& other) = default;
+
+
+ /** Constructor initializes the size and the pixel type
*/
- C2DImage();
-
- private:
+ C2DImage(const C2DBounds& size, EPixelType type);
+
+ /** Constructor initializes from the attributes, the size and the pixel type
+ */
+ C2DImage(const CAttributedData& attributes, const C2DBounds& size, EPixelType type);
+
+ /** standard constructor initializes the size to (0,0), and the pixel type
+ to "unknown"
+ */
+ C2DImage();
+
+private:
C2DBounds m_size;
EPixelType m_pixel_type;
};
@@ -182,6 +191,23 @@ public:
T2DImage(const T2DImage& orig);
/**
+ Move constructor
+ */
+ T2DImage(T2DImage&& orig);
+
+ /**
+ Move operator
+ */
+ T2DImage<T>& operator = (T2DImage<T>&& orig);
+
+
+ /**
+ Copy operator
+ */
+ T2DImage<T>& operator = (const T2DImage<T>& orig);
+
+
+ /**
Constructor to create the image by using a 2D data field
\param orig the input data field
*/
@@ -316,7 +342,7 @@ public:
/// \returns a pair (minimum, maximum) pixel intensity
std::pair<double, double> get_minmax_intensity() const;
- void make_single_ref();
+ void make_single_ref() __attribute__((deprecated));
private:
T2DDatafield<T> m_image;
};
@@ -393,30 +419,28 @@ public:
typedef T2DImage<bool> C2DBitImage;
/// \brief 2D image with signed 8 bit integer values
-typedef T2DImage<signed char> C2DSBImage;
+typedef T2DImage<int8_t> C2DSBImage;
/// \brief 2D image with unsigned 8 bit integer values
-typedef T2DImage<unsigned char> C2DUBImage;
+typedef T2DImage<uint8_t> C2DUBImage;
/// \brief 2D image with signed 16 bit integer values
-typedef T2DImage<signed short> C2DSSImage;
+typedef T2DImage<int16_t> C2DSSImage;
/// \brief 2D image with unsigned 16 bit integer values
-typedef T2DImage<unsigned short> C2DUSImage;
+typedef T2DImage<uint16_t> C2DUSImage;
/// \brief 2D image with signed 32 bit integer values
-typedef T2DImage<signed int> C2DSIImage;
+typedef T2DImage<int32_t> C2DSIImage;
/// \brief 2D image with unsigned 32 bit integer values
-typedef T2DImage<unsigned int> C2DUIImage;
+typedef T2DImage<uint32_t> C2DUIImage;
-#ifdef LONG_64BIT
/// \brief 2D image with signed 64 bit integer values
-typedef T2DImage<signed long> C2DSLImage;
+typedef T2DImage<int64_t> C2DSLImage;
/// \brief 2D image with unsigned 64 bit integer values
-typedef T2DImage<unsigned long> C2DULImage;
-#endif
+typedef T2DImage<uint64_t> C2DULImage;
/// \brief 2D image with single precsion floating point values
typedef T2DImage<float> C2DFImage;
diff --git a/mia/2d/imageio.cc b/mia/2d/imageio.cc
index e387dc3..4eacc7c 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 72d1f1e..fdb9ff6 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 efdb868..343ee7d 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,16 +131,14 @@ static P2DImage create_image_of_type(EPixelType type)
{
switch (type) {
case it_bit: return create_image<bool>();
- case it_sbyte: return create_image<signed char>();
- case it_ubyte: return create_image<unsigned char>();
- case it_sshort: return create_image<signed short>();
- case it_ushort: return create_image<unsigned short>();
- case it_sint: return create_image<signed int>();
- case it_uint: return create_image<unsigned int>();
-#ifdef LONG_64BIT
- case it_slong: return create_image<signed long>();
- case it_ulong: return create_image<unsigned long>();
-#endif
+ case it_sbyte: return create_image<int8_t>();
+ case it_ubyte: return create_image<uint8_t>();
+ case it_sshort: return create_image<int16_t>();
+ case it_ushort: return create_image<uint16_t>();
+ case it_sint: return create_image<int32_t>();
+ case it_uint: return create_image<uint32_t>();
+ case it_slong: return create_image<int64_t>();
+ case it_ulong: return create_image<uint64_t>();
case it_float: return create_image<float>();
case it_double: return create_image<double>();
default:
diff --git a/mia/2d/imageiotest.hh b/mia/2d/imageiotest.hh
index 4add1d1..8fcaaee 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 9b80933..063e634 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 8f73035..2dc0cc4 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 efb53e0..1cfd105 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,6 +36,14 @@ NS_MIA_BEGIN
using namespace std;
+C2DWeightCache::C2DWeightCache(int kernel_size,
+ const CSplineBoundaryCondition& xbc,
+ const CSplineBoundaryCondition& ybc):
+ x(kernel_size, xbc, kernel_size < 3),
+ y(kernel_size, ybc, true)
+{
+}
+
C2DInterpolatorFactory::C2DInterpolatorFactory(const std::string& kernel, const std::string& bc):
m_kernel(produce_spline_kernel(kernel)),
m_xbc(produce_spline_boundary_condition(bc)),
@@ -93,36 +101,35 @@ const CSplineKernel* C2DInterpolatorFactory::get_kernel() const
#ifdef __SSE__
float add_2d_new<T2DDatafield< float >, 4>::value(const T2DDatafield< float >& coeff,
- const CSplineKernel::SCache& xc,
- const CSplineKernel::SCache& yc)
+ const C2DWeightCache& spline_cache)
{
typedef float v4df __attribute__ ((vector_size (16)));
float __attribute__((aligned(16))) cache[16];
float __attribute__((aligned(16))) xweight[4];
- copy(xc.weights.begin(), xc.weights.end(), xweight);
+ copy(spline_cache.x.weights.begin(), spline_cache.x.weights.end(), xweight);
const int dx = coeff.get_size().x;
int idx = 0;
- if (xc.is_flat) {
+ if (spline_cache.x.is_flat) {
for (size_t y = 0; y < 4; ++y, idx+=4) {
- const float *p = &coeff[yc.index[y] * dx];
- memcpy(&cache[idx], &p[xc.start_idx], 4*sizeof(float));
+ const float *p = &coeff[spline_cache.y.index[y] * dx];
+ memcpy(&cache[idx], &p[spline_cache.x.start_idx], 4*sizeof(float));
}
}else{
for (size_t y = 0; y < 4; ++y, idx+=4) {
- const float *p = &coeff[yc.index[y] * dx];
- cache[idx ] = p[xc.index[0]];
- cache[idx+1] = p[xc.index[1]];
- cache[idx+2] = p[xc.index[2]];
- cache[idx+3] = p[xc.index[3]];
+ const float *p = &coeff[spline_cache.y.index[y] * dx];
+ cache[idx ] = p[spline_cache.x.index[0]];
+ cache[idx+1] = p[spline_cache.x.index[1]];
+ cache[idx+2] = p[spline_cache.x.index[2]];
+ cache[idx+3] = p[spline_cache.x.index[3]];
}
}
v4df wx = _mm_loadu_ps(xweight);
- v4df w0 = _mm_set1_ps(yc.weights[0]);
- v4df w1 = _mm_set1_ps(yc.weights[1]);
- v4df w2 = _mm_set1_ps(yc.weights[2]);
- v4df w3 = _mm_set1_ps(yc.weights[3]);
+ v4df w0 = _mm_set1_ps(spline_cache.y.weights[0]);
+ v4df w1 = _mm_set1_ps(spline_cache.y.weights[1]);
+ v4df w2 = _mm_set1_ps(spline_cache.y.weights[2]);
+ v4df w3 = _mm_set1_ps(spline_cache.y.weights[3]);
v4df x0 = _mm_load_ps(&cache[0]);
v4df x1 = _mm_load_ps(&cache[4]);
@@ -149,34 +156,34 @@ float add_2d_new<T2DDatafield< float >, 4>::value(const T2DDatafield< float >&
#ifdef __SSE2__
double add_2d_new<T2DDatafield< double >, 4>::value(const T2DDatafield< double >& coeff,
- const CSplineKernel::SCache& xc,
- const CSplineKernel::SCache& yc)
+ const C2DWeightCache& spline_cache)
{
typedef double v2df __attribute__ ((vector_size (16)));
double __attribute__((aligned(16))) cache[16];
const int dx = coeff.get_size().x;
- int idx = 0;
- if (xc.is_flat) {
+ int idx = 0;
+
+ if (spline_cache.x.is_flat) {
for (size_t y = 0; y < 4; ++y, idx+=4) {
- const double *p = &coeff[yc.index[y] * dx];
- v2df y1 = _mm_loadu_pd(&p[xc.start_idx]);
- v2df y2 = _mm_loadu_pd(&p[xc.start_idx+2]);
+ const double *p = &coeff[spline_cache.y.index[y] * dx];
+ v2df y1 = _mm_loadu_pd(&p[spline_cache.x.start_idx]);
+ v2df y2 = _mm_loadu_pd(&p[spline_cache.x.start_idx+2]);
_mm_store_pd(&cache[idx ], y1);
_mm_store_pd(&cache[idx+2], y2);
}
}else{
for (size_t y = 0; y < 4; ++y, idx+=4) {
- const double *p = &coeff[yc.index[y] * dx];
- cache[idx ] = p[xc.index[0]];
- cache[idx+1] = p[xc.index[1]];
- cache[idx+2] = p[xc.index[2]];
- cache[idx+3] = p[xc.index[3]];
+ const double *p = &coeff[spline_cache.y.index[y] * dx];
+ cache[idx ] = p[spline_cache.x.index[0]];
+ cache[idx+1] = p[spline_cache.x.index[1]];
+ cache[idx+2] = p[spline_cache.x.index[2]];
+ cache[idx+3] = p[spline_cache.x.index[3]];
}
}
- v2df w0 = _mm_set1_pd(yc.weights[0]);
- v2df w1 = _mm_set1_pd(yc.weights[1]);
+ v2df w0 = _mm_set1_pd(spline_cache.y.weights[0]);
+ v2df w1 = _mm_set1_pd(spline_cache.y.weights[1]);
v2df x00 = _mm_load_pd(&cache[0]);
v2df x01 = _mm_load_pd(&cache[2]);
@@ -186,8 +193,8 @@ double add_2d_new<T2DDatafield< double >, 4>::value(const T2DDatafield< double >
v2df y1 = x00 * w0 + x10 * w1;
v2df y2 = x01 * w0 + x11 * w1;
- v2df w2 = _mm_set1_pd(yc.weights[2]);
- v2df w3 = _mm_set1_pd(yc.weights[3]);
+ v2df w2 = _mm_set1_pd(spline_cache.y.weights[2]);
+ v2df w3 = _mm_set1_pd(spline_cache.y.weights[3]);
v2df x20 = _mm_load_pd(&cache[8]);
v2df x21 = _mm_load_pd(&cache[10]);
v2df x30 = _mm_load_pd(&cache[12]);
@@ -197,8 +204,8 @@ double add_2d_new<T2DDatafield< double >, 4>::value(const T2DDatafield< double >
y2 += x21 * w2 + x31 * w3;
- w0 = _mm_loadu_pd(&xc.weights[0]);
- w1 = _mm_loadu_pd(&xc.weights[2]);
+ w0 = _mm_loadu_pd(&spline_cache.x.weights[0]);
+ w1 = _mm_loadu_pd(&spline_cache.x.weights[2]);
y1 *= w0;
y2 *= w1;
@@ -213,22 +220,19 @@ double add_2d_new<T2DDatafield< double >, 4>::value(const T2DDatafield< double >
#endif
#define INSTANCIATE_INTERPOLATORS(TYPE) \
- template class EXPORT_2D T2DInterpolator<TYPE>; \
- template class EXPORT_2D T2DConvoluteInterpolator<TYPE>
+ template class EXPORT_2D T2DInterpolator<TYPE>
INSTANCIATE_INTERPOLATORS(bool);
-INSTANCIATE_INTERPOLATORS(unsigned char);
-INSTANCIATE_INTERPOLATORS(signed char);
-INSTANCIATE_INTERPOLATORS(unsigned short);
-INSTANCIATE_INTERPOLATORS(signed short);
-INSTANCIATE_INTERPOLATORS(unsigned int);
-INSTANCIATE_INTERPOLATORS(signed int);
+INSTANCIATE_INTERPOLATORS(int8_t);
+INSTANCIATE_INTERPOLATORS(int16_t);
+INSTANCIATE_INTERPOLATORS(int32_t);
+INSTANCIATE_INTERPOLATORS(int64_t);
+INSTANCIATE_INTERPOLATORS(uint8_t);
+INSTANCIATE_INTERPOLATORS(uint16_t);
+INSTANCIATE_INTERPOLATORS(uint32_t);
+INSTANCIATE_INTERPOLATORS(uint64_t);
INSTANCIATE_INTERPOLATORS(float);
INSTANCIATE_INTERPOLATORS(double);
-#ifdef LONG_64BIT
-INSTANCIATE_INTERPOLATORS(signed long);
-INSTANCIATE_INTERPOLATORS(unsigned long);
-#endif
INSTANCIATE_INTERPOLATORS(C2DFVector);
diff --git a/mia/2d/interpolator.cxx b/mia/2d/interpolator.cxx
index be464ff..ce02284 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,46 +64,37 @@ struct __dispatch_copy<C2DFVectorfield, C2DDVectorfield > {
template <typename T>
-T2DConvoluteInterpolator<T>::T2DConvoluteInterpolator(const T2DDatafield<T>& image, PSplineKernel kernel):
+T2DInterpolator<T>::T2DInterpolator(const T2DDatafield<T>& image, PSplineKernel kernel):
m_coeff(image.get_size()),
m_kernel(kernel),
m_x_boundary(produce_spline_boundary_condition("mirror")),
- m_y_boundary(produce_spline_boundary_condition("mirror")),
- m_x_index(kernel->size()),
- m_y_index(kernel->size()),
- m_x_weight(kernel->size()),
- m_y_weight(kernel->size()),
- m_x_cache(kernel->size(), *m_x_boundary, false),
- m_y_cache(kernel->size(), *m_y_boundary, true)
+ m_y_boundary(produce_spline_boundary_condition("mirror")),
+ m_cache(kernel->size(), *m_x_boundary, *m_y_boundary)
{
m_x_boundary->set_width(image.get_size().x);
m_y_boundary->set_width(image.get_size().y);
prefilter(image);
}
template <typename T>
-T2DConvoluteInterpolator<T>::T2DConvoluteInterpolator(const T2DDatafield<T>& image, PSplineKernel kernel,
+T2DInterpolator<T>::T2DInterpolator(const T2DDatafield<T>& image, PSplineKernel kernel,
const CSplineBoundaryCondition& xbc, const CSplineBoundaryCondition& ybc):
m_coeff(image.get_size()),
m_kernel(kernel),
m_x_boundary(xbc.clone()),
- m_y_boundary(ybc.clone()),
- m_x_index(kernel->size()),
- m_y_index(kernel->size()),
- m_x_weight(kernel->size()),
- m_y_weight(kernel->size()),
- m_x_cache(kernel->size(), *m_x_boundary, false),
- m_y_cache(kernel->size(), *m_y_boundary, true)
+ m_y_boundary(ybc.clone()),
+ m_cache(kernel->size(), *m_x_boundary, *m_y_boundary)
+
{
prefilter(image);
}
template <typename T>
-void T2DConvoluteInterpolator<T>::prefilter(const T2DDatafield<T>& image)
+void T2DInterpolator<T>::prefilter(const T2DDatafield<T>& image)
{
m_x_boundary->set_width(image.get_size().x);
- m_x_cache.reset();
+ m_cache.x.reset();
m_y_boundary->set_width(image.get_size().y);
- m_y_cache.reset();
+ m_cache.y.reset();
@@ -141,12 +132,19 @@ void T2DConvoluteInterpolator<T>::prefilter(const T2DDatafield<T>& image)
}
template <typename T>
-T2DConvoluteInterpolator<T>::~T2DConvoluteInterpolator()
+C2DWeightCache T2DInterpolator<T>::create_cache() const
+{
+ return C2DWeightCache(m_kernel->size(), *m_x_boundary, *m_y_boundary);
+}
+
+
+template <typename T>
+T2DInterpolator<T>::~T2DInterpolator()
{
}
template <typename T>
-const typename T2DConvoluteInterpolator<T>::TCoeff2D& T2DConvoluteInterpolator<T>::get_coefficients() const
+const typename T2DInterpolator<T>::TCoeff2D& T2DInterpolator<T>::get_coefficients() const
{
return m_coeff;
}
@@ -167,19 +165,16 @@ template <class C, int size>
struct add_2d {
typedef typename C::value_type U;
- static typename C::value_type apply(const C& coeff, const CSplineKernel::VWeight& xweight,
- const CSplineKernel::VWeight& yweight,
- const CSplineKernel::VIndex& xindex,
- const CSplineKernel::VIndex& yindex)
+ static typename C::value_type apply(const C& coeff, const C2DWeightCache& m_cache)
{
U result = U();
for (size_t y = 0; y < size; ++y) {
U rx = U();
- const U *p = &coeff(0, yindex[y]);
+ const U *p = &coeff(0, m_cache.y.index[y]);
for (size_t x = 0; x < size; ++x) {
- rx += xweight[x] * p[xindex[x]];
+ rx += m_cache.x.weights[x] * p[m_cache.x.index[x]];
}
- result += yweight[y] * rx;
+ result += m_cache.y.weights[y] * rx;
}
return result;
}
@@ -187,7 +182,7 @@ struct add_2d {
template <typename T>
-typename T2DConvoluteInterpolator<T>::TCoeff2D::value_type T2DConvoluteInterpolator<T>::evaluate() const
+typename T2DInterpolator<T>::TCoeff2D::value_type T2DInterpolator<T>::evaluate() const
{
typedef typename TCoeff2D::value_type U;
@@ -196,26 +191,21 @@ typename T2DConvoluteInterpolator<T>::TCoeff2D::value_type T2DConvoluteInterpola
// give the compiler some chance to optimize and unroll the
// interpolation loop by creating some fixed size calls
switch (m_kernel->size()) {
- case 2: result = add_2d<TCoeff2D,2>::apply(m_coeff, m_x_weight, m_y_weight,
- m_x_index, m_y_index); break;
- case 3: result = add_2d<TCoeff2D,3>::apply(m_coeff, m_x_weight, m_y_weight,
- m_x_index, m_y_index); break;
- case 4: result = add_2d<TCoeff2D,4>::apply(m_coeff, m_x_weight, m_y_weight,
- m_x_index, m_y_index); break;
- case 5: result = add_2d<TCoeff2D,5>::apply(m_coeff, m_x_weight, m_y_weight,
- m_x_index, m_y_index); break;
- case 6: result = add_2d<TCoeff2D,6>::apply(m_coeff, m_x_weight, m_y_weight,
- m_x_index, m_y_index); break;
+ case 2: result = add_2d<TCoeff2D,2>::apply(m_coeff, m_cache); break;
+ case 3: result = add_2d<TCoeff2D,3>::apply(m_coeff, m_cache); break;
+ case 4: result = add_2d<TCoeff2D,4>::apply(m_coeff, m_cache); break;
+ case 5: result = add_2d<TCoeff2D,5>::apply(m_coeff, m_cache); break;
+ case 6: result = add_2d<TCoeff2D,6>::apply(m_coeff, m_cache); break;
default: {
/* perform interpolation */
for (size_t y = 0; y < m_kernel->size(); ++y) {
U rx = U();
- const typename TCoeff2D::value_type *p = &m_coeff(0, m_y_index[y]);
+ const typename TCoeff2D::value_type *p = &m_coeff(0, m_cache.y.index[y]);
for (size_t x = 0; x < m_kernel->size(); ++x) {
- rx += m_x_weight[x] * p[m_x_index[x]];
- cvdebug() << m_x_weight[x] << "*" << p[m_x_index[x]] << "\n";
+ rx += m_cache.x.weights[x] * p[m_cache.x.index[x]];
+ cvdebug() << m_cache.x.weights[x] << "*" << p[m_cache.x.index[x]] << "\n";
}
- result += m_y_weight[y] * rx;
+ result += m_cache.y.weights[y] * rx;
}
}
} // end switch
@@ -227,27 +217,26 @@ template <class C, int size>
struct add_2d_new {
typedef typename C::value_type U;
- static typename C::value_type value(const C& coeff, const CSplineKernel::SCache& xc,
- const CSplineKernel::SCache& yc)
+ static typename C::value_type value(const C& coeff, const C2DWeightCache& cache)
{
U result = U();
- if (xc.is_flat) {
+ if (cache.x.is_flat) {
for (size_t y = 0; y < size; ++y) {
U rx = U();
- const U *p = &coeff(0, yc.index[y]);
+ const U *p = &coeff(0, cache.y.index[y]);
for (size_t x = 0; x < size; ++x) {
- rx += xc.weights[x] * p[xc.start_idx + x];
+ rx += cache.x.weights[x] * p[cache.x.start_idx + x];
}
- result += yc.weights[y] * rx;
+ result += cache.y.weights[y] * rx;
}
}else{
for (size_t y = 0; y < size; ++y) {
U rx = U();
- const U *p = &coeff(0, yc.index[y]);
+ const U *p = &coeff(0, cache.y.index[y]);
for (size_t x = 0; x < size; ++x) {
- rx += xc.weights[x] * p[xc.index[x]];
+ rx += cache.x.weights[x] * p[cache.x.index[x]];
}
- result += yc.weights[y] * rx;
+ result += cache.y.weights[y] * rx;
}
}
return result;
@@ -259,9 +248,8 @@ struct add_2d_new<T2DDatafield< T >, 1> {
static T value(const T2DDatafield< T >& coeff,
- const CSplineKernel::SCache& xc,
- const CSplineKernel::SCache& yc) {
- return coeff(xc.index[0], yc.index[0]);
+ const C2DWeightCache& cache) {
+ return coeff(cache.x.index[0], cache.y.index[0]);
}
};
@@ -270,8 +258,7 @@ struct add_2d_new<T2DDatafield< T >, 1> {
template <>
struct add_2d_new<T2DDatafield< double >, 4> {
static double value(const T2DDatafield< double >& coeff,
- const CSplineKernel::SCache& xc,
- const CSplineKernel::SCache& yc);
+ const C2DWeightCache& cache);
};
#endif
@@ -282,32 +269,70 @@ struct add_2d_new<T2DDatafield< float >, 4> {
static float value(const T2DDatafield< float >& coeff,
- const CSplineKernel::SCache& xc,
- const CSplineKernel::SCache& yc);
+ const C2DWeightCache& cache);
};
#endif
template <typename T>
-T T2DConvoluteInterpolator<T>::operator () (const C2DFVector& x) const
+T T2DInterpolator<T>::operator () (const C2DFVector& x, C2DWeightCache& cache) const
{
typedef typename TCoeff2D::value_type U;
- m_kernel->get_uncached(x.x, m_x_cache);
+ // x will usually be the fastest changing index, therefore, it is of no use to use the cache
+ // at the same time it's access may be handled "flat"
+ m_kernel->get_uncached(x.x, cache.x);
+
+ // the other two coordinates are changing slowly and caching makes sense
+ // however, the index set will always be fully evaluated
+ if (x.y != cache.y.x)
+ m_kernel->get_cached(x.y, cache.y);
+
+ U result = U();
+ // now we give the compiler a chance to optimize based on kernel size and data type.
+ // Some of these call also use template specialization to provide an optimized code path.
+ // With SSE and SSE2 available kernel sizes 2 and 4 and the use of float and double
+ // scalar fields are optimized.
+ switch (m_kernel->size()) {
+ case 1: result = add_2d_new<TCoeff2D,1>::value(m_coeff, cache); break;
+ case 2: result = add_2d_new<TCoeff2D,2>::value(m_coeff, cache); break;
+ case 3: result = add_2d_new<TCoeff2D,3>::value(m_coeff, cache); break;
+ case 4: result = add_2d_new<TCoeff2D,4>::value(m_coeff, cache); break;
+ case 5: result = add_2d_new<TCoeff2D,5>::value(m_coeff, cache); break;
+ case 6: result = add_2d_new<TCoeff2D,6>::value(m_coeff, cache); break;
+ default: {
+ assert(0 && "kernel sizes above 5 are not implemented");
+ }
+ } // end switch
+
+ bounded<U, T>::apply(result, m_min, m_max);
+
+ return round_to<U, T>::value(result);
+}
+
+
+template <typename T>
+T T2DInterpolator<T>::operator () (const C2DFVector& x) const
+{
+ typedef typename TCoeff2D::value_type U;
+
+ CScopedLock lock(m_cache_lock);
+
+ m_kernel->get_uncached(x.x, m_cache.x);
- if (x.y != m_y_cache.x)
- m_kernel->get_cached(x.y, m_y_cache);
+ if (x.y != m_cache.y.x)
+ m_kernel->get_cached(x.y, m_cache.y);
U result = U();
// give the compiler some chance to optimize
switch (m_kernel->size()) {
- case 1: result = add_2d_new<TCoeff2D,1>::value(m_coeff, m_x_cache, m_y_cache); break;
- case 2: result = add_2d_new<TCoeff2D,2>::value(m_coeff, m_x_cache, m_y_cache); break;
- case 3: result = add_2d_new<TCoeff2D,3>::value(m_coeff, m_x_cache, m_y_cache); break;
- case 4: result = add_2d_new<TCoeff2D,4>::value(m_coeff, m_x_cache, m_y_cache); break;
- case 5: result = add_2d_new<TCoeff2D,5>::value(m_coeff, m_x_cache, m_y_cache); break;
- case 6: result = add_2d_new<TCoeff2D,6>::value(m_coeff, m_x_cache, m_y_cache); break;
+ case 1: result = add_2d_new<TCoeff2D,1>::value(m_coeff, m_cache); break;
+ case 2: result = add_2d_new<TCoeff2D,2>::value(m_coeff, m_cache); break;
+ case 3: result = add_2d_new<TCoeff2D,3>::value(m_coeff, m_cache); break;
+ case 4: result = add_2d_new<TCoeff2D,4>::value(m_coeff, m_cache); break;
+ case 5: result = add_2d_new<TCoeff2D,5>::value(m_coeff, m_cache); break;
+ case 6: result = add_2d_new<TCoeff2D,6>::value(m_coeff, m_cache); break;
default: {
/* perform interpolation */
assert(0 && "spline degree > 5 not implemented");
@@ -320,31 +345,32 @@ T T2DConvoluteInterpolator<T>::operator () (const C2DFVector& x) const
}
template <typename T>
-T2DVector<T> T2DConvoluteInterpolator<T>::derivative_at(const C2DFVector& x) const
+T2DVector<T> T2DInterpolator<T>::derivative_at(const C2DFVector& x) const
{
T2DVector<T> result;
+ CScopedLock lock(m_cache_lock);
// cut at boundary maybe we can do better
if (x.x < 0.0 || x.y < 0.0 || x.x >= m_coeff.get_size().x || x.y >= m_coeff.get_size().y)
return result;
- const int xi = m_kernel->get_indices(x.x, m_x_index);
+ const int xi = m_kernel->get_indices(x.x, m_cache.x.index);
const double fx = x.x - xi;
- m_kernel->get_derivative_weights(fx, m_x_weight);
- m_x_boundary->apply(m_x_index, m_x_weight);
+ m_kernel->get_derivative_weights(fx, m_cache.x.weights);
+ m_x_boundary->apply(m_cache.x.index, m_cache.x.weights);
- const int yi = m_kernel->get_indices(x.y, m_y_index);
+ const int yi = m_kernel->get_indices(x.y, m_cache.y.index);
const double fy = x.y - yi;
- m_kernel->get_weights(fy, m_y_weight);
- m_y_boundary->apply(m_y_index, m_y_weight);
+ m_kernel->get_weights(fy, m_cache.y.weights);
+ m_y_boundary->apply(m_cache.y.index, m_cache.y.weights);
typename TCoeff2D::value_type r = evaluate();
result.x = round_to<typename TCoeff2D::value_type, T>::value(r);
- m_kernel->get_weights(fx, m_x_weight);
- m_kernel->get_derivative_weights(fy, m_y_weight);
+ m_kernel->get_weights(fx, m_cache.x.weights);
+ m_kernel->get_derivative_weights(fy, m_cache.y.weights);
r = evaluate();
result.y = round_to<typename TCoeff2D::value_type, T>::value(r);
diff --git a/mia/2d/interpolator.hh b/mia/2d/interpolator.hh
index bbbed9e..8c5339d 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -59,35 +59,6 @@ struct max_hold_type<T2DVector<T> > {
};
/// @endcond
-/**
- \ingroup interpol
-
- \tparam T data type to be interpolated
-
- \brief The base class template for all kinds of interpolators
-
- Basic Interpolator type for 2D Data.
-*/
-template <typename T>
-class EXPORT_2D T2DInterpolator {
-public:
-
- /** a virtual destructor is neccessary for some of the interpolators */
- virtual ~T2DInterpolator(){}
- /**
- \param x location of data value to read
- \returns interpolated value at location x
- */
- virtual T operator () (const C2DFVector& x) const = 0;
-
- /**
- \param x location of data value to read
- \returns interpolated gradient at location x
- */
- virtual T2DVector<T> derivative_at(const C2DFVector& x) const = 0;
-
-};
-
/**
@cond INTERNAL
*/
@@ -99,6 +70,20 @@ struct coeff_map<T2DVector<U> > {
/// @endcond
+
+/**
+ @cond INTERNAL
+*/
+struct C2DWeightCache {
+ CSplineKernel::SCache x;
+ CSplineKernel::SCache y;
+
+ C2DWeightCache(int kernel_size,
+ const CSplineBoundaryCondition& xbc,
+ const CSplineBoundaryCondition& ybc);
+};
+/// @endcond
+
/**
\ingroup interpol
@@ -110,7 +95,7 @@ struct coeff_map<T2DVector<U> > {
spacial convolution, like e.g. by using B-splines.
*/
template <class T>
-class EXPORT_2D T2DConvoluteInterpolator: public T2DInterpolator<T> {
+class EXPORT_2D T2DInterpolator {
public:
/**
Constructor for the interpolator. The input data is pre-filtered in order to
@@ -118,7 +103,7 @@ public:
\param data input data to base th einterpolation on
\param kernel the B-spline kernel to be used.
*/
- T2DConvoluteInterpolator(const T2DDatafield<T>& data, PSplineKernel kernel);
+ T2DInterpolator(const T2DDatafield<T>& data, PSplineKernel kernel);
/**
Construtor to prefilter the input for proper interpolation
@@ -128,10 +113,17 @@ public:
\param ybc boundary conditions to be applied along the y-axis when interpolating
*/
- T2DConvoluteInterpolator(const T2DDatafield<T>& data, PSplineKernel kernel,
+ T2DInterpolator(const T2DDatafield<T>& data, PSplineKernel kernel,
const CSplineBoundaryCondition& xbc, const CSplineBoundaryCondition& ybc);
- ~T2DConvoluteInterpolator();
+ ~T2DInterpolator();
+
+ /**
+ Create the cache structure needed to run the interpolation in a multi-threaded
+ environment. This function must be called in each thread once.
+ \returns the cache structure
+ */
+ C2DWeightCache create_cache() const;
/**
@@ -142,6 +134,9 @@ public:
*/
T operator () (const C2DFVector& x) const;
+
+ T operator () (const C2DFVector& x, C2DWeightCache& cache) const;
+
/**
Evaluate the first order derivative on the given coordinate
\param x location
@@ -178,15 +173,9 @@ private:
typename T2DDatafield<T>::value_type m_min;
typename T2DDatafield<T>::value_type m_max;
- /// This part makes the class to be not thread save
- mutable CSplineKernel::VIndex m_x_index;
- mutable CSplineKernel::VIndex m_y_index;
- mutable CSplineKernel::VWeight m_x_weight;
- mutable CSplineKernel::VWeight m_y_weight;
- mutable CSplineKernel::SCache m_x_cache;
- mutable CSplineKernel::SCache m_y_cache;
+ mutable CMutex m_cache_lock;
+ mutable C2DWeightCache m_cache;
-
};
@@ -269,7 +258,7 @@ typedef std::shared_ptr<C2DInterpolatorFactory > P2DInterpolatorFactory;
template <class T>
T2DInterpolator<T> *C2DInterpolatorFactory::create(const T2DDatafield<T>& src) const
{
- return new T2DConvoluteInterpolator<T>(src, m_kernel, *m_xbc, *m_ybc);
+ return new T2DInterpolator<T>(src, m_kernel, *m_xbc, *m_ybc);
}
NS_MIA_END
diff --git a/mia/2d/io/bmp.cc b/mia/2d/io/bmp.cc
index f4b7ba8..d868b90 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 497d79d..cd33c42 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 c2339d4..0a2727a 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,18 +35,18 @@ using namespace std;
const char *testset_init = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<workset>"
"<description><RVpeak value=\"2\"/>"
"<LVpeak value=\"1\"/><PreferedRef value=\"0\"/></description>"
- " <frame image=\"image.png\">"
- " <star y=\"118\" x=\"109\" r=\"21\">"
- " <point y=\"20\" x=\"10\"/>"
- " <point y=\"10\" x=\"20\"/>"
- " <point y=\"4\" x=\"0\"/>"
+ " <frame image=\"image.bmp\">"
+ " <star r=\"21\" x=\"109\" y=\"118\">"
+ " <point x=\"10\" y=\"20\"/>"
+ " <point x=\"20\" y=\"10\"/>"
+ " <point x=\"0\" y=\"4\"/>"
" </star>"
" </frame>"
- " <frame image=\"image2.png\">"
- " <star y=\"117\" x=\"119\" r=\"22\">"
- " <point y=\"21\" x=\"11\"/>"
- " <point y=\"11\" x=\"21\"/>"
- " <point y=\"5\" x=\"1\"/>"
+ " <frame image=\"image2.bmp\">"
+ " <star r=\"22\" x=\"119\" y=\"117\">"
+ " <point x=\"11\" y=\"21\"/>"
+ " <point x=\"21\" y=\"11\"/>"
+ " <point x=\"1\" y=\"5\"/>"
" </star>"
" </frame>"
"</workset>\n";
@@ -60,8 +60,8 @@ BOOST_AUTO_TEST_CASE( test_read_simple )
fill(img1.begin(), img1.end(), 0);
fill(img2.begin(), img2.end(), 1);
- save_image("image.png", img1);
- save_image("image2.png", img2);
+ save_image("image.bmp", img1);
+ save_image("image2.bmp", img2);
ofstream testfile("segset.set");
testfile << testset_init;
@@ -82,9 +82,9 @@ BOOST_AUTO_TEST_CASE( test_read_simple )
BOOST_CHECK_EQUAL(frames.size(), 2u);
- unlink("segset.set");
- unlink("image.png");
- unlink("image2.png");
+// unlink("segset.set");
+ unlink("image.bmp");
+ unlink("image2.bmp");
}
@@ -143,7 +143,7 @@ BOOST_AUTO_TEST_CASE( test_write_simple )
in_sections0.push_back(s11);
in_sections0.push_back(s12);
- CSegFrame in_frame0("image1.png", in_star0, in_sections0);
+ CSegFrame in_frame0("image1.bmp", in_star0, in_sections0);
in_frame0.set_quality(3.3);
in_frame0.set_brightness(1.0);
in_frame0.set_contrast(-1.0);
@@ -186,7 +186,7 @@ BOOST_AUTO_TEST_CASE( test_write_simple )
}
unlink("testsaveset.set");
- unlink("image1.png");
+ unlink("image1.bmp");
}
diff --git a/mia/2d/io/xml.cc b/mia/2d/io/xml.cc
index ffee85c..3d2c3b8 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,16 +21,21 @@
#include <boost/filesystem.hpp>
-#include <libxml++/libxml++.h>
#include <mia/core/tools.hh>
+#include <mia/core/xmlinterface.hh>
#include <mia/2d/io/xml.hh>
+#include <iterator>
+
+
NS_BEGIN(myosegset2d)
using namespace mia;
using std::string;
-using std::ofstream;
-using std::unique_ptr;
+using std::ofstream;
+using std::ifstream;
+using std::unique_ptr;
+using std::runtime_error;
namespace bfs=boost::filesystem;
CXMLSegSetWithImagesIOPlugin::CXMLSegSetWithImagesIOPlugin():
@@ -43,36 +48,40 @@ CXMLSegSetWithImagesIOPlugin::CXMLSegSetWithImagesIOPlugin():
PSegSetWithImages CXMLSegSetWithImagesIOPlugin::do_load(const string& fname) const
{
- xmlpp::DomParser parser;
- parser.set_substitute_entities(); //We just want the text to be resolved/unescaped automatically.
- parser.parse_file(fname);
-
- if (!parser){
- cvdebug() << "CXMLSegSetWithImagesIOPlugin:'" << fname << "' is not a XML document\n";
- return PSegSetWithImages();
+ ifstream infile(fname);
+ string xml_init(std::istreambuf_iterator<char>{infile}, {});
+
+ if (!infile.good())
+ throw create_exception<runtime_error>("CXMLSegSetWithImagesIOPlugin: Unable to read input file: '", fname, "'");
+
+ CXMLDocument doc;
+ if (!doc.read_from_string(xml_init.c_str())) {
+ cvdebug() << "CXMLSegSetWithImagesIOPlugin:'" << fname
+ << "' not an XML file\n";
+ return PSegSetWithImages();
}
+
+ auto root = doc.get_root_node ();
- const auto *document = parser.get_document();
- const auto *root = document->get_root_node ();
if (root->get_name() != "workset") {
cvdebug() << "CXMLSegSetWithImagesIOPlugin:'" << fname
<< "' XML file is not a segmentation set\n";
return PSegSetWithImages();
}
-
+
bfs::path src_path_(fname);
src_path_.remove_filename();
auto src_path = src_path_.string();
+ return PSegSetWithImages(new CSegSetWithImages(doc, src_path));
- return PSegSetWithImages(new CSegSetWithImages(*document, src_path));
}
bool CXMLSegSetWithImagesIOPlugin::do_save(const string& fname, const CSegSetWithImages& data) const
{
- unique_ptr<xmlpp::Document> outset(data.write());
+ auto outset = data.write();
ofstream outfile(fname.c_str() );
if (outfile.good()) {
- outfile << outset->write_to_string_formatted();
+ outfile << outset.write_to_string();
data.save_images(fname);
}
return outfile.good();
diff --git a/mia/2d/io/xml.hh b/mia/2d/io/xml.hh
index 5f60f32..14920e5 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 2ef3b0f..6a0dc92 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 fa0a282..ab77a2e 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,7 +39,7 @@ NS_MIA_BEGIN
*/
template <typename I>
-class range2d_iterator_with_boundary_flag: public std::forward_iterator_tag {
+class EXPORT_2D range2d_iterator_with_boundary_flag: public std::forward_iterator_tag {
public:
/// data type reference
typedef typename I::reference reference;
@@ -211,8 +211,8 @@ bool operator != (const range2d_iterator_with_boundary_flag<T>& left, const rang
template <typename I>
-class range2d_iterator: public std::iterator<std::forward_iterator_tag, typename I::value_type>
- {
+class EXPORT_2D range2d_iterator: public std::iterator<std::forward_iterator_tag, typename I::value_type>
+{
public:
/// data type reference
typedef typename I::reference reference;
@@ -301,7 +301,13 @@ public:
internal_iterator get_point();
- range2d_iterator_with_boundary_flag<I> with_boundary_flag() const;
+ range2d_iterator_with_boundary_flag<I> with_boundary_flag() const;
+
+ /**
+ access elements relative to the iterator position
+ */
+ const reference operator[] (int i) const;
+
private:
void increment_y();
@@ -370,6 +376,14 @@ bool operator != (const range2d_iterator<I>& a, const range2d_iterator<I>& b)
return !(a == b);
}
+template <typename I>
+const typename range2d_iterator<I>::reference
+range2d_iterator<I>::operator[] (int i) const
+{
+ return m_iterator[i];
+}
+
+
NS_MIA_END
diff --git a/mia/2d/kernel/curv.cc b/mia/2d/kernel/curv.cc
index 2e73729..b605adb 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 15a37db..bd14527 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 bee308c..fec7e9b 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 a97c823..ec4531c 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-2016 Gert Wollny
+ * This file is part of MIA - a toolbox for medical image analysis
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,214 +19,223 @@
*/
#include <mia/2d/maskedcost/lncc.hh>
-#include <mia/core/nccsum.hh>
+#include <mia/core/nccsum.hh>
#include <mia/core/threadedmsg.hh>
#include <mia/core/parallel.hh>
NS_BEGIN(NS)
-using namespace mia;
-using std::vector;
-using std::pair;
-using std::make_pair;
+using namespace mia;
+using std::vector;
+using std::pair;
+using std::make_pair;
CLNCC2DImageCost::CLNCC2DImageCost(int hw):
m_hwidth(hw)
{
+ m_copy_to_double = produce_2dimage_filter("convert:repn=double,map=copy");
}
-inline pair<C2DBounds, C2DBounds> prepare_range(const C2DBounds& size, int cx, int cy, int hw)
+inline pair<C2DBounds, C2DBounds> prepare_range(const C2DBounds& size, int cx, int cy, int hw)
{
- int yb = cy - hw;
- if (yb < 0) yb = 0;
- unsigned ye = cy + hw + 1;
- if (ye > size.y) ye = size.y;
-
- int xb = cx - hw;
- if (xb < 0) xb = 0;
- unsigned xe = cx + hw + 1;
- if (xe > size.x) xe = size.x;
-
- return make_pair(C2DBounds(xb,yb), C2DBounds(xe,ye));
+ int yb = cy - hw;
+ if (yb < 0) yb = 0;
+ unsigned ye = cy + hw + 1;
+ if (ye > size.y) ye = size.y;
+
+ int xb = cx - hw;
+ if (xb < 0) xb = 0;
+ unsigned xe = cx + hw + 1;
+ if (xe > size.x) xe = size.x;
+
+ return make_pair(C2DBounds(xb,yb), C2DBounds(xe,ye));
}
class FEvalCost : public TFilter<float> {
- int m_hw;
- const C2DBitImage& m_mask;
+ int m_hw;
+ const C2DBitImage& m_mask;
public:
- FEvalCost(int hw, const C2DBitImage& mask):
- m_hw(hw),
- m_mask(mask)
- {}
-
- template <typename T, typename R>
- float operator () ( const T& mov, const R& ref) const {
- auto evaluate_local_cost = [this, &mov, &ref](const C1DParallelRange& range, const pair<float, int>& result) -> pair<float, int> {
- CThreadMsgStream msks;
- float lresult = 0.0;
- int count = 0;
- const int max_length = 2 * m_hw +1;
- vector<float> a_buffer( max_length * max_length * max_length);
- vector<float> b_buffer( max_length * max_length * max_length);
-
- for (auto y = range.begin(); y != range.end(); ++y) {
- auto imask = m_mask.begin_at(0,y);
- for (size_t x = 0; x < mov.get_size().x; ++x, ++imask) {
- if (!*imask)
- continue;
-
- auto c_block = prepare_range(mov.get_size(), x, y, m_hw);
-
- NCCSums sum;
- for (unsigned iy = c_block.first.y; iy < c_block.second.y; ++iy) {
- auto ia = mov.begin_at(0,iy);
- auto ib = ref.begin_at(0, iy);
- auto im = m_mask.begin_at(0, iy);
- for (unsigned ix = c_block.first.x; ix < c_block.second.x; ++ix) {
-
- // make a local copy
- if (im[ix]) {
- sum.add(ia[ix], ib[ix]);
- }
- }
- }
-
- if (sum.has_samples()) {
- lresult += sum.value();
- ++count;
- }
-
-
- }
- }
- return make_pair(result.first + lresult, result.second + count);
- };
-
- pair<float,int> init{0, 0};
- auto r = preduce(C1DParallelRange(0, mov.get_size().y, 1), init, evaluate_local_cost,
- [](const pair<float,int>& x, const pair<float,int>& y){
- return make_pair(x.first + y.first, x.second + y.second);
- });
- cvdebug() << "result={" << r.first << " / " << r.second << "\n";
- return r.second > 0 ? r.first / r.second : 0.0;
- }
-};
+ FEvalCost(int hw, const C2DBitImage& mask):
+ m_hw(hw),
+ m_mask(mask)
+ {}
+
+ float operator () ( const C2DDImage& mov, const C2DDImage& ref) const {
+ auto evaluate_local_cost = [this, &mov, &ref](const C1DParallelRange& range, const pair<float, int>& result) -> pair<float, int> {
+ CThreadMsgStream msks;
+ float lresult = 0.0;
+ int count = 0;
+ const int max_length = 2 * m_hw +1;
+ vector<float> a_buffer( max_length * max_length * max_length);
+ vector<float> b_buffer( max_length * max_length * max_length);
+
+ for (auto y = range.begin(); y != range.end(); ++y) {
+ auto imask = m_mask.begin_at(0,y);
+ for (size_t x = 0; x < mov.get_size().x; ++x, ++imask) {
+ if (!*imask)
+ continue;
+
+ auto c_block = prepare_range(mov.get_size(), x, y, m_hw);
+
+ NCCSums sum;
+ for (unsigned iy = c_block.first.y; iy < c_block.second.y; ++iy) {
+ auto ia = mov.begin_at(0,iy);
+ auto ib = ref.begin_at(0, iy);
+ auto im = m_mask.begin_at(0, iy);
+ for (unsigned ix = c_block.first.x; ix < c_block.second.x; ++ix) {
+
+ // make a local copy
+ if (im[ix]) {
+ sum.add(ia[ix], ib[ix]);
+ }
+ }
+ }
+
+ if (sum.has_samples()) {
+ lresult += sum.value();
+ ++count;
+ }
+
+
+ }
+ }
+ return make_pair(result.first + lresult, result.second + count);
+ };
+
+ pair<float,int> init{0, 0};
+ auto r = preduce(C1DParallelRange(0, mov.get_size().y, 1), init, evaluate_local_cost,
+ [](const pair<float,int>& x, const pair<float,int>& y){
+ return make_pair(x.first + y.first, x.second + y.second);
+ });
+ cvdebug() << "result={" << r.first << " / " << r.second << "\n";
+ return r.second > 0 ? r.first / r.second : 0.0;
+ }
+};
double CLNCC2DImageCost::do_value(const Data& a, const Data& b, const Mask& m) const
{
- FEvalCost ecost(m_hwidth, m);
- return mia::filter(ecost, a, b);
+ auto a_double_ptr = m_copy_to_double->filter(a);
+ auto b_double_ptr = m_copy_to_double->filter(b);
+ const auto& mov = static_cast<const C2DDImage&>(*a_double_ptr);
+ const auto& ref = static_cast<const C2DDImage&>(*b_double_ptr);
+
+ FEvalCost ecost(m_hwidth, m);
+ return ecost(mov, ref);
}
class FEvalCostForce : public TFilter<float> {
- int m_hw;
- const C2DBitImage& m_mask;
- C2DFVectorfield& m_force;
-public:
- FEvalCostForce(int hw, const C2DBitImage& mask, C2DFVectorfield& force):
- m_hw(hw),
- m_mask(mask),
- m_force(force)
- {}
-
- template <typename T, typename R>
- float operator () ( const T& mov, const R& ref) const {
- auto ag = get_gradient(mov);
- auto evaluate_local_cost_force = [this, &mov, &ref, &ag](const C1DParallelRange& range,
- const pair<float, int>& result) -> pair<float, int> {
-
- CThreadMsgStream msks;
- float lresult = 0.0;
- int count = 0;
- const int max_length = 2 * m_hw + 1;
- vector<float> a_buffer( max_length * max_length * max_length);
- vector<float> b_buffer( max_length * max_length * max_length);
-
- for (auto y = range.begin(); y != range.end(); ++y) {
-
- auto iforce = m_force.begin_at(0,y);
- auto imask = m_mask.begin_at(0,y);
- auto ig = ag.begin_at(0,y);
- auto imov = mov.begin_at(0,y);
- auto iref = ref.begin_at(0,y);
-
- for (size_t x = 0; x < mov.get_size().x; ++x, ++iforce, ++imask, ++ig, ++iref, ++imov) {
- if (!*imask)
- continue;
-
- auto c_block = prepare_range(mov.get_size(), x, y, m_hw);
-
-
- NCCSums sum;
- for (unsigned iy = c_block.first.y; iy < c_block.second.y; ++iy) {
- auto ia = mov.begin_at(0,iy);
- auto ib = ref.begin_at(0, iy);
- auto im = m_mask.begin_at(0, iy);
- for (unsigned ix = c_block.first.x; ix < c_block.second.x; ++ix) {
-
- // make a local copy
- if (im[ix]) {
- sum.add(ia[ix], ib[ix]);
- }
- }
- }
-
- if (sum.has_samples()) {
- auto res = sum.get_grad_helper();
- lresult += res.first;
- *iforce = res.second.get_gradient_scale(*imov, *iref) * *ig;
- ++count;
- }
-
- }
- }
- return make_pair(result.first + lresult, result.second + count);
- };
- pair<float,int> init{0, 0};
- auto r = preduce(C1DParallelRange(0, mov.get_size().y, 1), init, evaluate_local_cost_force,
- [](const pair<float,int>& x, const pair<float,int>& y){
- return make_pair(x.first + y.first, x.second + y.second);
- });
-
- return r.second > 0 ? r.first / r.second : 0.0;
- }
-
+ int m_hw;
+ const C2DBitImage& m_mask;
+ C2DFVectorfield& m_force;
+public:
+ FEvalCostForce(int hw, const C2DBitImage& mask, C2DFVectorfield& force):
+ m_hw(hw),
+ m_mask(mask),
+ m_force(force)
+ {}
+
+ float operator () ( const C2DDImage& mov, const C2DDImage& ref) const {
+ auto ag = get_gradient(mov);
+ auto evaluate_local_cost_force = [this, &mov, &ref, &ag](const C1DParallelRange& range,
+ const pair<float, int>& result) -> pair<float, int> {
+
+ CThreadMsgStream msks;
+ float lresult = 0.0;
+ int count = 0;
+ const int max_length = 2 * m_hw + 1;
+ vector<float> a_buffer( max_length * max_length * max_length);
+ vector<float> b_buffer( max_length * max_length * max_length);
+
+ for (auto y = range.begin(); y != range.end(); ++y) {
+
+ auto iforce = m_force.begin_at(0,y);
+ auto imask = m_mask.begin_at(0,y);
+ auto ig = ag.begin_at(0,y);
+ auto imov = mov.begin_at(0,y);
+ auto iref = ref.begin_at(0,y);
+
+ for (size_t x = 0; x < mov.get_size().x; ++x, ++iforce, ++imask, ++ig, ++iref, ++imov) {
+ if (!*imask)
+ continue;
+
+ auto c_block = prepare_range(mov.get_size(), x, y, m_hw);
+
+
+ NCCSums sum;
+ for (unsigned iy = c_block.first.y; iy < c_block.second.y; ++iy) {
+ auto ia = mov.begin_at(0,iy);
+ auto ib = ref.begin_at(0, iy);
+ auto im = m_mask.begin_at(0, iy);
+ for (unsigned ix = c_block.first.x; ix < c_block.second.x; ++ix) {
+
+ // make a local copy
+ if (im[ix]) {
+ sum.add(ia[ix], ib[ix]);
+ }
+ }
+ }
+
+ if (sum.has_samples()) {
+ auto res = sum.get_grad_helper();
+ lresult += res.first;
+ *iforce = res.second.get_gradient_scale(*imov, *iref) * *ig;
+ ++count;
+ }
+
+ }
+ }
+ return make_pair(result.first + lresult, result.second + count);
+ };
+ pair<float,int> init{0, 0};
+ auto r = preduce(C1DParallelRange(0, mov.get_size().y, 1), init, evaluate_local_cost_force,
+ [](const pair<float,int>& x, const pair<float,int>& y){
+ return make_pair(x.first + y.first, x.second + y.second);
+ });
+
+ return r.second > 0 ? r.first / r.second : 0.0;
+ }
+
};
double CLNCC2DImageCost::do_evaluate_force(const Data& a, const Data& b, const Mask& m, Force& force) const
{
- FEvalCostForce ecostforce(m_hwidth, m, force);
- return mia::filter(ecostforce, a, b);
+ auto a_double_ptr = m_copy_to_double->filter(a);
+ auto b_double_ptr = m_copy_to_double->filter(b);
+ const auto& mov = static_cast<const C2DDImage&>(*a_double_ptr);
+ const auto& ref = static_cast<const C2DDImage&>(*b_double_ptr);
+
+ FEvalCostForce ecostforce(m_hwidth, m, force);
+ return ecostforce(mov, ref);
}
CLNCC2DImageCostPlugin::CLNCC2DImageCostPlugin():
-C2DMaskedImageCostPlugin("lncc"),
+C2DMaskedImageCostPlugin("lncc"),
m_hw(5)
{
- this->add_parameter("w", make_ci_param(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
{
- return new CLNCC2DImageCost(m_hw);
+ return new CLNCC2DImageCost(m_hw);
}
const std::string CLNCC2DImageCostPlugin::do_get_descr() const
{
- return "local normalized cross correlation with masking support.";
+ return "local normalized cross correlation with masking support.";
}
extern "C" EXPORT CPluginBase *get_plugin_interface()
{
- return new CLNCC2DImageCostPlugin();
+ return new CLNCC2DImageCostPlugin();
}
NS_END
diff --git a/mia/2d/maskedcost/lncc.hh b/mia/2d/maskedcost/lncc.hh
index 666dd4b..c467fc1 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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_2d_maskedcost_lncc_hh
#include <mia/2d/maskedcost.hh>
+#include <mia/2d/filter.hh>
#define NS mia_2d_maskedlncc
@@ -37,7 +38,7 @@ public:
private:
virtual double do_value(const Data& a, const Data& b, const Mask& m) const;
virtual double do_evaluate_force(const Data& a, const Data& b, const Mask& m, Force& force) const;
-
+ mia::P2DFilter m_copy_to_double;
int m_hwidth;
};
diff --git a/mia/2d/maskedcost/mi.cc b/mia/2d/maskedcost/mi.cc
index bab8c75..ddff155 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 e48d162..eb53ea3 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 55d32d9..e53cfde 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-2016 Gert Wollny
+ * This file is part of MIA - a toolbox for medical image analysis
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,142 +21,147 @@
#include <mia/2d/maskedcost/ncc.hh>
#include <mia/core/threadedmsg.hh>
-#include <mia/core/nccsum.hh>
+#include <mia/core/nccsum.hh>
#include <mia/core/parallel.hh>
NS_BEGIN(NS)
-using namespace mia;
+using namespace mia;
CNCC2DImageCost::CNCC2DImageCost()
{
+ m_copy_to_double = produce_2dimage_filter("convert:repn=double,map=copy");
}
-template <typename T, typename S>
struct FEvaluateNCCSum {
- FEvaluateNCCSum(const C2DBitImage& mask, const T& mov, const S& ref);
- NCCSums operator ()(const C1DParallelRange& range, const NCCSums& sumacc) const;
-private:
- C2DBitImage m_mask;
- T m_mov;
- S m_ref;
+ FEvaluateNCCSum(const C2DBitImage& mask, const C2DDImage& mov, const C2DDImage& ref);
+ NCCSums operator ()(const C1DParallelRange& range, const NCCSums& sumacc) const;
+private:
+ const C2DBitImage& m_mask;
+ const C2DDImage& m_mov;
+ const C2DDImage& m_ref;
};
-template <typename T, typename S>
-FEvaluateNCCSum<T,S>::FEvaluateNCCSum(const C2DBitImage& mask, const T& mov, const S& ref):
- m_mask(mask), m_mov(mov), m_ref(ref)
+FEvaluateNCCSum::FEvaluateNCCSum(const C2DBitImage& mask, const C2DDImage& mov, const C2DDImage& ref):
+ m_mask(mask), m_mov(mov), m_ref(ref)
{
-
+
}
-template <typename T, typename S>
-NCCSums FEvaluateNCCSum<T,S>::operator ()(const C1DParallelRange& range, const NCCSums& sumacc) const
+NCCSums FEvaluateNCCSum::operator ()(const C1DParallelRange& range, const NCCSums& sumacc) const
{
- CThreadMsgStream msks;
-
- NCCSums sum;
- for (auto z = range.begin(); z != range.end(); ++z) {
- auto imask = m_mask.begin_at(0,z);
- auto ia = m_mov.begin_at(0, z);
- auto ib = m_ref.begin_at(0, z);
- auto eb = m_ref.begin_at(0, z + 1);
-
- while (ib != eb) {
- if (*imask) {
- sum.add(*ia, *ib);
- }
- ++ia; ++ib; ++imask;
- }
- }
- return sum + sumacc;
+ CThreadMsgStream msks;
+
+ NCCSums sum;
+ for (auto z = range.begin(); z != range.end(); ++z) {
+ auto imask = m_mask.begin_at(0,z);
+ auto ia = m_mov.begin_at(0, z);
+ auto ib = m_ref.begin_at(0, z);
+ auto eb = m_ref.begin_at(0, z + 1);
+
+ while (ib != eb) {
+ if (*imask) {
+ sum.add(*ia, *ib);
+ }
+ ++ia; ++ib; ++imask;
+ }
+ }
+ return sum + sumacc;
};
class FEvalCost : public TFilter<float> {
- const C2DBitImage& m_mask;
+ const C2DBitImage& m_mask;
public:
- FEvalCost(const C2DBitImage& mask):
- m_mask(mask)
- {}
-
- template <typename T, typename R>
- float operator () ( const T& mov, const R& ref) const {
-
- FEvaluateNCCSum<T,R> ev(m_mask, mov, ref);
- NCCSums sum;
- sum = preduce(C1DParallelRange(0, mov.get_size().y, 1), sum, ev,
- [](const NCCSums& x, const NCCSums& y){
- return x + y;
- });
- return sum.value();
- }
-};
+ FEvalCost(const C2DBitImage& mask):
+ m_mask(mask)
+ {}
+
+ float operator () ( const C2DDImage& mov, const C2DDImage& ref) const {
+
+ FEvaluateNCCSum ev(m_mask, mov, ref);
+ NCCSums sum;
+ sum = preduce(C1DParallelRange(0, mov.get_size().y, 1), sum, ev,
+ [](const NCCSums& x, const NCCSums& y){
+ return x + y;
+ });
+ return sum.value();
+ }
+};
double CNCC2DImageCost::do_value(const Data& a, const Data& b, const Mask& m) const
{
- FEvalCost ecost(m);
- return mia::filter(ecost, a, b);
+ auto a_double_ptr = m_copy_to_double->filter(a);
+ auto b_double_ptr = m_copy_to_double->filter(b);
+ const auto& mov = static_cast<const C2DDImage&>(*a_double_ptr);
+ const auto& ref = static_cast<const C2DDImage&>(*b_double_ptr);
+ FEvalCost ecost(m);
+ return ecost(mov, ref);
}
class FEvalCostForce : public TFilter<float> {
- const C2DBitImage& m_mask;
- C2DFVectorfield& m_force;
-public:
- FEvalCostForce(const C2DBitImage& mask, C2DFVectorfield& force):
- m_mask(mask),
- m_force(force)
- {}
-
- template <typename T, typename R>
- float operator () ( const T& mov, const R& ref) const {
- CThreadMsgStream msks;
-
- NCCSums sum;
- FEvaluateNCCSum<T,R> ev(m_mask, mov, ref);
- sum = preduce(C1DParallelRange(0, mov.get_size().y, 1), sum, ev,
- [](const NCCSums& x, const NCCSums& y){
- return x + y;
- });
-
- auto geval = sum.get_grad_helper();
-
- auto grad = get_gradient(mov);
- auto grad_eval = [this, &mov, &ref, &grad, &geval](const C1DParallelRange& range) {
- for (auto z = range.begin(); z != range.end(); ++z) {
- auto ig = grad.begin_at(0,z);
- auto iforce = m_force.begin_at(0,z);
- auto im = m_mask.begin_at(0,z);
- auto ia = mov.begin_at(0,z);
- auto ib = ref.begin_at(0,z);
- auto eb = ref.begin_at(0,z+1);
-
- while (ib != eb) {
- if (*im) {
- *iforce = geval.second.get_gradient_scale(*ia, *ib) * *ig;
- }
- ++ig;
- ++iforce;
- ++ia; ++ib; ++im;
- }
- };
- };
-
- pfor(C1DParallelRange(0, mov.get_size().y, 1), grad_eval);
-
- return geval.first;
- }
-
+ const C2DBitImage& m_mask;
+ C2DFVectorfield& m_force;
+public:
+ FEvalCostForce(const C2DBitImage& mask, C2DFVectorfield& force):
+ m_mask(mask),
+ m_force(force)
+ {}
+
+ float operator () ( const C2DDImage& mov, const C2DDImage& ref) const {
+ CThreadMsgStream msks;
+
+ NCCSums sum;
+ FEvaluateNCCSum ev(m_mask, mov, ref);
+ sum = preduce(C1DParallelRange(0, mov.get_size().y, 1), sum, ev,
+ [](const NCCSums& x, const NCCSums& y){
+ return x + y;
+ });
+
+ auto geval = sum.get_grad_helper();
+
+ auto grad = get_gradient(mov);
+ auto grad_eval = [this, &mov, &ref, &grad, &geval](const C1DParallelRange& range) {
+ for (auto z = range.begin(); z != range.end(); ++z) {
+ auto ig = grad.begin_at(0,z);
+ auto iforce = m_force.begin_at(0,z);
+ auto im = m_mask.begin_at(0,z);
+ auto ia = mov.begin_at(0,z);
+ auto ib = ref.begin_at(0,z);
+ auto eb = ref.begin_at(0,z+1);
+
+ while (ib != eb) {
+ if (*im) {
+ *iforce = geval.second.get_gradient_scale(*ia, *ib) * *ig;
+ }
+ ++ig;
+ ++iforce;
+ ++ia; ++ib; ++im;
+ }
+ };
+ };
+
+ pfor(C1DParallelRange(0, mov.get_size().y, 1), grad_eval);
+
+ return geval.first;
+ }
+
};
double CNCC2DImageCost::do_evaluate_force(const Data& a, const Data& b, const Mask& m, Force& force) const
{
- FEvalCostForce ecostforce(m, force);
- return mia::filter(ecostforce, a, b);
+ auto a_double_ptr = m_copy_to_double->filter(a);
+ auto b_double_ptr = m_copy_to_double->filter(b);
+ const auto& mov = static_cast<const C2DDImage&>(*a_double_ptr);
+ const auto& ref = static_cast<const C2DDImage&>(*b_double_ptr);
+
+ FEvalCostForce ecostforce(m, force);
+ return ecostforce(mov, ref);
}
@@ -167,17 +172,17 @@ C2DMaskedImageCostPlugin("ncc")
C2DMaskedImageCost *CNCC2DImageCostPlugin::do_create() const
{
- return new CNCC2DImageCost();
+ return new CNCC2DImageCost();
}
const std::string CNCC2DImageCostPlugin::do_get_descr() const
{
- return "normalized cross correlation with masking support.";
+ return "normalized cross correlation with masking support.";
}
extern "C" EXPORT CPluginBase *get_plugin_interface()
{
- return new CNCC2DImageCostPlugin();
+ return new CNCC2DImageCostPlugin();
}
NS_END
diff --git a/mia/2d/maskedcost/ncc.hh b/mia/2d/maskedcost/ncc.hh
index 816e6e6..e09af04 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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_2d_maskedcost_ncc_hh
#include <mia/2d/maskedcost.hh>
+#include <mia/2d/filter.hh>
#define NS mia_2d_maskedncc
@@ -36,7 +37,8 @@ public:
CNCC2DImageCost();
private:
virtual double do_value(const Data& a, const Data& b, const Mask& m) const;
- virtual double do_evaluate_force(const Data& a, const Data& b, const Mask& m, Force& force) const;
+ virtual double do_evaluate_force(const Data& a, const Data& b, const Mask& m, Force& force) const;
+ mia::P2DFilter m_copy_to_double;
};
class CNCC2DImageCostPlugin: public mia::C2DMaskedImageCostPlugin {
diff --git a/mia/2d/maskedcost/ssd.cc b/mia/2d/maskedcost/ssd.cc
index abbc2fa..ec6bb14 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 9356f8f..9a194e0 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 1f89581..1e7ffae 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 f026bee..60ad8ff 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 4e23f46..0839a74 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 5a22590..057cbef 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 ce467cd..3257d26 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 028fa79..21c52a8 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 788a3fa..2d26599 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 a1ea7db..17eca3d 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 044cf71..a931cc8 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 7cf6d4b..209865e 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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.hh b/mia/2d/model/navier.hh
index 1982087..56f6d29 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 453aa6e..54190d5 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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.hh b/mia/2d/model/naviera.hh
index da5c29c..a3df5a6 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 840119c..2c630c1 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 74a41a8..b70a6e1 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 eeef04a..70c2135 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 0e5a503..1d052f7 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 c8cfcc7..4bd2004 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 d41a5fe..57e9998 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 0a99747..b89d0d1 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 6c67b64..e49829a 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 4d89de5..bba428a 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 fda6c4a..cf46df6 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 9368332..d209aa5 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 08634d6..467da5e 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 f8a087a..7933b29 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 1c77ecc..138613a 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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 @@ struct C2DPerfusionAnalysisImpl {
bool meanstrip);
vector<C2DFImage> get_references() const;
- bool run_ica(const vector<C2DFImage>& series, const CICAAnalysisFactory& icatool);
+ bool run_ica(const vector<C2DFImage>& series, const CIndepCompAnalysisFactory& icatool);
P2DFilter get_crop_filter(float scale, C2DBounds& crop_start,
C2DPerfusionAnalysis::EBoxSegmentation approach,
const std::string& save_features) const;
@@ -47,7 +47,7 @@ struct C2DPerfusionAnalysisImpl {
C2DBounds& crop_start,
const string& save_features)const;
- CICAAnalysis::IndexSet get_all_without_periodic()const;
+ CIndepCompAnalysis::IndexSet get_all_without_periodic()const;
void save_feature(const string& base, const string& feature, const C2DImage& image)const;
P2DImage get_rvlv_delta_from_feature(const string& save_features)const;
P2DImage get_rvlv_delta_from_peaks(const string& save_features)const;
@@ -65,7 +65,7 @@ struct C2DPerfusionAnalysisImpl {
C2DBounds m_image_size;
CWaveletSlopeClassifier m_cls;
size_t m_length;
- CICAAnalysis::EApproach m_ica_approach;
+ CIndepCompAnalysis::EApproach m_ica_approach;
bool m_use_guess_model;
C2DFImage m_image_attributes;
float m_min_movement_frequency;
@@ -109,7 +109,7 @@ void C2DPerfusionAnalysis::set_min_movement_frequency(float min_freq)
-void C2DPerfusionAnalysis::set_approach(CICAAnalysis::EApproach approach)
+void C2DPerfusionAnalysis::set_approach(CIndepCompAnalysis::EApproach approach)
{
assert(impl);
impl->m_ica_approach = approach;
@@ -131,7 +131,7 @@ P2DFilter C2DPerfusionAnalysis::get_crop_filter(float scale, C2DBounds& crop_sta
return impl->get_crop_filter(scale, crop_start, approach, save_features);
}
-bool C2DPerfusionAnalysis::run(const vector<C2DFImage>& series, const CICAAnalysisFactory& icatool)
+bool C2DPerfusionAnalysis::run(const vector<C2DFImage>& series, const CIndepCompAnalysisFactory& icatool)
{
assert(impl);
return impl->run_ica(series, icatool);
@@ -157,7 +157,7 @@ C2DPerfusionAnalysisImpl::C2DPerfusionAnalysisImpl(size_t components,
m_meanstrip(meanstrip),
m_max_iterations(0),
m_length(0),
- m_ica_approach(CICAAnalysis::appr_defl),
+ m_ica_approach(CIndepCompAnalysis::appr_defl),
m_use_guess_model(false),
m_min_movement_frequency(-1)
{
@@ -228,7 +228,7 @@ P2DFilter C2DPerfusionAnalysisImpl::get_crop_filter(float scale, C2DBounds& crop
vector<C2DFImage> C2DPerfusionAnalysisImpl::get_references() const
{
vector<C2DFImage> result(m_length);
- CICAAnalysis::IndexSet component_set = get_all_without_periodic();
+ CIndepCompAnalysis::IndexSet component_set = get_all_without_periodic();
for (size_t i = 0; i < m_length; ++i) {
result[i] = m_ica->get_partial_mix(i, component_set);
@@ -261,7 +261,7 @@ vector<vector<float> > C2DPerfusionAnalysisImpl::create_guess(size_t rows)
return result;
}
-bool C2DPerfusionAnalysisImpl::run_ica(const vector<C2DFImage>& series, const CICAAnalysisFactory& icatool)
+bool C2DPerfusionAnalysisImpl::run_ica(const vector<C2DFImage>& series, const CIndepCompAnalysisFactory& icatool)
{
m_series = series;
m_length = series.size();
@@ -270,10 +270,10 @@ bool C2DPerfusionAnalysisImpl::run_ica(const vector<C2DFImage>& series, const CI
m_image_attributes = series[0];
- srand(static_cast<unsigned>(time(NULL)));
+ srand(static_cast<unsigned>(time(NULL)));
m_image_size = series[0].get_size();
bool has_one = false;
- unique_ptr<C2DImageSeriesICA> ica(new C2DImageSeriesICA(icatool, series, false));
+ unique_ptr<C2DImageSeriesICA> ica(new C2DImageSeriesICA(icatool, series, false));
vector<vector<float> > guess;
if (m_use_guess_model)
@@ -283,7 +283,7 @@ bool C2DPerfusionAnalysisImpl::run_ica(const vector<C2DFImage>& series, const CI
ica->set_approach(m_ica_approach);
if (!ica->run(m_components, m_meanstrip, m_normalize, guess) &&
- (m_ica_approach == CICAAnalysis::appr_defl))
+ (m_ica_approach == CIndepCompAnalysis::appr_defl))
return false;
m_cls = CWaveletSlopeClassifier(ica->get_mixing_curves(), false, m_min_movement_frequency);
if (m_cls.result() != CWaveletSlopeClassifier::wsc_fail)
@@ -292,15 +292,16 @@ bool C2DPerfusionAnalysisImpl::run_ica(const vector<C2DFImage>& series, const CI
size_t min_components_nonzero = 100;
for (int i = 6; i >= 4; --i) {
- unique_ptr<C2DImageSeriesICA> l_ica(new C2DImageSeriesICA(icatool, series, false));
+ unique_ptr<C2DImageSeriesICA> l_ica(new C2DImageSeriesICA(icatool, series, false));
ica->set_approach(m_ica_approach);
l_ica->set_max_iterations(m_max_iterations);
-
- if (!l_ica->run(i, m_meanstrip, m_normalize, guess) && (m_ica_approach == CICAAnalysis::appr_defl)) {
+
+ if (!l_ica->run(i, m_meanstrip, m_normalize, guess) &&
+ (m_ica_approach == CIndepCompAnalysis::appr_defl)) {
cvwarn() << "run_ica: " << i << " components didn't return a result\n";
continue;
}
-
+
CWaveletSlopeClassifier cls(l_ica->get_mixing_curves(), false, m_min_movement_frequency);
size_t movement_components = cls.get_number_of_movement_components();
if (cls.result() == CWaveletSlopeClassifier::wsc_fail) {
@@ -340,12 +341,12 @@ bool C2DPerfusionAnalysisImpl::run_ica(const vector<C2DFImage>& series, const CI
return has_one;
}
-CICAAnalysis::IndexSet C2DPerfusionAnalysisImpl::get_all_without_periodic() const
+CIndepCompAnalysis::IndexSet C2DPerfusionAnalysisImpl::get_all_without_periodic() const
{
assert(m_ica);
int movement_index = m_cls.get_movement_idx();
- CICAAnalysis::IndexSet result;
+ CIndepCompAnalysis::IndexSet result;
for (int i = 0; i < (int)m_components; ++i) {
if (i != movement_index)
result.insert(i);
diff --git a/mia/2d/perfusion.hh b/mia/2d/perfusion.hh
index 178a0b5..ee4870d 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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 <vector>
#include <mia/core/dictmap.hh>
#include <mia/core/waveletslopeclassifier.hh>
-#include <mia/core/icaanalysisbase.hh>
+#include <mia/core/ica.hh>
#include <mia/2d/image.hh>
#include <mia/2d/filter.hh>
@@ -72,7 +72,7 @@ public:
\param icatool Generator for the used ICA analyis method
*/
- bool run(const std::vector<C2DFImage>& series, const CICAAnalysisFactory& icatool);
+ bool run(const std::vector<C2DFImage>& series, const CIndepCompAnalysisFactory& icatool);
/**
@@ -109,7 +109,7 @@ public:
\param approach FICA_APPROACH_SYMM or FICA_APPROACH_DEFL
\todo the parameter should be an enum
*/
- void set_approach(CICAAnalysis::EApproach approach);
+ void set_approach(CIndepCompAnalysis::EApproach approach);
/**
\returns the RV peak enhancement IC index of -1 if it could not be identified
diff --git a/mia/2d/polygon.cc b/mia/2d/polygon.cc
index 3ef2b3a..81d47c5 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 9974b8b..e1d2628 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 831495f..9d8851d 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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.hh b/mia/2d/ppmatrix.hh
index e676201..a64e032 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 2a5b98c..57afc7d 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 ec71cac..a750ce0 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 bf99166..3757999 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 3f609af..c3f4406 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 6df0f85..616512d 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 b587b3d..842776f 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 b276306..0f18ef6 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 e960443..bf84948 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,28 +18,25 @@
*
*/
-#include <stdexcept>
-#include <string>
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <mia/2d/imageio.hh>
+#include <mia/2d/angle.hh>
#include <mia/2d/segframe.hh>
#include <mia/core/msgstream.hh>
#include <mia/core/errormacro.hh>
-#include <mia/2d/imageio.hh>
-#include <mia/2d/angle.hh>
+#include <mia/core/xmlinterface.hh>
-#include <libxml++/libxml++.h>
-#include <boost/filesystem.hpp>
+#include <boost/filesystem.hpp>
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
+#include <stdexcept>
+#include <string>
-#if LIBXMLPP_VERSION < 3
-#define add_child_element add_child
-#endif
NS_MIA_BEGIN
using namespace std;
-using namespace xmlpp;
namespace bfs=boost::filesystem;
@@ -67,23 +64,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)
+void read_attribute_from_node(const CXMLElement& elm, const std::string& key, T& out_value, bool required)
{
auto attr = elm.get_attribute(key);
- if (!attr) {
+ if (attr.empty()) {
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))
+ if (!from_string(attr, out_value))
throw create_exception<std::runtime_error>( elm.get_name(), ":attribute '", key, "' has bogus value '",
- attr->get_value(), "'");
+ attr, "'");
}
-CSegFrame::CSegFrame(const Node& node, int version):
+CSegFrame::CSegFrame(const CXMLElement& elm, int version):
m_has_star(false),
m_quality(0),
m_brightness(0),
@@ -91,29 +88,27 @@ CSegFrame::CSegFrame(const Node& node, int version):
m_version(version)
{
TRACE("CSegFrame::CSegFrame");
- const Element& elm = dynamic_cast<const Element&>(node);
-
+
if (elm.get_name() != "frame")
throw invalid_argument(string("CSegFrame: unexpected node type: ") + elm.get_name());
- const Attribute *attr = elm.get_attribute("image");
- if (!attr) {
+ m_filename = elm.get_attribute("image");
+ if (m_filename.empty()) {
throw invalid_argument("CSegFrame: image attribute not found");
}
- m_filename = attr->get_value();
- auto nodes = elm.get_children();
+ auto nodes = elm.get_all_children();
- for (auto i = nodes.begin(); i != nodes.end(); ++i) {
+ for (auto i: nodes) {
- if ((*i)->get_name() == "star") {
- m_star = CSegStar(**i);
+ if (i->get_name() == "star") {
+ m_star = CSegStar(*i);
m_has_star = true;
}
- else if ((*i)->get_name() == "section") {
- m_sections.push_back(CSegSection(**i, version));
+ else if (i->get_name() == "section") {
+ m_sections.push_back(CSegSection(*i, version));
}else {
- cvinfo() << "ignoring unsuported element '" << (*i)->get_name() << "'\n";
+ cvinfo() << "ignoring unsupported element '" << i->get_name() << "'\n";
}
}
@@ -161,14 +156,14 @@ const CSegFrame::Sections& CSegFrame::get_sections()const
const CSegStar& CSegFrame::get_star() const
{
if (!m_has_star)
- cvwarn() << "CSegFrame::get_star(): returing fake star";
+ cvwarn() << "CSegFrame::get_star(): returning fake star";
return m_star;
}
-void CSegFrame::write(xmlpp::Element& node, int version) const
+void CSegFrame::write(CXMLElement& node, int version) const
{
- Element* self = node.add_child_element("frame");
+ auto self = node.add_child("frame");
self->set_attribute("image", m_filename);
if (version > 1) {
diff --git a/mia/2d/segframe.hh b/mia/2d/segframe.hh
index 75f3445..59f4385 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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 @@ public:
\param node
\param version segmentation set version the node stems from.
*/
- CSegFrame(const xmlpp::Node& node, int version);
+ CSegFrame(const CXMLElement& node, int version);
/// \returns the file name of the corresponding image
const std::string& get_imagename() const;
@@ -104,7 +104,7 @@ public:
@param node parent node to append the frame description to
@param version segmentation set file version that should be used to save the data
*/
- void write(xmlpp::Element& node, int version) const;
+ void write(CXMLElement& node, int version) const;
/**
Shift the segmentation frame and change the file name to the new name
diff --git a/mia/2d/segpoint.cc b/mia/2d/segpoint.cc
index 6a7e836..b886b50 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,39 +23,34 @@
#include <cassert>
#include <mia/2d/segpoint.hh>
#include <mia/core/tools.hh>
-#include <libxml++/libxml++.h>
+#include <mia/core/xmlinterface.hh>
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
-#if LIBXMLPP_VERSION < 3
-#define add_child_element add_child
-#endif
-
NS_MIA_BEGIN
-using namespace xmlpp;
using namespace std;
-void read_attribute_from_node(const Element& elm, const std::string& key, bool& out_value, bool required)
+void read_attribute_from_node(const CXMLElement& elm, const std::string& key, bool& out_value, bool required)
{
auto attr = elm.get_attribute(key);
- if (!attr) {
+ if (attr.empty()) {
if (required)
throw create_exception<runtime_error>( elm.get_name(), ":required attribute '", key, "' not found");
else
return;
}
- if (attr->get_value() == string("false"))
+ if (attr == string("false"))
out_value = false;
- else if (attr->get_value() == string("true"))
+ else if (attr == string("true"))
out_value = true;
else
throw create_exception<runtime_error>( elm.get_name(), ":attribute '", key, "' has bogus value '",
- attr->get_value(), "'");
+ attr, "'");
}
CSegPoint2D::CSegPoint2D()
@@ -79,26 +74,26 @@ CSegPoint2D::CSegPoint2D(float x, float y):
{
}
-CSegPoint2D::CSegPoint2D(const Node& node)
+CSegPoint2D::CSegPoint2D(const CXMLElement& elm)
{
- const Element& elm = dynamic_cast<const Element&>(node);
- auto *ax = elm.get_attribute ("x");
- auto *ay = elm.get_attribute ("y");
- if (!ax || !ay)
+
+ auto ax = elm.get_attribute ("x");
+ auto ay = elm.get_attribute ("y");
+ if (ax.empty() || ay.empty())
throw runtime_error("SegSection:Point attribute x or y not found");
- if (!from_string(ax->get_value(), x))
+ if (!from_string(ax, x))
throw create_exception<runtime_error>( "CSegPoint2D: x attribute '",
- ax->get_value(), "' is not a floating point value");
+ ax, "' is not a floating point value");
- if (!from_string(ay->get_value(), y))
+ if (!from_string(ay, y))
throw create_exception<runtime_error>( "CSegPoint2D: y attribute '",
- ay->get_value(), "' is not a floating point value");
+ ay, "' is not a floating point value");
}
-void CSegPoint2D::write(Element& node) const
+void CSegPoint2D::write(CXMLElement& node) const
{
- Element* point = node.add_child_element("point");
+ auto point = node.add_child("point");
point->set_attribute("y", to_string<float>(y));
point->set_attribute("x", to_string<float>(x));
}
diff --git a/mia/2d/segpoint.hh b/mia/2d/segpoint.hh
index be543e6..f27adb1 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,13 +25,10 @@
#include <mia/2d/defines2d.hh>
#include <mia/2d/transform.hh>
-namespace xmlpp {
-class Node;
-class Element;
-}
-
NS_MIA_BEGIN
+class CXMLElement;
+
/**
@ingroup perf
\brief a point in a 2D segmentation shape
@@ -57,16 +54,18 @@ public:
*/
CSegPoint2D(float x, float y);
- /**
+
+
+ /**
Construct the point from a XML node
\param node
*/
- CSegPoint2D(const xmlpp::Node& node);
+ CSegPoint2D(const CXMLElement& node);
/** Write the point as child-node to a given XML tree
\param node
*/
- void write(xmlpp::Element& node) const;
+ void write(CXMLElement& node) const;
/**
Tranform the point according to the given tranformation
@@ -84,9 +83,9 @@ public:
template <typename T>
-void read_attribute_from_node(const xmlpp::Element& elm, const std::string& key, T& out_value, bool required);
+void read_attribute_from_node(const CXMLElement& 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);
+void read_attribute_from_node(const CXMLElement& 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 a9aad34..8bc731f 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,16 +22,12 @@
#include <stdexcept>
#include <mia/core/msgstream.hh>
#include <mia/2d/segsection.hh>
-#include <libxml++/libxml++.h>
+#include <mia/core/xmlinterface.hh>
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
-#if LIBXMLPP_VERSION < 3
-#define add_child_element add_child
-#endif
-
NS_MIA_BEGIN
using namespace std;
@@ -47,22 +43,20 @@ CSegSection::CSegSection(const string& id, const Points& points, bool is_open):
{
}
-CSegSection::CSegSection(const xmlpp::Node& node, int version):
+CSegSection::CSegSection(const CXMLElement& elm, int version):
m_is_open(false)
{
TRACE("CSegSection::CSegSection");
- const xmlpp::Element& elm = dynamic_cast<const xmlpp::Element&>(node);
- auto *id = elm.get_attribute ("color");
+ m_id = elm.get_attribute ("color");
- if (!id)
+ if (m_id.empty())
throw invalid_argument("CSegSection::CSegSection: node without id");
- m_id = id->get_value();
- auto points = node.get_children("point");
+ auto points = elm.get_children("point");
- for (auto i = points.begin(); i != points.end(); ++i)
- m_points.push_back(CSegPoint2D(**i));
+ for (auto i: points)
+ m_points.push_back(CSegPoint2D(*i));
if (version > 1) {
read_attribute_from_node(elm, "open", m_is_open, false);
@@ -81,44 +75,35 @@ const CSegSection::Points& CSegSection::get_points()const
void CSegSection::shift(const C2DFVector& delta)
{
- Points::iterator ip = m_points.begin();
- Points::iterator ep = m_points.end();
-
- while (ip != ep) {
- *ip -= delta;
- ++ip;
- }
+ for(auto& i: m_points)
+ i -= delta;
}
void CSegSection::transform(const C2DTransformation& t)
{
- for(auto i = m_points.begin(); i != m_points.end(); ++i)
- i->transform(t);
+ for(auto& i: m_points)
+ i.transform(t);
}
void CSegSection::inv_transform(const C2DTransformation& t)
{
- for(auto i = m_points.begin(); i != m_points.end(); ++i)
- i->inv_transform(t);
+ for(auto& i : m_points)
+ i.inv_transform(t);
}
-void CSegSection::write(xmlpp::Element& node, int version) const
+void CSegSection::write(CXMLElement& node, int version) const
{
- xmlpp::Element* nodeChild = node.add_child_element("section");
+ auto nodeChild = node.add_child("section");
nodeChild->set_attribute("color", m_id);
if (version > 1) {
nodeChild->set_attribute("open", m_is_open ? "true" : "false");
}
- Points::const_iterator ip = m_points.begin();
- Points::const_iterator ep = m_points.end();
-
- while (ip != ep) {
- ip->write(*nodeChild);
- ++ip;
+ for (auto ip: m_points) {
+ ip.write(*nodeChild);
}
}
@@ -126,22 +111,15 @@ const C2DBoundingBox CSegSection::get_boundingbox() const
{
C2DBoundingBox result;
-
- Points::const_iterator ip = m_points.begin();
- Points::const_iterator ep = m_points.end();
-
- while (ip != ep) {
- result.add(*ip++);
- }
+ for(auto ip: m_points)
+ result.add(ip);
return result;
}
void CSegSection::append_to(C2DPolygon& polygon)const
{
- typedef std::vector<CSegPoint2D>::const_iterator point_iterator;
- for(point_iterator i = m_points.begin(); i != m_points.end(); ++i)
- polygon.append(*i);
-
+ for(auto i: m_points)
+ polygon.append(i);
}
float CSegSection::get_hausdorff_distance(const CSegSection& other) const
diff --git a/mia/2d/segsection.hh b/mia/2d/segsection.hh
index 65dfbac..3cd8791 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,14 +62,14 @@ public:
@param node root of the XML sub tree
\param version segmentation set version the node stems from.
*/
- CSegSection(const xmlpp::Node& node, int version);
+ CSegSection(const CXMLElement& node, int version);
/**
Store the segmented section into a XML sub-tree
@param node parent node to which the subtree should be added
\param version segmentation set version the node stems from.
*/
- void write(xmlpp::Element& node, int version) const;
+ void write(CXMLElement& node, int version) const;
/// \returns the ID of the section
const std::string& get_id() const;
diff --git a/mia/2d/segset.cc b/mia/2d/segset.cc
index a19e076..395d096 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,12 +18,14 @@
*
*/
-#include <libxml++/libxml++.h>
#include <mia/2d/segset.hh>
#include <mia/core/msgstream.hh>
#include <mia/core/filetools.hh>
+#include <mia/core/xmlinterface.hh>
#include <mia/core/tools.hh>
+#include <iterator>
+
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -35,7 +37,6 @@
NS_MIA_BEGIN
using namespace std;
-using namespace xmlpp;
CSegSet::CSegSet():
@@ -60,18 +61,18 @@ CSegSet::CSegSet(const std::string& src_filename):
m_preferred_reference(-1),
m_version(2)
{
- DomParser parser;
- parser.set_substitute_entities(); //We just want the text to be resolved/unescaped automatically.
- parser.parse_file(src_filename);
-
- if (!parser)
- throw runtime_error(string("CSegSet: Unable to parse input file:") + src_filename);
-
- read(*parser.get_document());
-
+ ifstream infile(src_filename);
+ string xml_init(std::istreambuf_iterator<char>{infile}, {});
+
+ if (!infile.good())
+ throw create_exception<runtime_error>("CSegSet: Unable to read input file: '", src_filename, "'");
+
+ CXMLDocument doc(xml_init.c_str());
+
+ read(doc);
}
-CSegSet::CSegSet(const xmlpp::Document& doc):
+CSegSet::CSegSet(const CXMLDocument& doc):
m_RV_peak(-1),
m_LV_peak(-1),
m_preferred_reference(-1),
@@ -112,104 +113,102 @@ const C2DBoundingBox CSegSet::get_boundingbox() const
return result;
}
-xmlpp::Document *CSegSet::write() const
+CXMLDocument CSegSet::write() const
{
- xmlpp::Document *doc = new xmlpp::Document;
- xmlpp::Element* nodeRoot = doc->create_root_node("workset");
+ CXMLDocument result;
+
+ auto nodeRoot = result.create_root_node("workset");
if (m_version > 1) {
nodeRoot->set_attribute("version", to_string<int>(m_version));
}
- Element* description = nodeRoot->add_child_element("description");
- Element* RVPeak = description->add_child_element("RVpeak");
+ auto description = nodeRoot->add_child("description");
+ auto RVPeak = description->add_child("RVpeak");
RVPeak->set_attribute("value", to_string<int>(m_RV_peak));
- Element* LVPeak = description->add_child_element("LVpeak");
+ auto LVPeak = description->add_child("LVpeak");
LVPeak->set_attribute("value", to_string<int>(m_LV_peak));
- Element* PreferedRef = description->add_child_element("PreferedRef");
+ auto PreferedRef = description->add_child("PreferedRef");
PreferedRef->set_attribute("value", to_string<int>(m_preferred_reference));
- for(Frames::const_iterator i = m_frames.begin(); i != m_frames.end(); ++i) {
- i->write(*nodeRoot, m_version);
- }
+ for(auto i: m_frames)
+ i.write(*nodeRoot, m_version);
- return doc;
+ return result;
}
-void CSegSet::read(const xmlpp::Document& node)
+void CSegSet::read(const CXMLDocument& doc)
{
- const xmlpp::Element *root = node.get_root_node ();
+ auto root = doc.get_root_node();
+ assert(root);
+
if (root->get_name() != "workset") {
throw invalid_argument(string("CSegSet: Document root node: expected 'workset', but got ") +
root->get_name());
}
// without attribute its version 1, otherwise read the version.
- const Attribute *attr = root->get_attribute("version");
- if (attr) {
- if (!from_string(attr->get_value(), m_version))
+ auto attr = root->get_attribute("version");
+ if (!attr.empty()) {
+ if (!from_string(attr, m_version))
throw create_exception<invalid_argument>("bogus version '",
- attr->get_value(),
+ attr,
"' in segmentation set");
}
-
+ cvdebug() << "Read version " << m_version << "\n";
+
auto frames = root->get_children("frame");
- auto i = frames.begin();
- auto e = frames.end();
- while (i != e) {
+ for (auto i: frames) {
try {
- m_frames.push_back(CSegFrame(**i, m_version));
+ m_frames.push_back(CSegFrame(*i, m_version));
}
catch (invalid_argument& x) {
- throw create_exception<invalid_argument>("Segset: Error reading frame ", distance(frames.begin(), i),
- ":", x.what());
+ throw create_exception<invalid_argument>("Segset: Error reading frames:", x.what());
}
- ++i;
}
auto descr = root->get_children("description");
if (!descr.empty())
- descr = (*descr.begin())->get_children();
- for(auto i = descr.begin(); i != descr.end(); ++i) {
- cvdebug() << "description element '" << (*i)->get_name() << "'\n";
- if ((*i)->get_name() == "RVpeak") {
- const Element& elm = dynamic_cast<const Element&>(**i);
- const Attribute *attr = elm.get_attribute("value");
- if (!attr)
+ descr = descr[0]->get_all_children();
+
+ for(auto i : descr) {
+ cvdebug() << "description element '" << i->get_name() << "'\n";
+ if (i->get_name() == "RVpeak") {
+ auto attr = i->get_attribute("value");
+ if (attr.empty())
cvwarn() << "CSegFrame: LVpeak without attribute";
else
- if (!from_string(attr->get_value(), m_RV_peak)) {
- cvwarn() << "Could't convert RV_peak attribute '" << attr->get_value()
- <<"' to an integer; ignoring\n";
+ if (!from_string(attr, m_RV_peak)) {
+ cvwarn() << "Could't convert RV_peak attribute '" << attr
+ <<"' to an integer; ignoring\n";
m_RV_peak = -1;
+
}
- } else if ((*i)->get_name() == "LVpeak") {
- const Element& elm = dynamic_cast<const Element&>(**i);
- const Attribute *attr = elm.get_attribute("value");
- if (!attr)
+ } else if (i->get_name() == "LVpeak") {
+ auto attr = i->get_attribute("value");
+ if (attr.empty())
cvwarn() << "CSegFrame: LVpeak without attribute";
else
- if (!from_string(attr->get_value(), m_LV_peak)) {
- cvwarn() << "Could't convert LV_peak attribute '" << attr->get_value()
+ if (!from_string(attr, m_LV_peak)) {
+ cvwarn() << "Could't convert LV_peak attribute '" << attr
<<"' to an integer; ignoring\n";
m_LV_peak = -1;
}
- } else if ((*i)->get_name() == "PreferedRef") {
- const Element& elm = dynamic_cast<const Element&>(**i);
- const Attribute *attr = elm.get_attribute("value");
- if (!attr)
+ } else if (i->get_name() == "PreferedRef") {
+ auto attr = i->get_attribute("value");
+ if (attr.empty())
cvwarn() << "CSegFrame: PreferedRef without attribute";
else
- if (!from_string(attr->get_value(), m_preferred_reference)) {
- cvwarn() << "Could't convert PreferedRef attribute '" << attr->get_value()
+ if (!from_string(attr, m_preferred_reference)) {
+ cvwarn() << "Could't convert PreferedRef attribute '" << attr
<<"' to an integer; ignoring\n";
m_preferred_reference = -1;
}
}
else {
- cvinfo() << "Ignoring unknown element '" << (*i)->get_name() << "'\n";
+ cvinfo() << "Ignoring unknown element '" << i->get_name() << "'\n";
}
}
}
diff --git a/mia/2d/segset.hh b/mia/2d/segset.hh
index 00e089b..6f150b4 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,15 +22,14 @@
#define SegSet_h
#include <mia/core/ioplugin.hh>
+#include <mia/core/xmlinterface.hh>
#include <mia/2d/segframe.hh>
#include <mia/2d/boundingbox.hh>
-namespace xmlpp {
- class Document;
-};
-
NS_MIA_BEGIN
+
+
/**
@ingroup perf
\brief A set of segmentation of a 2D series of perfusion images
@@ -55,7 +54,7 @@ public:
Construct a segmentation set by reading from a XML document
\param node the root node of the XML document
*/
- CSegSet(const xmlpp::Document& node);
+ CSegSet(const CXMLDocument& node);
CSegSet(int version);
@@ -69,7 +68,7 @@ public:
Write the segmentation information to an XML tree
\returns root node of xml tree.
*/
- xmlpp::Document *write() const;
+ CXMLDocument write() const;
/// \returns read-only vector of the segmentation frames
@@ -148,7 +147,7 @@ public:
void set_preferred_reference(int value);
private:
- void read(const xmlpp::Document& node);
+ void read(const CXMLDocument& node);
Frames m_frames;
int m_RV_peak;
int m_LV_peak;
diff --git a/mia/2d/segsetwithimages.cc b/mia/2d/segsetwithimages.cc
index 5bd84f1..463722b 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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 @@ CSegSetWithImages::CSegSetWithImages(int version):CSegSet(version)
{
}
-CSegSetWithImages::CSegSetWithImages(const xmlpp::Document& node, const string& fileroot):
+CSegSetWithImages::CSegSetWithImages(const CXMLDocument& node, const string& fileroot):
CSegSet(node)
{
diff --git a/mia/2d/segsetwithimages.hh b/mia/2d/segsetwithimages.hh
index 65aa9c0..fac0b6b 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,12 +27,10 @@
#include <mia/2d/segset.hh>
#include <mia/2d/image.hh>
-namespace xmlpp {
- class Document;
-};
-
NS_MIA_BEGIN
+class CXMLElement;
+class CXMLDocument;
/**
@ingroup perf
\brief A set of images and its segmentations, related to heart perfusion analysis
@@ -56,7 +54,7 @@ public:
\param fileroot is the root location of the set file and it is used as
base path for the images.
*/
- CSegSetWithImages(const xmlpp::Document& node, const std::string& fileroot);
+ CSegSetWithImages(const CXMLDocument& node, const std::string& fileroot);
/**
diff --git a/mia/2d/segstar.cc b/mia/2d/segstar.cc
index adf0229..dbb7f5a 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,19 +23,15 @@
#include <cassert>
#include <mia/core/msgstream.hh>
#include <mia/core/tools.hh>
+#include <mia/core/xmlinterface.hh>
#include <mia/2d/segstar.hh>
-#include <libxml++/libxml++.h>
+
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
-#if LIBXMLPP_VERSION < 3
-#define add_child_element add_child
-#endif
-
-
NS_MIA_BEGIN
using namespace std;
@@ -56,23 +52,20 @@ CSegStar::CSegStar(const CSegPoint2D& center, float r, const CSegPoint2D& d1,
}
-CSegStar::CSegStar(const xmlpp::Node& n)
+CSegStar::CSegStar(const CXMLElement& node)
{
TRACE("CSegStar::CSegStar");
-
- if (n.get_name() != "star")
- throw create_exception<runtime_error>("CSegStar: expect node of type 'star', but got '", n.get_name(), "'");
-
- const xmlpp::Element& node = dynamic_cast<const xmlpp::Element&>(n);
-
-
+
+ if (node.get_name() != "star")
+ throw create_exception<runtime_error>("CSegStar: expect node of type 'star', but got '", node.get_name(), "'");
+
m_center = CSegPoint2D(node);
auto rx = node.get_attribute ("r");
- if (!rx)
+ if (rx.empty())
throw runtime_error("CSegStar: attribute r not found");
- if (!from_string(rx->get_value(), m_radius))
- throw create_exception<runtime_error>("CSegStar: radius attribute '", rx->get_value(), "' is not a floating point value");
+ if (!from_string(rx, m_radius))
+ throw create_exception<runtime_error>("CSegStar: radius attribute '", rx, "' is not a floating point value");
cvdebug() << "Got star center (" << m_center.x << ", " << m_center.y << " @ " << m_radius << ")\n";
@@ -83,9 +76,9 @@ CSegStar::CSegStar(const xmlpp::Node& n)
throw invalid_argument("Bogus: Star should have 3 direction points");
size_t k = 0;
- for (auto i = points.begin(); i != points.end(); ++i, ++k) {
- auto& node = dynamic_cast<const xmlpp::Element&>(**i);
- m_directions[k] = CSegPoint2D(node);
+ for (auto& i: points) {
+ m_directions[k] = CSegPoint2D(*i);
+ ++k;
}
}
@@ -102,7 +95,8 @@ void CSegStar::transform(const C2DTransformation& t)
m_directions[i] = t(m_center + m_radius * m_directions[i]);
cvdebug() << "CSegStar::transform:" << i << ":" << m_directions[i] << "\n";
}
- recenter_rays();
+ recenter_rays();
+ cvdebug() << "CSegStar::transformed: " << m_center << "@" << m_radius << "\n";
}
inline double __calc_bc(double a, double b, double c)
@@ -172,10 +166,12 @@ void CSegStar::inv_transform(const C2DTransformation& t)
recenter_rays();
}
-void CSegStar::write(xmlpp::Element& node) const
+void CSegStar::write(CXMLElement& node) const
{
- auto nodeChild = node.add_child_element("star");
+ auto nodeChild = node.add_child("star");
+ cvdebug() << "Write star " << m_center << "@" << m_radius << "\n";
+
nodeChild->set_attribute("y", to_string<float>(m_center.y));
nodeChild->set_attribute("x", to_string<float>(m_center.x));
nodeChild->set_attribute("r", to_string<float>(m_radius));
diff --git a/mia/2d/segstar.hh b/mia/2d/segstar.hh
index af09db5..a27c172 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,13 +56,13 @@ public:
Constructor to create a CSegStar from a XML sub tree
@param node root of the sub tree
*/
- CSegStar(const xmlpp::Node& node);
+ CSegStar(const CXMLElement& node);
/**
write the CSegStar info to a XML node
@param node root node to add the info to
*/
- void write(xmlpp::Element& node) const;
+ void write(CXMLElement& node) const;
/**
Shift the segmentation data
diff --git a/mia/2d/shape.cc b/mia/2d/shape.cc
index 417e1c8..dab4916 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 de3679a..141d34d 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,8 @@ typedef std::shared_ptr<C2DShape > P2DShape;
/// Base class for Shape generating plug-ins
typedef TFactory<C2DShape> C2DShapePlugin;
+template <> const char * const TPluginHandler<TFactory<C2DShape>>::m_help;
+
/// Plug-in handler for the shape plug-ins
typedef THandlerSingleton<TFactoryPluginHandler<C2DShapePlugin> > C2DShapePluginHandler;
diff --git a/mia/2d/shapes/basic_shapes.cc b/mia/2d/shapes/basic_shapes.cc
index 6d389a6..ba2b99f 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 64410c0..88046b0 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 dcae2cf..614a3c8 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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.hh b/mia/2d/shapes/rect.hh
index a8e86a5..6cb192f 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 9d84ea2..1249a76 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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.hh b/mia/2d/shapes/sphere.hh
index 6d4f684..1d6b266 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 a059e1f..3c9f2b0 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 064b30f..9506eca 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 244a6ce..06f56dc 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 37bedb9..fcbce7e 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 b3ea7e5..8a59d0f 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 a5f6024..5ec240a 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 9952861..47a4a5b 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 2017f7d..5aea48a 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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.hh b/mia/2d/splinepenalty/divcurl.hh
index cedbb1a..75fc29e 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 f530413..98b9260 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -50,7 +50,7 @@ BOOST_AUTO_TEST_CASE( test_divcurl_cost )
}
auto kernel = produce_spline_kernel("bspline:d=4");
- T2DConvoluteInterpolator<C2DFVector> source(coef, kernel);
+ T2DInterpolator<C2DFVector> source(coef, kernel);
auto coeff_double = source.get_coefficients();
transform(coeff_double.begin(), coeff_double.end(), coef.begin(),
[](const C2DDVector& x) { return C2DFVector(x);});
@@ -82,7 +82,7 @@ BOOST_AUTO_TEST_CASE( test_divcurl_cost_scale_weight )
}
auto kernel = produce_spline_kernel("bspline:d=4");
- T2DConvoluteInterpolator<C2DFVector> source(coef, kernel);
+ T2DInterpolator<C2DFVector> source(coef, kernel);
auto coeff_double = source.get_coefficients();
transform(coeff_double.begin(), coeff_double.end(), coef.begin(),
[](const C2DDVector& x) { return C2DFVector(x);});
@@ -114,7 +114,7 @@ BOOST_AUTO_TEST_CASE( test_divcurl_cost_scale_div_weight )
}
auto kernel = produce_spline_kernel("bspline:d=4");
- T2DConvoluteInterpolator<C2DFVector> source(coef, kernel);
+ T2DInterpolator<C2DFVector> source(coef, kernel);
auto coeff_double = source.get_coefficients();
transform(coeff_double.begin(), coeff_double.end(), coef.begin(),
[](const C2DDVector& x) { return C2DFVector(x);});
@@ -146,7 +146,7 @@ BOOST_AUTO_TEST_CASE( test_divcurl_cost_scale_curl_weight )
}
auto kernel = produce_spline_kernel("bspline:d=4");
- T2DConvoluteInterpolator<C2DFVector> source(coef, kernel);
+ T2DInterpolator<C2DFVector> source(coef, kernel);
auto coeff_double = source.get_coefficients();
transform(coeff_double.begin(), coeff_double.end(), coef.begin(),
[](const C2DDVector& x) { return C2DFVector(x);});
diff --git a/mia/2d/splinetransformpenalty.cc b/mia/2d/splinetransformpenalty.cc
index f93a50a..1d6e56d 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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 @@ TPluginHandler<C2DSplineTransformPenaltyPlugin>::m_help =
"This class provides the penalty put on spline based transformations "
"when considering image registration. This penalty term ensures "
"the smoothness of a transformation or the evaluation of a similarity measure "
- "between a transformed study data set and a refernce data set.";
+ "between a transformed study data set and a reference data set.";
EXPLICIT_INSTANCE_DERIVED_FACTORY_HANDLER(C2DSplineTransformPenalty, C2DSplineTransformPenaltyPlugin);
diff --git a/mia/2d/splinetransformpenalty.hh b/mia/2d/splinetransformpenalty.hh
index 05ca60b..93a93a5 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 d360e29..e0ebb43 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 1f75e34..e4def0b 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 2b853e3..deba11a 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 578c40f..ee4bd84 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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_correlation_weight.cc b/mia/2d/test_correlation_weight.cc
index e4a1c21..8201738 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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_cost.cc b/mia/2d/test_cost.cc
index 69e30fd..351c39e 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 58d0fb5..55111b7 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,9 +46,6 @@ BOOST_AUTO_TEST_CASE( test_2ddatafield )
BOOST_CHECK(data(0,0) == 0);
BOOST_CHECK(data(2,2) == 6);
- // 4.25 * 0.25 + 6.25 *0.75
- float ip = data.get_interpol_val_at(C2DFVector(2.25, 1.75));
- BOOST_CHECK(fabs(ip - 5.75) < 0.0001);
std::vector<float> xbuffer;
data.get_data_line_x(2, xbuffer);
diff --git a/mia/2d/test_distance.cc b/mia/2d/test_distance.cc
index c31b859..5f870a0 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 99fd041..e2c0b8b 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 d0964b0..8176302 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -50,7 +50,7 @@ BOOST_AUTO_TEST_CASE(test_available_filters)
#ifdef HAVE_MAXFLOW
test_data.insert("maxflow");
#endif
- test_availabe_plugins(handler, test_data);
+ test_available_plugins(handler, test_data);
}
BOOST_AUTO_TEST_CASE(test_run_filters)
diff --git a/mia/2d/test_filter_cast.cc b/mia/2d/test_filter_cast.cc
index 1b76ae1..277fe37 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,21 +41,18 @@ struct FTestFilter : public TFilter<bool> {
};
-
-typedef bmpl::list<bool,
- signed char,
- unsigned char,
- signed short,
- unsigned short,
- signed int,
- unsigned int,
-#ifdef LONG_64BIT
- signed long,
- unsigned long,
-#endif
- float,
- double
- > test_types;
+typedef bmpl::vector<bool,
+ int8_t,
+ uint8_t,
+ int16_t,
+ uint16_t,
+ int32_t,
+ uint32_t,
+ int64_t,
+ uint64_t,
+ float,
+ double
+ > test_types;
BOOST_AUTO_TEST_CASE_TEMPLATE( test_test_type, T, test_types )
{
diff --git a/mia/2d/test_fullcost.cc b/mia/2d/test_fullcost.cc
index 4c4af54..6ac58b2 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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_mi_spline.cc b/mia/2d/test_fullcost_mi_spline.cc
index 28b8e0a..27c969a 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 5409753..0c73204 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 35770e4..d8f685f 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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/2d/transform.hh>
#include <mia/internal/autotest.hh>
-#include <mia/core/ica.hh>
#include <mia/2d/ica.hh>
using namespace mia;
@@ -39,18 +38,19 @@ struct ICASeriesFixture {
protected:
vector<C2DFImage> image_set;
vector<float> mean;
+ PIndepCompAnalysisFactory ica_factory;
};
-BOOST_AUTO_TEST_CASE ( test_empty_initialization )
+BOOST_FIXTURE_TEST_CASE ( test_empty_initialization, ICASeriesFixture )
{
vector<C2DFImage> series;
- BOOST_CHECK_THROW( C2DImageSeriesICA s(CICAAnalysisITPPFactory(), series, false), invalid_argument);
+ BOOST_CHECK_THROW( C2DImageSeriesICA s(*ica_factory, series, false), invalid_argument);
}
BOOST_FIXTURE_TEST_CASE( test_ica_with_some_mean, ICASeriesFixture )
{
- C2DImageSeriesICA ica(CICAAnalysisITPPFactory(), image_set, false);
+ C2DImageSeriesICA ica(*ica_factory, image_set, false);
ica.run(3, false, false);
@@ -67,7 +67,7 @@ BOOST_FIXTURE_TEST_CASE( test_ica_with_some_mean, ICASeriesFixture )
BOOST_FIXTURE_TEST_CASE( test_ica_imcomplete_mix, ICASeriesFixture )
{
- C2DImageSeriesICA ica(CICAAnalysisITPPFactory(),image_set, false);
+ C2DImageSeriesICA ica(*ica_factory,image_set, false);
C2DImageSeriesICA::IndexSet skip;
skip.insert(0);
skip.insert(1);
@@ -89,7 +89,7 @@ BOOST_FIXTURE_TEST_CASE( test_ica_imcomplete_mix, ICASeriesFixture )
BOOST_FIXTURE_TEST_CASE( test_ica_with_stripped_series_mean, ICASeriesFixture )
{
- C2DImageSeriesICA ica(CICAAnalysisITPPFactory(),image_set, true);
+ C2DImageSeriesICA ica(*ica_factory,image_set, true);
ica.run(3, false, false);
@@ -106,7 +106,7 @@ BOOST_FIXTURE_TEST_CASE( test_ica_with_stripped_series_mean, ICASeriesFixture )
BOOST_FIXTURE_TEST_CASE( test_ica_with_some_mean_4comp, ICASeriesFixture )
{
- C2DImageSeriesICA ica(CICAAnalysisITPPFactory(),image_set, true);
+ C2DImageSeriesICA ica(*ica_factory,image_set, true);
ica.run(4, false, false);
@@ -123,7 +123,7 @@ BOOST_FIXTURE_TEST_CASE( test_ica_with_some_mean_4comp, ICASeriesFixture )
BOOST_FIXTURE_TEST_CASE( test_ica_with_some_mean_4comp_stripped_and_normalized, ICASeriesFixture )
{
- C2DImageSeriesICA ica(CICAAnalysisITPPFactory(),image_set, true);
+ C2DImageSeriesICA ica(*ica_factory,image_set, true);
ica.run(4, true, true);
@@ -140,7 +140,7 @@ BOOST_FIXTURE_TEST_CASE( test_ica_with_some_mean_4comp_stripped_and_normalized,
BOOST_FIXTURE_TEST_CASE( test_ica_with_some_mean_4comp_normalized, ICASeriesFixture )
{
- C2DImageSeriesICA ica(CICAAnalysisITPPFactory(),image_set, false);
+ C2DImageSeriesICA ica(*ica_factory,image_set, false);
ica.run(4, true, true);
@@ -157,7 +157,7 @@ BOOST_FIXTURE_TEST_CASE( test_ica_with_some_mean_4comp_normalized, ICASeriesFixt
BOOST_FIXTURE_TEST_CASE( test_ica_with_some_mean_4comp_normalized2, ICASeriesFixture )
{
- C2DImageSeriesICA ica(CICAAnalysisITPPFactory(),image_set, false);
+ C2DImageSeriesICA ica(*ica_factory,image_set, false);
ica.run(4, true, true);
@@ -174,7 +174,7 @@ BOOST_FIXTURE_TEST_CASE( test_ica_with_some_mean_4comp_normalized2, ICASeriesFix
BOOST_FIXTURE_TEST_CASE( test_ica_with_some_mean_4comp_mix_normalized, ICASeriesFixture )
{
- C2DImageSeriesICA ica(CICAAnalysisITPPFactory(),image_set, false);
+ C2DImageSeriesICA ica(*ica_factory,image_set, false);
ica.run(4, true, false);
@@ -191,7 +191,7 @@ BOOST_FIXTURE_TEST_CASE( test_ica_with_some_mean_4comp_mix_normalized, ICASeries
BOOST_FIXTURE_TEST_CASE( test_ica_with_some_mean_4comp_none, ICASeriesFixture )
{
- C2DImageSeriesICA ica(CICAAnalysisITPPFactory(),image_set, false);
+ C2DImageSeriesICA ica(*ica_factory,image_set, false);
ica.run(4, false, false);
for (size_t i = 0; i < slices; ++i) {
@@ -207,7 +207,7 @@ BOOST_FIXTURE_TEST_CASE( test_ica_with_some_mean_4comp_none, ICASeriesFixture )
-BOOST_AUTO_TEST_CASE( test_ica_mean_substract )
+BOOST_FIXTURE_TEST_CASE( test_ica_mean_substract , ICASeriesFixture)
{
C2DBounds size(2,3);
float init_image1[6] = {1, 2, 3, 4, 5, 6};
@@ -218,7 +218,7 @@ BOOST_AUTO_TEST_CASE( test_ica_mean_substract )
images.push_back(C2DFImage(size, init_image1));
images.push_back(C2DFImage(size, init_image2));
- C2DImageSeriesICA ica(CICAAnalysisITPPFactory(),images, true);
+ C2DImageSeriesICA ica(*ica_factory,images, true);
const C2DFImage& mean = ica.get_mean_image();
@@ -235,7 +235,8 @@ BOOST_AUTO_TEST_CASE( test_ica_mean_substract )
ICASeriesFixture::ICASeriesFixture():
- mean(slices)
+ mean(slices),
+ ica_factory( produce_ica_factory("internal"))
{
float data_rows[slices][nx * ny] = {
{ 1.1, -0.9, -1.9, -0.9, 2.1, -1.9, 6.1, -2.9, -0.9, 1.1 },
diff --git a/mia/2d/test_image.cc b/mia/2d/test_image.cc
index 698b1f2..02065d8 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,7 @@ public:
template <typename T>
-static void creat_and_check(EPixelType type)
+static void create_and_check(EPixelType type)
{
const T init_data[4] = {0, 1, 0, 1 };
@@ -82,21 +82,22 @@ static void creat_and_check(EPixelType type)
BOOST_CHECK_EQUAL(img->get_pixel_size(), pixel_size2);
}
-BOOST_AUTO_TEST_CASE( check_data_types )
+typedef boost::mpl::vector<bool,
+ int8_t,
+ uint8_t,
+ int16_t,
+ uint16_t,
+ int32_t,
+ uint32_t,
+ int64_t,
+ uint64_t,
+ float,
+ double
+ > test_types;
+
+BOOST_AUTO_TEST_CASE_TEMPLATE( check_data_types, T, test_types)
{
- creat_and_check<bool>(it_bit);
- creat_and_check<unsigned char>(it_ubyte);
- creat_and_check<signed char>(it_sbyte);
- creat_and_check<unsigned short>(it_ushort);
- creat_and_check<signed short>(it_sshort);
- creat_and_check<unsigned int>(it_uint);
- creat_and_check<signed int>(it_sint);
-#ifdef LONG_64BIT
- creat_and_check<unsigned long>(it_ulong);
- creat_and_check<signed long>(it_slong);
-#endif
- creat_and_check<float>(it_float);
- creat_and_check<double>(it_double);
+ create_and_check<T>(pixel_type<T>::value);
}
BOOST_AUTO_TEST_CASE( check_gradient )
@@ -135,11 +136,7 @@ BOOST_AUTO_TEST_CASE( check_comparison )
C2DFImage fimage2(fimage);
BOOST_CHECK(fimage == fimage2);
- fimage2(0,0) = 3.0;
- // data is still shared!!
- BOOST_CHECK(fimage == fimage2);
- fimage2.make_single_ref();
fimage2(0,0) = 4.0;
BOOST_CHECK(fimage != fimage2);
@@ -147,5 +144,35 @@ BOOST_AUTO_TEST_CASE( check_comparison )
BOOST_CHECK(ubimage != ubimage2);
+}
+
+BOOST_AUTO_TEST_CASE (test_move_semantics)
+{
+ std::string attr("test_string");
+ C2DBounds size1(2,3);
+ C2DUBImage image1(size1);
+ image1(0,0) = 1.0;
+ image1.set_attribute("test", attr);
+
+ C2DBounds size2(1,1);
+ C2DUBImage image2(size2);
+
+ BOOST_CHECK_EQUAL(image2.get_size(), size2);
+
+
+ C2DUBImage image1_moved(std::move(image1));
+
+ BOOST_CHECK_EQUAL(image1_moved.get_size(), size1);
+ BOOST_CHECK_EQUAL(image1_moved(0,0), 1.0);
+ BOOST_CHECK_EQUAL(image1_moved.get_attribute_as_string("test"), attr);
+
+ BOOST_CHECK_EQUAL(image1.get_size(), C2DBounds::_0);
+
+ image2 =(std::move(image1_moved));
+ BOOST_CHECK_EQUAL(image2.get_size(), size1);
+ BOOST_CHECK_EQUAL(image2(0,0), 1.0);
+ BOOST_CHECK_EQUAL(image2.get_attribute_as_string("test"), attr);
+
+ BOOST_CHECK_EQUAL(image1_moved.get_size(), C2DBounds::_0);
}
diff --git a/mia/2d/test_imagecostbase.cc b/mia/2d/test_imagecostbase.cc
index e8ebc8f..ae728ef 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 15ca418..68b0d7f 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 cdb91ca..7063bd5 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,7 +66,7 @@ void test_direct_interpolator(const T2DDatafield<T>& data)
template <class T>
void test_conv_interpolator(const T2DDatafield<T>& data, PSplineKernel kernel)
{
- T2DConvoluteInterpolator<T> src(data, kernel);
+ T2DInterpolator<T> src(data, kernel);
test_interpolator(data, src);
}
@@ -177,18 +177,16 @@ void test_deformadd()
-typedef bmpl::list<signed char,
- unsigned char,
- signed short,
- unsigned short,
- signed int,
- unsigned int,
+typedef bmpl::list<int8_t,
+ uint8_t,
+ int16_t,
+ uint16_t,
+ int32_t,
+ uint32_t,
+ int64_t,
+ uint64_t,
float,
double
-#ifdef LONG_64BIT
- ,signed long
- ,unsigned long
-#endif
> test_types;
diff --git a/mia/2d/test_iterator.cc b/mia/2d/test_iterator.cc
index 5191982..d46d5c0 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,16 +23,15 @@
#include <mia/internal/autotest.hh>
#include <mia/2d/vectorfield.hh>
-#include <mia/2d/datafield.cxx>
-#include <mia/2d/iterator.cxx>
#include <mia/2d/image.hh>
NS_MIA_USE;
+
+
typedef C2DFVectorfield::range_iterator range2d_vfiterator;
typedef C2DFVectorfield::const_range_iterator const_range2d_vfiterator;
-
struct VFIteratorFixture {
VFIteratorFixture();
diff --git a/mia/2d/test_matrix.cc b/mia/2d/test_matrix.cc
index 7b4a2d8..581f7ad 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 0b63e41..9768756 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 e1b7b7b..8b3dce9 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 04d86a3..c0b8fe7 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 78a555a..64fd672 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 6e87135..5d4ba2a 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 c624c52..b45029a 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 e51d882..edb5b62 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,10 +22,7 @@
#include <climits>
#include <mia/internal/autotest.hh>
-
-
#include <mia/2d/perfusion.hh>
-#include <mia/core/ica.hh>
NS_MIA_USE
using std::vector;
@@ -129,13 +126,51 @@ void check_pa(const C2DPerfusionAnalysis& pa)
}
-BOOST_AUTO_TEST_CASE( test_series_with_movement_fixed_componenets )
+BOOST_AUTO_TEST_CASE( test_series_with_movement_fixed_componenets_defl )
{
C2DBounds size(16,16);
C2DFImage prototype(size);
prototype.set_pixel_size(C2DFVector(4, 4));
std::vector<C2DFImage> series(nframes, prototype);
+
+
+ for (unsigned i = 0; i < nframes; ++i) {
+ for (unsigned k = 0; k < ncomponents; ++k) {
+ const vector<float>& m = mix[k];
+ float mix_factor = m[i] * scale[k];
+ transform(init[k].begin(), init[k].end(), series[i].begin(), series[i].begin(),
+ [mix_factor](float comp, float pixel) {
+ return comp * mix_factor + pixel;
+ });
+ }
+ }
+
+ auto ica_factory = produce_ica_factory("internal");
+ ica_factory->set_deterministic_seed(1000);
+
+ C2DPerfusionAnalysis pa(5, true, true);
+ pa.set_approach(CIndepCompAnalysis::appr_defl);
+ BOOST_CHECK(pa.run(series, *ica_factory));
+ check_pa(pa);
+
+ C2DBounds crop_start;
+ P2DFilter crop_filter = pa.get_crop_filter(1.0, crop_start, C2DPerfusionAnalysis::bs_delta_feature);
+ BOOST_REQUIRE(crop_filter);
+
+ C2DPerfusionAnalysis pa0(0, true, true);
+ BOOST_CHECK(pa0.run(series, *ica_factory));
+ check_pa(pa0);
+}
+
+
+BOOST_AUTO_TEST_CASE( test_series_with_movement_fixed_componenets_symm )
+{
+ C2DBounds size(16,16);
+ C2DFImage prototype(size);
+ prototype.set_pixel_size(C2DFVector(4, 4));
+ std::vector<C2DFImage> series(nframes, prototype);
+
for (unsigned i = 0; i < nframes; ++i) {
for (unsigned k = 0; k < ncomponents; ++k) {
@@ -148,23 +183,21 @@ BOOST_AUTO_TEST_CASE( test_series_with_movement_fixed_componenets )
}
}
- CICAAnalysisITPPFactory ica_factory;
+ auto ica_factory = produce_ica_factory("internal");
+ ica_factory->set_deterministic_seed(1);
C2DPerfusionAnalysis pa(5, true, true);
+ pa.set_approach(CIndepCompAnalysis::appr_symm);
- BOOST_CHECK(pa.run(series, ica_factory));
+ BOOST_CHECK(pa.run(series, *ica_factory));
check_pa(pa);
C2DBounds crop_start;
P2DFilter crop_filter = pa.get_crop_filter(1.0, crop_start, C2DPerfusionAnalysis::bs_delta_feature);
BOOST_REQUIRE(crop_filter);
-#if 0 // this is a very shaky test, probably depends on the BLAS library used with it++
- BOOST_CHECK_EQUAL(crop_start.x, 2);
- BOOST_CHECK_EQUAL(crop_start.y, 0);
-#endif
C2DPerfusionAnalysis pa0(0, true, true);
- BOOST_CHECK(pa0.run(series, ica_factory));
+ BOOST_CHECK(pa0.run(series, *ica_factory));
check_pa(pa0);
}
diff --git a/mia/2d/test_polygon.cc b/mia/2d/test_polygon.cc
index 105ff0b..8283a80 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 e999aaa..38e2343 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,8 +153,8 @@ BOOST_FIXTURE_TEST_CASE( test_nocurl_bspline3, TransformSplineFixtureDivOnly )
{
init(16, 4, "bspline:d=4");
- const T2DConvoluteInterpolator<C2DFVector>& interp =
- static_cast<const T2DConvoluteInterpolator<C2DFVector>&>(*source);
+ const T2DInterpolator<C2DFVector>& interp =
+ static_cast<const T2DInterpolator<C2DFVector>&>(*source);
auto coeffs = interp.get_coefficients();
const double testvalue = 6.0 * M_PI;
@@ -173,8 +173,8 @@ BOOST_FIXTURE_TEST_CASE( test_nocurl_bspline3_noniso, TransformSplineFixtureDivO
{
init2d(T2DVector<int>(32, 14), 4, "bspline:d=4");
- const T2DConvoluteInterpolator<C2DFVector>& interp =
- static_cast<const T2DConvoluteInterpolator<C2DFVector>&>(*source);
+ const T2DInterpolator<C2DFVector>& interp =
+ static_cast<const T2DInterpolator<C2DFVector>&>(*source);
auto coeffs = interp.get_coefficients();
const double testvalue = 6.0 * M_PI;
@@ -194,8 +194,8 @@ BOOST_FIXTURE_TEST_CASE( test_nocurl_bspline3_8_4, TransformSplineFixtureDivOnly
{
init(8, 4, "bspline:d=4");
- const T2DConvoluteInterpolator<C2DFVector>& interp =
- static_cast<const T2DConvoluteInterpolator<C2DFVector>&>(*source);
+ const T2DInterpolator<C2DFVector>& interp =
+ static_cast<const T2DInterpolator<C2DFVector>&>(*source);
auto coeffs = interp.get_coefficients();
const double testvalue = 6.0 * M_PI;
@@ -214,8 +214,8 @@ BOOST_FIXTURE_TEST_CASE( test_nodiv_bspline3, TransformSplineFixtureCurlOnly )
{
init(16, 4, "bspline:d=4");
- const T2DConvoluteInterpolator<C2DFVector>& interp =
- static_cast<const T2DConvoluteInterpolator<C2DFVector>&>(*source);
+ const T2DInterpolator<C2DFVector>& interp =
+ static_cast<const T2DInterpolator<C2DFVector>&>(*source);
auto coeffs = interp.get_coefficients();
const double testvalue = 6.0 * M_PI;
@@ -253,8 +253,8 @@ BOOST_FIXTURE_TEST_CASE( test_divergence_expm2_bspline3_grad, TransformSplineFix
{
init(8, 4, "bspline:d=4");
- const T2DConvoluteInterpolator<C2DFVector>& interp =
- static_cast<const T2DConvoluteInterpolator<C2DFVector>&>(*source);
+ const T2DInterpolator<C2DFVector>& interp =
+ static_cast<const T2DInterpolator<C2DFVector>&>(*source);
auto coeffs = interp.get_coefficients();
C2DPPDivcurlMatrix div(field.get_size(), field_range, *ipf->get_kernel(), 1.0, 0.0);
@@ -295,8 +295,8 @@ BOOST_FIXTURE_TEST_CASE( test_rotation_expm2_bspline3_grad, TransformSplineFixtu
{
init(8, 4, "bspline:d=4");
- const T2DConvoluteInterpolator<C2DFVector>& interp =
- static_cast<const T2DConvoluteInterpolator<C2DFVector>&>(*source);
+ const T2DInterpolator<C2DFVector>& interp =
+ static_cast<const T2DInterpolator<C2DFVector>&>(*source);
auto coeffs = interp.get_coefficients();
C2DPPDivcurlMatrix rot(field.get_size(), field_range, *ipf->get_kernel(), 0.0, 1.0);
@@ -337,8 +337,8 @@ BOOST_FIXTURE_TEST_CASE( test_divergence_expm2_bspline3_grad_noiso, TransformSpl
{
init2d(T2DVector<int>(12, 9), 4, "bspline:d=4");
- const T2DConvoluteInterpolator<C2DFVector>& interp =
- static_cast<const T2DConvoluteInterpolator<C2DFVector>&>(*source);
+ const T2DInterpolator<C2DFVector>& interp =
+ static_cast<const T2DInterpolator<C2DFVector>&>(*source);
auto coeffs = interp.get_coefficients();
C2DPPDivcurlMatrix div(field.get_size(), field_range, *ipf->get_kernel(), 1.0, 0.0);
@@ -379,8 +379,8 @@ BOOST_FIXTURE_TEST_CASE( test_rotation_expm2_bspline3_grad_noiso, TransformSplin
{
init2d(T2DVector<int>(12, 9), 4, "bspline:d=4");
- const T2DConvoluteInterpolator<C2DFVector>& interp =
- static_cast<const T2DConvoluteInterpolator<C2DFVector>&>(*source);
+ const T2DInterpolator<C2DFVector>& interp =
+ static_cast<const T2DInterpolator<C2DFVector>&>(*source);
auto coeffs = interp.get_coefficients();
C2DPPDivcurlMatrix rot(field.get_size(), field_range, *ipf->get_kernel(), 0.0, 1.0);
@@ -436,8 +436,8 @@ BOOST_FIXTURE_TEST_CASE( test_divergence_zero_x, TransformSplineFixtureConst )
const double testvalue = 0.0;
- const T2DConvoluteInterpolator<C2DFVector>& interp =
- static_cast<const T2DConvoluteInterpolator<C2DFVector>&>(*source);
+ const T2DInterpolator<C2DFVector>& interp =
+ static_cast<const T2DInterpolator<C2DFVector>&>(*source);
auto coeffs = interp.get_coefficients();
@@ -627,8 +627,8 @@ void TransformSplineFixtureexpm2Field_44::run(int dsize, float range, const stri
// evaluated using maxima
const double testvalue = 4.0 * M_PI;
- const T2DConvoluteInterpolator<C2DFVector>& interp =
- static_cast<const T2DConvoluteInterpolator<C2DFVector>&>(*source);
+ const T2DInterpolator<C2DFVector>& interp =
+ static_cast<const T2DInterpolator<C2DFVector>&>(*source);
auto coeffs = interp.get_coefficients();
diff --git a/mia/2d/test_register.cc b/mia/2d/test_register.cc
index ca68758..b975b02 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 8cd36e7..cbd548b 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 76c7fb3..2255fce 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 dd602a1..404a325 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,12 +25,11 @@
#include <mia/2d/boundingbox.hh>
#include <mia/2d/imageio.hh>
#include <mia/2d/transformfactory.hh>
-#include <libxml++/libxml++.h>
+#include <mia/core/xmlinterface.hh>
using namespace mia;
using namespace std;
using namespace ::boost::unit_test;
-using namespace xmlpp;
namespace bfs=boost::filesystem;
extern const char *testframe_init;
@@ -61,14 +60,11 @@ struct FrameTestRead {
void FrameTestRead::init(const char *init_str)
{
- xmlpp::DomParser parser;
- parser.parse_memory(init_str);
- const xmlpp::Document *document = parser.get_document();
- const xmlpp::Element *root = document->get_root_node ();
- auto nodes = root->get_children();
+ CXMLDocument document(init_str);
+ auto root = document.get_root_node();
+ auto nodes = root->get_all_children();
BOOST_CHECK_EQUAL(nodes.size(),1u);
-
- frame = CSegFrame (**nodes.begin(), 1);
+ frame = CSegFrame (*nodes[0], 1);
}
@@ -139,20 +135,20 @@ BOOST_FIXTURE_TEST_CASE(segframe_shift, FrameTestRead)
const char *testframe_init = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<test>"
"<frame image=\"image.png\">"
- "<star y=\"118\" x=\"109\" r=\"21\">"
- "<point y=\"1\" x=\"0\"/>"
- "<point y=\"-0.5\" x=\"0.866025\"/>"
- "<point y=\"-0.5\" x=\"-0.866025\"/>"
+ "<star r=\"21\" x=\"109\" y=\"118\">"
+ "<point x=\"0\" y=\"1\"/>"
+ "<point x=\"0.866025\" y=\"-0.5\"/>"
+ "<point x=\"-0.866025\" y=\"-0.5\"/>"
"</star>"
"<section color=\"white\">"
- "<point y=\"20\" x=\"10\"/>"
- "<point y=\"10\" x=\"20\"/>"
- "<point y=\"4\" x=\"0\"/>"
+ "<point x=\"10\" y=\"20\"/>"
+ "<point x=\"20\" y=\"10\"/>"
+ "<point x=\"0\" y=\"4\"/>"
"</section>"
"<section color=\"red\">"
- "<point y=\"21\" x=\"11\"/>"
- "<point y=\"11\" x=\"21\"/>"
- "<point y=\"5\" x=\"1\"/>"
+ "<point x=\"11\" y=\"21\"/>"
+ "<point x=\"21\" y=\"11\"/>"
+ "<point x=\"1\" y=\"5\"/>"
"</section>"
"</frame>"
"</test>\n";
@@ -160,20 +156,20 @@ const char *testframe_init = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<test>
const char *testframe_shifted = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<test>"
"<frame image=\"newname\">"
- "<star y=\"116\" x=\"108\" r=\"21\">"
- "<point y=\"1\" x=\"0\"/>"
- "<point y=\"-0.5\" x=\"0.866025\"/>"
- "<point y=\"-0.5\" x=\"-0.866025\"/>"
+ "<star r=\"21\" x=\"108\" y=\"116\">"
+ "<point x=\"0\" y=\"1\"/>"
+ "<point x=\"0.866025\" y=\"-0.5\"/>"
+ "<point x=\"-0.866025\" y=\"-0.5\"/>"
"</star>"
"<section color=\"white\">"
- "<point y=\"18\" x=\"9\"/>"
- "<point y=\"8\" x=\"19\"/>"
- "<point y=\"2\" x=\"-1\"/>"
+ "<point x=\"9\" y=\"18\"/>"
+ "<point x=\"19\" y=\"8\"/>"
+ "<point x=\"-1\" y=\"2\"/>"
"</section>"
"<section color=\"red\">"
- "<point y=\"19\" x=\"10\"/>"
- "<point y=\"9\" x=\"20\"/>"
- "<point y=\"3\" x=\"0\"/>"
+ "<point x=\"10\" y=\"19\"/>"
+ "<point x=\"20\" y=\"9\"/>"
+ "<point x=\"0\" y=\"3\"/>"
"</section>"
"</frame>"
"</test>\n";
@@ -194,11 +190,11 @@ BOOST_FIXTURE_TEST_CASE(segframe_transform, FrameTestRead)
frame.transform(*transform);
frame.set_imagename("newname");
- xmlpp::Document document;
- xmlpp::Element* nodeRoot = document.create_root_node("test");
+ CXMLDocument document;
+ auto nodeRoot = document.create_root_node("test");
frame.write(*nodeRoot, 1);
- const string xmldoc = document.write_to_string("UTF-8");
+ const string xmldoc = document.write_to_string("UTF-8", false);
const string testdoc(testframe_shifted);
BOOST_CHECK_EQUAL(xmldoc.size(), testdoc.size());
@@ -213,18 +209,18 @@ BOOST_FIXTURE_TEST_CASE(test_frame_get_mask, FrameTestRead)
"<?xml version=\"1.0\"?>\n<test>"
"<frame image=\"framename\">"
"<section color=\"white\">"
- "<point y=\"2\" x=\"1\"/>"
- "<point y=\"4\" x=\"1\"/>"
- "<point y=\"4\" x=\"3\"/>"
- "<point y=\"2\" x=\"3\"/>"
+ "<point x=\"1\" y=\"2\"/>"
+ "<point x=\"1\" y=\"4\"/>"
+ "<point x=\"3\" y=\"4\"/>"
+ "<point x=\"3\" y=\"2\"/>"
"</section>"
"<section color=\"blue\">"
- "<point y=\"0\" x=\"2\"/>"
- "<point y=\"2\" x=\"2\"/>"
- "<point y=\"2\" x=\"3\"/>"
- "<point y=\"3\" x=\"3\"/>"
- "<point y=\"3\" x=\"4\"/>"
- "<point y=\"0\" x=\"4\"/>"
+ "<point x=\"2\" y=\"0\"/>"
+ "<point x=\"2\" y=\"2\"/>"
+ "<point x=\"3\" y=\"2\"/>"
+ "<point x=\"3\" y=\"3\"/>"
+ "<point x=\"4\" y=\"3\"/>"
+ "<point x=\"4\" y=\"0\"/>"
"</section>"
"</frame></test>\n";
@@ -347,18 +343,18 @@ BOOST_FIXTURE_TEST_CASE(test_frame_get_mask_size, FrameTestRead)
"<?xml version=\"1.0\"?>\n<test>"
"<frame image=\"name.@\">"
"<section color=\"white\">"
- "<point y=\"2\" x=\"1\"/>"
- "<point y=\"4\" x=\"1\"/>"
- "<point y=\"4\" x=\"3\"/>"
- "<point y=\"2\" x=\"3\"/>"
+ "<point x=\"1\" y=\"2\"/>"
+ "<point x=\"1\" y=\"4\"/>"
+ "<point x=\"3\" y=\"4\"/>"
+ "<point x=\"3\" y=\"2\"/>"
"</section>"
"<section color=\"blue\">"
- "<point y=\"0\" x=\"2\"/>"
- "<point y=\"2\" x=\"2\"/>"
- "<point y=\"2\" x=\"3\"/>"
- "<point y=\"3\" x=\"3\"/>"
- "<point y=\"3\" x=\"4\"/>"
- "<point y=\"0\" x=\"4\"/>"
+ "<point x=\"2\" y=\"0\"/>"
+ "<point x=\"2\" y=\"2\"/>"
+ "<point x=\"3\" y=\"2\"/>"
+ "<point x=\"3\" y=\"3\"/>"
+ "<point x=\"4\" y=\"3\"/>"
+ "<point x=\"4\" y=\"0\"/>"
"</section>"
"</frame></test>\n";
@@ -390,18 +386,18 @@ BOOST_FIXTURE_TEST_CASE(test_frame_get_stats, FrameTestRead)
"<?xml version=\"1.0\"?>\n<test>"
"<frame image=\"name.@\">"
"<section color=\"white\">"
- "<point y=\"2\" x=\"1\"/>"
- "<point y=\"4\" x=\"1\"/>"
- "<point y=\"4\" x=\"3\"/>"
- "<point y=\"2\" x=\"3\"/>"
+ "<point x=\"1\" y=\"2\"/>"
+ "<point x=\"1\" y=\"4\"/>"
+ "<point x=\"3\" y=\"4\"/>"
+ "<point x=\"3\" y=\"2\"/>"
"</section>"
"<section color=\"blue\">"
- "<point y=\"0\" x=\"2\"/>"
- "<point y=\"2\" x=\"2\"/>"
- "<point y=\"2\" x=\"3\"/>"
- "<point y=\"3\" x=\"3\"/>"
- "<point y=\"3\" x=\"4\"/>"
- "<point y=\"0\" x=\"4\"/>"
+ "<point x=\"2\" y=\"0\"/>"
+ "<point x=\"2\" y=\"2\"/>"
+ "<point x=\"3\" y=\"2\"/>"
+ "<point x=\"3\" y=\"3\"/>"
+ "<point x=\"4\" y=\"3\"/>"
+ "<point x=\"4\" y=\"0\"/>"
"</section>"
"</frame></test>\n";
@@ -458,11 +454,11 @@ BOOST_AUTO_TEST_CASE(segframe_write)
CSegFrame frame("image.png", star, sections);
- xmlpp::Document document;
- xmlpp::Element* nodeRoot = document.create_root_node("test");
+ CXMLDocument document;
+ auto nodeRoot = document.create_root_node("test");
frame.write(*nodeRoot, 1);
- const string xmldoc = document.write_to_string("UTF-8");
+ const string xmldoc = document.write_to_string("UTF-8", false);
const string testdoc(testframe_init);
BOOST_CHECK_EQUAL(xmldoc.size(), testdoc.size());
@@ -472,26 +468,26 @@ BOOST_AUTO_TEST_CASE(segframe_write)
const char *testframe_init2 = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<test>"
"<frame image=\"image.png\">"
- "<star y=\"118\" x=\"109\" r=\"21\">"
- "<point y=\"20\" x=\"10\"/>"
- "<point y=\"10\" x=\"20\"/>"
- "<point y=\"4\" x=\"0\"/>"
+ "<star r=\"21\" x=\"109\" y=\"118\">"
+ "<point x=\"10\" y=\"20\"/>"
+ "<point x=\"20\" y=\"10\"/>"
+ "<point x=\"0\" y=\"4\"/>"
" "
"</star>"
"<section color=\"white\">"
- "<point y=\"20\" x=\"10\"/>"
- "<point y=\"10\" x=\"20\"/>"
- "<point y=\"4\" x=\"0\"/>"
+ "<point x=\"10\" y=\"20\"/>"
+ "<point x=\"20\" y=\"10\"/>"
+ "<point x=\"0\" y=\"4\"/>"
"</section>"
"<section color=\"red\">"
- "<point y=\"21\" x=\"11\"/>"
- "<point y=\"11\" x=\"21\"/>"
- "<point y=\"5\" x=\"1\"/>"
+ "<point x=\"11\" y=\"21\"/>"
+ "<point x=\"21\" y=\"11\"/>"
+ "<point x=\"1\" y=\"5\"/>"
"</section>"
"<section color=\"blue\">"
- "<point y=\"21\" x=\"11\"/>"
- "<point y=\"11\" x=\"21\"/>"
- "<point y=\"5\" x=\"1\"/>"
+ "<point x=\"11\" y=\"21\"/>"
+ "<point x=\"21\" y=\"11\"/>"
+ "<point x=\"1\" y=\"5\"/>"
"</section>"
"</frame>"
"</test>\n";
diff --git a/mia/2d/test_segmentation.cc b/mia/2d/test_segmentation.cc
index 89d21a6..48945bd 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,8 +25,7 @@
#include <mia/2d/boundingbox.hh>
#include <mia/2d/transformfactory.hh>
#include <mia/2d/imageio.hh>
-
-#include <libxml++/libxml++.h>
+#include <mia/core/xmlinterface.hh>
namespace bfs=boost::filesystem;
@@ -34,18 +33,15 @@ namespace bfs=boost::filesystem;
NS_MIA_USE
using namespace std;
using namespace ::boost::unit_test;
-using namespace xmlpp;
const char *testpoint_init =
- "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<test><point y=\"20\" x=\"10\"/></test>\n";
+ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<test><point x=\"10\" y=\"20\"/></test>\n";
BOOST_AUTO_TEST_CASE(segpoint_read)
{
- DomParser parser;
- parser.parse_memory(testpoint_init);
+ CXMLDocument document(testpoint_init);
- const Document *document = parser.get_document();
- const Element *root = document->get_root_node ();
+ auto root = document.get_root_node ();
auto nodes = root->get_children("point");
BOOST_CHECK_EQUAL(nodes.size(),1u);
@@ -58,12 +54,12 @@ BOOST_AUTO_TEST_CASE(segpoint_read)
BOOST_AUTO_TEST_CASE(segpoint_write)
{
- Document document;
- Element* nodeRoot = document.create_root_node("test");
+ CXMLDocument document;
+ auto nodeRoot = document.create_root_node("test");
CSegPoint2D point(10,20);
point.write(*nodeRoot);
- const string xmldoc = document.write_to_string("UTF-8");
+ const string xmldoc = document.write_to_string("UTF-8", false);
const string testdoc(testpoint_init);
BOOST_CHECK_EQUAL(xmldoc.size(), testdoc.size());
BOOST_CHECK_EQUAL(xmldoc, testdoc);
@@ -104,10 +100,9 @@ struct SegStarFixture {
void SegStarFixture::init(const char *init_str)
{
- DomParser parser;
- parser.parse_memory(init_str);
- const Document *document = parser.get_document();
- const Element *root = document->get_root_node ();
+ CXMLDocument document(init_str);
+
+ auto root = document.get_root_node ();
auto nodes = root->get_children("star");
BOOST_CHECK_EQUAL(nodes.size(),1u);
@@ -148,6 +143,36 @@ BOOST_FIXTURE_TEST_CASE(segstar_shift, SegStarFixture)
check(C2DFVector(108, 116), 21, x_init, y_init);
}
+BOOST_FIXTURE_TEST_CASE(test_segstart_no_radius, SegStarFixture)
+{
+ const char *sestsection_error_r =
+ "<?xml version=\"1.0\"?>\n<test>"
+ "<star x=\"109\" y=\"118\">"
+ "<point x=\"10\" y=\"20\"/>"
+ "<point x=\"20\" y=\"10\"/>"
+ "<point x=\"0\" y=\"4\"/>"
+ "</star>"
+ "</test>";
+
+ CXMLDocument doc;
+ BOOST_CHECK_THROW(init(sestsection_error_r), runtime_error);
+}
+
+BOOST_FIXTURE_TEST_CASE(test_segstart_radius_no_number, SegStarFixture)
+{
+ const char *sestsection_error_r =
+ "<?xml version=\"1.0\"?>\n<test>"
+ "<star x=\"109\" y=\"118\" r=\"12a\">"
+ "<point x=\"10\" y=\"20\"/>"
+ "<point x=\"20\" y=\"10\"/>"
+ "<point x=\"0\" y=\"4\"/>"
+ "</star>"
+ "</test>";
+
+ CXMLDocument doc;
+ BOOST_CHECK_THROW(init(sestsection_error_r), runtime_error);
+}
+
BOOST_AUTO_TEST_CASE(segstar_write)
{
CSegStar star(CSegPoint2D(109, 118), 21,
@@ -155,11 +180,11 @@ BOOST_AUTO_TEST_CASE(segstar_write)
CSegPoint2D(20, 10),
CSegPoint2D(0, 4));
- Document document;
- Element* nodeRoot = document.create_root_node("test");
+ CXMLDocument document;
+ auto nodeRoot = document.create_root_node("test");
star.write(*nodeRoot);
- const string xmldoc = document.write_to_string("UTF-8");
+ const string xmldoc = document.write_to_string("UTF-8", false);
string teststar(teststar_init);
BOOST_CHECK_EQUAL(xmldoc.size(), teststar.size());
@@ -220,11 +245,11 @@ BOOST_AUTO_TEST_CASE(segment_section_write)
CSegSection section("white", points, 1);
- xmlpp::Document document;
- xmlpp::Element* nodeRoot = document.create_root_node("test");
+ CXMLDocument document;
+ auto nodeRoot = document.create_root_node("test");
section.write(*nodeRoot, 1);
- const string xmldoc = document.write_to_string("UTF-8");
+ const string xmldoc = document.write_to_string("UTF-8", false);
const string testdoc(testsection_init);
BOOST_CHECK_EQUAL(xmldoc.size(), testdoc.size());
@@ -333,10 +358,10 @@ BOOST_FIXTURE_TEST_CASE(test_segsection_draw2, SectionTestRead)
{
const char *sestsection_for_draw2 =
"<?xml version=\"1.0\"?>\n<test><section color=\"white\">"
- "<point y=\"2\" x=\"1\"/>"
- "<point y=\"4\" x=\"1\"/>"
- "<point y=\"4\" x=\"3\"/>"
- "<point y=\"2\" x=\"3\"/>"
+ "<point x=\"1\" y=\"2\"/>"
+ "<point x=\"1\" y=\"4\"/>"
+ "<point x=\"3\" y=\"4\"/>"
+ "<point x=\"3\" y=\"2\"/>"
"</section></test>\n";
@@ -358,7 +383,7 @@ BOOST_FIXTURE_TEST_CASE(test_segsection_error_attribute, SectionTestRead)
{
const char *sestsection_error_x =
"<?xml version=\"1.0\"?>\n<test><section color=\"white\">"
- "<point y=\"2\" x=\"1a\"/>"
+ "<point x=\"1 y=\"2\"a\"/>"
"</section></test>\n";
@@ -378,24 +403,21 @@ BOOST_AUTO_TEST_CASE(test_segstart_error_attribute)
{
const char *sestsection_error_r =
"<?xml version=\"1.0\"?>\n<test>"
- "<star y=\"118\" x=\"109\" r=\"21a\">"
- "<point y=\"20\" x=\"10\"/>"
- "<point y=\"10\" x=\"20\"/>"
- "<point y=\"4\" x=\"0\"/>"
+ "<star r=\"21\"x=\"109\" y=\"118\">"
+ "<point x=\"10\" y=\"20\"/>"
+ "<point x=\"20\" y=\"10\"/>"
+ "<point x=\"0\" y=\"4\"/>"
"</star>"
"</test>";
-
- xmlpp::DomParser parser;
- parser.parse_memory(sestsection_error_r);
- const xmlpp::Document *document = parser.get_document();
- const xmlpp::Element *root = document->get_root_node ();
- auto nodes = root->get_children();
- BOOST_CHECK_EQUAL(nodes.size(),1u);
- BOOST_CHECK_THROW(CSegStar(**nodes.begin()), runtime_error);
+ CXMLDocument doc;
+ BOOST_CHECK(!doc.read_from_string(sestsection_error_r));
}
+
+
+
/*
input_set.save_images();
*/
@@ -410,9 +432,9 @@ BOOST_AUTO_TEST_CASE( test_segset_write_version1 )
segset.add_frame(CSegFrame("image.png", star1, CSegFrame::Sections()));
segset.add_frame(CSegFrame("image2.png", star2, CSegFrame::Sections()));
- unique_ptr<xmlpp::Document> document(segset.write());
+ CXMLDocument document(segset.write());
- const string xmldoc = document->write_to_string("UTF-8");
+ const string xmldoc = document.write_to_string("UTF-8", false);
const string testdoc(testset_init2);
BOOST_CHECK_EQUAL(xmldoc.size(), testdoc.size());
@@ -424,8 +446,8 @@ BOOST_FIXTURE_TEST_CASE( test_segset_shift_and_rename, SegSetReadFixture )
init(testset_bboxtest);
C2DFVector shift(-3.0f, -10.0f);
CSegSet result = segset.shift_and_rename(0, shift, "moved");
- unique_ptr<xmlpp::Document> document(result.write());
- const string xmldoc = document->write_to_string("UTF-8");
+ CXMLDocument document(result.write());
+ const string xmldoc = document.write_to_string("UTF-8", false);
const string testdoc(testset_shift_and_rename);
BOOST_CHECK_EQUAL(xmldoc.size(), testdoc.size());
BOOST_CHECK_EQUAL(xmldoc, testdoc);
@@ -488,8 +510,8 @@ BOOST_FIXTURE_TEST_CASE( test_segset_version_2_read_write, SegSetReadFixture )
BOOST_CHECK_EQUAL(i->y, test_y);
}
- unique_ptr<xmlpp::Document> document(segset.write());
- const string xmldoc = document->write_to_string("UTF-8");
+ CXMLDocument document(segset.write());
+ const string xmldoc = document.write_to_string("UTF-8", false);
const string testdoc(testset_version_2);
BOOST_CHECK_EQUAL(xmldoc.size(), testdoc.size());
BOOST_CHECK_EQUAL(xmldoc, testdoc);
@@ -503,22 +525,22 @@ BOOST_FIXTURE_TEST_CASE( test_segset_version_2_draw, SegSetReadFixture )
"<?xml version=\"1.0\"?>\n<workset version=\"2\">"
"<description><RVpeak value=\"1\"/><LVpeak value=\"2\"/><PreferedRef value=\"0\"/></description>"
"<frame image=\"moved0000.png\" quality=\"4\" brightness=\"0.625\" contrast=\"1.5\">"
- "<star y=\"128\" x=\"112\" r=\"21\">"
- "<point y=\"20\" x=\"10\"/>"
- "<point y=\"10\" x=\"20\"/>"
- "<point y=\"4\" x=\"0\"/>"
+ "<star r=\"21\" x=\"112\" y=\"128\">"
+ "<point x=\"10\" y=\"20\"/>"
+ "<point x=\"20\" y=\"10\"/>"
+ "<point x=\"0\" y=\"4\"/>"
"</star>"
"<section color=\"white\" open=\"false\">"
- "<point y=\"1\" x=\"2\"/>"
- "<point y=\"9\" x=\"2\"/>"
- "<point y=\"9\" x=\"8\"/>"
- "<point y=\"1\" x=\"8\"/>"
+ "<point x=\"2\" y=\"1\"/>"
+ "<point x=\"2\" y=\"9\"/>"
+ "<point x=\"8\" y=\"9\"/>"
+ "<point x=\"8\" y=\"1\"/>"
"</section>"
"<section color=\"blue\" open=\"false\">"
- "<point y=\"3\" x=\"4\"/>"
- "<point y=\"7\" x=\"4\"/>"
- "<point y=\"7\" x=\"6\"/>"
- "<point y=\"3\" x=\"6\"/>"
+ "<point x=\"4\" y=\"3\"/>"
+ "<point x=\"4\" y=\"7\"/>"
+ "<point x=\"6\" y=\"7\"/>"
+ "<point x=\"6\" y=\"3\"/>"
"</section>"
"</frame></workset>\n";
@@ -561,22 +583,22 @@ BOOST_FIXTURE_TEST_CASE( test_segset_version_2_draw_fail, SegSetReadFixture )
"<?xml version=\"1.0\"?>\n<workset version=\"2\">"
"<description><RVpeak value=\"1\"/><LVpeak value=\"2\"/><PreferedRef value=\"0\"/></description>"
"<frame image=\"moved0000.png\" quality=\"4\" brightness=\"0.625\" contrast=\"1.5\">"
- "<star y=\"128\" x=\"112\" r=\"21\">"
- "<point y=\"20\" x=\"10\"/>"
- "<point y=\"10\" x=\"20\"/>"
- "<point y=\"4\" x=\"0\"/>"
+ "<star r=\"21\" x=\"112\" y=\"128\">"
+ "<point x=\"10\" y=\"20\"/>"
+ "<point x=\"20\" y=\"10\"/>"
+ "<point x=\"0\" y=\"4\"/>"
"</star>"
"<section color=\"white\" open=\"true\">"
- "<point y=\"1\" x=\"2\"/>"
- "<point y=\"9\" x=\"2\"/>"
- "<point y=\"9\" x=\"8\"/>"
- "<point y=\"1\" x=\"8\"/>"
+ "<point x=\"2\" y=\"1\"/>"
+ "<point x=\"2\" y=\"9\"/>"
+ "<point x=\"8\" y=\"9\"/>"
+ "<point x=\"8\" y=\"1\"/>"
"</section>"
"<section color=\"blue\" open=\"false\">"
- "<point y=\"3\" x=\"4\"/>"
- "<point y=\"7\" x=\"4\"/>"
- "<point y=\"7\" x=\"6\"/>"
- "<point y=\"3\" x=\"6\"/>"
+ "<point x=\"4\" y=\"3\"/>"
+ "<point x=\"4\" y=\"7\"/>"
+ "<point x=\"6\" y=\"7\"/>"
+ "<point x=\"6\" y=\"3\"/>"
"</section>"
"</frame></workset>\n";
@@ -589,20 +611,16 @@ BOOST_FIXTURE_TEST_CASE( test_segset_version_2_draw_fail, SegSetReadFixture )
void SegSetReadFixture::init(const char *data)
{
- xmlpp::DomParser parser;
- parser.parse_memory(data);
- const xmlpp::Document *document = parser.get_document();
- segset = CSegSet(*document);
+ CXMLDocument document(data);
+ segset = CSegSet(document);
}
void SectionTestRead::init(const char *init_str)
{
- xmlpp::DomParser parser;
- parser.parse_memory(init_str);
- const xmlpp::Document *document = parser.get_document();
- const xmlpp::Element *root = document->get_root_node ();
- auto nodes = root->get_children();
+ CXMLDocument document(init_str);
+ auto root = document.get_root_node ();
+ auto nodes = root->get_all_children();
BOOST_CHECK_EQUAL(nodes.size(),1u);
section = CSegSection(**nodes.begin(), 1);
@@ -625,43 +643,43 @@ void SectionTestRead::check(const float *x_data, const float *y_data) const
const char *sestsection_for_draw = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<test><section color=\"white\">"
- "<point y=\"4\" x=\"1\"/>"
- "<point y=\"8\" x=\"1\"/>"
- "<point y=\"8\" x=\"7\"/>"
- "<point y=\"1\" x=\"7\"/>"
- "<point y=\"1\" x=\"4\"/>"
- "<point y=\"6\" x=\"4\"/>"
- "<point y=\"6\" x=\"3\"/>"
- "<point y=\"4\" x=\"3\"/>"
+ "<point x=\"1\" y=\"4\"/>"
+ "<point x=\"1\" y=\"8\"/>"
+ "<point x=\"7\" y=\"8\"/>"
+ "<point x=\"7\" y=\"1\"/>"
+ "<point x=\"4\" y=\"1\"/>"
+ "<point x=\"4\" y=\"6\"/>"
+ "<point x=\"3\" y=\"6\"/>"
+ "<point x=\"3\" y=\"4\"/>"
"</section></test>\n";
const char *teststar_init =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<test>"
- "<star y=\"118\" x=\"109\" r=\"21\">"
- "<point y=\"20\" x=\"10\"/>"
- "<point y=\"10\" x=\"20\"/>"
- "<point y=\"4\" x=\"0\"/>"
+ "<star r=\"21\" x=\"109\" y=\"118\">"
+ "<point x=\"10\" y=\"20\"/>"
+ "<point x=\"20\" y=\"10\"/>"
+ "<point x=\"0\" y=\"4\"/>"
"</star></test>\n";
const char *teststar_init2 =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<test>"
- "<star y=\"118\" x=\"109\" r=\"21\">"
- " <point y=\"20\" x=\"10\"/>"
- " <point y=\"10\" x=\"20\"/>"
- " <point y=\"4\" x=\"0\"/>"
+ "<star r=\"21\" x=\"109\" y=\"118\">"
+ " <point x=\"10\" y=\"20\"/>"
+ " <point x=\"20\" y=\"10\"/>"
+ " <point x=\"0\" y=\"4\"/>"
"</star></test>\n";
const char *testsection_init = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<test><section color=\"white\">"
- "<point y=\"20\" x=\"10\"/>"
- "<point y=\"10\" x=\"20\"/>"
- "<point y=\"4\" x=\"0\"/>"
+ "<point x=\"10\" y=\"20\"/>"
+ "<point x=\"20\" y=\"10\"/>"
+ "<point x=\"0\" y=\"4\"/>"
"</section></test>\n";
const char *testsection_init2 = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<test><section color=\"white\">"
- "<point y=\"20\" x=\"10\"/>"
- "<point y=\"10\" x=\"20\"/>"
- "<point y=\"4\" x=\"0\"/>"
+ "<point x=\"10\" y=\"20\"/>"
+ "<point x=\"20\" y=\"10\"/>"
+ "<point x=\"0\" y=\"4\"/>"
"some text"
"</section></test>\n";
@@ -670,37 +688,37 @@ const char *testsection_init2 = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<te
const char *testset_init = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<workset>"
"<description><RVpeak value=\"0\"/><LVpeak value=\"1\"/><PreferedRef value=\"1\"/></description>"
"<frame image=\"image.png\">"
- "<star y=\"118\" x=\"109\" r=\"21\">"
- "<point y=\"20\" x=\"10\"/>"
- "<point y=\"10\" x=\"20\"/>"
- "<point y=\"4\" x=\"0\"/>"
+ "<star r=\"21\" x=\"109\" y=\"118\">"
+ "<point x=\"10\" y=\"20\"/>"
+ "<point x=\"20\" y=\"10\"/>"
+ "<point x=\"0\" y=\"4\"/>"
"</star>"
"<section color=\"white\">"
- "<point y=\"20\" x=\"10\"/>"
- "<point y=\"10\" x=\"20\"/>"
- "<point y=\"4\" x=\"0\"/>"
+ "<point x=\"10\" y=\"20\"/>"
+ "<point x=\"20\" y=\"10\"/>"
+ "<point x=\"0\" y=\"4\"/>"
"</section>"
"<section color=\"red\">"
- "<point y=\"21\" x=\"11\"/>"
- "<point y=\"11\" x=\"21\"/>"
- "<point y=\"5\" x=\"1\"/>"
+ "<point x=\"11\" y=\"21\"/>"
+ "<point x=\"21\" y=\"11\"/>"
+ "<point x=\"1\" y=\"5\"/>"
"</section>"
"</frame>"
"<frame image=\"image2.png\">"
- "<star y=\"118\" x=\"109\" r=\"22\">"
- "<point y=\"20\" x=\"10\"/>"
- "<point y=\"10\" x=\"20\"/>"
- "<point y=\"4\" x=\"0\"/>"
+ "<star r=\"22\" x=\"109\" y=\"118\">"
+ "<point x=\"10\" y=\"20\"/>"
+ "<point x=\"20\" y=\"10\"/>"
+ "<point x=\"0\" y=\"4\"/>"
"</star>"
"<section color=\"white\">"
- "<point y=\"20\" x=\"10\"/>"
- "<point y=\"10\" x=\"20\"/>"
- "<point y=\"4\" x=\"0\"/>"
+ "<point x=\"10\" y=\"20\"/>"
+ "<point x=\"20\" y=\"10\"/>"
+ "<point x=\"0\" y=\"4\"/>"
"</section>"
"<section color=\"red\">"
- "<point y=\"21\" x=\"11\"/>"
- "<point y=\"11\" x=\"21\"/>"
- "<point y=\"5\" x=\"1\"/>"
+ "<point x=\"11\" y=\"21\"/>"
+ "<point x=\"21\" y=\"11\"/>"
+ "<point x=\"1\" y=\"5\"/>"
"</section>"
"</frame>"
"</workset>\n";
@@ -708,17 +726,17 @@ const char *testset_init = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<workset
const char *testset_init2 = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<workset>"
"<description><RVpeak value=\"-1\"/><LVpeak value=\"-1\"/><PreferedRef value=\"-1\"/></description>"
"<frame image=\"image.png\">"
- "<star y=\"118\" x=\"109\" r=\"21\">"
- "<point y=\"20\" x=\"10\"/>"
- "<point y=\"10\" x=\"20\"/>"
- "<point y=\"4\" x=\"0\"/>"
+ "<star r=\"21\" x=\"109\" y=\"118\">"
+ "<point x=\"10\" y=\"20\"/>"
+ "<point x=\"20\" y=\"10\"/>"
+ "<point x=\"0\" y=\"4\"/>"
"</star>"
"</frame>"
"<frame image=\"image2.png\">"
- "<star y=\"118\" x=\"109\" r=\"22\">"
- "<point y=\"20\" x=\"10\"/>"
- "<point y=\"10\" x=\"20\"/>"
- "<point y=\"4\" x=\"1\"/>"
+ "<star r=\"22\" x=\"109\" y=\"118\">"
+ "<point x=\"10\" y=\"20\"/>"
+ "<point x=\"20\" y=\"10\"/>"
+ "<point x=\"1\" y=\"4\"/>"
"</star>"
"</frame>"
"</workset>\n";
@@ -726,17 +744,17 @@ const char *testset_init2 = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<workse
const char *testset_init3 = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<workset>"
"<description><RVpeak value=\"-1\"/><LVpeak value=\"-1\"/><PreferedRef value=\"-1\"/></description>"
" <frame image=\"image.png\">"
- " <star y=\"118\" x=\"109\" r=\"21\">"
- " <point y=\"20\" x=\"10\"/>"
- " <point y=\"10\" x=\"20\"/>"
- " <point y=\"4\" x=\"0\"/>"
+ " <star r=\"21\" x=\"109\" y=\"118\">"
+ " <point x=\"10\" y=\"20\"/>"
+ " <point x=\"20\" y=\"10\"/>"
+ " <point x=\"0\" y=\"4\"/>"
" </star>"
" </frame>"
" <frame image=\"image2.png\">"
- " <star y=\"118\" x=\"109\" r=\"22\">"
- " <point y=\"20\" x=\"10\"/>"
- " <point y=\"10\" x=\"20\"/>"
- " <point y=\"4\" x=\"0\"/>"
+ " <star r=\"22\" x=\"109\" y=\"118\">"
+ " <point x=\"10\" y=\"20\"/>"
+ " <point x=\"20\" y=\"10\"/>"
+ " <point x=\"0\" y=\"4\"/>"
" </star>"
" </frame>"
"</workset>\n";
@@ -749,32 +767,32 @@ const char *testset_bboxtest =
"<PreferedRef value=\"1\"/>"
"</description>"
"<frame image=\"data0000.png\">"
- "<star y=\"118\" x=\"109\" r=\"21\">"
- "<point y=\"20\" x=\"10\"/>"
- "<point y=\"10\" x=\"20\"/>"
- "<point y=\"4\" x=\"0\"/>"
+ "<star r=\"21\" x=\"109\" y=\"118\">"
+ "<point x=\"10\" y=\"20\"/>"
+ "<point x=\"20\" y=\"10\"/>"
+ "<point x=\"0\" y=\"4\"/>"
"</star>"
"<section color=\"white\">"
- "<point y=\"106.24\" x=\"91.520000\"/>"
- "<point y=\"97.6\" x=\"102.080000\"/>"
- "<point y=\"101.44\" x=\"111.360000\"/>"
- "<point y=\"106.56\" x=\"100.480000\"/>"
- "<point y=\"109.44\" x=\"94.400000\"/>"
+ "<point x=\"91.520000\" y=\"106.24\"/>"
+ "<point x=\"102.080000\" y=\"97.6\"/>"
+ "<point x=\"111.360000\" y=\"101.44\"/>"
+ "<point x=\"100.480000\" y=\"106.56\"/>"
+ "<point x=\"94.400000\" y=\"109.44\"/>"
"</section>"
"<section color=\"cyan\">"
- "<point y=\"109.44\" x=\"96.32\"/>"
- "<point y=\"124.16\" x=\"96.64\"/>"
- "<point y=\"115.52\" x=\"85.76\"/>"
- "<point y=\"105.28\" x=\"92.16\"/>"
+ "<point x=\"96.32\" y=\"109.44\"/>"
+ "<point x=\"96.64\" y=\"124.16\"/>"
+ "<point x=\"85.76\" y=\"115.52\"/>"
+ "<point x=\"92.16\" y=\"105.28\"/>"
"</section>"
"</frame>"
"<frame image=\"data0001.png\">"
"<section color=\"white\">"
- "<point y=\"102.4\" x=\"90.88\"/>"
- "<point y=\"97.60\" x=\"95.04\"/>"
- "<point y=\"94.72\" x=\"115.52\"/>"
- "<point y=\"101.44\" x=\"101.44\"/>"
- "<point y=\"104.96\" x=\"94.08\"/>"
+ "<point x=\"90.88\" y=\"102.4\"/>"
+ "<point x=\"95.04\" y=\"97.60\"/>"
+ "<point x=\"115.52\" y=\"94.72\"/>"
+ "<point x=\"101.44\" y=\"101.44\"/>"
+ "<point x=\"94.08\" y=\"104.96\"/>"
"</section>"
"</frame></workset>";
@@ -784,32 +802,32 @@ const char *testset_shift_and_rename =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<workset>"
"<description><RVpeak value=\"2\"/><LVpeak value=\"3\"/><PreferedRef value=\"1\"/></description>"
"<frame image=\"moved0000.png\">"
- "<star y=\"128\" x=\"112\" r=\"21\">"
- "<point y=\"20\" x=\"10\"/>"
- "<point y=\"10\" x=\"20\"/>"
- "<point y=\"4\" x=\"0\"/>"
+ "<star r=\"21\" x=\"112\" y=\"128\">"
+ "<point x=\"10\" y=\"20\"/>"
+ "<point x=\"20\" y=\"10\"/>"
+ "<point x=\"0\" y=\"4\"/>"
"</star>"
"<section color=\"white\">"
- "<point y=\"116.24\" x=\"94.52\"/>"
- "<point y=\"107.6\" x=\"105.08\"/>"
- "<point y=\"111.44\" x=\"114.36\"/>"
- "<point y=\"116.56\" x=\"103.48\"/>"
- "<point y=\"119.44\" x=\"97.4\"/>"
+ "<point x=\"94.52\" y=\"116.24\"/>"
+ "<point x=\"105.08\" y=\"107.6\"/>"
+ "<point x=\"114.36\" y=\"111.44\"/>"
+ "<point x=\"103.48\" y=\"116.56\"/>"
+ "<point x=\"97.4\" y=\"119.44\"/>"
"</section>"
"<section color=\"cyan\">"
- "<point y=\"119.44\" x=\"99.32\"/>"
- "<point y=\"134.16\" x=\"99.64\"/>"
- "<point y=\"125.52\" x=\"88.76\"/>"
- "<point y=\"115.28\" x=\"95.16\"/>"
+ "<point x=\"99.32\" y=\"119.44\"/>"
+ "<point x=\"99.64\" y=\"134.16\"/>"
+ "<point x=\"88.76\" y=\"125.52\"/>"
+ "<point x=\"95.16\" y=\"115.28\"/>"
"</section>"
"</frame>"
"<frame image=\"moved0001.png\">"
"<section color=\"white\">"
- "<point y=\"112.4\" x=\"93.88\"/>"
- "<point y=\"107.6\" x=\"98.04\"/>"
- "<point y=\"104.72\" x=\"118.52\"/>"
- "<point y=\"111.44\" x=\"104.44\"/>"
- "<point y=\"114.96\" x=\"97.08\"/>"
+ "<point x=\"93.88\" y=\"112.4\"/>"
+ "<point x=\"98.04\" y=\"107.6\"/>"
+ "<point x=\"118.52\" y=\"104.72\"/>"
+ "<point x=\"104.44\" y=\"111.44\"/>"
+ "<point x=\"97.08\" y=\"114.96\"/>"
"</section>"
"</frame></workset>\n";
@@ -817,21 +835,21 @@ const char *testset_shift_and_rename =
const char *testset_version_2 =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<workset version=\"2\">"
"<description><RVpeak value=\"1\"/><LVpeak value=\"2\"/><PreferedRef value=\"0\"/></description>"
- "<frame image=\"moved0000.png\" quality=\"4\" brightness=\"0.625\" contrast=\"1.5\">"
- "<star y=\"128\" x=\"112\" r=\"21\">"
- "<point y=\"20\" x=\"10\"/>"
- "<point y=\"10\" x=\"20\"/>"
- "<point y=\"4\" x=\"0\"/>"
+ "<frame brightness=\"0.625\" contrast=\"1.5\" image=\"moved0000.png\" quality=\"4\">"
+ "<star r=\"21\" x=\"112\" y=\"128\">"
+ "<point x=\"10\" y=\"20\"/>"
+ "<point x=\"20\" y=\"10\"/>"
+ "<point x=\"0\" y=\"4\"/>"
"</star>"
"<section color=\"white\" open=\"true\">"
- "<point y=\"1.1\" x=\"2.1\"/>"
- "<point y=\"2.1\" x=\"3.1\"/>"
- "<point y=\"3.1\" x=\"4.1\"/>"
+ "<point x=\"2.1\" y=\"1.1\"/>"
+ "<point x=\"3.1\" y=\"2.1\"/>"
+ "<point x=\"4.1\" y=\"3.1\"/>"
"</section>"
"<section color=\"green\" open=\"false\">"
- "<point y=\"1.2\" x=\"2.25\"/>"
- "<point y=\"2.2\" x=\"3.25\"/>"
- "<point y=\"3.2\" x=\"4.25\"/>"
+ "<point x=\"2.25\" y=\"1.2\"/>"
+ "<point x=\"3.25\" y=\"2.2\"/>"
+ "<point x=\"4.25\" y=\"3.2\"/>"
"</section>"
"</frame></workset>\n";
diff --git a/mia/2d/test_segpoint.cc b/mia/2d/test_segpoint.cc
index 6c64423..38132d5 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 2d6ac9d..d7c0b5b 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 e146021..1c74224 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 d8be825..26b5196 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 b2e3abe..e5768a0 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -237,8 +237,8 @@ C2DSplineTransformPenalty *C2DSplinePenaltyMock::do_clone() const
return result;
}
-BOOST_AUTO_TEST_CASE(test_available_plugins)
+BOOST_AUTO_TEST_CASE(test_available_plugins_spline_penalty)
{
std::set<std::string> test_data = {"divcurl"};
- test_availabe_plugins(C2DSplineTransformPenaltyPluginHandler::instance(), test_data);
+ test_available_plugins(C2DSplineTransformPenaltyPluginHandler::instance(), test_data);
}
diff --git a/mia/2d/test_trackpoint.cc b/mia/2d/test_trackpoint.cc
index 4a20505..1228138 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 d49e7fa..23cfca0 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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_transformfactory.cc b/mia/2d/test_transformfactory.cc
index 82c4b8a..6beaa08 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 d852eaa..e00b764 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 8ccfd7e..102737e 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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.cc
similarity index 51%
copy from mia/2d/test_vectorfield_interpolator.cc
copy to mia/2d/test_vectorfield.cc
index 378879c..ef18dbc 100644
--- a/mia/2d/test_vectorfield_interpolator.cc
+++ b/mia/2d/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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,9 +23,60 @@
#include <mia/core/spacial_kernel.hh>
#include <mia/2d/interpolator.hh>
+#include <mia/2d/vectorfield.hh>
+using namespace mia;
+
+BOOST_AUTO_TEST_CASE (test_vectorfield_as_inverse_of)
+{
+ C2DBounds size(10,10);
+
+ C2DFVectorfield other(size);
+
+ for (auto io = other.begin_range(C2DBounds::_0, size);
+ io != other.end_range(C2DBounds::_0, size); ++io) {
+ *io = C2DFVector(sin(io.pos().x * M_PI / 9), sin(io.pos().y * M_PI / 18));
+ }
+
+ C2DFVectorfield me(size);
+ me.update_as_inverse_of(other, 1e-14f, 50);
+
+ C2DInterpolatorFactory ipf(produce_spline_kernel("bspline:d=1"),
+ *produce_spline_boundary_condition("zero"),
+ *produce_spline_boundary_condition("zero"));
+
+
+ std::unique_ptr<T2DInterpolator<C2DFVector> > interp_me(ipf.create(me));
+ std::unique_ptr<T2DInterpolator<C2DFVector> > interp_other(ipf.create(other));
+
+ for(unsigned y = 0; y < 10; ++y)
+ for(unsigned x = 0; x < 10; ++x) {
+
+ C2DFVector pos(x,y);
+ C2DFVector pos_t = pos - (*interp_me)(pos);
+ C2DFVector pos_tt = pos_t - (*interp_other)(pos_t) - pos;
+
+ cvdebug() << pos << ": delta = " << pos_tt << "\n";
+
+ BOOST_CHECK_SMALL(pos_tt.x, 1e-5f);
+ BOOST_CHECK_SMALL(pos_tt.y, 1e-5f);
+
+
+ // test also the inverse, but with a higher tolerance,
+ // since this was not optimized
+ C2DFVector pos_it = pos - (*interp_other)(pos);
+ C2DFVector pos_inv = (*interp_me)(pos_it);
+ C2DFVector pos_itt = pos_it - pos_inv - pos;
+ cvdebug() << pos << ": pos-other = "<< pos_it
+ << ", intp = " << pos_inv
+ << ", inv delta = " << pos_itt << "\n";
+
+ BOOST_CHECK_SMALL(pos_itt.x, 0.05f);
+ BOOST_CHECK_SMALL(pos_itt.y, 0.05f);
+
+ }
+}
-NS_MIA_USE
using namespace std;
using namespace boost::unit_test;
@@ -39,7 +90,7 @@ struct FieldSplineFixture {
*produce_spline_boundary_condition("mirror"),
*produce_spline_boundary_condition("mirror"))
{
- C2DFVectorfield::iterator i = field.begin();
+ auto i = field.begin();
for (size_t y = 0; y < size.y; ++y)
for (size_t x = 0; x < size.x; ++x, ++i) {
*i = C2DFVector( fx(x, y), fy(x, y));
@@ -61,7 +112,7 @@ float FieldSplineFixture::fx(float x, float y)
{
x /= 25.0;
y /= 50.0;
- return (x + 1) / (x + y * x + 2);
+ return (x + 1.0) / (x + y * x + 2.0);
}
float FieldSplineFixture::fy(float x, float y)
@@ -71,6 +122,17 @@ float FieldSplineFixture::fy(float x, float y)
return (y + 1) / (x * x + y + 10);
}
+BOOST_FIXTURE_TEST_CASE( test_vector_trilininterp , FieldSplineFixture )
+{
+ C2DFVector iploc(20.4, 17.3);
+ auto ip = field.get_interpol_val_at(iploc);
+
+ BOOST_CHECK_CLOSE(ip.x, fx(iploc.x, iploc.y), 0.005);
+ BOOST_CHECK_CLOSE(ip.y, fy(iploc.x, iploc.y), 0.005);
+
+}
+
+
BOOST_FIXTURE_TEST_CASE( test_vector_field2d_splines, FieldSplineFixture )
{
std::shared_ptr<T2DInterpolator<C2DFVector> > source(ipf.create(field));
@@ -115,4 +177,3 @@ BOOST_AUTO_TEST_CASE( test_vf_cat )
}
-
diff --git a/mia/2d/test_vectorfield_interpolator.cc b/mia/2d/test_vectorfield_interpolator.cc
index 378879c..c487b45 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,7 +39,7 @@ struct FieldSplineFixture {
*produce_spline_boundary_condition("mirror"),
*produce_spline_boundary_condition("mirror"))
{
- C2DFVectorfield::iterator i = field.begin();
+ auto i = field.begin();
for (size_t y = 0; y < size.y; ++y)
for (size_t x = 0; x < size.x; ++x, ++i) {
*i = C2DFVector( fx(x, y), fy(x, y));
@@ -61,7 +61,7 @@ float FieldSplineFixture::fx(float x, float y)
{
x /= 25.0;
y /= 50.0;
- return (x + 1) / (x + y * x + 2);
+ return (x + 1.0) / (x + y * x + 2.0);
}
float FieldSplineFixture::fy(float x, float y)
@@ -71,6 +71,17 @@ float FieldSplineFixture::fy(float x, float y)
return (y + 1) / (x * x + y + 10);
}
+BOOST_FIXTURE_TEST_CASE( test_vector_trilininterp , FieldSplineFixture )
+{
+ C2DFVector iploc(20.4, 17.3);
+ auto ip = field.get_interpol_val_at(iploc);
+
+ BOOST_CHECK_CLOSE(ip.x, fx(iploc.x, iploc.y), 0.005);
+ BOOST_CHECK_CLOSE(ip.y, fy(iploc.x, iploc.y), 0.005);
+
+}
+
+
BOOST_FIXTURE_TEST_CASE( test_vector_field2d_splines, FieldSplineFixture )
{
std::shared_ptr<T2DInterpolator<C2DFVector> > source(ipf.create(field));
diff --git a/mia/2d/test_vfio.cc b/mia/2d/test_vfio.cc
index ea2027a..e4698f1 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 bb4774e..be36beb 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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.hh b/mia/2d/timestep.hh
index dd2b0e5..8b99af3 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 0124a8f..48b968a 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 78dadd5..c2b01f4 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 caf7b2c..747db64 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 9615275..5f2333c 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 fe80e81..915761a 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 b133487..eb9494d 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 2b9c855..f1e2a7b 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 fae6d4f..3b661e3 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-2016 Gert Wollny, David Pastor
+ * Copyright (c) Leipzig, Madrid 1999-2017 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 9e302a0..97aa331 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 f01f035..ae68fc9 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 988a7c1..1e0cf97 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -338,8 +338,14 @@ public:
\returns the displacement at coordinate x
\remark rename the function to something that explains better whats going on
*/
- virtual C2DFVector apply(const C2DFVector& x) const = 0;
+ virtual C2DFVector apply(const C2DFVector& x) const __attribute__((deprecated)){
+ return get_displacement_at(x);
+ }
+ /**
+ \returns the displacement at coordinate x
+ */
+ virtual C2DFVector get_displacement_at(const C2DFVector& x) const =0;
/**
apply the actual transformation to point x
\returns transformed point
diff --git a/mia/2d/transform/affine.cc b/mia/2d/transform/affine.cc
index af3e0ea..3d74699 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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_MIA_BEGIN
using namespace std;
-C2DFVector C2DAffineTransformation::apply(const C2DFVector& x) const
+C2DFVector C2DAffineTransformation::get_displacement_at(const C2DFVector& x) const
{
- return transform(x);
+ return x - transform(x);
}
@@ -203,10 +203,10 @@ void C2DAffineTransformation::set_identity()
float C2DAffineTransformation::get_max_transform() const
{
// check the corners
- float m = (apply(C2DFVector(get_size())) - C2DFVector(get_size())).norm2();
- float test0Y = (apply(C2DFVector(0, get_size().y)) - C2DFVector(0, get_size().y)).norm2();
- float testX0 = (apply(C2DFVector(get_size().x, 0)) - C2DFVector(get_size().x, 0)).norm2();
- float test00 = (apply(C2DFVector(0, 0)) - C2DFVector(0, 0)).norm2();
+ float m = (transform(C2DFVector(get_size())) - C2DFVector(get_size())).norm2();
+ float test0Y = (transform(C2DFVector(0, get_size().y)) - C2DFVector(0, get_size().y)).norm2();
+ float testX0 = (transform(C2DFVector(get_size().x, 0)) - C2DFVector(get_size().x, 0)).norm2();
+ float test00 = (transform(C2DFVector(0, 0)) - C2DFVector(0, 0)).norm2();
if (m < test0Y)
m = test0Y;
@@ -221,7 +221,7 @@ float C2DAffineTransformation::get_max_transform() const
C2DFVector C2DAffineTransformation::operator () (const C2DFVector& x) const
{
- return apply(x);
+ return transform(x);
}
float C2DAffineTransformation::get_jacobian(const C2DFVectorfield& /*v*/, float /*delta*/) const
@@ -256,9 +256,9 @@ C2DAffineTransformation::iterator_impl::iterator_impl(const C2DBounds& pos, cons
const C2DAffineTransformation& trans):
C2DTransformation::iterator_impl(pos, size),
m_trans(trans),
- m_value(trans.apply(C2DFVector(pos)))
+ m_value(trans.transform(C2DFVector(pos)))
{
- m_dx = m_trans.apply(C2DFVector(pos.x + 1.0, pos.y)) - m_value;
+ m_dx = m_trans.transform(C2DFVector(pos.x + 1.0, pos.y)) - m_value;
}
C2DTransformation::iterator_impl * C2DAffineTransformation::iterator_impl::clone() const
@@ -278,8 +278,8 @@ void C2DAffineTransformation::iterator_impl::do_x_increment()
void C2DAffineTransformation::iterator_impl::do_y_increment()
{
- m_value = m_trans.apply(C2DFVector(get_pos()));
- m_dx = m_trans.apply(C2DFVector(get_pos().x + 1.0, get_pos().y)) - m_value;
+ m_value = m_trans.transform(C2DFVector(get_pos()));
+ m_dx = m_trans.transform(C2DFVector(get_pos().x + 1.0, get_pos().y)) - m_value;
}
diff --git a/mia/2d/transform/affine.hh b/mia/2d/transform/affine.hh
index 0ae2b1c..36831dc 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -50,7 +50,7 @@ public:
void rotate(float angle);
void shear(float v);
- C2DFVector apply(const C2DFVector& x) const;
+ C2DFVector transform(const C2DFVector& x) const;
class EXPORT_2D iterator_impl: public C2DTransformation::iterator_impl {
public:
@@ -86,7 +86,7 @@ public:
virtual float pertuberate(C2DFVectorfield& v) const;
virtual C2DFVector operator () (const C2DFVector& x) const;
virtual float get_jacobian(const C2DFVectorfield& v, float delta) const;
- C2DFVector transform(const C2DFVector& x)const;
+ C2DFVector get_displacement_at(const C2DFVector& x)const;
private:
virtual C2DTransformation *do_clone() const;
void evaluate_t() const;
diff --git a/mia/2d/transform/rigid.cc b/mia/2d/transform/rigid.cc
index 5064173..0df5d44 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -74,9 +74,9 @@ void C2DRigidTransformation::initialize()
}
-C2DFVector C2DRigidTransformation::apply(const C2DFVector& x) const
+C2DFVector C2DRigidTransformation::get_displacement_at(const C2DFVector& x) const
{
- return transform(x);
+ return x - transform(x);
}
@@ -221,10 +221,10 @@ void C2DRigidTransformation::evaluate_matrix() const
float C2DRigidTransformation::get_max_transform() const
{
// check the corners
- float m = (C2DFVector(get_size() - C2DBounds::_1) - apply(C2DFVector(get_size() - C2DBounds::_1))).norm2();
- float test0Y = (C2DFVector(0, get_size().y - 1) - apply(C2DFVector(0, get_size().y - 1))).norm2();
- float testX0 = (C2DFVector(get_size().x - 1, 0) - apply(C2DFVector(get_size().x - 1, 0))).norm2();
- float test00 = apply(C2DFVector(0, 0)).norm2();
+ float m = (C2DFVector(get_size() - C2DBounds::_1) - transform(C2DFVector(get_size() - C2DBounds::_1))).norm2();
+ float test0Y = (C2DFVector(0, get_size().y - 1) - transform(C2DFVector(0, get_size().y - 1))).norm2();
+ float testX0 = (C2DFVector(get_size().x - 1, 0) - transform(C2DFVector(get_size().x - 1, 0))).norm2();
+ float test00 = transform(C2DFVector(0, 0)).norm2();
if (m < test0Y)
m = test0Y;
@@ -240,7 +240,7 @@ float C2DRigidTransformation::get_max_transform() const
C2DFVector C2DRigidTransformation::operator () (const C2DFVector& x) const
{
- return apply(x);
+ return transform(x);
}
float C2DRigidTransformation::get_jacobian(const C2DFVectorfield& /*v*/, float /*delta*/) const
diff --git a/mia/2d/transform/rigid.hh b/mia/2d/transform/rigid.hh
index 6de9f20..179ee56 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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 @@ public:
void translate(float x, float y);
void rotate(float angle);
- C2DFVector apply(const C2DFVector& x) const;
+ C2DFVector get_displacement_at(const C2DFVector& x) const;
class EXPORT_2D iterator_impl: public C2DTransformation::iterator_impl {
diff --git a/mia/2d/transform/rotation.cc b/mia/2d/transform/rotation.cc
index 29d4fce..07d9658 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -68,9 +68,9 @@ void C2DRotationTransformation::initialize()
m_rot_center = C2DFVector(m_size -C2DBounds::_1) * m_relative_rot_center;
}
-C2DFVector C2DRotationTransformation::apply(const C2DFVector& x) const
+C2DFVector C2DRotationTransformation::get_displacement_at(const C2DFVector& x) const
{
- return transform(x);
+ return x - transform(x);
}
@@ -189,10 +189,10 @@ void C2DRotationTransformation::evaluate_matrix() const
float C2DRotationTransformation::get_max_transform() const
{
// check the corners
- float m = (C2DFVector(get_size() - C2DBounds::_1) - apply(C2DFVector(get_size() - C2DBounds::_1))).norm2();
- float test0Y = (C2DFVector(0, get_size().y - 1) - apply(C2DFVector(0, get_size().y - 1))).norm2();
- float testX0 = (C2DFVector(get_size().x - 1, 0) - apply(C2DFVector(get_size().x - 1, 0))).norm2();
- float test00 = apply(C2DFVector(0, 0)).norm2();
+ float m = (C2DFVector(get_size() - C2DBounds::_1) - transform(C2DFVector(get_size() - C2DBounds::_1))).norm2();
+ float test0Y = (C2DFVector(0, get_size().y - 1) - transform(C2DFVector(0, get_size().y - 1))).norm2();
+ float testX0 = (C2DFVector(get_size().x - 1, 0) - transform(C2DFVector(get_size().x - 1, 0))).norm2();
+ float test00 = transform(C2DFVector(0, 0)).norm2();
if (m < test0Y)
m = test0Y;
@@ -208,7 +208,7 @@ float C2DRotationTransformation::get_max_transform() const
C2DFVector C2DRotationTransformation::operator () (const C2DFVector& x) const
{
- return apply(x);
+ return transform(x);
}
float C2DRotationTransformation::get_jacobian(const C2DFVectorfield& /*v*/, float /*delta*/) const
diff --git a/mia/2d/transform/rotation.hh b/mia/2d/transform/rotation.hh
index 2a45013..186e290 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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 @@ public:
void rotate(double angle);
- C2DFVector apply(const C2DFVector& x) const;
+ C2DFVector get_displacement_at(const C2DFVector& x) const;
class EXPORT_2D iterator_impl: public C2DTransformation::iterator_impl {
diff --git a/mia/2d/transform/spline.cc b/mia/2d/transform/spline.cc
index f48fa84..1f52782 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,7 +236,7 @@ C2DFVector C2DSplineTransformation::interpolate(const C2DFVector& x) const
return result;
}
-C2DFVector C2DSplineTransformation::apply(const C2DFVector& x) const
+C2DFVector C2DSplineTransformation::get_displacement_at(const C2DFVector& x) const
{
TRACE_FUNCTION;
assert(m_interpolator_valid);
@@ -277,7 +277,7 @@ C2DTransformation *C2DSplineTransformation::invert() const
C2DFVector C2DSplineTransformation::operator () (const C2DFVector& x) const
{
- return x - apply(x);
+ return x - get_displacement_at(x);
}
C2DFVector C2DSplineTransformation::scale( const C2DFVector& x) const
@@ -328,7 +328,7 @@ bool C2DSplineTransformation::refine()
// now interpolate the new coefficients
// \todo this should be done faster by a filter
reinit();
- T2DConvoluteInterpolator<C2DFVector> interp(m_coefficients, m_kernel);
+ T2DInterpolator<C2DFVector> interp(m_coefficients, m_kernel);
C2DFVectorfield coeffs(csize);
C2DFVector dx((float)(m_coefficients.get_size().x - 1 - m_enlarge.x) / (float)(csize.x - 1 - m_enlarge.x),
diff --git a/mia/2d/transform/spline.hh b/mia/2d/transform/spline.hh
index 91f1b48..216e819 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,7 @@ public:
void set_coefficients(const C2DFVectorfield& field);
void set_coefficients_and_prefilter(const C2DFVectorfield& field);
virtual void reinit();
- C2DFVector apply( const C2DFVector& x) const;
+ C2DFVector get_displacement_at( const C2DFVector& x) const;
C2DFVector scale( const C2DFVector& x) const;
virtual const C2DBounds& get_size() const;
diff --git a/mia/2d/transform/test_affine.cc b/mia/2d/transform/test_affine.cc
index e650719..ea2edf1 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 f75d7ba..387103e 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 f5a3287..078644e 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 c57f0ee..22a81d0 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 6b8564a..0a9d46f 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -168,7 +168,7 @@ BOOST_FIXTURE_TEST_CASE( test_splines_transformation, TransformSplineFixture )
BOOST_CHECK_EQUAL(stransf.degrees_of_freedom(), field.size() * 2);
C2DFVector testx(15, 20);
- C2DFVector result = stransf.apply(testx);
+ C2DFVector result = stransf.get_displacement_at(testx);
BOOST_CHECK_EQUAL(stransf.get_size(), range);
@@ -201,7 +201,7 @@ BOOST_FIXTURE_TEST_CASE( test_splines_transformation_upscale, TransformSplineFix
C2DFVector test2(15.4, 20.3);
- C2DFVector result2 = stransf_upscaled->apply(fscale * test2);
+ C2DFVector result2 = stransf_upscaled->get_displacement_at(fscale * test2);
BOOST_CHECK_CLOSE(result2.x, fscale.x * fx(test2.x, test2.y), 0.1);
BOOST_CHECK_CLOSE(result2.y, fscale.y * fy(test2.x, test2.y), 0.1);
@@ -353,7 +353,7 @@ BOOST_FIXTURE_TEST_CASE( test_splines_update, TransformSplineFixture )
stransf.update(2.0, update);
C2DFVector testx(20.4, 42.4);
- C2DFVector result = stransf.apply(testx);
+ C2DFVector result = stransf.get_displacement_at(testx);
BOOST_CHECK_CLOSE(result.x, fx(testx.x, testx.y) + 2.0f, 0.1);
BOOST_CHECK_CLOSE(result.y, fy(testx.x, testx.y) + 4.0f, 0.1);
@@ -414,7 +414,7 @@ BOOST_FIXTURE_TEST_CASE( test_splines_pertuberate, TransformSplineFixture )
fill(v.begin(), v.end(), vv);
- // this location is hand-picked and is not really the position ofthe maximun
+ // this location is hand-picked and is not really the position of the maximun
// but only an approximation
float gamma = stransf.pertuberate(v);
C2DFVector lmg(12* scalex, 27 * scaley);
diff --git a/mia/2d/transform/test_translate.cc b/mia/2d/transform/test_translate.cc
index 6a54cfe..e64070f 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 d90b8f8..a560f28 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA 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 @@ BOOST_FIXTURE_TEST_CASE(test_gridtransform_basic_props, GridTransformFixture)
BOOST_CHECK_EQUAL(field.degrees_of_freedom(), size.x * size.y * 2);
C2DFVector testx(20.2, 21.9);
- C2DFVector result = field.apply(testx);
+ C2DFVector result = field.get_displacement_at(testx);
BOOST_CHECK_CLOSE(result.x, fx(testx.x, testx.y), 1);
BOOST_CHECK_CLOSE(result.y, fy(testx.x, testx.y), 1);
@@ -191,9 +191,9 @@ BOOST_AUTO_TEST_CASE( test_gridtransform_add )
C2DGridTransformation c = a + b;
- BOOST_CHECK_EQUAL( c.apply(C2DFVector(1,1)), C2DFVector(3,4));
- BOOST_CHECK_EQUAL( c.apply(C2DFVector(2,1)), C2DFVector(0.0,-0.5));
- BOOST_CHECK_EQUAL( c.apply(C2DFVector(1,2)), C2DFVector(-0.5,0.0));
+ BOOST_CHECK_EQUAL( c.get_displacement_at(C2DFVector(1,1)), C2DFVector(3,4));
+ BOOST_CHECK_EQUAL( c.get_displacement_at(C2DFVector(2,1)), C2DFVector(0.0,-0.5));
+ BOOST_CHECK_EQUAL( c.get_displacement_at(C2DFVector(1,2)), C2DFVector(-0.5,0.0));
}
diff --git a/mia/2d/transform/translate.cc b/mia/2d/transform/translate.cc
index 2d3332d..a23b3c7 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,9 +46,9 @@ void C2DTranslateTransformation::translate(float x, float y)
m_transform.y += y;
}
-C2DFVector C2DTranslateTransformation::apply(const C2DFVector& x) const
+C2DFVector C2DTranslateTransformation::get_displacement_at(const C2DFVector& x) const
{
- return transform(x);
+ return x - transform(x);
}
diff --git a/mia/2d/transform/translate.hh b/mia/2d/transform/translate.hh
index 49e8e7c..d9d7d1c 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,7 +37,7 @@ public:
void translate(float x, float y);
- C2DFVector apply(const C2DFVector& x) const;
+ C2DFVector get_displacement_at(const C2DFVector& x) const;
class EXPORT_2D iterator_impl: public C2DTransformation::iterator_impl {
diff --git a/mia/2d/transform/vectorfield.cc b/mia/2d/transform/vectorfield.cc
index f44e314..896777d 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -240,7 +240,7 @@ void C2DGridTransformation::iterator_impl::do_y_increment()
C2DFVector C2DGridTransformation::operator ()(const C2DFVector& x) const
{
- return x - apply(x);
+ return x - get_displacement_at(x);
}
C2DGridTransformation::const_iterator C2DGridTransformation::begin() const
@@ -340,7 +340,7 @@ EXPORT_2D C2DGridTransformation operator + (const C2DGridTransformation& a, cons
for (size_t y = 0; y < a.get_size().y; ++y) {
for (size_t x = 0; x < a.get_size().x; ++x, ++ri, ++bi) {
const C2DFVector xi = C2DFVector(x,y) - *bi;
- *ri = a.apply(xi) + *bi;
+ *ri = a.get_displacement_at(xi) + *bi;
}
}
return result;
diff --git a/mia/2d/transform/vectorfield.hh b/mia/2d/transform/vectorfield.hh
index ce292d2..96b57d0 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -43,7 +43,7 @@ public:
// operator C2DFVectorfield&();
- C2DFVector apply(const C2DFVector& x) const;
+ C2DFVector get_displacement_at(const C2DFVector& x) const;
// C2DFVectorfield& field() __attribute__((deprecated)) ;
// const C2DFVectorfield& field() const __attribute__((deprecated)) ;
@@ -104,7 +104,7 @@ private:
EXPORT_2D C2DGridTransformation operator + (const C2DGridTransformation& a, const C2DGridTransformation& b);
};
-inline C2DFVector C2DGridTransformation::apply(const C2DFVector& x) const
+inline C2DFVector C2DGridTransformation::get_displacement_at(const C2DFVector& x) const
{
return m_field.get_interpol_val_at(x);
}
diff --git a/mia/2d/transformfactory.cc b/mia/2d/transformfactory.cc
index 2a3f772..74e1599 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 aa130c1..170e7b9 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 bca4e52..ae0064c 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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.hh b/mia/2d/transformio.hh
index 59a14ef..99c53a1 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 2ea2343..3eaad75 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,7 @@ float C2DTransformMock::pertuberate(C2DFVectorfield&) const
return 1.1;
}
-C2DFVector C2DTransformMock::apply(const C2DFVector& x) const
+C2DFVector C2DTransformMock::get_displacement_at(const C2DFVector& x) const
{
if (x.x == 0.0 && x.y == 0.0)
return C2DFVector(-1.2, -2.3);
@@ -124,7 +124,7 @@ C2DFVector C2DTransformMock::apply(const C2DFVector& x) const
C2DFVector C2DTransformMock::operator () (const C2DFVector& x) const
{
- return x - apply(x);
+ return x - get_displacement_at(x);
}
float C2DTransformMock::get_jacobian(const C2DFVectorfield&, float delta) const
diff --git a/mia/2d/transformmock.hh b/mia/2d/transformmock.hh
index 7a236df..9f4e297 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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 @@ public:
virtual void set_parameters(const CDoubleVector& params);
virtual const C2DBounds& get_size() const;
virtual float pertuberate(C2DFVectorfield& v) const;
- virtual C2DFVector apply(const C2DFVector& x) const;
+ virtual C2DFVector get_displacement_at(const C2DFVector& x) const;
virtual C2DFVector operator () (const C2DFVector& x) const;
virtual float get_jacobian(const C2DFVectorfield& v, float delta) const;
virtual float divergence() const;
diff --git a/mia/2d/transio/bbs.cc b/mia/2d/transio/bbs.cc
index 518ebf0..f1e23d8 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 40fc862..1814a61 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 3a50b97..f67d20e 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 f7c3ddb..2d95c6c 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 21579b3..b67a251 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 6a24d84..35623a1 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,11 +33,28 @@
#include <mia/2d/datafield.cxx>
#include <mia/2d/iterator.cxx>
+#include <mia/2d/interpolator.hh>
+#include <mia/core/parallel.hh>
+#include <mia/core/threadedmsg.hh>
+#include <gsl/gsl_cblas.h>
+
+#include <cmath>
NS_MIA_BEGIN
-template class EXPORT_2D T2DDatafield<C2DFVector>;
-template class EXPORT_2D T2DDatafield<C2DDVector>;
+#ifdef __GNUC__
+#pragma GCC diagnostic push
+#ifndef __clang__
+#pragma GCC diagnostic ignored "-Wattributes"
+#endif
+#endif
+
+//template class EXPORT_2D T2DDatafield<C2DFVector>;
+//template class EXPORT_2D T2DDatafield<C2DDVector>;
+
+#ifdef __GNUC__
+#pragma GCC diagnostic pop
+#endif
template <typename T>
T2DVectorfield<T>::T2DVectorfield()
@@ -82,6 +99,25 @@ void T2DVectorfield<T>::set_pixel_size(const C2DFVector& pixel)
set_attribute("pixel", PAttribute(new TAttribute<C2DFVector>(pixel)));
}
+template <class T>
+T T2DVectorfield<T>::get_interpol_val_at(const C2DFVector& p) const
+{
+ size_t x = (size_t )floor(p.x);
+ size_t y = (size_t )floor(p.y);
+ float xp = p.x - x; float xm = 1.0 - xp;
+ float yp = p.y - y; float ym = 1.0 - yp;
+
+ const T& H00 = (*this)(x ,y );
+ const T& H01 = (*this)(x ,y+1);
+ const T& H10 = (*this)(x+1,y );
+ const T& H11 = (*this)(x+1,y+1);
+
+ return T(ym * ( xm * H00 + xp * H10) +
+ yp * ( xm * H01 + xp * H11));
+
+}
+
+
template <typename T>
const char *T2DVectorfield<T>::data_descr = "2dvf";
@@ -92,10 +128,22 @@ const char *T2DVectorfield<T>::data_descr = "2dvf";
template class EXPORT_2D range2d_iterator_with_boundary_flag<T2DDatafield<TYPE>::iterator>; \
template class EXPORT_2D range2d_iterator_with_boundary_flag<T2DDatafield<TYPE>::const_iterator>;
+#ifdef __GNUC__
+#pragma GCC diagnostic push
+#ifndef __clang__
+#pragma GCC diagnostic ignored "-Wattributes"
+#endif
+#endif
+
INSTANCIATE(C2DFVector);
INSTANCIATE(C2DDVector);
+
+#ifdef __GNUC__
+#pragma GCC diagnostic pop
+#endif
+
/**
*/
@@ -120,6 +168,54 @@ EXPORT_2D C2DFVectorfield& operator += (C2DFVectorfield& a, const C2DFVectorfiel
+void C2DFVectorfield::update_as_inverse_of(const C2DFVectorfield& other, float tol, int maxiter)
+{
+ assert(get_size() == other.get_size());
+
+ float tol2 = tol * tol;
+
+ C2DInterpolatorFactory ipf(produce_spline_kernel("bspline:d=1"),
+ *produce_spline_boundary_condition("zero"),
+ *produce_spline_boundary_condition("zero"));
+
+ std::unique_ptr<T2DInterpolator<C2DFVector> > source(ipf.create(other));
+ const T2DInterpolator<C2DFVector>& t = *source;
+
+ C1DParallelRange range(0, get_size().y, 1);
+
+ auto callback = [this, &t, tol2, maxiter](const C1DParallelRange& range) {
+ CThreadMsgStream msg;
+ auto weight_cache = t.create_cache();
+ for (auto y = range.begin(); y != range.end(); ++y) {
+ auto i = begin_at(0,y);
+ for (size_t x = 0; x < get_size().x; ++x, ++i) {
+ int iter = 0;
+ C2DFVector pos(x,y);
+ float dnorm = 0.0;
+ while (iter++ < maxiter) {
+ C2DFVector r = pos - *i;
+ C2DFVector ov = t(r, weight_cache);
+ C2DFVector i_delta = r - ov - pos;
+ dnorm = i_delta.norm2();
+
+ if ( dnorm < tol2) {
+ break;
+ }
+ *i += 0.5 * i_delta;
+ cvdebug() << "[" << iter << "]=" << dnorm << "\n";
+ }
+ }
+ }
+ };
+
+ pfor( range, callback );
+}
+
+void C2DFVectorfield::update_by_velocity(const C2DFVectorfield& velocity_field, float time_step)
+{
+ // hoping that the cblas implementation takes care of threading
+ cblas_saxpy(velocity_field.size() * 2, time_step, &velocity_field[0].x, 1, &(*this)[0].x, 1);
+}
diff --git a/mia/2d/vectorfield.hh b/mia/2d/vectorfield.hh
index 47f4570..99b170b 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,6 +26,7 @@
NS_MIA_BEGIN
+
/**
\ingroup basic
\brief 2D Vector field
@@ -57,10 +58,51 @@ public:
void set_pixel_size(const C2DFVector& pixel);
+ /// This function should really go away
+ T get_interpol_val_at(const C2DFVector& p) const;
+
+
+};
+
+/// @cond never
+
+extern template class EXPORT_2D T2DVectorfield<C2DFVector>;
+extern template class EXPORT_2D T2DVectorfield<C2DDVector>;
+
+/// @endcond never
+
+/**
+ @ingroup basic
+ @brief a 2D field of floating point single accuracy 2D vectors
+*/
+class EXPORT_2D C2DFVectorfield : public T2DVectorfield<C2DFVector> {
+public:
+
+ using T2DVectorfield<C2DFVector>::T2DVectorfield;
+
+ /**
+ \brief evaluate this vector field as the inverse of another
+
+ This functions corrects the vector field to describe the inverse transformation
+ of a given input vector field
+
+ \param other the vector field this one should be inverse of
+ \param tol tolerance for inverse accuracy
+ \param maxiter maximum number of interations for one vector to be optimized
+ */
+ void update_as_inverse_of(const C2DFVectorfield& other, float tol, int maxiter);
+
+ /**
+ Update this vector field by using a velocity field
+ \param velocity_field the velocity field
+ \param time_step the time step to be used for the update
+ */
+ void update_by_velocity(const C2DFVectorfield& velocity_field, float time_step);
+
};
-/// 2D vector field to store single precicion 2D vectors
-typedef T2DVectorfield<C2DFVector> C2DFVectorfield;
+
+typedef std::shared_ptr<C2DFVectorfield > P2DFVectorfield;
/// 2D vector field to store double precicion 2D vectors
typedef T2DVectorfield<C2DDVector> C2DDVectorfield;
@@ -74,10 +116,6 @@ typedef T2DVectorfield<C2DDVector> C2DDVectorfield;
*/
EXPORT_2D C2DFVectorfield& operator += (C2DFVectorfield& a, const C2DFVectorfield& b);
-/// @cond never
-extern template class EXPORT_2D T2DDatafield<C2DFVector>;
-extern template class EXPORT_2D range2d_iterator<T2DDatafield<C2DFVector>::iterator>;
-/// @endcond never
NS_MIA_END
diff --git a/mia/2d/vfio.cc b/mia/2d/vfio.cc
index 3eee635..30a0964 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 8d91f1d..fab95a0 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 ec058f8..4d964d0 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/mia/2d/vfregularizer.cc b/mia/2d/vfregularizer.cc
new file mode 100644
index 0000000..5e47055
--- /dev/null
+++ b/mia/2d/vfregularizer.cc
@@ -0,0 +1,72 @@
+/* -*- mia-c++ -*-
+ *
+ * This file is part of MIA - a toolbox for medical image analysis
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
+ *
+ * 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/export_handler.hh>
+#include <mia/2d/vfregularizer.hh>
+
+#include <mia/core/handler.cxx>
+#include <mia/core/plugin_base.cxx>
+
+NS_MIA_BEGIN
+
+const char *C2DFVectorfieldRegularizer::type_descr = "regularizer";
+
+C2DFVectorfieldRegularizer::~C2DFVectorfieldRegularizer()
+{
+}
+
+double C2DFVectorfieldRegularizer::run(C2DFVectorfield& velocity, C2DFVectorfield& force, const C2DFVectorfield& deform) const
+{
+ assert(velocity.get_size() == m_size);
+ assert(force.get_size() == m_size);
+ assert(deform.get_size() == m_size);
+
+ return do_run(velocity, force, deform);
+}
+
+void C2DFVectorfieldRegularizer::set_size(const C2DBounds& size)
+{
+ if (size != m_size) {
+ m_size = size;
+ on_size_changed();
+ }
+}
+
+const C2DBounds& C2DFVectorfieldRegularizer::get_size() const
+{
+ return m_size;
+}
+
+void C2DFVectorfieldRegularizer::on_size_changed()
+{
+
+}
+
+template <> const char * const
+TPluginHandler<C2DFVectorfieldRegularizerPlugin>::m_help =
+ "This class of plug-ins implement various regularizations for "
+ "2D vector fields that are typically used in image registration "
+ "to translate the force driving the registration to a smooth "
+ "velocity field.";
+
+EXPLICIT_INSTANCE_HANDLER(C2DFVectorfieldRegularizer);
+
+NS_MIA_END
+
diff --git a/mia/2d/vfregularizer.hh b/mia/2d/vfregularizer.hh
new file mode 100644
index 0000000..65f01de
--- /dev/null
+++ b/mia/2d/vfregularizer.hh
@@ -0,0 +1,107 @@
+/* -*- mia-c++ -*-
+ *
+ * This file is part of MIA - a toolbox for medical image analysis
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
+ *
+ * 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_2d_vectorfieldregularizer_hh
+#define mia_2d_vectorfieldregularizer_hh
+
+
+#include <mia/core/factory.hh>
+#include <mia/2d/vectorfield.hh>
+
+NS_MIA_BEGIN
+
+/**
+ @ingroup registration
+
+ Regularize a 2D vector field with some model
+
+ This is the base class for a 2D vector field reguarlizer
+ that is typically used in non-linear registration to
+ evaluate a velocity field from a force field by applying
+ some regularization model on the input data.
+*/
+
+class EXPORT_2D C2DFVectorfieldRegularizer : public CProductBase {
+public:
+ typedef C2DFVectorfieldRegularizer plugin_type;
+ typedef C2DFVectorfield plugin_data;
+
+ static const char *type_descr;
+
+ typedef std::shared_ptr< C2DFVectorfieldRegularizer > Pointer;
+
+ virtual ~C2DFVectorfieldRegularizer();
+
+ /**
+ The work routine for the regularizer
+
+ \param [out] velocity the vector field that contains the reguarlized field
+ \param[in] force the vector field that containes the unregularized field,
+ e.g. a force field obtained from an image similarity measure. The field
+ may be overwritten by the regularization operation.
+ \param[in] deform the currently valid deformation
+ \returns the maximum of the norms of the vectors of the output field
+ */
+ double run(C2DFVectorfield& velocity, C2DFVectorfield& force, const C2DFVectorfield& deform) const;
+
+ /**
+ Sets the size of the vector fields that will be regularized. This method
+ is implemented to give the regularizer a chance to initialize additional
+ data structures. To do so a derived class has to override the method
+ on_size_changed(). \a on_size_changed() is only called if the size changes.
+ */
+ void set_size(const C2DBounds& size);
+protected:
+ const C2DBounds& get_size() const;
+private:
+
+ virtual double do_run(C2DFVectorfield& velocity, C2DFVectorfield& force, const C2DFVectorfield& deform) const = 0;
+
+ virtual void on_size_changed();
+
+ C2DBounds m_size;
+};
+
+
+typedef C2DFVectorfieldRegularizer::Pointer P2DVectorfieldRegularizer;
+
+typedef TFactory<C2DFVectorfieldRegularizer> C2DFVectorfieldRegularizerPlugin;
+
+typedef THandlerSingleton<TFactoryPluginHandler<C2DFVectorfieldRegularizerPlugin> > C2DFVectorfieldRegularizerPluginHandler;
+
+
+template <> const char * const TPluginHandler<C2DFVectorfieldRegularizerPlugin>::m_help;
+extern template class EXPORT_2D TFactory<C2DFVectorfieldRegularizer>;
+extern template class EXPORT_2D TFactoryPluginHandler<C2DFVectorfieldRegularizerPlugin>;
+extern template class EXPORT_2D THandlerSingleton<TFactoryPluginHandler<C2DFVectorfieldRegularizerPlugin> >;
+
+
+/**
+ @cond NEVER
+ @ingroup traits
+ @brief Trait to make C2DFVectorfieldRegularizerPluginHandler available for creation by command line parsing
+*/
+FACTORY_TRAIT(C2DFVectorfieldRegularizerPluginHandler);
+/// @endcond
+
+
+NS_MIA_END
+
+#endif
diff --git a/mia/2d/vfregularizer/CMakeLists.txt b/mia/2d/vfregularizer/CMakeLists.txt
new file mode 100644
index 0000000..e746c92
--- /dev/null
+++ b/mia/2d/vfregularizer/CMakeLists.txt
@@ -0,0 +1,8 @@
+
+SET(vfsolvers
+ sor
+)
+
+PLUGINGROUP_WITH_TEST_AND_PREFIX2("2dvf" "regularizer" "${vfsolvers}"
+ "${MIA2DLIBS}" TESTLIBS mia2dtest
+ )
diff --git a/mia/2d/vfregularizer/fluid.cc b/mia/2d/vfregularizer/fluid.cc
new file mode 100644
index 0000000..8e1793e
--- /dev/null
+++ b/mia/2d/vfregularizer/fluid.cc
@@ -0,0 +1,196 @@
+
+
+C3DFluidVectorfieldRegularizer::C3DFluidVectorfieldRegularizer(float mu, float lambda,
+ size_t maxiter, float omega, float epsilon):
+ m_mu(mu),
+ m_lambda(lambda),
+ m_omega(omega),
+ m_epsilon(epsilon),
+ m_maxiter(maxiter),
+ m_dx(0),
+ m_dxy(0)
+{
+ float a = mu;
+ float b = lambda + mu;
+ m_c = 1 / (6.0f * a + 2.0f * b);
+ m_b_4 = 0.25f * b * m_c;
+ m_a_b = ( a + b ) * m_c;
+ m_a = a * m_c;
+}
+
+double C3DFluidVectorfieldRegularizer::do_run(C3DFVectorfield& output, C3DFVectorfield& input) const
+{
+ // reserve space for temporaries
+ T3DDatafield<float> residua(get_size());
+ T3DDatafield<unsigned char> update_flags1(get_size());
+ T3DDatafield<unsigned char> update_flags2(get_size());
+
+ // these two will ping-pong in each update
+ T3DDatafield<unsigned char>& update_flags = update_flags1;
+ T3DDatafield<unsigned char>& dset_flags = update_flags2;
+
+ float start_residuum = 0.0;
+ float residuum;
+ float thresh = 0.0;
+
+ size_t iter = 0;
+
+ // first iteration runs over the whole field
+ fill(update_flags.begin(), update_flags.end(), 1);
+
+ m_fluid_row_kernel->set_data_fields(output, input, residua);
+
+ do {
+ iter++;
+ residuum == 0.0f;
+
+
+ m_fluid_row_kernel->set_update_fields(update_flags, dset_flags);
+
+ for (unsigned z = 1; z < work_size.z; ++z) {
+ for (unsigned y = 1; y < work_size.y; ++y) {
+ residuum += m_fluid_row_kernel->evaluate_row(y, z);
+ }
+ }
+
+
+ } while (iter < m_maxiter && residuum > m_epsilon);
+
+
+
+
+}
+
+
+// this moves to the specific solver
+
+float C3DFluidVectorfieldRegularizer::solve_at(C3DFVector_sse *v, const C3DFVector_sse& b) const
+{
+ C3DFVector *vm = v - m_dxy;
+
+ __m128 Vp0m1m1 = _mm_loadu_ps(&vm[ -m_dx]);
+ __m128 Vm1p0m1 = _mm_loadu_ps(&vm[ -1 ]);
+ __m128 Vp0p0m1 = _mm_loadu_ps(&vm[ 0 ]);
+ __m128 Vp1p0m1 = _mm_loadu_ps(&vm[ 1 ]);
+ __m128 Vp0p1m1 = _mm_loadu_ps(&vm[ m_dx]);
+
+ vm = v - m_dx;
+
+ __m128 Vm1m1p0 = _mm_loadu_ps(&vm[ -1 ]);
+ __m128 Vp0m1p0 = _mm_loadu_ps(&vm[ 0 ]);
+ __m128 Vp1m1p0 = _mm_loadu_ps(&vm[ 1 ]);
+
+ __m128 Vp0p0m1 = _mm_loadu_ps(&v[-1]);
+ __m128 Vp0p0p1 = _mm_loadu_ps(&v[1]);
+
+ vm = v + m_dx;
+
+ __m128 Vm1p1p0 = _mm_loadu_ps(&vm[ -1 ]);
+ __m128 Vp0p1p0 = _mm_loadu_ps(&vm[ 0 ]);
+ __m128 Vp1p1p0 = _mm_loadu_ps(&vm[ 1 ]);
+
+ vm = v + m_dxy;
+
+ __m128 Vp0m1p1 = _mm_loadu_ps(&vm[ -m_dx]);
+ __m128 Vm1p0p1 = _mm_loadu_ps(&vm[ -1 ]);
+ __m128 Vp0p0p1 = _mm_loadu_ps(&vm[ 0 ]);
+ __m128 Vp1p0p1 = _mm_loadu_ps(&vm[ 1 ]);
+ __m128 Vp0p1p1 = _mm_loadu_ps(&vm[ m_dx]);
+
+ //
+ // V(-1,-1,0).xy - V(1,-1,0).xy + V(1,1,0).xy - V(-1,1,0).xy
+ //
+ __m128 vdxy = Vm1m1p0 - Vp1m1p0 + Vp1p1p0 - Vm1p1p0; // only 1 and 2 of interest
+
+ //
+ // V(-1,0,-1).xz - V(1,0,-1).xz + V(1,0,1).xz - V(-1,0,1).xz
+ //
+ __m128 vdxz = Vm1p0m1 - Vp1p0m1 + Vp1p0p1 - Vm1p0p1; // only 1 and 3 of interest
+
+ //
+ // V(0,-1,-1).yz - V(0,1,-1).yz + V(0,1,1).yz - V(0,-1,1).yz
+ //
+ __m128 vdyz = Vp0m1m1 - Vp0p1m1 + Vp0p1p1 - Vp0m1p1; // only 2 and 3 of interest
+
+ //
+ // V(1,0,0) + V(-1,0,0)
+ //
+ __m128 sxx = Vp1p0p0 + Vm1p0p0;
+
+ //
+ // V(0,1,0) + V(0,-1,0)
+ //
+ __m128 syy = Vp0p1p0 + Vp0m1p0;
+
+ //
+ // V(0,0,1) + V(0,0,-1)
+ //
+ __m128 szz = Vp0p0p1 + Vp0p0m1;
+
+ __m128 vdxx = Vp1p0m0 + Vm1p0p0;
+ __m128 vdyy = Vp0p1p0 + Vp0m1p0;
+ __m128 vdzz = Vp0p0p1 + Vp0p0m1;
+
+ // a_b * sxx.x + a * (syy.x + szz.x)
+ // a_b * syy.y + a * (sxx.y + szz.y)
+ // a_b * szz.z + a * (sxx.z + syy.z)
+
+ __m128 p1 = sxx;
+ _mm_shuffle_ps(p1, szz, _MM_SHUFFLE(3,2,3,0)); // [0, szz.z, 0, sxx.x]
+
+ __m128 p2 = syy;
+ _mm_shuffle_ps(p2, p2, _MM_SHUFFLE(3,3,1,3)); // [0, 0, syy.y, 0]
+ _mm_add_ps(p1, p2); // [0, szz.z, syy.y, sxx.x]
+
+ __m128 p2 = sxx;
+ _mm_shuffle_ps(szz, sxx, _MM_SHUFFLE(3,2,1,0)); // [0, sxx.z, szz.y, szz.x]
+
+ _mm_shuffle_ps(p2, syy, _MM_SHUFFLE(2,0,2,1)); // [syy.z, syy.x, sxx.z, sxx.y]
+ _mm_shuffle_ps(p2, p2, _MM_SHUFFLE(0,1,0,2)); // [dc , syy.z, sxx.y, syy.x]
+
+
+ auto p = p1 * m_a_b_sse + m_a_sse * (szz + p2);
+
+ // now q
+ // vdxy[ 0, 0, y, x ], vdxz[ 0, z, 0, x], vdyz [0, z, 0, x]
+ //
+ // dxy.y + dxz.z //
+ // dyz.z + dxy.x
+ // dxz.x + dyz.y
+
+
+ _mm_shuffle_ps(vdxy, vdyz, _MM_SHUFFLE(0, 1, 0, 1)); // [* , vdyz.y, vdxy.x, vdxy.y]
+ _mm_shuffle_ps(vdxz, vdyz, _MM_SHUFFLE(2, 0, 2, 1)); // [vdxz.z, vdxz.x, vdyz.z, vdyz.y]
+ _mm_shuffle_ps(vdxz, vdxz _MM_SHUFFLE(0, 2, 1, 3));// [*,vdxz.x, vdyz.z, vdxz.z]
+ auto q = vdxz + vdxy;
+
+ auto b_sse = _mm_set_pd(b.x, b.y. b.z, 0.0f);
+
+ auto s = m_sor_sse * (b_sse + p + m_b_4_sse * q);
+ auto delta = s - *v;
+
+ *v = s;
+
+
+ __m128 p1 = _mm_shuffle_ps(vdxx, vdyy, _MM_SHUFFLE(0, 1, 1, 0));
+ __m128 p2 = _mm_shuffle_ps(vdyy, vdzz, _MM_SHUFFLE(0, 1, 1, 0));
+
+ p1 = _mm_shuffle_ps(p1, vdzz, _MM_SHUFFLE(0, 2, 2, 0)); // p1 should now contain (xx.x, yy.y, zz.z)
+
+ __m128 p2 = _mm_shuffle_ps(vdxx, vdzz, _MM_SHUFFLE(0, 2, 1, 3));
+
+
+ return sse_norm2(delta);
+
+}
+
+void C3DFluidVectorfieldRegularizer::on_size_changed()
+{
+ m_dx = get_size().x;
+ m_dxy = m_dx * get_size().y;
+ cvinfo() << "Temporary memory requirement will be " <<
+ (4 + 2 + 32) * get_size().product() / (1024 * 1024 * 1024) << " GiB\n";
+}
+
+
+
diff --git a/mia/mesh/triangle_neighbourhood.hh b/mia/2d/vfregularizer/fluid.hh
similarity index 55%
copy from mia/mesh/triangle_neighbourhood.hh
copy to mia/2d/vfregularizer/fluid.hh
index 6b21ff1..f91ca87 100644
--- a/mia/mesh/triangle_neighbourhood.hh
+++ b/mia/2d/vfregularizer/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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,27 +18,29 @@
*
*/
-#ifndef mia_mesh_triangleneighborhood_hh
-#define mia_mesh_triangleneighborhood_hh
-#include <mia/mesh/triangularMesh.hh>
+#include <mia/3d/vectorfieldregularizer.hh>
-NS_MIA_BEGIN
+NS_BEGIN(fluid_vfregularizer)
-class EXPORT_MESH CTrianglesWithAdjacentList {
+class C3DFluidVectorfieldRegularizer: public mia::C3DFVectorfieldRegularizer {
public:
- CTrianglesWithAdjacentList(const CTriangleMesh& mesh);
-
- const std::set<unsigned>& operator [](unsigned idx) const;
-
+ C3DFluidVectorfieldRegularizer(float mu, float lambda, size_t maxiter, float omega, float epsilon);
+
private:
+ virtual double do_run(C3DFVectorfield& output, C3DFVectorfield& input) const;
+ virtual void on_size_changed();
- std::vector<std::set<unsigned> > m_triangle_neighborhood;
-
-
-};
+ float m_mu;
+ float m_lambda;
+ float m_omega;
+ float m_epsilon;
+ size_t m_max_iter;
+ float m_a, m_c, m_a_b, m_b_4;
+ int m_dx;
+ int m_dxy;
-NS_MIA_END
-#endif
+};
+
diff --git a/mia/2d/vfregularizer/sor.cc b/mia/2d/vfregularizer/sor.cc
new file mode 100644
index 0000000..08172af
--- /dev/null
+++ b/mia/2d/vfregularizer/sor.cc
@@ -0,0 +1,147 @@
+/* -*- mia-c++ -*-
+ *
+ * This file is part of MIA - a toolbox for medical image analysis
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
+ *
+ * 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/vfregularizer/sor.hh>
+#include <mia/core/parallel.hh>
+
+NS_MIA_BEGIN
+
+C2DSORVectorfieldRegularizer::C2DSORVectorfieldRegularizer(float abs_epsilon, float rel_epsilon,
+ unsigned maxiter,
+ P2DVectorfieldRegularizerKernel kernel):
+ m_abs_epsilon(abs_epsilon),
+ m_rel_epsilon(rel_epsilon),
+ m_maxiter(maxiter),
+ m_kernel(kernel)
+{
+}
+
+double C2DSORVectorfieldRegularizer::do_run(C2DFVectorfield& velocity, C2DFVectorfield& force, const C2DFVectorfield& deform) const
+{
+ m_kernel->set_data_fields(&velocity, &force);
+
+ unsigned padding = m_kernel->get_boundary_padding();
+
+ unsigned iter = 0;
+ float residuum = 0.0;
+ float first_rel_residuum = -1.0;
+
+ unsigned work_size_y = velocity.get_size().y - padding;
+
+ do {
+ iter++;
+
+ residuum = 0.0f;
+
+ // to be parallized, needs reduce for residuum
+
+ auto callback_solver = [this, padding, work_size_y]
+ (const C1DParallelRange& range, float res) {
+ auto buffers = m_kernel->get_buffers();
+ for (auto y = range.begin(); y < range.end(); ++y) {
+ m_kernel->start_row(y, *buffers);
+ res += m_kernel->evaluate_row(y, *buffers);
+ }
+ return res;
+ };
+
+ residuum = preduce(C1DParallelRange(padding, work_size_y), 0.0f, callback_solver,
+ [](float a, float b){ return a+b;});
+
+ if (first_rel_residuum < 0)
+ first_rel_residuum = m_rel_epsilon * residuum;
+
+
+ cvinfo() << "[" << iter << "] res=" << residuum << "\n";
+ } while (iter < m_maxiter &&
+ residuum > m_abs_epsilon &&
+ residuum > first_rel_residuum);
+
+
+ float max_pert = 0.0f;
+ if (m_kernel->has_pertuberation()) {
+ m_kernel->set_data_fields(&velocity, &deform);
+
+ auto callback_pert = [this, padding, work_size_y]
+ (const C1DParallelRange& range, float maxpert) {
+
+ // to be parallized (reduce because of max )
+ auto buffers = m_kernel->get_buffers();
+ for (auto y = range.begin(); y < range.end(); ++y) {
+ m_kernel->start_row(y, *buffers);
+ float pert = m_kernel->evaluate_pertuberation_row(y, *buffers);
+ if (maxpert < pert)
+ maxpert = pert;
+ }
+ return maxpert;
+ };
+
+ max_pert = preduce(C1DParallelRange(padding, work_size_y), 0.0f, callback_pert,
+ [](float a, float b){ return std::max(a,b);});
+ }else{
+ // find maximum in velocity field
+ for (auto v : velocity) {
+ float pert = v.norm2();
+ if (max_pert < pert)
+ max_pert = pert;
+ }
+ }
+ return sqrt(max_pert);
+}
+
+C2DSORVectorfieldRegularizerPlugin::C2DSORVectorfieldRegularizerPlugin():
+ C2DFVectorfieldRegularizerPlugin("sor"),
+ m_abs_epsilon(0.01),
+ m_rel_epsilon(1e-5),
+ m_maxiter(100)
+{
+ add_parameter("rel_f", make_oi_param(m_rel_epsilon, 0.0, 1.0, false,
+ "breaking condition: relative residuum"));
+ add_parameter("abs_f", make_lc_param(m_abs_epsilon, 0.0, false,
+ "breaking condition: absolute residuum"));
+ add_parameter("maxiter", make_lc_param(m_maxiter, 0, false, "maximum number of iterations"));
+
+ // there should be some method to select the arch optimized version
+ //
+ add_parameter("kernel", make_param(m_kernel, "fluid", false, "solver kernel to be used"));
+
+}
+
+
+C2DFVectorfieldRegularizer *C2DSORVectorfieldRegularizerPlugin::do_create() const
+{
+
+ return new C2DSORVectorfieldRegularizer(m_abs_epsilon, m_rel_epsilon,
+ m_maxiter, m_kernel);
+}
+
+const std::string C2DSORVectorfieldRegularizerPlugin::do_get_descr() const
+{
+ return "This plugin implements successive (over-)relaxation as a solver "
+ "to regularize the vector field.";
+}
+
+
+extern "C" EXPORT CPluginBase *get_plugin_interface()
+{
+ return new C2DSORVectorfieldRegularizerPlugin();
+}
+
+NS_MIA_END
diff --git a/mia/2d/vfregularizer/sor.hh b/mia/2d/vfregularizer/sor.hh
new file mode 100644
index 0000000..b936187
--- /dev/null
+++ b/mia/2d/vfregularizer/sor.hh
@@ -0,0 +1,67 @@
+/* -*- mia-c++ -*-
+ *
+ * This file is part of MIA - a toolbox for medical image analysis
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
+ *
+ * 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_2d_vfregularizer_sor_hh
+#define mia_2d_vfregularizer_sor_hh
+
+#include <mia/2d/vfregularizer.hh>
+#include <mia/2d/vfregularizerkernel.hh>
+
+NS_MIA_BEGIN
+
+class C2DSORVectorfieldRegularizer : public C2DFVectorfieldRegularizer {
+
+public:
+ C2DSORVectorfieldRegularizer(float abs_epsilon, float rel_epsilon,
+ unsigned maxiter,
+ P2DVectorfieldRegularizerKernel kernel);
+
+private:
+ double do_run(C2DFVectorfield& velocity, C2DFVectorfield& force, const C2DFVectorfield& deform) const override;
+
+ float m_abs_epsilon;
+ float m_rel_epsilon;
+ unsigned m_maxiter;
+ P2DVectorfieldRegularizerKernel m_kernel;
+
+};
+
+class C2DSORVectorfieldRegularizerPlugin : public C2DFVectorfieldRegularizerPlugin {
+
+public:
+ C2DSORVectorfieldRegularizerPlugin();
+
+private:
+
+ C2DFVectorfieldRegularizer *do_create() const;
+
+ const std::string do_get_descr() const;
+
+
+ float m_abs_epsilon;
+ float m_rel_epsilon;
+ unsigned m_maxiter;
+ P2DVectorfieldRegularizerKernel m_kernel;
+
+};
+
+NS_MIA_END
+
+#endif
diff --git a/mia/2d/vfregularizer/test_sor.cc b/mia/2d/vfregularizer/test_sor.cc
new file mode 100644
index 0000000..bb31904
--- /dev/null
+++ b/mia/2d/vfregularizer/test_sor.cc
@@ -0,0 +1,187 @@
+/* -*- mia-c++ -*-
+ *
+ * This file is part of MIA - a toolbox for medical image analysis
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
+ *
+ * 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/vfregularizer/sor.hh>
+#include <mia/2d/vfregularizerkernel.hh>
+#include <mia/core/parallel.hh>
+
+using namespace std;
+using namespace mia;
+
+
+class Mock2DVectorfieldRegularizerKernel: public C2DFVectorfieldRegularizerKernel {
+public:
+ Mock2DVectorfieldRegularizerKernel();
+private:
+ virtual float do_evaluate_row(unsigned y, CBuffers& buffers);
+ virtual float do_evaluate_row_sparse(unsigned y, CBuffers& buffers);
+ virtual unsigned do_get_boundary_padding() const;
+ float solve_at(C2DFVector *v, const C2DFVector& b);
+
+ void post_set_data_fields();
+ int m_dx;
+ vector<CMutex> m_row_mutex;
+
+
+
+};
+
+BOOST_AUTO_TEST_CASE(test_sor_solver)
+{
+ C2DBounds size(5, 6);
+ C2DBounds rbe = size - 2 * C2DBounds::_1;
+
+ C2DFVectorfield v(size);
+ C2DFVectorfield b(size);
+
+
+ auto useful_range = v.get_range(2 * C2DBounds::_1, rbe);
+ auto irv = useful_range.begin();
+ auto erv = useful_range.end();
+
+ while ( irv != erv ) {
+ C2DFVector x(irv.pos());
+
+ float fy = cos((x.y - 3.0)/6.0 * M_PI);
+ float fx = x.x - 2.5f;
+
+ *irv = C2DFVector( fy * 1.0 / (1 + fx * fx),
+ fy * fy * 1.0 / (1 + fx * fx));
+
+ cvdebug() << "input[" << irv.pos() << "]=" << *irv << "\n";
+
+ ++irv;
+ }
+
+
+ C2DBounds rbe1 = size - C2DBounds::_1;
+ auto b_range = b.get_range(C2DBounds::_1, rbe1);
+
+ auto irb = b_range.begin();
+ auto erb = b_range.end();
+
+ while (irb != erb) {
+ C2DBounds p = irb.pos();
+
+ *irb = (6.0f * v(p) +
+ v(C2DBounds(p.x + 1, p.y)) +
+ v(C2DBounds(p.x - 1, p.y)) +
+ v(C2DBounds(p.x, p.y + 1)) +
+ v(C2DBounds(p.x, p.y - 1)))
+ * 1.0f/10.0f;
+
+ ++irb;
+ }
+
+ C2DSORVectorfieldRegularizer sor_solver(1e-7, 1e-9, 1000,
+ make_shared<Mock2DVectorfieldRegularizerKernel>());
+ C2DFVectorfield vs(size);
+ C2DFVectorfield d(size);
+
+ sor_solver.set_size(size);
+ sor_solver.run(vs, b, d);
+
+ auto vs_full_range = vs.get_range(C2DBounds::_0, vs.get_size());
+ auto v_full_range = v.get_range(C2DBounds::_0, vs.get_size());
+
+ for (auto ivs = vs_full_range.begin(), iv = v_full_range.begin(); ivs != vs_full_range.end(); ++ivs, ++iv) {
+
+ cvdebug() << "[" << ivs.pos() << "]=" << *ivs << " expect " << *iv << "\n";
+
+ if (fabs(iv->x) > 1e-5)
+ BOOST_CHECK_CLOSE(ivs->x, iv->x, 1e-4);
+ else
+ BOOST_CHECK_SMALL(ivs->x, 1e-5f);
+
+ if (fabs(iv->y) > 1e-5)
+ BOOST_CHECK_CLOSE(ivs->y, iv->y, 1e-4);
+ else
+ BOOST_CHECK_SMALL(ivs->y, 1e-5f);
+
+ }
+
+}
+
+Mock2DVectorfieldRegularizerKernel::Mock2DVectorfieldRegularizerKernel():
+ C2DFVectorfieldRegularizerKernel(false),
+ m_dx(0)
+{
+}
+
+
+float Mock2DVectorfieldRegularizerKernel::do_evaluate_row(unsigned y,
+ CBuffers& MIA_PARAM_UNUSED(buffers))
+{
+ float residuum = 0.0f;
+
+ auto& v = get_output_field();
+ auto& b = get_input_field();
+
+ unsigned linear_index = 1 + y * m_dx;
+
+ // There should be a more fine-grained method, but for the test it's okay
+
+ CScopedLock lock_zm1(m_row_mutex[y-1]);
+ CScopedLock lock_z(m_row_mutex[y]);
+ CScopedLock lock_zp1(m_row_mutex[y+1]);
+
+ for (int x = 1; x < m_dx - 1; ++x, ++linear_index) {
+ residuum += solve_at(&v[linear_index], b[linear_index]);
+ }
+ return residuum;
+
+}
+
+float Mock2DVectorfieldRegularizerKernel::do_evaluate_row_sparse(unsigned MIA_PARAM_UNUSED(y),
+ CBuffers& MIA_PARAM_UNUSED(buffers))
+{
+ return numeric_limits<float>::max();
+}
+
+float Mock2DVectorfieldRegularizerKernel::solve_at(C2DFVector *v, const C2DFVector& b)
+{
+ C2DFVector s = 6.0f * v[0];
+ s += v[1];
+ s += v[-1];
+
+ s += v[m_dx];
+ s += v[-m_dx];
+
+ s /= 10.0f;
+
+ C2DFVector r = 1.2 * ( b - s);
+
+ v[0] += r;
+
+ return r.norm();
+}
+
+unsigned Mock2DVectorfieldRegularizerKernel::do_get_boundary_padding() const
+{
+ return 1;
+}
+
+void Mock2DVectorfieldRegularizerKernel::post_set_data_fields()
+{
+ auto s = get_input_field().get_size();
+ m_dx = s.x;
+ m_row_mutex = vector<CMutex>(s.y);
+}
diff --git a/mia/2d/vfregularizerkernel.cc b/mia/2d/vfregularizerkernel.cc
new file mode 100644
index 0000000..f890b1e
--- /dev/null
+++ b/mia/2d/vfregularizerkernel.cc
@@ -0,0 +1,145 @@
+/* -*- mia-c++ -*-
+ *
+ * This file is part of MIA - a toolbox for medical image analysis
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
+ *
+ * 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/export_handler.hh>
+#include <mia/2d/vfregularizerkernel.hh>
+
+#include <mia/core/handler.cxx>
+#include <mia/core/plugin_base.cxx>
+#include <cassert>
+
+NS_MIA_BEGIN
+
+const char *C2DFVectorfieldRegularizerKernel::type_descr = "regularizerkernel";
+
+C2DFVectorfieldRegularizerKernel::C2DFVectorfieldRegularizerKernel(bool has_pertuberation):
+ m_output(nullptr),
+ m_input(nullptr),
+ m_residua(nullptr),
+ m_update_flags(nullptr),
+ m_set_flags(nullptr),
+ m_residual_thresh(0.0),
+ m_has_pertuberation(has_pertuberation)
+{
+}
+
+C2DFVectorfieldRegularizerKernel::~C2DFVectorfieldRegularizerKernel()
+{
+}
+
+float C2DFVectorfieldRegularizerKernel::evaluate_pertuberation_row(unsigned y, CBuffers& buffers) const
+{
+ return do_evaluate_pertuberation_row(y,buffers);
+}
+
+void C2DFVectorfieldRegularizerKernel::set_data_fields(C2DFVectorfield *output, const C2DFVectorfield *input)
+{
+ m_output = output;
+ m_input = input;
+ post_set_data_fields();
+}
+
+
+void C2DFVectorfieldRegularizerKernel::set_update_fields(const T2DDatafield<unsigned char> *update_flags,
+ T2DDatafield<unsigned char> *set_flags,
+ T2DDatafield<float> *residua,
+ float residual_thresh)
+{
+ m_update_flags = update_flags;
+ m_set_flags = set_flags;
+ m_residua = residua;
+ m_residual_thresh = residual_thresh;
+}
+
+float C2DFVectorfieldRegularizerKernel::evaluate_row(unsigned y, CBuffers& buffers)
+{
+ assert(m_output);
+ assert(m_input);
+
+ return do_evaluate_row(y, buffers);
+}
+
+float C2DFVectorfieldRegularizerKernel::evaluate_row_sparse(unsigned y, CBuffers& buffers)
+{
+ assert(m_output);
+ assert(m_input);
+ assert(m_residua);
+ assert(m_update_flags);
+ assert(m_set_flags);
+
+ return do_evaluate_row_sparse(y, buffers);
+}
+
+C2DFVectorfieldRegularizerKernel::PBuffers
+C2DFVectorfieldRegularizerKernel::get_buffers() const
+{
+ return do_get_buffers();
+}
+
+void C2DFVectorfieldRegularizerKernel::start_row(unsigned y, CBuffers& buffers) const
+{
+ do_start_row(y, buffers);
+}
+
+
+C2DFVectorfieldRegularizerKernel::PBuffers
+C2DFVectorfieldRegularizerKernel::do_get_buffers() const
+{
+ return PBuffers(new CBuffers());
+}
+
+float C2DFVectorfieldRegularizerKernel::do_evaluate_pertuberation_row(unsigned MIA_PARAM_UNUSED(y),
+ CBuffers& MIA_PARAM_UNUSED(buffers)) const
+{
+ assert(!m_has_pertuberation && "The kernel says it has a pertuberation evaluator, "
+ "but 'do_evaluate_pertuberation_row' has not been overriden");
+ return 0.0;
+}
+
+void C2DFVectorfieldRegularizerKernel::do_start_row(unsigned MIA_PARAM_UNUSED(y),
+ CBuffers& MIA_PARAM_UNUSED(buffers)) const
+{
+}
+
+void C2DFVectorfieldRegularizerKernel::post_set_data_fields()
+{
+}
+
+unsigned C2DFVectorfieldRegularizerKernel::get_boundary_padding() const
+{
+ return do_get_boundary_padding();
+}
+
+C2DFVectorfieldRegularizerKernel::CBuffers::~CBuffers()
+{
+}
+
+template <> const char * const
+TPluginHandler<C2DFVectorfieldRegularizerKernelPlugin>::m_help =
+ "This class of plug-ins implement various regularizations kernels for "
+ "2D vector fields regularization solvers that are typically used in image registration "
+ "to translate the force driving the registration to a smooth "
+ "velocity field.";
+
+EXPLICIT_INSTANCE_HANDLER(C2DFVectorfieldRegularizerKernel);
+
+
+NS_MIA_END
+
diff --git a/mia/2d/vfregularizerkernel.hh b/mia/2d/vfregularizerkernel.hh
new file mode 100644
index 0000000..b151202
--- /dev/null
+++ b/mia/2d/vfregularizerkernel.hh
@@ -0,0 +1,176 @@
+/* -*- mia-c++ -*-
+ *
+ * This file is part of MIA - a toolbox for medical image analysis
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
+ *
+ * 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_2d_vfregularizerkernel_hh
+#define mia_2d_vfregularizerkernel_hh
+
+#include <mia/core/factory.hh>
+#include <mia/2d/vectorfield.hh>
+
+NS_MIA_BEGIN
+
+/**
+ @ingroup registration
+
+ Kernel for iterative 2D vector field regularizer
+
+ This is the base class for a 2D vector field reguarlizer
+ kernels that is typically used in non-linear registration to
+ evaluate a velocity field from a force field by applying
+ some regularization model on the input data.
+*/
+
+class EXPORT_2D C2DFVectorfieldRegularizerKernel : public CProductBase {
+public:
+ typedef C2DFVectorfieldRegularizerKernel plugin_type;
+ typedef C2DFVectorfield plugin_data;
+
+ class CBuffers {
+ public:
+ virtual ~CBuffers();
+ };
+
+ typedef std::unique_ptr<CBuffers> PBuffers;
+
+ static const char *type_descr;
+
+ typedef std::shared_ptr< C2DFVectorfieldRegularizerKernel > Pointer;
+
+ C2DFVectorfieldRegularizerKernel(bool has_pertuberation);
+
+ float evaluate_pertuberation_row(unsigned y, CBuffers& buffers) const;
+
+ virtual ~C2DFVectorfieldRegularizerKernel();
+
+ void set_data_fields(C2DFVectorfield *output, const C2DFVectorfield *input);
+
+ void set_update_fields(const T2DDatafield<unsigned char> *update_flags,
+ T2DDatafield<unsigned char> *set_flags, T2DDatafield<float> *residua,
+ float residual_thresh);
+
+ float evaluate_row(unsigned y, CBuffers& buffers);
+
+ float evaluate_row_sparse(unsigned y, CBuffers& buffers);
+
+ unsigned get_boundary_padding() const;
+
+ PBuffers get_buffers() const;
+
+ void start_row(unsigned y, CBuffers& buffers) const;
+
+ bool has_pertuberation() const;
+ protected:
+ C2DFVectorfield& get_output_field() const;
+ const C2DFVectorfield& get_input_field() const;
+ T2DDatafield<float>& get_residua() const;
+ const T2DDatafield<unsigned char>& get_update_flags() const;
+ T2DDatafield<unsigned char>& get_set_flags() const;
+ float get_residual_thresh() const;
+ private:
+ virtual void post_set_data_fields();
+
+ virtual float do_evaluate_row(unsigned y, CBuffers& buffers) = 0;
+
+ virtual float do_evaluate_row_sparse(unsigned y, CBuffers& buffers) = 0;
+
+ virtual unsigned do_get_boundary_padding() const = 0;
+
+ virtual PBuffers do_get_buffers() const;
+
+ virtual void do_start_row(unsigned y, CBuffers& buffers) const;
+
+ virtual float do_evaluate_pertuberation_row(unsigned y, CBuffers& buffers) const;
+
+ C2DFVectorfield *m_output;
+ const C2DFVectorfield *m_input;
+ T2DDatafield<float> *m_residua;
+ const T2DDatafield<unsigned char> *m_update_flags;
+ T2DDatafield<unsigned char> *m_set_flags;
+ float m_residual_thresh;
+ bool m_has_pertuberation;
+};
+
+inline
+bool C2DFVectorfieldRegularizerKernel::has_pertuberation() const
+{
+ return m_has_pertuberation;
+}
+
+inline
+C2DFVectorfield& C2DFVectorfieldRegularizerKernel::get_output_field() const
+{
+ return *m_output;
+}
+
+inline
+const C2DFVectorfield& C2DFVectorfieldRegularizerKernel::get_input_field() const
+{
+ return *m_input;
+}
+
+inline
+T2DDatafield<float>& C2DFVectorfieldRegularizerKernel::get_residua() const
+{
+ return *m_residua;
+}
+
+inline
+const T2DDatafield<unsigned char>& C2DFVectorfieldRegularizerKernel::get_update_flags() const
+{
+ return *m_update_flags;
+}
+
+inline
+T2DDatafield<unsigned char>& C2DFVectorfieldRegularizerKernel::get_set_flags() const
+{
+ return *m_set_flags;
+}
+
+inline
+float C2DFVectorfieldRegularizerKernel::get_residual_thresh() const
+{
+ return m_residual_thresh;
+}
+
+typedef C2DFVectorfieldRegularizerKernel::Pointer P2DVectorfieldRegularizerKernel;
+
+typedef TFactory<C2DFVectorfieldRegularizerKernel> C2DFVectorfieldRegularizerKernelPlugin;
+
+typedef THandlerSingleton<TFactoryPluginHandler<C2DFVectorfieldRegularizerKernelPlugin> > C2DFVectorfieldRegularizerKernelPluginHandler;
+
+
+template <> const char * const TPluginHandler<C2DFVectorfieldRegularizerKernelPlugin>::m_help;
+extern template class EXPORT_2D TFactory<C2DFVectorfieldRegularizerKernel>;
+extern template class EXPORT_2D TFactoryPluginHandler<C2DFVectorfieldRegularizerKernelPlugin>;
+extern template class EXPORT_2D THandlerSingleton<TFactoryPluginHandler<C2DFVectorfieldRegularizerKernelPlugin> >;
+
+/**
+ @cond NEVER
+ @ingroup traits
+ @brief Trait to make C2DFVectorfieldRegularizerPluginHandler available for creation by command line parsing
+*/
+FACTORY_TRAIT(C2DFVectorfieldRegularizerKernelPluginHandler);
+/// @endcond
+
+
+
+NS_MIA_END
+#endif
diff --git a/mia/2d/vfregularizerkernel/CMakeLists.txt b/mia/2d/vfregularizerkernel/CMakeLists.txt
new file mode 100644
index 0000000..34d78bc
--- /dev/null
+++ b/mia/2d/vfregularizerkernel/CMakeLists.txt
@@ -0,0 +1,9 @@
+
+SET(regularizers
+ fluid-generic
+)
+
+PLUGINGROUP_WITH_TEST_AND_PREFIX2("2dvf" "regularizerkernel" "${regularizers}"
+ "${MIA2DLIBS}" TESTLIBS mia2dtest
+ )
+
diff --git a/mia/2d/vfregularizerkernel/fluid-generic.cc b/mia/2d/vfregularizerkernel/fluid-generic.cc
new file mode 100644
index 0000000..b4d7c35
--- /dev/null
+++ b/mia/2d/vfregularizerkernel/fluid-generic.cc
@@ -0,0 +1,244 @@
+/* -*- mia-c++ -*-
+ *
+ * This file is part of MIA - a toolbox for medical image analysis
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
+ *
+ * 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/vfregularizerkernel/fluid-generic.hh>
+
+NS_MIA_BEGIN
+
+C2DFVfFluidStandardRegularizerKernel::C2DFVfFluidStandardRegularizerKernel(float mu, float lambda, float relax):
+ C2DFVectorfieldRegularizerKernel(true),
+ m_relax(relax),
+ m_dx(0),
+ m_dxy(0)
+
+{
+ float a = mu;
+ float b = lambda + mu;
+ m_c = 1 / (6.0f * a + 2.0f * b);
+ m_b4 = 0.25f * b * m_c;
+ m_a_b = ( a + b ) * m_c;
+ m_a = a * m_c;
+}
+
+void C2DFVfFluidStandardRegularizerKernel::post_set_data_fields()
+{
+ m_dx = get_input_field().get_size().x;
+ m_dxy = m_dx * get_input_field().get_size().y;
+}
+
+float C2DFVfFluidStandardRegularizerKernel::do_evaluate_row(unsigned y,
+ CBuffers& MIA_PARAM_UNUSED(buf))
+{
+ float residuum = 0.0f;
+ unsigned linear_index = 1 + y * m_dx;
+ 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 C2DFVfFluidStandardRegularizerKernel::do_evaluate_row_sparse(unsigned y,
+ CBuffers& MIA_PARAM_UNUSED(buf))
+{
+ float residuum = 0.0f;
+ unsigned linear_index = 1 + y * m_dx;
+ auto& v = get_output_field();
+ auto& b = get_input_field();
+ auto& update = get_update_flags();
+ auto& res = get_residua();
+
+ for (int x = 1; x < m_dx - 1; ++x, ++linear_index) {
+ if (update[linear_index]) {
+ res[linear_index] = solve_at(&v[linear_index], b[linear_index]);
+ }
+ residuum += res[linear_index];
+
+ if (res[linear_index] > get_residual_thresh()) {
+ set_update_flags(linear_index);
+ }
+ }
+ return residuum;
+
+}
+
+void C2DFVfFluidStandardRegularizerKernel::multiply_with_matrix(C2DFVectorfield& out, const C2DFVectorfield& in)
+{
+ assert(out.get_size() == in.get_size());
+ auto size = out.get_size();
+
+ const C2DBounds rbe = size - C2DBounds::_1;
+ auto in_useful_range = in.get_range(C2DBounds::_1, rbe);
+ auto out_useful_range = out.get_range(C2DBounds::_1, rbe);
+
+ auto iiv = in_useful_range.begin();
+ auto eiv = in_useful_range.end();
+
+ auto iov = out_useful_range.begin();
+
+ while ( iiv != eiv ) {
+
+ C2DFVector xx = iiv[-1] + iiv[1];
+ C2DFVector yy = iiv[-m_dx] + iiv[m_dx];
+
+ const C2DFVector p(m_a_b*xx.x + m_a*yy.x, // 6A 6M
+ m_a_b*yy.y + m_a*xx.y);
+
+
+ const C2DFVector& Vm1m1p0 = iiv[ -1 - m_dx];
+ const C2DFVector& Vp1m1p0 = iiv[ 1 - m_dx];
+ const C2DFVector& Vm1p1p0 = iiv[ -1 + m_dx];
+ const C2DFVector& Vp1p1p0 = iiv[ 1 + m_dx];
+
+ const float vxdxy = Vm1m1p0.x - Vp1m1p0.x + Vp1p1p0.x - Vm1p1p0.x;
+ const float vydxy = Vm1m1p0.y - Vp1m1p0.y + Vp1p1p0.y - Vm1p1p0.y;
+
+
+ const C2DFVector q(vydxy,vxdxy);
+
+ *iov = *iiv + p + m_b4 * q;
+
+ ++iiv; ++iov;
+ }
+
+}
+
+float C2DFVfFluidStandardRegularizerKernel::do_evaluate_pertuberation_row(unsigned y,
+ CBuffers& MIA_PARAM_UNUSED(buffers)) const
+{
+
+
+ auto iu = get_input_field().begin_at(1, y);
+ auto iv = get_output_field().begin_at(1, y);
+
+ float max_pert = 0.0f;
+
+ for (int x = 1; x < m_dx - 1; ++x, ++iu, ++iv) {
+
+ auto dux = iu[1] - iu[-1];
+ auto duy = iu[m_dx] - iu[-m_dx];
+
+ *iv -= 0.5f * (iv->x * dux + iv->y * duy);
+ float pert = iv->norm2();
+ if (max_pert < pert)
+ max_pert = pert;
+ }
+ return max_pert;
+}
+
+unsigned C2DFVfFluidStandardRegularizerKernel::do_get_boundary_padding() const
+{
+ return 1;
+}
+
+float C2DFVfFluidStandardRegularizerKernel::solve_at(C2DFVector *v, const C2DFVector& b)
+{
+ C2DFVector *v_loc = &v[ -m_dx ];
+ const C2DFVector Vm1m1p0 = v_loc[ -1 ];
+ const C2DFVector Vp0m1p0 = v_loc[ 0 ];
+ const C2DFVector Vp1m1p0 = v_loc[ 1 ];
+
+ v_loc = &v[ m_dx ];
+ const C2DFVector Vm1p1p0 = v_loc[ -1 ];
+ const C2DFVector Vp0p1p0 = v_loc[ 0 ];
+ const C2DFVector Vp1p1p0 = v_loc[ 1 ];
+
+ const float vxdxy = Vm1m1p0.x - Vp1m1p0.x + Vp1p1p0.x - Vm1p1p0.x;
+ const float vydxy = Vm1m1p0.y - Vp1m1p0.y + Vp1p1p0.y - Vm1p1p0.y;
+
+ const C2DFVector vdxx = v[-1] + v[1]; // 3A
+ const C2DFVector vdyy = Vp0p1p0 + Vp0m1p0;
+
+
+ const C2DFVector p(m_a_b*vdxx.x + m_a*vdyy.x,
+ m_a_b*vdyy.y + m_a*vdxx.y);
+
+ const C2DFVector q(vydxy,vxdxy);
+ const C2DFVector R = b + p + m_b4 * q;
+
+
+ const C2DFVector delta = m_relax * ( R - *v ); // 3A 3M
+ *v += delta; // 3A
+
+ return delta.norm();
+
+}
+
+void C2DFVfFluidStandardRegularizerKernel::set_update_flags(unsigned idx)
+{
+ auto& sf = get_set_flags();
+
+ unsigned idx_my = idx - m_dx;
+
+ sf[idx_my - 1] = 1;
+ sf[idx_my] = 1;
+ sf[idx_my + 1] = 1;
+
+ sf[idx - 1] = 1;
+ sf[idx] = 1;
+ sf[idx + 1] = 1;
+
+ unsigned idx_py = idx + m_dx;
+
+ sf[idx_py - 1] = 1;
+ sf[idx_py] = 1;
+ sf[idx_py + 1] = 1;
+
+}
+
+C2DFVfFluidStandardRegularizerKernelPlugin::C2DFVfFluidStandardRegularizerKernelPlugin():
+ C2DFVectorfieldRegularizerKernelPlugin("fluid"),
+ m_mu(1.0f),
+ m_lambda(1.0f),
+ m_relax(1.0)
+{
+ this->add_parameter("mu", make_oci_param(m_mu, 0.0, 10000.0, false, "dynamic viscosity (shear)"));
+ this->add_parameter("lambda", make_ci_param(m_lambda, 0.0, 10000.0, false, "bulk viscosity (compressibility)"));
+ this->add_parameter("relax", make_ci_param(m_relax, 0.1, 2.0, false, "Relaxation parameter for the solver"));
+}
+
+C2DFVfFluidStandardRegularizerKernel *C2DFVfFluidStandardRegularizerKernelPlugin::do_create() const
+{
+ return new C2DFVfFluidStandardRegularizerKernel(m_mu, m_lambda, m_relax);
+}
+
+const std::string C2DFVfFluidStandardRegularizerKernelPlugin::do_get_descr() const
+{
+ return "Evaluation kernel for the fluid-dynamics solver, either using "
+ "successive (over-)relaxation, or a Gauss-Southwell relaxation. "
+ "This implementation is generic and doesn't implement any "
+ "architecture specific optimizations.";
+}
+
+NS_MIA_END
+
+extern "C" EXPORT mia::CPluginBase *get_plugin_interface()
+{
+ return new mia::C2DFVfFluidStandardRegularizerKernelPlugin();
+}
+
+
+
+
+
+
+
diff --git a/mia/2d/vfregularizerkernel/fluid-generic.hh b/mia/2d/vfregularizerkernel/fluid-generic.hh
new file mode 100644
index 0000000..4904cc0
--- /dev/null
+++ b/mia/2d/vfregularizerkernel/fluid-generic.hh
@@ -0,0 +1,74 @@
+/* -*- mia-c++ -*-
+ *
+ * This file is part of MIA - a toolbox for medical image analysis
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
+ *
+ * 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_2d_vfregularizerkernel_fluid_standard_hh
+#define mia_2d_vfregularizerkernel_fluid_standard_hh
+
+#include <mia/2d/vfregularizerkernel.hh>
+
+NS_MIA_BEGIN
+
+class C2DFVfFluidStandardRegularizerKernel: public C2DFVectorfieldRegularizerKernel {
+public:
+ C2DFVfFluidStandardRegularizerKernel(float mu, float lambda, float relax);
+
+ void multiply_with_matrix(C2DFVectorfield& out, const C2DFVectorfield& in);
+
+private:
+ void post_set_data_fields() override;
+
+ float do_evaluate_row(unsigned y, CBuffers& buf) override;
+
+ float do_evaluate_row_sparse(unsigned y, CBuffers& buf) override;
+
+ float do_evaluate_pertuberation_row(unsigned y, CBuffers& buffers) const override;
+
+ unsigned do_get_boundary_padding() const override;
+
+ void set_update_flags(unsigned idx);
+
+ float solve_at(C2DFVector *v, const C2DFVector& b);
+
+ float m_a;
+ float m_a_b;
+ float m_b4;
+ float m_relax;
+ float m_c;
+ int m_dx;
+ int m_dxy;
+
+};
+
+class C2DFVfFluidStandardRegularizerKernelPlugin: public C2DFVectorfieldRegularizerKernelPlugin {
+public:
+ C2DFVfFluidStandardRegularizerKernelPlugin();
+
+private:
+ C2DFVfFluidStandardRegularizerKernel *do_create() const;
+
+ const std::string do_get_descr() const;
+
+ float m_mu;
+ float m_lambda;
+ float m_relax;
+};
+
+NS_MIA_END
+#endif
diff --git a/mia/2d/vfregularizerkernel/test_fluid-generic.cc b/mia/2d/vfregularizerkernel/test_fluid-generic.cc
new file mode 100644
index 0000000..eb550fe
--- /dev/null
+++ b/mia/2d/vfregularizerkernel/test_fluid-generic.cc
@@ -0,0 +1,202 @@
+/* -*- mia-c++ -*-
+ *
+ * This file is part of MIA - a toolbox for medical image analysis
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
+ *
+ * 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/vfregularizerkernel/fluid-generic.hh>
+
+using namespace mia;
+
+
+
+BOOST_AUTO_TEST_CASE( test_evaluate_row_evaluation_one_element )
+{
+ float mu = 1.2;
+ float lambda = 1.1;
+ float relax = 1.8;
+
+
+ float c = 1 / (6.0f * mu + 2.0f * (mu + lambda));
+ float a = mu * c;
+ float _b = (mu + lambda) * c;
+
+ float a_b = a + _b; // mu + lambda
+ float b_4 = 0.25 * _b; // 0.25 * (mu + lambda)
+
+ cvdebug() << "a=" << a << ", b4=" << b_4 << ", a+b=" << a_b << ", c=" << c << "\n";
+
+ std::stringstream test_kernel;
+ test_kernel << "fluid:mu=" << mu << ",lambda="<<lambda<<",relax="<< relax;
+
+ auto kernel = BOOST_TEST_create_from_plugin<C2DFVfFluidStandardRegularizerKernelPlugin>(test_kernel.str().c_str());
+
+ C2DBounds size(3, 3);
+ C2DFVectorfield v(size);
+ C2DFVectorfield b(size);
+
+ C2DFVector b11(2,1);
+
+ b(1,1) = b11;
+
+ const C2DFVector Vmm0(1,2);
+ const C2DFVector V0m0(2,4);
+ const C2DFVector Vpm0(2,4);
+
+ const C2DFVector Vm00(3,6);
+ const C2DFVector V000(4,2);
+ const C2DFVector Vp00(5,1);
+
+ const C2DFVector Vmp0(0,2);
+ const C2DFVector V0p0(9,5);
+ const C2DFVector Vpp0(2,3);
+
+
+ const C2DFVector fill(1000,2000);
+
+ const std::vector<C2DFVector> v_init = {
+ Vmm0, V0m0, Vpm0,
+ Vm00, V000, Vp00,
+ Vmp0, V0p0, Vpp0,
+ };
+
+ copy(v_init.begin(), v_init.end(), v.begin());
+
+ C2DFVector vdxx = Vm00 + Vp00;
+ C2DFVector vdyy = V0m0 + V0p0;
+
+
+ C2DFVector p(a_b*vdxx.x + a*vdyy.x,
+ a_b*vdyy.y + a*vdxx.y);
+
+
+ float vxdxy = Vmm0.x + Vpp0.x - Vpm0.x - Vmp0.x;
+ float vydxy = Vmm0.y + Vpp0.y - Vpm0.y - Vmp0.y;
+
+ C2DFVector q(vydxy,vxdxy);
+
+ C2DFVector R = b11 + p + b_4 * q;
+ C2DFVector delta = relax * (R - V000);
+
+ C2DFVector v000 = V000 + delta;
+
+ kernel->set_data_fields(&v, &b);
+
+ auto buf = kernel->get_buffers();
+ float residuum = kernel->evaluate_row(1, *buf);
+
+ auto test_v = v(1,1);
+
+ BOOST_CHECK_CLOSE(residuum, delta.norm(), 0.1);
+
+ BOOST_CHECK_CLOSE(test_v.x, v000.x, 0.1);
+ BOOST_CHECK_CLOSE(test_v.y, v000.y, 0.1);
+
+}
+
+BOOST_AUTO_TEST_CASE( test_evaluate_row_evaluation )
+{
+
+ float mu = 1.2;
+ float lambda = 1.1;
+ float relax = 1.8;
+
+
+ float c = 1 / (6.0f * mu + 2.0f * (mu + lambda));
+ float a = mu * c;
+ float _b = (mu + lambda) * c;
+
+ float a_b = a + _b; // mu + lambda
+ float b_4 = 0.25 * _b; // 0.25 * (mu + lambda)
+
+ cvdebug() << "a=" << a << ", b4=" << b_4 << ", a+b=" << a_b << ", c=" << c << "\n";
+
+ std::stringstream test_kernel;
+ test_kernel << "fluid:mu=" << mu << ",lambda="<<lambda<<",relax="<< relax;
+
+ auto kernel = BOOST_TEST_create_from_plugin<C2DFVfFluidStandardRegularizerKernelPlugin>(test_kernel.str().c_str());
+
+ C2DBounds size(5, 3);
+ C2DFVectorfield v(size);
+ C2DFVectorfield b(size);
+
+ C2DFVector b111(2,1);
+ C2DFVector b211(2,2);
+ C2DFVector b311(1,2);
+
+ b(1,1) = b111;
+ b(2,1) = b211;
+ b(3,1) = b311;
+
+ const C2DFVector fill(1000,2000);
+
+ const C2DFVector Vm0[5] = {C2DFVector(2,6), C2DFVector(1,3), C2DFVector(4,6), C2DFVector(2, 2), C2DFVector(5,2)};
+ const C2DFVector V00[5] = {C2DFVector(3,2), C2DFVector(2,1), C2DFVector(3,1), C2DFVector(1, 3), C2DFVector(3,1)};
+ C2DFVector T00[5] = {C2DFVector(3,2), C2DFVector(2,1), C2DFVector(3,1), C2DFVector(1, 3), C2DFVector(3,1)};
+ const C2DFVector Vp0[5] = {C2DFVector(1,4), C2DFVector(7,3), C2DFVector(1,6), C2DFVector(3, 2), C2DFVector(1,2)};
+
+
+ copy(Vm0, Vm0 + 5, v.begin_at(0,0));
+ copy(V00, V00 + 5, v.begin_at(0,1));
+ copy(Vp0, Vp0 + 5, v.begin_at(0,2));
+
+
+ float test_residuum = 0.0f;
+
+ for (int x = 1; x < 4; ++x) {
+ C2DFVector vdxx = T00[x+1] + T00[x-1];
+ C2DFVector vdyy = Vm0[x] + Vp0[x];
+
+ C2DFVector p(a_b*vdxx.x + a*vdyy.x,
+ a_b*vdyy.y + a*vdxx.y);
+
+
+ float vydxy = Vm0[x-1].y + Vp0[x+1].y - Vm0[x+1].y - Vp0[x-1].y;
+ float vxdxy = Vm0[x-1].x + Vp0[x+1].x - Vm0[x+1].x - Vp0[x-1].x;
+
+
+
+ C2DFVector q(vydxy,vxdxy);
+
+ C2DFVector R = b(x,1) + p + b_4 * q;
+ C2DFVector delta = relax * (R - T00[x]);
+
+ cvdebug() << "vdxx="<< vdxx << ", vdyy=" << vdyy << "\n";
+ cvdebug() << "p="<< p << ", q=" << q << ", delta=" << delta << "\n";
+
+ test_residuum += delta.norm();
+
+ T00[x] += delta;
+
+ }
+
+
+ kernel->set_data_fields(&v, &b);
+
+ auto buf = kernel->get_buffers();
+ float residuum = kernel->evaluate_row(1, *buf);
+
+ BOOST_CHECK_CLOSE(residuum, test_residuum, 0.1);
+
+
+ for (int x = 1; x < 4; ++x) {
+ BOOST_CHECK_CLOSE(v(x,1).x, T00[x].x, 0.1);
+ BOOST_CHECK_CLOSE(v(x,1).y, T00[x].y, 0.1);
+ }
+
+}
diff --git a/mia/3d.hh b/mia/3d.hh
index 084e83f..a13f314 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/mia/3d/.gitignore b/mia/3d/.gitignore
deleted file mode 100644
index 2904d0a..0000000
--- a/mia/3d/.gitignore
+++ /dev/null
@@ -1,3 +0,0 @@
-*.hdr
-*.img
-
diff --git a/mia/3d/2dimagefifofilter.cc b/mia/3d/2dimagefifofilter.cc
index 2754a8c..decd199 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -121,7 +121,7 @@ TPluginHandler<C2DFifoFilterPlugin>::m_help =
"These filters work on a stack of 2D images in a 3D manner by interpreting the images of the stack "
"as slices of a 3D image. For spacial filters with a fixed filter width that is small compared to "
"the number of slices the filter is applied in a true 3D manner. "
- "For other filters, that would normaly require to work on the whole image domain at once, the "
+ "For other filters, that would normally require to work on the whole image domain at once, the "
"image filter is only applied to a subset of the images at a time which results in a quasi-3D processing "
" that may require additional post-processing.";
diff --git a/mia/3d/2dimagefifofilter.hh b/mia/3d/2dimagefifofilter.hh
index 7cb3563..ec60932 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 77e8e65..0c3cf7b 100644
--- a/mia/3d/CMakeLists.txt
+++ b/mia/3d/CMakeLists.txt
@@ -16,17 +16,6 @@
# along with this program; if not, see <http://www.gnu.org/licenses/>.
#
-
-IF(ITPP_FOUND)
- SET(ITPP_SRC
- ica.cc
- )
- SET(ITPP_HEADER
- ica.hh
- )
-ENDIF(ITPP_FOUND)
-
-
SET(MIA3D_SRC
affine_matrix.cc
camera.cc
@@ -40,6 +29,7 @@ SET(MIA3D_SRC
fullcost.cc
fuzzyseg.cc
fuzzyclustersolver_cg.cc
+ ica.cc
image.cc
imagedraw.cc
imageio.cc
@@ -70,8 +60,9 @@ SET(MIA3D_SRC
transformfactory.cc
transformio.cc
vectorfield.cc
+ vfregularizer.cc
+ vfregularizerkernel.cc
vfio.cc
- ${ITPP_SRC}
)
SET(MIA3D_HEADERS
@@ -80,13 +71,11 @@ SET(MIA3D_HEADERS
datafield.hh datafield.cxx
image.hh
filter.hh
+ ica.hh
imagedraw.cc
imageio.hh
imagetest.hh
imageiotest.hh
- vector.hh
- vfio.hh
- vfiotest.hh
camera.hh
cost.hh
creator.hh
@@ -129,9 +118,13 @@ SET(MIA3D_HEADERS
transformfactory.hh
transformio.hh
transformmock.hh
- ${ITPP_HEADER}
valueattributetranslator.hh
+ vector.hh
vectorfield.hh
+ vfregularizer.hh
+ vfregularizerkernel.hh
+ vfio.hh
+ vfiotest.hh
)
SET(MIA3DTEST_SRC
@@ -183,6 +176,7 @@ ENDIF(APPLE)
#
# Testing
#
+IF(MIA_ENABLE_TESTING)
ADD_EXECUTABLE(test-3d ${MIA3DTEST_SRC})
SET_TARGET_PROPERTIES(test-3d PROPERTIES COMPILE_FLAGS -DBOOST_TEST_DYN_LINK)
TARGET_LINK_LIBRARIES(test-3d mia3dtest ${MIA3DLIBS} ${BOOST_UNITTEST})
@@ -202,9 +196,7 @@ TEST_3D(nfg nfg)
TEST_3D(vectorfield vectorfield)
TEST_3D(orientation orientation)
TEST_3D(deform deform)
-IF(ITPP_FOUND)
- TEST_3D(ica ica)
-ENDIF(ITPP_FOUND)
+TEST_3D(ica ica)
TEST_3D(transformfactory transformfactory)
TEST_3D(rigidregister rigidregister)
TEST_3D(nonrigidregister nonrigidregister)
@@ -227,6 +219,7 @@ TEST_3D(rot rot)
TEST_3D(splinetransformpenalty splinetransformpenalty)
TEST_3D(imageio imageio)
+ENDIF()
#
# installation
#
@@ -244,10 +237,13 @@ ADD_SUBDIRECTORY(filter )
ADD_SUBDIRECTORY(fifof )
ADD_SUBDIRECTORY(fullcost )
ADD_SUBDIRECTORY(io )
+ADD_SUBDIRECTORY(lmio)
ADD_SUBDIRECTORY(maskedcost )
ADD_SUBDIRECTORY(reg3d )
ADD_SUBDIRECTORY(shapes )
ADD_SUBDIRECTORY(splinepenalty )
ADD_SUBDIRECTORY(transform)
ADD_SUBDIRECTORY(transio)
-ADD_SUBDIRECTORY(lmio)
+ADD_SUBDIRECTORY(vfregularizerkernel)
+ADD_SUBDIRECTORY(vfregularizer)
+
diff --git a/mia/3d/affine_matrix.cc b/mia/3d/affine_matrix.cc
index e3aee8b..5b89269 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 b00e0b9..d80e80b 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 f64400c..2c54d4b 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 154d5e8..1245235 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 7420b61..e03ab64 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 e18748a..7b9d50f 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 df90dbe..f9f82c1 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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.hh b/mia/3d/combiner/ops.hh
index 0a77847..f43030f 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 de81110..be5ef2e 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 8a3e2af..88aa78e 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 f4c07d2..a1b995c 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 955b7e9..69e53fb 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,10 +35,9 @@ TPluginHandler<TFactory<C3DImageCost>>::m_help =
"care of transforming and scaling the images during the image registration process.";
template class TCost<C3DImage, C3DFVectorfield>;
-template class TPlugin<C3DImage, cost_type>;
-template class TFactory<C3DImageCost>;
-template class THandlerSingleton<TFactoryPluginHandler<C3DImageCostPlugin> >;
-template class TFactoryPluginHandler<C3DImageCostPlugin>;
-template class TPluginHandler<C3DImageCostPlugin>;
+
+EXPLICIT_INSTANCE_HANDLER(C3DImageCost);
+
+
NS_MIA_END
diff --git a/mia/3d/cost.hh b/mia/3d/cost.hh
index aa26cca..679844c 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,6 +52,9 @@ typedef TFactory<C3DImageCost> C3DImageCostPlugin;
*/
typedef THandlerSingleton<TFactoryPluginHandler<C3DImageCostPlugin> > C3DImageCostPluginHandler;
+template <> const char * const TPluginHandler<C3DImageCostPlugin>::m_help;
+extern template class EXPORT_3D THandlerSingleton<TFactoryPluginHandler<C3DImageCostPlugin> >;
+
/// @cond NEVER
FACTORY_TRAIT(C3DImageCostPluginHandler);
/// @endcond
diff --git a/mia/3d/cost/lncc.cc b/mia/3d/cost/lncc.cc
index 8d812cf..e01c853 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,6 +34,7 @@ using std::make_pair;
CLNCC3DImageCost::CLNCC3DImageCost(int hw):
m_hwidth(hw)
{
+ m_copy_to_double = produce_3dimage_filter("convert:repn=double,map=copy");
}
inline pair<C3DBounds, C3DBounds> prepare_range(const C3DBounds& size, int cx, int cy, int cz, int hw)
@@ -65,8 +66,7 @@ public:
m_hw(hw)
{}
- template <typename T, typename R>
- float operator () ( const T& mov, const R& ref) const {
+ float operator () ( const C3DDImage& mov, const C3DDImage& ref) const {
auto evaluate_local_cost = [this, &mov, &ref](const C1DParallelRange& range, const pair<float, int>& result) -> pair<float, int> {
CThreadMsgStream msks;
float lresult = 0.0;
@@ -113,8 +113,12 @@ public:
double CLNCC3DImageCost::do_value(const Data& a, const Data& b) const
{
- FEvalCost ecost(m_hwidth);
- return mia::filter(ecost, a, b);
+ FEvalCost ecost(m_hwidth);
+ auto a_double_ptr = m_copy_to_double->filter(a);
+ auto b_double_ptr = m_copy_to_double->filter(b);
+ const C3DDImage& mov = static_cast<const C3DDImage&>(*a_double_ptr);
+ const C3DDImage& ref = static_cast<const C3DDImage&>(*b_double_ptr);
+ return ecost(mov, ref);
}
@@ -127,8 +131,7 @@ public:
m_force(force)
{}
- template <typename T, typename R>
- float operator () ( const T& mov, const R& ref) const {
+ float operator () ( const C3DDImage& mov, const C3DDImage& ref) const {
auto ag = get_gradient(mov);
auto evaluate_local_cost_force = [this, &mov, &ref, &ag](const C1DParallelRange& range,
const pair<float, int>& result) -> pair<float, int> {
@@ -185,8 +188,13 @@ public:
double CLNCC3DImageCost::do_evaluate_force(const Data& a, const Data& b, Force& force) const
{
- FEvalCostForce ecostforce(m_hwidth, force);
- return mia::filter(ecostforce, a, b);
+ FEvalCostForce ecostforce(m_hwidth, force);
+ auto a_double_ptr = m_copy_to_double->filter(a);
+ auto b_double_ptr = m_copy_to_double->filter(b);
+ const C3DDImage& mov = static_cast<const C3DDImage&>(*a_double_ptr);
+ const C3DDImage& ref = static_cast<const C3DDImage&>(*b_double_ptr);
+
+ return ecostforce(mov, ref);
}
diff --git a/mia/3d/cost/lncc.hh b/mia/3d/cost/lncc.hh
index 1fa879c..e3fe3db 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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_3d_maskedcost_lncc_hh
#include <mia/3d/cost.hh>
+#include <mia/3d/filter.hh>
#define NS mia_3d_lncc
@@ -36,7 +37,8 @@ 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;
- int m_hwidth;
+ int m_hwidth;
+ mia::P3DFilter m_copy_to_double;
};
class CLNCC3DImageCostPlugin: public mia::C3DImageCostPlugin {
diff --git a/mia/3d/cost/mi.cc b/mia/3d/cost/mi.cc
index cf0ae19..53a24db 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 9f440fb..2935ba5 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 e1db830..d29987c 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,27 +32,25 @@ using namespace mia;
CNCC3DImageCost::CNCC3DImageCost()
{
+ m_copy_to_double = produce_3dimage_filter("convert:repn=double,map=copy");
}
-template <typename T, typename S>
struct FEvaluateNCCSum {
- FEvaluateNCCSum(const T& mov, const S& ref);
+ FEvaluateNCCSum(const C3DDImage& mov, const C3DDImage& ref);
NCCSums operator ()(const C1DParallelRange& range, const NCCSums& sumacc) const;
private:
- T m_mov;
- S m_ref;
+ const C3DDImage& m_mov;
+ const C3DDImage& m_ref;
};
-template <typename T, typename S>
-FEvaluateNCCSum<T,S>::FEvaluateNCCSum(const T& mov, const S& ref):
+FEvaluateNCCSum::FEvaluateNCCSum(const C3DDImage& mov, const C3DDImage& ref):
m_mov(mov), m_ref(ref)
{
}
-template <typename T, typename S>
-NCCSums FEvaluateNCCSum<T,S>::operator ()(const C1DParallelRange& range, const NCCSums& sumacc) const
+NCCSums FEvaluateNCCSum::operator ()(const C1DParallelRange& range, const NCCSums& sumacc) const
{
CThreadMsgStream msks;
@@ -70,27 +68,20 @@ NCCSums FEvaluateNCCSum<T,S>::operator ()(const C1DParallelRange& range, const N
return sum + sumacc;
};
-
-class FEvalCost : public TFilter<float> {
-public:
- template <typename T, typename R>
- float operator () ( const T& mov, const R& ref) const {
-
- FEvaluateNCCSum<T,R> ev(mov, ref);
- NCCSums sum;
- sum = preduce(C1DParallelRange(0, mov.get_size().z, 1), sum, ev,
- [](const NCCSums& x, const NCCSums& y){
- return x + y;
- });
- return sum.value();
- }
-};
-
-
double CNCC3DImageCost::do_value(const Data& a, const Data& b) const
{
- FEvalCost ecost;
- return mia::filter(ecost, a, b);
+ auto a_double_ptr = m_copy_to_double->filter(a);
+ auto b_double_ptr = m_copy_to_double->filter(b);
+ const C3DDImage& mov = static_cast<const C3DDImage&>(*a_double_ptr);
+ const C3DDImage& ref = static_cast<const C3DDImage&>(*b_double_ptr);
+
+ FEvaluateNCCSum ev(mov, ref);
+ NCCSums sum;
+ sum = preduce(C1DParallelRange(0, mov.get_size().z, 1), sum, ev,
+ [](const NCCSums& x, const NCCSums& y){
+ return x + y;
+ });
+ return sum.value();
}
@@ -101,12 +92,11 @@ public:
m_force(force)
{}
- template <typename T, typename R>
- float operator () ( const T& mov, const R& ref) const {
+ float operator () ( const C3DDImage& mov, const C3DDImage& ref) const {
CThreadMsgStream msks;
NCCSums sum;
- FEvaluateNCCSum<T,R> ev(mov, ref);
+ FEvaluateNCCSum ev(mov, ref);
sum = preduce(C1DParallelRange(0, mov.get_size().z, 1), sum, ev,
[](const NCCSums& x, const NCCSums& y){
return x + y;
@@ -141,8 +131,12 @@ public:
double CNCC3DImageCost::do_evaluate_force(const Data& a, const Data& b, Force& force) const
{
- FEvalCostForce ecostforce(force);
- return mia::filter(ecostforce, a, b);
+ FEvalCostForce ecostforce(force);
+ auto a_double_ptr = m_copy_to_double->filter(a);
+ auto b_double_ptr = m_copy_to_double->filter(b);
+ const C3DDImage& mov = static_cast<const C3DDImage&>(*a_double_ptr);
+ const C3DDImage& ref = static_cast<const C3DDImage&>(*b_double_ptr);
+ return ecostforce(mov, ref);
}
diff --git a/mia/3d/cost/ncc.hh b/mia/3d/cost/ncc.hh
index 78a6175..c3461e2 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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_3d_cost_ncc_hh
#include <mia/3d/cost.hh>
+#include <mia/3d/filter.hh>
#define NS mia_3d_ncc
@@ -35,7 +36,8 @@ public:
CNCC3DImageCost();
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;
+ mia::P3DFilter m_copy_to_double;
};
class CNCC3DImageCostPlugin: public mia::C3DImageCostPlugin {
diff --git a/mia/3d/cost/ngf.cc b/mia/3d/cost/ngf.cc
index b7c48a1..43eeb73 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 8287b17..50a1b6d 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 97a4bce..4d67bcf 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 1bbc387..6749efe 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 7581f67..10f0f18 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 f1bd40c..b72e81d 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 749b9d6..137fc87 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 c79ebe3..380ba74 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 da188be..1afd2f3 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 8d3de51..b6322be 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 a3a3f52..715f8fc 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 d3c9a87..37633e7 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 1d78e27..1b1fc1a 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 f249b9f..bf3c796 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 9a39463..2b6845d 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 94f4ff2..4d1084e 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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.hh b/mia/3d/creator/lattic.hh
index 76e1207..3da3eec 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 761c832..50d1164 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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.hh b/mia/3d/creator/sphere.hh
index e9f81ff..a4b6b0f 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 4c80eb6..9a3c5ae 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 086cabb..918b215 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 0922d66..91f59b1 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 3013483..9984de2 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 9ae3839..5f62698 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -42,34 +42,6 @@ T3DDatafield<bool>::strip_avg()
}
-template <>
-T3DDatafield<bool>::value_type
-T3DDatafield<bool>::get_trilin_interpol_val_at(const T3DVector<float >& p) const
-{
- // Calculate the coordinates and the distances
- size_t x = (size_t )p.x;
- size_t y = (size_t )p.y;
- size_t z = (size_t )p.z;
- float fx = p.x-x;
- float fy = p.y-y;
- float fz = p.z-z;
-
- float dx = 1-fx;
- float dy = 1-fy;
- float dz = 1-fz;
-
- 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));
-
- 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>; \
@@ -84,17 +56,15 @@ T3DDatafield<bool>::get_trilin_interpol_val_at(const T3DVector<float >& p) const
INSTANCIATE(double);
INSTANCIATE(float);
-INSTANCIATE(unsigned int);
-INSTANCIATE(int);
+INSTANCIATE(int8_t);
+INSTANCIATE(int16_t);
+INSTANCIATE(int32_t);
+INSTANCIATE(int64_t);
+INSTANCIATE(uint8_t);
+INSTANCIATE(uint16_t);
+INSTANCIATE(uint32_t);
+INSTANCIATE(uint64_t);
-#ifdef LONG_64BIT
-INSTANCIATE(signed long);
-INSTANCIATE(unsigned long);
-#endif
-INSTANCIATE(short);
-INSTANCIATE(unsigned short);
-INSTANCIATE(unsigned char );
-INSTANCIATE(signed char);
template class T3DDatafield<bool>;
DEFINE_TYPE_DESCR2(C3DBounds, "3dbounds");
diff --git a/mia/3d/datafield.cxx b/mia/3d/datafield.cxx
index eb31b2f..520e7ea 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,12 +21,13 @@
#ifndef __3ddatafield_cxx
#define __3ddatafield_cxx
-
-#include <cstring>
#include <mia/core/msgstream.hh>
#include <mia/2d/datafield.hh>
#include <mia/3d/datafield.hh>
+#include <cassert>
+#include <cstring>
+
NS_MIA_BEGIN
@@ -38,7 +39,7 @@ template <typename T>
T3DDatafield<T>::T3DDatafield():
m_size(C3DBounds(0,0,0)),
m_xy(0),
- m_data(new data_array(0))
+ m_data(0)
{
}
@@ -54,7 +55,7 @@ template <typename T>
T3DDatafield<T>::T3DDatafield(const C3DBounds& size ):
m_size(size),
m_xy(static_cast<size_t>(size.x) * static_cast<size_t>(size.y)),
- m_data(new data_array(m_xy * static_cast<size_t>(size.z)))
+ m_data(m_xy * static_cast<size_t>(size.z))
{
}
@@ -62,17 +63,18 @@ template <typename T>
T3DDatafield<T>::T3DDatafield(const C3DBounds& size, const T *data):
m_size(size),
m_xy(static_cast<size_t>(size.x) * static_cast<size_t>(size.y)),
- m_data(new data_array(m_xy * static_cast<size_t>(size.z)))
+ m_data(m_xy * static_cast<size_t>(size.z))
{
- std::copy(data, data + m_data->size(), m_data->begin());
+ std::copy(data, data + m_data.size(), m_data.begin());
}
template <typename T>
T3DDatafield<T>::T3DDatafield(const C3DBounds& size, const data_array& data):
m_size(size),
m_xy(size.x * size.y),
- m_data(new data_array(data))
+ m_data(data)
{
+ assert(m_data.size() == m_size.product());
}
template <typename T>
@@ -83,70 +85,14 @@ T3DDatafield<T>::~T3DDatafield()
template <typename T>
void T3DDatafield<T>::make_single_ref()
{
- if (!m_data.unique())
- m_data = ref_data_type( new data_array(*m_data) );
}
-template <typename T>
-typename T3DDatafield<T>::value_type
-T3DDatafield<T>::get_interpol_val_at(const T3DVector<float >& p) const
-{
- return get_trilin_interpol_val_at(p);
-}
-
-template <typename T>
-typename T3DDatafield<T>::value_type
-T3DDatafield<T>::operator()(const T3DVector<float >& pos)const
-{
- return get_trilin_interpol_val_at(pos);
-}
-
-template <typename T>
-typename T3DDatafield<T>::value_type
-T3DDatafield<T>::get_trilin_interpol_val_at(const T3DVector<float >& p) const
-{
- // Calculate the coordinates and the distances
- size_t x = (size_t)p.x;
- size_t y = (size_t)p.y;
- size_t z = (size_t)p.z;
- float fx = p.x-x;
- float fy = p.y-y;
- float fz = p.z-z;
-
- float dx = 1-fx;
- float dy = 1-fy;
- float dz = 1-fz;
-
- if ( x < m_size.x-1 && y < m_size.y -1 && z < m_size.z -1 ) {
-
- const T *ptr = &(*this)[x + m_size.x * (y +m_size.y * z)];
- const T *ptr_h = &ptr[m_size.x];
- const T *ptr2 = &ptr[m_xy];
- const T *ptr2_h = &ptr2[m_size.x];
- const T a1 = T(dx * ptr[0] + fx * ptr[1]);
- const T a3 = T(dx * ptr_h[0] + fx * ptr_h[1]);
- const T a5 = T(dx * ptr2[0] + fx * ptr2[1]);
- const T a7 = T(dx * ptr2_h[0] + fx * ptr2_h[1]);
- const T b1 = T(dy * a1 + fy * a3);
- const T b2 = T(dy * a5 + fy * a7);
- return T(dz * b1 + fz * b2);
- } else {
- const T a1 = T(dx * (*this)(x , y , z ) + fx * (*this)(x+1, y , z ));
- const T a3 = T(dx * (*this)(x , y+1, z ) + fx * (*this)(x+1, y+1, z ));
- const T a5 = T(dx * (*this)(x , y , z+1) + fx * (*this)(x+1, y , z+1));
- const T a7 = T(dx * (*this)(x , y+1, z+1) + fx * (*this)(x+1, y+1, z+1));
- const T b1 = T(dy * a1 + fy * a3);
- const T b2 = T(dy * a5 + fy * a7);
- return T(dz * b1 + fz * b2);
- }
-}
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);
}
@@ -241,14 +187,14 @@ void T3DDatafield<T>::get_data_line_x(int y, int z, std::vector<T>& result)const
{
result.resize(m_size.x);
const size_t start = m_xy * z + static_cast<size_t>(m_size.x) * y;
- __mia_copy_dispatch<T, value_type>::apply_read(result, *m_data, start, m_size.x);
+ __mia_copy_dispatch<T, value_type>::apply_read(result, m_data, start, m_size.x);
}
template <typename T>
void T3DDatafield<T>::get_data_line_y(int x, int z, std::vector<T>& result)const
{
result.resize(m_size.y);
- auto i = m_data->begin() + static_cast<size_t>(x) + m_xy * z;
+ 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;
@@ -261,7 +207,7 @@ void T3DDatafield<T>::get_data_line_z(int x, int y, std::vector<T>& result)const
size_t start = static_cast<size_t>(x) + static_cast<size_t>(m_size.x) * y;
- auto i = m_data->begin() + start;
+ auto i = m_data.begin() + start;
auto k = result.begin();
if (m_size.z > 8) {
@@ -291,9 +237,8 @@ template <typename T>
void T3DDatafield<T>::put_data_line_x(int y, int z, const std::vector<T>& input)
{
assert(input.size() == m_size.x);
- make_single_ref();
size_t start = m_size.x * (y + z * m_size.y);
- __mia_copy_dispatch<value_type, T>::apply_write(*m_data, input, start, m_size.x);
+ __mia_copy_dispatch<value_type, T>::apply_write(m_data, input, start, m_size.x);
}
template <typename T>
@@ -301,10 +246,9 @@ void T3DDatafield<T>::put_data_line_y(int x, int z, const std::vector<T>& input)
{
assert(input.size() == m_size.y);
- make_single_ref();
size_t start= x + m_size.x * m_size.y * z;
- auto k = m_data->begin() + start;
+ auto k = m_data.begin() + start;
for (auto i = input.begin();
i != input.end(); ++i, k += m_size.x)
@@ -316,10 +260,9 @@ void T3DDatafield<T>::put_data_line_z(int x, int y, const std::vector<T>& input)
{
assert(input.size() == m_size.z);
- make_single_ref();
size_t start= x + m_size.x * y;
- auto k = m_data->begin() + start;
+ auto k = m_data.begin() + start;
for (auto i = input.begin();
i != input.end(); ++i, k += m_xy)
@@ -330,18 +273,29 @@ void T3DDatafield<T>::put_data_line_z(int x, int y, const std::vector<T>& input)
template <typename T>
T3DDatafield<T>& T3DDatafield<T>::operator = (const T3DDatafield<T>& org)
{
- if (&org == this) {
- return *this;
+ if (&org != this) {
+ m_size = org.m_size;
+ m_xy = org.m_xy;
+ m_data = org.m_data;
}
-
- m_size = org.m_size;
- m_xy = org.m_xy;
- m_data = org.m_data;
return *this;
}
template <typename T>
+T3DDatafield<T>& T3DDatafield<T>::operator = (T3DDatafield<T>&& org)
+{
+ if (&org != this) {
+ m_size = org.m_size;
+ m_xy = org.m_xy;
+ m_data.swap(org.m_data);
+ }
+
+ return *this;
+}
+
+
+template <typename T>
T3DDatafield<T>::T3DDatafield(const T3DDatafield<T>& org):
m_size(org.m_size),
m_xy(org.m_xy),
@@ -350,6 +304,15 @@ T3DDatafield<T>::T3DDatafield(const T3DDatafield<T>& org):
}
template <typename T>
+T3DDatafield<T>::T3DDatafield(T3DDatafield<T>&& org):
+ m_size(org.m_size),
+ m_xy(org.m_xy)
+{
+ m_data.swap(org.m_data);
+}
+
+
+template <typename T>
T2DDatafield<T> T3DDatafield<T>::get_data_plane_xy(size_t z)const
{
assert(z < get_size().z);
@@ -365,7 +328,7 @@ void T3DDatafield<T>::read_zslice_flat(size_t z, std::vector<atomic_type>& buffe
{
assert(z < get_size().z);
assert(m_xy * m_elements <= buffer.size());
- __copy_dispatch<value_type>::apply_read(buffer, 0, *m_data, z * m_xy, m_xy);
+ __copy_dispatch<value_type>::apply_read(buffer, 0, m_data, z * m_xy, m_xy);
}
@@ -374,7 +337,7 @@ void T3DDatafield<T>::write_zslice_flat(size_t z, const std::vector<atomic_type>
{
assert(z < get_size().z);
assert(m_xy * m_elements <= buffer.size());
- __copy_dispatch<value_type>::apply_write(*m_data, z * m_xy, buffer, 0, m_xy);
+ __copy_dispatch<value_type>::apply_write(m_data, z * m_xy, buffer, 0, m_xy);
}
@@ -387,7 +350,7 @@ void T3DDatafield<T>::read_yslice_flat(size_t y, std::vector<atomic_type>& buffe
const size_t offset = y * get_size().x;
for (size_t z = 0; z < get_size().z; ++z) {
__copy_dispatch<value_type>::apply_read(buffer, z * get_size().x * m_elements,
- *m_data, offset + z * m_xy, get_size().x);
+ m_data, offset + z * m_xy, get_size().x);
}
}
@@ -399,7 +362,7 @@ void T3DDatafield<T>::write_yslice_flat(size_t y, const std::vector<atomic_type>
const size_t offset = y * get_size().x;
for (size_t z = 0; z < get_size().z; ++z) {
- __copy_dispatch<value_type>::apply_write(*m_data, offset + z * m_xy,
+ __copy_dispatch<value_type>::apply_write(m_data, offset + z * m_xy,
buffer, z * get_size().x * m_elements,
get_size().x);
}
@@ -416,7 +379,7 @@ void T3DDatafield<T>::read_xslice_flat(size_t x, std::vector<atomic_type>& buffe
size_t doffs = get_size().x;
for (size_t i = 0; i < slice_size; ++i, offset += doffs) {
__copy_dispatch<value_type>::apply_read(buffer, m_elements * i,
- *m_data, offset, 1);
+ m_data, offset, 1);
}
}
@@ -430,7 +393,7 @@ void T3DDatafield<T>::write_xslice_flat(size_t x, const std::vector<atomic_type>
size_t offset = x;
size_t doffs = get_size().x;
for (size_t i = 0; i < slice_size; ++i, offset += doffs) {
- __copy_dispatch<value_type>::apply_write(*m_data, offset,
+ __copy_dispatch<value_type>::apply_write(m_data, offset,
buffer, m_elements * i, 1);
}
}
@@ -540,7 +503,6 @@ template <typename T>
typename T3DDatafield<T>::value_type
T3DDatafield<T>::strip_avg()
{
- make_single_ref();
T Avg = get_avg();
// first calculate avrg.
iterator r = begin();
@@ -555,8 +517,7 @@ T3DDatafield<T>::strip_avg()
template <typename T>
void T3DDatafield<T>::clear()
{
- make_single_ref();
- std::fill(m_data->begin(), m_data->end(), T());
+ std::fill(m_data.begin(), m_data.end(), T());
}
template <typename T>
diff --git a/mia/3d/datafield.hh b/mia/3d/datafield.hh
index 4ab9b16..a1de2c3 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,18 +56,16 @@ NS_MIA_BEGIN
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);
+DECLARE_EXTERN_ITERATORS(uint32_t);
+DECLARE_EXTERN_ITERATORS(int32_t);
+DECLARE_EXTERN_ITERATORS(int16_t);
+DECLARE_EXTERN_ITERATORS(uint16_t);
+DECLARE_EXTERN_ITERATORS(int8_t);
+DECLARE_EXTERN_ITERATORS(uint8_t);
DECLARE_EXTERN_ITERATORS(bool);
+DECLARE_EXTERN_ITERATORS(int64_t);
+DECLARE_EXTERN_ITERATORS(uint64_t);
-#ifdef LONG_64BIT
-DECLARE_EXTERN_ITERATORS(signed long);
-DECLARE_EXTERN_ITERATORS(unsigned long);
-#endif
DECLARE_EXTERN_ITERATORS(C3DFVector)
DECLARE_EXTERN_ITERATORS(C3DDVector)
@@ -85,21 +83,19 @@ class EXPORT_3D T3DDatafield {
typedef ::std::vector<typename __holder_type_dispatch<T>::type> data_array;
- typedef std::shared_ptr<data_array> ref_data_type;
-
public:
/** makes a single reference of the data, after calling this, it is save to write to the data field
*/
- void make_single_ref();
+ void make_single_ref() __attribute__((deprecated));
/**
Checks whether the data hold by the data field is unique.
\returns true if it is
*/
- bool holds_unique_data()const {
- return m_data.unique();
+ bool holds_unique_data()const __attribute__((deprecated)){
+ return true;
}
@@ -175,7 +171,7 @@ public:
T3DDatafield();
/** Constructor to create empty Datafield if given size */
- T3DDatafield(const C3DBounds& _Size);
+ explicit T3DDatafield(const C3DBounds& _Size);
/** Constructor to create Datafield if given size and with initialization data
\param size the size of the 3D-field
@@ -194,6 +190,9 @@ public:
/** copy - Constructor */
T3DDatafield(const T3DDatafield<T>& org);
+ /** move constructor */
+ T3DDatafield(T3DDatafield<T>&& org);
+
/// make sure the destructor is virtual
virtual ~T3DDatafield();
@@ -213,16 +212,7 @@ public:
T3DVector<Out> get_gradient(int index) const;
/** Interpolate the value of Field at p default uses tri-linear interpolation */
- value_type get_interpol_val_at(const T3DVector<float >& p) const;
-
- /* some rough interpolation using barycentric coordinates, needs less addition and
- multiplications then tri-linear interp. but is usally of low quality
- \remark this function may vanish
- value_type get_barycent_interpol_val_at(const T3DVector<float >& p) const;
- */
-
- /** just as the name says */
- value_type get_trilin_interpol_val_at(const T3DVector<float >& p) const;
+ value_type get_interpol_val_at(const T3DVector<float >& p) const __attribute__((deprecated));
/** Get the average over a given Block
Attn: Type T must be able to hold the Sum of all Elements in Block */
@@ -234,6 +224,9 @@ public:
*/
T3DDatafield& operator = (const T3DDatafield& org);
+ /// Moave asignment
+ T3DDatafield& operator = (T3DDatafield&& org);
+
/** \returns the 3D-size of the data field */
const C3DBounds& get_size() const
{
@@ -246,7 +239,7 @@ public:
/** \returns the number of elements in the datafield */
size_type size()const
{
- return m_data->size();
+ return m_data.size();
}
/// swap the data ofthis 3DDatafield with another one
@@ -259,17 +252,12 @@ public:
\returns the stripped average */
value_type strip_avg();
-
- /** interpolating access operator */
- value_type operator()(const T3DVector<float >& pos)const;
-
/** read-only indx operator */
const_reference operator()(size_t x, size_t y, size_t z) const
{
// Look if we are inside, and give reference, else give the zero
if (x < m_size.x && y < m_size.y && z < m_size.z) {
- const data_array& data = *m_data;
- return data[x+ m_size.x * (y + m_size.y * z)];
+ return m_data[x+ m_size.x * (y + m_size.y * z)];
}
return Zero;
}
@@ -287,7 +275,7 @@ public:
// Look if we are inside, and give reference, else throw exception
// since write access is wanted
assert(x < m_size.x && y < m_size.y && z < m_size.z);
- return (*m_data)[x + m_size.x *(y + m_size.y * z)];
+ return m_data[x + m_size.x *(y + m_size.y * z)];
}
@@ -427,7 +415,7 @@ public:
/** \returns an read only forward iterator over the whole data field */
const_iterator begin()const
{
- return m_data->begin();
+ return m_data.begin();
}
/**
@@ -435,7 +423,7 @@ public:
*/
const_iterator begin_at(size_t x, size_t y, size_t z)const
{
- return m_data->begin() + (z * m_size.y + y) * m_size.x + x;
+ return m_data.begin() + (z * m_size.y + y) * m_size.x + x;
}
@@ -444,7 +432,7 @@ public:
*/
const_iterator end()const
{
- return m_data->end();
+ return m_data.end();
}
/** \returns an read/write random access iterator over the whole data
@@ -452,8 +440,7 @@ public:
The functions ensures, that the field uses a single referenced datafield */
iterator begin()
{
- make_single_ref();
- return m_data->begin();
+ return m_data.begin();
}
Range get_range(const C3DBounds& start, const C3DBounds& end);
@@ -500,8 +487,7 @@ public:
*/
iterator begin_at(size_t x, size_t y, size_t z)
{
- make_single_ref();
- return m_data->begin() + (z * m_size.y + y) * m_size.x + x;
+ return m_data.begin() + (z * m_size.y + y) * m_size.x + x;
}
/** \returns an read/write random access iterator over the whole data
@@ -509,14 +495,13 @@ public:
The functions ensures, that the field uses a single referenced datafield */
iterator end()
{
- make_single_ref();
- return m_data->end();
+ return m_data.end();
}
/** a linear read only access operator */
const_reference operator[](int i)const
{
- return (*m_data)[i];
+ return m_data[i];
}
/** A linear read/write access operator. The refcount of Data must be 1,
@@ -524,8 +509,7 @@ public:
*/
reference operator[](int i)
{
- assert(m_data.unique());
- return (*m_data)[i];
+ return m_data[i];
}
@@ -543,7 +527,7 @@ private:
size_t m_xy;
/** Pointer to the Field of Data hold by this class */
- ref_data_type m_data;
+ data_array m_data;
/** helper: represents the zero-value */
static const value_type Zero;
@@ -556,20 +540,29 @@ private:
typedef T3DDatafield<float> C3DFDatafield;
/// a data field of 32 bit unsigned int values
-typedef T3DDatafield<unsigned int> C3DUIDatafield;
+typedef T3DDatafield<uint32_t> C3DUIDatafield;
/// a data field of 32 bit signed int values
-typedef T3DDatafield<int> C3DIDatafield;
+typedef T3DDatafield<int32_t> C3DSIDatafield;
+
+/// a data field of 32 bit unsigned int values
+typedef T3DDatafield<uint16_t> C3DUSDatafield;
+/// a data field of 32 bit signed int values
+typedef T3DDatafield<int16_t> C3DSSDatafield;
/// a data field of 32 bit unsigned int values
-typedef T3DDatafield<unsigned long> C3DULDatafield;
+typedef T3DDatafield<uint64_t> C3DULDatafield;
/// a data field of 32 bit signed int values
-typedef T3DDatafield<long> C3DLDatafield;
+typedef T3DDatafield<int64_t> C3DLDatafield;
+
+/// a data field of 8 bit int values
+typedef T3DDatafield<uint8_t> C3DUBDatafield;
+
+/// a data field of 8 bit int values
+typedef T3DDatafield<int8_t> C3DSBDatafield;
- /// a data field of float values
-typedef T3DDatafield<unsigned char> C3DUBDatafield;
/// a data field of float values
typedef T3DDatafield<bool> C3DBitDatafield;
@@ -595,13 +588,12 @@ template <class T>
template <typename Out>
T3DVector<Out> T3DDatafield<T>::get_gradient(size_t x, size_t y, size_t z) const
{
- const std::vector<T>& data = *m_data;
const int sizex = m_size.x;
// Look if we are inside the used space
if (x - 1 < m_size.x - 2 && y - 1 < m_size.y - 2 && z - 1 < m_size.z - 2) {
// Lookup all neccessary Values
- const T *H = &data[x + m_size.x * (y + m_size.y * z)];
+ const T *H = &m_data[x + m_size.x * (y + m_size.y * z)];
return T3DVector<Out> (Out((H[1] - H[-1]) * 0.5),
Out((H[sizex] - H[-sizex]) * 0.5),
@@ -618,7 +610,7 @@ T3DVector<Out> T3DDatafield<T>::get_gradient(int hardcode) const
{
const int sizex = m_size.x;
// Lookup all neccessary Values
- const T *H = &(*m_data)[hardcode];
+ const T *H = &m_data[hardcode];
return T3DVector<Out> (Out((H[1] - H[-1]) * 0.5),
Out((H[sizex] - H[-sizex]) * 0.5),
@@ -635,9 +627,9 @@ T3DVector<Out> T3DDatafield<bool>::get_gradient(int hardcode) const
{
// Lookup all neccessary Values
- return T3DVector<Out> (Out(((*m_data)[hardcode + 1] - (*m_data)[hardcode -1]) * 0.5),
- Out(((*m_data)[hardcode + m_size.x] - (*m_data)[hardcode -m_size.x]) * 0.5),
- Out(((*m_data)[hardcode + m_xy] - (*m_data)[hardcode -m_xy]) * 0.5));
+ return T3DVector<Out> (Out((m_data[hardcode + 1] - m_data[hardcode -1]) * 0.5),
+ Out((m_data[hardcode + m_size.x] - m_data[hardcode -m_size.x]) * 0.5),
+ Out((m_data[hardcode + m_xy] - m_data[hardcode -m_xy]) * 0.5));
}
template <class T>
@@ -646,7 +638,6 @@ T3DVector<Out> T3DDatafield<T>::get_gradient(const T3DVector<float >& p) const
{
// This will become really funny
const int sizex = m_size.x;
- const std::vector<T>& data = *m_data;
// Calculate the int coordinates near the POI
// and the distances
size_t x = size_t (p.x);
@@ -662,7 +653,7 @@ T3DVector<Out> T3DDatafield<T>::get_gradient(const T3DVector<float >& p) const
// Look if we are inside the used space
if (x-1 < m_size.x-3 && y -1 < m_size.y-3 && z - 1 < m_size.z-3 ) {
// Lookup all neccessary Values
- const T *H000 = &data[x + sizex * y + m_xy * z];
+ const T *H000 = &m_data[x + sizex * y + m_xy * z];
const T* H_100 = &H000[-m_xy];
const T* H_101 = &H_100[1];
@@ -740,17 +731,14 @@ T3DVector<Out> T3DDatafield<T>::get_gradient(const T3DVector<float >& p) const
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(uint8_t);
+DECLARE_EXTERN(uint16_t);
+DECLARE_EXTERN(uint32_t);
+DECLARE_EXTERN(uint64_t);
+DECLARE_EXTERN(int8_t);
+DECLARE_EXTERN(int16_t);
+DECLARE_EXTERN(int32_t);
+DECLARE_EXTERN(int64_t);
DECLARE_EXTERN(C3DFVector);
DECLARE_EXTERN(C3DDVector);
diff --git a/mia/3d/defines3d.hh b/mia/3d/defines3d.hh
index bab111a..d3fa51c 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 aaf7b5e..88c25fa 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 902b686..36b9892 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 d26cbfe..76c3ef4 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 cb6e2ca..b9e2b42 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 6e9e2ec..cff28a3 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 eefd927..056844d 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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.hh b/mia/3d/fifof/gauss.hh
index be363c0..3602c66 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 3742674..302b552 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 85a51f2..2d083c2 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 4042c69..737ebcc 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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.hh b/mia/3d/fifof/median.hh
index fb716cb..d2a0a6b 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 ea80a5e..a4877d6 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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.hh b/mia/3d/fifof/mlv.hh
index c71dac6..2aee9cb 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 d3432ad..25914a9 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 2a93060..1b82e4d 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 a7587cc..e80295f 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -205,7 +205,7 @@ const string C2DRegiongrowFifoFilterPlugin::do_get_descr() const
"a 3D image. The region growing is based on class probabilities obtained from "
"a c-means classification of the pixel intensities. One seed thresh is use to initiate "
"a region, and another (lower) threshold is used to stop the region growing. "
- "By holding a number of 3D slices in the working memory to allow the region to grow \""
+ "By holding a number of 3D slices in the working memory to permit the region to grow \""
"backwards \" in the stack a Quasi-3D processing is achieved. However, with complex "
"structures the region growing may not properly be segmented.";
}
diff --git a/mia/3d/fifof/regiongrow.hh b/mia/3d/fifof/regiongrow.hh
index ad1e6fa..d73e6a7 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 c97eeee..7e539de 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,12 +162,12 @@ C2DRGGStackFilterFactory::C2DRGGStackFilterFactory():
{
add_parameter("map", new CStringParameter(m_seed_map, CCmdOptionFlags::required_input, "class probability map"));
add_parameter("st", new CFloatParameter(m_seed_thresh, 0.0, 1.0,
- false, "seed probability threshhold"));
+ false, "seed probability threshold"));
add_parameter("depth", new CIntParameter(m_depth, 1, 30,
false, "number of slices to keep during processing"));
add_parameter("gt", new CFloatParameter(m_gradient_thresh, 4.0,
numeric_limits<float>::max(),
- false, "gradient threshhold"));
+ false, "gradient threshold"));
}
diff --git a/mia/3d/fifof/rgg2pass.cc b/mia/3d/fifof/rgg2pass.cc
index 6ef7efa..d830684 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 fc5694b..705c62c 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 9734003..585f11c 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 122346d..25cae56 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 0e5b09d..be3a349 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 bc64fd1..f7e6d72 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 53ed3fb..69b322f 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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_regiongrow.cc b/mia/3d/fifof/test_regiongrow.cc
index c09a2a4..1019835 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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.cc b/mia/3d/fifotestfixture.cc
index a5978f1..c46fbad 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 ea30b34..b330bef 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 4a875ae..e1d1636 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 22fdd8e..246895a 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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/aniso.cc b/mia/3d/filter/aniso.cc
index cfffcd5..5e646a3 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 0be819a..1e17c4b 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 12e574c..1560fdf 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 8739b8c..65d0959 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 85b59a2..4f467d5 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 eccd467..c3e0cb4 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 582e4d5..6c7a3db 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 b803f88..b0168ac 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 b3c09a9..c4fd1d9 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 ba11d75..4188b17 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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.hh b/mia/3d/filter/crop.hh
index 65748e2..9545ee9 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 823ebb7..1862da4 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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.hh b/mia/3d/filter/distance.hh
index 016e841..9514f97 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 b534984..8825633 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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.hh b/mia/3d/filter/downscale.hh
index d0208a7..b968a67 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 27d84ad..85a5fe5 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 7fcff5a..7d682e1 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 185aeae..70d3428 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -177,7 +177,7 @@ C3DDoGrowmask::result_type C3DDoGrowmask::operator () (const T3DImage<T>& data)
queue <seed_t<T> > pool;
if (data.get_size() != m_start_mask.get_size())
- throw invalid_argument("C3DGrowmask::filter: seed mask and reference must be ofthe same size");
+ throw invalid_argument("C3DGrowmask::filter: seed mask and reference must be of the same size");
C3DBitImage *r = new C3DBitImage(m_start_mask);
r->set_attributes(data.begin_attributes(), data.end_attributes());
P3DImage result(r);
diff --git a/mia/3d/filter/growmask.hh b/mia/3d/filter/growmask.hh
index 1bc9976..5943441 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 12ab250..baa15cf 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 6289c32..d459b20 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 0445750..9f8d246 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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.hh b/mia/3d/filter/kmeans.hh
index 973e5de..4980646 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 03c930c..0e4306e 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 9f500f5..a2200f5 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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/labelmap.cc b/mia/3d/filter/labelmap.cc
index 2779a16..a820c73 100644
--- a/mia/3d/filter/labelmap.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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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/labelmap.hh b/mia/3d/filter/labelmap.hh
index c64f9ef..8f7ca02 100644
--- a/mia/3d/filter/labelmap.hh
+++ 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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.cc b/mia/3d/filter/labelscale.cc
index eb87d89..0cbe3dc 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 0cc8569..f744e31 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 4dfd0d4..53a1d1a 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 9b63cc3..148cc25 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 6a6aac2..c6444df 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 175c86f..ceeaedd 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 7b871eb..ed67947 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 0fce15d..e0c49ef 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 e27777b..849ea4c 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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.hh b/mia/3d/filter/mean.hh
index afd28a0..ce933c9 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 332e3bb..94e73ba 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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.hh b/mia/3d/filter/median.hh
index a859e22..5ed5cbf 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 fed98bd..c7ef4aa 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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.hh b/mia/3d/filter/mlv.hh
index 3ef8a92..10504c4 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 9add2b0..505ce69 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 8027155..5094f76 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 e6f3597..d50a81a 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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.hh b/mia/3d/filter/msnormalizer.hh
index d20e9e0..fa71496 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 fdf956b..ece7402 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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.hh b/mia/3d/filter/reorient.hh
index a15c3e2..34d29af 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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.cc b/mia/3d/filter/resize.cc
index 603a0b6..096d809 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 0069c4f..64f3c04 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 c95a518..d572859 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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.hh b/mia/3d/filter/scale.hh
index ba8a029..56ddd8c 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 9da6a8d..3fe35a7 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 30270dd..c9187b1 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 2566ea5..119ac16 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 ccf8992..18fd213 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 a357df7..5eedb56 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -172,10 +172,82 @@ const string C3DGaussFilterPlugin::do_get_descr()const
return "isotropic 3D gauss filter";
}
+const TDictMap<EGradientDirection>::Table dir_dict[] = {
+ {"x", gd_x, "gradient in x-direction "},
+ {"y", gd_y, "gradient in y-direction "},
+ {"z", gd_z, "gradient in z-direction "},
+ {NULL, gd_undefined, ""}
+};
+
+const TDictMap<EGradientDirection> Ddirection(dir_dict);
+
+C3DSobelFilterPlugin::C3DSobelFilterPlugin():
+ C3DFilterPlugin("sobel"),
+ m_direction(gd_x)
+{
+ add_parameter("dir", new CDictParameter<EGradientDirection>(m_direction, Ddirection, "Gradient direction"));
+
+}
+
+mia::C3DFilter *C3DSobelFilterPlugin::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, gauss);
+ case gd_y: return new CSeparableConvolute(gauss, cdiff, gauss);
+ case gd_z: return new CSeparableConvolute(gauss, gauss, cdiff);
+ default:
+ throw invalid_argument("C2DSobelFilterPlugin: unknown gradient direction specified");
+ }
+
+}
+
+const std::string C3DSobelFilterPlugin::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.";
+}
+
+
+C3DScharrFilterPlugin::C3DScharrFilterPlugin():
+ C3DFilterPlugin("scharr"),
+ m_direction(gd_x)
+{
+ add_parameter("dir", new CDictParameter<EGradientDirection>(m_direction, Ddirection, "Gradient direction"));
+}
+
+mia::C3DFilter *C3DScharrFilterPlugin::do_create()const
+{
+ const auto& skp = C1DSpacialKernelPluginHandler::instance();
+ auto scharr = skp.produce("scharr");
+ auto cdiff = skp.produce("cdiff");
+
+ switch (m_direction) {
+ case gd_x: return new CSeparableConvolute(cdiff, scharr, scharr);
+ case gd_y: return new CSeparableConvolute(scharr, cdiff, scharr);
+ case gd_z: return new CSeparableConvolute(scharr, scharr, cdiff);
+ default:
+ throw invalid_argument("C3DScharrFilterPlugin: unknown gradient direction specified");
+ }
+}
+
+const std::string C3DScharrFilterPlugin::do_get_descr()const
+{
+ return "The 3D Scharr 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 C3DGaussFilterPlugin();
gauss->append_interface(new C3DSeparableConvoluteFilterPlugin());
+ gauss->append_interface(new C3DSobelFilterPlugin());
+ gauss->append_interface(new C3DScharrFilterPlugin());
return gauss;
}
diff --git a/mia/3d/filter/sepconv.hh b/mia/3d/filter/sepconv.hh
index 0504abc..a5b8234 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,6 +69,28 @@ private:
int m_w;
};
+enum EGradientDirection {gd_x, gd_y, gd_z, gd_undefined};
+
+class C3DSobelFilterPlugin: public mia::C3DFilterPlugin {
+public:
+ C3DSobelFilterPlugin();
+ virtual mia::C3DFilter *do_create()const;
+ virtual const std::string do_get_descr()const;
+private:
+ EGradientDirection m_direction;
+};
+
+class C3DScharrFilterPlugin: public mia::C3DFilterPlugin {
+public:
+ C3DScharrFilterPlugin();
+ virtual mia::C3DFilter *do_create()const;
+ virtual const std::string do_get_descr()const;
+private:
+ EGradientDirection m_direction;
+};
+
+
+
NS_END
#endif
diff --git a/mia/3d/filter/tee.cc b/mia/3d/filter/tee.cc
index 3100ac5..810169a 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 4064f34..2e901df 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 884d23f..9595ade 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 9b17c32..7ff3eaa 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 35f7d63..859535a 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -95,7 +95,7 @@ Combiner3DFilterFixture::Combiner3DFilterFixture():
Combiner3DFilterFixture::~Combiner3DFilterFixture()
{
- boost::any dummy = CDatapool::instance().get_and_remove("other.@");
+ CDatapool::instance().remove("other.@");
}
diff --git a/mia/3d/filter/test_convert.cc b/mia/3d/filter/test_convert.cc
index 1e566a3..ba6c28c 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 b424dbf..a71c5bf 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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_distance.cc b/mia/3d/filter/test_distance.cc
index 37c835f..8f6486c 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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_downscale.cc b/mia/3d/filter/test_downscale.cc
index e907f73..14c3dfb 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,7 +66,7 @@ BOOST_AUTO_TEST_CASE( test_downscale )
BOOST_AUTO_TEST_CASE( test_downscale_nonskew_x )
{
for (unsigned int dx = 1; dx < 4; ++dx) {
- C3DSSImage *fimage = new C3DSSImage(C3DBounds(10+dx, 20, 20));
+ unique_ptr<C3DSSImage> fimage(new C3DSSImage(C3DBounds(10+dx, 20, 20)));
auto i = fimage->begin();
for (size_t z= 0; z < 20; ++z)
for (size_t y = 0; y < 20; ++y)
@@ -101,7 +101,8 @@ BOOST_AUTO_TEST_CASE( test_downscale_nonskew_x )
BOOST_AUTO_TEST_CASE( test_downscale_nonskew_y )
{
for (unsigned int dx = 1; dx < 4; ++dx) {
- C3DSSImage *fimage = new C3DSSImage(C3DBounds(20, 10+dx, 20));
+ unique_ptr<C3DSSImage> fimage(new C3DSSImage(C3DBounds(20, 10+dx, 20)));
+
auto i = fimage->begin();
for (size_t z= 0; z < 20; ++z)
for (size_t y = 0; y < 10+dx; ++y)
diff --git a/mia/3d/filter/test_gradnorm.cc b/mia/3d/filter/test_gradnorm.cc
index e65c98b..4ac38df 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 08b2d45..fc84e73 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 a552de0..88895f6 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 892ab61..011d894 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 a5218b8..babdd8a 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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_labelmap.cc b/mia/3d/filter/test_labelmap.cc
index 9bc8672..673153f 100644
--- a/mia/3d/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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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_labelscale.cc b/mia/3d/filter/test_labelscale.cc
index 08d9314..13ba96d 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 dd7d7da..9737fba 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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 @@ LoadFixture::LoadFixture()
LoadFixture::~LoadFixture()
{
- boost::any dummy = CDatapool::instance().get_and_remove("test.@");
+ CDatapool::instance().remove("test.@");
}
diff --git a/mia/3d/filter/test_lvdownscale.cc b/mia/3d/filter/test_lvdownscale.cc
index 1115152..12c81b9 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 2cdfc8e..d1c7231 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 b8574c1..0da8f9f 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 a93409f..a8ce5a8 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 71cc18e..87bbb03 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 91a0a08..769510d 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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_msnormalizer.cc b/mia/3d/filter/test_msnormalizer.cc
index 873b03c..282aa59 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 5c20c74..0454323 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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_resize.cc b/mia/3d/filter/test_resize.cc
index 3ba602c..39402f1 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 5aa87f4..d968c22 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 940e97d..5129d55 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 678e756..a8883b3 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 58f4dcc..35652a0 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,7 +18,7 @@
*
*/
-#include <mia/internal/autotest.hh>
+#include <mia/internal/plugintester.hh>
#include <mia/3d/filter/sepconv.hh>
NS_MIA_USE
@@ -61,3 +61,154 @@ BOOST_AUTO_TEST_CASE( test_sepconv )
for (auto i = r.begin(); i != r.end(); ++i, ++j)
BOOST_CHECK_CLOSE(*i, gauss_ref[j], 0.01);
}
+
+BOOST_AUTO_TEST_CASE( test_sobel_x )
+{
+ auto sobel_x = BOOST_TEST_create_from_plugin<C3DSobelFilterPlugin>("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, 4,
+ 7, 6, 4,
+ 1, 3, 2,
+
+ };
+
+
+ const float test_image[] = {
+ 0, 0.6875f, 0,
+ 0, 0.625f, 0,
+ 0, 1.4375f, 0,
+
+ 0, 0.125f, 0,
+ 0, 0.34375f, 0,
+ 0, 1.15625f, 0,
+
+ 0, -1.1875f, 0,
+ 0, -0.59375, 0,
+ 0, 0.40625, 0
+ };
+
+ C3DFImage src(C3DBounds(3,3,3), in_image);
+
+ auto filtered = sobel_x->filter(src);
+
+ const C3DFImage& f = dynamic_cast<const C3DFImage&>(*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<C3DSobelFilterPlugin>("sobel:dir=y");
+
+ const float in_image[] = {
+ 1, 2, 3,
+ 4, 2, 3,
+ 2, 5, 6,
+
+ 7, 8, 9,
+ 5, 4, 6,
+ 3, 6, 7,
+
+ 8, 3, 4,
+ 7, 6, 4,
+ 1, 3, 2,
+
+ };
+
+
+ const float test_image[] = {
+ 0, 0, 0,
+ 0.125, 0.625, 0.875,
+ 0, 0, 0,
+
+ 0, 0, 0,
+ -1.34375, -0.59375, -0.3125,
+ 0, 0, 0,
+
+ 0, 0, 0,
+ -2.40625, -1.15625, -0.8125,
+ 0, 0, 0
+ };
+
+ C3DFImage src(C3DBounds(3,3,3), in_image);
+
+ auto filtered = sobel_y->filter(src);
+
+ const C3DFImage& f = dynamic_cast<const C3DFImage&>(*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_z )
+{
+ auto sobel_z = BOOST_TEST_create_from_plugin<C3DSobelFilterPlugin>("sobel:dir=z");
+
+ const float in_image[] = {
+ 1, 2, 3,
+ 4, 2, 3,
+ 2, 5, 6,
+
+ 7, 8, 9,
+ 5, 4, 6,
+ 3, 6, 7,
+
+ 8, 3, 4,
+ 7, 6, 4,
+ 1, 3, 2,
+
+ };
+
+
+ const float test_image[] = {
+ 0, 0, 0,
+ 0, 0, 0,
+ 0, 0, 0,
+
+ 2.46875, 1.3125, 0.59375,
+ 1.34375, 0.78125, 0.125,
+ -0.0625, -0.46875, -1.09375,
+
+ 0, 0, 0,
+ 0, 0, 0,
+ 0, 0, 0
+ };
+
+ C3DFImage src(C3DBounds(3,3,3), in_image);
+
+ auto filtered = sobel_z->filter(src);
+
+ const C3DFImage& f = dynamic_cast<const C3DFImage&>(*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/3d/filter/test_tee.cc b/mia/3d/filter/test_tee.cc
index 636a16a..fca3a33 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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 @@ TeeFixture::TeeFixture()
TeeFixture::~TeeFixture()
{
- boost::any dummy = CDatapool::instance().get_and_remove("test.@");
+ CDatapool::instance().remove("test.@");
}
diff --git a/mia/3d/filter/test_thinning.cc b/mia/3d/filter/test_thinning.cc
index a52162c..de89bfc 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 98ad73f..2f206f0 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 c98c726..a21ca53 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 c6b00e2..bd53d12 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 1bf8af4..91dfbdb 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 1130f5c..0a28ea1 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 3f3c806..56c2a16 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 5a582f0..fdb1644 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 e8690ff..5947134 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 ae20d92..31405ff 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 5767297..7ebd79d 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 7bc6eb9..92763f9 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,7 +122,7 @@ void C3DImageFullCost::do_reinit()
throw runtime_error("C3DImageFullCost only works with images of equal size");
if (m_src->get_voxel_size() != m_ref->get_voxel_size()) {
- cverr() << "C3DImageFullCost: src and reference image are of differnet pixel dimensions."
+ cverr() << "C3DImageFullCost: src and reference image are of different pixel dimensions."
<< "This code doesn't honour this and a proper scaling should be applied first.";
}
m_cost_kernel->set_reference(*m_ref_scaled);
diff --git a/mia/3d/fullcost/image.hh b/mia/3d/fullcost/image.hh
index 7bfba06..d17fea6 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 339a719..eeaac3a 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -257,7 +257,7 @@ void C3DLabelFullCost::do_reinit()
throw runtime_error("C3DLabelFullCost only works with images of equal size");
if (m_src->get_voxel_size() != m_ref->get_voxel_size()) {
- cvwarn() << "C3DLabelFullCost: src and reference image are of differnet voxel dimensions:"
+ cvwarn() << "C3DLabelFullCost: src and reference image are of different voxel dimensions:"
<< m_src->get_voxel_size() << " vs " << m_ref->get_voxel_size()
<< " This code doesn't honour this.\n";
}
diff --git a/mia/3d/fullcost/label.hh b/mia/3d/fullcost/label.hh
index c47d299..12b9de2 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 04d00c1..9fc2bf4 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -256,7 +256,7 @@ void C3DMaskedImageFullCost::do_reinit()
if (m_src->get_voxel_size() != m_ref->get_voxel_size()) {
- cvwarn() << "C3DMaskedImageFullCost: moving and reference image are of differnet pixel dimensions."
+ cvwarn() << "C3DMaskedImageFullCost: moving and reference image are of different pixel dimensions."
<< "unless you optimize a transformation that supports global scaling this might "
<< "not be what you want to do\n";
}
diff --git a/mia/3d/fullcost/maskedimage.hh b/mia/3d/fullcost/maskedimage.hh
index 8dc27a5..d01a21d 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 b27c39b..8659e21 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -359,7 +359,7 @@ void C3DTaggedSSDCost::do_reinit()
if (m_src[i]->get_voxel_size() != m_ref[i]->get_voxel_size()) {
- cverr() << "C3DImageFullCost: src and reference image are of differnet pixel dimensions."
+ cverr() << "C3DImageFullCost: src and reference image are of different pixel dimensions."
<< "This code doesn't honour this and a proper scaling should be applied first.";
}
}
diff --git a/mia/3d/fullcost/taggedssd.hh b/mia/3d/fullcost/taggedssd.hh
index 1544eb6..e340aac 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 13cbf6e..efcb7de 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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_label.cc b/mia/3d/fullcost/test_label.cc
index baf8fdd..18b1222 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 918fb61..3975755 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 2250a2d..94f129a 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 0d0eb8e..914df65 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 a165e07..0bae77b 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 caaa50d..54c860f 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 42751b9..cc589ec 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 adcc31c..0089ae1 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 532a930..ed92962 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 a354860..395e0ca 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -173,6 +173,44 @@ T3DImage<T>::T3DImage(const T3DImage<T>& orig):
}
template <typename T>
+T3DImage<T>::T3DImage(T3DImage<T>&& orig):
+ C3DImage(orig),
+ m_image(orig.m_image)
+{
+}
+
+template <typename T>
+T3DImage<T>& T3DImage<T>::operator = (const T3DImage<T>& orig)
+{
+ if (this != &orig) {
+ C3DImage::operator =(orig);
+ m_image = orig.m_image;
+ }
+ return *this;
+}
+
+
+template <typename T>
+T3DImage<T>& T3DImage<T>::operator = (T3DImage<T>&& orig)
+{
+ if (this != &orig) {
+ C3DImage::operator =(std::move(orig));
+ m_image = std::move(orig.m_image);
+ }
+ return *this;
+}
+
+
+template <typename T>
+T3DImage<T>::T3DImage(const T3DDatafield<T>& orig):
+ C3DImage((EPixelType)pixel_type<T>::value),
+ m_image(orig)
+
+{
+}
+
+
+template <typename T>
C3DImage::Pointer T3DImage<T>::clone() const
{
return P3DImage(new T3DImage<T>(*this));
@@ -414,22 +452,20 @@ C3DFVectorfield get_gradient(const C3DImage& image)
return filter(gg, image);
}
-template class T3DImage<bool>;
-template class T3DImage<signed char>;
-template class T3DImage<unsigned char>;
-template class T3DImage<signed short>;
-template class T3DImage<unsigned short>;
-template class T3DImage<signed int>;
-template class T3DImage<unsigned int>;
-
-#ifdef LONG_64BIT
-template class T3DImage<signed long>;
-template class T3DImage<unsigned long>;
-#endif
+template class T3DImage<bool>;
+template class T3DImage<int8_t>;
+template class T3DImage<uint8_t>;
+template class T3DImage<int16_t>;
+template class T3DImage<uint16_t>;
+template class T3DImage<int32_t>;
+template class T3DImage<uint32_t>;
+template class T3DImage<int64_t>;
+template class T3DImage<uint64_t>;
template class T3DImage<float>;
template class T3DImage<double>;
+
template <typename T>
C3DValueAttribute<T>::C3DValueAttribute(const T3DVector<T>& value):
m_value(value)
diff --git a/mia/3d/image.hh b/mia/3d/image.hh
index 7112a3b..9469761 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,11 +52,13 @@ protected:
@param type pixel type of this image
*/
C3DImage(const CAttributedData& data, EPixelType type);
+
/**
Constructor to create the base sceleton of the image
@param type pixel type of this image
*/
- C3DImage(EPixelType type);
+ explicit C3DImage(EPixelType type);
+
/// standard constructor
C3DImage();
@@ -186,14 +188,35 @@ public:
Construct a new image of a given size
\param size
*/
- T3DImage(const C3DBounds& size);
+ explicit T3DImage(const C3DBounds& size);
//T3DImage(const T3DDatafield<T>& size);
/**
copy constructor
*/
- T3DImage(const T3DImage& orig);
+ T3DImage(const T3DImage<T>& orig);
+
+ /**
+ move constructor
+ */
+ T3DImage(T3DImage<T>&& orig);
+
+ /**
+ copy operator
+ */
+ T3DImage& operator = (const T3DImage<T>& orig);
+
+ /**
+ move operator
+ */
+ T3DImage& operator = (T3DImage<T>&& orig);
+
+ /**
+ Constructor to create the image by using a 3D data field
+ \param orig the input data field
+ */
+ explicit T3DImage(const T3DDatafield<T>& orig);
/**
standart costructor creates an image of size (0,0,0)
@@ -448,31 +471,28 @@ EXPORT_3D C3DFVectorfield get_gradient(const C3DImage& image);
typedef T3DImage<bool> C3DBitImage;
/// \brief 3D image with signed 8 bit integer values
-typedef T3DImage<signed char> C3DSBImage;
+typedef T3DImage<int8_t> C3DSBImage;
/// \brief 3D image with unsigned 8 bit integer values
-typedef T3DImage<unsigned char> C3DUBImage;
+typedef T3DImage<uint8_t> C3DUBImage;
/// \brief 3D image with signed 16 bit integer values
-typedef T3DImage<signed short> C3DSSImage;
+typedef T3DImage<int16_t> C3DSSImage;
/// \brief 3D image with unsigned 16 bit integer values
-typedef T3DImage<unsigned short> C3DUSImage;
+typedef T3DImage<uint16_t> C3DUSImage;
/// \brief 3D image with signed 32 bit integer values
-typedef T3DImage<signed int> C3DSIImage;
+typedef T3DImage<int32_t> C3DSIImage;
/// \brief 3D image with unsigned 32 bit integer values
-typedef T3DImage<unsigned int> C3DUIImage;
-
-#ifdef LONG_64BIT
+typedef T3DImage<uint32_t> C3DUIImage;
/// \brief 3D image with signed 64 bit integer values
-typedef T3DImage<signed long> C3DSLImage;
+typedef T3DImage<int64_t> C3DSLImage;
/// \brief 3D image with unsigned 64 bit integer values
-typedef T3DImage<unsigned long> C3DULImage;
-#endif
+typedef T3DImage<uint64_t> C3DULImage;
/// \brief 3D image with signed 32 bit floating point values
typedef T3DImage<float> C3DFImage;
diff --git a/mia/3d/imagecollect.cc b/mia/3d/imagecollect.cc
index 088646b..8731da0 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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.hh b/mia/3d/imagecollect.hh
index 7ab3bba..4f4e62a 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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
index 22a4279..ad865ac 100644
--- a/mia/3d/imagedraw.cc
+++ b/mia/3d/imagedraw.cc
@@ -1,7 +1,7 @@
/* -*- mia-c++ -*-
*
* This file is part of MIA - a toolbox for medical image analysis
- * Copyright (c) Leipzig, Madrid 1999-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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.cxx b/mia/3d/imagedraw.cxx
index 8d820e4..2ff7f1f 100644
--- a/mia/3d/imagedraw.cxx
+++ b/mia/3d/imagedraw.cxx
@@ -1,7 +1,7 @@
/* -*- mia-c++ -*-
*
* This file is part of MIA - a toolbox for medical image analysis
- * Copyright (c) Leipzig, Madrid 1999-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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.hh b/mia/3d/imagedraw.hh
index a954d45..a57e56a 100644
--- a/mia/3d/imagedraw.hh
+++ b/mia/3d/imagedraw.hh
@@ -1,7 +1,7 @@
/* -*- mia-c++ -*-
*
* This file is part of MIA - a toolbox for medical image analysis
- * Copyright (c) Leipzig, Madrid 1999-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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.cc b/mia/3d/imageio.cc
index af6f7c3..1c585cb 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 c271116..1c0987a 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 760b8a4..e419be4 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 0075a5e..8cae69d 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 3e368e5..413f279 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 a1f60b4..ec879e1 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 784663f..fbeb245 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -453,18 +453,17 @@ float add_3d<T3DDatafield< float >, 4>::value(const T3DDatafield< float >& coef
template class EXPORT_3D T3DConvoluteInterpolator<TYPE>
INSTANCIATE_INTERPOLATORS(bool);
-INSTANCIATE_INTERPOLATORS(unsigned char);
-INSTANCIATE_INTERPOLATORS(signed char);
-INSTANCIATE_INTERPOLATORS(unsigned short);
-INSTANCIATE_INTERPOLATORS(signed short);
-INSTANCIATE_INTERPOLATORS(unsigned int);
-INSTANCIATE_INTERPOLATORS(signed int);
+INSTANCIATE_INTERPOLATORS(int8_t);
+INSTANCIATE_INTERPOLATORS(int16_t);
+INSTANCIATE_INTERPOLATORS(int32_t);
+INSTANCIATE_INTERPOLATORS(int64_t);
+INSTANCIATE_INTERPOLATORS(uint8_t);
+INSTANCIATE_INTERPOLATORS(uint16_t);
+INSTANCIATE_INTERPOLATORS(uint32_t);
+INSTANCIATE_INTERPOLATORS(uint64_t);
+
INSTANCIATE_INTERPOLATORS(float);
INSTANCIATE_INTERPOLATORS(double);
-#ifdef LONG_64BIT
-INSTANCIATE_INTERPOLATORS(signed long);
-INSTANCIATE_INTERPOLATORS(unsigned long);
-#endif
INSTANCIATE_INTERPOLATORS(C3DFVector);
INSTANCIATE_INTERPOLATORS(C3DDVector);
diff --git a/mia/3d/interpolator.cxx b/mia/3d/interpolator.cxx
index aaf75af..6114351 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 eca41fd..fd12ea2 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 7a02d62..3b6231a 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 3e4c41d..98b0099 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 bf59e8f..dcf5b33 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 06cab90..6dc231d 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 9b58c9e..631a0cb 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 7d1b97d..a475857 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,6 +287,10 @@ public:
*/
range3d_iterator_with_boundary_flag<I> with_boundary_flag() const;
+ /**
+ access elements relative to the iterator position
+ */
+ const reference operator[] (int i) const;
private:
@@ -331,6 +335,12 @@ range3d_iterator<I>::range3d_iterator(const range3d_iterator<AI>& other):
{
}
+template <typename I>
+const typename range3d_iterator<I>::reference
+range3d_iterator<I>::operator[] (int i) const
+{
+ return m_iterator[i];
+}
/**
Compare two range iterators. There equivalence is only decided based on the grid position.
diff --git a/mia/3d/landmark.cc b/mia/3d/landmark.cc
index 99ed82b..a8af766 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/mia/3d/landmark.hh b/mia/3d/landmark.hh
index 7d6c9c0..0fd0240 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/mia/3d/landmarklist.cc b/mia/3d/landmarklist.cc
index 7a797d3..0acb888 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/mia/3d/landmarklist.hh b/mia/3d/landmarklist.hh
index 4b86db5..22f647d 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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.cc b/mia/3d/landmarklistio.cc
index e747c3f..be7a551 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 0f9a599..ec63887 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 7395e17..445cf92 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 3f50de2..7d0c60b 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 df0a5e2..fd75943 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,9 +19,9 @@
*/
#include <mia/3d/landmarklistio.hh>
-#include <libxml++/libxml++.h>
#include <mia/core/msgstream.hh>
#include <mia/core/tools.hh>
+#include <mia/core/xmlinterface.hh>
#include <boost/filesystem.hpp>
@@ -29,14 +29,52 @@
#include <config.h>
#endif
-#if LIBXMLPP_VERSION < 3
-#define get_first_child_text get_child_text
-#define set_first_child_text set_child_text
-#define add_child_element add_child
-#endif
-
namespace bfs=boost::filesystem;
-using namespace xmlpp;
+
+
+namespace mia {
+template <>
+bool from_string(const char *s, C3DFVector& result)
+{
+ std::istringstream sx(s);
+ sx >> result.x >> result.y >> result.z;
+ if (sx.fail())
+ return false;
+ if (sx.eof())
+ return true;
+
+ std::string remaining;
+ sx >> remaining;
+ bool retval = true;
+ for(auto i = remaining.begin(); i != remaining.end(); ++i)
+ retval &= isspace(remaining[0]);
+ return retval;
+
+}
+
+template <>
+bool from_string(const char *s, Quaternion& result)
+{
+ std::istringstream sx(s);
+ double w, x, y, z;
+
+ sx >> x >> y >> z >> w;
+ result = Quaternion(w,x,y,z);
+ if (sx.fail())
+ return false;
+ if (sx.eof())
+ return true;
+
+ std::string remaining;
+ sx >> remaining;
+ bool retval = true;
+ for(auto i = remaining.begin(); i != remaining.end(); ++i)
+ retval &= isspace(remaining[0]);
+ return retval;
+
+}
+
+}
NS_MIA_USE
using namespace std;
@@ -49,8 +87,8 @@ private:
virtual bool do_save(string const& filename, const C3DLandmarklist& data) const;
virtual const string do_get_descr() const;
- P3DLandmark get_landmark(const Node& node) const ;
- void add_landmark(Element* lmnode, const C3DLandmark& lm) const;
+ P3DLandmark get_landmark(const CXMLElement& node) const ;
+ void add_landmark(CXMLElement& lmnode, const C3DLandmark& lm) const;
};
extern "C" EXPORT CPluginBase *get_plugin_interface()
@@ -64,53 +102,12 @@ C3DLandmarklistIOPlugin("lmx")
add_suffix(".lmx");
}
-template <typename Expect>
-bool translate_value(const Glib::ustring& content, Expect& result)
-{
- istringstream shelp(content.raw());
- shelp >> result;
- bool good = !shelp.fail();
- cvdebug() << "Get streamable type from from '" << content << ( good ? " success" : " fail") << "\n";
- return good;
-
-}
-
-template <>
-bool translate_value(const Glib::ustring& content, string& result)
-{
- result= content.raw();
- return true;
-}
-
-template <>
-bool translate_value(const Glib::ustring& content, C3DFVector& result)
-{
- istringstream shelp(content.raw());
- shelp >> result.x >> result.y >> result.z;
- bool good = !shelp.fail();
- cvdebug() << "Get 3D vector from '" << content << ( good ? " success" : " fail") << "\n";
- return good;
-
-}
-
-template <>
-bool translate_value(const Glib::ustring& content, Quaternion& result)
-{
- istringstream shelp(content.raw());
- double x,y,z,w;
- shelp >> x >> y >> z >> w;
- result = Quaternion(w,x,y,z);
- bool good = !shelp.fail();
- cvdebug() << "Get quaternion from '" << content << ( good ? " success" : " fail") << "\n";
- return good;
-}
-
template <typename Expect>
-bool get_single_xml_value(const Node& node, const string& tag, Expect& result)
+bool get_single_xml_value(const CXMLElement& node, const string& tag, Expect& result)
{
- cvdebug() << "search value for tag '" << tag << "'\n";
- auto children = node.get_children(tag);
+ cvdebug() << "search value for tag '" << tag << "' in node '" << node.get_name()<< "'\n";
+ auto children = node.get_children(tag.c_str());
if (children.empty()) {
cvdebug() << " tag not found\n";
return false;
@@ -120,26 +117,50 @@ bool get_single_xml_value(const Node& node, const string& tag, Expect& result)
<< "' specified more then once. Only reading first.";
}
- auto content = dynamic_cast<const Element*>(*children.begin());
- if (!content) {
+ auto content = children[0]->get_content();
+ cvdebug() << " got content '" << content << "'\n";
+ if (content.empty()) {
cvdebug() << " got empty node\n";
return false;
}
+ bool r = from_string(content, result);
+ if (!r)
+ cvdebug() << "ERROR:reading '" << tag << "' from '" << content << "'failed\n";
- auto text = content->get_first_child_text();
- if (!text) {
- cvdebug() << " no text in node\n";
+ return r;
+}
+
+template <>
+bool get_single_xml_value(const CXMLElement& node, const string& tag, string& result)
+{
+ cvdebug() << "search value for tag '" << tag << "' in node '" << node.get_name()<< "'\n";
+ auto children = node.get_children(tag.c_str());
+ if (children.empty()) {
+ cvdebug() << " tag not found\n";
return false;
}
+ if (children.size() > 1) {
+ cvwarn() << "C3DLMXLandmarklistIOPlugin:Tag '" << tag
+ << "' specified more then once. Only reading first.";
+ }
+
+ auto content = children[0]->get_content();
+
+ cvdebug() << " got content '" << content << "'\n";
- return translate_value(text->get_content(), result);
+ if (content.empty()) {
+ cvdebug() << " got empty node\n";
+ return false;
+ }
+ result = content;
+ return true;
}
template <>
-bool get_single_xml_value(const Node& node, const string& tag, C3DCamera& result)
+bool get_single_xml_value(const CXMLElement& node, const string& tag, C3DCamera& result)
{
-
- auto children = node.get_children(tag);
+ cvdebug() << "search value for tag '" << tag << "' in node '" << node.get_name()<< "'\n";
+ auto children = node.get_children(tag.c_str());
if (children.empty())
return false;
if (children.size() > 1) {
@@ -151,15 +172,16 @@ bool get_single_xml_value(const Node& node, const string& tag, C3DCamera& result
float distance;
Quaternion rotation;
float zoom;
-
- auto content = *children.begin();
+
+ auto camera = children[0];
+
bool camera_complete =
- get_single_xml_value(*content, "location", location) &&
- get_single_xml_value(*content, "zoom", zoom) &&
- get_single_xml_value(*content, "rotation", rotation);
-
+ get_single_xml_value(*camera, "location", location) &&
+ get_single_xml_value(*camera, "zoom", zoom) &&
+ get_single_xml_value(*camera, "rotation", rotation);
+
// work around old style saving that uses
- if (get_single_xml_value(*content, "distance", distance))
+ if (get_single_xml_value(*camera, "distance", distance))
location.z = distance;
if (camera_complete) {
@@ -172,7 +194,7 @@ bool get_single_xml_value(const Node& node, const string& tag, C3DCamera& result
}
-P3DLandmark C3DLMXLandmarklistIOPlugin::get_landmark(const Node& node) const
+P3DLandmark C3DLMXLandmarklistIOPlugin::get_landmark(const CXMLElement& node) const
{
string name;
@@ -204,27 +226,28 @@ P3DLandmark C3DLMXLandmarklistIOPlugin::get_landmark(const Node& node) const
P3DLandmarklist C3DLMXLandmarklistIOPlugin::do_load(string const& filename)const
{
- DomParser parser;
- parser.set_substitute_entities(); //We just want the text to be resolved/unescaped automatically.
- parser.parse_file(filename);
+ ifstream infile(filename);
+ string xml_init(std::istreambuf_iterator<char>{infile}, {});
- if (!parser) {
- cvinfo() << "C3DLMXLandmarklistIOPlugin: unable to parse '" << filename << "'\n";
- return P3DLandmarklist();
+ if (!infile.good()) {
+ throw create_exception<runtime_error>("C3DLMXLandmarklistIOPlugin: Unable to read input file: '", filename, "'");
}
-
- auto root = parser.get_document()->get_root_node ();
- if (root->get_name() != "list") {
- cvinfo() << "C3DLMXLandmarklistIOPlugin: input file '"
- << filename << "'is XML but lot an lmx file\n";
- return P3DLandmarklist();
+
+ CXMLDocument doc;
+
+ if (!doc.read_from_string(xml_init.c_str())) {
+ cvdebug() << "C3DLMXLandmarklistIOPlugin:'" << filename
+ << "' not an XML file\n";
+ return P3DLandmarklist();
}
-
+
+ auto root = doc.get_root_node();
+
P3DLandmarklist result(new C3DLandmarklist);
-
+
bfs::path bfsfilename(filename);
result->set_path(bfsfilename.root_path().string());
-
+
// get name of the set
string name;
if ( get_single_xml_value(*root, "name", name))
@@ -233,7 +256,7 @@ P3DLandmarklist C3DLMXLandmarklistIOPlugin::do_load(string const& filename)cons
auto lmdescr = root->get_children("landmark");
auto i = lmdescr.begin();
auto e = lmdescr.end();
-
+
while (i != e) {
result->add(get_landmark(**i));
++i;
@@ -242,74 +265,74 @@ P3DLandmarklist C3DLMXLandmarklistIOPlugin::do_load(string const& filename)cons
}
template <typename T>
-void add_node(Element& parent, const string& name, const T& value)
+void add_node(CXMLElement& parent, const string& name, const T& value)
{
ostringstream s;
s << value;
- auto node = parent.add_child_element(name);
- node->set_first_child_text(s.str());
+ auto node = parent.add_child(name.c_str());
+ node->set_child_text(s.str());
}
template <>
-void add_node(Element& parent, const string& name, const string& value)
+void add_node(CXMLElement& parent, const string& name, const string& value)
{
- auto node = parent.add_child_element(name);
- node->set_first_child_text(value);
+ auto node = parent.add_child(name.c_str());
+ node->set_child_text(value);
}
template <typename T>
-void add_node(Element& parent, const string& name, const T3DVector<T>& value)
+void add_node(CXMLElement& parent, const string& name, const T3DVector<T>& value)
{
ostringstream s;
s << value.x << " " << value.y << " " << value.z;
-
- auto node = parent.add_child_element(name);
- node->set_first_child_text(s.str());
+
+ auto node = parent.add_child(name.c_str());
+ node->set_child_text(s.str());
}
template <>
-void add_node(Element& parent, const string& name, const Quaternion& value)
+void add_node(CXMLElement& parent, const string& name, const Quaternion& value)
{
ostringstream s;
s << value.x() << " " << value.y() << " " << value.z() << " " << value.w() ;
- auto node = parent.add_child_element(name);
- node->set_first_child_text(s.str());
+ auto node = parent.add_child(name.c_str());
+ node->set_child_text(s.str());
}
template <>
-void add_node(Element& parent, const string& name, const C3DCamera& value)
+void add_node(CXMLElement& parent, const string& name, const C3DCamera& value)
{
- auto node = parent.add_child_element(name);
+ auto node = parent.add_child(name.c_str());
add_node(*node, "location", value.get_location());
add_node(*node, "rotation", value.get_rotation());
add_node(*node, "zoom", value.get_zoom());
}
-void C3DLMXLandmarklistIOPlugin::add_landmark(Element* lmnode, const C3DLandmark& lm) const
+void C3DLMXLandmarklistIOPlugin::add_landmark(CXMLElement& lmnode, const C3DLandmark& lm) const
{
- add_node(*lmnode, "name", lm.get_name());
- add_node(*lmnode, "picfile", lm.get_picture_file());
+ add_node(lmnode, "name", lm.get_name());
+ add_node(lmnode, "picfile", lm.get_picture_file());
if (lm.has_location())
- add_node(*lmnode, "location", lm.get_location());
- add_node(*lmnode, "isovalue", lm.get_isovalue());
- add_node(*lmnode, "camera", lm.get_view());
+ add_node(lmnode, "location", lm.get_location());
+ add_node(lmnode, "isovalue", lm.get_isovalue());
+ add_node(lmnode, "camera", lm.get_view());
}
bool C3DLMXLandmarklistIOPlugin::do_save(string const& filename, const C3DLandmarklist& data) const
{
- unique_ptr<Document> doc(new Document);
+ CXMLDocument doc;
- Element* list = doc->create_root_node("list");
+ auto list = doc.create_root_node("list");
add_node(*list, "name", data.get_name());
for(auto i = data.begin(); i != data.end(); ++i) {
- auto lmnode = list->add_child_element("landmark");
- add_landmark(lmnode, *i->second);
+ auto lmnode = list->add_child("landmark");
+ add_landmark(*lmnode, *i->second);
}
ofstream outfile(filename.c_str(), ios_base::out );
if (outfile.good())
- outfile << doc->write_to_string_formatted();
+ outfile << doc.write_to_string();
else
cvdebug() << "Unable to open file '" << filename << "'\n";
return outfile.good();
diff --git a/mia/3d/maskedcost.cc b/mia/3d/maskedcost.cc
index c8160ce..2265ffe 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 85e9564..faff5fc 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 80e5d20..5bc9ee2 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,6 +34,7 @@ using std::make_pair;
CLNCC3DImageCost::CLNCC3DImageCost(int hw):
m_hwidth(hw)
{
+ m_copy_to_double = produce_3dimage_filter("convert:repn=double,map=copy");
}
inline pair<C3DBounds, C3DBounds> prepare_range(const C3DBounds& size, int cx, int cy, int cz, int hw)
@@ -70,8 +71,7 @@ public:
m_mask(mask)
{}
- template <typename T, typename R>
- float operator () ( const T& mov, const R& ref) const {
+ float operator () ( const C3DDImage& mov, const C3DDImage& ref) const {
auto evaluate_local_cost = [this, &mov, &ref](const C1DParallelRange& range, const pair<float, int>& result) -> pair<float, int> {
CThreadMsgStream msks;
float lresult = 0.0;
@@ -130,8 +130,13 @@ public:
double CLNCC3DImageCost::do_value(const Data& a, const Data& b, const Mask& m) const
{
+ auto a_double_ptr = m_copy_to_double->filter(a);
+ auto b_double_ptr = m_copy_to_double->filter(b);
+ const C3DDImage& mov = static_cast<const C3DDImage&>(*a_double_ptr);
+ const C3DDImage& ref = static_cast<const C3DDImage&>(*b_double_ptr);
+
FEvalCost ecost(m_hwidth, m);
- return mia::filter(ecost, a, b);
+ return ecost(mov, ref);
}
@@ -146,8 +151,7 @@ public:
m_force(force)
{}
- template <typename T, typename R>
- float operator () ( const T& mov, const R& ref) const {
+ float operator () ( const C3DDImage& mov, const C3DDImage& ref) const {
auto ag = get_gradient(mov);
auto evaluate_local_cost_force = [this, &mov, &ref, &ag](const C1DParallelRange& range,
const pair<float, int>& result) -> pair<float, int> {
@@ -214,8 +218,13 @@ public:
double CLNCC3DImageCost::do_evaluate_force(const Data& a, const Data& b, const Mask& m, Force& force) const
{
- FEvalCostForce ecostforce(m_hwidth, m, force);
- return mia::filter(ecostforce, a, b);
+ auto a_double_ptr = m_copy_to_double->filter(a);
+ auto b_double_ptr = m_copy_to_double->filter(b);
+ const C3DDImage& mov = static_cast<const C3DDImage&>(*a_double_ptr);
+ const C3DDImage& ref = static_cast<const C3DDImage&>(*b_double_ptr);
+
+ FEvalCostForce ecostforce(m_hwidth, m, force);
+ return ecostforce(mov, ref);
}
diff --git a/mia/3d/maskedcost/lncc.hh b/mia/3d/maskedcost/lncc.hh
index 7589f0c..bb68f01 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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_3d_maskedcost_lncc_hh
#include <mia/3d/maskedcost.hh>
+#include <mia/3d/filter.hh>
#define NS mia_3d_maskedlncc
@@ -37,7 +38,8 @@ public:
private:
virtual double do_value(const Data& a, const Data& b, const Mask& m) const;
virtual double do_evaluate_force(const Data& a, const Data& b, const Mask& m, Force& force) const;
- int m_hwidth;
+ int m_hwidth;
+ mia::P3DFilter m_copy_to_double;
};
class CLNCC3DImageCostPlugin: public mia::C3DMaskedImageCostPlugin {
diff --git a/mia/3d/maskedcost/mi.cc b/mia/3d/maskedcost/mi.cc
index efbb8ef..99bbcdc 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 c18389e..5df0d5c 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 0bf7fd1..49e81f1 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,28 +31,26 @@ using namespace mia;
CNCC3DImageCost::CNCC3DImageCost()
{
+ m_copy_to_double = produce_3dimage_filter("convert:repn=double,map=copy");
}
-template <typename T, typename S>
struct FEvaluateNCCSum {
- FEvaluateNCCSum(const C3DBitImage& mask, const T& mov, const S& ref);
+ FEvaluateNCCSum(const C3DBitImage& mask, const C3DDImage& mov, const C3DDImage& ref);
NCCSums operator ()(const C1DParallelRange& range, const NCCSums& sumacc) const;
private:
C3DBitImage m_mask;
- T m_mov;
- S m_ref;
+ const C3DDImage& m_mov;
+ const C3DDImage& m_ref;
};
-template <typename T, typename S>
-FEvaluateNCCSum<T,S>::FEvaluateNCCSum(const C3DBitImage& mask, const T& mov, const S& ref):
+FEvaluateNCCSum::FEvaluateNCCSum(const C3DBitImage& mask, const C3DDImage& mov, const C3DDImage& ref):
m_mask(mask), m_mov(mov), m_ref(ref)
{
}
-template <typename T, typename S>
-NCCSums FEvaluateNCCSum<T,S>::operator ()(const C1DParallelRange& range, const NCCSums& sumacc) const
+NCCSums FEvaluateNCCSum::operator ()(const C1DParallelRange& range, const NCCSums& sumacc) const
{
CThreadMsgStream msks;
@@ -81,10 +79,9 @@ public:
m_mask(mask)
{}
- template <typename T, typename R>
- float operator () ( const T& mov, const R& ref) const {
+ float operator () ( const C3DDImage& mov, const C3DDImage& ref) const {
- FEvaluateNCCSum<T,R> ev(m_mask, mov, ref);
+ FEvaluateNCCSum ev(m_mask, mov, ref);
NCCSums sum;
sum = preduce(C1DParallelRange(0, mov.get_size().z, 1), sum, ev,
[](const NCCSums& x, const NCCSums& y){
@@ -97,8 +94,13 @@ public:
double CNCC3DImageCost::do_value(const Data& a, const Data& b, const Mask& m) const
{
+ auto a_double_ptr = m_copy_to_double->filter(a);
+ auto b_double_ptr = m_copy_to_double->filter(b);
+ const C3DDImage& mov = static_cast<const C3DDImage&>(*a_double_ptr);
+ const C3DDImage& ref = static_cast<const C3DDImage&>(*b_double_ptr);
+
FEvalCost ecost(m);
- return mia::filter(ecost, a, b);
+ return ecost(mov, ref);
}
@@ -111,12 +113,11 @@ public:
m_force(force)
{}
- template <typename T, typename R>
- float operator () ( const T& mov, const R& ref) const {
+ float operator () (const C3DDImage& mov, const C3DDImage& ref) const {
CThreadMsgStream msks;
NCCSums sum;
- FEvaluateNCCSum<T,R> ev(m_mask, mov, ref);
+ FEvaluateNCCSum ev(m_mask, mov, ref);
sum = preduce(C1DParallelRange(0, mov.get_size().z, 1), sum, ev,
[](const NCCSums& x, const NCCSums& y){
return x + y;
@@ -154,8 +155,13 @@ public:
double CNCC3DImageCost::do_evaluate_force(const Data& a, const Data& b, const Mask& m, Force& force) const
{
+ auto a_double_ptr = m_copy_to_double->filter(a);
+ auto b_double_ptr = m_copy_to_double->filter(b);
+ const C3DDImage& mov = static_cast<const C3DDImage&>(*a_double_ptr);
+ const C3DDImage& ref = static_cast<const C3DDImage&>(*b_double_ptr);
+
FEvalCostForce ecostforce(m, force);
- return mia::filter(ecostforce, a, b);
+ return ecostforce(mov, ref);
}
diff --git a/mia/3d/maskedcost/ncc.hh b/mia/3d/maskedcost/ncc.hh
index 847e9e9..8515215 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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_3d_maskedcost_ncc_hh
#include <mia/3d/maskedcost.hh>
+#include <mia/3d/filter.hh>
#define NS mia_3d_maskedncc
@@ -37,6 +38,7 @@ public:
private:
virtual double do_value(const Data& a, const Data& b, const Mask& m) const;
virtual double do_evaluate_force(const Data& a, const Data& b, const Mask& m, Force& force) const;
+ mia::P3DFilter m_copy_to_double;
};
class CNCC3DImageCostPlugin: public mia::C3DMaskedImageCostPlugin {
diff --git a/mia/3d/maskedcost/ssd.cc b/mia/3d/maskedcost/ssd.cc
index 79e2420..6037fbf 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 3155abe..e5fe947 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 bd4d980..9876351 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 7bb8e87..8f99023 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 429c62a..d0240ec 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 656d50c..88d6b8f 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 ab4dab5..d9561d7 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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.hh b/mia/3d/matrix.hh
index 16b4845..15526e1 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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.cc b/mia/3d/model.cc
index 58ac517..c49a563 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 1dc0451..b637447 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 fe084b9..3aef67b 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 9ed84a8..2e9f03b 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 4531bd5..451d668 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 619cf07..93580ff 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 8b78a48..2033fc6 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 56d2d35..691c335 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 20c61b7..3f3612d 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 5e8932a..f2d3bd4 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 a68c08e..d5658da 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -270,9 +270,6 @@ EXPORT_3D istream& operator >> (istream& is, E3DPatientPositioning& pp)
return is;
}
-EXPORT_3D const char * IDPatientPosition = "PatientPosition";
-
-
void C3DOrientationAndPosition::print(std::ostream& os)const
{
os << "[" << m_axisorder << " [" << m_origin << "] ["
@@ -314,6 +311,13 @@ EXPORT_3D std::istream& operator >> (std::istream& is, C3DOrientationAndPositio
return is;
}
+#ifdef __GNUC__
+#pragma GCC diagnostic push
+#ifndef __clang__
+#pragma GCC diagnostic ignored "-Wattributes"
+#endif
+#endif
+
template class EXPORT_3D TAttribute<E3DImageOrientation>;
template class EXPORT_3D TAttribute<E3DPatientPositioning>;
template class EXPORT_3D TAttribute<C3DOrientationAndPosition>;
@@ -322,5 +326,9 @@ template class EXPORT_3D TTranslator<E3DImageOrientation>;
template class EXPORT_3D TTranslator<E3DPatientPositioning>;
template class EXPORT_3D TTranslator<C3DOrientationAndPosition>;
+#ifdef __GNUC__
+#pragma GCC diagnostic pop
+#endif
+
NS_MIA_END
diff --git a/mia/3d/orientation.hh b/mia/3d/orientation.hh
index dfbbbbc..59e22a0 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 7ecac88..23bef28 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -247,7 +247,6 @@ void C3DPPDivcurlMatrixImpl::reset(const C3DBounds& size, const C3DFVector& rang
const double r101101 = r11x * r00y * r11z;
const double r011011 = r00x * r11y * r11z;
- bool zero = true;
cell.vxx = global_scale * (
r002002 * wrot +
r011011 * 2.0 * wrot +
@@ -256,8 +255,6 @@ void C3DPPDivcurlMatrixImpl::reset(const C3DBounds& size, const C3DFVector& rang
r110110 * wsum +
r200200 * wdiv);
- zero &= cell.vxx == 0.0;
-
cell.vyy = global_scale * (
r002002 * wrot +
r011011 * wsum +
@@ -265,7 +262,6 @@ void C3DPPDivcurlMatrixImpl::reset(const C3DBounds& size, const C3DFVector& rang
r101101 * 2* wrot +
r110110 * wsum +
r200200 * wrot);
- zero &= cell.vyy == 0.0;
cell.vzz = global_scale * (
r002002 * wdiv +
@@ -275,26 +271,22 @@ void C3DPPDivcurlMatrixImpl::reset(const C3DBounds& size, const C3DFVector& rang
r110110 * wrot * 2 +
r200200 * wrot);
- zero &= cell.vzz == 0.0;
-
+
if (wdelta != 0.0) {
cell.vxy = global_scale * wdelta *
(r21x * r01y * r00z +
r10x * r12y * r00z +
r01x * r10y * r11z);
- zero &= cell.vxy == 0.0;
cell.vxz = global_scale * wdelta *
(r21x * r00y * r01z +
r10x * r11y * r01z +
r10x * r00y * r12z);
- zero &= cell.vxz == 0.0;
cell.vyz = global_scale * wdelta * (
r11x * r10y * r01z +
r00x * r21y * r01z +
r00x * r10y * r12z);
- zero &= cell.vyz == 0.0;
}
*p = cell;
diff --git a/mia/3d/ppmatrix.hh b/mia/3d/ppmatrix.hh
index 90f9b20..d1d3b8f 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 8463a54..b451881 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 d52afe2..8f72b03 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 9c38ba6..2c3ec4d 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 aed9031..056bcb0 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 d84a7bd..cd963c5 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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/naviera.cc b/mia/3d/reg3d/naviera.cc
index 7cf8485..95a16dd 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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/navierasse.cc b/mia/3d/reg3d/navierasse.cc
index 11ceb23..1a52249 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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/navierpsse.cc b/mia/3d/reg3d/navierpsse.cc
index 7c63795..1534b2f 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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.cc b/mia/3d/register.cc
index e9137cd..9276f40 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 3005916..afdae82 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 f7956e7..9f5e19a 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 c8797db..dbc660b 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 1572e18..e0e9cde 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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.hh b/mia/3d/rot.hh
index 1ac5bd1..d196f6f 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 2ce5b69..3b40f84 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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.hh b/mia/3d/shape.hh
index 31f7b6a..b8c9425 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 60d1034..4e7b339 100644
--- a/mia/3d/shapes/CMakeLists.txt
+++ b/mia/3d/shapes/CMakeLists.txt
@@ -17,42 +17,9 @@
#
SET(shape3d
- 3d-shapes
-)
-
+ 3d-shapes
+ )
SET(SHAPES_SRC basic_shapes.cc sphere.cc)
-add_library(3d-shapes-common OBJECT ${SHAPES_SRC})
-IF(NOT WIN32)
- set_source_files_properties(${SHAPES_SRC} PROPERTIES COMPILE_FLAGS "-fPIC")
- set_target_properties(3d-shapes-common PROPERTIES COMPILE_FLAGS -DVSTREAM_DOMAIN='"${plugname}"')
-ENDIF(NOT WIN32)
-
-
-add_library(3d-shapes MODULE $<TARGET_OBJECTS:3d-shapes-common>)
-
-TARGET_LINK_LIBRARIES(3d-shapes ${MIA3DLIBS})
-SET_TARGET_PROPERTIES(3d-shapes PROPERTIES PREFIX "" SUFFIX ${PLUGSUFFIX})
-INSTALL(TARGETS 3d-shapes LIBRARY DESTINATION "${PLUGIN_INSTALL_PATH}/3dimage/shape")
-
-ADD_CUSTOM_TARGET(3d-shapes_test_link
- ln -sf "${CMAKE_CURRENT_BINARY_DIR}/3d-shapes.mia" ${PLUGIN_TEST_ROOT}/${PLUGIN_INSTALL_PATH}/3dimage/shape/
- DEPENDS 3dimage_shape_testdir 3d-shapes)
-
-ADD_DEPENDENCIES(plugin_test_links 3d-shapes_test_link)
-
-add_executable(test-3d-shapes test_shapes.cc $<TARGET_OBJECTS:3d-shapes-common>)
-IF(NOT WIN32)
- set_target_properties(test-3d-shapes PROPERTIES
- COMPILE_FLAGS -DVSTREAM_DOMAIN='"3d-shapes"'
- COMPILE_FLAGS -DBOOST_TEST_DYN_LINK)
-ELSE(NOT WIN32)
- set_target_properties(test-3d-shapes PROPERTIES
- COMPILE_FLAGS -DBOOST_TEST_DYN_LINK)
-ENDIF(NOT WIN32)
-# target_link_libraries(test-${plugname} ${plugname}-common)
-target_link_libraries(test-3d-shapes ${MIA3DLIBS} ${BOOST_UNITTEST})
-add_test(3d-shapes test-3d-shapes)
-
-
+PLUGIN_WITH_TEST_MULTISOURCE(shapes 3dimage shape "${SHAPES_SRC}" ${MIA3DLIBS})
diff --git a/mia/3d/shapes/basic_shapes.cc b/mia/3d/shapes/basic_shapes.cc
index aa8adc4..72da42c 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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.hh b/mia/3d/shapes/basic_shapes.hh
index dcf2d88..16f6c65 100644
--- a/mia/3d/shapes/basic_shapes.hh
+++ b/mia/3d/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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 05d1c60..010c5e8 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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.hh b/mia/3d/shapes/sphere.hh
index 1ac27c2..2609497 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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/test_shapes.cc b/mia/3d/shapes/test_shapes.cc
index b202c46..9031679 100644
--- a/mia/3d/shapes/test_shapes.cc
+++ b/mia/3d/shapes/test_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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 6b1b109..df06c77 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 a622507..8078781 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 1041db2..342bb83 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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.hh b/mia/3d/splinepenalty/divcurl.hh
index e51cb18..bc02637 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 23a16a4..de04dc8 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 4357393..1f32002 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -127,7 +127,7 @@ TPluginHandler<C3DSplineTransformPenaltyPlugin>::m_help =
"This class provides the penalty put on spline based transformations "
"when considering image registration. This penalty term ensures "
"the smoothness of a transformation or the evaluation of a similarity measure "
- "between a transformed study data set and a refernce data set.";
+ "between a transformed study data set and a reference data set.";
EXPLICIT_INSTANCE_DERIVED_FACTORY_HANDLER(C3DSplineTransformPenalty, C3DSplineTransformPenaltyPlugin);
diff --git a/mia/3d/splinetransformpenalty.hh b/mia/3d/splinetransformpenalty.hh
index 0244635..009bada 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 d4ad20c..852b20d 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 354bfc2..e2319ed 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 0419e76..70e1343 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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_3d.cc b/mia/3d/test_3d.cc
index 1ef9042..383a02b 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 caae249..e29c0c5 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 558d1e6..b945055 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 c4eff23..4781d29 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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_critical_points.cc b/mia/3d/test_critical_points.cc
index ce1320a..e6588f2 100644
--- a/mia/3d/test_critical_points.cc
+++ b/mia/3d/test_critical_points.cc
@@ -1,7 +1,7 @@
/* -*- mia-c++ -*-
*
* This file is part of MIA - a toolbox for medical image analysis
- * Copyright (c) Leipzig, Madrid 1999-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 9dd3d71..5ad94d8 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,9 +52,6 @@ BOOST_AUTO_TEST_CASE(test_3ddatafield)
fabs(grad_22.y - 2.0) < 0.0001 &&
fabs(grad_22.z + 1.0) < 0.0001);
- float ip = data.get_interpol_val_at(C3DFVector(2.25, 1.5, 1.5));
- BOOST_CHECK(fabs(ip - 5.875) < 0.0001);
-
std::vector<float> xbuffer;
data.get_data_line_x(2, 1, xbuffer);
BOOST_CHECK(xbuffer.size() == 5);
@@ -237,7 +234,9 @@ BOOST_AUTO_TEST_CASE( test_3ddatafield_get_put_yz )
}
-#ifdef LONG_64BIT
+// this test should only be run on a machine with more than 4GB
+// of working memory, so for now it is disabled
+#if 0
BOOST_AUTO_TEST_CASE( test_3ddatafield_larger_than_4GB )
{
diff --git a/mia/3d/test_deform.cc b/mia/3d/test_deform.cc
index d75ae36..af6cb1c 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 050c3a5..75030ea 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 b0000d9..7da4ef1 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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_ica.cc b/mia/3d/test_ica.cc
index 0c3aec0..5367a4f 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,9 +19,6 @@
*/
#include <mia/internal/autotest.hh>
-
-
-#include <mia/core/ica.hh>
#include <mia/3d/ica.hh>
using namespace mia;
@@ -43,18 +40,19 @@ struct ICA3DSeriesFixture {
protected:
vector<C3DFImage> image_set;
vector<float> mean;
+ PIndepCompAnalysisFactory ica_factory;
};
-BOOST_AUTO_TEST_CASE ( test_empty_initialization )
+BOOST_FIXTURE_TEST_CASE ( test_empty_initialization, ICA3DSeriesFixture )
{
vector<C3DFImage> series;
- BOOST_CHECK_THROW( C3DImageSeriesICA s(CICAAnalysisITPPFactory(), series, false), invalid_argument);
+ BOOST_CHECK_THROW( C3DImageSeriesICA s(*ica_factory, series, false), invalid_argument);
}
BOOST_FIXTURE_TEST_CASE( test_ica_with_some_mean, ICA3DSeriesFixture )
{
- C3DImageSeriesICA ica(CICAAnalysisITPPFactory(), image_set, false);
+ C3DImageSeriesICA ica(*ica_factory, image_set, false);
ica.run(3,false,false);
@@ -64,7 +62,7 @@ BOOST_FIXTURE_TEST_CASE( test_ica_with_some_mean, ICA3DSeriesFixture )
BOOST_FIXTURE_TEST_CASE( test_ica_imcomplete_mix, ICA3DSeriesFixture )
{
- C3DImageSeriesICA ica(CICAAnalysisITPPFactory(), image_set, false);
+ C3DImageSeriesICA ica(*ica_factory, image_set, false);
C3DImageSeriesICA::IndexSet skip;
skip.insert(0);
skip.insert(1);
@@ -83,7 +81,7 @@ BOOST_FIXTURE_TEST_CASE( test_ica_imcomplete_mix, ICA3DSeriesFixture )
BOOST_FIXTURE_TEST_CASE( test_ica_with_stripped_series_mean, ICA3DSeriesFixture )
{
- C3DImageSeriesICA ica(CICAAnalysisITPPFactory(), image_set, true);
+ C3DImageSeriesICA ica(*ica_factory, image_set, true);
ica.run(3,false,false);
@@ -93,7 +91,7 @@ BOOST_FIXTURE_TEST_CASE( test_ica_with_stripped_series_mean, ICA3DSeriesFixture
BOOST_FIXTURE_TEST_CASE( test_ica_with_some_mean_4comp, ICA3DSeriesFixture )
{
- C3DImageSeriesICA ica(CICAAnalysisITPPFactory(), image_set, true);
+ C3DImageSeriesICA ica(*ica_factory, image_set, true);
ica.run(4, false, false);
@@ -103,7 +101,7 @@ BOOST_FIXTURE_TEST_CASE( test_ica_with_some_mean_4comp, ICA3DSeriesFixture )
BOOST_FIXTURE_TEST_CASE( test_ica_with_some_mean_4comp_stripped_and_normalized, ICA3DSeriesFixture )
{
- C3DImageSeriesICA ica(CICAAnalysisITPPFactory(), image_set, true);
+ C3DImageSeriesICA ica(*ica_factory, image_set, true);
ica.run(4, true, true);
@@ -113,7 +111,7 @@ BOOST_FIXTURE_TEST_CASE( test_ica_with_some_mean_4comp_stripped_and_normalized,
BOOST_FIXTURE_TEST_CASE( test_ica_with_some_mean_4comp_normalized, ICA3DSeriesFixture )
{
- C3DImageSeriesICA ica(CICAAnalysisITPPFactory(), image_set, false);
+ C3DImageSeriesICA ica(*ica_factory, image_set, false);
ica.run(4, true, true);
@@ -123,7 +121,7 @@ BOOST_FIXTURE_TEST_CASE( test_ica_with_some_mean_4comp_normalized, ICA3DSeriesFi
BOOST_FIXTURE_TEST_CASE( test_ica_with_some_mean_4comp_normalized2, ICA3DSeriesFixture )
{
- C3DImageSeriesICA ica(CICAAnalysisITPPFactory(), image_set, false);
+ C3DImageSeriesICA ica(*ica_factory, image_set, false);
ica.run(4, true, true);
@@ -133,7 +131,7 @@ BOOST_FIXTURE_TEST_CASE( test_ica_with_some_mean_4comp_normalized2, ICA3DSeriesF
BOOST_FIXTURE_TEST_CASE( test_ica_with_some_mean_4comp_mix_normalized, ICA3DSeriesFixture )
{
- C3DImageSeriesICA ica(CICAAnalysisITPPFactory(), image_set, false);
+ C3DImageSeriesICA ica(*ica_factory, image_set, false);
ica.run(4, true, false);
@@ -143,7 +141,7 @@ BOOST_FIXTURE_TEST_CASE( test_ica_with_some_mean_4comp_mix_normalized, ICA3DSeri
BOOST_FIXTURE_TEST_CASE( test_ica_with_some_mean_4comp_none, ICA3DSeriesFixture )
{
- C3DImageSeriesICA ica(CICAAnalysisITPPFactory(), image_set, false);
+ C3DImageSeriesICA ica(*ica_factory, image_set, false);
ica.run(4, false, false);
for (size_t i = 0; i < slices; ++i)
@@ -152,7 +150,7 @@ BOOST_FIXTURE_TEST_CASE( test_ica_with_some_mean_4comp_none, ICA3DSeriesFixture
-BOOST_AUTO_TEST_CASE( test_ica_mean_substract )
+BOOST_FIXTURE_TEST_CASE( test_ica_mean_substract, ICA3DSeriesFixture )
{
C3DBounds size(2,3,1);
float init_image1[6] = {1, 2, 3, 4, 5, 6};
@@ -163,7 +161,7 @@ BOOST_AUTO_TEST_CASE( test_ica_mean_substract )
images.push_back(C3DFImage(size, init_image1));
images.push_back(C3DFImage(size, init_image2));
- C3DImageSeriesICA ica(CICAAnalysisITPPFactory(), images, true);
+ C3DImageSeriesICA ica(*ica_factory, images, true);
const C3DFImage& mean = ica.get_mean_image();
@@ -176,7 +174,8 @@ BOOST_AUTO_TEST_CASE( test_ica_mean_substract )
ICA3DSeriesFixture::ICA3DSeriesFixture():
- mean(slices)
+ mean(slices),
+ ica_factory( produce_ica_factory("internal"))
{
float data_rows[slices][nx * ny] = {
{ 1.1, -0.9, -1.9, -0.9, 2.1, -1.9, 6.1, -2.9, -0.9, 1.1 },
diff --git a/mia/3d/test_image.cc b/mia/3d/test_image.cc
index 2fdf187..04eb39d 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -81,21 +81,22 @@ static void creat_and_check(EPixelType type)
BOOST_CHECK(voxel2 == timg->get_voxel_size());
}
-BOOST_AUTO_TEST_CASE( check_data_types )
+typedef boost::mpl::vector<bool,
+ int8_t,
+ uint8_t,
+ int16_t,
+ uint16_t,
+ int32_t,
+ uint32_t,
+ int64_t,
+ uint64_t,
+ float,
+ double
+ > test_types;
+
+BOOST_AUTO_TEST_CASE_TEMPLATE( check_data_types , T, test_types)
{
- creat_and_check<bool>(it_bit);
- creat_and_check<unsigned char>(it_ubyte);
- creat_and_check<signed char>(it_sbyte);
- creat_and_check<unsigned short>(it_ushort);
- creat_and_check<signed short>(it_sshort);
- creat_and_check<unsigned int>(it_uint);
- creat_and_check<signed int>(it_sint);
-#ifdef LONG_64BIT
- creat_and_check<unsigned long>(it_ulong);
- creat_and_check<signed long>(it_slong);
-#endif
- creat_and_check<float>(it_float);
- creat_and_check<double>(it_double);
+ creat_and_check<T>(pixel_type<T>::value);
}
diff --git a/mia/3d/test_imagecollect.cc b/mia/3d/test_imagecollect.cc
index a11c83c..6923244 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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
index b26856b..648dd03 100644
--- a/mia/3d/test_imagedraw.cc
+++ b/mia/3d/test_imagedraw.cc
@@ -1,7 +1,7 @@
/* -*- mia-c++ -*-
*
* This file is part of MIA - a toolbox for medical image analysis
- * Copyright (c) Leipzig, Madrid 1999-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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_imageio.cc b/mia/3d/test_imageio.cc
index bafa3c4..c9a4820 100644
--- a/mia/3d/test_imageio.cc
+++ b/mia/3d/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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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_interpol.cc b/mia/3d/test_interpol.cc
index dfbe3cf..1ccb214 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -329,20 +329,22 @@ BOOST_AUTO_TEST_CASE(test_omoms3)
}
}
-typedef bmpl::vector<unsigned char,
- signed char,
- unsigned short,
- signed short,
-#ifdef LONG_64BIT
- signed long,
- unsigned long,
-#endif
- float,
- double> types;
+typedef bmpl::vector<int8_t,
+ uint8_t,
+ int16_t,
+ uint16_t,
+ int32_t,
+ uint32_t,
+ int64_t,
+ uint64_t,
+ float,
+ double
+ > test_types;
-BOOST_AUTO_TEST_CASE_TEMPLATE( test_types, T , types )
+
+BOOST_AUTO_TEST_CASE_TEMPLATE( test_interpolator_kernels , T , test_types )
{
test_type<T, bspline1>();
test_type<T, bspline2>();
diff --git a/mia/3d/test_iterator.cc b/mia/3d/test_iterator.cc
index 7aef97c..8ca29c4 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 e7adf6f..ea60b44 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 3bba025..46729ad 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,10 +26,10 @@
NS_MIA_USE
using namespace std;
-BOOST_AUTO_TEST_CASE( test_available_plugins )
+BOOST_AUTO_TEST_CASE( test_available_plugins_landmarklistio )
{
set<string> expected_plugins = {"lmx", "datapool"};
- test_availabe_plugins(C3DLandmarklistIOPluginHandler::instance(), expected_plugins);
+ test_available_plugins(C3DLandmarklistIOPluginHandler::instance(), expected_plugins);
}
BOOST_AUTO_TEST_CASE( test_load_landmarklist_lmx )
diff --git a/mia/3d/test_matrix.cc b/mia/3d/test_matrix.cc
index 8638dd7..be6c8e8 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 1836d82..b0aad50 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 974164b..87e0296 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 70e7d1c..9bc0e98 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 37a4102..8e4f530 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 0fd06bf..9b9aa7f 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 759ca32..019b7c5 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 fac917f..e1d684a 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 975073a..dac88d4 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 998f70b..9baaf96 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 3fefcca..c7a0fe5 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 6fedc79..ed97f65 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -259,8 +259,8 @@ C3DSplineTransformPenalty *C3DSplinePenaltyMock::do_clone() const
}
-BOOST_AUTO_TEST_CASE(test_available_plugins)
+BOOST_AUTO_TEST_CASE(test_available_plugins_spline_penalty)
{
std::set<std::string> test_data = {"divcurl"};
- test_availabe_plugins(C3DSplineTransformPenaltyPluginHandler::instance(), test_data);
+ test_available_plugins(C3DSplineTransformPenaltyPluginHandler::instance(), test_data);
}
diff --git a/mia/3d/test_stackdisttrans.cc b/mia/3d/test_stackdisttrans.cc
index 5632d41..eaf829c 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 909347b..6003795 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 5247d3a..050121a 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 6e098d1..30c605e 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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_transio.cc b/mia/3d/test_transio.cc
index e274c72..cc0f464 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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_vector.cc b/mia/3d/test_vector.cc
index 47ed811..32c11e8 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 fd27d65..e5bd841 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,13 +20,20 @@
#include <climits>
-#define VSTREAM_DOMAIN "test-transio"
+#define VSTREAM_DOMAIN "test-3d-vectorfield"
#include <mia/internal/autotest.hh>
+#include <set>
+
#include <mia/core.hh>
#include <mia/3d/vectorfield.hh>
+#include <boost/mpl/vector.hpp>
+
+#include <cmath>
+
+namespace bmpl=boost::mpl;
NS_MIA_USE;
using namespace std;
@@ -121,6 +128,190 @@ C3DVectorfieldFixture::C3DVectorfieldFixture():
}
+BOOST_AUTO_TEST_CASE( test_interpolation)
+{
+
+
+ C3DBounds size(3,3,3);
+ C3DFVectorfield f(size);
+
+
+ auto ifield = f.begin();
+ for (size_t iz = 0; iz < size.z; ++iz)
+ for (size_t iy = 0; iy < size.y; ++iy)
+ for (size_t ix = 0; ix < size.x; ++ix, ++ifield) {
+ *ifield = C3DFVector(2* ix+1, 3* iy +2, 4 * iz+1);
+ }
+
+
+ C3DLinearVectorfieldInterpolator ip(f);
+
+ unsigned n = 10;
+ float d = n / 2.0;
+
+
+ for (size_t iz = 1; iz < n; ++iz)
+ for (size_t iy = 1; iy < n; ++iy)
+ for (size_t ix = 1; ix < n; ++ix) {
+ C3DFVector v(ix / d, iy / d, iz / d);
+ C3DFVector value = ip(v);
+
+ int x = static_cast<int>( floor(v.x) );
+ int y = static_cast<int>( floor(v.y) );
+ int z = static_cast<int>( floor(v.z) );
+
+ C3DFVector dx(v.x - x, v.y - y, v.z - z);
+
+ C3DFVector px = C3DFVector::_1 - dx;
+
+ C3DFVector test_value =
+ px.z * (px.y * ( px.x * f(x,y,z) + dx.x * f(x+1,y,z) ) +
+ dx.y * ( px.x * f(x,y+1,z) + dx.x * f(x+1,y+1,z) )) +
+
+ dx.z * (px.y * ( px.x * f(x,y,z+1) + dx.x * f(x+1,y,z+1)) +
+ dx.y * ( px.x * f(x,y+1,z+1) + dx.x * f(x+1,y+1,z+1)));
+
+ cvdebug() << "x= " << v << ", dx = " << dx << "\n";
+
+ BOOST_CHECK_CLOSE(value.x, test_value.x, 0.1);
+ BOOST_CHECK_CLOSE(value.y, test_value.y, 0.1);
+ BOOST_CHECK_CLOSE(value.z, test_value.z, 0.1);
+
+ }
+
+
+ std::set<int> index_set;
+ index_set.insert(0);
+ index_set.insert(2);
+
+
+ // z \in {0,2}
+ for (auto iz: index_set)
+ for (size_t iy = 1; iy < n; ++iy)
+ for (size_t ix = 1; ix < n; ++ix) {
+ C3DFVector dx(ix / d, iy / d, iz);
+ C3DFVector value = ip(dx);
+
+ int x = static_cast<int>( floor(dx.x) );
+ int y = static_cast<int>( floor(dx.y) );
+
+
+ dx.y = dx.y - y;
+ dx.x = dx.x - x;
+
+ C3DFVector px = C3DFVector::_1 - dx;
+ C3DFVector test_value =
+ (px.y * ( px.x * f(x,y,iz) + dx.x * f(x+1,y,iz) ) +
+ dx.y * ( px.x * f(x,y+1,iz) + dx.x * f(x+1,y+1,iz) ));
+
+ BOOST_CHECK_CLOSE(value.x, test_value.x, 0.1);
+ BOOST_CHECK_CLOSE(value.y, test_value.y, 0.1);
+ BOOST_CHECK_CLOSE(value.z, test_value.z, 0.1);
+
+ }
+
+ // y \in {0,1}
+ for (size_t iz = 1; iz < n; ++iz)
+ for (auto iy : index_set)
+ for (size_t ix = 1; ix < n; ++ix) {
+
+ C3DFVector dx(ix / d, iy, iz / d);
+ C3DFVector value = ip(dx);
+
+ int x = static_cast<int>( floor(dx.x) );
+ int z = static_cast<int>( floor(dx.z) );
+
+ dx.z = dx.z - z;
+ dx.x = dx.x - x;
+
+ C3DFVector px = C3DFVector::_1 - dx;
+ C3DFVector test_value =
+ px.z * ( px.x * f(x,iy,z) + dx.x * f(x+1,iy,z) ) +
+ dx.z * ( px.x * f(x,iy,z+1) + dx.x * f(x+1,iy,z+1));
+
+ BOOST_CHECK_CLOSE(value.x, test_value.x, 0.1);
+ BOOST_CHECK_CLOSE(value.y, test_value.y, 0.1);
+ BOOST_CHECK_CLOSE(value.z, test_value.z, 0.1);
+
+ }
+
+ for (size_t iz = 1; iz < n; ++iz)
+ for (size_t iy = 1; iy < n; ++iy)
+ for (auto ix : index_set) {
+ C3DFVector dx(ix, iy / d, iz / d);
+ C3DFVector value = ip(dx);
+
+ int y = static_cast<int>( floor(dx.y) );
+ int z = static_cast<int>( floor(dx.z) );
+
+ dx.z = dx.z - z;
+ dx.y = dx.y - y;
+
+ C3DFVector px = C3DFVector::_1 - dx;
+
+ C3DFVector test_value =
+ px.z * (px.y * f(ix,y,z) + dx.y * f(ix,y+1,z) ) +
+ dx.z * (px.y * f(ix,y,z+1) + dx.y * f(ix,y+1,z+1) );
+
+ BOOST_CHECK_CLOSE(value.x, test_value.x, 0.1);
+ BOOST_CHECK_CLOSE(value.y, test_value.y, 0.1);
+ BOOST_CHECK_CLOSE(value.z, test_value.z, 0.1);
+
+ }
+}
+
+BOOST_AUTO_TEST_CASE (test_vectorfield_as_inverse_of)
+{
+ C3DBounds size(10,10,10);
+
+ C3DFVectorfield other(size);
+
+ for (auto io = other.begin_range(C3DBounds::_0, size);
+ io != other.end_range(C3DBounds::_0, size); ++io) {
+ *io = C3DFVector(sin(io.pos().x * M_PI / 9), sin(io.pos().y * M_PI / 18), sin(io.pos().z * M_PI / 9));
+ }
+
+ C3DFVectorfield me(size);
+ me.update_as_inverse_of(other, 1e-14f, 50);
+
+ C3DLinearVectorfieldInterpolator interp_me(me);
+ C3DLinearVectorfieldInterpolator interp_other(other);
+
+ for(unsigned z = 0; z < 10; ++z)
+ for(unsigned y = 0; y < 10; ++y)
+ for(unsigned x = 0; x < 10; ++x) {
+
+ C3DFVector pos(x,y,z);
+ C3DFVector pos_t = pos - interp_me(pos);
+ C3DFVector pos_tt = pos_t - interp_other(pos_t) - pos;
+
+ cvdebug() << pos << ": delta = " << pos_tt << "\n";
+
+ BOOST_CHECK_SMALL(pos_tt.x, 1e-5f);
+ BOOST_CHECK_SMALL(pos_tt.y, 1e-5f);
+ BOOST_CHECK_SMALL(pos_tt.z, 1e-5f);
+
+
+ // test also the inverse, but with a higher tolerance,
+ // since this was not optimized
+ C3DFVector pos_it = pos - interp_other(pos);
+ C3DFVector pos_inv = interp_me(pos_it);
+ C3DFVector pos_itt = pos_it - pos_inv - pos;
+ cvdebug() << pos << ": pos-other = "<< pos_it
+ << ", intp = " << pos_inv
+ << ", inv delta = " << pos_itt << "\n";
+
+ BOOST_CHECK_SMALL(pos_itt.x, 0.05f);
+ BOOST_CHECK_SMALL(pos_itt.y, 0.05f);
+ BOOST_CHECK_SMALL(pos_itt.z, 0.05f);
+
+ }
+
+
+}
+
+
+
NS_MIA_USE
diff --git a/mia/3d/test_vfio.cc b/mia/3d/test_vfio.cc
index 7a615b9..bc88cb1 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 73c74ed..787e743 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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.hh b/mia/3d/timestep.hh
index 352e994..97ea5af 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 1586a51..3bbab53 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 48d6861..307d868 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 04e7cd1..e1ec560 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 122b928..29d9538 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -245,6 +245,11 @@ const C3DBounds& C3DTransformation::const_iterator::get_size()const
return m_holder->get_size();
}
+C3DFVector C3DTransformation::apply(const C3DFVector& x) const
+{
+ return get_displacement_at(x);
+}
+
bool C3DTransformation::refine()
{
return false;
diff --git a/mia/3d/transform.hh b/mia/3d/transform.hh
index d8f719e..67f62a5 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -321,8 +321,16 @@ public:
@returns the displacement at coordinate x
\remark rename the function to something that explains better whats going on
*/
- virtual C3DFVector apply(const C3DFVector& x) const = 0;
+ virtual C3DFVector apply(const C3DFVector& x) const __attribute__((deprecated));
+ /**
+ Returns the displacement of the transformation at a given coordinate
+ \param x coordinate
+ \returns actual displacement
+ */
+
+ virtual C3DFVector get_displacement_at(const C3DFVector& x) const = 0;
+
/**
apply the actual transformation to point x
@returns transformed point
diff --git a/mia/3d/transform/affine.cc b/mia/3d/transform/affine.cc
index 689cd6e..6e9ee65 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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 @@
NS_MIA_BEGIN
using namespace std;
-C3DFVector C3DAffineTransformation::apply(const C3DFVector& x) const
+C3DFVector C3DAffineTransformation::get_displacement_at(const C3DFVector& x) const
{
return transform(x);
}
@@ -192,9 +192,9 @@ float C3DAffineTransformation::get_max_transform() const
C3DFVector(get_size())
};
- float result = apply(C3DFVector()).norm2();
+ float result = get_displacement_at(C3DFVector()).norm2();
for(int i = 0; i < 7; ++i) {
- float h = (apply(corners[i]) - corners[i]).norm2();
+ float h = (get_displacement_at(corners[i]) - corners[i]).norm2();
if (result < h)
result = h;
}
@@ -205,7 +205,7 @@ float C3DAffineTransformation::get_max_transform() const
C3DFVector C3DAffineTransformation::operator () (const C3DFVector& x) const
{
- return apply(x);
+ return get_displacement_at(x);
}
float C3DAffineTransformation::get_jacobian(const C3DFVectorfield& /*v*/, float /*delta*/) const
@@ -251,9 +251,9 @@ C3DAffineTransformation::iterator_impl::iterator_impl(const C3DBounds& pos, cons
const C3DAffineTransformation& trans):
C3DTransformation::iterator_impl(pos, size),
m_trans(trans),
- m_value(trans.apply(C3DFVector(pos)))
+ m_value(trans.get_displacement_at(C3DFVector(pos)))
{
- m_dx = m_trans.apply(C3DFVector(pos.x + 1.0, pos.y, pos.z)) - m_value;
+ m_dx = m_trans.get_displacement_at(C3DFVector(pos.x + 1.0, pos.y, pos.z)) - m_value;
}
C3DAffineTransformation::iterator_impl::iterator_impl(const C3DBounds& pos, const C3DBounds& begin,
@@ -261,9 +261,9 @@ C3DAffineTransformation::iterator_impl::iterator_impl(const C3DBounds& pos, cons
const C3DAffineTransformation& trans):
C3DTransformation::iterator_impl(pos, begin, end, size),
m_trans(trans),
- m_value(trans.apply(C3DFVector(pos)))
+ m_value(trans.get_displacement_at(C3DFVector(pos)))
{
- m_dx = m_trans.apply(C3DFVector(pos.x + 1.0, pos.y, pos.z)) - m_value;
+ m_dx = m_trans.get_displacement_at(C3DFVector(pos.x + 1.0, pos.y, pos.z)) - m_value;
}
C3DTransformation::iterator_impl * C3DAffineTransformation::iterator_impl::clone() const
@@ -283,14 +283,14 @@ void C3DAffineTransformation::iterator_impl::do_x_increment()
void C3DAffineTransformation::iterator_impl::do_y_increment()
{
- m_value = m_trans.apply(C3DFVector(get_pos()));
- m_dx = m_trans.apply(C3DFVector(get_pos().x + 1.0, get_pos().y, get_pos().z)) - m_value;
+ m_value = m_trans.get_displacement_at(C3DFVector(get_pos()));
+ m_dx = m_trans.get_displacement_at(C3DFVector(get_pos().x + 1.0, get_pos().y, get_pos().z)) - m_value;
}
void C3DAffineTransformation::iterator_impl::do_z_increment()
{
- m_value = m_trans.apply(C3DFVector(get_pos()));
- m_dx = m_trans.apply(C3DFVector(get_pos().x + 1.0, get_pos().y, get_pos().z)) - m_value;
+ m_value = m_trans.get_displacement_at(C3DFVector(get_pos()));
+ m_dx = m_trans.get_displacement_at(C3DFVector(get_pos().x + 1.0, get_pos().y, get_pos().z)) - m_value;
}
diff --git a/mia/3d/transform/affine.hh b/mia/3d/transform/affine.hh
index 21f9625..423c014 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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 @@ public:
C3DAffineTransformation(const C3DBounds& size, const C3DInterpolatorFactory& ipf);
C3DAffineTransformation(const C3DBounds& size, std::vector<double> transform, const C3DInterpolatorFactory& ipf);
- C3DFVector apply(const C3DFVector& x) const;
+ C3DFVector get_displacement_at(const C3DFVector& x) const;
class EXPORT_3D iterator_impl: public C3DTransformation::iterator_impl {
public:
diff --git a/mia/3d/transform/axisrot.cc b/mia/3d/transform/axisrot.cc
index 296f061..7ed59d7 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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 @@ using namespace std;
-C3DFVector C3DAxisrotTransformation::apply(const C3DFVector& x) const
+C3DFVector C3DAxisrotTransformation::get_displacement_at(const C3DFVector& x) const
{
return transform(x);
}
@@ -179,9 +179,9 @@ float C3DAxisrotTransformation::get_max_transform() const
C3DFVector(get_size())
};
- float result = apply(C3DFVector()).norm2();
+ float result = get_displacement_at(C3DFVector()).norm2();
for(int i = 0; i < 7; ++i) {
- float h = (apply(corners[i]) - corners[i]).norm2();
+ float h = (get_displacement_at(corners[i]) - corners[i]).norm2();
if (result < h)
result = h;
}
@@ -192,7 +192,7 @@ float C3DAxisrotTransformation::get_max_transform() const
C3DFVector C3DAxisrotTransformation::operator () (const C3DFVector& x) const
{
- return apply(x);
+ return get_displacement_at(x);
}
float C3DAxisrotTransformation::get_jacobian(const C3DFVectorfield& /*v*/, float /*delta*/) const
@@ -227,9 +227,9 @@ C3DAxisrotTransformation::iterator_impl::iterator_impl(const C3DBounds& pos, con
const C3DAxisrotTransformation& trans):
C3DTransformation::iterator_impl(pos, size),
m_trans(trans),
- m_value(trans.apply(C3DFVector(pos)))
+ m_value(trans.get_displacement_at(C3DFVector(pos)))
{
- m_dx = m_trans.apply(C3DFVector(pos.x + 1.0, pos.y, pos.z)) - m_value;
+ m_dx = m_trans.get_displacement_at(C3DFVector(pos.x + 1.0, pos.y, pos.z)) - m_value;
}
C3DAxisrotTransformation::iterator_impl::iterator_impl(const C3DBounds& pos, const C3DBounds& begin,
@@ -237,9 +237,9 @@ C3DAxisrotTransformation::iterator_impl::iterator_impl(const C3DBounds& pos, con
const C3DAxisrotTransformation& trans):
C3DTransformation::iterator_impl(pos, begin, end, size),
m_trans(trans),
- m_value(trans.apply(C3DFVector(pos)))
+ m_value(trans.get_displacement_at(C3DFVector(pos)))
{
- m_dx = m_trans.apply(C3DFVector(pos.x + 1.0, pos.y, pos.z)) - m_value;
+ m_dx = m_trans.get_displacement_at(C3DFVector(pos.x + 1.0, pos.y, pos.z)) - m_value;
}
C3DTransformation::iterator_impl * C3DAxisrotTransformation::iterator_impl::clone() const
@@ -259,14 +259,14 @@ void C3DAxisrotTransformation::iterator_impl::do_x_increment()
void C3DAxisrotTransformation::iterator_impl::do_y_increment()
{
- m_value = m_trans.apply(C3DFVector(get_pos()));
- m_dx = m_trans.apply(C3DFVector(get_pos().x + 1.0, get_pos().y, get_pos().z)) - m_value;
+ m_value = m_trans.get_displacement_at(C3DFVector(get_pos()));
+ m_dx = m_trans.get_displacement_at(C3DFVector(get_pos().x + 1.0, get_pos().y, get_pos().z)) - m_value;
}
void C3DAxisrotTransformation::iterator_impl::do_z_increment()
{
- m_value = m_trans.apply(C3DFVector(get_pos()));
- m_dx = m_trans.apply(C3DFVector(get_pos().x + 1.0, get_pos().y, get_pos().z)) - m_value;
+ m_value = m_trans.get_displacement_at(C3DFVector(get_pos()));
+ m_dx = m_trans.get_displacement_at(C3DFVector(get_pos().x + 1.0, get_pos().y, get_pos().z)) - m_value;
}
diff --git a/mia/3d/transform/axisrot.hh b/mia/3d/transform/axisrot.hh
index 75c0d70..e3d03ab 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,7 +37,7 @@ public:
const mia::C3DFVector& rot_axis,
const mia::C3DInterpolatorFactory& ipf);
- mia::C3DFVector apply(const mia::C3DFVector& x) const;
+ mia::C3DFVector get_displacement_at(const mia::C3DFVector& x) const;
class EXPORT_3D iterator_impl: public mia::C3DTransformation::iterator_impl {
public:
diff --git a/mia/3d/transform/raffine.cc b/mia/3d/transform/raffine.cc
index 9c5adbe..9900fa7 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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 @@ using namespace std;
-C3DFVector C3DRAffineTransformation::apply(const C3DFVector& x) const
+C3DFVector C3DRAffineTransformation::get_displacement_at(const C3DFVector& x) const
{
return transform(x);
}
@@ -176,9 +176,9 @@ float C3DRAffineTransformation::get_max_transform() const
C3DFVector(get_size())
};
- float result = apply(C3DFVector()).norm2();
+ float result = get_displacement_at(C3DFVector()).norm2();
for(int i = 0; i < 7; ++i) {
- float h = (apply(corners[i]) - corners[i]).norm2();
+ float h = (get_displacement_at(corners[i]) - corners[i]).norm2();
if (result < h)
result = h;
}
@@ -189,7 +189,7 @@ float C3DRAffineTransformation::get_max_transform() const
C3DFVector C3DRAffineTransformation::operator () (const C3DFVector& x) const
{
- return apply(x);
+ return get_displacement_at(x);
}
float C3DRAffineTransformation::get_jacobian(const C3DFVectorfield& /*v*/, float /*delta*/) const
@@ -238,9 +238,9 @@ C3DRAffineTransformation::iterator_impl::iterator_impl(const C3DBounds& pos, con
const C3DRAffineTransformation& trans):
C3DTransformation::iterator_impl(pos, size),
m_trans(trans),
- m_value(trans.apply(C3DFVector(pos)))
+ m_value(trans.get_displacement_at(C3DFVector(pos)))
{
- m_dx = m_trans.apply(C3DFVector(pos.x + 1.0, pos.y, pos.z)) - m_value;
+ m_dx = m_trans.get_displacement_at(C3DFVector(pos.x + 1.0, pos.y, pos.z)) - m_value;
}
C3DRAffineTransformation::iterator_impl::iterator_impl(const C3DBounds& pos, const C3DBounds& begin,
@@ -248,9 +248,9 @@ C3DRAffineTransformation::iterator_impl::iterator_impl(const C3DBounds& pos, con
const C3DRAffineTransformation& trans):
C3DTransformation::iterator_impl(pos, begin, end, size),
m_trans(trans),
- m_value(trans.apply(C3DFVector(pos)))
+ m_value(trans.get_displacement_at(C3DFVector(pos)))
{
- m_dx = m_trans.apply(C3DFVector(pos.x + 1.0, pos.y, pos.z)) - m_value;
+ m_dx = m_trans.get_displacement_at(C3DFVector(pos.x + 1.0, pos.y, pos.z)) - m_value;
}
C3DTransformation::iterator_impl * C3DRAffineTransformation::iterator_impl::clone() const
@@ -270,14 +270,14 @@ void C3DRAffineTransformation::iterator_impl::do_x_increment()
void C3DRAffineTransformation::iterator_impl::do_y_increment()
{
- m_value = m_trans.apply(C3DFVector(get_pos()));
- m_dx = m_trans.apply(C3DFVector(get_pos().x + 1.0, get_pos().y, get_pos().z)) - m_value;
+ m_value = m_trans.get_displacement_at(C3DFVector(get_pos()));
+ m_dx = m_trans.get_displacement_at(C3DFVector(get_pos().x + 1.0, get_pos().y, get_pos().z)) - m_value;
}
void C3DRAffineTransformation::iterator_impl::do_z_increment()
{
- m_value = m_trans.apply(C3DFVector(get_pos()));
- m_dx = m_trans.apply(C3DFVector(get_pos().x + 1.0, get_pos().y, get_pos().z)) - m_value;
+ m_value = m_trans.get_displacement_at(C3DFVector(get_pos()));
+ m_dx = m_trans.get_displacement_at(C3DFVector(get_pos().x + 1.0, get_pos().y, get_pos().z)) - m_value;
}
diff --git a/mia/3d/transform/raffine.hh b/mia/3d/transform/raffine.hh
index 4de15e9..e2ecc3a 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,7 +37,7 @@ public:
const mia::C3DFVector& rot_axis,
const mia::C3DInterpolatorFactory& ipf);
- mia::C3DFVector apply(const mia::C3DFVector& x) const;
+ mia::C3DFVector get_displacement_at(const mia::C3DFVector& x) const;
class EXPORT_3D iterator_impl: public mia::C3DTransformation::iterator_impl {
public:
diff --git a/mia/3d/transform/rigid.cc b/mia/3d/transform/rigid.cc
index 7c7f8d4..2e33baa 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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
using namespace std;
-C3DFVector C3DRigidTransformation::apply(const C3DFVector& x) const
+C3DFVector C3DRigidTransformation::get_displacement_at(const C3DFVector& x) const
{
CScopedLock lock(m_mutex);
if (!m_matrix_valid)
@@ -273,9 +273,9 @@ float C3DRigidTransformation::get_max_transform() const
C3DFVector(get_size().x-1, get_size().y-1, get_size().z-1),
};
- float result = apply(C3DFVector()).norm2();
+ float result = get_displacement_at(C3DFVector()).norm2();
for(int i = 0; i < 8; ++i) {
- float h = (apply(corners[i]) - corners[i]).norm2();
+ float h = (get_displacement_at(corners[i]) - corners[i]).norm2();
if (result < h)
result = h;
}
@@ -286,7 +286,7 @@ float C3DRigidTransformation::get_max_transform() const
C3DFVector C3DRigidTransformation::operator () (const C3DFVector& x) const
{
- return apply(x);
+ return get_displacement_at(x);
}
float C3DRigidTransformation::get_jacobian(const C3DFVectorfield& /*v*/, float /*delta*/) const
@@ -339,9 +339,9 @@ C3DRigidTransformation::iterator_impl::iterator_impl(const C3DBounds& pos, const
const C3DRigidTransformation& trans):
C3DTransformation::iterator_impl(pos, size),
m_trans(trans),
- m_value(trans.apply(C3DFVector(pos)))
+ m_value(trans.get_displacement_at(C3DFVector(pos)))
{
- m_dx = m_trans.apply(C3DFVector(pos.x + 1.0, pos.y, pos.z)) - m_value;
+ m_dx = m_trans.get_displacement_at(C3DFVector(pos.x + 1.0, pos.y, pos.z)) - m_value;
}
C3DRigidTransformation::iterator_impl::iterator_impl(const C3DBounds& pos, const C3DBounds& begin,
@@ -349,9 +349,9 @@ C3DRigidTransformation::iterator_impl::iterator_impl(const C3DBounds& pos, const
const C3DRigidTransformation& trans):
C3DTransformation::iterator_impl(pos, begin, end, size),
m_trans(trans),
- m_value(trans.apply(C3DFVector(pos)))
+ m_value(trans.get_displacement_at(C3DFVector(pos)))
{
- m_dx = m_trans.apply(C3DFVector(pos.x + 1.0, pos.y, pos.z)) - m_value;
+ m_dx = m_trans.get_displacement_at(C3DFVector(pos.x + 1.0, pos.y, pos.z)) - m_value;
}
C3DTransformation::iterator_impl * C3DRigidTransformation::iterator_impl::clone() const
@@ -371,14 +371,14 @@ void C3DRigidTransformation::iterator_impl::do_x_increment()
void C3DRigidTransformation::iterator_impl::do_y_increment()
{
- m_value = m_trans.apply(C3DFVector(get_pos()));
- m_dx = m_trans.apply(C3DFVector(get_pos().x + 1.0, get_pos().y, get_pos().z)) - m_value;
+ m_value = m_trans.get_displacement_at(C3DFVector(get_pos()));
+ m_dx = m_trans.get_displacement_at(C3DFVector(get_pos().x + 1.0, get_pos().y, get_pos().z)) - m_value;
}
void C3DRigidTransformation::iterator_impl::do_z_increment()
{
- m_value = m_trans.apply(C3DFVector(get_pos()));
- m_dx = m_trans.apply(C3DFVector(get_pos().x + 1.0, get_pos().y, get_pos().z)) - m_value;
+ m_value = m_trans.get_displacement_at(C3DFVector(get_pos()));
+ m_dx = m_trans.get_displacement_at(C3DFVector(get_pos().x + 1.0, get_pos().y, get_pos().z)) - m_value;
}
C3DTransformation::const_iterator C3DRigidTransformation::begin() const
diff --git a/mia/3d/transform/rigid.hh b/mia/3d/transform/rigid.hh
index 8bea1ea..b781d41 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -43,7 +43,7 @@ public:
void translate(float x, float y, float z);
void rotate(float xy, float xz, float yz);
- C3DFVector apply(const C3DFVector& x) const;
+ C3DFVector get_displacement_at(const C3DFVector& x) const;
class EXPORT_3D iterator_impl: public C3DTransformation::iterator_impl {
diff --git a/mia/3d/transform/rotation.cc b/mia/3d/transform/rotation.cc
index 6bb6391..ecbde7c 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,9 +67,9 @@ void C3DRotationTransformation::initialize()
m_rot_center = C3DFVector(m_size - C3DBounds::_1) * m_relative_rot_center;
}
-C3DFVector C3DRotationTransformation::apply(const C3DFVector& x) const
+C3DFVector C3DRotationTransformation::get_displacement_at(const C3DFVector& x) const
{
- return transform(x);
+ return transform(x) - x;
}
@@ -227,9 +227,9 @@ float C3DRotationTransformation::get_max_transform() const
C3DFVector(get_size()) - C3DFVector::_1
};
- float result = apply(C3DFVector()).norm2();
+ float result = transform(C3DFVector()).norm2();
for(int i = 0; i < 7; ++i) {
- float h = (apply(corners[i]) - corners[i]).norm2();
+ float h = (transform(corners[i]) - corners[i]).norm2();
if (result < h)
result = h;
}
@@ -241,7 +241,7 @@ float C3DRotationTransformation::get_max_transform() const
C3DFVector C3DRotationTransformation::operator () (const C3DFVector& x) const
{
- return apply(x);
+ return transform(x);
}
float C3DRotationTransformation::get_jacobian(const C3DFVectorfield& /*v*/, float /*delta*/) const
@@ -291,7 +291,7 @@ C3DRotationTransformation::iterator_impl::iterator_impl(const C3DBounds& pos, co
const C3DRotationTransformation& trans):
C3DTransformation::iterator_impl(pos, begin, end, size),
m_trans(trans),
- m_value(trans.apply(C3DFVector(pos)))
+ m_value(trans.transform(C3DFVector(pos)))
{
m_dx = m_trans.transform(C3DFVector(pos.x + 1.0, pos.y, pos.z)) - m_value;
}
diff --git a/mia/3d/transform/rotation.hh b/mia/3d/transform/rotation.hh
index df2eb15..6960543 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -42,7 +42,7 @@ public:
void rotate(float xy, float xz, float yz);
- C3DFVector apply(const C3DFVector& x) const;
+ C3DFVector get_displacement_at(const C3DFVector& x) const;
class EXPORT_3D iterator_impl: public C3DTransformation::iterator_impl {
diff --git a/mia/3d/transform/rotbend.cc b/mia/3d/transform/rotbend.cc
index 811c9ca..e7f5ae5 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,9 @@ using namespace std;
-C3DFVector C3DRotBendTransformation::apply(const C3DFVector& x) const
+C3DFVector C3DRotBendTransformation::get_displacement_at(const C3DFVector& x) const
{
- return transform(x);
+ return transform(x) - x;
}
@@ -159,9 +159,9 @@ float C3DRotBendTransformation::get_max_transform() const
C3DFVector(get_size())
};
- float result = apply(C3DFVector()).norm2();
+ float result = transform(C3DFVector()).norm2();
for(int i = 0; i < 7; ++i) {
- float h = (apply(corners[i]) - corners[i]).norm2();
+ float h = (transform(corners[i]) - corners[i]).norm2();
if (result < h)
result = h;
}
@@ -172,7 +172,7 @@ float C3DRotBendTransformation::get_max_transform() const
C3DFVector C3DRotBendTransformation::operator () (const C3DFVector& x) const
{
- return apply(x);
+ return transform(x);
}
float C3DRotBendTransformation::get_jacobian(const C3DFVectorfield& /*v*/, float /*delta*/) const
@@ -192,9 +192,9 @@ C3DRotBendTransformation::iterator_impl::iterator_impl(const C3DBounds& pos, con
const C3DRotBendTransformation& trans):
C3DTransformation::iterator_impl(pos, size),
m_trans(trans),
- m_value(trans.apply(C3DFVector(pos)))
+ m_value(trans.transform(C3DFVector(pos)))
{
- m_dx = m_trans.apply(C3DFVector(pos.x + 1.0, pos.y, pos.z)) - m_value;
+ m_dx = m_trans.transform(C3DFVector(pos.x + 1.0, pos.y, pos.z)) - m_value;
}
C3DRotBendTransformation::iterator_impl::iterator_impl(const C3DBounds& pos, const C3DBounds& begin,
@@ -202,9 +202,9 @@ C3DRotBendTransformation::iterator_impl::iterator_impl(const C3DBounds& pos, con
const C3DRotBendTransformation& trans):
C3DTransformation::iterator_impl(pos, begin, end, size),
m_trans(trans),
- m_value(trans.apply(C3DFVector(pos)))
+ m_value(trans.transform(C3DFVector(pos)))
{
- m_dx = m_trans.apply(C3DFVector(pos.x + 1.0, pos.y, pos.z)) - m_value;
+ m_dx = m_trans.transform(C3DFVector(pos.x + 1.0, pos.y, pos.z)) - m_value;
}
C3DTransformation::iterator_impl * C3DRotBendTransformation::iterator_impl::clone() const
@@ -224,14 +224,14 @@ void C3DRotBendTransformation::iterator_impl::do_x_increment()
void C3DRotBendTransformation::iterator_impl::do_y_increment()
{
- m_value = m_trans.apply(C3DFVector(get_pos()));
- m_dx = m_trans.apply(C3DFVector(get_pos().x + 1.0, get_pos().y, get_pos().z)) - m_value;
+ m_value = m_trans.transform(C3DFVector(get_pos()));
+ m_dx = m_trans.transform(C3DFVector(get_pos().x + 1.0, get_pos().y, get_pos().z)) - m_value;
}
void C3DRotBendTransformation::iterator_impl::do_z_increment()
{
- m_value = m_trans.apply(C3DFVector(get_pos()));
- m_dx = m_trans.apply(C3DFVector(get_pos().x + 1.0, get_pos().y, get_pos().z)) - m_value;
+ m_value = m_trans.transform(C3DFVector(get_pos()));
+ m_dx = m_trans.transform(C3DFVector(get_pos().x + 1.0, get_pos().y, get_pos().z)) - m_value;
}
diff --git a/mia/3d/transform/rotbend.hh b/mia/3d/transform/rotbend.hh
index ac72e05..fd6b3bc 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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 @@ public:
C3DRotBendTransformation(const mia::C3DBounds& size, const mia::C3DFVector& orig, bool norot,
const mia::C3DInterpolatorFactory& ipf);
- mia::C3DFVector apply(const mia::C3DFVector& x) const;
+ mia::C3DFVector get_displacement_at(const mia::C3DFVector& x) const;
class EXPORT_3D iterator_impl: public mia::C3DTransformation::iterator_impl {
public:
diff --git a/mia/3d/transform/spline.cc b/mia/3d/transform/spline.cc
index 4ebcf5f..641fb17 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -290,7 +290,7 @@ C3DFVector C3DSplineTransformation::interpolate(const C3DFVector& x) const
return sum(start, xweights, yweights, zweights);
}
-C3DFVector C3DSplineTransformation::apply(const C3DFVector& x) const
+C3DFVector C3DSplineTransformation::get_displacement_at(const C3DFVector& x) const
{
TRACE_FUNCTION;
assert(m_scales_valid);
@@ -314,7 +314,7 @@ C3DTransformation *C3DSplineTransformation::invert() const
C3DFVector C3DSplineTransformation::operator () (const C3DFVector& x) const
{
TRACE_FUNCTION;
- return x - apply(x);
+ return x - get_displacement_at(x);
}
C3DFVector C3DSplineTransformation::scale( const C3DFVector& x) const
@@ -999,7 +999,7 @@ C3DSplineTransformCreatorPlugin::C3DSplineTransformCreatorPlugin():
"will be overwritten by the 'rate' value."));
add_parameter("debug",
- new CBoolParameter(m_debug, false, "enable additional debuging output"));
+ new CBoolParameter(m_debug, false, "enable additional debugging output"));
add_parameter("penalty", make_param(m_penalty, "", false, "transformation penalty energy term"));
}
diff --git a/mia/3d/transform/spline.hh b/mia/3d/transform/spline.hh
index 1080fe6..def1e19 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -43,7 +43,7 @@ public:
void set_coefficients(const C3DFVectorfield& field);
void set_coefficients_and_prefilter(const C3DFVectorfield& field);
void reinit()const;
- C3DFVector apply( const C3DFVector& x) const;
+ C3DFVector get_displacement_at( const C3DFVector& x) const;
C3DFVector scale( const C3DFVector& x) const;
virtual const C3DBounds& get_size() const;
diff --git a/mia/3d/transform/test_affine.cc b/mia/3d/transform/test_affine.cc
index ffa5a5e..ed23976 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 2394f8c..9642524 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 f75d7ba..387103e 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 ed0e075..66cf091 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 0edd6dc..9a5a278 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 02e99e6..d011036 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 acea2dc..54b4c7a 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 67be069..77d087d 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -235,7 +235,7 @@ BOOST_FIXTURE_TEST_CASE( test_splines_transformation, TransformSplineFixture )
BOOST_CHECK_CLOSE(scaled.y, testscale.y, 0.1);
BOOST_CHECK_CLOSE(scaled.z, testscale.z, 0.1);
- C3DFVector result_apply = stransf.apply(testx);
+ C3DFVector result_apply = stransf.get_displacement_at(testx);
BOOST_CHECK_CLOSE(result_apply.x, fx(testx), 0.1);
BOOST_CHECK_CLOSE(result_apply.y, fy(testx), 0.1);
BOOST_CHECK_CLOSE(result_apply.z, fz(testx), 0.1);
@@ -465,7 +465,7 @@ BOOST_FIXTURE_TEST_CASE( test_splines_update, TransformSplineFixture )
stransf.reinit();
C3DFVector testx(33.4, 20.4, 21.9);
- C3DFVector result = stransf.apply(testx);
+ C3DFVector result = stransf.get_displacement_at(testx);
BOOST_CHECK_CLOSE(result.x, fx(testx) + 2.0f, 0.1);
BOOST_CHECK_CLOSE(result.y, fy(testx) + 4.0f, 0.1);
@@ -556,7 +556,7 @@ BOOST_FIXTURE_TEST_CASE( test_splines_pertuberate, TransformSplineFixture )
fill(v.begin(), v.end(), vv);
- // this location is hand-picked and is not really the position ofthe maximun
+ // this location is hand-picked and is not really the position of the maximun
// but only an approximation
float gamma = stransf.pertuberate(v);
C3DFVector lmg(12* scalex, 27 * scaley);
diff --git a/mia/3d/transform/test_translate.cc b/mia/3d/transform/test_translate.cc
index 6852b00..5af6c28 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 2200193..6ada3ed 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -102,21 +102,21 @@ BOOST_FIXTURE_TEST_CASE(test_gridtransform_basic_props, GridTransformFixture)
C3DFVector testx0(22, 22, 23);
- C3DFVector result0 = field.apply(testx0);
+ C3DFVector result0 = field.get_displacement_at(testx0);
BOOST_CHECK_CLOSE(result0.x, fx(testx0), 1);
BOOST_CHECK_CLOSE(result0.y, fy(testx0), 1);
BOOST_CHECK_CLOSE(result0.z, fz(testx0), 1);
C3DFVector testx1(32.5, 22, 23);
- C3DFVector result1 = field.apply(testx1);
+ C3DFVector result1 = field.get_displacement_at(testx1);
BOOST_CHECK_CLOSE(result1.x, fx(testx1), 1);
BOOST_CHECK_CLOSE(result1.y, fy(testx1), 1);
BOOST_CHECK_CLOSE(result1.z, fz(testx1), 1);
C3DFVector testx2(32, 22, 23);
- C3DFVector result2 = field.apply(testx2);
+ C3DFVector result2 = field.get_displacement_at(testx2);
BOOST_CHECK_CLOSE(result2.x, fx(testx2), 1);
BOOST_CHECK_CLOSE(result2.y, fy(testx2), 1);
@@ -125,7 +125,7 @@ BOOST_FIXTURE_TEST_CASE(test_gridtransform_basic_props, GridTransformFixture)
// the non-linearity of the test function is quite high ...
C3DFVector testx(32.2, 21.9, 22.9);
- C3DFVector result = field.apply(testx);
+ C3DFVector result = field.get_displacement_at(testx);
BOOST_CHECK_CLOSE(result.x, fx(testx), 4);
BOOST_CHECK_CLOSE(result.y, fy(testx), 4);
@@ -137,6 +137,15 @@ BOOST_FIXTURE_TEST_CASE(test_gridtransform_basic_props, GridTransformFixture)
BOOST_CHECK_CLOSE(result.y, testx.y - fy(testx), 0.1);
BOOST_CHECK_CLOSE(result.z, testx.z - fz(testx), 0.1);
+
+ // 4.25 * 0.25 + 6.25 *0.75
+ C3DFVector ip_loc( 2.25, 1.75, 3.2);
+ auto ip = field.get_displacement_at(ip_loc);
+
+ BOOST_CHECK_CLOSE(ip.x, fx(ip_loc), 0.02);
+ BOOST_CHECK_CLOSE(ip.y, fy(ip_loc), 0.02);
+ BOOST_CHECK_CLOSE(ip.z, fz(ip_loc), 0.02);
+
}
BOOST_FIXTURE_TEST_CASE(test_gridtransform_derivative_1, GridTransformFixture)
@@ -149,7 +158,7 @@ BOOST_FIXTURE_TEST_CASE(test_gridtransform_derivative_1, GridTransformFixture)
BOOST_CHECK_CLOSE(dv.x.z, - dfz_x(v), 1);
BOOST_CHECK_CLOSE(dv.y.x, - dfx_y(v), 1);
BOOST_CHECK_CLOSE(dv.y.y, 1.0f - dfy_y(v), 1);
- BOOST_CHECK_CLOSE(dv.y.z, - dfz_y(v), 1);
+ BOOST_CHECK_CLOSE(dv.y.z, - dfz_y(v), 1);
BOOST_CHECK_CLOSE(dv.z.x, - dfx_z(v), 1);
BOOST_CHECK_CLOSE(dv.z.y, - dfy_z(v), 1);
BOOST_CHECK_CLOSE(dv.z.z, 1.0f - dfz_z(v), 1);
@@ -364,10 +373,10 @@ BOOST_AUTO_TEST_CASE( test_gridtransform_add )
C3DGridTransformation c = a + b;
- BOOST_CHECK_EQUAL( c.apply(C3DFVector(1,1,0)), C3DFVector(3,4,2));
- BOOST_CHECK_EQUAL( c.apply(C3DFVector(1,1,1)), C3DFVector(3,4,3));
- BOOST_CHECK_EQUAL( c.apply(C3DFVector(2,1,0)), C3DFVector(0.0,-0.5,0));
- BOOST_CHECK_EQUAL( c.apply(C3DFVector(1,2,0)), C3DFVector(-0.5,0.0,0));
+ BOOST_CHECK_EQUAL( c.get_displacement_at(C3DFVector(1,1,0)), C3DFVector(3,4,2));
+ BOOST_CHECK_EQUAL( c.get_displacement_at(C3DFVector(1,1,1)), C3DFVector(3,4,3));
+ BOOST_CHECK_EQUAL( c.get_displacement_at(C3DFVector(2,1,0)), C3DFVector(0.0,-0.5,0));
+ BOOST_CHECK_EQUAL( c.get_displacement_at(C3DFVector(1,2,0)), C3DFVector(-0.5,0.0,0));
}
diff --git a/mia/3d/transform/translate.cc b/mia/3d/transform/translate.cc
index 95f12a9..55aaec1 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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 @@ void C3DTranslateTransformation::translate(float x, float y, float z)
m_transform.z += z;
}
-C3DFVector C3DTranslateTransformation::apply(const C3DFVector& x) const
+C3DFVector C3DTranslateTransformation::get_displacement_at(const C3DFVector& x) const
{
return transform(x);
}
diff --git a/mia/3d/transform/translate.hh b/mia/3d/transform/translate.hh
index 1f0574b..48fa6af 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,7 +37,7 @@ public:
void translate(float x, float y, float z);
- C3DFVector apply(const C3DFVector& x) const;
+ C3DFVector get_displacement_at(const C3DFVector& x) const;
class EXPORT_3D iterator_impl: public C3DTransformation::iterator_impl {
diff --git a/mia/3d/transform/vectorfield.cc b/mia/3d/transform/vectorfield.cc
index 0c9300f..f0ea8db 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,6 +33,11 @@ C3DGridTransformation::C3DGridTransformation(const C3DBounds& size, const C3DInt
{
}
+C3DFVector C3DGridTransformation::get_displacement_at(const C3DFVector& x) const
+{
+ return m_field.get_interpol_val_at(x);
+}
+
P3DTransformation C3DGridTransformation::do_upscale(const C3DBounds& size) const
{
/* This implementation could be improved by using something like the spline interpolator
@@ -296,7 +301,7 @@ void C3DGridTransformation::iterator_impl::do_z_increment()
C3DFVector C3DGridTransformation::operator ()(const C3DFVector& x) const
{
- return x - apply(x);
+ return x - get_displacement_at(x);
}
C3DGridTransformation::const_iterator C3DGridTransformation::begin() const
@@ -406,7 +411,7 @@ EXPORT_3D C3DGridTransformation operator + (const C3DGridTransformation& a, cons
for (size_t y = 0; y < a.get_size().y; ++y) {
for (size_t x = 0; x < a.get_size().x; ++x, ++ri, ++bi) {
const C3DFVector xi = C3DFVector(x,y,z) - *bi;
- *ri = a.apply(xi) + *bi;
+ *ri = a.get_displacement_at(xi) + *bi;
}
}
}
diff --git a/mia/3d/transform/vectorfield.hh b/mia/3d/transform/vectorfield.hh
index f45b93b..80a245c 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -43,7 +43,7 @@ public:
// operator C3DFVectorfield&();
- C3DFVector apply(const C3DFVector& x) const;
+ C3DFVector get_displacement_at(const C3DFVector& x) const;
// C3DFVectorfield& field() __attribute__((deprecated)) ;
// const C3DFVectorfield& field() const __attribute__((deprecated)) ;
@@ -109,10 +109,6 @@ private:
EXPORT_3D C3DGridTransformation operator + (const C3DGridTransformation& a, const C3DGridTransformation& b);
};
-inline C3DFVector C3DGridTransformation::apply(const C3DFVector& x) const
-{
- return m_field.get_interpol_val_at(x);
-}
EXPORT_3D C3DGridTransformation operator + (const C3DGridTransformation& a, const C3DGridTransformation& b);
diff --git a/mia/3d/transformfactory.cc b/mia/3d/transformfactory.cc
index 270d5fe..2241f26 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 612f2fd..9366a1e 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 3bd5f25..720ae6d 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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.hh b/mia/3d/transformio.hh
index 2880468..f089f01 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 3178955..03e1a68 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -120,7 +120,7 @@ float C3DTransformMock::pertuberate(C3DFVectorfield&) const
return 1.1;
}
-C3DFVector C3DTransformMock::apply(const C3DFVector& x) const
+C3DFVector C3DTransformMock::get_displacement_at(const C3DFVector& x) const
{
if (x.x == 0.0 && x.y == 0.0)
return C3DFVector(-1.2, -2.3, -4.3);
@@ -130,7 +130,7 @@ C3DFVector C3DTransformMock::apply(const C3DFVector& x) const
C3DFVector C3DTransformMock::operator () (const C3DFVector& x) const
{
- return x - apply(x);
+ return x - get_displacement_at(x);
}
float C3DTransformMock::get_jacobian(const C3DFVectorfield&, float delta) const
diff --git a/mia/3d/transformmock.hh b/mia/3d/transformmock.hh
index 2376e63..dbf75a1 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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 @@ public:
virtual void set_parameters(const CDoubleVector& params);
virtual const C3DBounds& get_size() const;
virtual float pertuberate(C3DFVectorfield& v) const;
- virtual C3DFVector apply(const C3DFVector& x) const;
+ virtual C3DFVector get_displacement_at(const C3DFVector& x) const;
virtual C3DFVector operator () (const C3DFVector& x) const;
virtual float get_jacobian(const C3DFVectorfield& v, float delta) const;
virtual float divergence() const;
diff --git a/mia/3d/transio/bbs.cc b/mia/3d/transio/bbs.cc
index f00be39..2215801 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 0541300..037414a 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 9ddb082..7d927ff 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 7ffd4d7..0b0e09a 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 2a06c3c..548f883 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 aec99d5..5b4ad84 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,9 +17,10 @@
* along with MIA; if not, see <http://www.gnu.org/licenses/>.
*
*/
-
+#include <gsl/gsl_cblas.h>
#include <mia/core/parallel.hh>
+#include <mia/core/threadedmsg.hh>
#include <mia/3d/vectorfield.hh>
#include <mia/3d/datafield.cxx>
@@ -27,9 +28,15 @@
#include <mia/3d/iterator.cxx>
#include <mia/2d/iterator.cxx>
+#ifdef __SSE__
+#include <xmmintrin.h>
+#endif
+
NS_MIA_BEGIN
+const char *C3DFVectorfield::data_descr = "3dvf";
+
EXPORT_3D C3DFVectorfield& operator += (C3DFVectorfield& a, const C3DFVectorfield& b)
{
assert(a.get_size() == b.get_size());
@@ -54,6 +61,327 @@ EXPORT_3D C3DFVectorfield& operator += (C3DFVectorfield& a, const C3DFVectorfiel
return a;
}
+
+
+template <typename T>
+T T3DVectorfield<T>::get_interpol_val_at(const C3DFVector& p) const
+{
+ // Calculate the coordinates and the distances
+ size_t x = (size_t)p.x;
+ size_t y = (size_t)p.y;
+ size_t z = (size_t)p.z;
+ float fx = p.x-x;
+ float fy = p.y-y;
+ float fz = p.z-z;
+
+ float dx = 1-fx;
+ float dy = 1-fy;
+ float dz = 1-fz;
+
+ if ( x < this->get_size().x-1 && y < this->get_size().y -1 && z < this->get_size().z -1 ) {
+
+ const T *ptr = &(*this)[x + this->get_size().x * (y + this->get_size().y * z)];
+ const T *ptr_h = &ptr[this->get_size().x];
+ const T *ptr2 = &ptr[this->get_plane_size_xy()];
+ const T *ptr2_h = &ptr2[this->get_size().x];
+ const T a1 = T(dx * ptr[0] + fx * ptr[1]);
+ const T a3 = T(dx * ptr_h[0] + fx * ptr_h[1]);
+ const T a5 = T(dx * ptr2[0] + fx * ptr2[1]);
+ const T a7 = T(dx * ptr2_h[0] + fx * ptr2_h[1]);
+ const T b1 = T(dy * a1 + fy * a3);
+ const T b2 = T(dy * a5 + fy * a7);
+ return T(dz * b1 + fz * b2);
+ } else {
+ const T a1 = T(dx * (*this)(x , y , z ) + fx * (*this)(x+1, y , z ));
+ const T a3 = T(dx * (*this)(x , y+1, z ) + fx * (*this)(x+1, y+1, z ));
+ const T a5 = T(dx * (*this)(x , y , z+1) + fx * (*this)(x+1, y , z+1));
+ const T a7 = T(dx * (*this)(x , y+1, z+1) + fx * (*this)(x+1, y+1, z+1));
+ const T b1 = T(dy * a1 + fy * a3);
+ const T b2 = T(dy * a5 + fy * a7);
+ return T(dz * b1 + fz * b2);
+ }
+}
+
+void C3DFVectorfield::update_as_inverse_of(const C3DFVectorfield& other, float tol, int maxiter)
+{
+ assert(get_size() == other.get_size());
+
+ float tol2 = tol * tol;
+
+ C3DLinearVectorfieldInterpolator t(other);
+
+ C1DParallelRange range(0, get_size().z, 1);
+
+ auto callback = [this, &t, tol2, maxiter](const C1DParallelRange& range) {
+ CThreadMsgStream msg;
+ for (auto z = range.begin(); z != range.end(); ++z) {
+ auto i = begin_at(0,0,z);
+ for (size_t y = 0; y < get_size().y; ++y) {
+ for (size_t x = 0; x < get_size().x; ++x, ++i) {
+ int iter = 0;
+ C3DFVector pos(x,y,z);
+ float dnorm = 0.0;
+ while (iter++ < maxiter) {
+ C3DFVector r = pos - *i;
+ C3DFVector ov = t(r);
+ C3DFVector i_delta = r - ov - pos;
+ dnorm = i_delta.norm2();
+
+ if ( dnorm < tol2) {
+ break;
+ }
+ *i += 0.5 * i_delta;
+
+
+ }
+ }
+ }
+ }
+ };
+
+ pfor( range, callback );
+}
+
+void C3DFVectorfield::update_by_velocity(const C3DFVectorfield& velocity_field, float time_step)
+{
+ // hoping that the cblas implementation takes care of threading
+ cblas_saxpy(velocity_field.size() * 3, time_step, &velocity_field[0].x, 1, &(*this)[0].x, 1);
+}
+
+struct C3DLinearVectorfieldInterpolatorImpl {
+ C3DLinearVectorfieldInterpolatorImpl(const C3DFVector& x);
+#ifdef __SSE__
+ __m128 last_elm;
+#endif
+ size_t m_field_size_m2;
+};
+
+C3DLinearVectorfieldInterpolatorImpl::C3DLinearVectorfieldInterpolatorImpl(const C3DFVector& v)
+{
+#ifdef __SSE__
+ last_elm = _mm_set_ps(0.0f, v.z, v.y, v.x);
+#endif
+}
+
+C3DLinearVectorfieldInterpolator::C3DLinearVectorfieldInterpolator(const C3DFVectorfield& field):
+ m_field(field),
+ m_save_index_range(m_field.size() - m_field.get_plane_size_xy()
+ - m_field.get_size().x - 2),
+ m_field_size_m1(m_field.size() - 1),
+ impl(nullptr)
+{
+#ifdef __SSE__
+ impl = new C3DLinearVectorfieldInterpolatorImpl(m_field[m_field_size_m1]);
+#endif
+ impl->m_field_size_m2 = m_field.size() - 2;
+}
+
+C3DLinearVectorfieldInterpolator::~C3DLinearVectorfieldInterpolator()
+{
+#ifdef __SSE__
+ delete impl;
+#endif
+}
+
+#ifdef __SSE__
+C3DFVector C3DLinearVectorfieldInterpolator::operator()(const C3DFVector& x) const
+{
+ C3DFVector result = C3DFVector::_0;
+
+ const C3DFVector h(floor(x.x), floor(x.y), floor(x.z));
+
+ const C3DBounds ip(static_cast<unsigned int>(h.x),
+ static_cast<unsigned int>(h.y),
+ static_cast<unsigned int>(h.z));
+
+ if (ip < m_field.get_size()) {
+ size_t linear_index = ip.x + m_field.get_size().x * (ip.y + ip.z * m_field.get_size().y);
+
+ const C3DFVector w1 = x - h;
+
+ if (w1 == C3DFVector::_0) {
+ // early exist for this special case
+ result = m_field[linear_index];
+ }else{
+
+ // note that the 4th value of the SSE register contains garbage,
+ // i.e. loads the x value of the next vector in the field.
+ //
+ const C3DFVector w0 = C3DFVector::_1 - w1;
+
+ __m128 in[8];
+ if (linear_index < m_save_index_range) {
+ // in this case all the values we access are certain to be
+ // within the allocated range
+ in[0] = _mm_loadu_ps(&m_field[linear_index].x);
+ in[1] = _mm_loadu_ps(&m_field[linear_index + 1].x);
+
+ const size_t linear_index_y1 = linear_index + m_field.get_size().x;
+
+ in[2] = _mm_loadu_ps(&m_field[linear_index_y1].x);
+ in[3] = _mm_loadu_ps(&m_field[linear_index_y1 + 1].x);
+
+ linear_index += m_field.get_plane_size_xy();
+ in[4] = _mm_loadu_ps(&m_field[linear_index].x);
+ in[5] = _mm_loadu_ps(&m_field[linear_index + 1].x);
+
+ linear_index += m_field.get_size().x;
+ in[6] = _mm_loadu_ps(&m_field[linear_index].x);
+ in[7] = _mm_loadu_ps(&m_field[linear_index + 1].x);
+
+ }else {
+ // We can not assume that all access would be to the data inside
+ // the allocated range
+ memset(in, 0, 8*sizeof(__m128));
+ if (linear_index < m_field_size_m1)
+ in[0] = _mm_loadu_ps(&m_field[linear_index].x);
+ else
+ in[0] = impl->last_elm;
+
+ if (linear_index < impl->m_field_size_m2)
+ in[1] = _mm_loadu_ps(&m_field[linear_index + 1].x);
+ else
+ in[1] = impl->last_elm;
+
+ size_t linear_index_y1 = linear_index + m_field.get_size().x;
+
+ if (linear_index_y1 < impl->m_field_size_m2) {
+ in[2] = _mm_loadu_ps(&m_field[linear_index_y1].x);
+ in[3] = _mm_loadu_ps(&m_field[linear_index_y1 + 1].x);
+ }else if (linear_index_y1 == impl->m_field_size_m2) {
+ in[2] = _mm_loadu_ps(&m_field[linear_index_y1].x);
+ in[3] = impl->last_elm;
+ }else if (linear_index_y1 == m_field_size_m1) {
+ in[2] = impl->last_elm;
+ }
+
+ linear_index += m_field.get_plane_size_xy();
+ if (linear_index < impl->m_field_size_m2) {
+ in[4] = _mm_loadu_ps(&m_field[linear_index].x);
+ in[5] = _mm_loadu_ps(&m_field[linear_index + 1].x);
+ }else if (linear_index == impl->m_field_size_m2) {
+ in[4] = _mm_loadu_ps(&m_field[linear_index].x);
+ in[5] = impl->last_elm;
+ }else if (linear_index == m_field_size_m1) {
+ in[4] = impl->last_elm;
+ }
+
+ linear_index += m_field.get_size().x;
+ if (linear_index < impl->m_field_size_m2) {
+ in[6] = _mm_loadu_ps(&m_field[linear_index].x);
+ in[7] = _mm_loadu_ps(&m_field[linear_index + 1].x);
+ }else if (linear_index == impl->m_field_size_m2) {
+ in[6] = _mm_loadu_ps(&m_field[linear_index].x);
+ in[7] = impl->last_elm;
+ }else if (linear_index == m_field_size_m1) {
+ in[6] = impl->last_elm;
+ }
+ }
+
+
+ const __m128 w0x = _mm_set1_ps(w0.x);
+ const __m128 w1x = _mm_set1_ps(w1.x);
+
+ const __m128 w0y = _mm_set1_ps(w0.y);
+ const __m128 w1y = _mm_set1_ps(w1.y);
+
+ const __m128 w0z = _mm_set1_ps(w0.z);
+ const __m128 w1z = _mm_set1_ps(w1.z);
+
+ const __m128 r =
+ w0z * (w0y * ( w0x * in[0] + w1x * in[1]) +
+ w1y * ( w0x * in[2] + w1x * in[3])) +
+ w1z * (w0y * ( w0x * in[4] + w1x * in[5]) +
+ w1y * ( w0x * in[6] + w1x * in[7]));
+
+ float __attribute__((aligned(16))) result_help[4];
+ _mm_store_ps(result_help, r);
+ result.x = result_help[0];
+ result.y = result_help[1];
+ result.z = result_help[2];
+ }
+ }
+ return result;
+
+}
+#else // no sse
+C3DFVector C3DLinearVectorfieldInterpolator::operator ()(const C3DFVector& x) const
+{
+ C3DFVector result = C3DFVector::_0;
+
+ const C3DFVector h(floor(x.x), floor(x.y), floor(x.z));
+
+
+ const C3DBounds ip(static_cast<unsigned int>(h.x),
+ static_cast<unsigned int>(h.y),
+ static_cast<unsigned int>(h.z));
+
+
+ if (ip < m_field.get_size()) {
+ size_t linear_index = ip.x + m_field.get_size().x * (ip.y + ip.z * m_field.get_size().y);
+
+ const C3DFVector& in000 = m_field[linear_index];
+
+ const C3DFVector w1 = x - h;
+
+ if (w1 == C3DFVector::_0) {
+ // early exist for this special case
+ result = in000;
+ }else {
+ const C3DFVector w0 = C3DFVector::_1 - w1;
+
+
+ if (linear_index < m_save_index_range) {
+ // with above test we don't need check for boundaries
+
+ const C3DFVector& in001 = m_field[linear_index + 1];
+
+ size_t linear_index_y1 = linear_index + m_field.get_size().x;
+ const C3DFVector& in010 = m_field[linear_index_y1];
+ const C3DFVector& in011 = m_field[linear_index_y1 + 1];
+
+ linear_index += m_field.get_plane_size_xy();
+
+ const C3DFVector& in100 = m_field[linear_index];
+ const C3DFVector& in101 = m_field[linear_index + 1];
+
+ linear_index += m_field.get_size().x;
+ const C3DFVector& in110 = m_field[linear_index];
+
+ // here we have to check, because otherwise we might access
+ // data outside the allocated memory.
+ ++linear_index;
+ const C3DFVector& in111 = m_field[linear_index];
+
+ // now interpolate
+ result = w0.z * (w0.y * ( w0.x * in000 + w1.x * in001) +
+ w1.y * ( w0.x * in010 + w1.x * in011)) +
+ w1.z * (w0.y * ( w0.x * in100 + w1.x * in101) +
+ w1.y * ( w0.x * in110 + w1.x * in111));
+
+ } else {
+ // use the slow operator that always tests to get the
+ // elements
+ const C3DFVector& in001 = m_field(ip.x+1,ip.y, ip.z);
+ const C3DFVector& in010 = m_field(ip.x,ip.y+1, ip.z);
+ const C3DFVector& in011 = m_field(ip.x+1,ip.y+1, ip.z);
+
+ const C3DFVector& in100 = m_field(ip.x,ip.y, ip.z+1);
+ const C3DFVector& in101 = m_field(ip.x+1,ip.y, ip.z+1);
+ const C3DFVector& in110 = m_field(ip.x,ip.y+1, ip.z+1);
+ const C3DFVector& in111 = m_field(ip.x+1,ip.y+1, ip.z+1);
+ result = w0.z * (w0.y * ( w0.x * in000 + w1.x * in001) +
+ w1.y * ( w0.x * in010 + w1.x * in011)) +
+ w1.z * (w0.y * ( w0.x * in100 + w1.x * in101) +
+ w1.y * ( w0.x * in110 + w1.x * in111)); ;
+ }
+
+ }
+ }
+ return result;
+}
+#endif
+
#define INSTANCIATE(TYPE) \
template class T3DDatafield<TYPE>; \
template class range3d_iterator<T3DDatafield<TYPE>::iterator>; \
@@ -68,13 +396,25 @@ EXPORT_3D C3DFVectorfield& operator += (C3DFVectorfield& a, const C3DFVectorfiel
template class range2d_iterator<T2DDatafield<TYPE>::const_iterator>;
+#ifdef __GNUC__
+#pragma GCC diagnostic push
+#ifndef __clang__
+#pragma GCC diagnostic ignored "-Wattributes"
+#endif
+#endif
+
INSTANCIATE2D(C3DFVector);
INSTANCIATE2D(C3DDVector);
INSTANCIATE(C3DFVector);
INSTANCIATE(C3DDVector);
-template class T3DVectorfield<C3DFVector>;
-template class T3DVectorfield<C3DDVector>;
+template class EXPORT_3D T3DVectorfield<C3DFVector>;
+template class EXPORT_3D T3DVectorfield<C3DDVector>;
+
+#ifdef __GNUC__
+#pragma GCC diagnostic pop
+#endif
+
diff --git a/mia/3d/vectorfield.hh b/mia/3d/vectorfield.hh
index b33aad4..a6f87fc 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,9 +57,9 @@ public:
T3DVectorfield(const C3DBounds& size, const CAttributedData& data):
T3DDatafield<T>(size),
CAttributedData(data)
- {
- }
-
+ {
+ }
+
C3DFVector get_voxel_size() const {
const PAttribute attr = get_attribute("voxel");
if (!attr) {
@@ -67,7 +67,7 @@ public:
"voxel size not defined, default to <1,1,1>\n";
return C3DFVector(1,1,1);
}
-
+
const CVoxelAttribute * vs = dynamic_cast<const CVoxelAttribute *>(attr.get());
if (!vs){
cvinfo() << "T3DImage<T>::get_voxel_size(): voxel size wrong type, "
@@ -76,14 +76,19 @@ public:
}
return *vs;
}
-
+
void set_voxel_size(const C3DFVector& voxel){
set_attribute("voxel", PAttribute(new CVoxelAttribute(voxel)));
}
+
+ /** Interpolate the value of Field at p default uses tri-linear interpolation */
+ T get_interpol_val_at(const C3DFVector& p) const;
+
+
};
-extern template class EXPORT_3D T3DVectorfield<C3DFVector>;
+extern template class EXPORT_3D T3DVectorfield<C3DFVector>;
/**
@ingroup basic
@brief a 3D field of floating point single accuracy 3D vectors
@@ -91,22 +96,34 @@ extern template class EXPORT_3D T3DVectorfield<C3DFVector>;
class EXPORT_3D C3DFVectorfield : public T3DVectorfield<C3DFVector> {
public:
static const char *data_descr;
-
- using T3DVectorfield<C3DFVector>::T3DVectorfield;
+ using T3DVectorfield<C3DFVector>::T3DVectorfield;
+
+ /**
+ \brief evaluate this vector field as the inverse of another
+
+ This functions corrects the vector field to describe the inverse transformation
+ of a given input vector field
+
+ \param other the vector field this one should be inverse of
+ \param tol tolerance for inverse accuracy
+ \param maxiter maximum number of interations for one vector to be optimized
+ */
void update_as_inverse_of(const C3DFVectorfield& other, float tol, int maxiter);
+ /**
+ Update this vector field by using a velocity field
+ \param velocity_field the velocity field
+ \param time_step the time step to be used for the update
+ */
+ void update_by_velocity(const C3DFVectorfield& velocity_field, float time_step);
+
};
extern template class EXPORT_3D T3DVectorfield<C3DDVector>;
-
-/**
- @ingroup basic
- @brief a 3D field of floating point single accuracy 3D vectors
-*/
typedef std::shared_ptr<C3DFVectorfield > P3DFVectorfield;
/**
@@ -122,9 +139,24 @@ typedef T3DVectorfield<C3DDVector> C3DDVectorfield;
\param[in,out] lhs left input vector field and output
\param[in] rhs right input vector field and output
\returns lhs after processing
- */
+*/
EXPORT_3D C3DFVectorfield& operator += (C3DFVectorfield& lhs, const C3DFVectorfield& rhs);
+
+struct C3DLinearVectorfieldInterpolatorImpl;
+class EXPORT_3D C3DLinearVectorfieldInterpolator {
+public:
+ C3DLinearVectorfieldInterpolator(const C3DFVectorfield& field);
+ ~C3DLinearVectorfieldInterpolator();
+
+ C3DFVector operator () (const C3DFVector& x) const;
+private:
+ const C3DFVectorfield& m_field;
+ const size_t m_save_index_range;
+ const size_t m_field_size_m1;
+ C3DLinearVectorfieldInterpolatorImpl *impl;
+};
+
NS_MIA_END
#endif
diff --git a/mia/3d/vfio.cc b/mia/3d/vfio.cc
index 72d6552..8c987d2 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,8 +28,6 @@
NS_MIA_BEGIN
-const char *io_3dvf_data::data_descr = "3dvf";
-
C3DIOVectorfield::C3DIOVectorfield()
{
}
@@ -60,8 +58,8 @@ template <> const char * const
TPluginHandler<C3DVFIOPlugin>::m_help =
"These plug-ins implement loading and saving of vector fields to certain file formats.";
-template class TPlugin<io_3dvf_data, io_plugin_type>;
-template class TIOPlugin<io_3dvf_data>;
+template class TPlugin<C3DIOVectorfield, io_plugin_type>;
+template class TIOPlugin<C3DIOVectorfield>;
template class THandlerSingleton<TIOPluginHandler<C3DVFIOPlugin> >;
template class TIOPluginHandler<C3DVFIOPlugin>;
template class TPluginHandler<C3DVFIOPlugin>;
diff --git a/mia/3d/vfio.hh b/mia/3d/vfio.hh
index 02a8895..9fee619 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,6 +36,10 @@ NS_MIA_BEGIN
class EXPORT_3D C3DIOVectorfield: public C3DFVectorfield, public CIOData {
public:
+
+ typedef C3DIOVectorfield type;
+ typedef C3DFVectorfield plugin_data;
+
C3DIOVectorfield();
/** Constructor to create empty Datafield if given size */
@@ -52,23 +56,16 @@ public:
};
-///@cond INTERNAL
-struct io_3dvf_data {
- typedef C3DIOVectorfield type;
- static const char *data_descr;
-};
-///@endcond
-
/**
@ingroup io
@brief Base class for vector field IO plug-ins
*/
-typedef TIOPlugin<io_3dvf_data> C3DVFIOPlugin;
+typedef TIOPlugin<C3DIOVectorfield> C3DVFIOPlugin;
template <> const char * const TPluginHandler<C3DVFIOPlugin>::m_help;
-extern template class EXPORT_3D TPlugin<io_3dvf_data, io_plugin_type>;
-extern template class EXPORT_3D TIOPlugin<io_3dvf_data>;
+extern template class EXPORT_3D TPlugin<C3DIOVectorfield, io_plugin_type>;
+extern template class EXPORT_3D TIOPlugin<C3DIOVectorfield>;
extern template class EXPORT_3D TIOPluginHandler<C3DVFIOPlugin>;
extern template class EXPORT_3D THandlerSingleton<TIOPluginHandler<C3DVFIOPlugin> >;
/**
diff --git a/mia/3d/vfiotest.cc b/mia/3d/vfiotest.cc
index f60f0cb..bf6b3a7 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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 0619573..01e2baf 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you 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.cc b/mia/3d/vfregularizer.cc
new file mode 100644
index 0000000..3370dc2
--- /dev/null
+++ b/mia/3d/vfregularizer.cc
@@ -0,0 +1,72 @@
+/* -*- mia-c++ -*-
+ *
+ * This file is part of MIA - a toolbox for medical image analysis
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
+ *
+ * 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/export_handler.hh>
+#include <mia/3d/vfregularizer.hh>
+
+#include <mia/core/handler.cxx>
+#include <mia/core/plugin_base.cxx>
+
+NS_MIA_BEGIN
+
+const char *C3DFVectorfieldRegularizer::type_descr = "regularizer";
+
+C3DFVectorfieldRegularizer::~C3DFVectorfieldRegularizer()
+{
+}
+
+double C3DFVectorfieldRegularizer::run(C3DFVectorfield& velocity, C3DFVectorfield& force, const C3DFVectorfield& deform) const
+{
+ assert(velocity.get_size() == m_size);
+ assert(force.get_size() == m_size);
+ assert(deform.get_size() == m_size);
+
+ return do_run(velocity, force, deform);
+}
+
+void C3DFVectorfieldRegularizer::set_size(const C3DBounds& size)
+{
+ if (size != m_size) {
+ m_size = size;
+ on_size_changed();
+ }
+}
+
+const C3DBounds& C3DFVectorfieldRegularizer::get_size() const
+{
+ return m_size;
+}
+
+void C3DFVectorfieldRegularizer::on_size_changed()
+{
+
+}
+
+template <> const char * const
+TPluginHandler<C3DFVectorfieldRegularizerPlugin>::m_help =
+ "This class of plug-ins implement various regularizations for "
+ "3D vector fields that are typically used in image registration "
+ "to translate the force driving the registration to a smooth "
+ "velocity field.";
+
+EXPLICIT_INSTANCE_HANDLER(C3DFVectorfieldRegularizer);
+
+NS_MIA_END
+
diff --git a/mia/3d/vfregularizer.hh b/mia/3d/vfregularizer.hh
new file mode 100644
index 0000000..fd576f0
--- /dev/null
+++ b/mia/3d/vfregularizer.hh
@@ -0,0 +1,107 @@
+/* -*- mia-c++ -*-
+ *
+ * This file is part of MIA - a toolbox for medical image analysis
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
+ *
+ * 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_vectorfieldregularizer_hh
+#define mia_3d_vectorfieldregularizer_hh
+
+
+#include <mia/core/factory.hh>
+#include <mia/3d/vectorfield.hh>
+
+NS_MIA_BEGIN
+
+/**
+ @ingroup registration
+
+ Regularize a 3D vector field with some model
+
+ This is the base class for a 3D vector field reguarlizer
+ that is typically used in non-linear registration to
+ evaluate a velocity field from a force field by applying
+ some regularization model on the input data.
+*/
+
+class EXPORT_3D C3DFVectorfieldRegularizer : public CProductBase {
+public:
+ typedef C3DFVectorfieldRegularizer plugin_type;
+ typedef C3DFVectorfield plugin_data;
+
+ static const char *type_descr;
+
+ typedef std::shared_ptr< C3DFVectorfieldRegularizer > Pointer;
+
+ virtual ~C3DFVectorfieldRegularizer();
+
+ /**
+ The work routine for the regularizer
+
+ \param [out] velocity the vector field that contains the reguarlized field
+ \param[in] force the vector field that containes the unregularized field,
+ e.g. a force field obtained from an image similarity measure. The field
+ may be overwritten by the regularization operation.
+ \param[in] deform the currently valid deformation
+ \returns the maximum of the norms of the vectors of the output field
+ */
+ double run(C3DFVectorfield& velocity, C3DFVectorfield& force, const C3DFVectorfield& deform) const;
+
+ /**
+ Sets the size of the vector fields that will be regularized. This method
+ is implemented to give the regularizer a chance to initialize additional
+ data structures. To do so a derived class has to override the method
+ on_size_changed(). \a on_size_changed() is only called if the size changes.
+ */
+ void set_size(const C3DBounds& size);
+protected:
+ const C3DBounds& get_size() const;
+private:
+
+ virtual double do_run(C3DFVectorfield& velocity, C3DFVectorfield& force, const C3DFVectorfield& deform) const = 0;
+
+ virtual void on_size_changed();
+
+ C3DBounds m_size;
+};
+
+
+typedef C3DFVectorfieldRegularizer::Pointer P3DVectorfieldRegularizer;
+
+typedef TFactory<C3DFVectorfieldRegularizer> C3DFVectorfieldRegularizerPlugin;
+
+typedef THandlerSingleton<TFactoryPluginHandler<C3DFVectorfieldRegularizerPlugin> > C3DFVectorfieldRegularizerPluginHandler;
+
+
+template <> const char * const TPluginHandler<C3DFVectorfieldRegularizerPlugin>::m_help;
+extern template class EXPORT_3D TFactory<C3DFVectorfieldRegularizer>;
+extern template class EXPORT_3D TFactoryPluginHandler<C3DFVectorfieldRegularizerPlugin>;
+extern template class EXPORT_3D THandlerSingleton<TFactoryPluginHandler<C3DFVectorfieldRegularizerPlugin> >;
+
+
+/**
+ @cond NEVER
+ @ingroup traits
+ @brief Trait to make C3DFVectorfieldRegularizerPluginHandler available for creation by command line parsing
+*/
+FACTORY_TRAIT(C3DFVectorfieldRegularizerPluginHandler);
+/// @endcond
+
+
+NS_MIA_END
+
+#endif
diff --git a/mia/3d/vfregularizer/CMakeLists.txt b/mia/3d/vfregularizer/CMakeLists.txt
new file mode 100644
index 0000000..a61183f
--- /dev/null
+++ b/mia/3d/vfregularizer/CMakeLists.txt
@@ -0,0 +1,8 @@
+
+SET(vfsolvers
+ sor
+)
+
+PLUGINGROUP_WITH_TEST_AND_PREFIX2("3dvf" "regularizer" "${vfsolvers}"
+ "${MIA3DLIBS}" TESTLIBS mia3dtest
+ )
diff --git a/mia/3d/vfregularizer/fluid.cc b/mia/3d/vfregularizer/fluid.cc
new file mode 100644
index 0000000..8e1793e
--- /dev/null
+++ b/mia/3d/vfregularizer/fluid.cc
@@ -0,0 +1,196 @@
+
+
+C3DFluidVectorfieldRegularizer::C3DFluidVectorfieldRegularizer(float mu, float lambda,
+ size_t maxiter, float omega, float epsilon):
+ m_mu(mu),
+ m_lambda(lambda),
+ m_omega(omega),
+ m_epsilon(epsilon),
+ m_maxiter(maxiter),
+ m_dx(0),
+ m_dxy(0)
+{
+ float a = mu;
+ float b = lambda + mu;
+ m_c = 1 / (6.0f * a + 2.0f * b);
+ m_b_4 = 0.25f * b * m_c;
+ m_a_b = ( a + b ) * m_c;
+ m_a = a * m_c;
+}
+
+double C3DFluidVectorfieldRegularizer::do_run(C3DFVectorfield& output, C3DFVectorfield& input) const
+{
+ // reserve space for temporaries
+ T3DDatafield<float> residua(get_size());
+ T3DDatafield<unsigned char> update_flags1(get_size());
+ T3DDatafield<unsigned char> update_flags2(get_size());
+
+ // these two will ping-pong in each update
+ T3DDatafield<unsigned char>& update_flags = update_flags1;
+ T3DDatafield<unsigned char>& dset_flags = update_flags2;
+
+ float start_residuum = 0.0;
+ float residuum;
+ float thresh = 0.0;
+
+ size_t iter = 0;
+
+ // first iteration runs over the whole field
+ fill(update_flags.begin(), update_flags.end(), 1);
+
+ m_fluid_row_kernel->set_data_fields(output, input, residua);
+
+ do {
+ iter++;
+ residuum == 0.0f;
+
+
+ m_fluid_row_kernel->set_update_fields(update_flags, dset_flags);
+
+ for (unsigned z = 1; z < work_size.z; ++z) {
+ for (unsigned y = 1; y < work_size.y; ++y) {
+ residuum += m_fluid_row_kernel->evaluate_row(y, z);
+ }
+ }
+
+
+ } while (iter < m_maxiter && residuum > m_epsilon);
+
+
+
+
+}
+
+
+// this moves to the specific solver
+
+float C3DFluidVectorfieldRegularizer::solve_at(C3DFVector_sse *v, const C3DFVector_sse& b) const
+{
+ C3DFVector *vm = v - m_dxy;
+
+ __m128 Vp0m1m1 = _mm_loadu_ps(&vm[ -m_dx]);
+ __m128 Vm1p0m1 = _mm_loadu_ps(&vm[ -1 ]);
+ __m128 Vp0p0m1 = _mm_loadu_ps(&vm[ 0 ]);
+ __m128 Vp1p0m1 = _mm_loadu_ps(&vm[ 1 ]);
+ __m128 Vp0p1m1 = _mm_loadu_ps(&vm[ m_dx]);
+
+ vm = v - m_dx;
+
+ __m128 Vm1m1p0 = _mm_loadu_ps(&vm[ -1 ]);
+ __m128 Vp0m1p0 = _mm_loadu_ps(&vm[ 0 ]);
+ __m128 Vp1m1p0 = _mm_loadu_ps(&vm[ 1 ]);
+
+ __m128 Vp0p0m1 = _mm_loadu_ps(&v[-1]);
+ __m128 Vp0p0p1 = _mm_loadu_ps(&v[1]);
+
+ vm = v + m_dx;
+
+ __m128 Vm1p1p0 = _mm_loadu_ps(&vm[ -1 ]);
+ __m128 Vp0p1p0 = _mm_loadu_ps(&vm[ 0 ]);
+ __m128 Vp1p1p0 = _mm_loadu_ps(&vm[ 1 ]);
+
+ vm = v + m_dxy;
+
+ __m128 Vp0m1p1 = _mm_loadu_ps(&vm[ -m_dx]);
+ __m128 Vm1p0p1 = _mm_loadu_ps(&vm[ -1 ]);
+ __m128 Vp0p0p1 = _mm_loadu_ps(&vm[ 0 ]);
+ __m128 Vp1p0p1 = _mm_loadu_ps(&vm[ 1 ]);
+ __m128 Vp0p1p1 = _mm_loadu_ps(&vm[ m_dx]);
+
+ //
+ // V(-1,-1,0).xy - V(1,-1,0).xy + V(1,1,0).xy - V(-1,1,0).xy
+ //
+ __m128 vdxy = Vm1m1p0 - Vp1m1p0 + Vp1p1p0 - Vm1p1p0; // only 1 and 2 of interest
+
+ //
+ // V(-1,0,-1).xz - V(1,0,-1).xz + V(1,0,1).xz - V(-1,0,1).xz
+ //
+ __m128 vdxz = Vm1p0m1 - Vp1p0m1 + Vp1p0p1 - Vm1p0p1; // only 1 and 3 of interest
+
+ //
+ // V(0,-1,-1).yz - V(0,1,-1).yz + V(0,1,1).yz - V(0,-1,1).yz
+ //
+ __m128 vdyz = Vp0m1m1 - Vp0p1m1 + Vp0p1p1 - Vp0m1p1; // only 2 and 3 of interest
+
+ //
+ // V(1,0,0) + V(-1,0,0)
+ //
+ __m128 sxx = Vp1p0p0 + Vm1p0p0;
+
+ //
+ // V(0,1,0) + V(0,-1,0)
+ //
+ __m128 syy = Vp0p1p0 + Vp0m1p0;
+
+ //
+ // V(0,0,1) + V(0,0,-1)
+ //
+ __m128 szz = Vp0p0p1 + Vp0p0m1;
+
+ __m128 vdxx = Vp1p0m0 + Vm1p0p0;
+ __m128 vdyy = Vp0p1p0 + Vp0m1p0;
+ __m128 vdzz = Vp0p0p1 + Vp0p0m1;
+
+ // a_b * sxx.x + a * (syy.x + szz.x)
+ // a_b * syy.y + a * (sxx.y + szz.y)
+ // a_b * szz.z + a * (sxx.z + syy.z)
+
+ __m128 p1 = sxx;
+ _mm_shuffle_ps(p1, szz, _MM_SHUFFLE(3,2,3,0)); // [0, szz.z, 0, sxx.x]
+
+ __m128 p2 = syy;
+ _mm_shuffle_ps(p2, p2, _MM_SHUFFLE(3,3,1,3)); // [0, 0, syy.y, 0]
+ _mm_add_ps(p1, p2); // [0, szz.z, syy.y, sxx.x]
+
+ __m128 p2 = sxx;
+ _mm_shuffle_ps(szz, sxx, _MM_SHUFFLE(3,2,1,0)); // [0, sxx.z, szz.y, szz.x]
+
+ _mm_shuffle_ps(p2, syy, _MM_SHUFFLE(2,0,2,1)); // [syy.z, syy.x, sxx.z, sxx.y]
+ _mm_shuffle_ps(p2, p2, _MM_SHUFFLE(0,1,0,2)); // [dc , syy.z, sxx.y, syy.x]
+
+
+ auto p = p1 * m_a_b_sse + m_a_sse * (szz + p2);
+
+ // now q
+ // vdxy[ 0, 0, y, x ], vdxz[ 0, z, 0, x], vdyz [0, z, 0, x]
+ //
+ // dxy.y + dxz.z //
+ // dyz.z + dxy.x
+ // dxz.x + dyz.y
+
+
+ _mm_shuffle_ps(vdxy, vdyz, _MM_SHUFFLE(0, 1, 0, 1)); // [* , vdyz.y, vdxy.x, vdxy.y]
+ _mm_shuffle_ps(vdxz, vdyz, _MM_SHUFFLE(2, 0, 2, 1)); // [vdxz.z, vdxz.x, vdyz.z, vdyz.y]
+ _mm_shuffle_ps(vdxz, vdxz _MM_SHUFFLE(0, 2, 1, 3));// [*,vdxz.x, vdyz.z, vdxz.z]
+ auto q = vdxz + vdxy;
+
+ auto b_sse = _mm_set_pd(b.x, b.y. b.z, 0.0f);
+
+ auto s = m_sor_sse * (b_sse + p + m_b_4_sse * q);
+ auto delta = s - *v;
+
+ *v = s;
+
+
+ __m128 p1 = _mm_shuffle_ps(vdxx, vdyy, _MM_SHUFFLE(0, 1, 1, 0));
+ __m128 p2 = _mm_shuffle_ps(vdyy, vdzz, _MM_SHUFFLE(0, 1, 1, 0));
+
+ p1 = _mm_shuffle_ps(p1, vdzz, _MM_SHUFFLE(0, 2, 2, 0)); // p1 should now contain (xx.x, yy.y, zz.z)
+
+ __m128 p2 = _mm_shuffle_ps(vdxx, vdzz, _MM_SHUFFLE(0, 2, 1, 3));
+
+
+ return sse_norm2(delta);
+
+}
+
+void C3DFluidVectorfieldRegularizer::on_size_changed()
+{
+ m_dx = get_size().x;
+ m_dxy = m_dx * get_size().y;
+ cvinfo() << "Temporary memory requirement will be " <<
+ (4 + 2 + 32) * get_size().product() / (1024 * 1024 * 1024) << " GiB\n";
+}
+
+
+
diff --git a/mia/mesh/triangle_neighbourhood.hh b/mia/3d/vfregularizer/fluid.hh
similarity index 55%
copy from mia/mesh/triangle_neighbourhood.hh
copy to mia/3d/vfregularizer/fluid.hh
index 6b21ff1..f91ca87 100644
--- a/mia/mesh/triangle_neighbourhood.hh
+++ b/mia/3d/vfregularizer/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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,27 +18,29 @@
*
*/
-#ifndef mia_mesh_triangleneighborhood_hh
-#define mia_mesh_triangleneighborhood_hh
-#include <mia/mesh/triangularMesh.hh>
+#include <mia/3d/vectorfieldregularizer.hh>
-NS_MIA_BEGIN
+NS_BEGIN(fluid_vfregularizer)
-class EXPORT_MESH CTrianglesWithAdjacentList {
+class C3DFluidVectorfieldRegularizer: public mia::C3DFVectorfieldRegularizer {
public:
- CTrianglesWithAdjacentList(const CTriangleMesh& mesh);
-
- const std::set<unsigned>& operator [](unsigned idx) const;
-
+ C3DFluidVectorfieldRegularizer(float mu, float lambda, size_t maxiter, float omega, float epsilon);
+
private:
+ virtual double do_run(C3DFVectorfield& output, C3DFVectorfield& input) const;
+ virtual void on_size_changed();
- std::vector<std::set<unsigned> > m_triangle_neighborhood;
-
-
-};
+ float m_mu;
+ float m_lambda;
+ float m_omega;
+ float m_epsilon;
+ size_t m_max_iter;
+ float m_a, m_c, m_a_b, m_b_4;
+ int m_dx;
+ int m_dxy;
-NS_MIA_END
-#endif
+};
+
diff --git a/mia/3d/vfregularizer/sor.cc b/mia/3d/vfregularizer/sor.cc
new file mode 100644
index 0000000..6b435dd
--- /dev/null
+++ b/mia/3d/vfregularizer/sor.cc
@@ -0,0 +1,152 @@
+/* -*- mia-c++ -*-
+ *
+ * This file is part of MIA - a toolbox for medical image analysis
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
+ *
+ * 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>
+#include <mia/core/parallel.hh>
+
+NS_MIA_BEGIN
+
+C3DSORVectorfieldRegularizer::C3DSORVectorfieldRegularizer(float abs_epsilon, float rel_epsilon,
+ unsigned maxiter,
+ P3DVectorfieldRegularizerKernel kernel):
+ m_abs_epsilon(abs_epsilon),
+ m_rel_epsilon(rel_epsilon),
+ m_maxiter(maxiter),
+ m_kernel(kernel)
+{
+}
+
+double C3DSORVectorfieldRegularizer::do_run(C3DFVectorfield& velocity, C3DFVectorfield& force, const C3DFVectorfield& deform) const
+{
+ m_kernel->set_data_fields(&velocity, &force);
+
+ unsigned padding = m_kernel->get_boundary_padding();
+
+ unsigned iter = 0;
+ float residuum = 0.0;
+ float first_rel_residuum = -1.0;
+
+ unsigned work_size_z = velocity.get_size().z - padding;
+ unsigned work_size_y = velocity.get_size().y - padding;
+
+ do {
+ iter++;
+
+ residuum = 0.0f;
+
+ // to be parallized, needs reduce for residuum
+
+ auto callback_solver = [this, padding, work_size_y]
+ (const C1DParallelRange& range, float res) {
+ auto buffers = m_kernel->get_buffers();
+ for (auto z = range.begin(); z < range.end(); ++z) {
+ m_kernel->start_slice(z, *buffers);
+ for (unsigned y = padding; y < work_size_y; ++y) {
+ res += m_kernel->evaluate_row(y, z, *buffers);
+ }
+ }
+ return res;
+ };
+
+ residuum = preduce(C1DParallelRange(padding, work_size_z), 0.0f, callback_solver,
+ [](float a, float b){ return a+b;});
+
+ if (first_rel_residuum < 0)
+ first_rel_residuum = m_rel_epsilon * residuum;
+
+
+ cvinfo() << "[" << iter << "] res=" << residuum << "\n";
+ } while (iter < m_maxiter &&
+ residuum > m_abs_epsilon &&
+ residuum > first_rel_residuum);
+
+
+ float max_pert = 0.0f;
+ if (m_kernel->has_pertuberation()) {
+ m_kernel->set_data_fields(&velocity, &deform);
+
+ auto callback_pert = [this, padding, work_size_y]
+ (const C1DParallelRange& range, float maxpert) {
+
+ // to be parallized (reduce because of max )
+ auto buffers = m_kernel->get_buffers();
+ for (auto z = range.begin(); z < range.end(); ++z) {
+ m_kernel->start_slice(z, *buffers);
+ for (unsigned y = padding; y < work_size_y; ++y) {
+ float pert = m_kernel->evaluate_pertuberation_row(y, z, *buffers);
+ if (maxpert < pert)
+ maxpert = pert;
+ }
+ }
+ return maxpert;
+ };
+
+ max_pert = preduce(C1DParallelRange(padding, work_size_z), 0.0f, callback_pert,
+ [](float a, float b){ return std::max(a,b);});
+ }else{
+ // find maximum in velocity field
+ for (auto v : velocity) {
+ float pert = v.norm2();
+ if (max_pert < pert)
+ max_pert = pert;
+ }
+ }
+ return sqrt(max_pert);
+}
+
+C3DSORVectorfieldRegularizerPlugin::C3DSORVectorfieldRegularizerPlugin():
+ C3DFVectorfieldRegularizerPlugin("sor"),
+ m_abs_epsilon(0.01),
+ m_rel_epsilon(1e-5),
+ m_maxiter(100)
+{
+ add_parameter("rel_f", make_oi_param(m_rel_epsilon, 0.0, 1.0, false,
+ "breaking condition: relative residuum"));
+ add_parameter("abs_f", make_lc_param(m_abs_epsilon, 0.0, false,
+ "breaking condition: absolute residuum"));
+ add_parameter("maxiter", make_lc_param(m_maxiter, 0, false, "maximum number of iterations"));
+
+ // there should be some method to select the arch optimized version
+ //
+ add_parameter("kernel", make_param(m_kernel, "fluid", false, "solver kernel to be used"));
+
+}
+
+
+C3DFVectorfieldRegularizer *C3DSORVectorfieldRegularizerPlugin::do_create() const
+{
+
+ return new C3DSORVectorfieldRegularizer(m_abs_epsilon, m_rel_epsilon,
+ m_maxiter, m_kernel);
+}
+
+const std::string C3DSORVectorfieldRegularizerPlugin::do_get_descr() const
+{
+ return "This plugin implements successive (over-)relaxation as a solver "
+ "to regularize the vector field.";
+}
+
+
+extern "C" EXPORT CPluginBase *get_plugin_interface()
+{
+ return new C3DSORVectorfieldRegularizerPlugin();
+}
+
+NS_MIA_END
diff --git a/mia/3d/vfregularizer/sor.hh b/mia/3d/vfregularizer/sor.hh
new file mode 100644
index 0000000..ac81982
--- /dev/null
+++ b/mia/3d/vfregularizer/sor.hh
@@ -0,0 +1,67 @@
+/* -*- mia-c++ -*-
+ *
+ * This file is part of MIA - a toolbox for medical image analysis
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
+ *
+ * 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_vfregularizer_sor_hh
+#define mia_3d_vfregularizer_sor_hh
+
+#include <mia/3d/vfregularizer.hh>
+#include <mia/3d/vfregularizerkernel.hh>
+
+NS_MIA_BEGIN
+
+class C3DSORVectorfieldRegularizer : public C3DFVectorfieldRegularizer {
+
+public:
+ C3DSORVectorfieldRegularizer(float abs_epsilon, float rel_epsilon,
+ unsigned maxiter,
+ P3DVectorfieldRegularizerKernel kernel);
+
+private:
+ double do_run(C3DFVectorfield& velocity, C3DFVectorfield& force, const C3DFVectorfield& deform) const;
+
+ float m_abs_epsilon;
+ float m_rel_epsilon;
+ unsigned m_maxiter;
+ P3DVectorfieldRegularizerKernel m_kernel;
+
+};
+
+class C3DSORVectorfieldRegularizerPlugin : public C3DFVectorfieldRegularizerPlugin {
+
+public:
+ C3DSORVectorfieldRegularizerPlugin();
+
+private:
+
+ C3DFVectorfieldRegularizer *do_create() const;
+
+ const std::string do_get_descr() const;
+
+
+ float m_abs_epsilon;
+ float m_rel_epsilon;
+ unsigned m_maxiter;
+ P3DVectorfieldRegularizerKernel m_kernel;
+
+};
+
+NS_MIA_END
+
+#endif
diff --git a/mia/3d/vfregularizer/test_sor.cc b/mia/3d/vfregularizer/test_sor.cc
index 6c57cd5..4525014 100644
--- a/mia/3d/vfregularizer/test_sor.cc
+++ b/mia/3d/vfregularizer/test_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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,28 +18,45 @@
*
*/
+#include <mia/internal/plugintester.hh>
#include <mia/3d/vfregularizer/sor.hh>
+#include <mia/3d/vfregularizerkernel.hh>
+#include <mia/core/parallel.hh>
-class Mock3DVectorfieldRegularizerKernel: public C3DVectorfieldRegularizerKernel {
+using namespace std;
+using namespace mia;
+
+
+class Mock3DVectorfieldRegularizerKernel: public C3DFVectorfieldRegularizerKernel {
+public:
+ Mock3DVectorfieldRegularizerKernel();
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);
+
+ void post_set_data_fields();
+ int m_dx;
+ int m_dxy;
+ vector<CMutex> m_slice_mutex;
+
+
};
BOOST_AUTO_TEST_CASE(test_sor_solver)
{
C3DBounds size(5, 6, 7);
- C3DBounds rbe = size - C3DBounds::_1;
-
+ C3DBounds rbe = size - 2 * C3DBounds::_1;
+
C3DFVectorfield v(size);
C3DFVectorfield b(size);
- auto useful_range = v.get_range(C3DBounds::_1, rbe);
-
+ auto useful_range = v.get_range(2 * C3DBounds::_1, rbe);
+ auto irv = useful_range.begin();
+ auto erv = useful_range.end();
while ( irv != erv ) {
C3DFVector x(irv.pos());
@@ -52,29 +69,92 @@ BOOST_AUTO_TEST_CASE(test_sor_solver)
*irv = C3DFVector( fy * 1.0 / (1 + fx * fx),
fy * fy * 1.0 / (1 + fx * fx),
fz * fy * 2.0 / (1 + fx * fx));
+
+ cvdebug() << "input[" << irv.pos() << "]=" << *irv << "\n";
++irv;
}
+ C3DBounds rbe1 = size - C3DBounds::_1;
+ auto b_range = b.get_range(C3DBounds::_1, rbe1);
+ auto irb = b_range.begin();
+ auto erb = b_range.end();
- auto iib = b.begin_range(
+ while (irb != erb) {
+ C3DBounds p = irb.pos();
+
+ *irb = (6.0f * v(p) +
+ v(C3DBounds(p.x + 1, p.y, p.z)) +
+ v(C3DBounds(p.x - 1, p.y, p.z)) +
+ v(C3DBounds(p.x, p.y + 1, p.z)) +
+ v(C3DBounds(p.x, p.y - 1, p.z)) +
+ v(C3DBounds(p.x, p.y, p.z + 1)) +
+ v(C3DBounds(p.x, p.y, p.z - 1))) * 1.0f/12.0f;
+
+ ++irb;
+ }
+ C3DSORVectorfieldRegularizer sor_solver(1e-7, 1e-9, 1000,
+ make_shared<Mock3DVectorfieldRegularizerKernel>());
+ C3DFVectorfield vs(size);
+ C3DFVectorfield d(size);
+
+ sor_solver.set_size(size);
+ sor_solver.run(vs, b, d);
+ auto vs_full_range = vs.get_range(C3DBounds::_0, vs.get_size());
+ auto v_full_range = v.get_range(C3DBounds::_0, vs.get_size());
+
+ for (auto ivs = vs_full_range.begin(), iv = v_full_range.begin(); ivs != vs_full_range.end(); ++ivs, ++iv) {
+
+ cvdebug() << "[" << ivs.pos() << "]=" << *ivs << " expect " << *iv << "\n";
+
+ if (fabs(iv->x) > 1e-5)
+ BOOST_CHECK_CLOSE(ivs->x, iv->x, 1e-4);
+ else
+ BOOST_CHECK_SMALL(ivs->x, 1e-5f);
+
+ if (fabs(iv->y) > 1e-5)
+ BOOST_CHECK_CLOSE(ivs->y, iv->y, 1e-4);
+ else
+ BOOST_CHECK_SMALL(ivs->y, 1e-5f);
+
+ if (fabs(iv->z) > 1e-5)
+ BOOST_CHECK_CLOSE(ivs->z, iv->z, 1e-4);
+ else
+ BOOST_CHECK_SMALL(ivs->z, 1e-5f);
+
+
+ }
}
+Mock3DVectorfieldRegularizerKernel::Mock3DVectorfieldRegularizerKernel():
+ C3DFVectorfieldRegularizerKernel(false),
+ m_dx(0),
+ m_dxy(0)
+{
+}
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();
+ unsigned linear_index = 1 + y * m_dx + z * m_dxy;
+
+ // There should be a more fine-grained method, but for the test it's okay
+
+ CScopedLock lock_zm1(m_slice_mutex[z-1]);
+ CScopedLock lock_z(m_slice_mutex[z]);
+ CScopedLock lock_zp1(m_slice_mutex[z+1]);
+
for (int x = 1; x < m_dx - 1; ++x, ++linear_index) {
residuum += solve_at(&v[linear_index], b[linear_index]);
}
@@ -82,19 +162,28 @@ float Mock3DVectorfieldRegularizerKernel::do_evaluate_row(unsigned y, unsigned z
}
-float Mock3DVectorfieldRegularizerKernel::do_evaluate_row_sparse(unsigned y, unsigned z,
+float Mock3DVectorfieldRegularizerKernel::do_evaluate_row_sparse(unsigned MIA_PARAM_UNUSED(y),
+ unsigned MIA_PARAM_UNUSED(z),
CBuffers& MIA_PARAM_UNUSED(buffers))
{
-
+ return numeric_limits<float>::max();
}
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 s = 6.0f * v[0];
+ s += v[1];
+ s += v[-1];
+
+ s += v[m_dx];
+ s += v[m_dxy];
+
+ s += v[-m_dx];
+
+ s += v[-m_dxy];
+
+
+ s /= 12.0f;
C3DFVector r = 1.2 * ( b - s);
@@ -107,3 +196,11 @@ unsigned Mock3DVectorfieldRegularizerKernel::do_get_boundary_padding() const
{
return 1;
}
+
+void Mock3DVectorfieldRegularizerKernel::post_set_data_fields()
+{
+ auto s = get_input_field().get_size();
+ m_dx = s.x;
+ m_dxy = s.x * s.y;
+ m_slice_mutex = vector<CMutex>(s.z);
+}
diff --git a/mia/3d/vfregularizerkernel.cc b/mia/3d/vfregularizerkernel.cc
new file mode 100644
index 0000000..f87b738
--- /dev/null
+++ b/mia/3d/vfregularizerkernel.cc
@@ -0,0 +1,146 @@
+/* -*- mia-c++ -*-
+ *
+ * This file is part of MIA - a toolbox for medical image analysis
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
+ *
+ * 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/export_handler.hh>
+#include <mia/3d/vfregularizerkernel.hh>
+
+#include <mia/core/handler.cxx>
+#include <mia/core/plugin_base.cxx>
+#include <cassert>
+
+NS_MIA_BEGIN
+
+const char *C3DFVectorfieldRegularizerKernel::type_descr = "regularizerkernel";
+
+C3DFVectorfieldRegularizerKernel::C3DFVectorfieldRegularizerKernel(bool has_pertuberation):
+ m_output(nullptr),
+ m_input(nullptr),
+ m_residua(nullptr),
+ m_update_flags(nullptr),
+ m_set_flags(nullptr),
+ m_residual_thresh(0.0),
+ m_has_pertuberation(has_pertuberation)
+{
+}
+
+C3DFVectorfieldRegularizerKernel::~C3DFVectorfieldRegularizerKernel()
+{
+}
+
+float C3DFVectorfieldRegularizerKernel::evaluate_pertuberation_row(unsigned y, unsigned z, CBuffers& buffers) const
+{
+ return do_evaluate_pertuberation_row(z,y,buffers);
+}
+
+void C3DFVectorfieldRegularizerKernel::set_data_fields(C3DFVectorfield *output, const C3DFVectorfield *input)
+{
+ m_output = output;
+ m_input = input;
+ post_set_data_fields();
+}
+
+
+void C3DFVectorfieldRegularizerKernel::set_update_fields(const T3DDatafield<unsigned char> *update_flags,
+ T3DDatafield<unsigned char> *set_flags,
+ T3DDatafield<float> *residua,
+ float residual_thresh)
+{
+ m_update_flags = update_flags;
+ m_set_flags = set_flags;
+ m_residua = residua;
+ m_residual_thresh = residual_thresh;
+}
+
+float C3DFVectorfieldRegularizerKernel::evaluate_row(unsigned y, unsigned z, CBuffers& buffers)
+{
+ assert(m_output);
+ assert(m_input);
+
+ return do_evaluate_row(y, z, buffers);
+}
+
+float C3DFVectorfieldRegularizerKernel::evaluate_row_sparse(unsigned y, unsigned z, CBuffers& buffers)
+{
+ assert(m_output);
+ assert(m_input);
+ assert(m_residua);
+ assert(m_update_flags);
+ assert(m_set_flags);
+
+ return do_evaluate_row_sparse(y, z, buffers);
+}
+
+C3DFVectorfieldRegularizerKernel::PBuffers
+C3DFVectorfieldRegularizerKernel::get_buffers() const
+{
+ return do_get_buffers();
+}
+
+void C3DFVectorfieldRegularizerKernel::start_slice(unsigned z, CBuffers& buffers) const
+{
+ do_start_slice(z, buffers);
+}
+
+
+C3DFVectorfieldRegularizerKernel::PBuffers
+C3DFVectorfieldRegularizerKernel::do_get_buffers() const
+{
+ return PBuffers(new CBuffers());
+}
+
+float C3DFVectorfieldRegularizerKernel::do_evaluate_pertuberation_row(unsigned MIA_PARAM_UNUSED(y),
+ unsigned MIA_PARAM_UNUSED(z),
+ CBuffers& MIA_PARAM_UNUSED(buffers)) const
+{
+ assert(!m_has_pertuberation && "The kernel says it has a pertuberation evaluator, "
+ "but 'do_evaluate_pertuberation_row' has not been overriden");
+ return 0.0;
+}
+
+void C3DFVectorfieldRegularizerKernel::do_start_slice(unsigned MIA_PARAM_UNUSED(z),
+ CBuffers& MIA_PARAM_UNUSED(buffers)) const
+{
+}
+
+void C3DFVectorfieldRegularizerKernel::post_set_data_fields()
+{
+}
+
+unsigned C3DFVectorfieldRegularizerKernel::get_boundary_padding() const
+{
+ return do_get_boundary_padding();
+}
+
+C3DFVectorfieldRegularizerKernel::CBuffers::~CBuffers()
+{
+}
+
+template <> const char * const
+TPluginHandler<C3DFVectorfieldRegularizerKernelPlugin>::m_help =
+ "This class of plug-ins implement various regularizations kernels for "
+ "3D vector fields regularization solvers that are typically used in image registration "
+ "to translate the force driving the registration to a smooth "
+ "velocity field.";
+
+EXPLICIT_INSTANCE_HANDLER(C3DFVectorfieldRegularizerKernel);
+
+
+NS_MIA_END
+
diff --git a/mia/3d/vfregularizerkernel.hh b/mia/3d/vfregularizerkernel.hh
new file mode 100644
index 0000000..f1bc571
--- /dev/null
+++ b/mia/3d/vfregularizerkernel.hh
@@ -0,0 +1,176 @@
+/* -*- mia-c++ -*-
+ *
+ * This file is part of MIA - a toolbox for medical image analysis
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
+ *
+ * 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_vfregularizerkernel_hh
+#define mia_3d_vfregularizerkernel_hh
+
+#include <mia/core/factory.hh>
+#include <mia/3d/vectorfield.hh>
+
+NS_MIA_BEGIN
+
+/**
+ @ingroup registration
+
+ Kernel for iterative 3D vector field regularizer
+
+ This is the base class for a 3D vector field reguarlizer
+ kernels that is typically used in non-linear registration to
+ evaluate a velocity field from a force field by applying
+ some regularization model on the input data.
+*/
+
+class EXPORT_3D C3DFVectorfieldRegularizerKernel : public CProductBase {
+public:
+ typedef C3DFVectorfieldRegularizerKernel plugin_type;
+ typedef C3DFVectorfield plugin_data;
+
+ class CBuffers {
+ public:
+ virtual ~CBuffers();
+ };
+
+ typedef std::unique_ptr<CBuffers> PBuffers;
+
+ static const char *type_descr;
+
+ typedef std::shared_ptr< C3DFVectorfieldRegularizerKernel > Pointer;
+
+ C3DFVectorfieldRegularizerKernel(bool has_pertuberation);
+
+ float evaluate_pertuberation_row(unsigned y, unsigned z, CBuffers& buffers) const;
+
+ virtual ~C3DFVectorfieldRegularizerKernel();
+
+ void set_data_fields(C3DFVectorfield *output, const C3DFVectorfield *input);
+
+ void set_update_fields(const T3DDatafield<unsigned char> *update_flags,
+ T3DDatafield<unsigned char> *set_flags, T3DDatafield<float> *residua,
+ float residual_thresh);
+
+ float evaluate_row(unsigned y, unsigned z, CBuffers& buffers);
+
+ float evaluate_row_sparse(unsigned y, unsigned z, CBuffers& buffers);
+
+ unsigned get_boundary_padding() const;
+
+ PBuffers get_buffers() const;
+
+ void start_slice(unsigned z, CBuffers& buffers) const;
+
+ bool has_pertuberation() const;
+ protected:
+ C3DFVectorfield& get_output_field() const;
+ const C3DFVectorfield& get_input_field() const;
+ T3DDatafield<float>& get_residua() const;
+ const T3DDatafield<unsigned char>& get_update_flags() const;
+ T3DDatafield<unsigned char>& get_set_flags() const;
+ float get_residual_thresh() const;
+ private:
+ virtual void post_set_data_fields();
+
+ virtual float do_evaluate_row(unsigned y, unsigned z, CBuffers& buffers) = 0;
+
+ virtual float do_evaluate_row_sparse(unsigned y, unsigned z, CBuffers& buffers) = 0;
+
+ virtual unsigned do_get_boundary_padding() const = 0;
+
+ virtual PBuffers do_get_buffers() const;
+
+ virtual void do_start_slice(unsigned z, CBuffers& buffers) const;
+
+ virtual float do_evaluate_pertuberation_row(unsigned y, unsigned z, CBuffers& buffers) const;
+
+ C3DFVectorfield *m_output;
+ const C3DFVectorfield *m_input;
+ T3DDatafield<float> *m_residua;
+ const T3DDatafield<unsigned char> *m_update_flags;
+ T3DDatafield<unsigned char> *m_set_flags;
+ float m_residual_thresh;
+ bool m_has_pertuberation;
+};
+
+inline
+bool C3DFVectorfieldRegularizerKernel::has_pertuberation() const
+{
+ return m_has_pertuberation;
+}
+
+inline
+C3DFVectorfield& C3DFVectorfieldRegularizerKernel::get_output_field() const
+{
+ return *m_output;
+}
+
+inline
+const C3DFVectorfield& C3DFVectorfieldRegularizerKernel::get_input_field() const
+{
+ return *m_input;
+}
+
+inline
+T3DDatafield<float>& C3DFVectorfieldRegularizerKernel::get_residua() const
+{
+ return *m_residua;
+}
+
+inline
+const T3DDatafield<unsigned char>& C3DFVectorfieldRegularizerKernel::get_update_flags() const
+{
+ return *m_update_flags;
+}
+
+inline
+T3DDatafield<unsigned char>& C3DFVectorfieldRegularizerKernel::get_set_flags() const
+{
+ return *m_set_flags;
+}
+
+inline
+float C3DFVectorfieldRegularizerKernel::get_residual_thresh() const
+{
+ return m_residual_thresh;
+}
+
+typedef C3DFVectorfieldRegularizerKernel::Pointer P3DVectorfieldRegularizerKernel;
+
+typedef TFactory<C3DFVectorfieldRegularizerKernel> C3DFVectorfieldRegularizerKernelPlugin;
+
+typedef THandlerSingleton<TFactoryPluginHandler<C3DFVectorfieldRegularizerKernelPlugin> > C3DFVectorfieldRegularizerKernelPluginHandler;
+
+
+template <> const char * const TPluginHandler<C3DFVectorfieldRegularizerKernelPlugin>::m_help;
+extern template class EXPORT_3D TFactory<C3DFVectorfieldRegularizerKernel>;
+extern template class EXPORT_3D TFactoryPluginHandler<C3DFVectorfieldRegularizerKernelPlugin>;
+extern template class EXPORT_3D THandlerSingleton<TFactoryPluginHandler<C3DFVectorfieldRegularizerKernelPlugin> >;
+
+/**
+ @cond NEVER
+ @ingroup traits
+ @brief Trait to make C3DFVectorfieldRegularizerPluginHandler available for creation by command line parsing
+*/
+FACTORY_TRAIT(C3DFVectorfieldRegularizerKernelPluginHandler);
+/// @endcond
+
+
+
+NS_MIA_END
+#endif
diff --git a/mia/3d/vfregularizerkernel/CMakeLists.txt b/mia/3d/vfregularizerkernel/CMakeLists.txt
new file mode 100644
index 0000000..28ae6c3
--- /dev/null
+++ b/mia/3d/vfregularizerkernel/CMakeLists.txt
@@ -0,0 +1,9 @@
+
+SET(regularizers
+ fluid-generic
+)
+
+PLUGINGROUP_WITH_TEST_AND_PREFIX2("3dvf" "regularizerkernel" "${regularizers}"
+ "${MIA3DLIBS}" TESTLIBS mia3dtest
+ )
+
diff --git a/mia/3d/vfregularizerkernel/fluid-generic.cc b/mia/3d/vfregularizerkernel/fluid-generic.cc
new file mode 100644
index 0000000..2c84634
--- /dev/null
+++ b/mia/3d/vfregularizerkernel/fluid-generic.cc
@@ -0,0 +1,302 @@
+/* -*- mia-c++ -*-
+ *
+ * This file is part of MIA - a toolbox for medical image analysis
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
+ *
+ * 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/vfregularizerkernel/fluid-generic.hh>
+
+NS_MIA_BEGIN
+
+C3DFVfFluidStandardRegularizerKernel::C3DFVfFluidStandardRegularizerKernel(float mu, float lambda, float relax):
+ C3DFVectorfieldRegularizerKernel(true),
+ m_relax(relax),
+ m_dx(0),
+ m_dxy(0)
+
+{
+ float a = mu;
+ float b = lambda + mu;
+ m_c = 1 / (6.0f * a + 2.0f * b);
+ m_b4 = 0.25f * b * m_c;
+ m_a_b = ( a + b ) * m_c;
+ m_a = a * m_c;
+}
+
+void C3DFVfFluidStandardRegularizerKernel::post_set_data_fields()
+{
+ m_dx = get_input_field().get_size().x;
+ m_dxy = m_dx * get_input_field().get_size().y;
+}
+
+float C3DFVfFluidStandardRegularizerKernel::do_evaluate_row(unsigned y, unsigned z,
+ CBuffers& MIA_PARAM_UNUSED(buf))
+{
+ 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 C3DFVfFluidStandardRegularizerKernel::do_evaluate_row_sparse(unsigned y, unsigned z,
+ CBuffers& MIA_PARAM_UNUSED(buf))
+{
+ float residuum = 0.0f;
+ unsigned linear_index = 1 + y * m_dx + z * m_dxy;
+ auto& v = get_output_field();
+ auto& b = get_input_field();
+ auto& update = get_update_flags();
+ auto& res = get_residua();
+
+ for (int x = 1; x < m_dx - 1; ++x, ++linear_index) {
+ if (update[linear_index]) {
+ res[linear_index] = solve_at(&v[linear_index], b[linear_index]);
+ }
+ residuum += res[linear_index];
+
+ if (res[linear_index] > get_residual_thresh()) {
+ set_update_flags(linear_index);
+ }
+ }
+ return residuum;
+
+}
+
+void C3DFVfFluidStandardRegularizerKernel::multiply_with_matrix(C3DFVectorfield& out, const C3DFVectorfield& in)
+{
+ assert(out.get_size() == in.get_size());
+ auto size = out.get_size();
+
+ const C3DBounds rbe = size - C3DBounds::_1;
+ auto in_useful_range = in.get_range(C3DBounds::_1, rbe);
+ auto out_useful_range = out.get_range(C3DBounds::_1, rbe);
+
+ auto iiv = in_useful_range.begin();
+ auto eiv = in_useful_range.end();
+
+ auto iov = out_useful_range.begin();
+
+ while ( iiv != eiv ) {
+
+ C3DFVector xx = iiv[-1] + iiv[1];
+ C3DFVector yy = iiv[-m_dx] + iiv[m_dx];
+ C3DFVector zz = iiv[-m_dxy] + iiv[m_dxy];
+
+ const C3DFVector p(m_a_b*xx.x + m_a*(yy.x+zz.x), // 6A 6M
+ m_a_b*yy.y + m_a*(xx.y+zz.y),
+ m_a_b*zz.z + m_a*(xx.z+yy.z));
+
+
+ const C3DFVector& Vm1m1p0 = iiv[ -1 - m_dx];
+ const C3DFVector& Vp1m1p0 = iiv[ 1 - m_dx];
+ const C3DFVector& Vm1p1p0 = iiv[ -1 + m_dx];
+ const C3DFVector& Vp1p1p0 = iiv[ 1 + m_dx];
+
+ const float vxdxy = Vm1m1p0.x - Vp1m1p0.x + Vp1p1p0.x - Vm1p1p0.x;
+ const float vydxy = Vm1m1p0.y - Vp1m1p0.y + Vp1p1p0.y - Vm1p1p0.y;
+
+ const C3DFVector& Vm1p0m1 = iiv[ -1 - m_dxy];
+ const C3DFVector& Vp1p0m1 = iiv[ 1 - m_dxy];
+ const C3DFVector& Vm1p0p1 = iiv[ -1 + m_dxy];
+ const C3DFVector& Vp1p0p1 = iiv[ 1 + m_dxy];
+
+ const float vxdxz = Vm1p0m1.x - Vp1p0m1.x + Vp1p0p1.x - Vm1p0p1.x;
+ const float vzdxz = Vm1p0m1.z - Vp1p0m1.z + Vp1p0p1.z - Vm1p0p1.z;
+
+ const C3DFVector& Vp0m1m1 = iiv[ -m_dx - m_dxy];
+ const C3DFVector& Vp0p1m1 = iiv[ m_dx - m_dxy];
+ const C3DFVector& Vp0m1p1 = iiv[ -m_dx + m_dxy];
+ const C3DFVector& Vp0p1p1 = iiv[ m_dx + m_dxy];
+
+ const float vydyz = Vp0m1m1.y - Vp0p1m1.y + Vp0p1p1.y - Vp0m1p1.y;
+ const float vzdyz = Vp0m1m1.z - Vp0p1m1.z + Vp0p1p1.z - Vp0m1p1.z;
+
+ const C3DFVector q(vydxy+vzdxz,vxdxy+vzdyz,vxdxz+vydyz);
+
+ *iov = *iiv + p + m_b4 * q;
+
+ ++iiv; ++iov;
+ }
+
+}
+
+float C3DFVfFluidStandardRegularizerKernel::do_evaluate_pertuberation_row(unsigned y, unsigned z,
+ CBuffers& MIA_PARAM_UNUSED(buffers)) const
+{
+
+
+ auto iu = get_input_field().begin_at(1, y, z);
+ auto iv = get_output_field().begin_at(1, y, z);
+
+ float max_pert = 0.0f;
+
+ for (int x = 1; x < m_dx - 1; ++x, ++iu, ++iv) {
+
+ auto dux = iu[1] - iu[-1];
+ auto duy = iu[m_dx] - iu[-m_dx];
+ auto duz = iu[m_dxy] - iu[-m_dxy];
+
+ *iv -= 0.5f * (iv->x * dux + iv->y * duy + iv->z * duz);
+ float pert = iv->norm2();
+ if (max_pert < pert)
+ max_pert = pert;
+ }
+ return max_pert;
+}
+
+unsigned C3DFVfFluidStandardRegularizerKernel::do_get_boundary_padding() const
+{
+ return 1;
+}
+
+float C3DFVfFluidStandardRegularizerKernel::solve_at(C3DFVector *v, const C3DFVector& b)
+{
+ C3DFVector *v_loc = &v[ -m_dxy ];
+
+ const C3DFVector Vp0m1m1 = v_loc[ -m_dx ];
+ const C3DFVector Vm1p0m1 = v_loc[ -1 ];
+ const C3DFVector Vp0p0m1 = v_loc[ 0 ];
+ const C3DFVector Vp1p0m1 = v_loc[ 1 ];
+ const C3DFVector Vp0p1m1 = v_loc[ m_dx ];
+
+ v_loc = &v[ -m_dx ];
+ const C3DFVector Vm1m1p0 = v_loc[ -1 ];
+ const C3DFVector Vp0m1p0 = v_loc[ 0 ];
+ const C3DFVector Vp1m1p0 = v_loc[ 1 ];
+
+ v_loc = &v[ m_dx ];
+ const C3DFVector Vm1p1p0 = v_loc[ -1 ];
+ const C3DFVector Vp0p1p0 = v_loc[ 0 ];
+ const C3DFVector Vp1p1p0 = v_loc[ 1 ];
+
+ const float vxdxy = Vm1m1p0.x - Vp1m1p0.x + Vp1p1p0.x - Vm1p1p0.x;
+ const float vydxy = Vm1m1p0.y - Vp1m1p0.y + Vp1p1p0.y - Vm1p1p0.y;
+
+ v_loc = &v[ m_dxy ];
+ const C3DFVector Vp0m1p1 = v_loc[ -m_dx ];
+ const C3DFVector Vm1p0p1 = v_loc[ -1 ];
+ const C3DFVector Vp0p0p1 = v_loc[ 0 ];
+ const C3DFVector Vp1p0p1 = v_loc[ 1 ];
+ const C3DFVector Vp0p1p1 = v_loc[ m_dx ];
+
+ const float vxdxz = Vm1p0m1.x - Vp1p0m1.x + Vp1p0p1.x - Vm1p0p1.x;
+ const float vzdxz = Vm1p0m1.z - Vp1p0m1.z + Vp1p0p1.z - Vm1p0p1.z;
+
+ const C3DFVector vdxx = v[-1] + v[1]; // 3A
+ const C3DFVector vdyy = Vp0p1p0 + Vp0m1p0;
+ const C3DFVector vdzz = Vp0p0p1 + Vp0p0m1;
+
+ const float vydyz = Vp0m1m1.y - Vp0p1m1.y + Vp0p1p1.y - Vp0m1p1.y;
+ const float vzdyz = Vp0m1m1.z - Vp0p1m1.z + Vp0p1p1.z - Vp0m1p1.z;
+
+
+ const C3DFVector p(m_a_b*vdxx.x + m_a*(vdyy.x+vdzz.x), // 6A 6M
+ m_a_b*vdyy.y + m_a*(vdxx.y+vdzz.y),
+ m_a_b*vdzz.z + m_a*(vdxx.z+vdyy.z));
+
+ const C3DFVector q(vydxy+vzdxz,vxdxy+vzdyz,vxdxz+vydyz); // 3A
+ const C3DFVector R = b + p + m_b4 * q; // 6A 3M
+
+
+ const C3DFVector delta = m_relax * ( R - *v ); // 3A 3M
+ *v += delta; // 3A
+
+ return delta.norm();
+
+}
+
+void C3DFVfFluidStandardRegularizerKernel::set_update_flags(unsigned idx)
+{
+ auto& sf = get_set_flags();
+
+ unsigned idx_mz = idx - m_dxy;
+
+ sf[idx_mz - m_dx] = 1;
+ sf[idx_mz - 1] = 1;
+ sf[idx_mz] = 1;
+ sf[idx_mz + 1] = 1;
+ sf[idx_mz + m_dx] = 1;
+
+ unsigned idx_my = idx - m_dx;
+
+ sf[idx_my - 1] = 1;
+ sf[idx_my] = 1;
+ sf[idx_my + 1] = 1;
+
+ sf[idx - 1] = 1;
+ sf[idx] = 1;
+ sf[idx + 1] = 1;
+
+ unsigned idx_py = idx + m_dx;
+
+ sf[idx_py - 1] = 1;
+ sf[idx_py] = 1;
+ sf[idx_py + 1] = 1;
+
+ unsigned idx_pz = idx - m_dxy;
+
+ sf[idx_pz - m_dx] = 1;
+ sf[idx_pz - 1] = 1;
+ sf[idx_pz] = 1;
+ sf[idx_pz + 1] = 1;
+ sf[idx_pz + m_dx] = 1;
+
+
+}
+
+C3DFVfFluidStandardRegularizerKernelPlugin::C3DFVfFluidStandardRegularizerKernelPlugin():
+ C3DFVectorfieldRegularizerKernelPlugin("fluid"),
+ m_mu(1.0f),
+ m_lambda(1.0f),
+ m_relax(1.0)
+{
+ this->add_parameter("mu", make_oci_param(m_mu, 0.0, 10000.0, false, "dynamic viscosity (shear)"));
+ this->add_parameter("lambda", make_ci_param(m_lambda, 0.0, 10000.0, false, "bulk viscosity (compressibility)"));
+ this->add_parameter("relax", make_ci_param(m_relax, 0.1, 2.0, false, "Relaxation parameter for the solver"));
+}
+
+C3DFVfFluidStandardRegularizerKernel *C3DFVfFluidStandardRegularizerKernelPlugin::do_create() const
+{
+ return new C3DFVfFluidStandardRegularizerKernel(m_mu, m_lambda, m_relax);
+}
+
+const std::string C3DFVfFluidStandardRegularizerKernelPlugin::do_get_descr() const
+{
+ return "Evaluation kernel for the fluid-dynamics solver, either using "
+ "successive (over-)relaxation, or a Gauss-Southwell relaxation. "
+ "This implementation is generic and doesn't implement any "
+ "architecture specific optimizations.";
+}
+
+NS_MIA_END
+
+extern "C" EXPORT mia::CPluginBase *get_plugin_interface()
+{
+ return new mia::C3DFVfFluidStandardRegularizerKernelPlugin();
+}
+
+
+
+
+
+
+
diff --git a/mia/3d/vfregularizerkernel/fluid-generic.hh b/mia/3d/vfregularizerkernel/fluid-generic.hh
new file mode 100644
index 0000000..af2c7e6
--- /dev/null
+++ b/mia/3d/vfregularizerkernel/fluid-generic.hh
@@ -0,0 +1,74 @@
+/* -*- mia-c++ -*-
+ *
+ * This file is part of MIA - a toolbox for medical image analysis
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
+ *
+ * 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_vfregularizerkernel_fluid_standard_hh
+#define mia_3d_vfregularizerkernel_fluid_standard_hh
+
+#include <mia/3d/vfregularizerkernel.hh>
+
+NS_MIA_BEGIN
+
+class C3DFVfFluidStandardRegularizerKernel: public C3DFVectorfieldRegularizerKernel {
+public:
+ C3DFVfFluidStandardRegularizerKernel(float mu, float lambda, float relax);
+
+ void multiply_with_matrix(C3DFVectorfield& out, const C3DFVectorfield& in);
+
+private:
+ void post_set_data_fields();
+
+ float do_evaluate_row(unsigned y, unsigned z, CBuffers& buf);
+
+ float do_evaluate_row_sparse(unsigned y, unsigned z, CBuffers& buf);
+
+ float do_evaluate_pertuberation_row(unsigned y, unsigned z, CBuffers& buffers) const;
+
+ unsigned do_get_boundary_padding() const;
+
+ void set_update_flags(unsigned idx);
+
+ float solve_at(C3DFVector *v, const C3DFVector& b);
+
+ float m_a;
+ float m_a_b;
+ float m_b4;
+ float m_relax;
+ float m_c;
+ int m_dx;
+ int m_dxy;
+
+};
+
+class C3DFVfFluidStandardRegularizerKernelPlugin: public C3DFVectorfieldRegularizerKernelPlugin {
+public:
+ C3DFVfFluidStandardRegularizerKernelPlugin();
+
+private:
+ C3DFVfFluidStandardRegularizerKernel *do_create() const;
+
+ const std::string do_get_descr() const;
+
+ float m_mu;
+ float m_lambda;
+ float m_relax;
+};
+
+NS_MIA_END
+#endif
diff --git a/mia/3d/vfregularizerkernel/test_fluid-generic.cc b/mia/3d/vfregularizerkernel/test_fluid-generic.cc
new file mode 100644
index 0000000..76e4bbe
--- /dev/null
+++ b/mia/3d/vfregularizerkernel/test_fluid-generic.cc
@@ -0,0 +1,262 @@
+/* -*- mia-c++ -*-
+ *
+ * This file is part of MIA - a toolbox for medical image analysis
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
+ *
+ * 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/3d/vfregularizerkernel/fluid-generic.hh>
+
+using namespace mia;
+
+
+
+BOOST_AUTO_TEST_CASE( test_evaluate_row_evaluation_one_element )
+{
+ float mu = 1.2;
+ float lambda = 1.1;
+ float relax = 1.8;
+
+
+ float c = 1 / (6.0f * mu + 2.0f * (mu + lambda));
+ float a = mu * c;
+ float _b = (mu + lambda) * c;
+
+ float a_b = a + _b; // mu + lambda
+ float b_4 = 0.25 * _b; // 0.25 * (mu + lambda)
+
+ cvdebug() << "a=" << a << ", b4=" << b_4 << ", a+b=" << a_b << ", c=" << c << "\n";
+
+ std::stringstream test_kernel;
+ test_kernel << "fluid:mu=" << mu << ",lambda="<<lambda<<",relax="<< relax;
+
+ auto kernel = BOOST_TEST_create_from_plugin<C3DFVfFluidStandardRegularizerKernelPlugin>(test_kernel.str().c_str());
+
+ C3DBounds size(3, 3, 3);
+ C3DFVectorfield v(size);
+ C3DFVectorfield b(size);
+
+ C3DFVector b111(2,1,1);
+
+ b(1,1,1) = b111;
+
+ const C3DFVector V0mm(0,2,7);
+ const C3DFVector Vm0m(2,3,6);
+ const C3DFVector V00m(3,6,9);
+ const C3DFVector Vp0m(-2,-4,-5);
+ const C3DFVector V0pm(2,3,3);
+
+ const C3DFVector Vmm0(1,2,1);
+ const C3DFVector V0m0(2,4,2);
+ const C3DFVector Vpm0(2,4,5);
+
+ const C3DFVector Vm00(3,6,4);
+ const C3DFVector V000(4,2,5);
+ const C3DFVector Vp00(5,1,3);
+
+ const C3DFVector Vmp0(0,2,7);
+ const C3DFVector V0p0(9,5,1);
+ const C3DFVector Vpp0(2,3,3);
+
+
+ const C3DFVector V0mp(2,-1,-7);
+ const C3DFVector Vm0p(-3,-4,-8);
+ const C3DFVector V00p(6,2,4);
+ const C3DFVector Vp0p(3,2,1);
+ const C3DFVector V0pp(1,2,1);
+
+ const C3DFVector fill(1000,2000,3000);
+
+ const std::vector<C3DFVector> v_init = {
+ fill, V0mm, fill,
+ Vm0m, V00m, Vp0m,
+ fill, V0pm, fill,
+
+ Vmm0, V0m0, Vpm0,
+ Vm00, V000, Vp00,
+ Vmp0, V0p0, Vpp0,
+
+ fill, V0mp, fill,
+ Vm0p, V00p, Vp0p,
+ fill, V0pp, fill
+
+ };
+
+ copy(v_init.begin(), v_init.end(), v.begin());
+
+ C3DFVector vdxx = Vm00 + Vp00;
+ C3DFVector vdyy = V0m0 + V0p0;
+ C3DFVector vdzz = V00m + V00p;
+
+
+ C3DFVector p(a_b*vdxx.x + a*(vdyy.x+vdzz.x),
+ a_b*vdyy.y + a*(vdxx.y+vdzz.y),
+ a_b*vdzz.z + a*(vdxx.z+vdyy.z));
+
+
+ float vydxy = Vmm0.y + Vpp0.y - Vpm0.y - Vmp0.y;
+ float vxdxy = Vmm0.x + Vpp0.x - Vpm0.x - Vmp0.x;
+
+ float vzdxz = Vm0m.z + Vp0p.z - Vp0m.z - Vm0p.z;
+ float vxdxz = Vm0m.x + Vp0p.x - Vp0m.x - Vm0p.x;
+
+ float vzdyz = V0mm.z + V0pp.z - V0pm.z - V0mp.z;
+ float vydyz = V0mm.y + V0pp.y - V0pm.y - V0mp.y;
+
+
+ C3DFVector q(vydxy+vzdxz,vxdxy+vzdyz,vxdxz+vydyz);
+
+ C3DFVector R = b111 + p + b_4 * q;
+ C3DFVector delta = relax * (R - V000);
+
+ C3DFVector v000 = V000 + delta;
+
+ kernel->set_data_fields(&v, &b);
+
+ auto buf = kernel->get_buffers();
+ float residuum = kernel->evaluate_row(1,1, *buf);
+
+ auto test_v = v(1,1,1);
+
+ BOOST_CHECK_CLOSE(residuum, delta.norm(), 0.1);
+
+ BOOST_CHECK_CLOSE(test_v.x, v000.x, 0.1);
+ BOOST_CHECK_CLOSE(test_v.y, v000.y, 0.1);
+ BOOST_CHECK_CLOSE(test_v.z, v000.z, 0.1);
+
+
+}
+
+BOOST_AUTO_TEST_CASE( test_evaluate_row_evaluation )
+{
+
+ float mu = 1.2;
+ float lambda = 1.1;
+ float relax = 1.8;
+
+
+ float c = 1 / (6.0f * mu + 2.0f * (mu + lambda));
+ float a = mu * c;
+ float _b = (mu + lambda) * c;
+
+ float a_b = a + _b; // mu + lambda
+ float b_4 = 0.25 * _b; // 0.25 * (mu + lambda)
+
+ cvdebug() << "a=" << a << ", b4=" << b_4 << ", a+b=" << a_b << ", c=" << c << "\n";
+
+ std::stringstream test_kernel;
+ test_kernel << "fluid:mu=" << mu << ",lambda="<<lambda<<",relax="<< relax;
+
+ auto kernel = BOOST_TEST_create_from_plugin<C3DFVfFluidStandardRegularizerKernelPlugin>(test_kernel.str().c_str());
+
+ C3DBounds size(5, 3, 3);
+ C3DFVectorfield v(size);
+ C3DFVectorfield b(size);
+
+ C3DFVector b111(2,1,1);
+ C3DFVector b211(2,2,1);
+ C3DFVector b311(1,2,2);
+
+ b(1,1,1) = b111;
+ b(2,1,1) = b211;
+ b(3,1,1) = b311;
+
+ const C3DFVector fill(1000,2000,3000);
+
+ const C3DFVector Vmm[5] = {fill, C3DFVector(2,3,6), C3DFVector(3,6,9), C3DFVector(1, 2,-1), fill};
+ const C3DFVector V0m[5] = {C3DFVector(-1, 1,-1), C3DFVector(1,8,1), C3DFVector(1,1,3), C3DFVector(2, 5, 1), C3DFVector(1, 2, 1)};
+ const C3DFVector Vpm[5] = {fill, C3DFVector(4,2,3), C3DFVector(4,5,2), C3DFVector(4, 6,-2), fill};
+
+ const C3DFVector Vm0[5] = {C3DFVector(2,6,3), C3DFVector(1,3,4), C3DFVector(4,6,1), C3DFVector(2, 2, -3), C3DFVector(5,2,7)};
+ const C3DFVector V00[5] = {C3DFVector(3,2,3), C3DFVector(2,1,6), C3DFVector(3,1,9), C3DFVector(1, 3, -3), C3DFVector(3,1,6)};
+ C3DFVector T00[5] = {C3DFVector(3,2,3), C3DFVector(2,1,6), C3DFVector(3,1,9), C3DFVector(1, 3, -3), C3DFVector(3,1,6)};
+ const C3DFVector Vp0[5] = {C3DFVector(1,4,4), C3DFVector(7,3,1), C3DFVector(1,6,3), C3DFVector(3, 2, -2), C3DFVector(1,2,3)};
+
+ const C3DFVector Vmp[5] = {fill, C3DFVector(4,3,6), C3DFVector(3,6,5), C3DFVector(-5, 2, 2), fill};
+ const C3DFVector V0p[5] = {C3DFVector(1,1,1), C3DFVector(2,2,1), C3DFVector(2,2,3), C3DFVector(2, 3, 2), C3DFVector(2,-2, 3)};
+ const C3DFVector Vpp[5] = {fill, C3DFVector(2,3,4), C3DFVector(8,5,9), C3DFVector(1, 4, -3), fill};
+
+
+ copy(Vmm, Vmm + 5, v.begin_at(0,0,0));
+ copy(V0m, V0m + 5, v.begin_at(0,1,0));
+ copy(Vpm, Vpm + 5, v.begin_at(0,2,0));
+
+ copy(Vm0, Vm0 + 5, v.begin_at(0,0,1));
+ copy(V00, V00 + 5, v.begin_at(0,1,1));
+ copy(Vp0, Vp0 + 5, v.begin_at(0,2,1));
+
+ copy(Vmp, Vmp + 5, v.begin_at(0,0,2));
+ copy(V0p, V0p + 5, v.begin_at(0,1,2));
+ copy(Vpp, Vpp + 5, v.begin_at(0,2,2));
+
+ float test_residuum = 0.0f;
+
+ for (int x = 1; x < 4; ++x) {
+ C3DFVector vdxx = T00[x+1] + T00[x-1];
+ C3DFVector vdyy = Vm0[x] + Vp0[x];
+ C3DFVector vdzz = V0m[x] + V0p[x];
+
+
+ C3DFVector p(a_b*vdxx.x + a*(vdyy.x+vdzz.x),
+ a_b*vdyy.y + a*(vdxx.y+vdzz.y),
+ a_b*vdzz.z + a*(vdxx.z+vdyy.z));
+
+
+ float vydxy = Vm0[x-1].y + Vp0[x+1].y - Vm0[x+1].y - Vp0[x-1].y;
+ float vxdxy = Vm0[x-1].x + Vp0[x+1].x - Vm0[x+1].x - Vp0[x-1].x;
+
+ float vzdxz = V0m[x-1].z + V0p[x+1].z - V0m[x+1].z - V0p[x-1].z;
+ float vxdxz = V0m[x-1].x + V0p[x+1].x - V0m[x+1].x - V0p[x-1].x;
+
+ float vzdyz = Vmm[x].z + Vpp[x].z - Vpm[x].z - Vmp[x].z;
+ float vydyz = Vmm[x].y + Vpp[x].y - Vpm[x].y - Vmp[x].y;
+
+
+ C3DFVector q(vydxy+vzdxz,vxdxy+vzdyz,vxdxz+vydyz);
+
+ C3DFVector R = b(x,1,1) + p + b_4 * q;
+ C3DFVector delta = relax * (R - T00[x]);
+
+ cvdebug() << "vdxx="<< vdxx << ", vdyy=" << vdyy << ", vdzz=" << vdzz << "\n";
+ cvdebug() << "p="<< p << ", q=" << q << ", delta=" << delta << "\n";
+
+ test_residuum += delta.norm();
+
+ T00[x] += delta;
+
+ }
+
+
+ kernel->set_data_fields(&v, &b);
+
+ auto buf = kernel->get_buffers();
+ float residuum = kernel->evaluate_row(1,1, *buf);
+
+ BOOST_CHECK_CLOSE(residuum, test_residuum, 0.1);
+
+
+ for (int x = 1; x < 4; ++x) {
+ BOOST_CHECK_CLOSE(v(x,1,1).x, T00[x].x, 0.1);
+ BOOST_CHECK_CLOSE(v(x,1,1).y, T00[x].y, 0.1);
+ BOOST_CHECK_CLOSE(v(x,1,1).z, T00[x].z, 0.1);
+ }
+
+
+
+
+
+}
diff --git a/mia/core.hh b/mia/core.hh
index d3c217f..f8e255e 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 afc60d7..8aceacc 100644
--- a/mia/core/CMakeLists.txt
+++ b/mia/core/CMakeLists.txt
@@ -43,6 +43,7 @@ SET(MIACORE_SRC_BASE
callback.cc
cost.cc
combiner.cc
+ convergence_measure.cc
cmdlineparser.cc
cmdoption.cc
cmdstringoption.cc
@@ -53,7 +54,7 @@ SET(MIACORE_SRC_BASE
distance.cc
dlloader.cc
dummyhandler.cc
- fastica.cc
+ errormacro.cc
fastica_nonlinearity.cc
file.cc
filetools.cc
@@ -65,7 +66,7 @@ SET(MIACORE_SRC_BASE
fullstats.cc
handlerbase.cc
history.cc
- icaanalysisbase.cc
+ ica.cc
index.cc
info.cc
interpolator1d.cc
@@ -129,6 +130,7 @@ SET(MIACORE_HEADER_BASE
cmdstringoption.hh
cmeans.hh
combiner.hh
+ convergence_measure.hh
cost.hh
cost.cxx
combiner.hh
@@ -145,7 +147,6 @@ SET(MIACORE_HEADER_BASE
export_handler.hh
factory.hh
factory_trait.hh
- fastica.hh
fastica_nonlinearity.hh
fft1d_r2c.hh
fftslopeclassifier.hh
@@ -161,7 +162,9 @@ SET(MIACORE_HEADER_BASE
handler.cxx handler.hh
history.hh
histogram.hh
- icaanalysisbase.hh
+ ica.hh
+ ica_template.hh
+ ica_template.cxx
index.hh
import_handler.hh
iodata.hh
@@ -227,16 +230,6 @@ SET(MIACORETEST_SRC
test_core_combined.cc
)
-IF(ITPP_FOUND)
- SET(ITPP_SRC
- ica.cc
- )
- SET(ITPP_HEADER
- ica.hh
- ica_template.hh ica_template.cxx
- )
-ENDIF(ITPP_FOUND)
-
IF(NOT TBB_FOUND)
SET(MIACORE_SRC_PARALLELCXX11
parallelcxx11.cc
@@ -253,15 +246,6 @@ IF(PWPDF_FOUND)
)
ENDIF(PWPDF_FOUND)
-MACRO(CORE_TEST name)
- ADD_EXECUTABLE(test-${name} test_${name}.cc)
- TARGET_LINK_LIBRARIES(test-${name} ${MIACORE} ${BOOST_UNITTEST})
- ADD_TEST(core-${name} test-${name})
- IF(WIN32)
- SET_TARGET_PROPERTIES(test-${name} PROPERTIES LINKER_FLAGS "/NODEFAULTLIB:MSVCRT")
- ENDIF(WIN32)
-ENDMACRO(CORE_TEST name)
-
#
# create the revision retrival code
#
@@ -274,7 +258,7 @@ CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/revision.hh.cmake ${CMAKE_CURRENT_BIN
SET(MIACORE_SRC ${MIACORE_SRC_BASE} ${ITPP_SRC} ${FFTWF_SRC} ${PWPDF_SRC} ${MIACORE_SRC_PARALLELCXX11})
SET(MIACORE_HEADER ${MIACORE_HEADER_BASE} ${ITPP_HEADER} ${FFTWF_HEADER} ${PWPDF_HEADER})
-SET(miacore_deps ${BASELIBS} ${TBB_LIBRARIES} ${FFTWF_LIBRARIES} ${XMLPP_LIBRARIES})
+SET(miacore_deps ${BASELIBS} ${TBB_LIBRARIES} ${FFTWF_LIBRARIES} ${XML_LIBRARIES})
MIA_ADD_LIBRARY(miacore "${MIACORE_SRC}" "${miacore_deps}")
IF(PWPDF_FOUND AND FFTWD_FOUND)
@@ -297,14 +281,16 @@ SET_TARGET_PROPERTIES(miacore PROPERTIES
# the test targets
#
-ADD_EXECUTABLE(test-core ${MIACORETEST_SRC})
-ADD_TEST(core test-core)
+IF(MIA_ENABLE_TESTING)
+ ADD_EXECUTABLE(test-core ${MIACORETEST_SRC})
+ ADD_TEST(core test-core)
TARGET_LINK_LIBRARIES(test-core ${MIACORE} ${BOOST_UNITTEST})
IF(WIN32)
SET_TARGET_PROPERTIES(test-core PROPERTIES LINKER_FLAGS "/NODEFAULTLIB:MSVCRT")
ENDIF(WIN32)
+ENDIF()
#IF (NOT WIN32)
# CORE_TEST(history)
@@ -320,15 +306,17 @@ ADD_SUBDIRECTORY(splinekernel )
ADD_SUBDIRECTORY(splinebc )
ADD_SUBDIRECTORY(testplug )
+IF(MIA_ENABLE_TESTING)
+
#tests that fork themselfs
SET(cmdxmlhelp_params -r 1 --other o)
NEW_TEST_WITH_PARAM(cmdxmlhelp miacore "${cmdxmlhelp_params}")
-
NEW_TEST(Vector miacore)
NEW_TEST(attributes miacore)
-NEW_TEST(boundary_conditions miacore)
+NEW_TEST(boundary_conditions miacore)
NEW_TEST(callback miacore)
+NEW_TEST(convergence_measure miacore)
NEW_TEST(cmdoptionflags miacore)
NEW_TEST(cmdparamoption miacore)
NEW_TEST(cmdlineparser miacore)
@@ -338,7 +326,6 @@ NEW_TEST(datapool miacore)
NEW_TEST(delayedparameter miacore)
NEW_TEST(distance miacore)
NEW_TEST(factoryoption miacore)
-NEW_TEST(fastica miacore)
NEW_TEST(fftslopeclassifier miacore)
NEW_TEST(filetools miacore)
NEW_TEST(fixedwidthoutput miacore)
@@ -381,11 +368,6 @@ NEW_TEST(gsl_multimin miacore)
NEW_TEST(gsl_pca miacore)
NEW_TEST(gsl_vector miacore)
-
-IF(ITPP_FOUND)
- NEW_TEST(ica miacore)
-ENDIF(ITPP_FOUND)
-
IF(FFTWF_FOUND AND WITH_FFTWF)
NEW_TEST(fft1d miacore)
ENDIF(FFTWF_FOUND AND WITH_FFTWF)
@@ -393,6 +375,8 @@ ENDIF(FFTWF_FOUND AND WITH_FFTWF)
IF(PWPDF_FOUND)
NEW_TEST(pwh miacore)
ENDIF(PWPDF_FOUND)
+
+ENDIF()
#
#installation
#
diff --git a/mia/core/attribute_names.cc b/mia/core/attribute_names.cc
index 6002564..574ffa1 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 93322d1..9fc41c7 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 021406b..16f5b1e 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -163,9 +163,11 @@ bool CStringAttrTranslatorMap::add(const string& key, CAttrTranslator* t)
{
CMap::const_iterator k = m_translators.find(key);
if ( k != m_translators.end()) {
- if ( typeid(*t) != typeid(*k->second))
- throw invalid_argument(string("translator with key '") + key + ("' already defined otherwise"));
- else
+ if ( typeid(*t) != typeid(*k->second)) {
+ delete t;
+ throw create_exception<invalid_argument>(string("translator with key '") +
+ key + ("' already defined otherwise"));
+ } else
return false;
}
cvdebug() << "add translator type '" << typeid(*t).name() << "' for '" << key << "'\n";
@@ -234,11 +236,11 @@ bool EXPORT_CORE operator == (const CAttributedData& a, const CAttributedData& b
return *a.m_attr == *b.m_attr;
}
-template class EXPORT_CORE TAttribute<unsigned char>;
-template class EXPORT_CORE TAttribute<signed char>;
+template class TAttribute<uint8_t>;
+template class TAttribute<int8_t>;
-template class EXPORT_CORE TAttribute<std::vector<unsigned char>>;
-template class EXPORT_CORE TAttribute<std::vector<signed char>>;
+template class TAttribute<std::vector<uint8_t>>;
+template class TAttribute<std::vector<int8_t>>;
template class EXPORT_CORE TTranslator<double>;
template class EXPORT_CORE TTranslator<std::vector<double> >;
@@ -246,31 +248,29 @@ template class EXPORT_CORE TTranslator<std::vector<double> >;
template class EXPORT_CORE TTranslator<float>;
template class EXPORT_CORE TTranslator<std::vector<float> >;
-#ifdef LONG_64BIT
-template class EXPORT_CORE TTranslator<unsigned long>;
-template class EXPORT_CORE TTranslator<std::vector<unsigned long> >;
+template class EXPORT_CORE TTranslator<uint64_t>;
+template class EXPORT_CORE TTranslator<std::vector<uint64_t> >;
-template class EXPORT_CORE TTranslator<signed long>;
-template class EXPORT_CORE TTranslator<std::vector<signed long> >;
-#endif
+template class EXPORT_CORE TTranslator<int64_t>;
+template class EXPORT_CORE TTranslator<std::vector<int64_t> >;
-template class EXPORT_CORE TTranslator<unsigned int>;
-template class EXPORT_CORE TTranslator<std::vector<unsigned int> >;
+template class EXPORT_CORE TTranslator<uint32_t>;
+template class EXPORT_CORE TTranslator<std::vector<uint32_t> >;
-template class EXPORT_CORE TTranslator<signed int>;
-template class EXPORT_CORE TTranslator<std::vector<signed int> >;
+template class EXPORT_CORE TTranslator<int32_t>;
+template class EXPORT_CORE TTranslator<std::vector<int32_t> >;
-template class EXPORT_CORE TTranslator<unsigned short>;
-template class EXPORT_CORE TTranslator<std::vector<unsigned short> >;
+template class EXPORT_CORE TTranslator<uint16_t>;
+template class EXPORT_CORE TTranslator<std::vector<uint16_t> >;
-template class EXPORT_CORE TTranslator<signed short>;
-template class EXPORT_CORE TTranslator<std::vector<signed short> >;
+template class EXPORT_CORE TTranslator<int16_t>;
+template class EXPORT_CORE TTranslator<std::vector<int16_t> >;
-template class EXPORT_CORE TTranslator<unsigned char>;
-template class EXPORT_CORE TTranslator<std::vector<unsigned char> >;
+template class EXPORT_CORE TTranslator<uint8_t>;
+template class EXPORT_CORE TTranslator<std::vector<uint8_t> >;
-template class EXPORT_CORE TTranslator<signed char>;
-template class EXPORT_CORE TTranslator<std::vector<signed char> >;
+template class EXPORT_CORE TTranslator<int8_t>;
+template class EXPORT_CORE TTranslator<std::vector<int8_t> >;
template class EXPORT_CORE TTranslator<bool>;
template class EXPORT_CORE TTranslator<std::vector<bool> >;
diff --git a/mia/core/attributes.cxx b/mia/core/attributes.cxx
index 6c19f77..66a9f42 100644
--- a/mia/core/attributes.cxx
+++ 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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.hh b/mia/core/attributes.hh
index ba71bd0..1d85139 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -150,7 +150,7 @@ private:
\ingroup basic
Helper function to get the value of an attribute. Thr function throws a bad_cast exception,
- if the attribute doesn't hold a value ofthe requested type T
+ if the attribute doesn't hold a value of the requested type T
\tparam T target type
\param attr attribute to be read
*/
@@ -250,7 +250,7 @@ EXPORT_CORE std::ostream& operator << (std::ostream& os, const CAttributeMap& d
\brief A collection of attributes
This is the base class for all data that uses attributes. It provides all the needed functions to store
- and retrive attributes.
+ and retrieve attributes.
*/
class EXPORT_CORE CAttributedData {
public:
@@ -775,12 +775,14 @@ const T CAttributedData::get_attribute_as(const std::string& key, T default_valu
return *attr;
}
-extern template class EXPORT_CORE TAttribute<unsigned char>;
-extern template class EXPORT_CORE TAttribute<signed char>;
-extern template class EXPORT_CORE TAttribute<std::vector<unsigned char>>;
-extern template class EXPORT_CORE TAttribute<std::vector<signed char>>;
+/// \cond NEVER
+extern template class EXPORT_CORE TAttribute<uint8_t>;
+extern template class EXPORT_CORE TAttribute<int8_t>;
+extern template class EXPORT_CORE TAttribute<std::vector<uint8_t> >;
+extern template class EXPORT_CORE TAttribute<std::vector<int8_t> >;
+/// \endcond NEVER
typedef TTranslator<double> CDoubleTranslator;
typedef TTranslator<std::vector<double> > CVDoubleTranslator;
@@ -788,31 +790,29 @@ typedef TTranslator<std::vector<double> > CVDoubleTranslator;
typedef TTranslator<float> CFloatTranslator;
typedef TTranslator<std::vector<float> > CVFloatTranslator;
-#ifdef LONG_64BIT
-typedef TTranslator<unsigned long> CULTranslator;
-typedef TTranslator<std::vector<unsigned long> > CVULTranslator;
+typedef TTranslator<uint64_t> CULTranslator;
+typedef TTranslator<std::vector<uint64_t> > CVULTranslator;
-typedef TTranslator<signed long> CSLTranslator;
-typedef TTranslator<std::vector<signed long> > CVSLTranslator;
-#endif
+typedef TTranslator<int64_t> CSLTranslator;
+typedef TTranslator<std::vector<int64_t> > CVSLTranslator;
typedef TTranslator<unsigned int> CUITranslator;
-typedef TTranslator<std::vector<unsigned int> > CVUITranslator;
+typedef TTranslator<std::vector<uint32_t> > CVUITranslator;
typedef TTranslator<signed int> CSITranslator;
-typedef TTranslator<std::vector<signed int> > CVSITranslator;
+typedef TTranslator<std::vector<int32_t> > CVSITranslator;
-typedef TTranslator<unsigned short> CUSTranslator;
-typedef TTranslator<std::vector<unsigned short> > CVUSTranslator;
+typedef TTranslator<uint16_t> CUSTranslator;
+typedef TTranslator<std::vector<uint16_t> > CVUSTranslator;
-typedef TTranslator<signed short> CSSTranslator;
-typedef TTranslator<std::vector<signed short> > CVSSTranslator;
+typedef TTranslator<int16_t> CSSTranslator;
+typedef TTranslator<std::vector<int16_t> > CVSSTranslator;
-typedef TTranslator<unsigned char> CUBTranslator;
-typedef TTranslator<std::vector<unsigned char> > CVUBTranslator;
+typedef TTranslator<uint8_t> CUBTranslator;
+typedef TTranslator<std::vector<uint8_t> > CVUBTranslator;
-typedef TTranslator<signed char> CSBTranslator;
-typedef TTranslator<std::vector<signed char> > CVSBTranslator;
+typedef TTranslator<int8_t> CSBTranslator;
+typedef TTranslator<std::vector<int8_t> > CVSBTranslator;
typedef TTranslator<bool> CBitTranslator;
typedef TTranslator<std::vector<bool> > CVBitTranslator;
diff --git a/mia/core/attributetype.hh b/mia/core/attributetype.hh
index b5fb0cd..2240244 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,19 +70,17 @@ struct attribute_type : public EAttributeType {
};
ATTR_TYPEID(bool, attr_bool);
-ATTR_TYPEID(unsigned char, attr_uchar);
-ATTR_TYPEID(signed char, attr_schar);
+ATTR_TYPEID(uint8_t, attr_uchar);
+ATTR_TYPEID(int8_t, attr_schar);
-ATTR_TYPEID(unsigned short, attr_ushort);
-ATTR_TYPEID(signed short, attr_sshort);
+ATTR_TYPEID(uint16_t, attr_ushort);
+ATTR_TYPEID(int16_t, attr_sshort);
-ATTR_TYPEID(unsigned int, attr_uint);
-ATTR_TYPEID(signed int, attr_sint);
+ATTR_TYPEID(uint32_t, attr_uint);
+ATTR_TYPEID(int32_t, attr_sint);
-#ifdef LONG_64BIT
-ATTR_TYPEID(unsigned long, attr_ulong);
-ATTR_TYPEID(signed long, attr_slong);
-#endif
+ATTR_TYPEID(uint64_t, attr_ulong);
+ATTR_TYPEID(int64_t, attr_slong);
ATTR_TYPEID(float, attr_float);
ATTR_TYPEID(double, attr_double);
diff --git a/mia/core/boundary_conditions.cc b/mia/core/boundary_conditions.cc
index bd6b873..5a51209 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 8701d73..fb8d64c 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -192,6 +192,9 @@ private:
*/
typedef THandlerSingleton<TFactoryPluginHandler<CSplineBoundaryConditionPlugin> > CSplineBoundaryConditionPluginHandler;
+template<>
+const char * const TPluginHandler<CSplineBoundaryConditionPlugin>::m_help;
+
extern template class EXPORT_CORE THandlerSingleton<TFactoryPluginHandler<CSplineBoundaryConditionPlugin> >;
/// make spline boundary conditions parsable by the command line
diff --git a/mia/core/callback.cc b/mia/core/callback.cc
index 5ca6ab1..17f3b40 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 d065885..241e2d9 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 94181a3..0d3fb4d 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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 <cassert>
#include <mia/core/typedescr.hh>
#include <mia/core/cmdbooloption.hh>
+#include <mia/core/xmlinterface.hh>
NS_MIA_BEGIN
diff --git a/mia/core/cmdbooloption.hh b/mia/core/cmdbooloption.hh
index ed13701..02098bb 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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/cmdlineparser.cc b/mia/core/cmdlineparser.cc
index b820b07..7b02963 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,8 @@ using std::ostream;
using std::ofstream;
using std::ostringstream;
using std::string;
-using std::invalid_argument;
+using std::invalid_argument;
+using std::runtime_error;
using std::logic_error;
using std::vector;
using std::map;
@@ -195,7 +196,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-2016 Leipzig, Germany and Madrid, Spain. "
+const char *g_basic_copyright2 = " 1999-2017 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";
@@ -392,10 +393,13 @@ void CCmdOptionListData::print_help_xml(const char *name_help, const CPluginHand
if (help_xml != "-") {
ofstream xmlfile(help_xml.c_str());
- xmlfile << doc->write_to_string_formatted();
+ xmlfile << doc->write_to_string();
xmlfile << std::endl;
+ if (!xmlfile.good()) {
+ throw create_exception<runtime_error>("Unable to write '", help_xml, "'");
+ }
}else{
- std::cout << doc->write_to_string_formatted();
+ std::cout << doc->write_to_string();
}
}
@@ -627,7 +631,9 @@ int CCmdOptionList::handle_shortargs(const char *arg, size_t remaining_args, con
"parameter for multiple parameters");
}
}else {
- cvdebug() << "remaining_args = " << remaining_args << ", and " << nargs << " needed\n";
+
+ // this is the last flag
+ cvdebug() << "remaining_args = " << remaining_args << ", and " << nargs << " needed\n";
if (remaining_args < nargs ) {
throw create_exception<invalid_argument>("Option -", opt->get_short_option(),
": requires ", nargs, " arguments, but only ",
@@ -637,13 +643,11 @@ int CCmdOptionList::handle_shortargs(const char *arg, size_t remaining_args, con
switch (nargs) {
case 0:
opt->set_value(NULL);
- bool_options_only = true;
break;
case 1:
// this handles when the option value is not attacted to the flag
// like in -b somevalue
opt->set_value(args[0]);
- bool_options_only = false;
break;
default:// actually currently multiple
throw logic_error("Command line parameters that take more then"
diff --git a/mia/core/cmdlineparser.hh b/mia/core/cmdlineparser.hh
index cbe9365..fa7ed6e 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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/cmdoption.cc b/mia/core/cmdoption.cc
index ef2a7f1..f0c1501 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,11 +18,14 @@
*
*/
-#include <sstream>
-#include <stdexcept>
#include <mia/core/msgstream.hh>
#include <mia/core/cmdoption.hh>
#include <mia/core/tools.hh>
+#include <mia/core/xmlinterface.hh>
+
+#include <sstream>
+#include <stdexcept>
+#include <cassert>
using std::ostream;
using std::string;
@@ -168,6 +171,11 @@ void CCmdOption::do_get_opt_help(std::ostream& os) const
os << " ";
}
+void CCmdOption::xmlhelp_set_attribute(CXMLElement& node, const char *name, const std::string& value) const
+{
+ node.set_attribute(name, value);
+}
+
void CCmdOption::set_value(const char *str_value)
{
bool result;
diff --git a/mia/core/cmdoption.hh b/mia/core/cmdoption.hh
index 4c22823..efb4e08 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,11 @@
#include <iostream>
#include <mia/core/cmdoptionflags.hh>
#include <mia/core/handlerbase.hh>
-#include <mia/core/xmlinterface.hh>
NS_MIA_BEGIN
class CCmdOption;
+class CXMLElement;
/// Class to provide a maping from short option names to options
typedef std::map<char, CCmdOption *> CShortoptionMap;
@@ -149,7 +149,9 @@ protected:
*/
virtual void do_get_long_help(std::ostream& os) const;
- bool has_flag(CCmdOptionFlags test_flags) const;
+ bool has_flag(CCmdOptionFlags test_flags) const;
+
+ void xmlhelp_set_attribute(CXMLElement& node, const char *name, const std::string& value) const;
private:
std::string get_flag_string() const;
const char *get_short_help() const;
diff --git a/mia/core/cmdoptionflags.hh b/mia/core/cmdoptionflags.hh
index 0cd98b2..24e4634 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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/cmdparamoption.hh b/mia/core/cmdparamoption.hh
index 5950a6b..2fa80e9 100644
--- a/mia/core/cmdparamoption.hh
+++ b/mia/core/cmdparamoption.hh
@@ -1,7 +1,7 @@
/* -*- mia-c++ -*-
*
* This file is part of MIA - a toolbox for medical image analysis
- * Copyright (c) Leipzig, Madrid 1999-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -346,7 +346,7 @@ void TCmdOption<T>::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<T>::value);
+ xmlhelp_set_attribute(parent, "type", __type_descr<T>::value);
}
template <typename T>
@@ -372,8 +372,8 @@ void TRepeatableCmdOption<T>::do_get_long_help_xml(std::ostream& os, CXMLElement
HandlerHelpMap& MIA_PARAM_UNUSED(handler_map)) const
{
do_get_long_help(os);
- parent.set_attribute("type", __type_descr<T>::value);
- parent.set_attribute("repeatable", "1");
+ xmlhelp_set_attribute(parent, "type", __type_descr<T>::value);
+ xmlhelp_set_attribute(parent, "repeatable", "1");
}
template <typename T>
diff --git a/mia/core/cmdstringoption.cc b/mia/core/cmdstringoption.cc
index e4d2727..e6c1db7 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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/core/cmdstringoption.hh>
#include <mia/core/msgstream.hh>
#include <mia/core/typedescr.hh>
+#include <mia/core/xmlinterface.hh>
NS_MIA_BEGIN
diff --git a/mia/core/cmdstringoption.hh b/mia/core/cmdstringoption.hh
index d284322..3e0a481 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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/cmdtranslateroption.cc b/mia/core/cmdtranslateroption.cc
index 32994f6..64b5410 100644
--- a/mia/core/cmdtranslateroption.cc
+++ b/mia/core/cmdtranslateroption.cc
@@ -1,7 +1,7 @@
/* -*- mia-c++ -*-
*
* This file is part of MIA - a toolbox for medical image analysis
- * Copyright (c) Leipzig, Madrid 1999-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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/cmdtranslateroption.hh b/mia/core/cmdtranslateroption.hh
index 93ad62d..b50fc59 100644
--- a/mia/core/cmdtranslateroption.hh
+++ b/mia/core/cmdtranslateroption.hh
@@ -1,7 +1,7 @@
/* -*- mia-c++ -*-
*
* This file is part of MIA - a toolbox for medical image analysis
- * Copyright (c) Leipzig, Madrid 1999-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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/cmeans.cc b/mia/core/cmeans.cc
index fc7d9d9..42c5b44 100644
--- a/mia/core/cmeans.cc
+++ b/mia/core/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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -79,8 +79,6 @@ CMeans::SparseProbmap CMeans::run(const SparseHistogram& histogram, DVector& cl
CMeans::SparseProbmap CMeans::run(const SparseHistogram& histogram, DVector& class_centers, bool de_normalize_results) const
{
- FUNCTION_NOT_TESTED;
-
// prepare input data
NormalizedHistogram nhist(histogram.size());
@@ -109,9 +107,9 @@ CMeans::SparseProbmap CMeans::run(const SparseHistogram& histogram, DVector& cl
<< ", " << nhist[nhist.size()-1].first << "]\n";
class_centers = m_cci->run(nhist);
- cvmsg() << "Initial class centers =" << class_centers << "\n";
+ cvinfo() << "Initial class centers =" << class_centers << "\n";
auto internal_result = impl->run(nhist, class_centers);
- cvmsg() << "Finale class centers =" << class_centers << "\n";
+ cvinfo() << "Finale class centers =" << class_centers << "\n";
SparseProbmap result(internal_result.size());
@@ -127,7 +125,7 @@ CMeans::SparseProbmap CMeans::run(const SparseHistogram& histogram, DVector& cl
[inv_bin_scale, bin_shift](double x) {
return inv_bin_scale * x + bin_shift;
});
- cvmsg() << "Finale class rescaled =" << class_centers << "\n";
+ cvinfo() << "Finale class rescaled =" << class_centers << "\n";
}
return result;
@@ -232,7 +230,7 @@ CMeansImpl::run(const CMeans::NormalizedHistogram& nh, CMeans::DVector& class_ce
while (cont) {
evaluate_probabilities(class_centers, pv);
double residuum = update_class_centers(class_centers, nh, pv);
- cvmsg() << "Class centers: " << class_centers
+ cvdebug() << "Class centers: " << class_centers
<< ", res=" << residuum
<< "\n";
cont = residuum > m_epsilon;
@@ -246,7 +244,7 @@ CMeansImpl::run(const CMeans::NormalizedHistogram& nh, CMeans::DVector& class_ce
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"));
+ add_parameter("nc", make_lc_param(m_size, 2, true, "Number of classes to use for the fuzzy-cmeans classification"));
}
size_t CMeansInitializerSizedPlugin::get_size_param() const
@@ -319,6 +317,8 @@ CMeans::SparseProbmap::SparseProbmap(const std::string& filename)
*is >> buf;
size_t hsize, nclasses;
+
+ // coverity[TAINTED_SCALAR]
if (buf != map_signature) {
throw create_exception<runtime_error>("CMeans::SparseProbmap::load: Input file '",
filename, "'is not a sparse probability map: signature:'",
diff --git a/mia/core/cmeans.hh b/mia/core/cmeans.hh
index a668837..681fd5b 100644
--- a/mia/core/cmeans.hh
+++ b/mia/core/cmeans.hh
@@ -1,7 +1,7 @@
/* -*- mia-c++ -*-
*
* This file is part of MIA - a toolbox for medical image analysis
- * Copyright (c) Leipzig, Madrid 1999-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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/cmeansinit/kmeans.cc b/mia/core/cmeansinit/kmeans.cc
index a52ec3b..5ade424 100644
--- a/mia/core/cmeansinit/kmeans.cc
+++ b/mia/core/cmeansinit/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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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/cmeansinit/kmeans.hh b/mia/core/cmeansinit/kmeans.hh
index 5e56ecc..2498213 100644
--- a/mia/core/cmeansinit/kmeans.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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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/cmeansinit/static.cc b/mia/core/cmeansinit/static.cc
index 1ac9b0c..e9e0ed4 100644
--- a/mia/core/cmeansinit/static.cc
+++ b/mia/core/cmeansinit/static.cc
@@ -1,7 +1,7 @@
/* -*- mia-c++ -*-
*
* This file is part of MIA - a toolbox for medical image analysis
- * Copyright (c) Leipzig, Madrid 1999-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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/cmeansinit/static.hh b/mia/core/cmeansinit/static.hh
index 91ae85e..270077f 100644
--- a/mia/core/cmeansinit/static.hh
+++ b/mia/core/cmeansinit/static.hh
@@ -1,7 +1,7 @@
/* -*- mia-c++ -*-
*
* This file is part of MIA - a toolbox for medical image analysis
- * Copyright (c) Leipzig, Madrid 1999-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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/cmeansinit/test_kmeans.cc b/mia/core/cmeansinit/test_kmeans.cc
index 07d7ca9..1467e05 100644
--- a/mia/core/cmeansinit/test_kmeans.cc
+++ b/mia/core/cmeansinit/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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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/cmeansinit/test_static.cc b/mia/core/cmeansinit/test_static.cc
index 21e07b1..22f9cbf 100644
--- a/mia/core/cmeansinit/test_static.cc
+++ b/mia/core/cmeansinit/test_static.cc
@@ -1,7 +1,7 @@
/* -*- mia-c++ -*-
*
* This file is part of MIA - a toolbox for medical image analysis
- * Copyright (c) Leipzig, Madrid 1999-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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.cc b/mia/core/combiner.cc
index 4d40e65..d674787 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 19ccb3a..6f6d750 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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/convergence_measure.cc b/mia/core/convergence_measure.cc
new file mode 100644
index 0000000..4d23df3
--- /dev/null
+++ b/mia/core/convergence_measure.cc
@@ -0,0 +1,85 @@
+/* -*- mia-c++ -*-
+ *
+ * This file is part of MIA - a toolbox for medical image analysis
+ * Copyright (c) Genoa 1999-2017 Gert Wollny
+ *
+ * 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/convergence_measure.hh>
+#include <mia/core/msgstream.hh>
+#include <limits>
+#include <numeric>
+#include <cmath>
+
+using std::numeric_limits;
+
+namespace mia {
+
+CConvergenceMeasure::CConvergenceMeasure(uint32_t size):
+ m_size(size)
+{
+
+}
+
+void CConvergenceMeasure::push(double value)
+{
+ m_v.push_back(value);
+
+ if (m_v.size() > m_size) {
+ m_v.pop_front();
+ }
+}
+
+double CConvergenceMeasure::value() const
+{
+ double retval = numeric_limits<double>::max();
+ if (!m_v.empty())
+ retval = std::accumulate(m_v.begin(), m_v.end(), 0.0)/m_v.size();
+ return retval;
+}
+
+double CConvergenceMeasure::rate() const
+{
+ double retval = 0.0;
+ if (m_v.size() > 1) {
+ double sum_v = 0.0;
+ double sum_xv = 0.0;
+ double sum_x2 = 0.0;
+ for (std::size_t i = 0, k=1; i < m_v.size(); ++i, ++k) {
+ sum_v += m_v[i];
+ sum_xv += k * m_v[i];
+ sum_x2 += k*k;
+ }
+ double x_mean = (m_v.size() + 1.0) / 2.0;
+ retval = ((sum_xv - sum_v * x_mean) / m_v.size()) /
+ (sum_x2 / m_v.size() - x_mean * x_mean);
+ }
+ return retval;
+}
+
+uint32_t CConvergenceMeasure::fill() const
+{
+ return m_v.size();
+}
+
+
+bool CConvergenceMeasure::is_full_size() const
+{
+ return fill() >= m_size;
+
+}
+
+}
diff --git a/mia/core/convergence_measure.hh b/mia/core/convergence_measure.hh
new file mode 100644
index 0000000..9d47845
--- /dev/null
+++ b/mia/core/convergence_measure.hh
@@ -0,0 +1,85 @@
+/* -*- mia-c++ -*-
+ *
+ * This file is part of MIA - a toolbox for medical image analysis
+ * Copyright (c) Genoa 1999-2017 Gert Wollny
+ *
+ * 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_convergence_hh
+#define mia_core_convergence_hh
+
+#include <deque>
+#include <cstdint>
+
+#include <mia/core/defines.hh>
+
+namespace mia {
+
+/**
+ \brief Class to get a convergence value as mean over various time steps
+
+ This class can is used to measure the mean of a value over a user-defined
+ number of steps.
+
+
+*/
+
+
+class EXPORT_CORE CConvergenceMeasure {
+public:
+
+ /**
+ Contruct the class by giving the number of steps the
+ measure should be averaged over.
+
+ \param size default number of steps to take into account
+
+ */
+
+ CConvergenceMeasure(uint32_t size);
+
+ /**
+ Add a new value to the measure. If the maximum number of
+ values is already in consideration, the oldest value will
+ be dropped.
+ */
+
+ void push(double value);
+
+ /// \returns current average of the measure
+ double value() const;
+
+
+ /** \returns the (linear) rate of change as linear regression of
+ the values currently in the buffer.
+ */
+ double rate() const;
+
+ /// \returns the number of values currently in the buffer
+ uint32_t fill() const;
+
+ /// \returns whether the buffer is at maximal expected capacity
+ bool is_full_size() const;
+
+private:
+ std::deque<double> m_v;
+ uint32_t m_size;
+};
+
+}; // namespace mia
+
+#endif
diff --git a/mia/core/cost.cc b/mia/core/cost.cc
index 1042f61..e7a598b 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 d28ffae..ca7b510 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 a892f8a..e8f06c6 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 a955b12..3d13753 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 8c05bda..94102a2 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 4be8a8c..23a2f2a 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 a36002d..93280f2 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,6 +51,19 @@ boost::any CDatapool::get_and_remove(const std::string& key)
return retval;
}
+void CDatapool::remove(const std::string& key)
+{
+ CRecursiveScopedLock lock(m_mutex);
+ try{
+ Anymap::const_iterator i = get_iterator(key);
+ m_map.erase(key);
+ m_usage.erase(key);
+ }
+ catch (std::invalid_argument& x) {
+ cvwarn() << "CDatapool::remove: key '" << key << "' not in pool\n";
+ }
+}
+
void CDatapool::add(const std::string& key, boost::any value)
{
CRecursiveScopedLock lock(m_mutex);
diff --git a/mia/core/datapool.hh b/mia/core/datapool.hh
index cf69543..f948d11 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -68,6 +68,13 @@ public:
boost::any get_and_remove(const std::string& key);
/**
+ remove this data from the pool
+ \param key key of data to be retrieved
+ */
+ void remove(const std::string& key);
+
+
+ /**
\param key
\returns \a true if key exists in pool and \a false if not
*/
diff --git a/mia/core/defines.hh b/mia/core/defines.hh
index 816d40c..083f0af 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 9a26e5d..8d0fd01 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,7 +91,7 @@ const T TDelayedParameter<T>::get() const
{
if (!(CDatapool::instance().has_key(m_key))) {
throw create_exception<std::invalid_argument>("TDelayedParameter::get(): Key '", m_key,
- "' is not availabe in the data pool");
+ "' is not available in the data pool");
}
return boost::any_cast<T>(CDatapool::instance().get(m_key));
}
diff --git a/mia/core/dictmap.hh b/mia/core/dictmap.hh
index 88751a4..45ee3d0 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 3d0e775..4c8692f 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 99f7168..b5fb1c3 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 006d55d..a05b8e1 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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.hh b/mia/core/dlloader.hh
index 6093c5d..7dcf762 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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.cc b/mia/core/dummyhandler.cc
index 4366a94..14fd307 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 e47e91d..83473f7 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,13 +51,14 @@ public:
};
+extern template class EXPORT_CORE TIOPluginHandler<CTestIOPlugin>;
class EXPORT_CORE CDummyIOPluginHandler: public TIOPluginHandler<CTestIOPlugin> {
void check_file_exists(const std::string& fname) const;
};
-extern template class EXPORT_CORE TIOPluginHandler<CTestIOPlugin>;
extern template class EXPORT_CORE THandlerSingleton<TIOPluginHandler<CTestIOPlugin> >;
+
/// Test IO plugin handler, don't use this in real code
typedef THandlerSingleton<CDummyIOPluginHandler> CTestIOPluginHandler;
diff --git a/mia/core/errormacro.cc b/mia/core/errormacro.cc
new file mode 100644
index 0000000..3fc7c64
--- /dev/null
+++ b/mia/core/errormacro.cc
@@ -0,0 +1,94 @@
+
+/* -*- mia-c++ -*-
+ *
+ * This file is part of MIA - a toolbox for medical image analysis
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
+ *
+ * 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 <mia/core/defines.hh>
+#include <ostream>
+#include <cstdlib>
+
+#if defined(HAVE_CXXABI_H) && defined(HAVE_EXEINFO_H)
+#include <execinfo.h>
+#include <cxxabi.h>
+#endif
+
+NS_MIA_BEGIN
+
+using std::ostream;
+
+#if defined(HAVE_CXXABI_H) && defined(HAVE_EXECINFO_H)
+void append_stacktrace(ostream& os)
+{
+ os << "backtrace:\n";
+ void* addrlist[64];
+
+ int addrlen = backtrace(addrlist, sizeof(addrlist) / sizeof(void*));
+
+ if (addrlen == 0) {
+ os << " not availble\n";
+ return;
+ }
+ char** symbollist = backtrace_symbols(addrlist, addrlen);
+
+
+ for (int i = 0; i < addrlen, ++i){
+ char *begin_name = 0, *begin_offset = 0, *end_offset = 0;
+
+ p = symbollist[i];
+
+ while (!begin_name && *p != 0) {
+ if (*p == '(') {
+ *p++ = 0;
+ begin_name = p;
+ }
+ }
+
+ while (!begin_offset && *p != 0) {
+ if (*p == '+') {
+ *p++ = 0;
+ begin_offset = p;
+ }
+ }
+
+
+ int status;
+ char* ret = abi::__cxa_demangle(begin_name, 0, 0, &status);
+ if (status == 0) {
+ msg << " " << symbollist[i] << "("
+ << ret << "+" << begin_offset << "\n";
+ free(ret);
+ }else {
+ msg << " " << symbollist[i] << "("
+ << begin_name << "+" << begin_offset << "\n";
+ }
+ }
+ free(symbollist);
+}
+#else
+void append_stacktrace(ostream& os)
+{
+ os << "\nStack unwinding not implemented for this platform\n";
+}
+#endif
+
+NS_MIA_END
diff --git a/mia/core/errormacro.hh b/mia/core/errormacro.hh
index 4ea6271..21ed792 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,6 +31,10 @@
NS_MIA_BEGIN
+#if defined(HAVE_CXXABI_H) && defined(HAVE_EXEINFO_H)
+void append_stacktrace(ostream& os);
+#endif
+
template <typename V>
void __append_message(std::ostream& os, const V& v)
{
@@ -52,7 +56,10 @@ template <typename... T>
const std::string __create_message(T ...t)
{
std::stringstream msg;
- ::mia::__append_message(msg, t...);
+ ::mia::__append_message(msg, t...);
+#if defined(HAVE_CXXABI_H) && defined(HAVE_EXEINFO_H)
+ append_stacktrace(msg);
+#endif
return msg.str();
}
diff --git a/mia/core/export_handler.hh b/mia/core/export_handler.hh
index fa4a662..48aa25b 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 4d420c4..17a6321 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -282,11 +282,13 @@ struct create_plugin {
return nullptr;
}
- cvdebug() << "TFactoryPluginHandler<>::produce: Create plugin from '" << factory_name << "'\n";
+ cvdebug() << "TFactoryPluginHandler<"<< h.get_descriptor() << ">::produce: "
+ "Create plugin from '" << factory_name << "'\n";
auto factory = h.plugin(factory_name.c_str());
if (!factory)
- throw create_exception<std::invalid_argument>("Unable to find plugin for '", factory_name.c_str(), "'");
+ throw create_exception<std::invalid_argument>("Factory " , h.get_descriptor(),
+ ":Unable to find plugin for '", factory_name, "'");
return factory->create(param_list.begin()->second,params.c_str());
}
};
@@ -318,7 +320,8 @@ struct create_plugin<Handler, ProductChained, true> {
auto factory = h.plugin(factory_name.c_str());
if (!factory) {
delete result;
- throw create_exception<std::invalid_argument>("Unable to find plugin for '", factory_name.c_str(), "'");
+ throw create_exception<std::invalid_argument>("Factory " , h.get_descriptor(),
+ "Unable to find plugin for '", factory_name, "'");
}
auto r = factory->create(ipl->second,params.c_str());
diff --git a/mia/core/factory_trait.hh b/mia/core/factory_trait.hh
index 7cd6be3..348b3cc 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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/fastica.cc b/mia/core/fastica.cc
deleted file mode 100644
index 42896ae..0000000
--- a/mia/core/fastica.cc
+++ /dev/null
@@ -1,567 +0,0 @@
-/* -*- mia-c++ -*-
- *
- * This file is part of MIA - a toolbox for medical image analysis
- * Copyright (c) Leipzig, Madrid 1999-2016 Gert Wollny
- *
- * 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/gsl_matrix_vector_ops.hh>
-#include <mia/core/gsl_pca.hh>
-#include <mia/core/fastica.hh>
-#include <algorithm>
-#include <random>
-#include <cmath>
-#include <stdexcept>
-#include <gsl/gsl_blas.h>
-#include <mia/core/fastica_nonlinearity.hh>
-
-NS_MIA_BEGIN
-
-using gsl::Vector;
-using gsl::Matrix;
-using gsl::CSymmvEvalEvec;
-
-using std::sort;
-using std::transform;
-using std::vector;
-
-FastICA::FastICA(int num_ic):
- m_approach(appr_defl),
- m_numOfIC(num_ic),
- m_finetune(true),
- m_mu(1.0),
- m_epsilon(1e-10),
- m_sampleSize(1.0),
- m_stabilization(true),
- m_maxNumIterations(1000),
- m_maxFineTune(200),
- m_firstEig(-1),
- m_lastEig(-1),
- m_PCAonly(false),
- m_component_energy_limit(0.9),
- m_with_initial_guess(false),
- m_do_saddle_check(false),
- m_saddle_postiter(100),
- m_separating_matrix(1,1,false)
-{
- m_nonlinearity = produce_fastica_nonlinearity("pow3");
-}
-
-struct CCenteredSignal {
- CCenteredSignal(const Matrix& mixedSig);
-
- Matrix signal;
- Vector mean;
-};
-
-
-CCenteredSignal::CCenteredSignal(const Matrix& mixedSig):
- signal(mixedSig.rows(), mixedSig.cols(), false),
- mean(mixedSig.rows(), true)
-{
- for (size_t r = 0; r < mixedSig.rows(); ++r) {
- for (size_t c = 0; c < mixedSig.cols(); ++c)
- mean[r] += mixedSig(r,c);
- mean[r] /= mixedSig.cols();
- for (size_t c = 0; c < mixedSig.cols(); ++c)
- signal.set(r,c, mixedSig(r,c) - mean[r]);
- }
-}
-
-void FastICA::evaluate_whiten_matrix(const Matrix& evec, const Vector& eval)
-{
- m_whitening_matrix.reset(evec.cols(), evec.rows(), false);
- m_dewhitening_matrix.reset(evec.rows(), evec.cols(), false);
-
- for (unsigned i = 0; i < eval.size(); i++) {
- double iwscale = sqrt(eval[i]);
- double wscale = 1.0 / iwscale;
-
- auto wmr = m_whitening_matrix.get_row(i);
- auto inv = evec.get_column(i);
- auto dwmc = m_dewhitening_matrix.get_column(i);
-
- transform(inv.begin(), inv.end(), wmr.begin(),
- [wscale](double x) {return wscale * x;});
-
- transform(inv.begin(), inv.end(), dwmc.begin(),
- [iwscale](double x) {return iwscale * x;});
- }
-
- cvdebug() << "Whitening: = " << m_whitening_matrix << "\n";
- cvdebug() << "DeWhitening: = " << m_dewhitening_matrix << "\n";
-
-}
-
-bool FastICA::separate(const gsl::Matrix& mix)
-{
- CCenteredSignal centered(mix);
- cvdebug() << "separate signal of size " << centered.signal.rows() << "x" << centered.signal.cols() << "\n";
-
- // currently not used
- Matrix guess;
- if (m_initGuess)
- guess = m_initGuess;
-
-
- // run PCA to prepare the whitening
- // also select the limit of useful compinents based on maximal
- // energy
- gsl::PCA pca(m_numOfIC, m_component_energy_limit);
- auto pca_result = pca.analyze(centered.signal);
-
- if (pca_result.eval.size() < 1) {
- m_independent_components = mix;
- return false;
- }
-
- // update the number of components
- m_numOfIC = pca_result.eval.size();
-
- cvdebug() << "Considering " << m_numOfIC << " independend components\n";
- cvdebug() << "PCA: eval= " << pca_result.eval << "\n";
- cvdebug() << "PCA: evec= " << pca_result.evec << "\n";
-
- evaluate_whiten_matrix(pca_result.evec, pca_result.eval);
-
- // if only PCA, stop here and save the dewithening as independend components
- // where is the mixing matrix?
- if (m_PCAonly) {
- m_mixing_matrix.reset(mix.rows(), m_dewhitening_matrix.cols(), 1.0);
- m_independent_components = m_dewhitening_matrix;
- return true;
- }
-
- // run the actual ICA
-
- auto whitened_signal = m_whitening_matrix * centered.signal;
-
- bool result = false;
- Matrix B( whitened_signal.rows(), m_numOfIC, true);
-
- switch (m_approach) {
- case appr_defl: result = fpica_defl(whitened_signal, B);break;
- case appr_symm: result = fpica_symm(whitened_signal, B); break;
- default:
- throw std::invalid_argument("FastICA::separate: unknown apporach given");
-
- }
-
- // evaluate the results if the ICA
- m_mixing_matrix = m_dewhitening_matrix * B;
-
- cvdebug() << "Mixing matrix= " << m_mixing_matrix << "\n";
-
- multiply_mT_m(m_separating_matrix, B, m_whitening_matrix);
-
- m_independent_components = m_separating_matrix * mix;
-
- cvdebug() << "ICs= " << m_independent_components << "\n";
-
- return result;
-}
-
-bool FastICA::fpica_defl_round(int component, Vector& w, Matrix& B)
-{
- Vector w_old(w);
- Vector w_old2(w);
-
- double mu = m_mu;
- double delta = m_epsilon + 1.0;
-
- bool is_finetuning = false;
- bool converged = false;
- bool loong = false;
-
- double stroke = 0.0;
-
- int iter = 0;
- int maxiter = m_maxNumIterations;
-
- while (!converged && iter < maxiter) {
-
- cvdebug() << "Defl: c=" << component
- << ", iter= " << iter
- << ", delta= " << delta
- << "\n";
-
- m_nonlinearity->set_mu(mu);
- m_nonlinearity->apply(w);
-
- Vector w_save(w);
- for (int j = 0; j < component; ++j) {
- const double wdot = B.dot_column(j, w_save);
- auto wj = B.get_column(j);
- cblas_daxpy(wj->size, -wdot, wj->data, wj->stride, w->data, w->stride);
- }
-
- double norm = sqrt(dot(w, w));
- if (norm > 0.0)
- gsl_vector_scale(w, 1.0/norm);
-
- Vector w_help = w_old;
- gsl_vector_sub(w_help, w);
-
- cvdebug() << "w-help=" << w_help << "\n";
- delta = sqrt(dot(w_help, w_help));
-
- cvmsg() << "DEFL["<<iter<<"]: delta = " << delta << "\n";
-
- if (delta < m_epsilon) {
- if (m_finetune && !is_finetuning) {
- cvinfo() << "DEFL: start fine tuning\n";
- is_finetuning = true;
- maxiter += m_maxFineTune;
- mu = 0.01 * m_mu;
- }else{
- converged = true;
- }
- } else if (m_stabilization) {
- gsl_vector_sub(w_old2, w);
- double delta2 = sqrt(dot(w_old2, w_old2));
- if ( (stroke == 0.0) && (delta2 < m_epsilon)) {
- stroke = mu;
- mu *= 0.5;
- }else if (stroke != 0.0) {
- mu = stroke;
- stroke = 0.0;
- }else if (! loong && 2*iter > m_maxNumIterations ) {
- loong = true;
- mu *= 0.5;
- }
- }
- w_old2 = w_old;
- w_old = w;
-
- cvdebug() << "w_old=" << w_old << " norm=" << norm << "\n";
-
- iter++;
- }
-
- return delta < m_epsilon;
-}
-
-bool FastICA::fpica_defl(const Matrix& X, Matrix& B)
-{
- // not yet supported
- assert(!m_with_initial_guess);
-
- std::random_device rd;
- std::mt19937 gen(rd());
- std::uniform_real_distribution<> random_source( -0.5, 0.5 );
-
- Vector w( X.rows(), false);
-
- m_nonlinearity->set_signal(&X);
-
- bool global_converged = true;
-
- for (int i = 0; i < m_numOfIC; ++i) {
-
- // initalize vector (should also go into extra class
- for (unsigned i = 0; i < w.size(); ++i)
- w[i] = random_source(gen);
-
- bool converged = fpica_defl_round(i, w, B);
- cvmsg() << "Round(" << i << ")" << (converged ? "converged" : "did not converge") << "\n";
-
- global_converged &= converged;
- B.set_column(i, w);
- }
-
- return global_converged;
-}
-
-
-static double min_abs_diag(const Matrix& m)
-{
- unsigned N = m.rows() > m.cols() ? m.rows() : m.cols();
- double min_val = fabs(m(0,0));
- for (unsigned i = 1; i < N; ++i) {
- double v = fabs(m(i,i));
- if ( min_val > v)
- min_val = v;
- }
- return min_val;
-}
-
-double FastICA::fpica_symm_step(Matrix& B, Matrix& B_old,double mu, Matrix& workspace)
-{
- m_nonlinearity->set_mu(mu);
- m_nonlinearity->apply(B);
- matrix_inv_sqrt(B);
- multiply_mT_m(workspace, B, B_old);
- return min_abs_diag(workspace);
-}
-
-bool FastICA::fpica_symm(const Matrix& X, Matrix& B)
-{
- // not yet supported
- assert(!m_with_initial_guess);
-
- std::random_device rd;
- std::mt19937 gen(rd());
- std::uniform_real_distribution<> random_source( -0.5, 0.5 );
-
- Matrix B_old2(B);
- Matrix B_restart(B);
-
- // random and orthogonalize
- for(auto ib = B.begin(); ib != B.end(); ++ib)
- *ib = random_source(gen);
-
- matrix_orthogonalize(B);
- Matrix B_old(B);
-
- m_nonlinearity->set_signal(&X);
-
- bool is_fine_tuning = false;
- double mu = m_mu;
-
- Matrix BTB(B.cols(), B.rows(), false);
-
- bool converged = false;
- int iter = 0;
- double stroke = 0.0;
- bool loong = false;
-
- int maxiter = m_maxNumIterations;
-
- bool do_saddle_check = m_do_saddle_check;
- bool finished = !do_saddle_check;
-
- do {
- while (!converged && iter < maxiter) {
-
- double minAbsCos = fpica_symm_step(B, B_old, mu, BTB);
-
- cvdebug() << "B= " << B << "\n";
-
- cvmsg() << "FastICA: "<< iter << ":" << 1.0 - minAbsCos << "\n";
-
- if ( 1.0 - minAbsCos < m_epsilon) {
- // run one more time with lower step-width
- if (m_finetune && !is_fine_tuning) {
- mu *= 0.01;
- is_fine_tuning = true;
- maxiter += m_maxFineTune;
- } else {
- converged = true;
- }
- } else if (m_stabilization) {
- multiply_mT_m(BTB, B, B_old2);
- double minAbsCos2 = min_abs_diag(BTB);
-
- // Avoid ping-pong
- if (!stroke && (1 - minAbsCos2 < m_epsilon)) {
- stroke = mu;
- mu /= 2.0;
- } else if (stroke) { // back to normal
- mu = stroke;
- stroke = 0;
- } else if ( !loong && 2 * iter > m_maxNumIterations) {
- // already running some time and
- // no convergence, try half step width
- // once
- loong = true;
- mu *= 0.5;
- }
- }
-
- B_old2 = B_old;
- B_old = B;
-
- ++iter;
- }
- if (do_saddle_check) {
- do_saddle_check = run_saddlecheck(B, X);
- m_saddle_postiter = maxiter;
- iter = 0;
- } else
- finished = true;
-
- } while (!finished);
-
- return converged;
-}
-
-
-/*
- This is the saddle check as described in
-
- Petr Tichavský, Zbynek Koldovský, and Erkki Oja
- "Performance Analysis of the FastICA Algorithm and Cramér–Rao "
- "Bounds for Linear Independent Component Analysis"
- IEEE Tran Signal Processing, 54(4), 2006, 1189-1203
-
- Returns true if at least one check resulted in an update of the
- components.
-
-*/
-bool FastICA::run_saddlecheck(Matrix &B, const Matrix& X)
-{
- bool result = false;
- vector<bool> rotated(B.cols(), false);
- Matrix U(B.cols(), X.cols(), false);
- multiply_mT_m(U, B, X);
- auto table = m_nonlinearity->get_saddle_test_table(U);
-
- for (unsigned i = 0; i < U.rows(); ++i) {
- for (unsigned j = i+1; j < U.rows() && !rotated[i]; ++j) {
- if (rotated[j])
- continue;
- auto ui = U.get_row(i);
- auto uj = U.get_row(j);
- const double isqrt2 = 1.0 / sqrt(2.0);
- auto ui_new = (ui + uj) * isqrt2;
- auto uj_new = (ui - uj) * isqrt2;
-
- auto ui_sir = m_nonlinearity->get_saddle_test_value(ui_new);
- auto uj_sir = m_nonlinearity->get_saddle_test_value(uj_new);
-
- if (fmax(ui_sir, uj_sir) > fmax(table[i], table[j])) {
- result = rotated[i] = rotated[j] = true;
- auto bi_new = (B.get_row(i) + B.get_row(j)) * isqrt2;
- auto bj_new = (B.get_row(i) - B.get_row(j)) * isqrt2;
- B.set_row(i, bi_new);
- B.set_row(j, bj_new);
- cvdebug() << "Rotating components " << i << " and " << j << "\n";
- }
- }
- }
- return result;
-};
-
-void FastICA::set_approach(EApproach apr)
-{
- m_approach = apr;
-}
-
-void FastICA::set_nr_of_independent_components (int nrIC)
-{
- m_numOfIC = nrIC;
-}
-
-
-void FastICA::set_nonlinearity (PFastICADeflNonlinearity g)
-{
- assert(g);
- m_nonlinearity = g;
-}
-
-
-void FastICA::set_finetune (bool finetune)
-{
- m_finetune = finetune;
-}
-
-void FastICA::set_mu (double mu)
-{
- m_mu = mu;
-}
-
-void FastICA::set_epsilon (double epsilon)
-{
- m_epsilon = epsilon;
-}
-
-void FastICA::set_sample_size (double sampleSize)
-{
- m_sampleSize = sampleSize;
-}
-
-void FastICA::set_component_energy_limit(double limit)
-{
- m_component_energy_limit = limit;
-}
-
-void FastICA::set_stabilization (bool stabilization)
-{
- m_stabilization = stabilization;
-}
-
-void FastICA::set_max_num_iterations (int maxNumIterations)
-{
- m_maxNumIterations = maxNumIterations;
-}
-
-void FastICA::set_max_fine_tune (int maxFineTune)
-{
- m_maxFineTune = maxFineTune;
-}
-
-void FastICA::set_pca_only (bool PCAonly)
-{
- m_PCAonly = PCAonly;
-}
-
-void FastICA::set_init_guess (const Matrix& initGuess)
-{
- m_initGuess = initGuess;
-}
-
-void FastICA::set_saddle_check(bool saddle_check)
-{
- m_do_saddle_check = saddle_check;
-}
-
-void FastICA::set_saddle_check_postiterations(int saddle_postiter)
-{
- m_saddle_postiter = saddle_postiter;
-}
-
-int FastICA::get_nr_of_independent_components () const
-{
- return m_numOfIC;
-}
-
-const Matrix& FastICA::get_mixing_matrix () const
-{
- return m_mixing_matrix;
-}
-
-const Matrix& FastICA::get_separating_matrix () const
-{
- return m_separating_matrix;
-}
-
-const Matrix& FastICA::get_independent_components () const
-{
- return m_independent_components;
-}
-
-
-const Matrix& FastICA::get_principal_eigenvectors () const
-{
- return m_principal_eigenvectors;
-}
-
-const Matrix& FastICA::get_whitening_matrix () const
-{
- return m_whitening_matrix;
-}
-
-const Matrix& FastICA::get_dewhitening_matrix () const
-{
- return m_dewhitening_matrix;
-}
-
-const Matrix& FastICA::get_white_signal () const
-{
- return m_white_sig;
-}
-
-NS_END
diff --git a/mia/core/fastica/CMakeLists.txt b/mia/core/fastica/CMakeLists.txt
index 3d63350..0b88ba6 100644
--- a/mia/core/fastica/CMakeLists.txt
+++ b/mia/core/fastica/CMakeLists.txt
@@ -16,6 +16,12 @@
# along with this program; if not, see <http://www.gnu.org/licenses/>.
#
-SET(NAMES deflationnonlinearity)
+SET(NL_NAMES deflationnonlinearity)
+
+PLUGINGROUP_WITH_TEST_AND_PREFIX2("fastica" "deflation" "${NL_NAMES}" "${MIACORE}")
+
+SET(IMPL_NAMES fastica)
+
+PLUGINGROUP_WITH_TEST_AND_PREFIX2("fastica" "implementation" "${IMPL_NAMES}" "${MIACORE}")
+
-PLUGINGROUP_WITH_TEST_AND_PREFIX2("fastica" "deflation" "${NAMES}" "${MIACORE}")
diff --git a/mia/core/fastica/deflationnonlinearity.cc b/mia/core/fastica/deflationnonlinearity.cc
index dac828c..91de69c 100644
--- a/mia/core/fastica/deflationnonlinearity.cc
+++ b/mia/core/fastica/deflationnonlinearity.cc
@@ -1,7 +1,7 @@
/* -*- mia-c++ -*-
*
* This file is part of MIA - a toolbox for medical image analysis
- * Copyright (c) Leipzig, Madrid 1999-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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/fastica/deflationnonlinearity.hh b/mia/core/fastica/deflationnonlinearity.hh
index 0a64023..f84f29d 100644
--- a/mia/core/fastica/deflationnonlinearity.hh
+++ b/mia/core/fastica/deflationnonlinearity.hh
@@ -1,7 +1,7 @@
/* -*- mia-c++ -*-
*
* This file is part of MIA - a toolbox for medical image analysis
- * Copyright (c) Leipzig, Madrid 1999-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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/fastica/fastica.cc b/mia/core/fastica/fastica.cc
new file mode 100644
index 0000000..4d908c1
--- /dev/null
+++ b/mia/core/fastica/fastica.cc
@@ -0,0 +1,1037 @@
+/* -*- mia-c++ -*-
+ *
+ * This file is part of MIA - a toolbox for medical image analysis
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
+ *
+ * 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 <miaconfig.h>
+
+#include <mia/core/gsl_matrix_vector_ops.hh>
+#include <mia/core/gsl_pca.hh>
+#include <mia/core/fastica/fastica.hh>
+#include <mia/core/fastica_nonlinearity.hh>
+#include <mia/core/errormacro.hh>
+#include <mia/core/msgstream.hh>
+
+#include <algorithm>
+#include <random>
+#include <cmath>
+#include <stdexcept>
+#include <gsl/gsl_blas.h>
+#include <vector>
+#include <cassert>
+#include <stdexcept>
+#include <memory>
+
+
+NS_MIA_BEGIN
+
+using gsl::Vector;
+using gsl::Matrix;
+using gsl::CSymmvEvalEvec;
+
+using std::swap;
+using std::sort;
+using std::transform;
+using std::vector;
+using std::invalid_argument;
+
+FastICA::FastICA(int num_ic):
+ m_approach(CIndepCompAnalysis::appr_defl),
+ m_numOfIC(num_ic),
+ m_finetune(true),
+ m_mu(0.9),
+ m_epsilon(1e-10),
+ m_sampleSize(1.0),
+ m_stabilization(true),
+ m_maxNumIterations(1000),
+ m_maxFineTune(200),
+ m_firstEig(-1),
+ m_lastEig(-1),
+ m_PCAonly(false),
+ m_component_energy_limit(0.9),
+ m_with_initial_guess(false),
+ m_do_saddle_check(true),
+ m_saddle_postiter(10),
+ m_separating_matrix(1,1,false),
+ m_deterministic_seed(-1)
+{
+ m_nonlinearity = produce_fastica_nonlinearity("pow3");
+}
+
+struct CCenteredSignal {
+ CCenteredSignal(const Matrix& mixedSig);
+
+ Matrix signal;
+ Vector mean;
+};
+
+
+CCenteredSignal::CCenteredSignal(const Matrix& mixedSig):
+ signal(mixedSig.rows(), mixedSig.cols(), false),
+ mean(mixedSig.rows(), true)
+{
+ for (size_t r = 0; r < mixedSig.rows(); ++r) {
+ for (size_t c = 0; c < mixedSig.cols(); ++c)
+ mean[r] += mixedSig(r,c);
+ mean[r] /= mixedSig.cols();
+ for (size_t c = 0; c < mixedSig.cols(); ++c)
+ signal.set(r,c, mixedSig(r,c) - mean[r]);
+ }
+}
+
+void FastICA::set_deterministic_seed(int seed)
+{
+ TRACE_FUNCTION;
+ m_deterministic_seed = seed;
+}
+
+void FastICA::evaluate_whiten_matrix(const Matrix& evec, const Vector& eval)
+{
+ m_whitening_matrix.reset(evec.cols(), evec.rows(), false);
+ m_dewhitening_matrix.reset(evec.rows(), evec.cols(), false);
+
+ for (unsigned i = 0; i < eval.size(); i++) {
+ double iwscale = sqrt(eval[i]);
+ double wscale = 1.0 / iwscale;
+
+ auto wmr = m_whitening_matrix.get_row(i);
+ auto inv = evec.get_column(i);
+ auto dwmc = m_dewhitening_matrix.get_column(i);
+
+ transform(inv.begin(), inv.end(), wmr.begin(),
+ [wscale](double x) {return wscale * x;});
+
+ transform(inv.begin(), inv.end(), dwmc.begin(),
+ [iwscale](double x) {return iwscale * x;});
+ }
+
+ cvdebug() << "Whitening: = " << m_whitening_matrix << "\n";
+ cvdebug() << "DeWhitening: = " << m_dewhitening_matrix << "\n";
+
+}
+
+bool FastICA::separate(const gsl::Matrix& mix)
+{
+ CCenteredSignal centered(mix);
+ cvdebug() << "separate signal of size " << centered.signal.rows() << "x" << centered.signal.cols() << "\n";
+
+ // currently not used
+ Matrix guess;
+ if (m_initGuess)
+ guess = m_initGuess;
+
+
+ // run PCA to prepare the whitening
+ // also select the limit of useful compinents based on maximal
+ // energy
+ gsl::PCA pca(m_numOfIC, m_component_energy_limit);
+ auto pca_result = pca.analyze(centered.signal);
+
+ if (pca_result.eval.size() < 1) {
+ m_independent_components = mix;
+ return false;
+ }
+
+ // update the number of components
+ m_numOfIC = pca_result.eval.size();
+
+ cvdebug() << "Considering " << m_numOfIC << " independend components\n";
+ cvdebug() << "PCA: eval= " << pca_result.eval << "\n";
+ cvdebug() << "PCA: evec= " << pca_result.evec << "\n";
+
+ evaluate_whiten_matrix(pca_result.evec, pca_result.eval);
+
+ // if only PCA, stop here and save the dewithening as independend components
+ // where is the mixing matrix?
+ if (m_PCAonly) {
+ m_mixing_matrix.reset(mix.rows(), m_dewhitening_matrix.cols(), 1.0);
+ m_independent_components = m_dewhitening_matrix;
+ return true;
+ }
+
+ // run the actual ICA
+
+ auto whitened_signal = m_whitening_matrix * centered.signal;
+
+ bool result = false;
+ Matrix B( whitened_signal.rows(), m_numOfIC, true);
+
+ switch (m_approach) {
+ case CIndepCompAnalysis::appr_defl: result = fpica_defl(whitened_signal, B);break;
+ case CIndepCompAnalysis::appr_symm: result = fpica_symm(whitened_signal, B); break;
+ default:
+ throw std::invalid_argument("FastICA::separate: unknown apporach given");
+
+ }
+
+ // evaluate the results if the ICA
+ m_mixing_matrix = m_dewhitening_matrix * B;
+
+ cvdebug() << "Mixing matrix= " << m_mixing_matrix << "\n";
+
+ multiply_mT_m(m_separating_matrix, B, m_whitening_matrix);
+
+ m_independent_components = m_separating_matrix * mix;
+
+ cvdebug() << "ICs= " << m_independent_components << "\n";
+
+ return result;
+}
+
+bool FastICA::fpica_defl_round(int component, Vector& w, Matrix& B)
+{
+ Vector w_old(w);
+ Vector w_old2(w);
+
+ double mu = m_mu;
+ double delta = m_epsilon + 1.0;
+
+ bool is_finetuning = false;
+ bool converged = false;
+ bool loong = false;
+
+ double stroke = 0.0;
+
+ int iter = 0;
+ int maxiter = m_maxNumIterations;
+
+ while (!converged && iter < maxiter) {
+
+ cvdebug() << "Defl: c=" << component
+ << ", iter= " << iter
+ << ", delta= " << delta
+ << "\n";
+
+ m_nonlinearity->set_mu(mu);
+ m_nonlinearity->apply(w);
+
+ Vector w_save(w);
+ for (int j = 0; j < component; ++j) {
+ const double wdot = B.dot_column(j, w_save);
+ auto wj = B.get_column(j);
+ cblas_daxpy(wj->size, -wdot, wj->data, wj->stride, w->data, w->stride);
+ }
+
+ double norm = sqrt(dot(w, w));
+ if (norm > 0.0)
+ gsl_vector_scale(w, 1.0/norm);
+
+ Vector w_help = w_old;
+ gsl_vector_sub(w_help, w);
+
+ cvdebug() << "w-help=" << w_help << "\n";
+ delta = sqrt(dot(w_help, w_help));
+
+ cvmsg() << "DEFL["<<iter<<"]: delta = " << delta << "\n";
+
+ if (delta < m_epsilon) {
+ if (m_finetune && !is_finetuning) {
+ cvinfo() << "DEFL: start fine tuning\n";
+ is_finetuning = true;
+ maxiter += m_maxFineTune;
+ mu = 0.01 * m_mu;
+ }else{
+ converged = true;
+ }
+ } else if (m_stabilization) {
+ // this checks whether the values just pig-pong
+
+ Vector w_old2_copy = w_old2;
+ gsl_vector_sub(w_old2, w);
+ gsl_vector_add(w_old2_copy, w);
+ double delta2 = sqrt(dot(w_old2, w_old2));
+ double delta3 = sqrt(dot(w_old2_copy, w_old2_copy));
+ cvinfo() << "DEFL: stabelize, mu=" << mu
+ << ", stroke=" << stroke
+ << ", delta2= " << delta2
+ << ", delta3= " << delta3
+ <<"\n";
+ if ( (stroke == 0.0) &&
+ ((delta2 < m_epsilon) || (delta3 < m_epsilon))) {
+ stroke = mu;
+ mu *= 0.5;
+ }else if (stroke != 0.0) {
+ mu = stroke;
+ stroke = 0.0;
+ }else if (! loong && 2*iter > m_maxNumIterations ) {
+ loong = true;
+ mu *= 0.5;
+ }
+ }
+ w_old2 = w_old;
+ w_old = w;
+
+ cvdebug() << "w_old=" << w_old << " norm=" << norm << "\n";
+
+ iter++;
+ }
+
+ return delta < m_epsilon;
+}
+
+bool FastICA::fpica_defl(const Matrix& X, Matrix& B)
+{
+ // not yet supported
+ assert(!m_with_initial_guess);
+
+ std::random_device rd;
+
+ // this deterministic seed ensures that the tests can be
+ // run in a controlled environment
+ std::mt19937 gen((m_deterministic_seed < 0) ? rd() : m_deterministic_seed);
+ std::uniform_real_distribution<> random_source( -0.5, 0.5 );
+
+ Vector w( X.rows(), false);
+
+ m_nonlinearity->set_signal(&X);
+
+ bool global_converged = true;
+
+ for (int i = 0; i < m_numOfIC; ++i) {
+
+ // initalize vector (should also go into extra class
+ for (unsigned i = 0; i < w.size(); ++i)
+ w[i] = random_source(gen);
+
+ bool converged = fpica_defl_round(i, w, B);
+ cvmsg() << "Round(" << i << ")" << (converged ? "converged" : "did not converge") << "\n";
+
+ global_converged &= converged;
+ B.set_column(i, w);
+ }
+
+ return global_converged;
+}
+
+
+static double min_abs_diag(const Matrix& m)
+{
+ unsigned N = m.rows() > m.cols() ? m.rows() : m.cols();
+ double min_val = fabs(m(0,0));
+ for (unsigned i = 1; i < N; ++i) {
+ double v = fabs(m(i,i));
+ if ( min_val > v)
+ min_val = v;
+ }
+ return min_val;
+}
+
+double FastICA::fpica_symm_step(Matrix& B, Matrix& B_old,double mu, Matrix& workspace)
+{
+ m_nonlinearity->set_mu(mu);
+ m_nonlinearity->apply(B);
+ matrix_inv_sqrt(B);
+ multiply_mT_m(workspace, B, B_old);
+ return min_abs_diag(workspace);
+}
+
+bool FastICA::fpica_symm(const Matrix& X, Matrix& B)
+{
+ // not yet supported
+ assert(!m_with_initial_guess);
+
+ std::random_device rd;
+
+ // this deterministic seed ensures that the tests can be
+ // run in a controlled environment
+ std::mt19937 gen((m_deterministic_seed < 0) ? rd() : m_deterministic_seed);
+ std::uniform_real_distribution<> random_source( -0.5, 0.5 );
+
+ Matrix B_old2(B);
+ Matrix B_restart(B);
+
+ // random and orthogonalize
+ for(auto ib = B.begin(); ib != B.end(); ++ib)
+ *ib = random_source(gen);
+
+ matrix_orthogonalize(B);
+ Matrix B_old(B);
+
+ m_nonlinearity->set_signal(&X);
+
+ bool is_fine_tuning = false;
+ double mu = m_mu;
+
+ Matrix BTB(B.cols(), B.rows(), false);
+
+ bool converged = false;
+ int iter = 0;
+ double stroke = 0.0;
+ bool loong = false;
+
+ int maxiter = m_maxNumIterations;
+
+ bool do_saddle_check = m_do_saddle_check;
+ bool finished = !do_saddle_check;
+
+ int saddle_iter = 0;
+
+ do {
+ while (!converged && iter < maxiter) {
+
+ double minAbsCos = fpica_symm_step(B, B_old, mu, BTB);
+
+ cvdebug() << "B= " << B << "\n";
+
+ cvmsg() << "FastICA: "<< iter << ":" << 1.0 - minAbsCos << "\n";
+
+ if ( 1.0 - minAbsCos < m_epsilon) {
+ // run one more time with lower step-width
+ if (m_finetune && !is_fine_tuning) {
+ mu *= 0.01;
+ is_fine_tuning = true;
+ maxiter += m_maxFineTune;
+ } else {
+ converged = true;
+ }
+ } else if (m_stabilization) {
+ multiply_mT_m(BTB, B, B_old2);
+ double minAbsCos2 = min_abs_diag(BTB);
+
+ // Avoid ping-pong
+ if (!stroke && (1 - minAbsCos2 < m_epsilon)) {
+ stroke = mu;
+ mu /= 2.0;
+ } else if (stroke) { // back to normal
+ mu = stroke;
+ stroke = 0;
+ } else if ( !loong && 2 * iter > m_maxNumIterations) {
+ // already running some time and
+ // no convergence, try half step width
+ // once
+ loong = true;
+ mu *= 0.5;
+ }
+ }
+
+ B_old2 = B_old;
+ B_old = B;
+
+ ++iter;
+ }
+ if (do_saddle_check && saddle_iter < m_numOfIC) {
+ ++saddle_iter;
+ do_saddle_check = run_saddlecheck(B, X);
+ if (!do_saddle_check)
+ break;
+ converged = false;
+ iter = 0;
+ } else
+ finished = true;
+
+ } while (!finished);
+
+ return converged;
+}
+
+
+/*
+ This is the saddle check as described in
+
+ Petr Tichavský, Zbynek Koldovský, and Erkki Oja
+ "Performance Analysis of the FastICA Algorithm and Cramér–Rao "
+ "Bounds for Linear Independent Component Analysis"
+ IEEE Tran Signal Processing, 54(4), 2006, 1189-1203
+
+ Returns true if at least one check resulted in an update of the
+ components.
+
+*/
+bool FastICA::run_saddlecheck(Matrix &B, const Matrix& X)
+{
+ cvinfo() << "run_saddlecheck \n";
+ bool result = false;
+ vector<bool> rotated(B.cols(), false);
+ Matrix U(B.cols(), X.cols(), false);
+ multiply_mT_m(U, B, X);
+ auto table = m_nonlinearity->get_saddle_test_table(U);
+
+ for (unsigned i = 0; i < U.rows(); ++i) {
+ for (unsigned j = i+1; j < U.rows() && !rotated[i]; ++j) {
+ if (rotated[j])
+ continue;
+ auto ui = U.get_row(i);
+ auto uj = U.get_row(j);
+ const double isqrt2 = 1.0 / sqrt(2.0);
+ auto ui_new = (ui + uj) * isqrt2;
+ auto uj_new = (ui - uj) * isqrt2;
+
+ auto ui_sir = m_nonlinearity->get_saddle_test_value(ui_new);
+ auto uj_sir = m_nonlinearity->get_saddle_test_value(uj_new);
+
+ if (fmax(ui_sir, uj_sir) > fmax(table[i], table[j])) {
+ result = rotated[i] = rotated[j] = true;
+ auto bi_new = (B.get_row(i) + B.get_row(j)) * isqrt2;
+ auto bj_new = (B.get_row(i) - B.get_row(j)) * isqrt2;
+ B.set_row(i, bi_new);
+ B.set_row(j, bj_new);
+ cvmsg() << "Rotating components " << i << " and " << j << "\n";
+ }
+ }
+ }
+ return result;
+};
+
+void FastICA::set_approach(CIndepCompAnalysis::EApproach apr)
+{
+ m_approach = apr;
+}
+
+void FastICA::set_nr_of_independent_components (int nrIC)
+{
+ m_numOfIC = nrIC;
+}
+
+
+void FastICA::set_nonlinearity (PFastICADeflNonlinearity g)
+{
+ assert(g);
+ m_nonlinearity = g;
+}
+
+
+void FastICA::set_finetune (bool finetune)
+{
+ m_finetune = finetune;
+}
+
+void FastICA::set_mu (double mu)
+{
+ m_mu = mu;
+}
+
+void FastICA::set_epsilon (double epsilon)
+{
+ m_epsilon = epsilon;
+}
+
+void FastICA::set_sample_size (double sampleSize)
+{
+ m_sampleSize = sampleSize;
+}
+
+void FastICA::set_component_energy_limit(double limit)
+{
+ m_component_energy_limit = limit;
+}
+
+void FastICA::set_stabilization (bool stabilization)
+{
+ m_stabilization = stabilization;
+}
+
+void FastICA::set_max_num_iterations (int maxNumIterations)
+{
+ m_maxNumIterations = maxNumIterations;
+}
+
+void FastICA::set_max_fine_tune (int maxFineTune)
+{
+ m_maxFineTune = maxFineTune;
+}
+
+void FastICA::set_pca_only (bool PCAonly)
+{
+ m_PCAonly = PCAonly;
+}
+
+void FastICA::set_init_guess (const Matrix& initGuess)
+{
+ m_initGuess = initGuess;
+}
+
+void FastICA::set_saddle_check(bool saddle_check)
+{
+ m_do_saddle_check = saddle_check;
+}
+
+void FastICA::set_saddle_check_postiterations(int saddle_postiter)
+{
+ m_saddle_postiter = saddle_postiter;
+}
+
+int FastICA::get_nr_of_independent_components () const
+{
+ return m_numOfIC;
+}
+
+const Matrix& FastICA::get_mixing_matrix () const
+{
+ return m_mixing_matrix;
+}
+
+const Matrix& FastICA::get_separating_matrix () const
+{
+ return m_separating_matrix;
+}
+
+const Matrix& FastICA::get_independent_components () const
+{
+ return m_independent_components;
+}
+
+
+const Matrix& FastICA::get_principal_eigenvectors () const
+{
+ return m_principal_eigenvectors;
+}
+
+const Matrix& FastICA::get_whitening_matrix () const
+{
+ return m_whitening_matrix;
+}
+
+const Matrix& FastICA::get_dewhitening_matrix () const
+{
+ return m_dewhitening_matrix;
+}
+
+const Matrix& FastICA::get_white_signal () const
+{
+ return m_white_sig;
+}
+
+struct CICAAnalysisMIAImpl {
+
+ CICAAnalysisMIAImpl(unsigned int rows, unsigned int length);
+ CICAAnalysisMIAImpl(const gsl::Matrix& ic, const gsl::Matrix& mix, const std::vector<double>& mean);
+ void normalize_ICs();
+ void get_mixing_curve(unsigned int c, vector<float>& curve) const;
+ void set_mixing_series(unsigned int index, const std::vector<float>& series);
+ void check_set(const CICAAnalysisMIA::IndexSet& s) const;
+ std::vector<float> normalize_Mix();
+
+ gsl::Matrix m_Signal;
+ gsl::Matrix m_ICs;
+ gsl::Matrix m_Mix;
+ vector<double> m_mean;
+
+ unsigned int m_ncomponents;
+ unsigned int m_nlength;
+ unsigned int m_rows;
+
+ int m_max_iterations;
+ CIndepCompAnalysis::EApproach m_approach;
+};
+
+
+CICAAnalysisMIA::CICAAnalysisMIA(const gsl::Matrix& ic, const gsl::Matrix& mix, const std::vector<double>& mean):
+ impl(new CICAAnalysisMIAImpl(ic, mix, mean)),
+ m_deterministic_seed(-1)
+{
+
+}
+
+CICAAnalysisMIA::CICAAnalysisMIA():impl(nullptr),
+ m_deterministic_seed(-1)
+{
+
+}
+
+
+void CICAAnalysisMIA::initialize(unsigned int series_length, unsigned int slice_size)
+{
+ auto new_impl = new CICAAnalysisMIAImpl(series_length, slice_size);
+ swap(new_impl, impl);
+
+ if (new_impl)
+ delete new_impl;
+}
+
+CICAAnalysisMIA::~CICAAnalysisMIA()
+{
+ delete impl;
+}
+
+void CICAAnalysisMIA::set_row_internal(unsigned row, const std::vector<double>& buffer, double mean)
+{
+ TRACE_FUNCTION;
+ assert(impl);
+ assert(row < static_cast<unsigned>(impl->m_Signal.rows()));
+ assert(buffer.size() == static_cast<unsigned>(impl->m_Signal.cols()));
+
+ gsl::Vector buf(buffer.size(), &buffer[0]);
+
+ impl->m_Signal.set_row(static_cast<signed>(row), buf);
+ impl->m_mean[row] = mean;
+ cvdebug() << "add row " << row << ", mean=" << mean << "\n";
+}
+
+void CICAAnalysisMIA::set_approach(CIndepCompAnalysis::EApproach approach)
+{
+ switch (approach) {
+ case appr_defl: impl->m_approach = CIndepCompAnalysis::appr_defl;
+ break;
+ case appr_symm: impl->m_approach = CIndepCompAnalysis::appr_symm;
+ break;
+ default:
+ throw std::invalid_argument("CICAAnalysisMIA:set_approach: Unknown approach given");
+ }
+
+}
+
+
+void CICAAnalysisMIA::set_deterministic_seed(int seed)
+{
+ TRACE_FUNCTION;
+ m_deterministic_seed = seed;
+};
+
+bool CICAAnalysisMIA::run(unsigned int nica, vector<vector<float> > guess)
+{
+ TRACE_FUNCTION;
+ assert(impl);
+
+
+ FastICA fastICA(nica);
+
+ if (m_deterministic_seed >= 0 ) {
+ fastICA.set_deterministic_seed(m_deterministic_seed);
+ }
+
+ auto nonlin = produce_fastica_nonlinearity("tanh");
+ fastICA.set_nonlinearity (nonlin);
+
+#if ICA_ALWAYS_USE_SYMM
+ // approach APPROACH_DEFL may not return in the unpached itpp
+ // therefore, always use APPROACH_SYMM
+ fastICA.set_approach( appr_symm );
+#else
+ fastICA.set_approach( impl->m_approach );
+#endif
+ if (impl->m_max_iterations > 0)
+ fastICA.set_max_num_iterations(impl->m_max_iterations);
+
+ if (!guess.empty()) {
+ gsl::Matrix mguess(impl->m_Signal.rows(), guess.size(), false);
+ for (unsigned int c = 0; c < guess.size(); ++c)
+ for (unsigned int r = 0; r < guess.size(); ++r)
+ mguess.set(r,c, guess[c][r]);
+ fastICA.set_init_guess(mguess);
+ }
+#ifdef ICA_ALWAYS_USE_SYMM
+ // in the unpatched itpp separate doesn't return a value
+ // therefore, we always assume true
+ bool result = true;
+ fastICA.separate(impl->m_Signal);
+#else
+ bool result = fastICA.separate(impl->m_Signal);
+#endif
+
+ impl->m_ICs = fastICA.get_independent_components();
+ impl->m_Mix = fastICA.get_mixing_matrix();
+
+ impl->m_ncomponents = impl->m_Mix.cols();
+ impl->m_nlength = impl->m_ICs.cols();
+ impl->m_rows = impl->m_Mix.rows();
+ return result;
+}
+
+unsigned int CICAAnalysisMIA::get_ncomponents() const
+{
+ return impl->m_ncomponents;
+}
+
+vector<float> CICAAnalysisMIA::get_feature_row(unsigned int row) const
+{
+ TRACE_FUNCTION;
+ if (row < impl->m_ncomponents) {
+ vector<float> result(impl->m_nlength);
+ for (unsigned int i = 0; i < impl->m_nlength; ++i)
+ result[i] = static_cast<float>(impl->m_ICs(row, i));
+ return result;
+ }
+
+ throw create_exception<invalid_argument>("CICAAnalysisMIA::get_feature_row: requested row ", row, " out of range");
+
+}
+
+std::vector<float> CICAAnalysisMIA::get_mix_series(unsigned int colm)const
+{
+ TRACE_FUNCTION;
+ if (colm < impl->m_ncomponents) {
+ vector<float> result(impl->m_rows);
+ impl->get_mixing_curve(colm, result);
+ return result;
+ }
+ throw create_exception<invalid_argument>("CICAAnalysisMIA::get_mix_series: requested series ", colm, " out of range");
+}
+
+void CICAAnalysisMIA::set_mixing_series(unsigned int index, const std::vector<float>& filtered_series)
+{
+ impl->set_mixing_series(index, filtered_series);
+}
+
+void CICAAnalysisMIAImpl::set_mixing_series(unsigned int index, const std::vector<float>& series)
+{
+ TRACE_FUNCTION;
+ assert(m_rows == series.size());
+ assert(index < m_nlength);
+ for (unsigned int i = 0; i < m_rows; ++i)
+ m_Mix.set(i, index, series[i]);
+
+}
+
+
+CSlopeColumns CICAAnalysisMIA::get_mixing_curves() const
+{
+ TRACE_FUNCTION;
+ CSlopeColumns result(impl->m_ncomponents);
+ for (unsigned int c = 0; c < impl->m_ncomponents; ++c)
+ impl->get_mixing_curve(c, result[c]);
+ return result;
+}
+
+void CICAAnalysisMIAImpl::get_mixing_curve(unsigned int c, vector<float>& curve) const
+{
+ TRACE_FUNCTION;
+ curve.resize(m_rows);
+ for (unsigned int i = 0; i < m_rows; ++i)
+ curve[i] = static_cast<float>(m_Mix(i, c));
+}
+
+std::vector<float> CICAAnalysisMIA::get_mix(unsigned int idx)const
+{
+ TRACE_FUNCTION;
+ if (idx < impl->m_rows) {
+ vector<float> result(impl->m_nlength, static_cast<float>(impl->m_mean[idx]));
+ for (unsigned int i = 0; i < impl->m_nlength; ++i) {
+ for (unsigned int c = 0; c < impl->m_ncomponents; ++c) {
+ result[i] += impl->m_ICs(c, i) * impl->m_Mix(idx, c);
+ }
+ }
+ return result;
+ }
+
+ throw create_exception<invalid_argument>("CICAAnalysisMIA::get_mix: requested idx ", idx, " out of range: ", impl->m_rows);
+}
+
+std::vector<float> CICAAnalysisMIA::get_delta_feature(const IndexSet& plus, const IndexSet& minus)const
+{
+ TRACE_FUNCTION;
+
+ vector<float> result(impl->m_nlength, 0.0f);
+ impl->check_set(plus);
+ impl->check_set(minus);
+
+ for (unsigned int i = 0; i < impl->m_nlength; ++i) {
+ for (IndexSet::const_iterator c = plus.begin(); c != plus.end(); ++c)
+ result[i] += impl->m_ICs(*c, i);
+
+ for (IndexSet::const_iterator c = minus.begin(); c != minus.end(); ++c)
+ result[i] -= impl->m_ICs(*c, i);
+
+ }
+ return result;
+}
+
+std::vector<float> CICAAnalysisMIA::get_partial_mix(unsigned int idx, const IndexSet& cps)const
+{
+ TRACE_FUNCTION;
+ if (idx >= impl->m_rows) {
+ throw create_exception<invalid_argument>("CICAAnalysisMIA::get_mix: requested idx ", idx,
+ " out of range: ", impl->m_rows);
+
+ } else {
+ impl->check_set(cps);
+ vector<float> result(impl->m_nlength, static_cast<float>(impl->m_mean[idx]));
+ for (unsigned int i = 0; i < impl->m_nlength; ++i) {
+ for (auto c = cps.begin(); c != cps.end(); ++c) {
+ cvdebug() << " idx = " << idx << ", i = " << i << ", c=" << *c<< std::endl;
+ result[i] += impl->m_ICs(*c, i) * impl->m_Mix(idx, *c);
+ }
+ }
+ return result;
+ }
+}
+
+std::vector<float> CICAAnalysisMIA::get_incomplete_mix(unsigned int idx, const std::set<unsigned int>& skip)const
+{
+ TRACE_FUNCTION;
+ if (idx < impl->m_rows) {
+ IndexSet use_set;
+ for (unsigned int c = 0; c < impl->m_ncomponents; ++c)
+ if (skip.find(c) == skip.end())
+ use_set.insert(c);
+
+ return get_partial_mix(idx, use_set);
+ }
+
+ throw create_exception<invalid_argument>("CICAAnalysisMIA::get_mix: requested idx ", idx,
+ " out of range: ", impl->m_rows);
+}
+
+std::vector<float> CICAAnalysisMIA::normalize_Mix()
+{
+ return impl->normalize_Mix();
+}
+
+CICAAnalysisMIAImpl::CICAAnalysisMIAImpl(unsigned int rows, unsigned int length):
+ m_Signal(rows, length, false),
+ m_mean(rows),
+ m_ncomponents(0),
+ m_nlength(0),
+ m_rows(0),
+ m_max_iterations(0),
+ m_approach(CIndepCompAnalysis::appr_defl)
+{
+ cvdebug() << "Analyis of signal with " << rows << " data rows of " << length << " entries\n";
+}
+
+CICAAnalysisMIAImpl::CICAAnalysisMIAImpl(const gsl::Matrix& ic, const gsl::Matrix& mix, const std::vector<double>& mean):
+ // Coverty may complain here, but the order is correct
+ // the signal is a matrix of the number of columns of the mixing matrix = time points
+ // by rows of the independent components - each row constitutes th epixel ogf a feature image
+ // coverity[swapped_arguments]
+ m_Signal(mix.cols(), ic.rows(), false),
+ m_ICs(ic),
+ m_Mix(mix),
+ m_mean(mean),
+ m_ncomponents(ic.rows()),
+ m_nlength(ic.cols()),
+ m_rows(mix.rows()),
+ m_max_iterations(0),
+ m_approach(CIndepCompAnalysis::appr_defl)
+{
+ TRACE_FUNCTION;
+}
+
+void CICAAnalysisMIA::normalize_ICs()
+{
+ TRACE_FUNCTION;
+ impl->normalize_ICs();
+}
+
+void CICAAnalysisMIAImpl::check_set(const CICAAnalysisMIA::IndexSet& s) const
+{
+ for (CICAAnalysisMIA::IndexSet::const_iterator is = s.begin();
+ is != s.end(); ++is) {
+ if (*is >= m_ncomponents) {
+ throw create_exception<invalid_argument>("CICAAnalysisMIA: request component index ", *is ,
+ " but only up to index ", m_ncomponents - 1,
+ " available\n");
+ }
+ }
+}
+
+void CICAAnalysisMIAImpl::normalize_ICs()
+{
+ if (m_nlength < 2)
+ throw invalid_argument("ICAAnalysis: input should have at least two pixels");
+
+ // scale all ICs to have a variance of 1.0
+ for (unsigned int c = 0; c < m_ncomponents; ++c) {
+ // evaluate range of IC
+ double v = m_ICs(c, 0);
+
+ double sum = v;
+ double sum2 = v * v;
+ for (unsigned int k = 1; k < m_nlength; ++k) {
+ const double v = m_ICs(c, k);
+ sum += v;
+ sum2 += v * v;
+ }
+ const double ic_shift = sum / m_nlength;
+ const double sigma = sqrt((sum2 - m_nlength * ic_shift * ic_shift) / (m_nlength - 1));
+
+ // we want to start all slopes with the negative value
+ // makes only truely sense, if the allover mean was stripped
+ float invert = 1.0;
+ if (m_Mix(0, c) > 0) {
+ cvdebug() << "Component " << c << " invert sign\n";
+ invert = -1.0;
+ }
+
+ if (sigma > 0) {
+ const double ic_factor = invert * 2.0 / sigma;
+ const double mix_factor = 1.0 / ic_factor;
+
+ for (unsigned int k = 0; k < m_nlength; ++k)
+ m_ICs.set(c, k, (m_ICs(c, k) - ic_shift) * ic_factor);
+
+ for (unsigned int r = 0; r < m_rows; ++r) {
+ m_mean[r] += m_Mix(r, c) * ic_shift;
+ m_Mix.set(r, c, m_Mix(r, c) * mix_factor);
+ }
+ }
+ }
+
+
+}
+
+std::vector<float> CICAAnalysisMIAImpl::normalize_Mix()
+{
+ std::vector<float> result(m_nlength,0.0f);
+
+ for (unsigned int c = 0; c < m_ncomponents; ++c) {
+ float mean = 0.0f;
+ for (unsigned int r = 0; r < m_rows; ++r)
+ mean += m_Mix(r, c);
+ mean /= m_rows;
+ for (unsigned int r = 0; r < m_rows; ++r)
+ m_Mix.set(r, c, m_Mix(r,c) - mean);
+
+ for (unsigned int k = 0; k < m_nlength; ++k)
+ result[k] += mean * m_ICs(c, k);
+ }
+ for (unsigned int c = 0; c < m_ncomponents; ++c) {
+ // invert sign so that all mixing curves start with a value < 0
+ if (m_Mix(0, c) > 0) {
+ for (unsigned int r = 0; r < m_rows; ++r)
+ m_Mix.set(r, c, -m_Mix(r, c));
+ for (unsigned int k = 0; k < m_nlength; ++k)
+ m_ICs.set(c, k, -m_ICs(c, k));
+ }
+ }
+
+ return result;
+}
+
+
+void CICAAnalysisMIA::set_max_iterations(int n)
+{
+ impl->m_max_iterations = n;
+}
+
+CIndepCompAnalysis *CICAAnalysisMIAFactory::do_create() const
+{
+ return new CICAAnalysisMIA;
+}
+
+CICAAnalysisMIAFactoryPlugin::CICAAnalysisMIAFactoryPlugin():
+ CIndepCompAnalysisFactoryPlugin("internal")
+{
+}
+
+CIndepCompAnalysisFactory *CICAAnalysisMIAFactoryPlugin::do_create() const
+{
+ return new CICAAnalysisMIAFactory;
+}
+
+const std::string CICAAnalysisMIAFactoryPlugin::do_get_descr()const
+{
+ return "This is the MIA implementation of the FastICA algorithm.";
+}
+
+extern "C" EXPORT CPluginBase *get_plugin_interface()
+{
+ return new CICAAnalysisMIAFactoryPlugin;
+}
+
+
+NS_END
diff --git a/mia/core/fastica.hh b/mia/core/fastica/fastica.hh
similarity index 52%
rename from mia/core/fastica.hh
rename to mia/core/fastica/fastica.hh
index bccf0bc..890313d 100644
--- a/mia/core/fastica.hh
+++ b/mia/core/fastica/fastica.hh
@@ -1,7 +1,7 @@
/* -*- mia-c++ -*-
*
* This file is part of MIA - a toolbox for medical image analysis
- * Copyright (c) Leipzig, Madrid 1999-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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 <memory>
#include <mia/core/gsl_matrix.hh>
#include <mia/core/fastica_nonlinearity.hh>
+#include <mia/core/ica.hh>
namespace mia {
@@ -44,15 +45,6 @@ class EXPORT_CORE FastICA {
public:
/**
- Separation approach to be used.
- */
- enum EApproach {
- appr_defl, /**< Deflation approach - each component is extimated separately */
- appr_symm /**< Symmetric approach thet estimates all components at the same time */
- };
-
-
- /**
Construct the FastICA algorithms with the number of expected components.
\param num_ic will seperate in at most this number of components
*/
@@ -69,7 +61,7 @@ public:
Set the separation approach to be used.
\param apr appr_delf|appr_symm
*/
- void set_approach(EApproach apr);
+ void set_approach(CIndepCompAnalysis::EApproach apr);
/**
Set the limit of the energy sum used to estimate the number of
@@ -147,7 +139,10 @@ public:
/// \returns number of estimated independedn components
int get_nr_of_independent_components () const;
-
+
+ /// use this to make sure that for tests always the same
+ /// random series is used
+ void set_deterministic_seed(int seed);
const gsl::Matrix& get_mixing_matrix () const;
@@ -168,13 +163,13 @@ public:
private:
// evaluate the whitening and de-whitening matrices
void evaluate_whiten_matrix(const gsl::Matrix& evec, const gsl::Vector& eval);
- bool fpica_defl_round(int component, gsl::Vector& w, gsl::Matrix& B);
+ bool fpica_defl_round(int component, gsl::Vector& w, gsl::Matrix& B);
bool fpica_defl(const gsl::Matrix& X, gsl::Matrix& B);
double fpica_symm_step(gsl::Matrix& B, gsl::Matrix& B_old, double mu, gsl::Matrix& Workspace);
bool fpica_symm(const gsl::Matrix& X, gsl::Matrix& B);
bool run_saddlecheck(gsl::Matrix &B, const gsl::Matrix& X);
- EApproach m_approach;
+ CIndepCompAnalysis::EApproach m_approach;
int m_numOfIC;
@@ -219,13 +214,147 @@ private:
gsl::Matrix m_whitening_matrix;
gsl::Matrix m_dewhitening_matrix;
+
+ gsl::Matrix m_principal_eigenvectors;
+
+ gsl::Matrix m_white_sig;
- gsl::Matrix m_principal_eigenvectors;
+ int m_deterministic_seed;
+};
- gsl::Matrix m_white_sig;
+class EXPORT_CORE CICAAnalysisMIA : public CIndepCompAnalysis {
+public:
+ typedef CIndepCompAnalysis::IndexSet IndexSet;
+
+
+ /**
+ Initialize an ICA based of predefined data - this is only used for test cases.
+ */
+ CICAAnalysisMIA(const gsl::Matrix& ic, const gsl::Matrix& mix, const std::vector<double>& mean );
+
+
+ CICAAnalysisMIA();
+
+
+ ~CICAAnalysisMIA();
+
+ /**
+ Initialize the ICA
+ \param series_length number of data sets that will be provided
+ \param slice_size number of elements each set containes
+ */
+
+ void initialize(unsigned int series_length, unsigned int slice_size) override;
+
+
+ /**
+ Run the independed component analysis using the given numbers of components
+ \param nica number of indentepended components
+ \param guess initial guess for the ICA, pass an empty vector of you
+ don't want to use this feature
+ */
+ bool run(unsigned int nica, std::vector<std::vector<float> > guess) override;
+
+
+ /// \returns the feature vector of \a row
+ std::vector<float> get_feature_row(unsigned int row) const override;
+
+ /// \returns the mixing signal curve of the feature \a row
+ std::vector<float> get_mix_series(unsigned int row) const override;
+
+ /// \returns the complete mixed signal at series index \a idx
+ std::vector<float> get_mix(unsigned int idx) const override;
+
+ /** Evaluate an incomplete mixed signal. Here the features are given that are \a not to be used.
+ \sa get_partial_mix
+ \param idx series index
+ \param skip a set of feature indices that will be skipped when evaluating the mix
+ \returns the mixed signal
+ */
+ std::vector<float> get_incomplete_mix(unsigned int idx, const IndexSet& skip)const override;
+
+ /** Evaluate an incomplete mixed signal. Here the features are given that are \a used to create the mix.
+ \sa get_incomplete_mix
+ \param idx series index
+ \param use the set of feature indices that will be used to evaluate the mix
+ \returns an incolmplete mixed signal.
+ */
+ std::vector<float> get_partial_mix(unsigned int idx, const IndexSet& use)const override;
+ /** Evaluate a mix of the feature signals by adding and subtractig individual features.
+ \param plus features o be added
+ \param minus features to be subtracted
+ \returns the feature mix
+ */
+ std::vector<float> get_delta_feature(const IndexSet& plus, const IndexSet& minus)const override;
+
+ /**
+ Replace a mixing signal curve
+ \param index of the curve to be replaced
+ \param series new data for mixing curve
+ */
+ void set_mixing_series(unsigned int index, const std::vector<float>& series) override;
+
+ /// \returns a vector containing all mixing curves
+ CSlopeColumns get_mixing_curves() const override;
+
+ /**
+ Normalize the ICs in the following manner:
+ * Scale and shift the range of the ICs to [-1, 1]
+ * Scale the mixing curved to compensate for the required scaling
+ * move the means of the time points to compensate for the shifting.
+ */
+ void normalize_ICs() override;
+
+ /**
+ Normalize the mixing curves to have a zero mean. As a result a mean image is created that
+ containes the sum of the ICs weighted by the required mean shift.
+
+ */
+ std::vector<float> normalize_Mix() override;
+
+
+ /// \returns the number of actual ICs
+ unsigned int get_ncomponents() const override;
+
+ /**
+ sets the number of iterations in the ICA
+ \param n
+ */
+ void set_max_iterations(int n) override;
+
+ /**
+ Set the ICA approach to either FICA_APPROACH_DEFL(default) or FICA_APPROACH_SYMM.
+ \param approach
+ */
+ void set_approach(EApproach approach) override;
+
+ void set_deterministic_seed(int seed) override;
+private:
+ void set_row_internal(unsigned row, const std::vector<double>& buffer, double mean) override;
+
+ struct CICAAnalysisMIAImpl *impl;
+
+ int m_deterministic_seed;
};
+
+class EXPORT_CORE CICAAnalysisMIAFactory: public CIndepCompAnalysisFactory {
+public:
+ CIndepCompAnalysis *do_create() const override;
+};
+
+
+class EXPORT_CORE CICAAnalysisMIAFactoryPlugin: public CIndepCompAnalysisFactoryPlugin {
+public:
+ CICAAnalysisMIAFactoryPlugin();
+
+ CIndepCompAnalysisFactory *do_create() const override;
+
+ const std::string do_get_descr()const override;
+};
+
+
}
#endif
diff --git a/mia/core/fastica/test_deflationnonlinearity.cc b/mia/core/fastica/test_deflationnonlinearity.cc
index 944d285..57f9577 100644
--- a/mia/core/fastica/test_deflationnonlinearity.cc
+++ b/mia/core/fastica/test_deflationnonlinearity.cc
@@ -1,7 +1,7 @@
/* -*- mia-c++ -*-
*
* This file is part of MIA - a toolbox for medical image analysis
- * Copyright (c) Leipzig, Madrid 1999-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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/fastica/test_fastica.cc
similarity index 57%
rename from mia/core/test_ica.cc
rename to mia/core/fastica/test_fastica.cc
index ab1bd1e..feb7dfa 100644
--- a/mia/core/test_ica.cc
+++ b/mia/core/fastica/test_fastica.cc
@@ -1,7 +1,7 @@
/* -*- mia-c++ -*-
*
* This file is part of MIA - a toolbox for medical image analysis
- * Copyright (c) Leipzig, Madrid 1999-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,48 +18,194 @@
*
*/
-#include <mia/internal/autotest.hh>
+#include <cmath>
-#include <stdexcept>
-#include <cmath>
-#include <iomanip>
+#include <mia/internal/autotest.hh>
+#include <mia/core/fastica/fastica.hh>
-#include <mia/core/ica.hh>
+#include <mia/core/gsl_matrix_vector_ops.hh>
+#include <gsl/gsl_blas.h>
-using namespace std;
+using gsl::Matrix;
using namespace mia;
+using std::vector;
+using std::invalid_argument;
-template <typename T>
-ostream& operator << (ostream& os, const vector<T>& v)
+BOOST_AUTO_TEST_CASE ( test_fastica_symm )
{
- os << "[";
- for(typename vector<T>::const_iterator i = v.begin(); i != v.end(); ++i)
- os << setw(9)<<*i << ",";
- os << "]";
- return os;
+ // create the components and the mixing matrix
+
+ const double c[] = {1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1};
+
+ Matrix in_ics(3, 13, c);
+ const int steps = 101;
+
+ Matrix in_mixing_matrix(steps, 3, false);
+
+ auto c0 = in_mixing_matrix.get_column(0);
+ auto c1 = in_mixing_matrix.get_column(1);
+ auto c2 = in_mixing_matrix.get_column(2);
+
+ // sin(x) ; cos(x); sin(2x)
+ for ( int i = 0; i < steps; ++i) {
+ cvdebug() << "init row " << i << "\n";
+ double x = (M_PI * (i - (steps- 1)/2)) / steps;
+ c0[i] = sin(x);
+ c1[i] = cos(x);
+ c2[i] = sin(2 * x);
+ }
+
+ Matrix mix = in_mixing_matrix * in_ics;
+
+
+ FastICA ica(3);
+
+ ica.set_approach(CIndepCompAnalysis::appr_symm);
+ ica.set_epsilon (1e-8);
+ ica.set_finetune(true);
+ ica.set_nonlinearity(produce_fastica_nonlinearity("pow3"));
+ BOOST_CHECK(ica.separate(mix));
+
+
+ const gsl::Matrix& out_mixing_matrix = ica.get_mixing_matrix();
+ const gsl::Matrix& out_ics = ica.get_independent_components();
+
+ // the mixes should be close to orthogonal
+
+ for (unsigned int c = 1; c < out_mixing_matrix.cols(); ++c) {
+ auto col_a = out_mixing_matrix.get_column(c);
+ double na = 0.0;
+ gsl_blas_ddot(col_a, col_a, &na);
+ for (unsigned int c1 = 0; c1 < c; ++c1) {
+ auto col_b = out_mixing_matrix.get_column(c1);
+ auto dot = 1.0;
+ double nb = 0.0;
+ gsl_blas_ddot(col_b, col_b, &nb);
+ gsl_blas_ddot(col_a, col_b, & dot);
+ BOOST_CHECK_SMALL(dot, 0.1 * na * nb);
+ }
+ }
+
+
+ BOOST_CHECK_EQUAL(out_mixing_matrix.rows(), in_mixing_matrix.rows());
+ BOOST_CHECK_EQUAL(out_mixing_matrix.cols(), in_mixing_matrix.cols());
+ BOOST_CHECK_EQUAL(out_ics.rows(), in_ics.rows());
+ BOOST_CHECK_EQUAL(out_ics.cols(), in_ics.cols());
+
+ // create the remix and test it against the input mix
+
+
+ Matrix remix = out_mixing_matrix * out_ics;
+ Matrix delta = remix - mix;
+
+ for(auto id = delta.begin(); id != delta.end(); ++id) {
+ BOOST_CHECK_SMALL(*id, 1e-10);
+ }
+
}
-BOOST_AUTO_TEST_CASE( test_mixing_ica_without_mean )
+
+
+BOOST_AUTO_TEST_CASE ( test_fastica_defl )
{
- const int rows = 5;
- const int elms = 10;
- const int nica = 3;
+ // create the components and the mixing matrix
- const double init_mix[nica * rows] = {
+ const double c[] = {1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1};
+
+ Matrix in_ics(3, 13, c);
+ const int steps = 101;
+
+ Matrix in_mixing_matrix(steps, 3, false);
+
+ auto c0 = in_mixing_matrix.get_column(0);
+ auto c1 = in_mixing_matrix.get_column(1);
+ auto c2 = in_mixing_matrix.get_column(2);
+
+ // sin(x) ; cos(x); sin(2x)
+ for ( int i = 0; i < steps; ++i) {
+ cvdebug() << "init row " << i << "\n";
+ double x = (M_PI * (i - (steps- 1)/2)) / steps;
+ c0[i] = sin(x);
+ c1[i] = cos(x);
+ c2[i] = sin(2 * x);
+ }
+
+ Matrix mix = in_mixing_matrix * in_ics;
+
+
+ FastICA ica(3);
+
+ ica.set_approach(CIndepCompAnalysis::appr_defl);
+ ica.set_epsilon (1e-10);
+ ica.set_finetune(true);
+ ica.set_stabilization(true);
+ ica.set_nonlinearity(produce_fastica_nonlinearity("pow3"));
+ BOOST_CHECK(ica.separate(mix));
+
+
+ const gsl::Matrix& out_mixing_matrix = ica.get_mixing_matrix();
+ const gsl::Matrix& out_ics = ica.get_independent_components();
+
+ // the mixes should be close to orthogonal
+
+ for (unsigned int c = 1; c < out_mixing_matrix.cols(); ++c) {
+ auto col_a = out_mixing_matrix.get_column(c);
+ double na = 0.0;
+ gsl_blas_ddot(col_a, col_a, &na);
+ for (unsigned int c1 = 0; c1 < c; ++c1) {
+ auto col_b = out_mixing_matrix.get_column(c1);
+ auto dot = 1.0;
+ double nb = 0.0;
+ gsl_blas_ddot(col_b, col_b, &nb);
+ gsl_blas_ddot(col_a, col_b, & dot);
+ BOOST_CHECK_SMALL(dot, 0.1 * na * nb);
+ }
+ }
+
+
+ BOOST_CHECK_EQUAL(out_mixing_matrix.rows(), in_mixing_matrix.rows());
+ BOOST_CHECK_EQUAL(out_mixing_matrix.cols(), in_mixing_matrix.cols());
+
+
+ BOOST_CHECK_EQUAL(out_ics.rows(), in_ics.rows());
+ BOOST_CHECK_EQUAL(out_ics.cols(), in_ics.cols());
+
+ Matrix remix = out_mixing_matrix * out_ics;
+ Matrix delta = remix - mix;
+
+ for(auto id = delta.begin(); id != delta.end(); ++id) {
+ BOOST_CHECK_SMALL(*id, 1e-10);
+ }
+
+}
+
+//
+
+BOOST_AUTO_TEST_CASE( test_mia_mixing_ica_without_mean )
+{
+ const unsigned time_steps = 5;
+ const unsigned elms = 10;
+ const unsigned nica = 3;
+
+ const double init_mix[nica * time_steps] = {
1, 2, 3, 4, 5,
1, 3, 5, 3, 1,
1, 1, 1, 1, 1
};
- const double init_ic[rows * elms] = {
+ const double init_ic[nica * elms] = {
1, 1, 1, 0, 0, 0, 0, 0, 0, 1,
0, 0, 0, 1, 2,-1, 0, 0, 0, 0,
0, 0, 1, 0, 0, 1, 4, 3, 2, 0
};
- double test_rows[rows][elms] = {
+ double test_rows[time_steps][elms] = {
{ 1, 1, 2, 1, 2, 0, 4, 3, 2, 1 } ,
{ 2, 2, 3, 3, 6, -2, 4, 3, 2, 2 } ,
{ 3, 3, 4, 5,10, -4, 4, 3, 2, 3 } ,
@@ -68,15 +214,16 @@ BOOST_AUTO_TEST_CASE( test_mixing_ica_without_mean )
};
- itpp::mat mix(init_mix, rows, nica, false);
- itpp::mat ic(init_ic, rows, elms, true);
- vector<double> mean(rows, 0.0);
+ gsl::Matrix mix(nica, time_steps, init_mix);
+ gsl::Matrix ic(nica, elms, init_ic);
+ vector<double> mean(time_steps, 0.0);
- CICAAnalysisITPP ica(ic, mix, mean);
+ CICAAnalysisMIA ica(ic, mix.transposed(), mean);
- for (int i = 0; i < rows; ++i) {
+ for (unsigned i = 0; i < time_steps; ++i) {
vector<float> mixed = ica.get_mix(i);
- for (int k = 0; k < elms; ++k) {
+ BOOST_CHECK_EQUAL(mixed.size(), elms);
+ for (unsigned k = 0; k < elms; ++k) {
if (mixed[k] != test_rows[i][k])
cverr() << i << ", " << k << " expect " << test_rows[i][k]
<< " get " << mixed[k] << "\n";
@@ -86,7 +233,7 @@ BOOST_AUTO_TEST_CASE( test_mixing_ica_without_mean )
}
-BOOST_AUTO_TEST_CASE( test_mixing_ica_with_skip )
+BOOST_AUTO_TEST_CASE( test_mia_mixing_ica_with_skip )
{
const int rows = 5;
const int elms = 10;
@@ -105,7 +252,7 @@ BOOST_AUTO_TEST_CASE( test_mixing_ica_with_skip )
0, 0, 1, 0, 0, 1, 4, 3, 2, 0
};
- double test_rows[rows][elms] = {
+ double test_miarows[rows][elms] = {
{ 0, 0, 1, 1, 2, 0, 4, 3, 2, 0 } ,
{ 0, 0, 1, 3, 6, -2, 4, 3, 2, 0 } ,
{ 0, 0, 1, 5,10, -4, 4, 3, 2, 0 } ,
@@ -114,26 +261,26 @@ BOOST_AUTO_TEST_CASE( test_mixing_ica_with_skip )
};
- itpp::mat mix(init_mix, rows, nica, false);
- itpp::mat ic(init_ic, rows, elms, true);
+ gsl::Matrix mix(nica, rows, init_mix);
+ gsl::Matrix ic(nica, elms, init_ic);
vector<double> mean(rows, 0.0);
- CICAAnalysisITPP ica(ic, mix, mean);
- CICAAnalysis::IndexSet skip;
+ CICAAnalysisMIA ica(ic, mix.transposed(), mean);
+ CIndepCompAnalysis::IndexSet skip;
skip.insert(skipnr);
for (int i = 0; i < rows; ++i) {
vector<float> mixed = ica.get_incomplete_mix(i, skip);
for (int k = 0; k < elms; ++k) {
- if (mixed[k] != test_rows[i][k])
- cverr() << i << ", " << k << " expect " << test_rows[i][k]
+ if (mixed[k] != test_miarows[i][k])
+ cverr() << i << ", " << k << " expect " << test_miarows[i][k]
<< " get " << mixed[k] << "\n";
- BOOST_CHECK_CLOSE(mixed[k], test_rows[i][k], 0.001);
+ BOOST_CHECK_CLOSE(mixed[k], test_miarows[i][k], 0.001);
}
}
}
-BOOST_AUTO_TEST_CASE( test_partial_ica_mix )
+BOOST_AUTO_TEST_CASE( test_miapartial_ica_mix )
{
const int rows = 5;
const int elms = 10;
@@ -151,7 +298,7 @@ BOOST_AUTO_TEST_CASE( test_partial_ica_mix )
0, 0, 1, 0, 0, 1, 4, 3, 2, 0
};
- double test_rows[rows][elms] = {
+ double test_miarows[rows][elms] = {
{ 0, 0, 1, 1, 2, 0, 4, 3, 2, 0 } ,
{ 0, 0, 1, 3, 6, -2, 4, 3, 2, 0 } ,
{ 0, 0, 1, 5,10, -4, 4, 3, 2, 0 } ,
@@ -160,27 +307,27 @@ BOOST_AUTO_TEST_CASE( test_partial_ica_mix )
};
- itpp::mat mix(init_mix, rows, nica, false);
- itpp::mat ic(init_ic, rows, elms, true);
+ gsl::Matrix mix(nica, rows, init_mix);
+ gsl::Matrix ic(nica, elms, init_ic);
vector<double> mean(rows, 0.0);
- CICAAnalysisITPP ica(ic, mix, mean);
- CICAAnalysis::IndexSet components;
+ CICAAnalysisMIA ica(ic, mix.transposed(), mean);
+ CIndepCompAnalysis::IndexSet components;
components.insert(1);
components.insert(2);
for (int i = 0; i < rows; ++i) {
vector<float> mixed = ica.get_partial_mix(i, components);
for (int k = 0; k < elms; ++k) {
- if (mixed[k] != test_rows[i][k])
- cverr() << i << ", " << k << " expect " << test_rows[i][k]
+ if (mixed[k] != test_miarows[i][k])
+ cverr() << i << ", " << k << " expect " << test_miarows[i][k]
<< " get " << mixed[k] << "\n";
- BOOST_CHECK_CLOSE(mixed[k], test_rows[i][k], 0.001);
+ BOOST_CHECK_CLOSE(mixed[k], test_miarows[i][k], 0.001);
}
}
}
-BOOST_AUTO_TEST_CASE( test_delta_ica_mix )
+BOOST_AUTO_TEST_CASE( test_miadelta_ica_mix )
{
const int rows = 5;
const int elms = 10;
@@ -198,34 +345,34 @@ BOOST_AUTO_TEST_CASE( test_delta_ica_mix )
0, 0, 1, 0, 0, 1, 4, 3, 2, 0
};
- double test_rows[elms] = {
+ double test_miarows[elms] = {
-1, -1, 0, 1, 2, 0, 4, 3, 2, -1 ,
};
- itpp::mat mix(init_mix, rows, nica, false);
- itpp::mat ic(init_ic, rows, elms, true);
+ gsl::Matrix mix(nica, rows, init_mix);
+ gsl::Matrix ic(nica, elms, init_ic);
vector<double> mean(rows, 0.0);
- CICAAnalysisITPP ica(ic, mix, mean);
- CICAAnalysis::IndexSet plus_components;
+ CICAAnalysisMIA ica(ic, mix.transposed(), mean);
+ CIndepCompAnalysis::IndexSet plus_components;
plus_components.insert(1);
plus_components.insert(2);
- CICAAnalysis::IndexSet minus_components;
+ CIndepCompAnalysis::IndexSet minus_components;
minus_components.insert(0);
vector<float> mixed = ica.get_delta_feature(plus_components, minus_components);
for (int k = 0; k < elms; ++k) {
- if (mixed[k] != test_rows[k])
- cverr() << k << " expect " << test_rows[k]
+ if (mixed[k] != test_miarows[k])
+ cverr() << k << " expect " << test_miarows[k]
<< " get " << mixed[k] << "\n";
- BOOST_CHECK_CLOSE(mixed[k], test_rows[k], 0.001);
+ BOOST_CHECK_CLOSE(mixed[k], test_miarows[k], 0.001);
}
}
-BOOST_AUTO_TEST_CASE( test_ica_with_zero_mean )
+BOOST_AUTO_TEST_CASE( test_miaica_with_zero_mean )
{
const int rows = 5;
const int elms = 10;
@@ -237,7 +384,7 @@ BOOST_AUTO_TEST_CASE( test_ica_with_zero_mean )
{ 5, -5, -6, -1, 2, -2, 6, -3, -1, 5 }
};
- CICAAnalysisITPP ica;
+ CICAAnalysisMIA ica;
ica.initialize(rows, elms);
for (int i = 0; i < rows; ++i)
@@ -246,6 +393,8 @@ BOOST_AUTO_TEST_CASE( test_ica_with_zero_mean )
ica.run(3, vector<vector<float> >());
+ BOOST_CHECK_EQUAL(ica.get_ncomponents(), 3u);
+
for (int i = 0; i < rows; ++i) {
vector<float> mixed = ica.get_mix(i);
for (int k = 0; k < elms; ++k) {
@@ -256,7 +405,7 @@ BOOST_AUTO_TEST_CASE( test_ica_with_zero_mean )
}
-BOOST_AUTO_TEST_CASE( test_ica_with_some_mean )
+BOOST_AUTO_TEST_CASE( test_miaica_with_some_mean )
{
const int rows = 5;
const int elms = 10;
@@ -268,7 +417,7 @@ BOOST_AUTO_TEST_CASE( test_ica_with_some_mean )
{ 1, -9, -10, -5, -2, -6, 2, -7, -5, 1 }
};
- CICAAnalysisITPP ica;
+ CICAAnalysisMIA ica;
ica.initialize(rows, elms);
for (int i = 0; i < rows; ++i)
ica.set_row(i, data_rows[i], data_rows[i] + elms);
@@ -281,7 +430,7 @@ BOOST_AUTO_TEST_CASE( test_ica_with_some_mean )
}
}
-BOOST_AUTO_TEST_CASE( test_ica_with_some_mean_unknown )
+BOOST_AUTO_TEST_CASE( test_miaica_with_some_mean_unknown )
{
const int rows = 5;
const int elms = 10;
@@ -293,7 +442,7 @@ BOOST_AUTO_TEST_CASE( test_ica_with_some_mean_unknown )
{ 1, -9, -10, -5, -2, -6, 2, -7, -5, 1 }
};
- CICAAnalysisITPP ica;
+ CICAAnalysisMIA ica;
ica.initialize(rows, elms);
for (int i = 0; i < rows; ++i)
@@ -311,7 +460,7 @@ BOOST_AUTO_TEST_CASE( test_ica_with_some_mean_unknown )
}
}
-BOOST_AUTO_TEST_CASE( test_ica_with_some_mean_unknown_SYMM )
+BOOST_AUTO_TEST_CASE( test_miaica_with_some_mean_unknown_SYMM )
{
const int rows = 5;
const int elms = 10;
@@ -323,10 +472,11 @@ BOOST_AUTO_TEST_CASE( test_ica_with_some_mean_unknown_SYMM )
{ 1, -9, -10, -5, -2, -6, 2, -7, -5, 1 }
};
- CICAAnalysisITPP ica;
+ CICAAnalysisMIA ica;
ica.initialize(rows, elms);
- ica.set_approach(CICAAnalysis::appr_symm);
-
+ ica.set_approach(CIndepCompAnalysis::appr_symm);
+ ica.set_deterministic_seed(1);
+
for (int i = 0; i < rows; ++i)
ica.set_row(i, data_rows[i], data_rows[i] + elms);
@@ -344,7 +494,7 @@ BOOST_AUTO_TEST_CASE( test_ica_with_some_mean_unknown_SYMM )
-BOOST_AUTO_TEST_CASE( test_ica_with_some_mean_unknown_normalized_mix )
+BOOST_AUTO_TEST_CASE( test_miaica_with_some_mean_unknown_normalized_mix )
{
const int rows = 5;
const int elms = 10;
@@ -356,7 +506,7 @@ BOOST_AUTO_TEST_CASE( test_ica_with_some_mean_unknown_normalized_mix )
{ 1, -9, -10, -5, -2, -6, 2, -7, -5, 1 }
};
- CICAAnalysisITPP ica;
+ CICAAnalysisMIA ica;
ica.initialize(rows, elms);
for (int i = 0; i < rows; ++i)
@@ -375,7 +525,7 @@ BOOST_AUTO_TEST_CASE( test_ica_with_some_mean_unknown_normalized_mix )
}
-BOOST_AUTO_TEST_CASE( test_ica_with_some_mean_unknown_normalized )
+BOOST_AUTO_TEST_CASE( test_miaica_with_some_mean_unknown_normalized )
{
const int rows = 5;
const int elms = 10;
@@ -387,7 +537,7 @@ BOOST_AUTO_TEST_CASE( test_ica_with_some_mean_unknown_normalized )
{ 1, -9, -10, -5, -2, -6, 2, -7, -5, 1 }
};
- CICAAnalysisITPP ica;
+ CICAAnalysisMIA ica;
ica.initialize(rows, elms);
for (int i = 0; i < rows; ++i)
@@ -395,6 +545,7 @@ BOOST_AUTO_TEST_CASE( test_ica_with_some_mean_unknown_normalized )
ica.run(4, vector<vector<float> >());
+
ica.normalize_ICs();
for (int i = 0; i < rows; ++i) {
@@ -406,7 +557,7 @@ BOOST_AUTO_TEST_CASE( test_ica_with_some_mean_unknown_normalized )
}
}
-BOOST_AUTO_TEST_CASE( test_ica_saftey_against_stupid )
+BOOST_AUTO_TEST_CASE( test_miaica_saftey_against_stupid )
{
const int rows = 5;
const int elms = 10;
@@ -418,7 +569,7 @@ BOOST_AUTO_TEST_CASE( test_ica_saftey_against_stupid )
{ 1, -9, -10, -5, -2, -6, 2, -7, -5, 1 }
};
- CICAAnalysisITPP ica;
+ CICAAnalysisMIA ica;
ica.initialize(rows, elms);
for (int i = 0; i < rows; ++i)
@@ -430,7 +581,7 @@ BOOST_AUTO_TEST_CASE( test_ica_saftey_against_stupid )
}
-BOOST_AUTO_TEST_CASE( test_ica_access_failtures )
+BOOST_AUTO_TEST_CASE( test_miaica_access_failtures )
{
const int ncomponents = 4;
const size_t rows = 5;
@@ -443,7 +594,7 @@ BOOST_AUTO_TEST_CASE( test_ica_access_failtures )
{ 1, -9, -10, -5, -2, -6, 2, -7, -5, 1 }
};
- CICAAnalysisITPP ica;
+ CICAAnalysisMIA ica;
ica.initialize(rows, elms);
for (size_t i = 0; i < rows; ++i)
@@ -463,46 +614,3 @@ BOOST_AUTO_TEST_CASE( test_ica_access_failtures )
BOOST_CHECK_EQUAL(ica.get_mix(0).size(), elms);
}
-
-/**
- This test needs more data to work properly
-BOOST_AUTO_TEST_CASE( test_autorun )
-{
- const int comps = 3;
- const int rows = 10;
- const int elms = 40;
- double ic_rows[comps * elms] =
- { 1.1, -0.9, -1.9, 0.9, 2.1, 1.9, 6.1, -2.9, 0.9, 1.1,
- 1.1, 1.9, -1.1, 2.9, 3.1, 1.9, 0.1, 2.9, 1.9, 2.1,
- 2.3, -1.7, -2.7, -2.7, 6.3, -3.7, 6.3, -2.7, -0.7, 2.3,
- 2.3, -2.7, 2.2, 2.6, 6.4, -3.8, 6.2, -2.5, -0.6, 2.2,
-
- 2.3, -1.7, -2.7, -2.7, 6.3, -3.7, 6.3, -2.7, -0.7, 2.3,
- 2.3, -2.7, -2.2, -2.6, 6.4, -3.8, 6.2, -2.5, -0.6, 2.2,
- 2.3, -1.7, -2.7, -2.7, 6.3, -3.7, 6.3, -2.7, -0.7, 2.3,
- 2.3, -2.7, -2.2, -2.6, 6.4, -3.8, 6.2, -2.5, -0.6, 2.2 ,
-
- 2.3, -1.7, -2.7, -2.7, 6.3, -3.7, 6.3, -2.7, -0.7, 2.3,
- 2, 4.4, -5, 6, 9, -7, 5, -4, 2, 2,
- 1.1, 1.9, -1.1, 2.9, 3.1, 1.9, 0.1, 2.9, 1.9, 2.1,
- 2.1, 4.1, -5.2, 6.4, -9.2, -7.1, -5.3, 4.4, -2.1, 2.1
- };
-
- CICAAnalysis ica(rows, elms);
-
- for (int i = 0; i < rows; ++i) {
- vector <float> input(elms);
- for (int j = 0; j < elms; ++j)
- for (int k = 0; k < comps; ++k)
- input[j] += ic_rows[k * elms + j] * cos(i + k);
-
- ica.set_row(i, input.begin(), input.end());
- }
- ica.run_auto(6,2,0.9);
- BOOST_CHECK_EQUAL(ica.get_ncomponents(), comps);
-
-
-}
-
-
-*/
diff --git a/mia/core/fastica_nonlinearity.cc b/mia/core/fastica_nonlinearity.cc
index ad195b4..17e0be3 100644
--- a/mia/core/fastica_nonlinearity.cc
+++ b/mia/core/fastica_nonlinearity.cc
@@ -1,7 +1,7 @@
/* -*- mia-c++ -*-
*
* This file is part of MIA - a toolbox for medical image analysis
- * Copyright (c) Leipzig, Madrid 1999-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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/fastica_nonlinearity.hh b/mia/core/fastica_nonlinearity.hh
index 4c332df..829d42c 100644
--- a/mia/core/fastica_nonlinearity.hh
+++ b/mia/core/fastica_nonlinearity.hh
@@ -1,7 +1,7 @@
/* -*- mia-c++ -*-
*
* This file is part of MIA - a toolbox for medical image analysis
- * Copyright (c) Leipzig, Madrid 1999-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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.cc b/mia/core/fft1d_r2c.cc
index 1a72c45..69070e0 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 4538d6e..fa6e8bd 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 84a19e7..abde9e1 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -215,7 +215,7 @@ CFFTSlopeClassifierImpl::CFFTSlopeClassifierImpl(const CFFTSlopeClassifier::Colu
/* mechanics for classifying the mixing curves:
- - sort the slopes that are below the periodic threshhold for high range and eliminate the
+ - sort the slopes that are below the periodic threshold for high range and eliminate the
other curves, they are perfusion or baseline
- sort these two curves by the order in which the high peaks appear to identify
which is RV (peak comes first) and which LV
diff --git a/mia/core/fftslopeclassifier.hh b/mia/core/fftslopeclassifier.hh
index f7f0085..873cc92 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 3b9e24f..f1f1f1b 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 9aa21e3..b3f736a 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 1b5af86..b0d80c7 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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.hh b/mia/core/file.hh
index 969c02f..4524255 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 aae1e3b..fca8db0 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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 <boost/regex.hpp>
#include <mia/core/msgstream.hh>
#include <mia/core/filetools.hh>
diff --git a/mia/core/filetools.hh b/mia/core/filetools.hh
index ff209f8..1a9eac9 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 60920e4..ac10826 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 4708107..baba669 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,6 +28,8 @@
#include <mia/core/factory.hh>
#include <mia/core/import_handler.hh>
+#include <cinttypes>
+
NS_MIA_BEGIN
/** @cond INTERNAL
@@ -197,16 +199,14 @@ struct plugin_can_chain<TDataFilterPlugin<D>> {
template <template <class> class D>
struct __bind_all {
typedef D<bool> Dbool;
- typedef D<signed char> Dsc;
- typedef D<unsigned char> Duc;
- typedef D<signed short> Dss;
- typedef D<unsigned short> Dus;
- typedef D<signed int> Dsi;
- typedef D<unsigned int> Dui;
-#ifdef LONG_64BIT
- typedef D<signed long> Dsl;
- typedef D<unsigned long> Dul;
-#endif
+ typedef D<int8_t> Dsc;
+ typedef D<uint8_t> Duc;
+ typedef D<int16_t> Dss;
+ typedef D<uint16_t> Dus;
+ typedef D<int32_t> Dsi;
+ typedef D<uint32_t> Dui;
+ typedef D<int64_t> Dsl;
+ typedef D<uint64_t> Dul;
typedef D<float> Dfloat;
typedef D<double> Ddouble;
};
@@ -258,10 +258,8 @@ static typename F::result_type filter(const F& f, const B& b)
case it_ushort:return f(DC(typename D::Dus,b));
case it_sint: return f(DC(typename D::Dsi,b));
case it_uint: return f(DC(typename D::Dui,b));
-#ifdef LONG_64BIT
case it_slong: return f(DC(typename D::Dsl,b));
case it_ulong: return f(DC(typename D::Dul,b));
-#endif
case it_float: return f(DC(typename D::Dfloat,b));
case it_double:return f(DC(typename D::Ddouble,b));
default:
@@ -294,10 +292,8 @@ static typename F::result_type filter_inplace(const F& f, B& b)
case it_ushort:return f(DV(typename D::Dus,b));
case it_sint: return f(DV(typename D::Dsi,b));
case it_uint: return f(DV(typename D::Dui,b));
-#ifdef LONG_64BIT
case it_slong: return f(DV(typename D::Dsl,b));
case it_ulong: return f(DV(typename D::Dul,b));
-#endif
case it_float: return f(DV(typename D::Dfloat,b));
case it_double:return f(DV(typename D::Ddouble,b));
default:
@@ -329,10 +325,8 @@ static typename F::result_type accumulate(F& f, const B& data)
case it_ushort:return f(DC(typename D::Dus,data));
case it_sint: return f(DC(typename D::Dsi,data));
case it_uint: return f(DC(typename D::Dui,data));
-#ifdef LONG_64BIT
case it_slong: return f(DC(typename D::Dsl,data));
case it_ulong: return f(DC(typename D::Dul,data));
-#endif
case it_float: return f(DC(typename D::Dfloat,data));
case it_double:return f(DC(typename D::Ddouble,data));
default:
@@ -353,10 +347,8 @@ static typename F::result_type _combine_inplace(const F& f, INOUT& inout, const
case it_ushort:return f(inout, DC(typename D::Dus, in));
case it_sint: return f(inout, DC(typename D::Dsi, in));
case it_uint: return f(inout, DC(typename D::Dui, in));
-#ifdef LONG_64BIT
case it_slong: return f(inout, DC(typename D::Dsl, in));
case it_ulong: return f(inout, DC(typename D::Dul, in));
-#endif
case it_float: return f(inout, DC(typename D::Dfloat, in));
case it_double:return f(inout, DC(typename D::Ddouble, in));
default:
@@ -378,10 +370,8 @@ static typename F::result_type combine_inplace(const F& f, INOUT& inout, const I
case it_ushort:return _combine_inplace(f, DV(typename D::Dus, inout), in);
case it_sint: return _combine_inplace(f, DV(typename D::Dsi, inout), in);
case it_uint: return _combine_inplace(f, DV(typename D::Dui, inout), in);
-#ifdef LONG_64BIT
case it_slong: return _combine_inplace(f, DV(typename D::Dsl, inout), in);
case it_ulong: return _combine_inplace(f, DV(typename D::Dul, inout), in);
-#endif
case it_float: return _combine_inplace(f, DV(typename D::Dfloat, inout), in);
case it_double:return _combine_inplace(f, DV(typename D::Ddouble, inout), in);
default:
@@ -418,10 +408,8 @@ static typename F::result_type filter_equal(const F& f, const B& a, const B& b)
case it_ushort:return f( DC(typename D::Dus, a), DC(typename D::Dus,b));
case it_sint: return f( DC(typename D::Dsi, a), DC(typename D::Dsi,b));
case it_uint: return f( DC(typename D::Dui, a), DC(typename D::Dui,b));
-#ifdef LONG_64BIT
case it_slong: return f( DC(typename D::Dsl, a), DC(typename D::Dsl,b));
case it_ulong: return f( DC(typename D::Dul, a), DC(typename D::Dul,b));
-#endif
case it_float: return f( DC(typename D::Dfloat, a), DC(typename D::Dfloat,b));
case it_double:return f( DC(typename D::Ddouble, a), DC(typename D::Ddouble,b));
default:
@@ -455,10 +443,8 @@ static void filter_equal_inplace(const F& f, const B& a, B& b)
case it_ushort: f( DC(typename D::Dus, a), DV(typename D::Dus,b));break;
case it_sint: f( DC(typename D::Dsi, a), DV(typename D::Dsi,b));break;
case it_uint: f( DC(typename D::Dui, a), DV(typename D::Dui,b));break;
-#ifdef LONG_64BIT
case it_slong: f( DC(typename D::Dsl, a), DV(typename D::Dsl,b));break;
case it_ulong: f( DC(typename D::Dul, a), DV(typename D::Dul,b));break;
-#endif
case it_float: f( DC(typename D::Dfloat, a), DV(typename D::Dfloat,b));break;
case it_double: f( DC(typename D::Ddouble, a), DV(typename D::Ddouble,b));break;
default:
@@ -491,10 +477,8 @@ static typename F::result_type filter_and_output(const F& f, const B& a, O& b)
case it_ushort: return f(DC(typename D::Dus, a), b);break;
case it_sint: return f(DC(typename D::Dsi, a), b);break;
case it_uint: return f(DC(typename D::Dui, a), b);break;
-#ifdef HAVE_INT64
case it_slong: return f(DC(typename D::Dsl, a), b);break;
case it_ulong: return f(DC(typename D::Dul, a), b);break;
-#endif
case it_float: return f(DC(typename D::Dfloat, a), b);break;
case it_double: return f(DC(typename D::Ddouble, a), b);break;
default:
@@ -517,10 +501,8 @@ static typename F::result_type _filter(const F& f, const A& a, const B& b)
case it_ushort:return f(DC(typename D::Dus, a), b);
case it_sint: return f(DC(typename D::Dsi, a), b);
case it_uint: return f(DC(typename D::Dui, a), b);
-#ifdef LONG_64BIT
case it_slong: return f(DC(typename D::Dsl, a), b);
case it_ulong: return f(DC(typename D::Dul, a), b);
-#endif
case it_float: return f(DC(typename D::Dfloat,a), b);
case it_double:return f(DC(typename D::Ddouble,a), b);
default:
@@ -554,11 +536,9 @@ static typename F::result_type filter(const F& f, const A& a, const B& b)
case it_sshort:return _filter(f, a, DC(typename D::Dss, b));
case it_ushort:return _filter(f, a, DC(typename D::Dus, b));
case it_sint: return _filter(f, a, DC(typename D::Dsi, b));
- case it_uint: return _filter(f, a, DC(typename D::Dui, b));
-#ifdef LONG_64BIT
+ case it_uint: return _filter(f, a, DC(typename D::Dui, b));
case it_slong: return _filter(f, a, DC(typename D::Dsl, b));
case it_ulong: return _filter(f, a, DC(typename D::Dul, b));
-#endif
case it_float: return _filter(f, a, DC(typename D::Dfloat, b));
case it_double:return _filter(f, a, DC(typename D::Ddouble,b));
default:
@@ -581,10 +561,8 @@ static typename F::result_type _accumulate(F& f, const A& a, const B& b)
case it_ushort:return f(DC(typename D::Dus, a), b);
case it_sint: return f(DC(typename D::Dsi, a), b);
case it_uint: return f(DC(typename D::Dui, a), b);
-#ifdef LONG_64BIT
case it_slong: return f(DC(typename D::Dsl, a), b);
case it_ulong: return f(DC(typename D::Dul, a), b);
-#endif
case it_float: return f(DC(typename D::Dfloat,a), b);
case it_double:return f(DC(typename D::Ddouble,a), b);
default:
@@ -618,10 +596,8 @@ static typename F::result_type accumulate(F& f, const A& a, const B& b)
case it_ushort:return _accumulate(f, a, DC(typename D::Dus, b));
case it_sint: return _accumulate(f, a, DC(typename D::Dsi, b));
case it_uint: return _accumulate(f, a, DC(typename D::Dui, b));
-#ifdef LONG_64BIT
case it_slong: return _accumulate(f, a, DC(typename D::Dsl, b));
case it_ulong: return _accumulate(f, a, DC(typename D::Dul, b));
-#endif
case it_float: return _accumulate(f, a, DC(typename D::Dfloat, b));
case it_double:return _accumulate(f, a, DC(typename D::Ddouble,b));
default:
diff --git a/mia/core/fixedwidthoutput.cc b/mia/core/fixedwidthoutput.cc
index e8c152a..e38977f 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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.hh b/mia/core/fixedwidthoutput.hh
index 375931d..b533d8e 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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
index 89e203d..67e4ea6 100644
--- a/mia/core/flags.hh
+++ b/mia/core/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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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.cc b/mia/core/flagstring.cc
index 0446903..bf5c89a 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 1d2c46a..0729f6a 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 be1b74c..a5dc5ff 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 3fd872c..1e9a12a 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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/gsl_defines.hh b/mia/core/gsl_defines.hh
index a392126..79769f5 100644
--- a/mia/core/gsl_defines.hh
+++ b/mia/core/gsl_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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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/gsl_iterator.hh b/mia/core/gsl_iterator.hh
index cf013e8..c124b25 100644
--- a/mia/core/gsl_iterator.hh
+++ b/mia/core/gsl_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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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/gsl_matrix.cc b/mia/core/gsl_matrix.cc
index 4f24d08..8ceb89e 100644
--- a/mia/core/gsl_matrix.cc
+++ b/mia/core/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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,17 @@ Matrix::Matrix():m_matrix(nullptr), m_const_matrix(nullptr), m_owner(false)
{
}
+bool Matrix::is_valid() const
+{
+ return m_const_matrix != nullptr;
+}
+
+
+bool Matrix::is_writable() const
+{
+ return m_matrix != nullptr;
+}
+
Matrix::Matrix(size_t rows, size_t columns, bool clean):
m_matrix(NULL), m_owner(true)
{
@@ -76,6 +87,18 @@ Matrix::Matrix(const Matrix& other):
m_const_matrix = m_matrix;
}
+Matrix::Matrix(Matrix&& other):
+ m_matrix(other.m_matrix),
+ m_const_matrix(other.m_const_matrix),
+ m_owner(other.m_owner)
+{
+ other.m_const_matrix = nullptr;
+ other.m_matrix = nullptr;
+ other.m_owner = false;
+}
+
+
+
Matrix::Matrix(gsl_matrix* m):
m_matrix(m),
m_const_matrix(m),
@@ -90,6 +113,21 @@ Matrix::Matrix(const gsl_matrix* m):
{
}
+Matrix& Matrix::operator =(Matrix&& other)
+{
+ if (this == &other)
+ return *this;
+
+ m_const_matrix = other.m_const_matrix;
+ m_matrix = other.m_matrix;
+ m_owner = other.m_owner;
+
+ other.m_const_matrix = nullptr;
+ other.m_matrix = nullptr;
+ other.m_owner = false;
+ return *this;
+}
+
Matrix& Matrix::operator =(const Matrix& other)
{
if (this == &other)
@@ -118,7 +156,8 @@ void Matrix::reset(size_t rows, size_t columns, bool clean)
swap(help, m_matrix);
if (help && m_owner)
gsl_matrix_free(help);
- m_const_matrix = m_matrix;
+ m_const_matrix = m_matrix;
+ m_owner = true;
}
void Matrix::reset(size_t rows, size_t columns, double init)
@@ -130,7 +169,8 @@ void Matrix::reset(size_t rows, size_t columns, double init)
swap(help, m_matrix);
if (help && m_owner)
gsl_matrix_free(help);
- m_const_matrix = m_matrix;
+ m_const_matrix = m_matrix;
+ m_owner = true;
}
Matrix::~Matrix()
diff --git a/mia/core/gsl_matrix.hh b/mia/core/gsl_matrix.hh
index 6071c37..27e38d1 100644
--- a/mia/core/gsl_matrix.hh
+++ b/mia/core/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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -191,6 +191,13 @@ public:
Copy constructor that executes a deep copy
*/
Matrix(const Matrix& other);
+
+
+ /**
+ move constructor
+ */
+ Matrix(Matrix&& other);
+
/**
Wrap an existing GSL matrix
@@ -217,6 +224,12 @@ public:
Matrix& operator =(const Matrix& other);
/**
+ Move operator that
+ */
+ Matrix& operator =(Matrix&& other);
+
+
+ /**
Reset the matrix with the new dimensions.
\param rows
\param columns
@@ -410,6 +423,10 @@ public:
gsl_matrix_scale(*this, rhs);
return *this;
}
+
+ bool is_valid() const;
+
+ bool is_writable() const;
private:
gsl_matrix *m_matrix;
diff --git a/mia/core/gsl_matrix_vector_ops.cc b/mia/core/gsl_matrix_vector_ops.cc
index e3af56e..34d2210 100644
--- a/mia/core/gsl_matrix_vector_ops.cc
+++ b/mia/core/gsl_matrix_vector_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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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/gsl_matrix_vector_ops.hh b/mia/core/gsl_matrix_vector_ops.hh
index ff78161..f7dca34 100644
--- a/mia/core/gsl_matrix_vector_ops.hh
+++ b/mia/core/gsl_matrix_vector_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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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/gsl_multimin.cc b/mia/core/gsl_multimin.cc
index b0a5382..73ff163 100644
--- a/mia/core/gsl_multimin.cc
+++ b/mia/core/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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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/gsl_multimin.hh b/mia/core/gsl_multimin.hh
index 5d0602a..671e173 100644
--- a/mia/core/gsl_multimin.hh
+++ b/mia/core/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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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/gsl_pca.cc b/mia/core/gsl_pca.cc
index 7d4ca4c..c6872d5 100644
--- a/mia/core/gsl_pca.cc
+++ b/mia/core/gsl_pca.cc
@@ -1,7 +1,7 @@
/* -*- mia-c++ -*-
*
* This file is part of MIA - a toolbox for medical image analysis
- * Copyright (c) Leipzig, Madrid 1999-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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/gsl_pca.hh b/mia/core/gsl_pca.hh
index 0c2d271..c057eed 100644
--- a/mia/core/gsl_pca.hh
+++ b/mia/core/gsl_pca.hh
@@ -1,7 +1,7 @@
/* -*- mia-c++ -*-
*
* This file is part of MIA - a toolbox for medical image analysis
- * Copyright (c) Leipzig, Madrid 1999-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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/gsl_vector.cc b/mia/core/gsl_vector.cc
index 4a104fe..9345c2e 100644
--- a/mia/core/gsl_vector.cc
+++ b/mia/core/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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,39 @@ Vector::Vector(const Vector& other):
gsl_vector_memcpy(data, other.cdata);
}
+Vector::Vector(Vector&& other)
+{
+ owner = other.owner;
+ cdata = other.cdata;
+ data = other.data;
+
+ other.cdata = other.data = nullptr;
+ other.owner = false;
+}
+
+Vector& Vector::operator = (Vector&& other)
+{
+ if (&other != this) {
+ owner = other.owner;
+ cdata = other.cdata;
+ data = other.data;
+
+ other.cdata = other.data = nullptr;
+ other.owner = false;
+ }
+ return *this;
+}
+
+bool Vector::is_writable() const
+{
+ return data != nullptr;
+}
+
+bool Vector::is_valid() const
+{
+ return cdata != nullptr;
+}
+
Vector& Vector::operator = (const Vector& other)
{
if (&other != this) {
@@ -183,21 +216,6 @@ CSetGSLErrorHandler::~CSetGSLErrorHandler()
}
-#ifdef NDEBUG
- class CTurnOffErrorHandler {
- public:
- CTurnOffErrorHandler();
- };
-
-
- CTurnOffErrorHandler::CTurnOffErrorHandler()
- {
- gsl_set_error_handler_off ();
- }
-
- const CTurnOffErrorHandler gsl_turn_off_error_handler;
-#else
CSetGSLErrorHandler replace_error_handler;
-#endif
}
diff --git a/mia/core/gsl_vector.hh b/mia/core/gsl_vector.hh
index 5976f3b..e8e5f05 100644
--- a/mia/core/gsl_vector.hh
+++ b/mia/core/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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,9 +89,21 @@ public:
Vector(const Vector& other);
/**
+ Move constructor, does move the internal data structure to the new object.
+ */
+ Vector(Vector&& other);
+
+
+ /**
Copy operator, does a deep copy of the internal data structures.
*/
Vector& operator = (const Vector& other);
+
+ /**
+ Move operator, does move the internal data structure to the new object.
+ */
+ Vector& operator = (Vector&& other);
+
/// Destructor
~Vector();
@@ -157,7 +169,10 @@ public:
Write the vector to a stream
\param os the output stream
*/
- void print(std::ostream& os) const;
+ void print(std::ostream& os) const;
+
+ bool is_writable() const;
+ bool is_valid() const;
protected:
diff --git a/mia/core/gsl_vector_dispatch.hh b/mia/core/gsl_vector_dispatch.hh
index 788cf84..6006f9d 100644
--- a/mia/core/gsl_vector_dispatch.hh
+++ b/mia/core/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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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/gsl_wavelet.cc b/mia/core/gsl_wavelet.cc
index e1345c9..2052232 100644
--- a/mia/core/gsl_wavelet.cc
+++ b/mia/core/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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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/gsl_wavelet.hh b/mia/core/gsl_wavelet.hh
index abb99d4..e7a27c2 100644
--- a/mia/core/gsl_wavelet.hh
+++ b/mia/core/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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 6ca3fc4..b4a4980 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,12 +28,12 @@
#include <iterator>
#include <climits>
-#include <boost/regex.hpp>
#include <boost/filesystem/operations.hpp>
#include <mia/core/module.hh>
#include <mia/core/plugin_base.hh>
#include <mia/core/msgstream.hh>
+#include <mia/core/xmlinterface.hh>
@@ -315,10 +315,10 @@ T& THandlerSingleton<T>::do_instance(bool require_initialization)
if (require_initialization) {
if (!m_is_initialized) {
- TRACE("Unitialized state");
+ TRACE("Uninitialized state");
CScopedLock lock_init(m_initialization_mutex);
if (!m_is_initialized) {
- TRACE("Enter locked unitialized state");
+ TRACE("Enter locked uninitialized state");
lock.release();
cvdebug() << "not yet initialized: second check passed\n";
me.initialise(m_searchpath);
diff --git a/mia/core/handler.hh b/mia/core/handler.hh
index 4788ec0..b9b0774 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -60,7 +60,7 @@ public:
typedef std::shared_ptr<I> PInterface;
- /// a map containing the names and theavailabe plug-ins
+ /// a map containing the names and the available plug-ins
typedef std::map<std::string, PInterface> CPluginMap;
/// the iterator to walk over the available plug-ins
diff --git a/mia/core/handlerbase.cc b/mia/core/handlerbase.cc
index f689563..bcd8fdb 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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/handlerbase.hh>
#include <mia/core/msgstream.hh>
#include <boost/filesystem/path.hpp>
+#include <mia/core/xmlinterface.hh>
NS_MIA_BEGIN
diff --git a/mia/core/handlerbase.hh b/mia/core/handlerbase.hh
index b38a836..9c3ed72 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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 <ostream>
#include <fstream>
#include <map>
-#include <mia/core/xmlinterface.hh>
#include <mia/core/defines.hh>
@@ -32,7 +31,7 @@ NS_MIA_BEGIN
-
+class CXMLElement;
class CPluginHandlerBase;
/**
diff --git a/mia/core/histogram.hh b/mia/core/histogram.hh
index c13f8b4..5c0fd1d 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 e67a72b..64049a7 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 9687593..2169d24 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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/hwcap.cc b/mia/core/hwcap.cc
new file mode 100644
index 0000000..633f475
--- /dev/null
+++ b/mia/core/hwcap.cc
@@ -0,0 +1,59 @@
+//
+// Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+//
+//
+
+#include <mia/core/hwcap.hh>
+
+#ifndef __linux__
+#error this code is only valid on linux
+#endif
+
+#include <sys/auxv.h>
+
+NS_MIA_BEGIN
+#ifdef __x86_64__
+
+bool cpu_has_sse()
+{
+ return true;
+}
+
+bool cpu_has_sse2()
+{
+ return true;
+}
+
+bool cpu_has_sse3()
+
+bool cpu_has_ssse3()
+
+bool cpu_has_fma()
+
+bool cpu_has_fma4()
+
+bool cpu_has_neon()
+
+#else
+
+
+NS_MIA_END
+
+
+#endif
+
diff --git a/mia/core/hwcap.hh b/mia/core/hwcap.hh
new file mode 100644
index 0000000..e457edf
--- /dev/null
+++ b/mia/core/hwcap.hh
@@ -0,0 +1,49 @@
+//
+// Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+//
+//
+
+
+
+#ifndef mia_core_hwcap_hh
+#define mia_core_hwcap_hh
+
+#include <mia/core/defines.hh>
+
+NS_MIA_BEGIN
+
+bool cpu_has_sse();
+
+bool cpu_has_sse2();
+
+bool cpu_has_sse3();
+
+bool cpu_has_ssse3();
+
+bool cpu_has_fma();
+
+bool cpu_has_fma4();
+
+bool cpu_has_neon();
+
+
+NS_MIA_END
+
+
+
+#endif
diff --git a/mia/core/ica.cc b/mia/core/ica.cc
index 20c8e76..ae52180 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-2016 Gert Wollny
+ * This file is part of MIA - a toolbox for medical image analysis
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,485 +18,54 @@
*
*/
-#include <vector>
-#include <cassert>
-#include <stdexcept>
-#include <memory>
-#include <miaconfig.h>
-#include <mia/core/ica.hh>
-#include <mia/core/errormacro.hh>
-#include <mia/core/msgstream.hh>
-
-
-NS_MIA_BEGIN
-
-using namespace std;
-
-struct CICAAnalysisITPPImpl {
-
- CICAAnalysisITPPImpl(unsigned int rows, unsigned int length);
- CICAAnalysisITPPImpl(const itpp::mat& ic, const itpp::mat& mix, const std::vector<double>& mean);
- void normalize_ICs();
- void get_mixing_curve(unsigned int c, vector<float>& curve) const;
- void set_mixing_series(unsigned int index, const std::vector<float>& series);
- void check_set(const CICAAnalysisITPP::IndexSet& s) const;
- std::vector<float> normalize_Mix();
-
- itpp::mat m_Signal;
- itpp::mat m_ICs;
- itpp::mat m_Mix;
- vector<double> m_mean;
-
- unsigned int m_ncomponents;
- unsigned int m_nlength;
- unsigned int m_rows;
-
- int m_max_iterations;
- int m_approach;
-};
+#define VSTREAM_DOMAIN "ICA-BASE"
+#include <mia/core/export_handler.hh>
+#include <mia/core/ica.hh>
+#include <mia/core/spacial_kernel.hh>
+#include <mia/core/plugin_base.cxx>
+#include <mia/core/handler.cxx>
-CICAAnalysisITPP::CICAAnalysisITPP(const itpp::mat& ic, const itpp::mat& mix, const std::vector<double>& mean):
- impl(new CICAAnalysisITPPImpl(ic, mix, mean))
-{
-
-}
-
-CICAAnalysisITPP::CICAAnalysisITPP():impl(nullptr)
-{
-
-}
-
-
-void CICAAnalysisITPP::initialize(unsigned int series_length, unsigned int slice_size)
-{
- auto new_impl = new CICAAnalysisITPPImpl(series_length, slice_size);
- swap(new_impl, impl);
-
- if (new_impl)
- delete new_impl;
-}
-CICAAnalysisITPP::~CICAAnalysisITPP()
-{
- delete impl;
-}
+namespace mia {
-void CICAAnalysisITPP::set_row_internal(unsigned row, const std::vector<double>& buffer, double mean)
+CIndepCompAnalysis::~CIndepCompAnalysis()
{
- TRACE_FUNCTION;
- assert(impl);
- assert(row < static_cast<unsigned>(impl->m_Signal.rows()));
- assert(buffer.size() == static_cast<unsigned>(impl->m_Signal.cols()));
-
- itppvector buf(static_cast<signed>(buffer.size()));
- for (auto i= 0; static_cast<unsigned>(i) < buffer.size(); ++i)
- buf[i] = buffer[static_cast<unsigned>(i)];
- impl->m_Signal.set_row(static_cast<signed>(row), buf);
- impl->m_mean[row] = mean;
- cvdebug() << "add row " << row << ", mean=" << mean << "\n";
}
-void CICAAnalysisITPP::set_approach(EApproach approach)
+CIndepCompAnalysisFactory::CIndepCompAnalysisFactory():
+ m_deterministic_seed(-1)
{
- switch (approach) {
- case appr_defl: impl->m_approach = FICA_APPROACH_DEFL;
- break;
- case appr_symm: impl->m_approach = FICA_APPROACH_SYMM;
- break;
- default:
- throw invalid_argument("CICAAnalysisITPP:set_approach: Unknown approach given");
- }
-
}
-
-bool CICAAnalysisITPP::run(unsigned int nica, vector<vector<float> > guess)
-{
- TRACE_FUNCTION;
- assert(impl);
-
- itpp::Fast_ICA fastICA(impl->m_Signal);
-
- fastICA.set_nrof_independent_components(nica);
- fastICA.set_non_linearity( FICA_NONLIN_TANH );
-
-#if ICA_ALWAYS_USE_SYMM
- // approach APPROACH_DEFL may not return in the unpached itpp
- // therefore, always use APPROACH_SYMM
- fastICA.set_approach( FICA_APPROACH_SYMM );
-#else
- fastICA.set_approach( impl->m_approach );
-#endif
- if (impl->m_max_iterations > 0)
- fastICA.set_max_num_iterations(impl->m_max_iterations);
-
- if (!guess.empty()) {
- itpp::mat mguess(impl->m_Signal.rows(), static_cast<int>(guess.size()));
- for (unsigned int c = 0; c < guess.size(); ++c)
- for (unsigned int r = 0; r < guess.size(); ++r)
- mguess(r,c) = guess[c][r];
- fastICA.set_init_guess(mguess);
- }
-#ifdef ICA_ALWAYS_USE_SYMM
- // in the unpatched itpp separate doesn't return a value
- // therefore, we always assume true
- bool result = true;
- fastICA.separate();
-#else
- bool result = fastICA.separate();
-#endif
-
- impl->m_ICs = fastICA.get_independent_components();
- impl->m_Mix = fastICA.get_mixing_matrix();
-
- impl->m_ncomponents = impl->m_Mix.cols();
- impl->m_nlength = impl->m_ICs.cols();
- impl->m_rows = impl->m_Mix.rows();
- return result;
-}
-
-unsigned int CICAAnalysisITPP::get_ncomponents() const
-{
- return impl->m_ncomponents;
-}
-
-vector<float> CICAAnalysisITPP::get_feature_row(unsigned int row) const
-{
- TRACE_FUNCTION;
- if (row < impl->m_ncomponents) {
- vector<float> result(impl->m_nlength);
- for (unsigned int i = 0; i < impl->m_nlength; ++i)
- result[i] = static_cast<float>(impl->m_ICs(row, i));
- return result;
- }
-
- throw create_exception<invalid_argument>("CICAAnalysisITPP::get_feature_row: requested row ", row, " out of range");
-
-}
-
-std::vector<float> CICAAnalysisITPP::get_mix_series(unsigned int colm)const
-{
- TRACE_FUNCTION;
- if (colm < impl->m_ncomponents) {
- vector<float> result(impl->m_rows);
- impl->get_mixing_curve(colm, result);
- return result;
- }
- throw create_exception<invalid_argument>("CICAAnalysisITPP::get_mix_series: requested series ", colm, " out of range");
-}
-
-void CICAAnalysisITPP::set_mixing_series(unsigned int index, const std::vector<float>& filtered_series)
-{
- impl->set_mixing_series(index, filtered_series);
-}
-
-
-float correlation(const CICAAnalysisITPP::itppvector& a, const CICAAnalysisITPP::itppvector& b)
-{
- assert(a.size() > 0);
- assert(a.size() == b.size());
-
- float sxx = 0.0;
- float syy = 0.0;
- float sxy = 0.0;
- float sx = 0.0;
- float sy = 0.0;
-
- for (int i = 0; i < a.size(); ++i) {
- sx += a[i];
- sy += b[i];
- sxx += a[i] * a[i];
- syy += b[i] * b[i];
- sxy += a[i] * b[i];
- }
- const float ssxy = sxy - sx * sy / a.size();
- const float ssxx = sxx - sx * sx / a.size();
- const float ssyy = syy - sy * sy / a.size();
- if (sxx < 1e-10 && syy < 1e-10 )
- return 1.0;
-
- if (sxx < 1e-10 || syy < 1e-10 )
- return 0.0;
-
- return (ssxy * ssxy) / (ssxx * ssyy);
-}
-
-void CICAAnalysisITPPImpl::set_mixing_series(unsigned int index, const std::vector<float>& series)
-{
- TRACE_FUNCTION;
- assert(m_rows == series.size());
- assert(index < m_nlength);
- for (unsigned int i = 0; i < m_rows; ++i)
- m_Mix(i, index) = series[i];
-
-}
-
-
-CSlopeColumns CICAAnalysisITPP::get_mixing_curves() const
+void CIndepCompAnalysisFactory::set_deterministic_seed(int seed)
{
- TRACE_FUNCTION;
- CSlopeColumns result(impl->m_ncomponents);
- for (unsigned int c = 0; c < impl->m_ncomponents; ++c)
- impl->get_mixing_curve(c, result[c]);
- return result;
+ m_deterministic_seed = seed;
}
-void CICAAnalysisITPPImpl::get_mixing_curve(unsigned int c, vector<float>& curve) const
+CIndepCompAnalysis *CIndepCompAnalysisFactory::create() const
{
- TRACE_FUNCTION;
- curve.resize(m_rows);
- for (unsigned int i = 0; i < m_rows; ++i)
- curve[i] = static_cast<float>(m_Mix(i, c));
-}
-
-std::vector<float> CICAAnalysisITPP::get_mix(unsigned int idx)const
-{
- TRACE_FUNCTION;
- if (idx < impl->m_rows) {
- vector<float> result(impl->m_nlength, static_cast<float>(impl->m_mean[idx]));
- for (unsigned int i = 0; i < impl->m_nlength; ++i) {
- for (unsigned int c = 0; c < impl->m_ncomponents; ++c)
- result[i] += impl->m_ICs(c, i) * impl->m_Mix(idx, c);
- }
- return result;
+ auto retval = do_create();
+ if (m_deterministic_seed >= 0) {
+ cvdebug() << "Set deterministic to " << m_deterministic_seed << "\n";
+ retval->set_deterministic_seed(m_deterministic_seed);
}
-
- throw create_exception<invalid_argument>("CICAAnalysisITPP::get_mix: requested idx ", idx, " out of range: ", impl->m_rows);
+ return retval;
}
-std::vector<float> CICAAnalysisITPP::get_delta_feature(const IndexSet& plus, const IndexSet& minus)const
+CIndepCompAnalysisFactory::~CIndepCompAnalysisFactory()
{
- TRACE_FUNCTION;
-
- vector<float> result(impl->m_nlength, 0.0f);
- impl->check_set(plus);
- impl->check_set(minus);
-
- for (unsigned int i = 0; i < impl->m_nlength; ++i) {
- for (IndexSet::const_iterator c = plus.begin(); c != plus.end(); ++c)
- result[i] += impl->m_ICs(*c, i);
- for (IndexSet::const_iterator c = minus.begin(); c != minus.end(); ++c)
- result[i] -= impl->m_ICs(*c, i);
-
- }
- return result;
}
-std::vector<float> CICAAnalysisITPP::get_partial_mix(unsigned int idx, const IndexSet& cps)const
-{
- TRACE_FUNCTION;
- if (idx >= impl->m_rows) {
- throw create_exception<invalid_argument>("CICAAnalysisITPP::get_mix: requested idx ", idx,
- " out of range: ", impl->m_rows);
+const char *CIndepCompAnalysisFactory::data_descr = "fastica";
+const char *CIndepCompAnalysisFactory::type_descr = "implementation";
- } else {
- impl->check_set(cps);
- vector<float> result(impl->m_nlength, static_cast<float>(impl->m_mean[idx]));
- for (unsigned int i = 0; i < impl->m_nlength; ++i) {
- for (IndexSet::const_iterator c = cps.begin(); c != cps.end(); ++c)
- result[i] += impl->m_ICs(*c, i) * impl->m_Mix(idx, *c);
- }
- return result;
- }
-}
+template<> const char * const
+TPluginHandler<TFactory<CIndepCompAnalysisFactory>>::m_help =
+ "These plug-ins provide implementations for the ICA algoritm.";
-std::vector<float> CICAAnalysisITPP::get_incomplete_mix(unsigned int idx, const std::set<unsigned int>& skip)const
-{
- TRACE_FUNCTION;
- if (idx < impl->m_rows) {
- vector<float> result(impl->m_nlength, static_cast<float>(impl->m_mean[idx]));
- for (unsigned int i = 0; i < impl->m_nlength; ++i) {
- for (unsigned int c = 0; c < impl->m_ncomponents; ++c)
- if (skip.find(c) == skip.end())
- result[i] += impl->m_ICs(c, i) * impl->m_Mix(idx, c);
- }
- return result;
- }
+EXPLICIT_INSTANCE_HANDLER(CIndepCompAnalysisFactory);
- throw create_exception<invalid_argument>("CICAAnalysisITPP::get_mix: requested idx ", idx,
- " out of range: ", impl->m_rows);
}
-
-std::vector<float> CICAAnalysisITPP::normalize_Mix()
-{
- return impl->normalize_Mix();
-}
-
-CICAAnalysisITPPImpl::CICAAnalysisITPPImpl(unsigned int rows, unsigned int length):
- m_Signal(rows, length),
- m_mean(rows),
- m_ncomponents(0),
- m_nlength(0),
- m_rows(0),
- m_max_iterations(0),
- m_approach(FICA_APPROACH_DEFL)
-{
- cvdebug() << "Analyis of signal with " << rows << " data rows of " << length << " entries\n";
-}
-
-CICAAnalysisITPPImpl::CICAAnalysisITPPImpl(const itpp::mat& ic, const itpp::mat& mix, const std::vector<double>& mean):
- // Coverty may complain here, but the order is correct
- // the signal is a matrix of the number of columns of the mixing matrix = time points
- // by rows of the independent components - each row constitutes th epixel ogf a feature image
- // coverity[swapped_arguments]
- m_Signal(mix.cols(), ic.rows()),
- m_ICs(ic),
- m_Mix(mix),
- m_mean(mean),
- m_ncomponents(mix.cols()),
- m_nlength(ic.cols()),
- m_rows(mix.rows()),
- m_max_iterations(0),
- m_approach(FICA_APPROACH_DEFL)
-{
- TRACE_FUNCTION;
-}
-
-void CICAAnalysisITPP::normalize_ICs()
-{
- TRACE_FUNCTION;
- impl->normalize_ICs();
-}
-
-void CICAAnalysisITPPImpl::check_set(const CICAAnalysisITPP::IndexSet& s) const
-{
- for (CICAAnalysisITPP::IndexSet::const_iterator is = s.begin();
- is != s.end(); ++is) {
- if (*is >= m_ncomponents) {
- throw create_exception<invalid_argument>("CICAAnalysisITPP: request component index ", *is ,
- " but only up to index ", m_ncomponents - 1,
- " available\n");
- }
- }
-}
-
-void CICAAnalysisITPPImpl::normalize_ICs()
-{
-#if 1
- if (m_nlength < 2)
- throw invalid_argument("ICAAnalysis: input should have at least two pixels");
-
- // scale all ICs to have a variance of 1.0
- for (unsigned int c = 0; c < m_ncomponents; ++c) {
- // evaluate range of IC
- double v = m_ICs(c, 0);
-
- double sum = v;
- double sum2 = v * v;
- for (unsigned int k = 1; k < m_nlength; ++k) {
- const double v = m_ICs(c, k);
- sum += v;
- sum2 += v * v;
- }
- const double ic_shift = sum / m_nlength;
- const double sigma = sqrt((sum2 - m_nlength * ic_shift * ic_shift) / (m_nlength - 1));
-
- // we want to start all slopes with the negative value
- // makes only truely sense, if the allover mean was stripped
- float invert = 1.0;
- if (m_Mix(0, c) > 0) {
- cvdebug() << "Component " << c << " invert sign\n";
- invert = -1.0;
- }
-
- if (sigma > 0) {
- const double ic_factor = invert * 2.0 / sigma;
- const double mix_factor = 1.0 / ic_factor;
-
- for (unsigned int k = 0; k < m_nlength; ++k)
- m_ICs(c, k) = (m_ICs(c, k) - ic_shift) * ic_factor;
-
- for (unsigned int r = 0; r < m_rows; ++r) {
- m_mean[r] += m_Mix(r, c) * ic_shift;
- m_Mix(r, c) *= mix_factor;
- }
- }
- }
-
-#else
- // scale all ICs to have a range of 2.0 and are shifted to the mean
- for (unsigned int c = 0; c < m_ncomponents; ++c) {
- // evaluate range of IC
- double min_val = m_ICs(c, 0);
- double max_val = m_ICs(c, 0);
-
- double sum = m_ICs(c, 0);
- for (unsigned int k = 0; k < m_nlength; ++k) {
- const double v = m_ICs(c, k);
- if (min_val > v)
- min_val = v;
- if (max_val < v)
- max_val = v;
- sum += v;
- }
- assert(min_val != max_val);
-
-
- // we want to start all slopes with the negative value
- // makes only truely sense, if the 1allover mean was stripped
- float invert = 1.0;
- if (m_Mix(0, c) > 0) {
- cvdebug() << "Component " << c << " invert sign\n";
- invert = -1.0;
- }
-
- const double ic_factor = invert * 2.0 / (max_val - min_val);
- const double mix_factor = 1.0 / ic_factor;
-
-
- const double ic_shift = sum / m_nlength;
-
- for (unsigned int k = 0; k < m_nlength; ++k)
- m_ICs(c, k) = (m_ICs(c, k) - ic_shift) * ic_factor;
-
- for (unsigned int r = 0; r < m_rows; ++r) {
- m_mean[r] += m_Mix(r, c) * ic_shift;
- m_Mix(r, c) *= mix_factor;
- }
- }
-#endif
-}
-
-std::vector<float> CICAAnalysisITPPImpl::normalize_Mix()
-{
- std::vector<float> result(m_nlength,0.0f);
-
- for (unsigned int c = 0; c < m_ncomponents; ++c) {
- float mean = 0.0f;
- for (unsigned int r = 0; r < m_rows; ++r)
- mean += m_Mix(r, c);
- mean /= m_rows;
- for (unsigned int r = 0; r < m_rows; ++r)
- m_Mix(r, c) -= mean;
-
- for (unsigned int k = 0; k < m_nlength; ++k)
- result[k] += mean * m_ICs(c, k);
- }
- for (unsigned int c = 0; c < m_ncomponents; ++c) {
- // invert sign so that all mixing curves start with a value < 0
- if (m_Mix(0, c) > 0) {
- for (unsigned int r = 0; r < m_rows; ++r)
- m_Mix(r, c) *= -1;
- for (unsigned int k = 0; k < m_nlength; ++k)
- m_ICs(c, k) *= -1;
- }
- }
-
- return result;
-}
-
-
-void CICAAnalysisITPP::set_max_iterations(int n)
-{
- impl->m_max_iterations = n;
-}
-
-PICAAnalysis CICAAnalysisITPPFactory::create() const
-{
- return PICAAnalysis(new CICAAnalysisITPP);
-}
-
-NS_MIA_END
diff --git a/mia/core/ica.hh b/mia/core/ica.hh
index fa089b9..51eb7ff 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-2016 Gert Wollny
+ * This file is part of MIA - a toolbox for medical image analysis
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,81 +18,81 @@
*
*/
-#ifndef mia_core_ica_hh
-#define mia_core_ica_hh
+#ifndef mia_core_ICAANALYSISBASE_HH
+#define mia_core_ICAANALYSISBASE_HH
+
+#include <memory>
#include <set>
-#include <vector>
-#include <itpp/signal/fastica.h>
+#include <boost/concept/requires.hpp>
+#include <boost/concept_check.hpp>
#include <mia/core/defines.hh>
#include <mia/core/slopevector.hh>
-#include <mia/core/icaanalysisbase.hh>
-
-#include <boost/concept/requires.hpp>
-#include <boost/concept_check.hpp>
+#include <mia/core/factory.hh>
+namespace mia {
-NS_MIA_BEGIN
-/**
- \ingroup perf
- \brief class for ICA analysis and use of such data.
- This class implements basic operations for of ICA. It makes use of the ITPP implementation of FastICA.
-*/
-class EXPORT_CORE CICAAnalysisITPP : public CICAAnalysis {
+class EXPORT_CORE CIndepCompAnalysis
+{
public:
- typedef CICAAnalysis::IndexSet IndexSet;
-
- /// The type of a vector as used by IT++
- typedef itpp::Vec<itpp::mat::value_type> itppvector;
/**
- Initialize an ICA based of predefined data - this is only used for test cases.
+ Separation approach to be used.
*/
- CICAAnalysisITPP(const itpp::mat& ic, const itpp::mat& mix, const std::vector<double>& mean );
+ enum EApproach {
+ appr_defl, /**< Deflation approach - each component is extimated separately */
+ appr_symm, /**< Symmetric approach thet estimates all components at the same time */
+ appr_unknown
+ };
-
- CICAAnalysisITPP();
+ typedef std::unique_ptr<CIndepCompAnalysis> Pointer;
+ /// defines a set of indices used for mixing
+ typedef std::set<unsigned int> IndexSet;
- ~CICAAnalysisITPP();
+ virtual ~CIndepCompAnalysis();
/**
- Initialize the ICA
- \param series_length number of data sets that will be provided
- \param slice_size number of elements each set containes
+ Set on row of input data
+ \tparam Iterator input data iterator, must follow the model of a forward iterator
+ \param row index of the input slice
+ \param begin start iterator of input data
+ \param end end iterator of input data
*/
-
- void initialize(unsigned int series_length, unsigned int slice_size);
+ template <class Iterator>
+ BOOST_CONCEPT_REQUIRES(((::boost::ForwardIterator<Iterator>)),
+ (void))
+ set_row(unsigned row, Iterator begin, Iterator end);
+ virtual void initialize(unsigned int series_length, unsigned int slice_size) = 0;
/**
Run the independed component analysis using the given numbers of components
\param nica number of indentepended components
- \param guess initial guess for the ICA, pass an empty vector of you
- don't want to use this feature
+ \param guess initial guess for the ICA, pass an empty vector of you
+ don't want to use this feature
*/
- bool run(unsigned int nica, std::vector<std::vector<float> > guess);
-
+ virtual bool run(unsigned int nica, std::vector<std::vector<float> > guess) = 0;
/// \returns the feature vector of \a row
- std::vector<float> get_feature_row(unsigned int row)const;
-
+ virtual std::vector<float> get_feature_row(unsigned int row)const = 0;
+
/// \returns the mixing signal curve of the feature \a row
- std::vector<float> get_mix_series(unsigned int row)const;
-
+ virtual std::vector<float> get_mix_series(unsigned int row)const = 0;
+
/// \returns the complete mixed signal at series index \a idx
- std::vector<float> get_mix(unsigned int idx)const;
-
+ virtual std::vector<float> get_mix(unsigned int idx)const = 0;
+
/** Evaluate an incomplete mixed signal. Here the features are given that are \a not to be used.
\sa get_partial_mix
\param idx series index
\param skip a set of feature indices that will be skipped when evaluating the mix
\returns the mixed signal
*/
- std::vector<float> get_incomplete_mix(unsigned int idx, const IndexSet& skip)const;
+ virtual std::vector<float> get_incomplete_mix(unsigned int idx, const IndexSet& skip)const = 0;
/** Evaluate an incomplete mixed signal. Here the features are given that are \a used to create the mix.
\sa get_incomplete_mix
@@ -100,70 +100,130 @@ public:
\param use the set of feature indices that will be used to evaluate the mix
\returns an incolmplete mixed signal.
*/
- std::vector<float> get_partial_mix(unsigned int idx, const IndexSet& use)const;
-
+ virtual std::vector<float> get_partial_mix(unsigned int idx, const IndexSet& use)const = 0;
+
/** Evaluate a mix of the feature signals by adding and subtractig individual features.
\param plus features o be added
\param minus features to be subtracted
\returns the feature mix
*/
- std::vector<float> get_delta_feature(const IndexSet& plus, const IndexSet& minus)const;
-
+ virtual std::vector<float> get_delta_feature(const IndexSet& plus, const IndexSet& minus)const = 0;
+
/**
Replace a mixing signal curve
\param index of the curve to be replaced
\param series new data for mixing curve
- */
- void set_mixing_series(unsigned int index, const std::vector<float>& series);
-
+ */
+ virtual void set_mixing_series(unsigned int index, const std::vector<float>& series) = 0;
+
/// \returns a vector containing all mixing curves
- CSlopeColumns get_mixing_curves() const;
-
+ virtual CSlopeColumns get_mixing_curves() const = 0;
+
/**
Normalize the ICs in the following manner:
* Scale and shift the range of the ICs to [-1, 1]
* Scale the mixing curved to compensate for the required scaling
* move the means of the time points to compensate for the shifting.
- */
- void normalize_ICs();
+ */
+ virtual void normalize_ICs() = 0;
/**
Normalize the mixing curves to have a zero mean. As a result a mean image is created that
containes the sum of the ICs weighted by the required mean shift.
- */
- std::vector<float> normalize_Mix();
+ */
+ virtual std::vector<float> normalize_Mix() = 0;
/// \returns the number of actual ICs
- unsigned int get_ncomponents() const;
-
+ virtual unsigned int get_ncomponents() const = 0;
+
/**
sets the number of iterations in the ICA
\param n
- */
- void set_max_iterations(int n);
-
+ */
+ virtual void set_max_iterations(int n) = 0;
+
/**
- Set the ICA approach to either FICA_APPROACH_DEFL(default) or FICA_APPROACH_SYMM.
+ Set the ICA approach to either FICA_APPROACH_DEFL(default) or FICA_APPROACH_SYMM.
\param approach
*/
- void set_approach(EApproach approach);
+ virtual void set_approach(EApproach approach) = 0;
+
+ virtual void set_deterministic_seed(int seed) = 0;
private:
- void set_row_internal(unsigned row, const std::vector<double>& buffer, double mean);
-
- struct CICAAnalysisITPPImpl *impl;
-
+ virtual void set_row_internal(unsigned row, const std::vector<double>& buffer, double mean) = 0;
+
};
+typedef CIndepCompAnalysis::Pointer PIndepCompAnalysis;
+
-class EXPORT_CORE CICAAnalysisITPPFactory: public CICAAnalysisFactory {
+class EXPORT_CORE CIndepCompAnalysisFactory : public CProductBase {
public:
- PICAAnalysis create() const;
+ static const char *data_descr;
+ static const char *type_descr;
+
+ typedef CIndepCompAnalysisFactory plugin_type;
+ typedef CIndepCompAnalysisFactory plugin_data;
+
+ CIndepCompAnalysisFactory();
+ virtual ~CIndepCompAnalysisFactory();
+ void set_deterministic_seed(int seed);
+ CIndepCompAnalysis *create() const __attribute__((warn_unused_result));
+private:
+ virtual CIndepCompAnalysis *do_create() const __attribute__((warn_unused_result)) = 0;
+ int m_deterministic_seed;
};
-typedef std::shared_ptr<CICAAnalysisITPPFactory> PICAAnalysisITPPFactory;
-NS_MIA_END
+typedef TFactory<CIndepCompAnalysisFactory> CIndepCompAnalysisFactoryPlugin;
+
+typedef std::shared_ptr<CIndepCompAnalysisFactory> PIndepCompAnalysisFactory;
+
+/// plugin handler for spaciel filter kernels
+typedef THandlerSingleton<TFactoryPluginHandler<CIndepCompAnalysisFactoryPlugin> >
+CIndepCompAnalysisFactoryPluginHandler;
+
+
+template<> const char * const
+TPluginHandler<TFactory<CIndepCompAnalysisFactory>>::m_help;
+
+extern template class EXPORT_CORE TPluginHandler<TFactory<CIndepCompAnalysisFactory>>;
+
+/// @cond NEVER
+FACTORY_TRAIT(CIndepCompAnalysisFactoryPluginHandler);
+/// @endcond
+
+
+
+inline PIndepCompAnalysisFactory produce_ica_factory(const std::string& descr)
+{
+ return CIndepCompAnalysisFactoryPluginHandler::instance().produce(descr);
+}
+
+
+
+/// \cond DOXYGEN_DOESNT_UNDERSTAND_BOOST_CONCEPT_REQUIRES
+template <class Iterator>
+BOOST_CONCEPT_REQUIRES(((::boost::ForwardIterator<Iterator>)),
+ (void))
+ CIndepCompAnalysis::set_row(unsigned row, Iterator begin, Iterator end)
+{
+ const unsigned int length = std::distance(begin, end);
+ std::vector<double> buffer(length);
+ unsigned int idx = 0;
+ double mean = 0.0;
+
+ while (begin != end)
+ mean += (buffer[idx++] = *begin++);
+ mean /= length;
+ for(unsigned int i = 0; i < length; ++i)
+ buffer[i] -= mean;
+ set_row_internal(row, buffer, mean);
+}
+/// \endcond
+
+}
-#endif
+#endif // CICAANALYSISBASE_HH
diff --git a/mia/core/ica_template.cxx b/mia/core/ica_template.cxx
index fa3a942..7bb6aef 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,7 @@
NS_MIA_BEGIN
template <class Data>
-TDataSeriesICA<Data>::TDataSeriesICA(const CICAAnalysisFactory& icatool, const std::vector<Data>& initializer,
+TDataSeriesICA<Data>::TDataSeriesICA(const CIndepCompAnalysisFactory& icatool, const std::vector<Data>& initializer,
bool strip_mean):
m_analysis(icatool.create())
{
@@ -195,7 +195,7 @@ void TDataSeriesICA<Data>::set_max_iterations(int n)
}
template <class Data>
-void TDataSeriesICA<Data>::set_approach(CICAAnalysis::EApproach approach)
+void TDataSeriesICA<Data>::set_approach(CIndepCompAnalysis::EApproach approach)
{
m_analysis->set_approach(approach);
}
diff --git a/mia/core/ica_template.hh b/mia/core/ica_template.hh
index 6f40b04..85b5d40 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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_ica_template_hh
#define mia_core_ica_template_hh
-#include <mia/core/icaanalysisbase.hh>
+#include <mia/core/ica.hh>
#include <vector>
@@ -62,7 +62,7 @@ class EXPORT_TDataSeriesICA TDataSeriesICA {
public:
/** a set of indices used for addressing a subset of the independend componsts
*/
- typedef CICAAnalysis::IndexSet IndexSet;
+ typedef CIndepCompAnalysis::IndexSet IndexSet;
/** a (shared) pointer to itself */
typedef typename Data::Pointer PData;
@@ -77,7 +77,7 @@ public:
*/
- TDataSeriesICA(const CICAAnalysisFactory& icatool, const std::vector<Data>& initializer, bool strip_mean);
+ TDataSeriesICA(const CIndepCompAnalysisFactory& icatool, const std::vector<Data>& initializer, bool strip_mean);
/** Runs the ICA
\param ncomponents retained components
@@ -163,12 +163,12 @@ public:
Set the ICA approach to either FICA_APPROACH_DEFL(default) or FICA_APPROACH_SYMM.
\param approach
*/
- void set_approach(CICAAnalysis::EApproach approach);
+ void set_approach(CIndepCompAnalysis::EApproach approach);
~TDataSeriesICA();
private:
- PICAAnalysis m_analysis;
+ PIndepCompAnalysis m_analysis;
typedef typename Data::dimsize_type dimsize_type;
dimsize_type m_size;
Data m_mean;
diff --git a/mia/core/icaanalysisbase.cc b/mia/core/icaanalysisbase.cc
deleted file mode 100644
index 4392080..0000000
--- a/mia/core/icaanalysisbase.cc
+++ /dev/null
@@ -1,36 +0,0 @@
-/* -*- mia-c++ -*-
- *
- * This file is part of MIA - a toolbox for medical image analysis
- * Copyright (c) Leipzig, Madrid 1999-2016 Gert Wollny
- *
- * 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/icaanalysisbase.hh>
-
-namespace mia {
-
-CICAAnalysis::~CICAAnalysis()
-{
-
-}
-
-CICAAnalysisFactory::~CICAAnalysisFactory()
-{
-
-}
-
-}
diff --git a/mia/core/icaanalysisbase.hh b/mia/core/icaanalysisbase.hh
deleted file mode 100644
index 20cac95..0000000
--- a/mia/core/icaanalysisbase.hh
+++ /dev/null
@@ -1,189 +0,0 @@
-/* -*- mia-c++ -*-
- *
- * This file is part of MIA - a toolbox for medical image analysis
- * Copyright (c) Leipzig, Madrid 1999-2016 Gert Wollny
- *
- * 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_ICAANALYSISBASE_HH
-#define mia_core_ICAANALYSISBASE_HH
-
-#include <memory>
-#include <set>
-#include <boost/concept/requires.hpp>
-#include <boost/concept_check.hpp>
-
-#include <mia/core/defines.hh>
-#include <mia/core/slopevector.hh>
-
-
-namespace mia {
-
-class EXPORT_CORE CICAAnalysis
-{
-public:
-
- /**
- Separation approach to be used.
- */
- enum EApproach {
- appr_defl, /**< Deflation approach - each component is extimated separately */
- appr_symm, /**< Symmetric approach thet estimates all components at the same time */
- appr_unknown
- };
-
- typedef std::unique_ptr<CICAAnalysis> Pointer;
-
- /// defines a set of indices used for mixing
- typedef std::set<unsigned int> IndexSet;
-
- virtual ~CICAAnalysis();
-
- /**
- Set on row of input data
- \tparam Iterator input data iterator, must follow the model of a forward iterator
- \param row index of the input slice
- \param begin start iterator of input data
- \param end end iterator of input data
- */
- template <class Iterator>
- BOOST_CONCEPT_REQUIRES(((::boost::ForwardIterator<Iterator>)),
- (void))
- set_row(unsigned row, Iterator begin, Iterator end);
-
-
- virtual void initialize(unsigned int series_length, unsigned int slice_size) = 0;
- /**
- Run the independed component analysis using the given numbers of components
- \param nica number of indentepended components
- \param guess initial guess for the ICA, pass an empty vector of you
- don't want to use this feature
- */
- virtual bool run(unsigned int nica, std::vector<std::vector<float> > guess) = 0;
-
- /// \returns the feature vector of \a row
- virtual std::vector<float> get_feature_row(unsigned int row)const = 0;
-
- /// \returns the mixing signal curve of the feature \a row
- virtual std::vector<float> get_mix_series(unsigned int row)const = 0;
-
- /// \returns the complete mixed signal at series index \a idx
- virtual std::vector<float> get_mix(unsigned int idx)const = 0;
-
- /** Evaluate an incomplete mixed signal. Here the features are given that are \a not to be used.
- \sa get_partial_mix
- \param idx series index
- \param skip a set of feature indices that will be skipped when evaluating the mix
- \returns the mixed signal
- */
- virtual std::vector<float> get_incomplete_mix(unsigned int idx, const IndexSet& skip)const = 0;
-
- /** Evaluate an incomplete mixed signal. Here the features are given that are \a used to create the mix.
- \sa get_incomplete_mix
- \param idx series index
- \param use the set of feature indices that will be used to evaluate the mix
- \returns an incolmplete mixed signal.
- */
- virtual std::vector<float> get_partial_mix(unsigned int idx, const IndexSet& use)const = 0;
-
- /** Evaluate a mix of the feature signals by adding and subtractig individual features.
- \param plus features o be added
- \param minus features to be subtracted
- \returns the feature mix
- */
- virtual std::vector<float> get_delta_feature(const IndexSet& plus, const IndexSet& minus)const = 0;
-
- /**
- Replace a mixing signal curve
- \param index of the curve to be replaced
- \param series new data for mixing curve
- */
- virtual void set_mixing_series(unsigned int index, const std::vector<float>& series) = 0;
-
- /// \returns a vector containing all mixing curves
- virtual CSlopeColumns get_mixing_curves() const = 0;
-
- /**
- Normalize the ICs in the following manner:
- * Scale and shift the range of the ICs to [-1, 1]
- * Scale the mixing curved to compensate for the required scaling
- * move the means of the time points to compensate for the shifting.
- */
- virtual void normalize_ICs() = 0;
-
- /**
- Normalize the mixing curves to have a zero mean. As a result a mean image is created that
- containes the sum of the ICs weighted by the required mean shift.
-
- */
- virtual std::vector<float> normalize_Mix() = 0;
-
-
- /// \returns the number of actual ICs
- virtual unsigned int get_ncomponents() const = 0;
-
- /**
- sets the number of iterations in the ICA
- \param n
- */
- virtual void set_max_iterations(int n) = 0;
-
- /**
- Set the ICA approach to either FICA_APPROACH_DEFL(default) or FICA_APPROACH_SYMM.
- \param approach
- */
- virtual void set_approach(EApproach approach) = 0;
-private:
- virtual void set_row_internal(unsigned row, const std::vector<double>& buffer, double mean) = 0;
-
-};
-
-typedef CICAAnalysis::Pointer PICAAnalysis;
-
-
-class EXPORT_CORE CICAAnalysisFactory {
-public:
- virtual ~CICAAnalysisFactory();
- virtual PICAAnalysis create() const = 0;
-};
-
-
-typedef std::shared_ptr<CICAAnalysisFactory> PICAAnalysisFactory;
-
-/// \cond DOXYGEN_DOESNT_UNDERSTAND_BOOST_CONCEPT_REQUIRES
-template <class Iterator>
-BOOST_CONCEPT_REQUIRES(((::boost::ForwardIterator<Iterator>)),
- (void))
-CICAAnalysis::set_row(unsigned row, Iterator begin, Iterator end)
-{
- const unsigned int length = std::distance(begin, end);
- std::vector<double> buffer(length);
- unsigned int idx = 0;
- double mean = 0.0;
-
- while (begin != end)
- mean += (buffer[idx++] = *begin++);
- mean /= length;
- for(unsigned int i = 0; i < length; ++i)
- buffer[i] -= mean;
- set_row_internal(row, buffer, mean);
-}
-/// \endcond
-
-}
-
-#endif // CICAANALYSISBASE_HH
diff --git a/mia/core/import_handler.hh b/mia/core/import_handler.hh
index b831f4e..0e12fc1 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 e57ca1b..8f93d51 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 97af55f..0c7dac8 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,7 +39,7 @@ class EXPORT_CORE CCircularIndex {
public:
/**
Construct the buffer
- \param size size ofthe buffer
+ \param size size of the buffer
\param start start index
*/
CCircularIndex(unsigned int size, unsigned int start);
diff --git a/mia/core/info.cc b/mia/core/info.cc
index 54a6c7b..8b01959 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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-2016 Leipzig, Germany and Madrid, Spain \n"
+ " (c) 1999-2017 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 2e04344..fe807c4 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,17 +75,15 @@ C1DInterpolatorFactory::~C1DInterpolatorFactory()
template class T1DConvoluteInterpolator<TYPE>
INSTANCIATE_INTERPOLATORS(bool);
-INSTANCIATE_INTERPOLATORS(unsigned char);
-INSTANCIATE_INTERPOLATORS(signed char);
-INSTANCIATE_INTERPOLATORS(unsigned short);
-INSTANCIATE_INTERPOLATORS(signed short);
-INSTANCIATE_INTERPOLATORS(unsigned int);
-INSTANCIATE_INTERPOLATORS(signed int);
+INSTANCIATE_INTERPOLATORS(uint8_t);
+INSTANCIATE_INTERPOLATORS(int8_t);
+INSTANCIATE_INTERPOLATORS(uint16_t);
+INSTANCIATE_INTERPOLATORS(int16_t);
+INSTANCIATE_INTERPOLATORS(int32_t);
+INSTANCIATE_INTERPOLATORS(uint32_t);
INSTANCIATE_INTERPOLATORS(float);
INSTANCIATE_INTERPOLATORS(double);
-#ifdef LONG_64BIT
-INSTANCIATE_INTERPOLATORS(unsigned long);
-INSTANCIATE_INTERPOLATORS(signed long);
-#endif
+INSTANCIATE_INTERPOLATORS(uint64_t);
+INSTANCIATE_INTERPOLATORS(int64_t);
NS_MIA_END
diff --git a/mia/core/interpolator1d.cxx b/mia/core/interpolator1d.cxx
index 8cbd131..408462e 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 04a6c7e..3224235 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 2a18dd3..a6ada3f 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 0f5dae2..4b37656 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 764b272..6df1302 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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.hh b/mia/core/iohandler.hh
index 4c3511d..69dcc86 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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 @@ public:
/// the IO interface provided by this handler
typedef typename TPluginHandler<I>::Interface Interface;
- /// an iterator over the availabe plug-ins
+ /// an iterator over the available plug-ins
typedef typename TPluginHandler<I>::const_iterator const_iterator;
/// The map that maps file name suffixes to IO plug-ins
diff --git a/mia/core/ioplugin.cc b/mia/core/ioplugin.cc
index 182e7d4..1db1eb5 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 6fe4239..244dc6b 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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 <iostream>
#include <mia/core/plugin_base.cxx>
+#include <mia/core/xmlinterface.hh>
NS_MIA_BEGIN
diff --git a/mia/core/ioplugin.hh b/mia/core/ioplugin.hh
index 2c87481..ed04d04 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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.cc b/mia/core/kmeans.cc
index 253531b..318e161 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 073fe55..3f4edb8 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 94f1090..d441ac2 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 0797212..020ab4b 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 6ddd203..57f07ec 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 67c65af..5fc966f 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 6d23239..cc1ea15 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 3d35c52..3fd3a5d 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,7 +89,7 @@ int CGDSAMinimizer::do_run(CDoubleVector& x)
if (f < f_old) {
- cvinfo() << "Successfull step: [" << iter << "]: f=" << f
+ cvinfo() << "Successful step: [" << iter << "]: f=" << f
<< ", gmax = " << gmax << ", step=" << step << "\n";
tries = 0;
@@ -140,7 +140,7 @@ int CGDSAMinimizer::do_run(CDoubleVector& x)
cvmsg() << "Stop: dx below given limit\n";
if (success & SUCCESS_FTOLR)
- cvmsg() << "Stop: relative cost funtion value decrease below limit "<< m_ftolr << ".\n";
+ cvmsg() << "Stop: relative cost function value decrease below limit "<< m_ftolr << ".\n";
return CMinimizer::success;
}
diff --git a/mia/core/minimizer/gdas.hh b/mia/core/minimizer/gdas.hh
index a46ebb0..40f63cd 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 04c2c5e..ab884f9 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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.hh b/mia/core/minimizer/gdsq.hh
index de8c7f4..d21eade 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 ce03afa..1c6eb8b 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -277,7 +277,7 @@ CGSLMinimizerPlugin::CGSLMinimizerPlugin():
const std::string CGSLMinimizerPlugin::do_get_descr() const
{
- return "optimizer plugin based on the multimin optimizers of"
+ return "optimizer plugin based on the multimin optimizers of "
"the GNU Scientific Library (GSL) https://www.gnu.org/software/gsl/";
}
diff --git a/mia/core/minimizer/gsl.hh b/mia/core/minimizer/gsl.hh
index 56a15b1..3237c49 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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_gdas.cc b/mia/core/minimizer/test_gdas.cc
index bb33db3..da6d890 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 c530b29..5b73187 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 e047bf9..cfade20 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 d250298..c5e5cf5 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 63cb1ff..0549679 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 d0e8a4f..101ab72 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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.hh b/mia/core/module.hh
index a2a2c9a..d2653c7 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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.cc b/mia/core/msgstream.cc
index 37ebb79..f5775c4 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 3ebb4be..10e3268 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 eabeacd..64c29ef 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 d43814a..032f8b7 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 2f33894..c11114b 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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.hh b/mia/core/noise/gauss.hh
index 9aeb746..a7c6e23 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 3344518..21ce92c 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 8f4da4b..2dd7503 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 3146468..7526284 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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.hh b/mia/core/noise/uniform.hh
index dd21eb8..9a68207 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 2ed8596..4066156 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 1b5d205..8fd0829 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 2214844..f13a30a 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 a3e334f..b1710f3 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 d7870ea..a86e758 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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 <mia/core/optparam.hh>
#include <mia/core/tools.hh>
+#include <mia/core/xmlinterface.hh>
NS_MIA_BEGIN
diff --git a/mia/core/optparam.hh b/mia/core/optparam.hh
index 10d07fc..5931a45 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,11 @@
#include <mia/core/parameter.hh>
#include <mia/core/optionparser.hh>
-#include <mia/core/xmlinterface.hh>
-
NS_MIA_BEGIN
+class CXMLElement;
+
/**
\ingroup cmdline
\brief A class to hold a list of named parameters.
diff --git a/mia/core/parallel.hh b/mia/core/parallel.hh
index 66b4763..57defa3 100644
--- a/mia/core/parallel.hh
+++ b/mia/core/parallel.hh
@@ -1,7 +1,7 @@
/* -*- mia-c++ -*-
*
* This file is part of MIA - a toolbox for medical image analysis
- * Copyright (c) Leipzig, Madrid 1999-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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/parallelcxx11.cc b/mia/core/parallelcxx11.cc
index 8b36fb2..8019159 100644
--- a/mia/core/parallelcxx11.cc
+++ b/mia/core/parallelcxx11.cc
@@ -1,7 +1,7 @@
/* -*- mia-c++ -*-
*
* This file is part of MIA - a toolbox for medical image analysis
- * Copyright (c) Leipzig, Madrid 1999-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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/parallelcxx11.hh b/mia/core/parallelcxx11.hh
index c5354a3..d869b13 100644
--- a/mia/core/parallelcxx11.hh
+++ b/mia/core/parallelcxx11.hh
@@ -1,7 +1,7 @@
/* -*- mia-c++ -*-
*
* This file is part of MIA - a toolbox for medical image analysis
- * Copyright (c) Leipzig, Madrid 1999-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,6 +52,10 @@ public:
m_mutex.lock();
own_lock = true;
};
+
+ TScopedLock(const TScopedLock<Mutex>& other) = delete;
+ TScopedLock& operator = (const TScopedLock<Mutex>& other) = delete;
+
~TScopedLock(){
if (own_lock)
m_mutex.unlock();
@@ -122,6 +126,9 @@ private:
std::atomic<int> m_current_wp;
};
+// The functor f must actually be passed by value because a copy must
+// be used.
+//coverity[PASS_BY_VALUE]
template <typename Range, typename Func>
void pfor_callback(Range& range, Func f)
{
@@ -135,7 +142,7 @@ void pfor_callback(Range& range, Func f)
}
template <typename Range, typename Func>
-void pfor(Range range, Func f) {
+void pfor(Range range, const Func& f) {
int max_treads = CMaxTasks::get_max_tasks();
@@ -176,6 +183,9 @@ private:
Value value;
};
+// The functor f must actually be passed by value because a copy must
+// be used.
+//coverity[PASS_BY_VALUE]
template <typename Range, typename Value, typename Func, typename Reduce>
void preduce_callback(Range& range, ReduceValue<Value>& v, Func f, Reduce r)
{
@@ -191,7 +201,7 @@ void preduce_callback(Range& range, ReduceValue<Value>& v, Func f, Reduce r)
}
template <typename Range, typename Value, typename Func, typename Reduce>
-Value preduce(Range range, Value identity, Func f, Reduce r)
+Value preduce(Range range, Value identity, const Func& f, Reduce r)
{
int max_treads = CMaxTasks::get_max_tasks();
diff --git a/mia/core/paramarray.hh b/mia/core/paramarray.hh
new file mode 100644
index 0000000..d8b54cd
--- /dev/null
+++ b/mia/core/paramarray.hh
@@ -0,0 +1,90 @@
+/* -*- mia-c++ -*-
+ *
+ * This file is part of MIA - a toolbox for medical image analysis
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
+ *
+ * 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_paramarray_hh
+#define mia_core_paramarray_hh
+
+#include <mia/core/cmdlineparser.hh>
+
+#include <cassert>
+
+namespace mia {
+
+template <typename T>
+class TPerLevelScalarParam {
+public:
+ TPerLevelScalarParam(T default_value);
+
+ PCmdOption create_level_params_option(const char* long_name,
+ char short_name,
+ EParameterBounds flags,
+ const std::vector<T>& boundaries,
+ const char* help);
+
+ PCmdOption create_level_params_option(const char* long_name,
+ char short_name,
+ const char* help);
+
+
+ T operator [](unsigned l)const;
+private:
+ std::vector<T> m_params;
+ T m_default_value;
+};
+
+template <typename T>
+TPerLevelScalarParam<T>::TPerLevelScalarParam(T default_value):
+ m_default_value(default_value)
+{
+}
+
+template <typename T>
+PCmdOption TPerLevelScalarParam<T>::create_level_params_option(const char* long_opt,
+ char short_opt,
+ EParameterBounds bflags,
+ const std::vector<T>& boundaries,
+ const char* help)
+{
+ return PCmdOption(new CParamOption( short_opt, long_opt,
+ new TBoundedParameter<std::vector<T> >(m_params, bflags,
+ boundaries, false, help)));
+}
+
+template <typename T>
+PCmdOption TPerLevelScalarParam<T>::create_level_params_option(const char* long_opt,
+ char short_opt,
+ const char* help)
+{
+ return PCmdOption(new CParamOption( short_opt, long_opt,
+ new CTParameter<std::vector<T> >(m_params, false, help)));
+}
+
+template <typename T>
+T TPerLevelScalarParam<T>::operator [](unsigned l) const
+{
+ if (m_params.empty())
+ return m_default_value;
+ return l < m_params.size() ? m_params[l] : m_params[m_params.size() - 1];
+}
+
+
+} // namespace mia
+
+#endif
diff --git a/mia/core/parameter.cc b/mia/core/parameter.cc
index 902a26e..d7bfca9 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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 @@ void CParameter::reset()
const char *CParameter::type() const
{
- return m_type;
+ return m_type.c_str();
}
void CParameter::get_help_xml(CXMLElement& param) const
@@ -56,7 +56,6 @@ void CParameter::get_help_xml(CXMLElement& param) const
TRACE_FUNCTION;
param.set_attribute("type", m_type);
param.set_attribute("default", get_default_value());
- ostringstream d;
param.set_child_text(m_descr);
do_get_help_xml(param);
if (m_is_required) {
@@ -130,14 +129,37 @@ std::string CParameter::get_default_value() const
return do_get_default_value();
}
+CXMLElement& CParameter::add_xmlhelp_childnode(CXMLElement& parent, const std::string& tag)const
+{
+ auto child = parent.add_child(tag.c_str());
+ return *child;
+}
+
+void CParameter::add_xmlhelp_attribute(CXMLElement& node, const std::string& tag, const std::string& value)const
+{
+ node.set_attribute(tag.c_str(), value);
+}
+
+void CParameter::add_xmlhelp_text(CXMLElement& node, const std::string& value)const
+{
+ node.set_child_text(value);
+}
+
CStringParameter::CStringParameter(std::string& value,CCmdOptionFlags flags , const char *descr,
const CPluginHandlerBase *plugin_hint):
- CParameter(__type_descr<std::string>::value, has_flag(flags, CCmdOptionFlags::required), descr),
+ CParameter(plugin_hint ?
+ plugin_hint->get_handler_type_string().c_str():
+ __type_descr<std::string>::value,
+ has_flag(flags, CCmdOptionFlags::required), descr),
m_value(value),
m_default_value(value),
m_flags(flags),
m_plugin_hint(plugin_hint)
{
+ if (plugin_hint) {
+ cvdebug() << "plugin_hint->get_handler_type_string()=" << plugin_hint->get_handler_type_string() << "\n";
+ cvdebug() << "Reported type = " << type() << "\n";
+ }
}
void CStringParameter::do_reset()
@@ -199,19 +221,19 @@ void CStringParameter::do_add_dependend_handler(HandlerHelpMap& handler_map)cons
template <typename T>
TBoundedParameter<T>::TBoundedParameter(T& value, EParameterBounds flags,
- const vector<T>& boundaries,
+ const vector<boundary_type>& 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_min(boundary_type()),
+ m_max(boundary_type()),
m_flags(flags)
{
assert(!boundaries.empty());
unsigned idx = 0;
-
+
if (has_flag(flags, EParameterBounds::bf_min)) {
- m_min = boundaries[0];
+ m_min = boundaries[idx];
++idx;
}
if (has_flag(flags, EParameterBounds::bf_max)) {
@@ -220,30 +242,49 @@ TBoundedParameter<T>::TBoundedParameter(T& value, EParameterBounds flags,
}
}
-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);
+template <typename T>
+struct __adjust_param {
+ static void test_boundaries(EParameterBounds flags, T value, T minval, T maxval,
+ const std::string& descr, int idx) {
+ if (has_flag(flags, EParameterBounds::bf_min_closed)&& value < minval) {
+ throw create_exception<invalid_argument>("Parameters value[", idx, "]=", value, " given, but ",
+ "expected a value >= ", minval, ". Parameter is ",
+ descr, " flags=", flags);
+ }
+ if (has_flag(flags, EParameterBounds::bf_min_open) && value <= minval) {
+ throw create_exception<invalid_argument>("Parameters value[", idx, "]=", value, " given, but ",
+ "expected a value > ", minval, ". Parameter is ",
+ descr, " flags=", flags);
+ }
+
+ if (has_flag(flags, EParameterBounds::bf_max_closed)&& value > maxval) {
+ throw create_exception<invalid_argument>("Parameters value[", idx, "]=", value, " given, but ",
+ "expected a value <= ", maxval, ". Parameter is ",
+ descr, " flags=", flags);
+ }
+ if (has_flag(flags, EParameterBounds::bf_max_open) && value >= maxval) {
+ throw create_exception<invalid_argument>("Parameters value[", idx, "]=", value, " given, but "
+ "expected a value < ", maxval, ". Parameter is ",
+ descr, " flags=", 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);
+};
+
+template <typename T>
+struct __adjust_param< std::vector<T> > {
+ static void test_boundaries(EParameterBounds flags, const std::vector<T>& value, T minval, T maxval,
+ const std::string& descr, int MIA_PARAM_UNUSED(idx)) {
+ for(unsigned i = 0; i < value.size(); ++i) {
+ __adjust_param<T>::test_boundaries(flags, value[i], minval, maxval, descr, i);
+ }
}
+};
- 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>::adjust(T& value)
+{
+ __adjust_param<T>::test_boundaries(m_flags, value, m_min, m_max, this->get_descr(), 0);
}
template <typename T>
@@ -320,27 +361,45 @@ EXPORT_CORE std::ostream& operator << (std::ostream& os, EParameterBounds flags)
-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<uint16_t>;
+template class TBoundedParameter<uint32_t>;
+template class TBoundedParameter<uint64_t>;
+template class TBoundedParameter<int16_t>;
+template class TBoundedParameter<int32_t>;
+template class TBoundedParameter<int64_t>;
template class TBoundedParameter<float>;
template class TBoundedParameter<double>;
-
-template class CTParameter<unsigned short>;
-template class CTParameter<unsigned int>;
-template class CTParameter<unsigned long>;
-template class CTParameter<short>;
-template class CTParameter<int>;
-template class CTParameter<long>;
+template class TBoundedParameter<vector<uint16_t>>;
+template class TBoundedParameter<vector<uint32_t>>;
+template class TBoundedParameter<vector<uint64_t>>;
+template class TBoundedParameter<vector<int16_t>>;
+template class TBoundedParameter<vector<int32_t>>;
+template class TBoundedParameter<vector<int64_t>>;
+template class TBoundedParameter<vector<float>>;
+template class TBoundedParameter<vector<double>>;
+
+
+template class CTParameter<uint16_t>;
+template class CTParameter<uint32_t>;
+template class CTParameter<uint64_t>;
+template class CTParameter<int16_t>;
+template class CTParameter<int32_t>;
+template class CTParameter<int64_t>;
template class CTParameter<float>;
template class CTParameter<double>;
-
template class CTParameter<string>;
template class CTParameter<bool>;
+template class CTParameter<vector<uint16_t>>;
+template class CTParameter<vector<uint32_t>>;
+template class CTParameter<vector<uint64_t>>;
+template class CTParameter<vector<int16_t>>;
+template class CTParameter<vector<int32_t>>;
+template class CTParameter<vector<int64_t>>;
+template class CTParameter<vector<float>>;
+template class CTParameter<vector<double>>;
+template class CTParameter<vector<string>>;
+
NS_MIA_END
diff --git a/mia/core/parameter.cxx b/mia/core/parameter.cxx
index a25fc96..f174bb3 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,7 @@ 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) {
+ assert(!str_value.empty());
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) {
@@ -83,7 +84,7 @@ struct __dispatch_parameter_do_set {
template <typename T>
struct __dispatch_parameter_do_set<std::vector<T> > {
static bool apply (const std::string& str_value, std::vector<T>& value) {
-
+ assert(!str_value.empty());
std::string h(str_value);
unsigned int n = 1;
@@ -107,7 +108,7 @@ struct __dispatch_parameter_do_set<std::vector<T> > {
std::istringstream sval(h);
auto i = value.begin();
- while (!sval.eof()) {
+ while (sval.good()) {
sval >> *i;
++i;
}
@@ -118,12 +119,12 @@ struct __dispatch_parameter_do_set<std::vector<T> > {
template <>
struct __dispatch_parameter_do_set<std::string> {
static bool apply (const std::string& str_value, std::string& value) {
+ assert(!str_value.empty());
value = str_value;
return true;
}
};
-
template <typename T>
bool CTParameter<T>::do_set(const std::string& str_value)
{
diff --git a/mia/core/parameter.hh b/mia/core/parameter.hh
index 0bb48e0..b441604 100644
--- a/mia/core/parameter.hh
+++ b/mia/core/parameter.hh
@@ -1,7 +1,7 @@
/* -*- mia-c++ -*-
*
* This file is part of MIA - a toolbox for medical image analysis
- * Copyright (c) Leipzig, Madrid 1999-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Pub
@@ -134,6 +134,11 @@ protected:
/// create an error message by using the given value that raises the error
const std::string errmsg(const std::string& err_value) const;
+
+ CXMLElement& add_xmlhelp_childnode(CXMLElement& parent, const std::string& tag) const;
+ void add_xmlhelp_attribute(CXMLElement& node, const std::string& tag, const std::string& value)const;
+ void add_xmlhelp_text(CXMLElement& node, const std::string& value)const;
+
private:
/** the actual (abstract) function to set the parameter that needs to be overwritten
\param str_value the parameter value as string
@@ -144,9 +149,10 @@ private:
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(CXMLElement& self) const;
+
bool m_required;
bool m_is_required;
- const char *m_type;
+ const std::string m_type;
const char *m_descr;
};
@@ -206,6 +212,7 @@ private:
*/
enum class EParameterBounds : int {
+ bf_none = 0,
bf_min = 1,
bf_min_open = 3,
bf_min_closed = 5,
@@ -227,7 +234,19 @@ template <typename T>
class EXPORT_CORE TBoundedParameter : public CTParameter<T> {
public:
+ template <typename S>
+ struct boundary {
+ typedef S value_type;
+ };
+
+ template <typename S>
+ struct boundary<std::vector<S>> {
+ typedef S value_type;
+ };
+
+ typedef typename boundary<T>::value_type boundary_type;
+
/** Constructor
\param value reference to the parameter handled by this parameter object
\param flags boundary flags
@@ -238,17 +257,19 @@ public:
\param required set to \a true if the parameter has to be set by the user
\param descr a description of the parameter
*/
- TBoundedParameter(T& value, EParameterBounds flags, const std::vector<T>& boundaries, bool required, const char *descr);
+ TBoundedParameter(T& value, EParameterBounds flags, const std::vector<boundary_type>& boundaries,
+ bool required, const char *descr);
protected:
/**
the implementation of the description-function
*/
void do_descr(std::ostream& os) const;
private:
+
virtual void adjust(T& value);
virtual void do_get_help_xml(CXMLElement& self) const;
- T m_min;
- T m_max;
+ boundary_type m_min;
+ boundary_type m_max;
EParameterBounds m_flags;
};
@@ -533,24 +554,44 @@ typedef CTParameter<bool> CBoolParameter;
/// an unsigned short parameter (with possible boundaries)
-typedef TBoundedParameter<unsigned short> CUSBoundedParameter;
+typedef TBoundedParameter<uint16_t> CUSBoundedParameter;
/// an unsigned int parameter (with possible boundaries)
-typedef TBoundedParameter<unsigned int> CUIBoundedParameter;
+typedef TBoundedParameter<uint32_t> CUIBoundedParameter;
/// an unsigned long parameter (with possible boundaries)
-typedef TBoundedParameter<unsigned long> CULBoundedParameter;
+typedef TBoundedParameter<uint64_t> CULBoundedParameter;
/// an signed short parameter (with possible boundaries)
-typedef TBoundedParameter<short> CSSBoundedParameter;
+typedef TBoundedParameter<int16_t> CSSBoundedParameter;
/// an signed int parameter (with possible boundaries)
-typedef TBoundedParameter<int> CSIBoundedParameter;
+typedef TBoundedParameter<int32_t> CSIBoundedParameter;
/// an signed long parameter (with possible boundaries)
-typedef TBoundedParameter<long> CSLBoundedParameter;
+typedef TBoundedParameter<int64_t> 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;
+/// an unsigned short parameter (with possible boundaries)
+typedef TBoundedParameter<std::vector<uint16_t>> CVUSBoundedParameter;
+/// an unsigned int parameter (with possible boundaries)
+typedef TBoundedParameter<std::vector<uint32_t>> CVUIBoundedParameter;
+/// an unsigned long parameter (with possible boundaries)
+typedef TBoundedParameter<std::vector<uint64_t>> CVULBoundedParameter;
+
+/// an signed short parameter (with possible boundaries)
+typedef TBoundedParameter<std::vector<int16_t>> CVSSBoundedParameter;
+/// an signed int parameter (with possible boundaries)
+typedef TBoundedParameter<std::vector<int32_t>> CVSIBoundedParameter;
+/// an signed long parameter (with possible boundaries)
+typedef TBoundedParameter<std::vector<int64_t>> CVSLBoundedParameter;
+
+/// an float parameter, single accuracy (with possible boundaries)
+typedef TBoundedParameter<std::vector<float>> CVFBoundedParameter;
+/// an float parameter, double accuracy (with possible boundaries)
+typedef TBoundedParameter<std::vector<double>> CVDBoundedParameter;
+
+
/**
\ingroup cmdline
\brief create a factory parameter that initializes to a std::shared_ptr
@@ -650,11 +691,12 @@ template <typename T>
void CDictParameter<T>::do_get_help_xml(CXMLElement& self) const
{
TRACE_FUNCTION;
- auto dict = self.add_child("dict");
+ auto& dict = this->add_xmlhelp_childnode(self, "dict");
for (auto i = m_dict.get_help_begin(); i != m_dict.get_help_end(); ++i) {
- auto v = dict->add_child("value");
- v->set_attribute("name", i->second.first);
- v->set_child_text(i->second.second);
+
+ auto& v = this->add_xmlhelp_childnode(dict, "value");
+ this->add_xmlhelp_attribute(v, "name", i->second.first);
+ this->add_xmlhelp_text(v, i->second.second);
}
}
@@ -718,8 +760,8 @@ void TFactoryParameter<T>::do_descr(std::ostream& os) const
template <typename T>
void TFactoryParameter<T>::do_get_help_xml(CXMLElement& self) const
{
- auto dict = self.add_child("factory");
- dict->set_attribute("name", T::instance().get_descriptor());
+ auto& node = this->add_xmlhelp_childnode(self, "factory");
+ this->add_xmlhelp_attribute(node, "name", T::instance().get_descriptor());
}
template <typename T>
@@ -816,10 +858,10 @@ void CSetParameter<T>::do_descr(std::ostream& os) const
template <typename T>
void CSetParameter<T>::do_get_help_xml(CXMLElement& self) const
{
- auto set = self.add_child("set");
+ auto& node = this->add_xmlhelp_childnode(self, "set");
for (auto i = m_valid_set.begin(); i != m_valid_set.end(); ++i) {
- auto v = set->add_child("value");
- v->set_attribute("name", __dispatch_param_translate<T>::apply(*i));
+ auto& v = this->add_xmlhelp_childnode(node, "value");
+ this->add_xmlhelp_attribute(v, "name", __dispatch_param_translate<T>::apply(*i));
}
}
@@ -896,7 +938,31 @@ std::string TParameter<T>::do_get_value_as_string() const
return __dispatch_param_translate<T>::apply(m_value);
}
+/// @cond never
+extern template class EXPORT_CORE TBoundedParameter<uint16_t>;
+extern template class EXPORT_CORE TBoundedParameter<uint32_t>;
+extern template class EXPORT_CORE TBoundedParameter<uint64_t>;
+extern template class EXPORT_CORE TBoundedParameter<int16_t>;
+extern template class EXPORT_CORE TBoundedParameter<int32_t>;
+extern template class EXPORT_CORE TBoundedParameter<int64_t>;
+extern template class EXPORT_CORE TBoundedParameter<float>;
+extern template class EXPORT_CORE TBoundedParameter<double>;
+
+extern template class EXPORT_CORE TBoundedParameter<std::vector<uint16_t> >;
+extern template class EXPORT_CORE TBoundedParameter<std::vector<uint32_t> >;
+extern template class EXPORT_CORE TBoundedParameter<std::vector<uint64_t> >;
+extern template class EXPORT_CORE TBoundedParameter<std::vector<int16_t> >;
+extern template class EXPORT_CORE TBoundedParameter<std::vector<int32_t> >;
+extern template class EXPORT_CORE TBoundedParameter<std::vector<int64_t> >;
+extern template class EXPORT_CORE TBoundedParameter<std::vector<float> >;
+extern template class EXPORT_CORE TBoundedParameter<std::vector<double> >;
+
+extern template class EXPORT_CORE CTParameter<std::vector<std::string> >;
+
+extern template class EXPORT_CORE CTParameter<std::string>;
+extern template class EXPORT_CORE CTParameter<bool>;
+/// @endcond never
NS_MIA_END
#endif
diff --git a/mia/core/paramoption.cc b/mia/core/paramoption.cc
index ae394b3..49252db 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,11 +63,11 @@ void CParamOption::do_post_set()
m_param->post_set();
}
-void CParamOption::do_get_long_help_xml(std::ostream& os, CXMLElement& parent, HandlerHelpMap& handler_map) const
+void CParamOption::do_get_long_help_xml(std::ostream& MIA_PARAM_UNUSED(os),
+ CXMLElement& parent, HandlerHelpMap& handler_map) const
{
m_param->add_dependend_handler(handler_map);
m_param->get_help_xml(parent);
- os << m_param->get_descr();
}
NS_MIA_END
diff --git a/mia/core/paramoption.hh b/mia/core/paramoption.hh
index a62536e..8b29f9b 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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/paramtranslator.cc b/mia/core/paramtranslator.cc
index d0f5741..42b6f64 100644
--- a/mia/core/paramtranslator.cc
+++ b/mia/core/paramtranslator.cc
@@ -1,7 +1,7 @@
/* -*- mia-c++ -*-
*
* This file is part of MIA - a toolbox for medical image analysis
- * Copyright (c) Leipzig, Madrid 1999-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,6 +19,7 @@
*/
#include <mia/core/paramtranslator.hh>
+#include <mia/core/xmlinterface.hh>
NS_MIA_BEGIN
using std::invalid_argument;
diff --git a/mia/core/paramtranslator.hh b/mia/core/paramtranslator.hh
index ada94e4..c46aa39 100644
--- a/mia/core/paramtranslator.hh
+++ b/mia/core/paramtranslator.hh
@@ -1,7 +1,7 @@
/* -*- mia-c++ -*-
*
* This file is part of MIA - a toolbox for medical image analysis
- * Copyright (c) Leipzig, Madrid 1999-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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/pixeltype.cc b/mia/core/pixeltype.cc
index cda80cd..affb0c9 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,10 +29,8 @@ const TDictMap<EPixelType>::Table PixelTypeTable[] = {
{"ushort",it_ushort, "unsigned 16 bit"},
{"sint", it_sint, "signed 32 bit"},
{"uint", it_uint, "unsigned 32 bit"},
-#ifdef LONG_64BIT
{"slong", it_slong, "signed 64 bit"},
{"ulong", it_ulong, "unsigned 64 bit"},
-#endif
{"float", it_float, "floating point 32 bit"},
{"double",it_double, "floating point 64 bit"},
{"none", it_none, "no pixel type defined"},
diff --git a/mia/core/pixeltype.hh b/mia/core/pixeltype.hh
index f3e8c83..92f748b 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,8 @@ enum EPixelType {it_bit, /**< bit/bool pixels */
it_ushort, /**< unsigned short pixels (16-bit) */
it_sint, /**< signed int pixels (32-bit)*/
it_uint, /**< unsigned int pixels (32-bit)*/
-#ifdef LONG_64BIT
it_slong, /**< signed long pixels (64 bit)*/
it_ulong, /**< unsigned long pixels (64 bit) */
-#endif
it_float, /**< float pixels (32 bit)*/
it_double, /**< double pixels (63 bit)*/
it_none, /**< type not set */
@@ -89,46 +87,44 @@ struct pixel_type<bool> {
};
template <>
-struct pixel_type<signed char> {
+struct pixel_type<int8_t> {
static const EPixelType value = it_sbyte;
};
template <>
-struct pixel_type<unsigned char> {
+struct pixel_type<uint8_t> {
static const EPixelType value = it_ubyte;
};
template <>
-struct pixel_type<signed short> {
+struct pixel_type<int16_t> {
static const EPixelType value = it_sshort;
};
template <>
-struct pixel_type<unsigned short> {
+struct pixel_type<uint16_t> {
static const EPixelType value = it_ushort;
};
template <>
-struct pixel_type<signed int> {
+struct pixel_type<int32_t> {
static const EPixelType value = it_sint;
};
template <>
-struct pixel_type<unsigned int> {
+struct pixel_type<uint32_t> {
static const EPixelType value = it_uint;
};
-#ifdef LONG_64BIT
template <>
-struct pixel_type<signed long> {
+struct pixel_type<int64_t> {
static const EPixelType value = it_slong;
};
template <>
-struct pixel_type<unsigned long> {
+struct pixel_type<uint64_t> {
static const EPixelType value = it_ulong;
};
-#endif
template <>
struct pixel_type<float> {
diff --git a/mia/core/plugin_base.cc b/mia/core/plugin_base.cc
index f0f52b3..1a87f41 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,7 +116,7 @@ const char *g_plugin_root = nullptr;
PrepareTestPluginPath::PrepareTestPluginPath()
{
- g_plugin_root = MIA_BUILD_ROOT "/plugintest/" PLUGIN_INSTALL_PATH;
+ g_plugin_root = MIA_BUILD_ROOT "/plugintest/";
}
PrepareTestPluginPath::~PrepareTestPluginPath()
diff --git a/mia/core/plugin_base.cxx b/mia/core/plugin_base.cxx
index 43dbc85..056d169 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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.hh b/mia/core/plugin_base.hh
index 5bfb922..c3f8aed 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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_test.cc b/mia/core/plugin_test.cc
index c122502..2360479 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 d8a7d3a..a1986b5 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 b1efd87..020683b 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 d4d01ff..f4d898b 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 f18db04..3facffd 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 c42fcb4..1172786 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 55329e5..b4ed2f3 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 b471141..ff584b7 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 9e44509..a4038d4 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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 @@ public:
bool has_all_in(const CPropertyFlagHolder& testset)const;
/**
- Evalaute the set of properties that is availabe in the testset but not in this one
+ Evalaute the set of properties that is available in the testset but not in this one
@param testset
@return set of missing flags
*/
diff --git a/mia/core/pwh.cc b/mia/core/pwh.cc
index 7da7fa0..0719e52 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 2634df0..d7bee8a 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 42640fa..d47d020 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 e3e38c8..6bf65aa 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 0f5b0a0..375cec2 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 a7c2042..d09a394 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 ea9a1cb..7a4cae8 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 4a07f19..448524a 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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
index 9ddb14f..116554f 100644
--- a/mia/core/searchpath.cc
+++ b/mia/core/searchpath.cc
@@ -1,7 +1,7 @@
/* -*- mia-c++ -*-
*
* This file is part of MIA - a toolbox for medical image analysis
- * Copyright (c) Leipzig, Madrid 1999-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,19 +17,31 @@
* along with MIA; if not, see <http://www.gnu.org/licenses/>.
*
*/
+#include <mia/core/searchpath.hh>
+#include <mia/core/msgstream.hh>
+
#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>
+#ifdef MIA_USE_BOOST_REGEX
+#include <boost/regex.hpp>
+using boost::regex;
+using boost::regex_match;
+#else
+# if __cplusplus >= 201103
+# include <regex>
+using std::regex;
+using std::regex_match;
+# else
+# error must either use boost::regex or c++11 based regex
+# endif
+#endif
+
NS_MIA_BEGIN
@@ -115,7 +127,8 @@ std::vector<PPluginModule> CPluginSearchpath::find_modules(const std::string& da
std::stringstream pattern;
pattern << ".*\\."<< MIA_MODULE_SUFFIX << "$";
- boost::regex pat_expr(pattern.str());
+
+ regex pat_expr(pattern.str());
std::vector<PPluginModule> result;
@@ -138,7 +151,7 @@ std::vector<PPluginModule> CPluginSearchpath::find_modules(const std::string& da
while (di != dend) {
cvdebug() << " candidate:'" << di->path().string() << "'";
- if (boost::regex_match(di->path().string(), pat_expr)) {
+ if (regex_match(di->path().string(), pat_expr)) {
candidates.push_back(*di);
cverb << " add\n";
}else
diff --git a/mia/core/searchpath.hh b/mia/core/searchpath.hh
index 89ff26f..08a015d 100644
--- a/mia/core/searchpath.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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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.cc b/mia/core/selftestcmdoption.cc
index e18fffc..1ba4944 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 382f9c8..5a1a5eb 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 a36946f..524ea79 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 2df8a31..019cbd7 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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.cc b/mia/core/shape.cc
index 4fe1964..ec740cc 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 c070fd9..c1b44de 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 72737f6..1cf1c29 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 b8c77e0..d03b182 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 6068a98..5924e3b 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,6 +66,11 @@ public:
TSingleReferencedObject& operator = (const TSingleReferencedObject<T>& other);
+ TSingleReferencedObject(TSingleReferencedObject<T>&& other);
+
+ TSingleReferencedObject& operator = (TSingleReferencedObject<T>&& other);
+
+
~TSingleReferencedObject();
operator T()const;
@@ -128,6 +133,26 @@ TSingleReferencedObject<T>& TSingleReferencedObject<T>::operator = (const TSingl
}
template <typename T>
+TSingleReferencedObject<T>::TSingleReferencedObject(TSingleReferencedObject<T>&& other):
+ m_object(other.m_object)
+{
+ other.m_object = nullptr;
+}
+
+template <typename T>
+TSingleReferencedObject<T>& TSingleReferencedObject<T>::operator = (TSingleReferencedObject<T>&& other)
+{
+ if (&other != this) {
+ if (m_object)
+ m_object->del_ref();
+ m_object = other.m_object;
+ other.m_object = nullptr;
+ }
+ return *this;
+}
+
+
+template <typename T>
TSingleReferencedObject<T>::~TSingleReferencedObject()
{
if (m_object)
diff --git a/mia/core/slopeclassifier.cc b/mia/core/slopeclassifier.cc
index b09d0d4..4cf345b 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 023e4cd..ab8cc24 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,7 +91,7 @@ public:
/// @return the time index of the LV peak image or -1 if not identified
int get_LV_peak() const;
- /// \returns the absolute difference between the length ofthe longest and second longest curve in the list
+ /// \returns the absolute difference between the length of the longest and second longest curve in the list
float get_max_slope_length_diff() const;
/// \returns the maximum value of the correlation between the curves and the rows for which it occures
diff --git a/mia/core/slopestatistics.cc b/mia/core/slopestatistics.cc
index 6d7c3ff..feb66eb 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 47e7354..9d7647b 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 1c02129..8286e58 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 e88cae7..d1c6dbb 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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.hh b/mia/core/spacial_kernel.hh
index 16e77d0..f2a7df6 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,6 +164,9 @@ typedef TFactory<C1DFoldingKernel> C1DSpacialKernelPlugin;
typedef std::shared_ptr<C1DFoldingKernel> P1DSpacialKernel;
+template<> const char * const
+TPluginHandler<TFactory<C1DFoldingKernel>>::m_help;
+
/// plugin handler for spaciel filter kernels
typedef THandlerSingleton<TFactoryPluginHandler<C1DSpacialKernelPlugin> > C1DSpacialKernelPluginHandler;
diff --git a/mia/core/spacialkernel/cdiff.cc b/mia/core/spacialkernel/cdiff.cc
index d15f8d1..780ffad 100644
--- a/mia/core/spacialkernel/cdiff.cc
+++ b/mia/core/spacialkernel/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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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/spacialkernel/cdiff.hh b/mia/core/spacialkernel/cdiff.hh
index e92257c..b18e130 100644
--- a/mia/core/spacialkernel/cdiff.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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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/spacialkernel/gauss.cc b/mia/core/spacialkernel/gauss.cc
index 646dbcc..33259e5 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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/spacialkernel/gauss.hh b/mia/core/spacialkernel/gauss.hh
index 4da004c..f9452d1 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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/spacialkernel/test_cdiff.cc b/mia/core/spacialkernel/test_cdiff.cc
index 16bd452..ab0c8c2 100644
--- a/mia/core/spacialkernel/test_cdiff.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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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/spacialkernel/test_gauss.cc b/mia/core/spacialkernel/test_gauss.cc
index 6195f1c..08ab621 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,11 +35,15 @@ BOOST_AUTO_TEST_CASE( test_gauss )
success &= (kernel[2] == 0.25);
const double input[5] = {0,0,1,0,0 };
- const double input2[5] = {1,1,1,1,1 };
+ const double input2[5] = {1,1,1,1,1 };
+ const double input3[5] = {2,1,1,1,3 };
const double test_out_1[5] = {0,0.25,0.5,0.25,0 };
const double test_out_2[5] = {0.0625,0.25,0.375,0.25,0.0625 };
const double test_out_3[5] = {1,1,1,1,1};
- const double test_out_4[5] = {0.109375, 0.234375, 0.3125, 0.234375, 0.109375};
+ const double test_out_4[5] = {0.109375, 0.234375, 0.3125, 0.234375, 0.109375};
+
+ // this is mirror on boundary
+ const double test_out_31[5] = {1.75, 1.25, 1, 1.5, 2.5};
vector<double> in1(5);
copy(input, input+5, in1.begin());
@@ -93,5 +97,15 @@ BOOST_AUTO_TEST_CASE( test_gauss )
}
+ copy(input3, input3+5, in1.begin());
+ kernel.apply_inplace(in1);
+
+ success &= (equal(in1.begin(), in1.end(), test_out_31, equal_double()));
+
+ if (!success) {
+ for (size_t i = 0; i < 5; ++i)
+ cvfail() << in1[i] << " vs " << test_out_31[i] << "\n";
+ }
+
}
diff --git a/mia/core/sparse_histogram.cc b/mia/core/sparse_histogram.cc
index e950e90..e40eb6c 100644
--- a/mia/core/sparse_histogram.cc
+++ b/mia/core/sparse_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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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_histogram.hh b/mia/core/sparse_histogram.hh
index 5236922..9b16012 100644
--- a/mia/core/sparse_histogram.hh
+++ b/mia/core/sparse_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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,12 +62,12 @@ public:
*/
Compressed get_compressed_histogram()const;
private:
- std::vector<unsigned long> m_histogram;
- int m_shift;
+ std::vector<uint64_t> m_histogram;
+ int64_t m_shift;
EPixelType m_pixeltype;
};
-EXPORT_CORE std::ostream& operator << (std::ostream& os, const std::pair<short, unsigned long>& pair);
+EXPORT_CORE std::ostream& operator << (std::ostream& os, const std::pair<short, uint64_t>& pair);
// Implementation
@@ -76,14 +76,14 @@ EXPORT_CORE std::ostream& operator << (std::ostream& os, const std::pair<short,
template <typename InIterator, bool sig>
struct dispatch_by_pixeltype {
static size_t apply(InIterator MIA_PARAM_UNUSED(begin), InIterator MIA_PARAM_UNUSED(end),
- std::vector<unsigned long>& MIA_PARAM_UNUSED(histogram)){
+ std::vector<uint64_t>& MIA_PARAM_UNUSED(histogram)){
throw std::invalid_argument("Input pixel type not supported");
}
};
template <typename InIterator>
struct dispatch_by_pixeltype<InIterator, false> {
- static size_t apply(InIterator begin, InIterator end, std::vector<unsigned long>& histogram){
+ static size_t apply(InIterator begin, InIterator end, std::vector<uint64_t>& histogram){
size_t n = 0;
while ( begin != end) {
++histogram[*begin];
@@ -96,9 +96,9 @@ struct dispatch_by_pixeltype<InIterator, false> {
template <typename InIterator>
struct dispatch_by_pixeltype<InIterator, true> {
- static size_t apply(InIterator begin, InIterator end, std::vector<unsigned long>& histogram){
+ static size_t apply(InIterator begin, InIterator end, std::vector<uint64_t>& histogram){
typedef typename InIterator::value_type in_pixels;
- int shift = -std::numeric_limits<in_pixels>::min();
+ int64_t shift = -std::numeric_limits<in_pixels>::min();
size_t n = 0;
while ( begin != end) {
++histogram[*begin + shift];
diff --git a/mia/core/sparse_solver.hh b/mia/core/sparse_solver.hh
index ca951f2..49f5008 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 10fee6d..9562456 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 aabe602..104db44 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 7feb9e1..7098f5d 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 d00de6f..4c4daa7 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 91cc8ec..7d4a997 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -292,6 +292,9 @@ typedef std::shared_ptr<CSplineKernel> PSplineKernel;
/// base plugin for spline kernels
typedef TFactory<CSplineKernel> CSplineKernelPlugin;
+
+template<> const char * const
+TPluginHandler<TFactory<CSplineKernel>>::m_help;
/**
\ingroup interpol
Plugin handler for the creation of spline kernels
diff --git a/mia/core/splinekernel/bspline.cc b/mia/core/splinekernel/bspline.cc
index f05019b..3fb6e77 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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.hh b/mia/core/splinekernel/bspline.hh
index df0978c..22c9db9 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 ba03197..90084da 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 7f81d1b..1f21ca7 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 6757d88..2a6022e 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -345,8 +345,10 @@ CSplineParzenMI::get_reduced_range_masked(DataIterator dbegin,
auto ib = dbegin;
auto im = mbegin;
- while (! *im++ && ib != dend)
- ++ib;
+ while (! *im && ib != dend) {
+ ++im;
+ ++ib;
+ }
if (ib == dend)
throw std::runtime_error("CSplineParzenMI: empty mask");
diff --git a/mia/core/sqmin.cc b/mia/core/sqmin.cc
index 277e67b..4c9bb3d 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 6154ff8..e94800e 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 b9984dd..f53ff16 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 7aec459..06c6a3e 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 35d7f97..04b42ff 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 131e840..928c5d7 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 715e6af..53ca4b7 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 50c3524..96336d5 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,16 +122,14 @@ BOOST_AUTO_TEST_CASE( test_translator )
check_translate_type("bit", true, "1");
check_translate_type("double", 1.8, "1.8");
check_translate_type("float", 1.75f, "1.75");
- check_translate_type("ubyte", (unsigned char)129, "129");
- check_translate_type("sbyte", (signed char)-120, "-120");
- check_translate_type("sshort", (signed short)-1231, "-1231");
- check_translate_type("ushort", (unsigned short)3213, "3213");
-#ifdef LONG_64BIT
+ check_translate_type("ubyte", (uint8_t)129, "129");
+ check_translate_type("sbyte", (int8_t)-120, "-120");
+ check_translate_type("sshort", (int16_t)-1231, "-1231");
+ check_translate_type("ushort", (uint16_t)3213, "3213");
CULTranslator::register_for("ulong");
CSLTranslator::register_for("slong");
- check_translate_type("slong", (signed long)-1212321, "-1212321");
- check_translate_type("ulong", (unsigned long)1238763, "1238763");
-#endif
+ check_translate_type("slong", (int64_t)-1212321, "-1212321");
+ check_translate_type("ulong", (uint64_t)1238763, "1238763");
}
@@ -166,16 +164,14 @@ void test_type_attribute()
typedef bmpl::vector<bool,
- signed char,
- unsigned char,
- signed short,
- unsigned short,
- signed int,
- unsigned int,
-#ifdef LONG_64BIT
- signed long,
- unsigned long,
-#endif
+ int8_t,
+ uint8_t,
+ int16_t,
+ uint16_t,
+ int32_t,
+ uint32_t,
+ int64_t,
+ uint64_t,
float,
double
> test_types;
diff --git a/mia/core/test_boundary_conditions.cc b/mia/core/test_boundary_conditions.cc
index c13d74a..88c1403 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 6786ead..3e8ac3d 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 463f366..4e80ba8 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,6 +25,7 @@
#include <miaconfig.h>
#include <mia/core/cmdlineparser.hh>
+#include <mia/core/paramarray.hh>
#include <mia/core/msgstream.hh>
#include <mia/internal/autotest.hh>
@@ -444,7 +445,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-2016 Leipzig, \n"
+ " This software is Copyright (c) Gert Wollny 1999-2017 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"
@@ -563,4 +564,27 @@ BOOST_FIXTURE_TEST_CASE( test_repeat_option, CmdlineParserFixture )
}
+BOOST_FIXTURE_TEST_CASE( test_array_param_option_parsing, CmdlineParserFixture )
+{
+
+ CCmdOptionList olist(general_help);
+
+ TPerLevelScalarParam<uint32_t> conv_count(10);
+
+
+ olist.add(conv_count.
+ create_level_params_option("conv-test-intervall",'T', EParameterBounds::bf_min_closed, {4},
+ "Convergence test interations intervall: In order to measure "));
+ vector<const char *> options;
+
+ options.push_back("self");
+
+ BOOST_CHECK_EQUAL(olist.parse(options.size(), &options[0]), CCmdOptionList::hr_no);
+
+
+ BOOST_CHECK_EQUAL(conv_count[0], 10);
+ BOOST_CHECK_EQUAL(conv_count[1], 10);
+}
+
+
diff --git a/mia/core/test_cmdlineparseroutput.cc b/mia/core/test_cmdlineparseroutput.cc
index ed14343..7b905db 100644
--- a/mia/core/test_cmdlineparseroutput.cc
+++ b/mia/core/test_cmdlineparseroutput.cc
@@ -1,7 +1,7 @@
/* -*- mia-c++ -*-
*
* This file is part of MIA - a toolbox for medical image analysis
- * Copyright (c) Leipzig, Madrid 1999-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,6 +18,11 @@
*
*/
+#define _XOPEN_SOURCE 500
+#include <stdlib.h>
+#include <stdio.h>
+
+
#include <stdexcept>
#include <climits>
@@ -57,40 +62,42 @@ private:
};
-bool wait_for_child = true;
-
-void sig_usr(int signo)
-{
- if (signo == SIGINT)
- wait_for_child = false;
-}
-
-
bool fork_and_run_check(const char *me, const char *console_width, string& child_output)
{
- int aStdoutPipe[2];
-
- struct sigaction sig;
- sigemptyset(&sig.sa_mask);
- sig.sa_flags = 0;
- sig.sa_handler = sig_usr;
-
- wait_for_child = true;
-
- if (pipe2(aStdoutPipe, O_NONBLOCK) < 0) {
- perror ("Allocatin stdout pipe");
- return false;
- }
-
+ int master = posix_openpt (O_RDWR | O_NOCTTY | O_NONBLOCK);
+ if (master < 0)
+ {
+ cvfail() << "unable to get a ptty" << endl;
+ return false;
+ }
+
+ if (grantpt (master) < 0 || unlockpt (master) < 0)
+ {
+ cvfail() << "unable to grant access to terminal" << endl;
+ return false;
+ }
+ const char *name = ptsname (master);
+ int slave = open (name, O_RDWR);
+ if (slave < 0)
+ {
+ cvfail() << "unable to open slave tty" << endl;
+ return false;
+ }
+
cvdebug() << "Parent: About to fork" << endl;
pid_t pid = fork();
if (!pid) { // child process
- if (dup2(aStdoutPipe[1], STDOUT_FILENO) == -1) {
+ if (dup2(slave, STDOUT_FILENO) == -1) {
perror("redirecting stdout");
return false;
}
-
+
+ if (dup2(slave, STDIN_FILENO) == -1) {
+ perror("redirecting stdin");
+ return false;
+ }
+ cvdebug() << "Slave: start self" << endl;
execlp(me, me,
"-w", console_width,
"--internal",
@@ -98,17 +105,28 @@ bool fork_and_run_check(const char *me, const char *console_width, string& child
cvfail() << "unable to start myself" << endl;
return false;
}else {
- sigaction(SIGINT,&sig,NULL);
cvdebug() << "Parent: Start reading" << endl;
child_output.clear();
char c;
-
- while (wait_for_child) {
- while(read(aStdoutPipe[0], &c, 1) == 1) {
+ int wstatus = 0;
+ while (0 == waitpid (pid, &wstatus, WNOHANG)) {
+ while(read (master, &c, 1) == 1) {
child_output.push_back(c);
}
}
- return true;
+
+ // now get the exit code
+
+ if (WIFEXITED(wstatus)) {
+ WEXITSTATUS(wstatus);
+ if (wstatus != 0) {
+ cverr() << "Child process exited with status " << wstatus << "\n";
+ return false;
+ }
+ return true;
+ }
+
+ return false;
}
}
@@ -132,12 +150,18 @@ int main(int argc, const char **args)
CCmdOptionList options(general_help);
options.add(make_opt(console_width, "width", 'w', "set console width"));
options.add(make_opt(internal, "internal", 'i', "was forked" ));
-
- if (options.parse(argc, args) != CCmdOptionList::hr_no)
- return -1;
-
- if (internal) {
+ try {
+ if (options.parse(argc, args) != CCmdOptionList::hr_no)
+ return -1;
+ }
+ catch (const std::logic_error& x) {
+ cvfail() << x.what() << "\n";
+ return -1;
+ }
+
+ if (internal) {
+ cvdebug() << "Start internal\n";
int retvalue = 0;
struct winsize ws;
int old_width = 100;
@@ -153,56 +177,69 @@ int main(int argc, const char **args)
options.push_back("-h");
olist.add(make_opt(test, "lala", 'i', "a string option"));
- if (olist.parse(options.size(), &options[0]) == CCmdOptionList::hr_no) {
- ws.ws_col = old_width;
- if (ioctl(0,TIOCSWINSZ,&ws) !=0) {
- cverr() << "Resetting console width failed\n";
- retvalue = -1;
- }
- }else
- retvalue = -1;
+ try {
+ if (olist.parse(options.size(), &options[0]) == CCmdOptionList::hr_no) {
+ ws.ws_col = old_width;
+ if (ioctl(0,TIOCSWINSZ,&ws) !=0) {
+ cverr() << "Resetting console width failed\n";
+ retvalue = -2;
+ }
+ }else
+ retvalue = 0;
+ }
+ catch (const std::logic_error& x) {
+ cvfail() << x.what() << "\n";
+ retvalue = -4;
+ }
}else
- retvalue = -1;
+ retvalue = -5;
}else
- retvalue = -1;
+ retvalue = -6;
ws.ws_col = old_width;
ioctl(0,TIOCSWINSZ,&ws);
- cverr() << "Send signal\n";
- sleep(1);
- kill(getppid(), SIGINT);
- sleep(1);
-
+ if (retvalue)
+ cverr() << "Retval " << retvalue << endl;
return retvalue;
} else {
+ cvdebug() << "Start Master\n";
int retval = 0;
// fork the tests
- string child_output_100;
+ string child_output_100;
+
+ // args[0] is well defined, i.e. it is the name of the current program
+ // coverity[TAINTED_STRING]
if (fork_and_run_check(args[0], "100", child_output_100)) {
- if (child_output_100.size() != 1796) {
- cvfail() << "Output 100: expected 1796 bytes, got "
+ if (child_output_100.size() != 1843) {
+ cvfail () << child_output_100 << endl;
+ cvfail() << "Output 100: expected 1843 bytes, got "
<< child_output_100.size() <<"\n";
- retval = -3;
+ retval = -7;
}
}else
retval = -2;
- string child_output_50;
+ string child_output_50;
+
+ // args[0] is well defined, i.e. it is the name of the current program
+ // coverity[TAINTED_STRING]
if (fork_and_run_check(args[0], "50", child_output_50)) {
- if (child_output_50.size() != 2241) {
- cvfail() << "Output 50: expected 2241 bytes, got "
+ if (child_output_50.size() != 2311) {
+ cvfail () << child_output_50 << endl;
+ cvfail() << "Output 50: expected 2311 bytes, got "
<< child_output_50.size() <<"\n";
- retval = -3;
+ retval = -8;
}
}else
- retval = -2;
-
+ retval = -9;
+ if (retval)
+ cverr() << "Retval " << retval << endl;
return retval;
}
};
diff --git a/mia/core/test_cmdoptionflags.cc b/mia/core/test_cmdoptionflags.cc
index f66ef24..363cdf6 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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_cmdparamoption.cc b/mia/core/test_cmdparamoption.cc
index 036097d..73f41d1 100644
--- a/mia/core/test_cmdparamoption.cc
+++ b/mia/core/test_cmdparamoption.cc
@@ -1,7 +1,7 @@
/* -*- mia-c++ -*-
*
* This file is part of MIA - a toolbox for medical image analysis
- * Copyright (c) Leipzig, Madrid 1999-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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
index 4bea9e1..33691ff 100644
--- a/mia/core/test_cmdtranslatoroption.cc
+++ b/mia/core/test_cmdtranslatoroption.cc
@@ -1,7 +1,7 @@
/* -*- mia-c++ -*-
*
* This file is part of MIA - a toolbox for medical image analysis
- * Copyright (c) Leipzig, Madrid 1999-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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_cmdxmlhelp.cc b/mia/core/test_cmdxmlhelp.cc
index 41fa047..caeddd9 100644
--- a/mia/core/test_cmdxmlhelp.cc
+++ b/mia/core/test_cmdxmlhelp.cc
@@ -1,7 +1,7 @@
/* -*- mia-c++ -*-
*
* This file is part of MIA - a toolbox for medical image analysis
- * Copyright (c) Leipzig, Madrid 1999-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -170,7 +170,10 @@ int do_main(int argc, char **args)
vector<const char*> arg{args[0],"--help-xml", "-", NULL};
- bool failed = false;
+ bool failed = false;
+
+ // args[0] is well defined, i.e. it is the name of the current program
+ // coverity[TAINTED_STRING]
if (!fork_and_run_check(args[0], arg, expect_xml_help)) {
failed = true;
}
@@ -192,18 +195,18 @@ string expect_xml_help_end="</version>\n"
" <basic_usage> test-cmdxmlhelp -r <required> --other <value> [options] <PLUGINS:none/test></basic_usage>\n"
" <whatis>program tests</whatis>\n"
" <group name=\"A\">\n"
-" <option short=\"r\" long=\"required\" default=\"\" type=\"string\"><flags>input required </flags>some required option</option>\n"
-" <option short=\"\" long=\"other\" default=\"\" type=\"string\"><flags>output required </flags>other required option</option>\n"
+" <option default=\"\" long=\"required\" short=\"r\" type=\"string\">some required option<flags>input required </flags></option>\n"
+" <option default=\"\" long=\"other\" short=\"\" type=\"string\">other required option<flags>output required </flags></option>\n"
" </group>\n"
" <group name=\"Help & Info\">\n"
-" <option short=\"V\" long=\"verbose\" default=\"warning\" type=\"dict\">verbosity of output, print messages of given level and higher priorities. Supported priorities starting at lowest level are:<dict><value name=\"trace\">Function call trace</value><value name=\"debug\">Debug output</value><value name=\"info\">Low level messages</value><value name=\"message\">Normal messages</value><value name=\"warning\">Warnings</value><value name=\"fail\">Report test failures</value><value name= [...]
-" <option short=\"\" long=\"copyright\" default=\"false\" type=\"bool\"><flags>nonipype </flags>print copyright information</option>\n"
-" <option short=\"h\" long=\"help\" default=\"false\" type=\"bool\"><flags>nonipype </flags>print this help</option>\n"
-" <option short=\"?\" long=\"usage\" default=\"false\" type=\"bool\"><flags>nonipype </flags>print a short help</option>\n"
-" <option short=\"\" long=\"version\" default=\"false\" type=\"bool\"><flags>nonipype </flags>print the version number and exit</option>\n"
+" <option default=\"warning\" long=\"verbose\" short=\"V\" type=\"dict\">verbosity of output, print messages of given level and higher priorities. Supported priorities starting at lowest level are:<dict><value name=\"trace\">Function call trace</value><value name=\"debug\">Debug output</value><value name=\"info\">Low level messages</value><value name=\"message\">Normal messages</value><value name=\"warning\">Warnings</value><value name=\"fail\">Report test failures</value><value name= [...]
+" <option default=\"false\" long=\"copyright\" short=\"\" type=\"bool\">print copyright information<flags>nonipype </flags></option>\n"
+" <option default=\"false\" long=\"help\" short=\"h\" type=\"bool\">print this help<flags>nonipype </flags></option>\n"
+" <option default=\"false\" long=\"usage\" short=\"?\" type=\"bool\">print a short help<flags>nonipype </flags></option>\n"
+" <option default=\"false\" long=\"version\" short=\"\" type=\"bool\">print the version number and exit<flags>nonipype </flags></option>\n"
" </group>\n"
" <group name=\"Processing\">\n"
-" <option short=\"\" long=\"threads\" default=\"-1\" type=\"int\">Maxiumum number of threads to use for processing,This number should be lower or equal to the number of logical processor cores in the machine. (-1: automatic estimation).Maxiumum number of threads to use for processing,This number should be lower or equal to the number of logical processor cores in the machine. (-1: automatic estimation).</option>\n"
+" <option default=\"-1\" long=\"threads\" short=\"\" type=\"int\">Maxiumum number of threads to use for processing,This number should be lower or equal to the number of logical processor cores in the machine. (-1: automatic estimation).</option>\n"
" </group>\n"
" <freeparams name=\"none/test\" type=\"factory\"/>\n"
" <stdout-is-result/>\n"
diff --git a/mia/core/test_cmeans.cc b/mia/core/test_cmeans.cc
index 45fa899..37b86e7 100644
--- a/mia/core/test_cmeans.cc
+++ b/mia/core/test_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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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_convergence_measure.cc b/mia/core/test_convergence_measure.cc
new file mode 100644
index 0000000..81381be
--- /dev/null
+++ b/mia/core/test_convergence_measure.cc
@@ -0,0 +1,123 @@
+/* -*- mia-c++ -*-
+ *
+ * This file is part of MIA - a toolbox for medical image analysis
+ * Copyright (c) Genoa 1999-2017 Gert Wollny
+ *
+ * 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/convergence_measure.hh>
+#include <mia/internal/autotest.hh>
+
+#include <limits>
+
+
+BOOST_AUTO_TEST_CASE ( test_CConvergenceMeasure_0 )
+{
+ mia::CConvergenceMeasure cm(4);
+
+ BOOST_CHECK_EQUAL( cm.value(), std::numeric_limits<double>::max());
+ BOOST_CHECK( !cm.is_full_size());
+ BOOST_CHECK_EQUAL( cm.fill(), 0u);
+ BOOST_CHECK_EQUAL( cm.rate(), 0.0);
+}
+
+BOOST_AUTO_TEST_CASE ( test_CConvergenceMeasure_1 )
+{
+ mia::CConvergenceMeasure cm(4);
+ cm.push(1.0);
+ BOOST_CHECK( !cm.is_full_size());
+ BOOST_CHECK_EQUAL( cm.fill(), 1u);
+ BOOST_CHECK_EQUAL( cm.value(), 1.0);
+ BOOST_CHECK_EQUAL( cm.rate(), 0.0);
+}
+
+BOOST_AUTO_TEST_CASE ( test_CConvergenceMeasure_2 )
+{
+ mia::CConvergenceMeasure cm(4);
+ cm.push(1.0);
+ cm.push(2.0);
+ BOOST_CHECK( !cm.is_full_size());
+ BOOST_CHECK_EQUAL( cm.fill(), 2u);
+ BOOST_CHECK_CLOSE( cm.value(), 1.5, 1e-8);
+ BOOST_CHECK_CLOSE( cm.rate(), 1.0, 1e-8);
+
+}
+
+BOOST_AUTO_TEST_CASE ( test_CConvergenceMeasure_3 )
+{
+ mia::CConvergenceMeasure cm(4);
+ cm.push(1.0);
+ cm.push(2.0);
+ cm.push(3.0);
+ BOOST_CHECK( !cm.is_full_size());
+ BOOST_CHECK_EQUAL( cm.fill(), 3u);
+ BOOST_CHECK_CLOSE( cm.value(), 2.0, 1e-8);
+ BOOST_CHECK_CLOSE( cm.rate(), 1.0, 1e-8);
+
+}
+
+BOOST_AUTO_TEST_CASE ( test_CConvergenceMeasure_4 )
+{
+ mia::CConvergenceMeasure cm(4);
+ cm.push(1.0);
+ cm.push(2.0);
+ cm.push(3.0);
+ cm.push(4.0);
+ BOOST_CHECK( cm.is_full_size());
+ BOOST_CHECK_EQUAL( cm.fill(), 4u);
+ BOOST_CHECK_CLOSE( cm.value(), 2.5, 1e-8);
+ BOOST_CHECK_CLOSE( cm.rate(), 1.0, 1e-8);
+
+
+}
+
+BOOST_AUTO_TEST_CASE ( test_CConvergenceMeasure_5 )
+{
+ mia::CConvergenceMeasure cm(4);
+ cm.push(1.0);
+ cm.push(2.0);
+ cm.push(3.0);
+ cm.push(4.0);
+ cm.push(5.0);
+ BOOST_CHECK( cm.is_full_size());
+ BOOST_CHECK_EQUAL( cm.fill(), 4u);
+ BOOST_CHECK_CLOSE( cm.value(), 3.5, 1e-8);
+ BOOST_CHECK_CLOSE( cm.rate(), 1.0, 1e-8);
+
+
+}
+
+BOOST_AUTO_TEST_CASE ( test_CConvergenceMeasure_inv )
+{
+ mia::CConvergenceMeasure cm(4);
+ cm.push(90);
+ cm.push(10);
+ BOOST_CHECK_EQUAL( cm.fill(), 2u);
+ BOOST_CHECK_CLOSE( cm.value(), 50, 1e-8);
+ BOOST_CHECK_CLOSE( cm.rate(), -80, 1e-8);
+}
+
+
+BOOST_AUTO_TEST_CASE ( test_CConvergenceMeasure_inv_big )
+{
+ mia::CConvergenceMeasure cm(4);
+ cm.push(5.1401e+07);
+ cm.push(5.01538e+07);
+ BOOST_CHECK_EQUAL( cm.fill(), 2u);
+ BOOST_CHECK_CLOSE( cm.value(), (5.1401e+07 + 5.01538e+07)/2, 1e-8);
+ BOOST_CHECK_CLOSE( cm.rate(), 5.01538e+07 - 5.1401e+07, 1e-8);
+}
+
diff --git a/mia/core/test_core.cc b/mia/core/test_core.cc
index a837aea..73eb1f1 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,11 @@
#include <mia/core/utils.hh>
+// WIN32 and HURD don't define this
+#ifndef PATH_MAX
+#define PATH_MAX 1024
+#endif
+
NS_MIA_USE
using namespace std;
using namespace boost::unit_test;
diff --git a/mia/core/test_cost.cc b/mia/core/test_cost.cc
index f4d6f23..30c7f20 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 14b43f7..2b6d9b1 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 44d8beb..578b4c5 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -68,6 +68,8 @@ BOOST_AUTO_TEST_CASE( test_pool_get_and_remove )
CDatapool::instance().add("param1", 10);
any p1 = CDatapool::instance().get_and_remove("param1");
BOOST_CHECK(!CDatapool::instance().has_key("param1"));
+
+ BOOST_CHECK_THROW(CDatapool::instance().get_and_remove("param1"), std::invalid_argument);
}
BOOST_AUTO_TEST_CASE( test_pool_has_unused )
@@ -83,6 +85,12 @@ BOOST_AUTO_TEST_CASE( test_pool_has_key )
BOOST_CHECK(!CDatapool::instance().has_key("unknown"));
}
+BOOST_AUTO_TEST_CASE( test_pool_remove_unknown_key_no_throw )
+{
+ BOOST_CHECK_NO_THROW(CDatapool::instance().remove("unknown"));
+}
+
+
BOOST_AUTO_TEST_CASE( test_pool_clear )
{
CDatapool::instance().add("param1", 10);
diff --git a/mia/core/test_delayedparameter.cc b/mia/core/test_delayedparameter.cc
index e8d2249..46fa172 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 b7650dd..f918417 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 51812b5..b6e2b74 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 4beba21..509d0f0 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,8 @@ class CFactoryMockPluginHandler : public TFactoryPluginHandler<CFactoryMock> {
public:
CFactoryMockPluginHandler()
{
- assert(add_plugin(TFactoryPluginHandler<CFactoryMock>::PInterface(new CFactoryMock())));
+ auto is_added = add_plugin(TFactoryPluginHandler<CFactoryMock>::PInterface(new CFactoryMock()));
+ assert(is_added);
}
};
diff --git a/mia/core/test_fastica.cc b/mia/core/test_fastica.cc
deleted file mode 100644
index ac8e892..0000000
--- a/mia/core/test_fastica.cc
+++ /dev/null
@@ -1,184 +0,0 @@
-/* -*- mia-c++ -*-
- *
- * This file is part of MIA - a toolbox for medical image analysis
- * Copyright (c) Leipzig, Madrid 1999-2016 Gert Wollny
- *
- * 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 <cmath>
-
-#include <mia/internal/autotest.hh>
-#include <mia/core/fastica.hh>
-#include <mia/core/cmdlineparser.hh>
-
-#include <mia/core/gsl_matrix_vector_ops.hh>
-
-#include <gsl/gsl_blas.h>
-
-using gsl::Matrix;
-using namespace mia;
-
-BOOST_AUTO_TEST_CASE ( test_fastica_symm )
-{
- // create the components and the mixing matrix
-
- const double c[] = {1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1};
-
- Matrix in_ics(3, 13, c);
- const int steps = 101;
-
- Matrix in_mixing_matrix(steps, 3, false);
-
- auto c0 = in_mixing_matrix.get_column(0);
- auto c1 = in_mixing_matrix.get_column(1);
- auto c2 = in_mixing_matrix.get_column(2);
-
- // sin(x) ; cos(x); sin(2x)
- for ( int i = 0; i < steps; ++i) {
- cvdebug() << "init row " << i << "\n";
- double x = (M_PI * (i - (steps- 1)/2)) / steps;
- c0[i] = sin(x);
- c1[i] = cos(x);
- c2[i] = sin(2 * x);
- }
-
- Matrix mix = in_mixing_matrix * in_ics;
-
-
- FastICA ica(3);
-
- ica.set_approach(FastICA::appr_symm);
- ica.set_epsilon (1e-10);
- ica.set_finetune(true);
- ica.set_nonlinearity(produce_fastica_nonlinearity("pow3"));
- BOOST_CHECK(ica.separate(mix));
-
-
- const gsl::Matrix& out_mixing_matrix = ica.get_mixing_matrix();
- const gsl::Matrix& out_ics = ica.get_independent_components();
-
- // the mixes should be close to orthogonal
-
- for (unsigned int c = 1; c < out_mixing_matrix.cols(); ++c) {
- auto col_a = out_mixing_matrix.get_column(c);
- double na = 0.0;
- gsl_blas_ddot(col_a, col_a, &na);
- for (unsigned int c1 = 0; c1 < c; ++c1) {
- auto col_b = out_mixing_matrix.get_column(c1);
- auto dot = 1.0;
- double nb = 0.0;
- gsl_blas_ddot(col_b, col_b, &nb);
- gsl_blas_ddot(col_a, col_b, & dot);
- BOOST_CHECK_SMALL(dot, 0.1 * na * nb);
- }
- }
-
-
- BOOST_CHECK_EQUAL(out_mixing_matrix.rows(), in_mixing_matrix.rows());
- BOOST_CHECK_EQUAL(out_mixing_matrix.cols(), in_mixing_matrix.cols());
- BOOST_CHECK_EQUAL(out_ics.rows(), in_ics.rows());
- BOOST_CHECK_EQUAL(out_ics.cols(), in_ics.cols());
-
- // create the remix and test it against the input mix
-
-
- Matrix remix = out_mixing_matrix * out_ics;
- Matrix delta = remix - mix;
-
- for(auto id = delta.begin(); id != delta.end(); ++id) {
- BOOST_CHECK_SMALL(*id, 1e-10);
- }
-
-}
-
-
-
-BOOST_AUTO_TEST_CASE ( test_fastica_defl )
-{
- // create the components and the mixing matrix
-
- const double c[] = {1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1};
-
- Matrix in_ics(3, 13, c);
- const int steps = 101;
-
- Matrix in_mixing_matrix(steps, 3, false);
-
- auto c0 = in_mixing_matrix.get_column(0);
- auto c1 = in_mixing_matrix.get_column(1);
- auto c2 = in_mixing_matrix.get_column(2);
-
- // sin(x) ; cos(x); sin(2x)
- for ( int i = 0; i < steps; ++i) {
- cvdebug() << "init row " << i << "\n";
- double x = (M_PI * (i - (steps- 1)/2)) / steps;
- c0[i] = sin(x);
- c1[i] = cos(x);
- c2[i] = sin(2 * x);
- }
-
- Matrix mix = in_mixing_matrix * in_ics;
-
-
- FastICA ica(3);
-
- ica.set_approach(FastICA::appr_defl);
- ica.set_epsilon (1e-10);
- ica.set_finetune(true);
- ica.set_stabilization(true);
- ica.set_nonlinearity(produce_fastica_nonlinearity("pow3"));
- BOOST_CHECK(ica.separate(mix));
-
-
- const gsl::Matrix& out_mixing_matrix = ica.get_mixing_matrix();
- const gsl::Matrix& out_ics = ica.get_independent_components();
-
- // the mixes should be close to orthogonal
-
- for (unsigned int c = 1; c < out_mixing_matrix.cols(); ++c) {
- auto col_a = out_mixing_matrix.get_column(c);
- double na = 0.0;
- gsl_blas_ddot(col_a, col_a, &na);
- for (unsigned int c1 = 0; c1 < c; ++c1) {
- auto col_b = out_mixing_matrix.get_column(c1);
- auto dot = 1.0;
- double nb = 0.0;
- gsl_blas_ddot(col_b, col_b, &nb);
- gsl_blas_ddot(col_a, col_b, & dot);
- BOOST_CHECK_SMALL(dot, 0.1 * na * nb);
- }
- }
-
-
- BOOST_CHECK_EQUAL(out_mixing_matrix.rows(), in_mixing_matrix.rows());
- BOOST_CHECK_EQUAL(out_mixing_matrix.cols(), in_mixing_matrix.cols());
-
-
- BOOST_CHECK_EQUAL(out_ics.rows(), in_ics.rows());
- BOOST_CHECK_EQUAL(out_ics.cols(), in_ics.cols());
-
- Matrix remix = out_mixing_matrix * out_ics;
- Matrix delta = remix - mix;
-
- for(auto id = delta.begin(); id != delta.end(); ++id) {
- BOOST_CHECK_SMALL(*id, 1e-10);
- }
-
-}
diff --git a/mia/core/test_fft1d.cc b/mia/core/test_fft1d.cc
index 4fd5afb..24752d7 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 874c28b..81bb253 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 32d7d5a..0bf3406 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 bb8e0ca..4940099 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 cf741e1..7770f87 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,6 +25,7 @@
#include <boost/test/unit_test_suite.hpp>
#include <boost/test/unit_test.hpp>
+#include <boost/mpl/vector.hpp>
#include <mia/core/filter.hh>
@@ -104,16 +105,14 @@ template <typename T>
void do_test_combiner_call(DualFilter dual)
{
do_test_combiner_call_b<T, bool>(dual);
- do_test_combiner_call_b<T, signed char>(dual);
- do_test_combiner_call_b<T, unsigned char>(dual);
- do_test_combiner_call_b<T, signed short>(dual);
- do_test_combiner_call_b<T, unsigned short>(dual);
- do_test_combiner_call_b<T, signed int>(dual);
- do_test_combiner_call_b<T, unsigned int>(dual);
-#ifdef LONG_64BIT
- do_test_combiner_call_b<T, unsigned long>(dual);
- do_test_combiner_call_b<T, signed long>(dual);
-#endif
+ do_test_combiner_call_b<T, int8_t>(dual);
+ do_test_combiner_call_b<T, int16_t>(dual);
+ do_test_combiner_call_b<T, int32_t>(dual);
+ do_test_combiner_call_b<T, int64_t>(dual);
+ do_test_combiner_call_b<T, uint8_t>(dual);
+ do_test_combiner_call_b<T, uint16_t>(dual);
+ do_test_combiner_call_b<T, uint32_t>(dual);
+ do_test_combiner_call_b<T, uint64_t>(dual);
do_test_combiner_call_b<T, float>(dual);
do_test_combiner_call_b<T, double>(dual);
}
@@ -122,40 +121,27 @@ NS_MIA_END
NS_MIA_USE
-BOOST_AUTO_TEST_CASE( test_filter_call)
+typedef boost::mpl::vector<bool,
+ int8_t,
+ uint8_t,
+ int16_t,
+ uint16_t,
+ int32_t,
+ uint32_t,
+ int64_t,
+ uint64_t,
+ float,
+ double
+ > test_types;
+
+BOOST_AUTO_TEST_CASE_TEMPLATE( test_filter_call, T, test_types)
{
UniFilter uni;
-
- do_test_filter_call<bool>(uni);
- do_test_filter_call<signed char>(uni);
- do_test_filter_call<unsigned char>(uni);
- do_test_filter_call<signed short>(uni);
- do_test_filter_call<unsigned short>(uni);
- do_test_filter_call<signed int>(uni);
- do_test_filter_call<unsigned int>(uni);
-#ifdef LONG_64BIT
- do_test_filter_call<signed long>(uni);
- do_test_filter_call<unsigned long>(uni);
-#endif
- do_test_filter_call<float>(uni);
- do_test_filter_call<double>(uni);
+ do_test_filter_call<T>(uni);
}
-BOOST_AUTO_TEST_CASE( test_combiner_call )
+BOOST_AUTO_TEST_CASE_TEMPLATE( test_combiner_call, T, test_types)
{
DualFilter dual;
-
- do_test_combiner_call<bool>(dual);
- do_test_combiner_call<signed char>(dual);
- do_test_combiner_call<unsigned char>(dual);
- do_test_combiner_call<signed short>(dual);
- do_test_combiner_call<unsigned short>(dual);
- do_test_combiner_call<signed int>(dual);
- do_test_combiner_call<unsigned int>(dual);
-#ifdef LONG_64BIT
- do_test_combiner_call<signed long>(dual);
- do_test_combiner_call<unsigned long>(dual);
-#endif
- do_test_combiner_call<float>(dual);
- do_test_combiner_call<double>(dual);
+ do_test_combiner_call<T>(dual);
}
diff --git a/mia/core/test_fixedwidthoutput.cc b/mia/core/test_fixedwidthoutput.cc
index b2f416b..0b2a0da 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 366a4bd..acea7de 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 5f1d49f..5cb59cc 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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_gsl_matrix.cc b/mia/core/test_gsl_matrix.cc
index d89c3dd..ab74597 100644
--- a/mia/core/test_gsl_matrix.cc
+++ b/mia/core/test_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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,6 +156,42 @@ BOOST_AUTO_TEST_CASE( test_copy_ops )
BOOST_CHECK(im == m.begin());
}
+BOOST_AUTO_TEST_CASE( test_move_ops )
+{
+ Matrix m(2,3, 2.0);
+
+ BOOST_CHECK_EQUAL(m.rows(), 2u);
+ BOOST_CHECK_EQUAL(m.cols(), 3u);
+ BOOST_CHECK_EQUAL(m(0,0), 2.0);
+
+ Matrix m2(1,1, 1.0);
+
+ BOOST_CHECK_EQUAL(m2.rows(), 1u);
+ BOOST_CHECK_EQUAL(m2.cols(), 1u);
+ BOOST_CHECK_EQUAL(m2(0,0), 1.0);
+
+
+ Matrix mm(std::move(m));
+ BOOST_REQUIRE(mm.is_valid());
+ BOOST_CHECK(!m.is_valid());
+
+ BOOST_CHECK_EQUAL(mm.rows(), 2u);
+ BOOST_CHECK_EQUAL(mm.cols(), 3u);
+ BOOST_CHECK_EQUAL(mm(0,0), 2.0);
+
+ mm = std::move(m2);
+ BOOST_REQUIRE(mm.is_valid());
+ BOOST_CHECK(!m2.is_valid());
+
+ BOOST_CHECK_EQUAL(mm.rows(), 1u);
+ BOOST_CHECK_EQUAL(mm.cols(), 1u);
+ BOOST_CHECK_EQUAL(mm(0,0), 1.0);
+
+
+
+}
+
+
BOOST_AUTO_TEST_CASE( test_print )
{
Matrix m;
diff --git a/mia/core/test_gsl_matrix_vector_ops.cc b/mia/core/test_gsl_matrix_vector_ops.cc
index c8b57e3..e28b55a 100644
--- a/mia/core/test_gsl_matrix_vector_ops.cc
+++ b/mia/core/test_gsl_matrix_vector_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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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_gsl_multimin.cc b/mia/core/test_gsl_multimin.cc
index e03d7af..d7d5b7f 100644
--- a/mia/core/test_gsl_multimin.cc
+++ b/mia/core/test_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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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_gsl_pca.cc b/mia/core/test_gsl_pca.cc
index e1cf77d..3707bdf 100644
--- a/mia/core/test_gsl_pca.cc
+++ b/mia/core/test_gsl_pca.cc
@@ -1,7 +1,7 @@
/* -*- mia-c++ -*-
*
* This file is part of MIA - a toolbox for medical image analysis
- * Copyright (c) Leipzig, Madrid 1999-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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_gsl_vector.cc b/mia/core/test_gsl_vector.cc
index 98b3d91..c9ca155 100644
--- a/mia/core/test_gsl_vector.cc
+++ b/mia/core/test_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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,44 @@ BOOST_AUTO_TEST_CASE_TEMPLATE( test_vector_copy_to, T ,test_types )
}
+BOOST_AUTO_TEST_CASE_TEMPLATE( test_vector_move_to, T ,test_types )
+{
+
+ const typename T::value_type init[5] = {1, 2, 3, 4, 5};
+ std::vector<typename T::value_type> a(init, init+5);
+ T gsl_vector(5,false);
+ std::copy(a.begin(), a.end(), gsl_vector.begin());
+
+ BOOST_REQUIRE(gsl_vector.size()== 5);
+
+ T other(std::move(gsl_vector));
+
+ BOOST_REQUIRE(other.is_valid());
+ BOOST_REQUIRE(other.size()== 5);
+ BOOST_CHECK(!gsl_vector.is_valid());
+
+ BOOST_CHECK_EQUAL(other[0], 1.0);
+ BOOST_CHECK_EQUAL(other[4], 5.0);
+
+ T gsl_vector2(2, true);
+ gsl_vector2[0] = 10;
+ gsl_vector2[1] = 12;
+
+ other = std::move(gsl_vector2);
+ BOOST_REQUIRE(other.is_valid());
+
+ // coverity [CONSTANT_EXPRESSION_RESULT]
+ BOOST_REQUIRE(other.size()== 2);
+ BOOST_CHECK(!gsl_vector2.is_valid());
+
+ BOOST_CHECK_EQUAL(other[0], 10.0);
+ BOOST_CHECK_EQUAL(other[1], 12.0);
+
+
+
+}
+
+
BOOST_AUTO_TEST_CASE_TEMPLATE( test_vector_copy_from, T ,test_types )
{
T gsl_vector(5,false);
diff --git a/mia/core/test_handler.cc b/mia/core/test_handler.cc
index 9bd90c7..ac5f6bc 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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_helpers.hh b/mia/core/test_helpers.hh
index 423aa2a..2b13edc 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 565fe64..c6e6c4f 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 bb34db1..770cc86 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 dfd6f99..82f0304 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 cf5f5a8..aa8ecc6 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 b91c1a5..764fc7e 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -108,7 +108,7 @@ void InterpolatorIDFixture::test_case(const string& interpolator_kernel, double
BOOST_CHECK_CLOSE( (*interp)(0) + 1, f(0.0) + 1, tolerance);
for(size_t x = 0; x < 512; ++x) {
double interpx = (*interp)(x);
- if (abs(interpx > 1e-10) || f(x) >1e-10)
+ if ((abs(interpx) > 1e-10) || f(x) >1e-10)
BOOST_CHECK_CLOSE( interpx, f(x), tolerance);
}
@@ -116,7 +116,7 @@ void InterpolatorIDFixture::test_case(const string& interpolator_kernel, double
// at the boundaries unreliable
for(size_t x = 10; x < 502; ++x) {
double interpdx = interp->derivative_at(x);
- if (abs(interpdx > 1e-3) || df(x) >1e-3)
+ if ((abs(interpdx) > 1e-3) || df(x) >1e-3)
BOOST_CHECK_CLOSE( interpdx, df(x), 2*tolerance);
}
}
diff --git a/mia/core/test_iohandler.cc b/mia/core/test_iohandler.cc
index 7a9befd..2fd7eb7 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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_kernels.cc b/mia/core/test_kernels.cc
index dda81a4..cd7a9d9 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 3c93530..054b997 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,9 +34,9 @@ BOOST_AUTO_TEST_CASE( test_closes_class_center )
BOOST_CHECK_EQUAL(kmeans_get_closest_clustercenter(classes, 3, -2), 0);
BOOST_CHECK_EQUAL(kmeans_get_closest_clustercenter(classes, 1, 30), 1);
- BOOST_CHECK_EQUAL(kmeans_get_closest_clustercenter(classes, 4, 24), 2);
+ BOOST_CHECK_EQUAL(kmeans_get_closest_clustercenter(classes, 3, 24), 2);
BOOST_CHECK_EQUAL(kmeans_get_closest_clustercenter(classes, 3, 28), 3);
- BOOST_CHECK_EQUAL(kmeans_get_closest_clustercenter(classes, 4, 18), 2);
+ BOOST_CHECK_EQUAL(kmeans_get_closest_clustercenter(classes, 3, 18), 2);
}
diff --git a/mia/core/test_labelmap.cc b/mia/core/test_labelmap.cc
index cf722aa..1509e7d 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 e00922f..6f0591f 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 d1edbc3..ae259af 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 16213ee..15ed014 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 32c615d..c9768c0 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 84e0b15..a1e0cd5 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 4481380..ab33c37 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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_parallelcxx11.cc b/mia/core/test_parallelcxx11.cc
index e6aaa84..486fdf1 100644
--- a/mia/core/test_parallelcxx11.cc
+++ b/mia/core/test_parallelcxx11.cc
@@ -1,7 +1,7 @@
/* -*- mia-c++ -*-
*
* This file is part of MIA - a toolbox for medical image analysis
- * Copyright (c) Leipzig, Madrid 1999-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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_parameter.cc b/mia/core/test_parameter.cc
index e0dc71f..2667131 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,11 @@
#include <mia/core/parameter.hh>
#include <mia/core/msgstream.hh>
+#include <mia/core/paramarray.hh>
#include <mia/core/parameter.cxx>
+
NS_MIA_USE
@@ -198,6 +200,34 @@ BOOST_AUTO_TEST_CASE( test_bounded_param_int_min_close)
}
+BOOST_AUTO_TEST_CASE( test_bounded_param_vint_min_close)
+{
+ vector<int32_t> v;
+ CVSIBoundedParameter testv(v, EParameterBounds::bf_min_closed,
+ {-2}, false, "a bounded test value");
+
+
+ BOOST_CHECK(testv.set("-2,2,3"));
+ BOOST_CHECK_EQUAL(v.size(), 3u);
+ BOOST_CHECK_EQUAL(v[0], -2);
+ BOOST_CHECK_EQUAL(v[1], 2);
+ BOOST_CHECK_EQUAL(v[2], 3);
+
+ v.clear();
+ BOOST_CHECK(testv.set("2,-2"));
+ BOOST_CHECK_EQUAL(v.size(), 2u);
+ BOOST_CHECK_EQUAL(v[0], 2);
+ BOOST_CHECK_EQUAL(v[1], -2);
+
+ // throw if boundary is not respected
+ v.clear();
+ BOOST_CHECK_THROW(testv.set("-3,3"), std::invalid_argument);
+
+ // throw if expected size is given
+ v.resize(2);
+ BOOST_CHECK_THROW(testv.set("-2,2,10,5"), std::invalid_argument);
+}
+
BOOST_AUTO_TEST_CASE( test_bounded_param_unsignedshort_min_open)
{
unsigned short v = 0;
@@ -238,5 +268,48 @@ BOOST_AUTO_TEST_CASE( test_bounded_param_unsignedshort_min_close_negative_input)
}
+BOOST_AUTO_TEST_CASE( test_paramarray_uint32_success )
+{
+ TPerLevelScalarParam<uint32_t> value(128000);
+
+ BOOST_CHECK_EQUAL(value[0], 128000);
+ BOOST_CHECK_EQUAL(value[1], 128000);
+
+
+ PCmdOption opt =
+ value.create_level_params_option("long_name",'l',
+ EParameterBounds::bf_min_closed,
+ {100}, "this is the help");
+
+
+ opt->set_value("200,400,70000");
+
+ BOOST_CHECK_EQUAL(value[0], 200u);
+ BOOST_CHECK_EQUAL(value[1], 400u);
+ BOOST_CHECK_EQUAL(value[2], 70000u);
+ BOOST_CHECK_EQUAL(value[3], 70000u);
+
+}
+
+BOOST_AUTO_TEST_CASE( test_paramarray_int32_unbounded_success )
+{
+ TPerLevelScalarParam<int32_t> value(128000);
+
+ PCmdOption opt =
+ value.create_level_params_option("long_name",'l',
+ "this is the help");
+
+ BOOST_CHECK_EQUAL(value[0], 128000);
+ BOOST_CHECK_EQUAL(value[1], 128000);
+
+ opt->set_value("-200,400,70000");
+
+ BOOST_CHECK_EQUAL(value[0], -200);
+ BOOST_CHECK_EQUAL(value[1], 400);
+ BOOST_CHECK_EQUAL(value[2], 70000);
+ BOOST_CHECK_EQUAL(value[3], 70000);
+
+}
+
diff --git a/mia/core/test_parseroutput.cc b/mia/core/test_parseroutput.cc
index d6e7d9d..ffb5112 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 c804ab3..ca28611 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,13 +33,8 @@ NS_MIA_USE
BOOST_AUTO_TEST_CASE( test_pixeltype_translation )
{
-#ifdef LONG_64BIT
BOOST_CHECK(CPixelTypeDict.get_name_set().size() == 12);
BOOST_CHECK(it_none == 11);
-#else
- BOOST_CHECK(CPixelTypeDict.get_name_set().size() == 10);
- BOOST_CHECK(it_none == 9);
-#endif
BOOST_CHECK(CPixelTypeDict.get_value("bit") == it_bit);
BOOST_CHECK(CPixelTypeDict.get_value("ubyte") == it_ubyte);
@@ -48,10 +43,8 @@ BOOST_AUTO_TEST_CASE( test_pixeltype_translation )
BOOST_CHECK(CPixelTypeDict.get_value("sshort") == it_sshort);
BOOST_CHECK(CPixelTypeDict.get_value("uint") == it_uint);
BOOST_CHECK(CPixelTypeDict.get_value("sint") == it_sint);
-#ifdef LONG_64BIT
BOOST_CHECK(CPixelTypeDict.get_value("ulong") == it_ulong);
BOOST_CHECK(CPixelTypeDict.get_value("slong") == it_slong);
-#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);
diff --git a/mia/core/test_probmap.cc b/mia/core/test_probmap.cc
index f944407..0321936 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 26e3c2b..6ccf126 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 ef2f89c..426acaf 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 43e8df7..aa2d91d 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 f67c412..b529420 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 c4a368a..0bfab38 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 5588cde..a70738b 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 10a01ef..1412d86 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 52ded7e..7c2ee68 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 76b1fe0..ba88ddf 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,10 +57,13 @@ BOOST_AUTO_TEST_CASE ( test_singlular_refobj_empty_then_copy )
TSingleReferencedObject<int> myobj2(1);
myobj = myobj2;
- BOOST_CHECK_EQUAL(myobj.get_refcount(), 2u);
+ BOOST_CHECK_EQUAL(myobj.get_refcount(), 2u);
+ BOOST_CHECK_EQUAL(myobj2.get_refcount(), 2u);
+ cvdebug() << "second coming\n";
+
myobj2 = TSingleReferencedObject<int>();
BOOST_CHECK_EQUAL(myobj2.get_refcount(), 0u);
- BOOST_CHECK_EQUAL(myobj.get_refcount(), 1u);
+ BOOST_CHECK_EQUAL(myobj.get_refcount(), 1u);
}
diff --git a/mia/core/test_slopeclassifier.cc b/mia/core/test_slopeclassifier.cc
index 82b3f90..9e0f5ef 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 de6de38..0966326 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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_histogram.cc b/mia/core/test_sparse_histogram.cc
index 7220cee..bf17bb6 100644
--- a/mia/core/test_sparse_histogram.cc
+++ b/mia/core/test_sparse_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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 9c9ae13..f5683e7 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 e03090b..54c31be 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 84f9097..6ed0b90 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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_sqmin.cc b/mia/core/test_sqmin.cc
index cdd1262..402cd31 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 3c77278..ed6f5be 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 d56c0ed..92a38c2 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 32528a2..2590c48 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 06088ca..ef914ad 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 b83cd86..cd62eda 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 de4ae26..49d40bb 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 473b040..8cd0ca9 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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 @@ void don_t_optimize_x_away(double /*x*/)
*/
BOOST_AUTO_TEST_CASE( test_watch )
{
- CWatch watch;
+ CWatch& watch = CWatch::instance();
#ifndef WIN32
timeval tv_start, tv_end;
double start = watch.get_seconds();
diff --git a/mia/core/test_waveletslopeclassifier.cc b/mia/core/test_waveletslopeclassifier.cc
index 4819fda..6637e19 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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
index ac0826c..9a9213b 100644
--- a/mia/core/test_xmlinterface.cc
+++ b/mia/core/test_xmlinterface.cc
@@ -1,7 +1,7 @@
/* -*- mia-c++ -*-
*
* This file is part of MIA - a toolbox for medical image analysis
- * Copyright (c) Leipzig, Madrid 1999-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,7 +41,7 @@ BOOST_AUTO_TEST_CASE( test_nested_xml_doc_string )
child2->set_attribute("attribute22", "4");
- auto result_string = doc.write_to_string_formatted();
+ auto result_string = doc.write_to_string();
cvdebug() << "Result=\n" << result_string << "\n";
@@ -71,7 +71,7 @@ BOOST_AUTO_TEST_CASE( test_simple_xml_doc_string )
child2->set_attribute("attribute22", "4");
- auto result_string = doc.write_to_string_formatted();
+ auto result_string = doc.write_to_string();
cvdebug() << "Result=\n" << result_string << "\n";
@@ -86,3 +86,179 @@ BOOST_AUTO_TEST_CASE( test_simple_xml_doc_string )
BOOST_CHECK_EQUAL(result_string, string(test_string));
}
+
+BOOST_AUTO_TEST_CASE( test_xml_doc_string_with_content_and_special_values )
+{
+ CXMLDocument doc;
+
+ auto root_node = doc.create_root_node("root");
+
+ auto child1 = root_node->add_child("child1");
+ child1->set_attribute("attribute1", "1");
+ child1->set_attribute("attribute2", "2");
+ child1->set_child_text("1 <> 2");
+
+ auto child2 = child1->add_child("child2");
+ child2->set_attribute("attribute21", "3");
+ child2->set_attribute("attribute22", "4");
+
+
+ auto result_string = doc.write_to_string();
+
+ cvdebug() << "Result=\n" << result_string << "\n";
+
+ const char *test_string =
+ "<?xml version=\"1.0\"?>\n"
+ "<root>\n"
+ " <child1 attribute1=\"1\" attribute2=\"2\">1 <> 2"
+ "<child2 attribute21=\"3\" attribute22=\"4\"/>"
+ "</child1>\n"
+ "</root>\n";
+
+ BOOST_CHECK_EQUAL(result_string, string(test_string));
+
+}
+
+
+BOOST_AUTO_TEST_CASE( test_xml_doc_string_with_content )
+{
+ CXMLDocument doc;
+
+ auto root_node = doc.create_root_node("root");
+
+ auto child1 = root_node->add_child("child1");
+ child1->set_attribute("attribute1", "1");
+ child1->set_attribute("attribute2", "2");
+ child1->set_child_text("some text");
+
+ auto child2 = child1->add_child("child2");
+ child2->set_attribute("attribute21", "3");
+ child2->set_attribute("attribute22", "4");
+
+
+ auto result_string = doc.write_to_string();
+
+ cvdebug() << "Result=\n" << result_string << "\n";
+
+ const char *test_string =
+ "<?xml version=\"1.0\"?>\n"
+ "<root>\n"
+ " <child1 attribute1=\"1\" attribute2=\"2\">some text"
+ "<child2 attribute21=\"3\" attribute22=\"4\"/>"
+ "</child1>\n"
+ "</root>\n";
+
+ BOOST_CHECK_EQUAL(result_string, string(test_string));
+
+}
+
+
+BOOST_AUTO_TEST_CASE( test_simple_xml_doc_string_read )
+{
+ const char *test_string =
+ "<?xml version=\"1.0\"?>\n"
+ "<root version=\"3\">\n"
+ " <frame attribute1=\"1\" attribute2=\"2\">\n"
+ " <child attribute21=\"3\" attribute22=\"4\"/>\n"
+ " </frame>\n"
+ " <frame attribute1=\"5\" attribute2=\"6\">\n"
+ " <child attribute21=\"7\" attribute22=\"8\"/>\n"
+ " <child attribute21=\"9\" attribute22=\"A\"/>\n"
+ " </frame>\n"
+ " <text>This is a text</text>\n"
+ "</root>\n";
+
+
+ CXMLDocument doc(test_string);
+
+
+ auto root = doc.get_root_node();
+
+ BOOST_CHECK_EQUAL(root->get_attribute("version"), "3");
+
+ auto frames = root->get_children("frame");
+ BOOST_CHECK_EQUAL(frames.size(), 2u);
+ BOOST_REQUIRE(frames.size() == 2u);
+
+ auto f0 = frames[0];
+ BOOST_CHECK_EQUAL(f0->get_attribute("attribute1"), "1");
+ BOOST_CHECK_EQUAL(f0->get_attribute("attribute2"), "2");
+
+ auto children0 = f0->get_children("child");
+ BOOST_REQUIRE(children0.size() == 1u);
+
+ auto c00 = children0[0];
+ BOOST_CHECK_EQUAL(c00->get_attribute("attribute21"), "3");
+ BOOST_CHECK_EQUAL(c00->get_attribute("attribute22"), "4");
+
+
+ auto f1 = frames[1];
+ BOOST_CHECK_EQUAL(f1->get_attribute("attribute1"), "5");
+ BOOST_CHECK_EQUAL(f1->get_attribute("attribute2"), "6");
+
+ auto children1 = f1->get_children("child");
+ BOOST_REQUIRE(children1.size() == 2u);
+
+ auto c10 = children1[0];
+ BOOST_CHECK_EQUAL(c10->get_attribute("attribute21"), "7");
+ BOOST_CHECK_EQUAL(c10->get_attribute("attribute22"), "8");
+
+ auto c11 = children1[1];
+ BOOST_CHECK_EQUAL(c11->get_attribute("attribute21"), "9");
+ BOOST_CHECK_EQUAL(c11->get_attribute("attribute22"), "A");
+
+ auto textnode = root->get_children("text");
+ BOOST_REQUIRE(textnode.size() == 1u);
+
+ auto text = textnode[0]->get_content();
+ BOOST_CHECK_EQUAL(text, "This is a text");
+}
+
+BOOST_AUTO_TEST_CASE( test_simple_xml_doc_string_read_with_special_chars )
+{
+ const char *test_string =
+ "<?xml version=\"1.0\"?>\n"
+ "<root version=\"3\">\n"
+ " <text>1 < 2; 2 > 1</text>\n"
+ "</root>\n";
+
+
+ CXMLDocument doc(test_string);
+
+
+ auto root = doc.get_root_node();
+
+ BOOST_CHECK_EQUAL(root->get_attribute("version"), "3");
+
+ auto textnode = root->get_children("text");
+ BOOST_REQUIRE(textnode.size() == 1u);
+
+ auto text = textnode[0]->get_content();
+ BOOST_CHECK_EQUAL(text, "1 < 2; 2 > 1");
+}
+
+BOOST_AUTO_TEST_CASE( test_simple_xml_broken1 )
+{
+ const char *test_string =
+ "<?xml version=";
+
+
+ BOOST_CHECK_THROW(CXMLDocument(test_string).get_root_node(),runtime_error);
+
+ CXMLDocument manual_read;
+ BOOST_CHECK(!manual_read.read_from_string(test_string));
+}
+
+BOOST_AUTO_TEST_CASE( test_simple_xml_broken2 )
+{
+ const char *test_string =
+ "<?xml version=\"1.0\"?>\n"
+ "<root version=\"3\">\n"
+ " <text>1 < 2; 2 > 1</text>\n";
+
+
+ BOOST_CHECK_THROW(CXMLDocument(test_string).get_root_node(),runtime_error);
+
+ CXMLDocument manual_read;
+ BOOST_CHECK(!manual_read.read_from_string(test_string));
+}
diff --git a/mia/core/testplug/dummy1.cc b/mia/core/testplug/dummy1.cc
index dca8cab..d4fd466 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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/dummy2.cc b/mia/core/testplug/dummy2.cc
index 3e1ba10..9451d0e 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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/lala.cc b/mia/core/testplug/lala.cc
index 551c84c..201d160 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 537f3c2..6d3700a 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 83d41e6..c3f0877 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 7dd8a0a..e6c7f44 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 f341795..7b1937d 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 8c4e4e3..5c2c5e8 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 2282911..6f71a62 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 cd8e5f1..99f4d27 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 3a468ba..871b16e 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 33939a4..2aa2019 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 8379dbc..2290bc7 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,27 +25,27 @@ NS_MIA_BEGIN
const char *timestep_type::type_descr = "timestep";
-DEFINE_TYPE_DESCR(short);
-DEFINE_TYPE_DESCR(int);
-DEFINE_TYPE_DESCR(long);
+DEFINE_TYPE_DESCR2(int16_t, "short");
+DEFINE_TYPE_DESCR2(int32_t, "int");
+DEFINE_TYPE_DESCR2(int64_t, "long");
DEFINE_TYPE_DESCR(float);
DEFINE_TYPE_DESCR(double);
DEFINE_TYPE_DESCR(bool);
-DEFINE_TYPE_DESCR2(signed char, "sbyte");
-DEFINE_TYPE_DESCR2(unsigned char, "ubyte");
+DEFINE_TYPE_DESCR2(int8_t, "sbyte");
+DEFINE_TYPE_DESCR2(uint8_t, "ubyte");
-DEFINE_TYPE_DESCR2(unsigned short, "ushort");
-DEFINE_TYPE_DESCR2(unsigned int, "uint");
-DEFINE_TYPE_DESCR2(unsigned long, "ulong");
+DEFINE_TYPE_DESCR2(uint16_t, "ushort");
+DEFINE_TYPE_DESCR2(uint32_t, "uint");
+DEFINE_TYPE_DESCR2(uint64_t, "ulong");
DEFINE_TYPE_DESCR2(std::string, "string");
-DEFINE_TYPE_DESCR2(std::vector<short>, "vshort");
-DEFINE_TYPE_DESCR2(std::vector<int>, "vint");
-DEFINE_TYPE_DESCR2(std::vector<long>, "vlong");
-DEFINE_TYPE_DESCR2(std::vector<unsigned int>, "vuint");
-DEFINE_TYPE_DESCR2(std::vector<unsigned short>, "vushort");
-DEFINE_TYPE_DESCR2(std::vector<unsigned long>, "vulong");
+DEFINE_TYPE_DESCR2(std::vector<int16_t>, "vshort");
+DEFINE_TYPE_DESCR2(std::vector<int32_t>, "vint");
+DEFINE_TYPE_DESCR2(std::vector<int64_t>, "vlong");
+DEFINE_TYPE_DESCR2(std::vector<uint32_t>, "vuint");
+DEFINE_TYPE_DESCR2(std::vector<uint16_t>, "vushort");
+DEFINE_TYPE_DESCR2(std::vector<uint64_t>, "vulong");
DEFINE_TYPE_DESCR2(std::vector<float>, "vfloat");
DEFINE_TYPE_DESCR2(std::vector<double>, "vdouble");
DEFINE_TYPE_DESCR2(std::vector<bool>, "vbool");
diff --git a/mia/core/typedescr.hh b/mia/core/typedescr.hh
index f9fd9d7..57f8028 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -80,26 +80,26 @@ struct __type_descr {
/// @cond NEVER
-DECLARE_TYPE_DESCR(signed char);
-DECLARE_TYPE_DESCR(unsigned char);
-DECLARE_TYPE_DESCR(short);
-DECLARE_TYPE_DESCR(int);
-DECLARE_TYPE_DESCR(long);
-DECLARE_TYPE_DESCR(unsigned int);
-DECLARE_TYPE_DESCR(unsigned short);
-DECLARE_TYPE_DESCR(unsigned long);
+DECLARE_TYPE_DESCR(int8_t);
+DECLARE_TYPE_DESCR(uint8_t);
+DECLARE_TYPE_DESCR(int16_t);
+DECLARE_TYPE_DESCR(int32_t);
+DECLARE_TYPE_DESCR(int64_t);
+DECLARE_TYPE_DESCR(uint16_t);
+DECLARE_TYPE_DESCR(uint32_t);
+DECLARE_TYPE_DESCR(uint64_t);
DECLARE_TYPE_DESCR(float);
DECLARE_TYPE_DESCR(double);
DECLARE_TYPE_DESCR(bool);
DECLARE_TYPE_DESCR(std::string);
-DECLARE_TYPE_DESCR(std::vector<short>);
-DECLARE_TYPE_DESCR(std::vector<int>);
-DECLARE_TYPE_DESCR(std::vector<long>);
-DECLARE_TYPE_DESCR(std::vector<unsigned int>);
-DECLARE_TYPE_DESCR(std::vector<unsigned short>);
-DECLARE_TYPE_DESCR(std::vector<unsigned long>);
+DECLARE_TYPE_DESCR(std::vector<int16_t>);
+DECLARE_TYPE_DESCR(std::vector<int32_t>);
+DECLARE_TYPE_DESCR(std::vector<int64_t>);
+DECLARE_TYPE_DESCR(std::vector<uint32_t>);
+DECLARE_TYPE_DESCR(std::vector<uint16_t>);
+DECLARE_TYPE_DESCR(std::vector<uint64_t>);
DECLARE_TYPE_DESCR(std::vector<float>);
DECLARE_TYPE_DESCR(std::vector<double>);
DECLARE_TYPE_DESCR(std::vector<bool>);
diff --git a/mia/core/utils.cc b/mia/core/utils.cc
index 6903f2a..d8b1402 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,14 +22,10 @@
#include <unistd.h>
#endif
-#ifndef WIN32
-#include <regex.h>
-#include <dirent.h>
-#else
+#ifdef WIN32
#include <direct.h>
#define getcwd _getcwd
#define chdir _chdir
-#define PATH_MAX 1024
#endif
#include <limits.h>
@@ -45,6 +41,11 @@
#include <mia/core/utils.hh>
#include <mia/core/msgstream.hh>
+// WIN32 and HURD don't define this
+#ifndef PATH_MAX
+#define PATH_MAX 1024
+#endif
+
NS_MIA_BEGIN
CCWDSaver::CCWDSaver():
@@ -64,68 +65,6 @@ CCWDSaver::~CCWDSaver()
delete[] cwd;
}
-#if 0
-static bool scan_dir(const std::string& path, const std::string& pattern, std::list<std::string>& list)
-{
- class TFindRegExp {
- regex_t preg;
- public:
- TFindRegExp(const std::string& pattern) {
- char buf[1024];
- int status = regcomp (&preg, pattern.c_str(), REG_EXTENDED |REG_NOSUB);
- if (status) {
- regerror(status, &preg, buf, 1024);
- std::cerr << buf << std::endl;
- }
- }
-
- ~TFindRegExp() {
- regfree(&preg);
- }
- bool check(const char *s) {
- return !regexec(&preg, s,0, NULL, 0);
- }
- };
-
-
- CCWDSaver __saver;
-
- if (chdir(path.c_str())) {
- //std::cerr << path << ":" << strerror(errno) << std::endl;
- return false;
- }
-
- struct dirent **namelist;
- int nfiles = scandir(".", &namelist, NULL , NULL);
-
- TFindRegExp searcher(pattern);
- for (int i = 0; i < nfiles; i++) {
- if (searcher.check(namelist[i]->d_name))
- list.push_back(path + std::string("/") + std::string(namelist[i]->d_name));
- free(namelist[i]);
-
- }
- free(namelist);
-
- return true;
-}
-
-
-FSearchFiles::FSearchFiles(std::list<std::string>& __result, const std::string& __pattern):
- result(__result),
- pattern(__pattern)
-{
-}
-
-void FSearchFiles::operator()(const std::string& path) {
- try {
- scan_dir(path, pattern, result);
- }
- catch (std::exception& e) {
- std::cerr << e.what();
- }
-}
-#endif
#ifndef _GNU_SOURCE
// there should be an intrinsic (at least on intel)
diff --git a/mia/core/utils.hh b/mia/core/utils.hh
index f9ab369..b0e8964 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 e1d79c7..f542d43 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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 @@ public:
reference operator[] (size_t i) {
assert(i < m_size);
DEBUG_ASSERT_RELEASE_THROW(m_data && m_data.unique(),
- "TCArrayWrapper::operator[]: No writeable data availabe or not unique,"
+ "TCArrayWrapper::operator[]: No writeable data available or not unique,"
" call TCArrayWrapper::make_unique() first or enforce the use of "
"'TCArrayWrapper::operator[](...) const'");
return m_data.get()[i];
@@ -170,7 +170,7 @@ public:
*/
iterator begin() {
DEBUG_ASSERT_RELEASE_THROW(m_data && m_data.unique(),
- "TCArrayWrapper::begin(): No writeable data availabe or not unique, "
+ "TCArrayWrapper::begin(): No writeable data available or not unique, "
"call TCArrayWrapper::make_unique() first or enforce the use of "
"'TCArrayWrapper::begin() const'");
return m_data.get();
@@ -181,7 +181,7 @@ public:
*/
iterator end() {
DEBUG_ASSERT_RELEASE_THROW(m_data && m_data.unique(),
- "TCArrayWrapper::begin(): No writeable data availabe or not unique, "
+ "TCArrayWrapper::begin(): No writeable data available or not unique, "
"call TCArrayWrapper::make_unique() first or enforce the use of "
"'TCArrayWrapper::end() const'");
return m_data.get() + m_size;
diff --git a/mia/core/watch.cc b/mia/core/watch.cc
index 96cd829..130d1a1 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,9 +21,9 @@
#include <stdio.h>
#include <errno.h>
#include <string.h>
-#include <signal.h>
#ifndef WIN32
+#include <signal.h>
#include <sys/time.h>
#endif
@@ -35,8 +35,26 @@ NS_MIA_BEGIN
const int TIMERSPAN=2000;
#ifndef WIN32
+
+class CWatchUnix: public CWatch {
+public:
+ CWatchUnix();
+ ~CWatchUnix();
+
+private:
+ static void overlap_handler(int p_sig);
+ double do_get_seconds() const;
+
+ static uint64_t m_overlaps;
+ struct sigaction m_old_action;
+};
+
CWatch::CWatch()
{
+}
+
+CWatchUnix::CWatchUnix()
+{
itimerval value;
itimerval oldvalue;
@@ -46,15 +64,37 @@ CWatch::CWatch()
value.it_value.tv_sec = TIMERSPAN;
value.it_value.tv_usec = 0;
- if (signal(SIGVTALRM,CWatch::overlap_handler)==SIG_ERR)
+ struct sigaction act;
+ sigemptyset (&act.sa_mask);
+ act.sa_flags = 0;
+ act.sa_handler = CWatchUnix::overlap_handler;
+
+ if (sigaction(SIGVTALRM, &act, &m_old_action) < 0 )
cvwarn() << "Unable to catch signal:" << strerror(errno) << "\n";
if (setitimer(ITIMER_VIRTUAL,&value,&oldvalue))
cvwarn() << "setitimer failed:" << strerror(errno) << "\n";
}
+CWatchUnix::~CWatchUnix()
+{
+ sigaction(SIGVTALRM, &m_old_action, NULL);
+}
+
+
+const CWatch& CWatch::instance()
+{
+ static CWatchUnix me;
+ return me;
+}
+
double CWatch::get_seconds() const
{
+ return do_get_seconds();
+}
+
+double CWatchUnix::do_get_seconds() const
+{
itimerval value;
if (getitimer(ITIMER_VIRTUAL,&value))
@@ -62,15 +102,15 @@ double CWatch::get_seconds() const
double result = TIMERSPAN - value.it_value.tv_sec;
double resultlow = value.it_value.tv_usec/1e+6;
- return (result - resultlow) + TIMERSPAN*double(overlaps);
+ return (result - resultlow) + TIMERSPAN*double(m_overlaps);
}
-void CWatch::overlap_handler(int p_sig)
+void CWatchUnix::overlap_handler(int p_sig)
{
if (p_sig == SIGVTALRM) {
- overlaps++;
+ m_overlaps++;
}
- signal(SIGVTALRM,CWatch::overlap_handler);
+ signal(SIGVTALRM,CWatchUnix::overlap_handler);
}
#else
@@ -86,7 +126,7 @@ void CWatch::overlap_handler(int p_sig)
{
}
#endif
-int CWatch::overlaps=0;
+uint64_t CWatchUnix::m_overlaps=0;
NS_MIA_END
diff --git a/mia/core/watch.hh b/mia/core/watch.hh
index 76d5bc5..c20a11b 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,17 +35,25 @@ NS_MIA_BEGIN
\remark On WIN32 this class is currently a fake that always returns 0.0;
*/
class EXPORT_CORE CWatch {
- static int overlaps;
public:
- /** construct a watch
- \todo Make this a singelton, since no second instance is needed
- */
- CWatch();
-
+ static const CWatch& instance();
+
+
/// \returns get the current time value
double get_seconds() const;
+protected:
+ CWatch();
private:
- static void overlap_handler(int p_sig);
+
+ virtual double do_get_seconds() const = 0;
+
+ CWatch(const CWatch& w) = delete;
+ CWatch(CWatch&& w) = delete;
+ CWatch& operator = (const CWatch& w) = delete;
+ CWatch& operator = (CWatch&& w) = delete;
+
+
+
};
NS_MIA_END
diff --git a/mia/core/waveletslopeclassifier.cc b/mia/core/waveletslopeclassifier.cc
index 8364c13..35c7f7b 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,6 +72,14 @@ CWaveletSlopeClassifier::CWaveletSlopeClassifier(const CWaveletSlopeClassifier&
impl(new CWaveletSlopeClassifierImpl(*other.impl))
{
}
+
+CWaveletSlopeClassifier::CWaveletSlopeClassifier(CWaveletSlopeClassifier&& other):
+ impl(other.impl)
+{
+ other.impl = new CWaveletSlopeClassifierImpl();
+}
+
+
CWaveletSlopeClassifier::CWaveletSlopeClassifier():
impl(new CWaveletSlopeClassifierImpl())
{
@@ -87,6 +95,17 @@ CWaveletSlopeClassifier& CWaveletSlopeClassifier::operator =(const CWaveletSlope
return *this;
}
+CWaveletSlopeClassifier& CWaveletSlopeClassifier::operator =(CWaveletSlopeClassifier&& other)
+{
+ if (this != &other) {
+ auto help = other.impl;
+ delete impl;
+ impl = help;
+ other.impl = new CWaveletSlopeClassifierImpl();
+ }
+ return *this;
+}
+
CWaveletSlopeClassifier::~CWaveletSlopeClassifier()
{
delete impl;
diff --git a/mia/core/waveletslopeclassifier.hh b/mia/core/waveletslopeclassifier.hh
index 9f7dee9..7788693 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,12 +62,19 @@ public:
/** copy constructor */
CWaveletSlopeClassifier(const CWaveletSlopeClassifier& other);
+
+ // Move constructor
+ CWaveletSlopeClassifier(CWaveletSlopeClassifier&& other);
CWaveletSlopeClassifier();
/// assignment operator
CWaveletSlopeClassifier& operator =(const CWaveletSlopeClassifier& other);
+ /// move operator
+ CWaveletSlopeClassifier& operator =(CWaveletSlopeClassifier&& other);
+
+
~CWaveletSlopeClassifier();
/// @return the index of the periodic curve or -1 if none was found
diff --git a/mia/core/xmlinterface.cc b/mia/core/xmlinterface.cc
index a74f596..4c9a3a7 100644
--- a/mia/core/xmlinterface.cc
+++ b/mia/core/xmlinterface.cc
@@ -1,7 +1,7 @@
/* -*- mia-c++ -*-
*
* This file is part of MIA - a toolbox for medical image analysis
- * Copyright (c) Leipzig, Madrid 1999-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,36 +21,116 @@
#include <libxml/parser.h>
#include <libxml/tree.h>
#include <sstream>
+#include <cstdarg>
+#include <map>
+#include <stack>
+
+#include <string>
#include <mia/core/xmlinterface.hh>
#include <mia/core/msgstream.hh>
+#include <mia/core/errormacro.hh>
NS_MIA_BEGIN
using std::string;
-using std::stringstream;
+using std::stringstream;
using std::make_shared;
-using std::vector;
+using std::vector;
+using std::map;
+using std::runtime_error;
+using std::stack;
+using std::pair;
+using std::make_pair;
+using std::unique_ptr;
struct CXMLElementImpl {
CXMLElementImpl(const char *name);
~CXMLElementImpl();
-
- xmlNodePtr element;
- vector<CXMLElement::Pointer> children;
+
+ string m_name;
+ std::string m_content;
+ map<std::string, std::string> m_attributes;
+ vector<CXMLElement::Pointer> m_children;
+
+ xmlNodePtr write_to_node();
+};
+
+
+struct CXMLErrorHandler {
+ CXMLErrorHandler(const std::string& context, string& last_error);
+ ~CXMLErrorHandler();
+ static void error_handler(void *ctx, const char *msg, ...);
+private:
+ string m_context;
+ string& m_last_error;
+
};
-CXMLElementImpl::CXMLElementImpl(const char *name)
+
+CXMLErrorHandler::CXMLErrorHandler(const std::string& context, string& error_msg):
+ m_context(context),
+ m_last_error(error_msg)
+{
+ xmlSetGenericErrorFunc(this, (xmlGenericErrorFunc)CXMLErrorHandler::error_handler);
+}
+
+CXMLErrorHandler::~CXMLErrorHandler()
+{
+ xmlSetGenericErrorFunc(NULL, NULL);
+}
+
+
+void CXMLErrorHandler::error_handler(void *ctx, const char *msg, ...)
+{
+ CXMLErrorHandler* self = reinterpret_cast<CXMLErrorHandler*>(ctx);
+
+ const int TMP_BUF_SIZE = 1024;
+ char s[TMP_BUF_SIZE];
+ va_list arg_ptr;
+
+ va_start(arg_ptr, msg);
+ vsnprintf(s, TMP_BUF_SIZE, msg, arg_ptr);
+ va_end(arg_ptr);
+
+ stringstream error_msg;
+ error_msg << self->m_context << ":" << s;
+ self->m_last_error = error_msg.str();
+}
+
+
+CXMLElementImpl::CXMLElementImpl(const char *name):
+ m_name(name)
{
- element = xmlNewNode(nullptr, BAD_CAST name);
}
CXMLElementImpl::~CXMLElementImpl()
{
- // here the element should be freed if it is not a child
-
}
-
+
+xmlNodePtr CXMLElementImpl::write_to_node()
+{
+ auto this_node = xmlNewNode(nullptr, BAD_CAST m_name.c_str());
+ // add attributes
+ for (auto a: m_attributes)
+ xmlNewProp(this_node, BAD_CAST a.first.c_str(), BAD_CAST a.second.c_str());
+
+ // add content
+ // missing: add encoding special chars
+ if (!m_content.empty()) {
+ xmlNodePtr text = xmlNewText(BAD_CAST m_content.c_str());
+ xmlAddChild(this_node, text);
+ }
+
+ // add children
+ for (auto child: m_children) {
+ auto child_node = child->impl->write_to_node();
+ xmlAddChild(this_node, child_node );
+ }
+
+ return this_node;
+}
+
CXMLElement::CXMLElement(const char *name):
impl(new CXMLElementImpl(name))
@@ -67,84 +147,220 @@ CXMLElement::~CXMLElement()
CXMLElement::Pointer CXMLElement::add_child(const char *name)
{
Pointer result = make_shared<CXMLElement>(name);
- impl->children.push_back(result);
- xmlAddChild(impl->element, result->impl->element);
+ impl->m_children.push_back(result);
return result;
}
void CXMLElement::set_child_text(const std::string& value)
{
- xmlNodeAddContent(impl->element, BAD_CAST value.c_str());
+ assert(impl);
+ impl->m_content += value;
}
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);
- }
+ assert(impl);
+ impl->m_attributes[name] = value;
}
+const string& CXMLElement::get_name() const
+{
+ assert(impl);
+ return impl->m_name;
+}
-struct CXMLDocumentImpl {
- CXMLDocumentImpl();
- ~CXMLDocumentImpl();
-
- xmlDocPtr doc;
-};
+const string CXMLElement::get_attribute(const string& name) const
+{
+ auto ip = impl->m_attributes.find(name);
+ if (ip != impl->m_attributes.end()) {
+ return ip->second;
+ }
+ return string();
+
+}
-CXMLDocumentImpl::CXMLDocumentImpl()
+const vector<CXMLElement::Pointer>& CXMLElement::get_all_children() const
{
- doc = xmlNewDoc(BAD_CAST "1.0");
+ assert(impl);
+ return impl->m_children;
}
-CXMLDocumentImpl::~CXMLDocumentImpl()
+vector<CXMLElement::Pointer> CXMLElement::get_children(const char *name) const
{
- xmlFreeDoc(doc);
+ assert(impl);
+ vector<CXMLElement::Pointer> result;
+ for (auto c : impl->m_children) {
+ if (c->get_name() == name)
+ result.push_back(c);
+ }
+ return result;
}
+const std::string& CXMLElement::get_content() const
+{
+ return impl->m_content;
+}
-CXMLDocument::CXMLDocument():
- impl(new CXMLDocumentImpl)
+
+
+CXMLElement::Pointer CXMLDocument::create_root_node(const char *name)
{
+ m_root = CXMLElement::Pointer(new CXMLElement(name));
+ return m_root;
}
-
-CXMLDocument::~CXMLDocument()
+CXMLElement::Pointer CXMLDocument::get_root_node() const
{
- delete impl;
- xmlCleanupParser();
-
+ return m_root;
}
-
-CXMLElement::Pointer CXMLDocument::create_root_node(const char *name)
+
+CXMLDocument::CXMLDocument()
+{
+}
+
+CXMLDocument::CXMLDocument(const char *init)
{
- auto result = make_shared<CXMLElement>(name);
- xmlDocSetRootElement(impl->doc, result->impl->element);
- return result;
+ if (!read_from_string(init)) {
+ throw runtime_error(m_last_error);
+ }
+}
+
+
+struct xmlDocDeleter {
+ void operator() (xmlDoc *p) {
+ xmlFreeDoc(p);
+ }
+};
+
+bool CXMLDocument::read_from_string(const char *init)
+{
+ CXMLErrorHandler error_handler("XML Reader", m_last_error);
+
+ unique_ptr<xmlDoc, xmlDocDeleter> doc(xmlParseDoc(reinterpret_cast<const xmlChar *>(init)));
+
+ if (!doc)
+ return false;
+
+ auto root = xmlDocGetRootElement(doc.get());
+
+ if (!root)
+ return false;
+
+ m_root = make_shared<CXMLElement>(reinterpret_cast<const char*>(root->name));
+
+ {
+ xmlChar *content = xmlNodeGetContent(root);
+ if (content) {
+ const char *c = reinterpret_cast<const char *>(content);
+ m_root->set_child_text(c);
+ xmlFree(content);
+ }
+ // read attributes
+ xmlAttr* attribute = root->properties;
+ while(attribute) {
+ const char* name = reinterpret_cast<const char*>(attribute->name);
+ xmlChar* value = xmlNodeListGetString(root->doc, attribute->children, 1);
+ const char* v = reinterpret_cast<const char*>(value);
+ m_root->set_attribute(name, v);
+ xmlFree(value);
+ attribute = attribute->next;
+ }
+
+ }
+
+
+ std::stack<pair<CXMLElement::Pointer, xmlNodePtr> > s;
+ s.push(make_pair(m_root, root->children));
+
+ cvdebug() << "Parse document\n";
+ while(!s.empty() && m_last_error.empty()) {
+ auto current_level = s.top();
+ s.pop();
+
+
+ for (auto n = current_level.second; n; n = n->next) {
+ if (n->type != XML_ELEMENT_NODE)
+ continue;
+
+ cvdebug() << s.size() << " Got node '" << n->name
+ << "' of type " << n->type << "\n";
+
+
+ auto name = reinterpret_cast<const char *>(n->name);
+ auto node = current_level.first->add_child(name);
+
+ cvdebug() << s.size() << "Add child node to "
+ << current_level.first->get_name() << ": " << name << "\n";
+
+ // read content
+ xmlChar *content = xmlNodeGetContent(n);
+ if (content) {
+ const char *c = reinterpret_cast<const char *>(content);
+ cvdebug() << s.size() << " Got content '" << c << "'\n";
+ node->set_child_text(c);
+ xmlFree(content);
+ }
+
+ // read attributes
+ xmlAttr* attribute = n->properties;
+ while(attribute) {
+ const char* name = reinterpret_cast<const char*>(attribute->name);
+ xmlChar* value = xmlNodeListGetString(n->doc, attribute->children, 1);
+ const char* v = reinterpret_cast<const char*>(value);
+ cvdebug() << s.size()<< " Got attribute '" << name
+ << "', value='" << value << "'\n";
+ node->set_attribute(name, v);
+ xmlFree(value);
+ attribute = attribute->next;
+ }
+
+ if (n->children) {
+ s.push(make_pair(node, n->children));
+ }
+ }
+ }
+
+ return m_last_error.empty();
}
-string CXMLDocument::write_to_string_formatted() const
+
+std::string CXMLDocument::write_to_string(const char *encoding, bool formatted) const
{
- xmlChar *doc_txt_ptr = NULL;
+ string error_msg;
+ CXMLErrorHandler error_handler("XML Writer", error_msg);
+
+ xmlChar *doc_txt_ptr = NULL;
int doc_txt_len = 0;
- xmlKeepBlanksDefault(0);
- xmlDocDumpFormatMemory(impl->doc,
+
+ unique_ptr<xmlDoc, xmlDocDeleter> doc(xmlNewDoc(BAD_CAST "1.0"));
+
+ xmlNodePtr root = m_root->impl->write_to_node();
+ xmlDocSetRootElement(doc.get(), root);
+
+ xmlKeepBlanksDefault(0);
+
+ if (encoding)
+ xmlDocDumpFormatMemoryEnc(doc.get(),
+ &doc_txt_ptr,
+ &doc_txt_len,
+ encoding,
+ formatted ? 1 : 0);
+ else
+ xmlDocDumpFormatMemory(doc.get(),
&doc_txt_ptr,
&doc_txt_len,
- 1);
-
- stringstream out_string;
+ formatted ? 1 : 0);
+
+ stringstream out_string;
out_string << doc_txt_ptr;
free(doc_txt_ptr);
- return out_string.str();
+
+ if (!error_msg.empty())
+ throw runtime_error(error_msg);
+
+ return out_string.str();
+
}
NS_MIA_END
diff --git a/mia/core/xmlinterface.hh b/mia/core/xmlinterface.hh
index 96ed2b8..d654f98 100644
--- a/mia/core/xmlinterface.hh
+++ b/mia/core/xmlinterface.hh
@@ -1,7 +1,7 @@
/* -*- mia-c++ -*-
*
* This file is part of MIA - a toolbox for medical image analysis
- * Copyright (c) Leipzig, Madrid 1999-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,18 +23,25 @@
#define mia_core_xmlinterface_hh
#include <mia/core/defines.hh>
-#include <memory>
+#include <memory>
+#include <vector>
NS_MIA_BEGIN
+class EXPORT_CORE CXMLDocument;
+
/**
\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.
+ This class implements a facade for the XML IO to makes it
+ possible to change the used underlying XML implementation.
+ It is also useful to reduce the compile time dependencies
+ for programs that use MIA.
+ The implemented support for XML is limted, i.e. there is no
+ support for namespaces, schemes, and interleaved node
+ content.
*/
@@ -43,7 +50,12 @@ class EXPORT_CORE CXMLElement {
public:
typedef std::shared_ptr<CXMLElement> Pointer;
+ /**
+ Create a new node
+ \param name tag of the node
+ */
CXMLElement(const char *name);
+
~CXMLElement();
// do not allow copying
@@ -54,6 +66,7 @@ public:
\brief add a new child element
This method adds a new child element to this node
+
\param name name tag of the new child element
\returns the newly created node
@@ -74,37 +87,99 @@ public:
\param value text value to be set
*/
void set_child_text(const std::string& value);
+
+ /// \returns Get name tag of the node
+ const std::string& get_name() const;
+
+ /**
+ retrive an attribute value
+ \param name attribute name to retrive
+ \returns attribute value as string, if the attribute doesn't
+ extist an empty string is returned
+ */
+ const std::string get_attribute(const std::string& name) const;
+
+
+ /// \returns all child nodes
+
+ const std::vector<CXMLElement::Pointer>& get_all_children() const;
+
+
+ /**
+ retrive first level children with a certain tag
+
+ \param name tag of the nodes to be retrived
+ \returns a vector containing the nodes with the requested tag
+ */
+ std::vector<CXMLElement::Pointer> get_children(const char *name) const;
+
+ /// \returns the content of the node as string
+ const std::string& get_content() const;
+
private:
+
+ struct CXMLElementImpl *impl;
+ friend CXMLElementImpl;
friend class CXMLDocument;
- struct CXMLElementImpl *impl;
};
/**
\brief facate for an XML document
- This class implements a facade for a XML document.
-
-
+ This class implements a very simple facade for a XML document that
+ only supports reading, writing, and retriving the root node of the
+ document.
*/
-
class EXPORT_CORE CXMLDocument {
public:
+ /**
+ Create an empty document
+ */
+
CXMLDocument();
- ~CXMLDocument();
+ /**
+ Read the document from a charactar string that comprises
+ valid XML.
+ */
+ CXMLDocument(const char *init);
- CXMLDocument(const CXMLDocument& other) = delete;
- CXMLDocument& operator = (const CXMLDocument& other) = delete;
-
-
- CXMLElement::Pointer create_root_node(const char *);
- std::string write_to_string_formatted() const;
+
+ /**
+ Create a new root node and return it
+ \param name tag of the root node
+ \returns the newly created node
+ */
+ CXMLElement::Pointer create_root_node(const char *name);
+
+ /**
+ \returns the root node of the document, it may be an
+ empty shared pointer
+ */
+ CXMLElement::Pointer get_root_node() const;
+
+ /**
+ Read the document tree from an XML formatted string
+ \param init the valid XML string
+ \returns true if successful, false otherwise
+ */
+ bool read_from_string(const char *init);
+
+ /**
+ Write the document data as XML to a string.
+ \param encoding specify the encoding to be used
+ \param formatted write the xml in a nicely formatted, human readable way
+ \returns the string containing the xml tree
+ */
+ std::string write_to_string(const char *encoding = NULL, bool formatted = true) const;
private:
+ friend class CXMLElement;
+ CXMLElement::Pointer m_root;
- struct CXMLDocumentImpl *impl;
+ std::string m_last_error;
};
NS_MIA_END
diff --git a/mia/internal/autotest.hh b/mia/internal/autotest.hh
index 7cdb7a7..56980d7 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 7385e55..bae406d 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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/pluginsettest.hh b/mia/internal/pluginsettest.hh
index be819de..cb167fd 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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 <boost/test/unit_test.hpp>
template <typename Hander>
-void test_availabe_plugins(const Hander& handler, const std::set<std::string>& test)
+void test_available_plugins(const Hander& handler, const std::set<std::string>& test)
{
auto data = handler.get_set();
BOOST_CHECK_EQUAL(data.size(), test.size());
diff --git a/mia/internal/plugintester.hh b/mia/internal/plugintester.hh
index 531a928..54eeb45 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 4490b16..21ff2e4 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 30f948f..db140fe 100644
--- a/mia/mesh/CMakeLists.txt
+++ b/mia/mesh/CMakeLists.txt
@@ -50,6 +50,7 @@ SET(MIAMESHLIBS miamesh)
ADD_SUBDIRECTORY(io)
ADD_SUBDIRECTORY(filter)
-TEST_MESH(triangulate)
-TEST_MESH(triangle_neighbourhood)
-
+IF(MIA_ENABLE_TESTING)
+ TEST_MESH(triangulate)
+ TEST_MESH(triangle_neighbourhood)
+ENDIF()
diff --git a/mia/mesh/clist.hh b/mia/mesh/clist.hh
index adc4fae..d241557 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 828d631..d633d5b 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 308104b..b476d2d 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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/addscale.cc b/mia/mesh/filter/addscale.cc
index fec461d..f13f298 100644
--- a/mia/mesh/filter/addscale.cc
+++ b/mia/mesh/filter/addscale.cc
@@ -1,7 +1,7 @@
/* -*- mia-c++ -*-
*
* This file is part of MIA - a toolbox for medical image analysis
- * Copyright (c) Leipzig, Madrid 1999-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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/addscale.hh b/mia/mesh/filter/addscale.hh
index c3bb862..f7c10b3 100644
--- a/mia/mesh/filter/addscale.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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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/deltrianglesbynormal.cc b/mia/mesh/filter/deltrianglesbynormal.cc
index 59d5720..2be3283 100644
--- a/mia/mesh/filter/deltrianglesbynormal.cc
+++ b/mia/mesh/filter/deltrianglesbynormal.cc
@@ -1,7 +1,7 @@
/* -*- mia-c++ -*-
*
* This file is part of MIA - a toolbox for medical image analysis
- * Copyright (c) Leipzig, Madrid 1999-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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/deltrianglesbynormal.hh b/mia/mesh/filter/deltrianglesbynormal.hh
index c72f568..eab748c 100644
--- a/mia/mesh/filter/deltrianglesbynormal.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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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.cc b/mia/mesh/filter/scale.cc
index a025a09..f332cfc 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 9d8f351..e2042b3 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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
index 2ef474b..06a8d35 100644
--- a/mia/mesh/filter/selectbig.cc
+++ b/mia/mesh/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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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.hh b/mia/mesh/filter/selectbig.hh
index fc6d58d..2382329 100644
--- a/mia/mesh/filter/selectbig.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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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_addscale.cc b/mia/mesh/filter/test_addscale.cc
index 2818273..05db46e 100644
--- a/mia/mesh/filter/test_addscale.cc
+++ b/mia/mesh/filter/test_addscale.cc
@@ -1,7 +1,7 @@
/* -*- mia-c++ -*-
*
* This file is part of MIA - a toolbox for medical image analysis
- * Copyright (c) Leipzig, Madrid 1999-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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_deltrianglesbynormal.cc b/mia/mesh/filter/test_deltrianglesbynormal.cc
index dfc01f2..2108b1e 100644
--- a/mia/mesh/filter/test_deltrianglesbynormal.cc
+++ b/mia/mesh/filter/test_deltrianglesbynormal.cc
@@ -1,7 +1,7 @@
/* -*- mia-c++ -*-
*
* This file is part of MIA - a toolbox for medical image analysis
- * Copyright (c) Leipzig, Madrid 1999-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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_scale.cc b/mia/mesh/filter/test_scale.cc
index 01f6046..99244c1 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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
index ca33f1c..a3c2470 100644
--- a/mia/mesh/filter/test_selectbig.cc
+++ b/mia/mesh/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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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_vtxsort.cc b/mia/mesh/filter/test_vtxsort.cc
index 0ecdf36..c717df6 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 66287ca..a558894 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 c7bea16..9310f5b 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 2a0e037..6f3f480 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 471479f..ab67644 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -119,9 +119,10 @@ static bool read_line(char *buf, size_t size, FILE *f)
{
char *success;
do {
- success = fgets( buf, size, f);
+ success = fgets( buf, size-1, f);
while (success && (*success == ' ' || *success == '\t')) ++success;
} while (success && (*success == '#' || *success == '\n' || *success == '\r'));
+ buf[size-1] = 0;
return success != NULL;
}
@@ -153,7 +154,6 @@ bool COffMeshIO::load_vertices(CInputFile& inf,
}
char buf[2048];
-
bool success = read_line(buf, 2048, inf);
if (!success)
return false;
@@ -253,6 +253,9 @@ bool COffMeshIO::load_triangles(CInputFile& inp, vector<CTriangleMesh::triangle_
bool success = read_line(line, 2048, inp);
while (nfaces-- && success){
+
+ // it is ensured in read_line that the string in "line" is null-terminated
+ // coverity [TAINTED_SCALAR]
istringstream in_line(line);
if (!read_polygon(in_line, tri, nvertices, triangulator))
@@ -420,7 +423,7 @@ PTriangleMesh COffMeshIO::do_load_it(CInputFile& inp)const
int n_faces = 0;
int n_edges = 0;
- char buffer[2049];
+ char buffer[2048];
if (!read_line(buffer, 2048, inp))
throw create_exception<runtime_error>("OFF: Unable to read from input file.");
diff --git a/mia/mesh/io/ply.cc b/mia/mesh/io/ply.cc
index 1eaba82..6782e79 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,8 @@ using namespace std;
static char const * const format = "ply";
+static const int buflen = 2048;
+
class TPlyMeshIO: public CMeshIOPlugin {
public:
TPlyMeshIO();
@@ -72,22 +74,28 @@ const string TPlyMeshIO::do_get_descr()const
// read the next line and skip comments
//
-static void get_line(char *buffer, string const & filename, FILE *file)
+static void get_line(char *buffer, int buflen, string const & filename, FILE *file)
{
do {
- if (!fgets(buffer, 2048, file)) {
+ if (!fgets(buffer, buflen-1, file)) {
throw create_exception<runtime_error>("Ply: Bougus file '", filename, "'");
}
} while (!strncmp(buffer, "comment ", 8));
- cvdebug() << "Read line '" << buffer << "'\n";
+ // ensure the buffer is null-terminated
+ buffer[buflen-1] = 0;
+ cvdebug() << "Read line '" << buffer << "'\n";
+
}
-static vector<pair<string, vector<string>> > get_properties(char *buffer, string const &filename, FILE *file)
+static vector<pair<string, vector<string>> > get_properties(char *buffer, int buflen, string const &filename, FILE *file)
{
vector<pair<string, vector<string>>> result;
while (!strncmp(buffer, "property ", 9)) {
+
+ // in get_line buffer is ensured to be null terminated
+ // coverity[TAINTED_SCALAR]
istringstream is(buffer);
string key, name, type;
is >> key >> type;
@@ -102,7 +110,7 @@ static vector<pair<string, vector<string>> > get_properties(char *buffer, string
is >> name;
result.push_back(make_pair(type, vector<string>{name}));
}
- get_line(buffer, filename, file);
+ get_line(buffer, buflen, filename, file);
}
return result;
}
@@ -123,11 +131,13 @@ void read_vertex_data(CTriangleMesh::CVertexfield& v,
CTriangleMesh::PNormalfield n,
CTriangleMesh::PColorfield c,
CTriangleMesh::PScalefield s,
- char *buffer, const string& filename, FILE *file)
+ const string& filename, FILE *file)
{
+ char buffer[buflen +1];
for (unsigned i = 0; i < v.size(); ++i) {
- get_line(buffer, filename, file);
-
+ get_line(buffer, buflen, filename, file);
+
+ // coverity[TAINTED_SCALAR]
istringstream buf(buffer);
buf >> v[i].x >> v[i].y >> v[i].z;
@@ -145,8 +155,9 @@ void read_vertex_data(CTriangleMesh::CVertexfield& v,
void read_faces(CTriangleMesh::CTrianglefield& triangles, unsigned n_faces,
const CTriangleMesh::CVertexfield& vertices,
- char *buffer, const string& filename, FILE *file)
+ const string& filename, FILE *file)
{
+ char buffer[buflen];
unsigned count;
vector<unsigned> v(3);
typedef TPolyTriangulator<CTriangleMesh::CVertexfield, vector<unsigned int> > CPolyTriangulator;
@@ -154,8 +165,9 @@ void read_faces(CTriangleMesh::CTrianglefield& triangles, unsigned n_faces,
CPolyTriangulator triangulator(vertices);
for (unsigned i = 0; i < n_faces; ++i) {
- get_line(buffer, filename, file);
-
+ get_line(buffer, buflen, filename, file);
+
+ // coverity[TAINTED_SCALAR]
istringstream buf(buffer);
buf >> count;
if (count > v.max_size()) {
@@ -219,8 +231,10 @@ pair<int, map<string, int>> get_data_flags(const vector<pair<string, vector<stri
PTriangleMesh TPlyMeshIO::do_load(string const & filename) const
{
- cvdebug() << "Load as PLY?\n";
- char buffer[2048];
+ cvdebug() << "Load as PLY?\n";
+ char buffer[buflen];
+
+ // make sure buffer is null-terminated
int n_vertices = 0;
unsigned n_face = 0;
@@ -228,33 +242,33 @@ PTriangleMesh TPlyMeshIO::do_load(string const & filename) const
if (!f)
return PTriangleMesh();
- if ( (!fgets(buffer, 1024, f)) || strncmp(buffer,"ply",3)) {
+ if ( (!fgets(buffer, buflen, f)) || strncmp(buffer,"ply",3)) {
cvdebug() << "Not a PLY file\n";
return PTriangleMesh();
}
- if ( (!fgets(buffer, 1024, f)) || strncmp(buffer,"format ",7)) {
+ if ( (!fgets(buffer, buflen, f)) || strncmp(buffer,"format ",7)) {
throw create_exception<runtime_error>("Ply: Format specifier missing '", filename, "'");
}
// now we must check the type of file, only support ascii though
- get_line(buffer, filename, f);
+ get_line(buffer, buflen, filename, f);
if (sscanf(buffer,"element vertex %d",&n_vertices)!= 1)
throw create_exception<runtime_error>("Ply: Bougus file '", filename,
"', can't parse vertex count from '",buffer,"'.");
- get_line(buffer, filename, f);
+ get_line(buffer, buflen, filename, f);
- auto vertex_properties = get_properties(buffer, filename, f);
+ auto vertex_properties = get_properties(buffer, buflen, filename, f);
if (sscanf(buffer,"element face %d",&n_face)!= 1)
throw create_exception<runtime_error>("Ply: Unsupported file '", filename, "', can't parse face count from '",
buffer, "'");
- get_line(buffer, filename, f);
- auto face_properties = get_properties(buffer, filename, f);
+ get_line(buffer, buflen, filename, f);
+ auto face_properties = get_properties(buffer, buflen, filename, f);
if (strncmp(buffer,"end_header",10))
throw create_exception<runtime_error>("Ply: Header end marker not found in '", filename, "'.");
@@ -280,7 +294,7 @@ PTriangleMesh TPlyMeshIO::do_load(string const & filename) const
if (flags & CTriangleMesh::ed_scale)
scales.reset(new CTriangleMesh::CScalefield(n_vertices));
- read_vertex_data(*vertices, normals, colors, scales, buffer, filename, f);
+ read_vertex_data(*vertices, normals, colors, scales, filename, f);
CTriangleMesh::PTrianglefield triangles(new CTriangleMesh::CTrianglefield);
@@ -291,7 +305,7 @@ PTriangleMesh TPlyMeshIO::do_load(string const & filename) const
triangles->reserve(n_face);
- read_faces(*triangles, n_face, *vertices, buffer, filename, f);
+ read_faces(*triangles, n_face, *vertices, filename, f);
return PTriangleMesh(new CTriangleMesh(triangles, vertices, normals, colors, scales));
}
@@ -321,11 +335,11 @@ public:
if (m_next)
m_next->append(w);
else
- m_next = w;
+ m_next.reset(w);
}
private:
virtual void do_write(const CTriangleMesh& mesh, ostream& os, unsigned i) = 0;
- CElementWriter *m_next;
+ unique_ptr<CElementWriter> m_next;
};
class CVertexWriter : public CElementWriter{
diff --git a/mia/mesh/io/stl.cc b/mia/mesh/io/stl.cc
index 9c31dd6..dc11fa5 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -96,6 +96,7 @@ bool CSTLMeshIO::read_vertex(CVertexMap& vmap, unsigned int& index, istream& f)c
C3DFVector vertex;
f >> tag >> vertex.x >> vertex.y >> vertex.z;
+ // coverity[TAINTED_SCALAR]
if (tag != vertex_tag) {
cverr() << "not a valid ascii STL file\n";
return false;
@@ -126,25 +127,33 @@ PTriangleMesh CSTLMeshIO::load_ascii(istream& f)const
f >> attribute;
+ // coverity is complaining when a tainted string is used in
+ // std::string::operator !=
+ //
+ // coverity[TAINTED_SCALAR]
if (attribute != start_solid)
return PTriangleMesh();
f >> tag;
+ // coverity[TAINTED_SCALAR]
if (tag != start_face) {
cvdebug() << "Loading solid " <<tag << "\n";
f >> tag;
}
+ // coverity[TAINTED_SCALAR]
while (tag != end_solid) {
CTriangleMesh::triangle_type face;
C3DFVector face_normal;
+ // coverity[TAINTED_SCALAR]
if (tag != start_face)
goto fail;
cverb << "start face ";
f >> tag;
+ // coverity[TAINTED_SCALAR]
if (tag != normal_tag)
goto fail;
@@ -153,10 +162,12 @@ PTriangleMesh CSTLMeshIO::load_ascii(istream& f)const
cverb << " normal " << face_normal;
f >> tag;
+ // coverity[TAINTED_SCALAR]
if (tag != start_loop)
goto fail;
f >> tag;
+ // coverity[TAINTED_SCALAR]
if (tag != tag_loop)
goto fail;
@@ -168,10 +179,12 @@ PTriangleMesh CSTLMeshIO::load_ascii(istream& f)const
goto fail;
f >> tag;
+ // coverity[TAINTED_SCALAR]
if (tag != end_loop)
goto fail;
f >> tag;
+ // coverity[TAINTED_SCALAR]
if (tag != end_face)
goto fail;
diff --git a/mia/mesh/io/test_meshio.cc b/mia/mesh/io/test_meshio.cc
index fc0a699..78316fc 100644
--- a/mia/mesh/io/test_meshio.cc
+++ b/mia/mesh/io/test_meshio.cc
@@ -1,7 +1,7 @@
/* -*- mia-c++ -*-
*
* This file is part of MIA - a toolbox for medical image analysis
- * Copyright (c) Leipzig, Madrid 1999-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -374,12 +374,16 @@ static void run_simple_octaedron_test(const char *in_file, const char *test_file
FILE *testfile = fopen(test_file, "r");
BOOST_REQUIRE(testfile);
char buffer[2000];
- memset(buffer, 0, 2000);
size_t flen = test_string.length(); //don't count terminating 0
- size_t read_bytes = fread(buffer, 1, 2000, testfile);
+ size_t read_bytes = fread(buffer, 1, 1999, testfile);
+ BOOST_CHECK_EQUAL(read_bytes, flen);
+
+ // coverity [CONSTANT_EXPRESSION_RESULT]
+ BOOST_REQUIRE(read_bytes < 2000);
+ buffer[read_bytes] = 0;
fclose(testfile);
- BOOST_CHECK_EQUAL(read_bytes, flen);
+
BOOST_CHECK(!strcmp(buffer, test_string.c_str()));
cvdebug() << "Read: '" << buffer << "'\n";
@@ -410,9 +414,12 @@ static void run_octaedron_vertex_normal_test(const char *in_file, const char *te
FILE *testfile = fopen(test_file, "r");
BOOST_REQUIRE(testfile);
char buffer[2000];
- memset(buffer, 0, 2000);
size_t flen = test_string.length();
- size_t read_bytes = fread(buffer, 1, 2000, testfile);
+ size_t read_bytes = fread(buffer, 1, 1999, testfile);
+
+ // coverity [CONSTANT_EXPRESSION_RESULT]
+ BOOST_REQUIRE(read_bytes < 2000);
+ buffer[read_bytes] = 0;
fclose(testfile);
BOOST_CHECK_EQUAL(read_bytes, flen);
@@ -446,9 +453,12 @@ void run_octaedron_vertex_normal_color_test(const char *in_file, const char *tes
FILE *testfile = fopen(test_file, "r");
BOOST_REQUIRE(testfile);
char buffer[2000];
- memset(buffer, 0, 2000);
size_t flen = test_string.length(); //don't count terminating 0
- size_t read_bytes = fread(buffer, 1, 2000, testfile);
+ size_t read_bytes = fread(buffer, 1, 1999, testfile);
+
+ // coverity [CONSTANT_EXPRESSION_RESULT]
+ BOOST_REQUIRE(read_bytes < 2000);
+ buffer[read_bytes] = 0;
fclose(testfile);
BOOST_CHECK_EQUAL(read_bytes, flen);
@@ -481,9 +491,12 @@ void run_octaedron_vertex_normal_scale_test(const char *in_file, const char *tes
FILE *testfile = fopen(test_file, "r");
BOOST_REQUIRE(testfile);
char buffer[2000];
- memset(buffer, 0, 2000);
size_t flen = test_string.length(); //don't count terminating 0
- size_t read_bytes = fread(buffer, 1, 2000, testfile);
+ size_t read_bytes = fread(buffer, 1, 1999, testfile);
+
+ // coverity [CONSTANT_EXPRESSION_RESULT]
+ BOOST_REQUIRE(read_bytes < 2000);
+ buffer[read_bytes] = 0;
fclose(testfile);
BOOST_CHECK_EQUAL(read_bytes, flen);
@@ -518,9 +531,12 @@ BOOST_AUTO_TEST_CASE( test_load_save_octaedron_stl )
FILE *testfile = fopen(test_file, "r");
BOOST_REQUIRE(testfile);
char buffer[2000];
- memset(buffer, 0, 2000);
size_t flen = test_string.length(); //don't count terminating 0
- size_t read_bytes = fread(buffer, 1, 2000, testfile);
+ size_t read_bytes = fread(buffer, 1, 1999, testfile);
+
+ // coverity [CONSTANT_EXPRESSION_RESULT]
+ BOOST_REQUIRE(read_bytes < 2000);
+ buffer[read_bytes] = 0;
fclose(testfile);
BOOST_CHECK_EQUAL(read_bytes, flen);
diff --git a/mia/mesh/test_triangle_neighbourhood.cc b/mia/mesh/test_triangle_neighbourhood.cc
index 05a2c8f..b727e76 100644
--- a/mia/mesh/test_triangle_neighbourhood.cc
+++ b/mia/mesh/test_triangle_neighbourhood.cc
@@ -1,7 +1,7 @@
/* -*- mia-c++ -*-
*
* This file is part of MIA - a toolbox for medical image analysis
- * Copyright (c) Leipzig, Madrid 1999-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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_triangulate.cc b/mia/mesh/test_triangulate.cc
index 2c0e48e..f8e14f6 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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
index 371de0d..5fb0fd3 100644
--- a/mia/mesh/triangle_neighbourhood.cc
+++ b/mia/mesh/triangle_neighbourhood.cc
@@ -1,7 +1,7 @@
/* -*- mia-c++ -*-
*
* This file is part of MIA - a toolbox for medical image analysis
- * Copyright (c) Leipzig, Madrid 1999-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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.hh b/mia/mesh/triangle_neighbourhood.hh
index 6b21ff1..c0e205e 100644
--- a/mia/mesh/triangle_neighbourhood.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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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/triangularMesh.cc b/mia/mesh/triangularMesh.cc
index 96c7903..bccd858 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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/triangularMesh.hh b/mia/mesh/triangularMesh.hh
index 0140e99..9a289cc 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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/triangulate.hh b/mia/mesh/triangulate.hh
index 774a0c9..bb62b66 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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/bandpass.cxx b/mia/template/bandpass.cxx
index 52169b3..f7fd5cd 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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/bandpass.hh b/mia/template/bandpass.hh
index be4854f..de9ae76 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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/binarize.cxx b/mia/template/binarize.cxx
index 557762d..72564d6 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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/binarize.hh b/mia/template/binarize.hh
index 288b619..449038e 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 bab5bae..5846e4c 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 4881248..d3b6a67 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 e86b4f1..c54b890 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 cf549e3..3166d25 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,6 +92,24 @@ private:
long double m_a, m_mx, m_my;
};
+template <typename S, typename T, bool>
+struct can_fast_copy {
+ static bool apply() {
+ return false;
+ }
+};
+
+template <typename S, typename T>
+struct can_fast_copy<S, T, true> {
+ static bool apply() {
+ auto trgt_minmax = get_minmax<T>::apply();
+ auto src_minmax = get_minmax<S>::apply();
+ return (src_minmax.first >= trgt_minmax.first) &&
+ (src_minmax.second <= trgt_minmax.second);
+ }
+};
+
+
template <class Image>
template <template <typename> class Data, typename S, typename T>
@@ -100,19 +118,27 @@ typename TConvert<Image>::result_type TConvert<Image>::convert(const Data<S>& sr
TRACE("TConvert::convert");
long double a = 1.0, mx, my;
- Data<T> *result = new Data<T>(src.get_size(), src);
-
-
+ Data<T> *result = new Data<T>(src.get_size(), src);
+ typename TConvert<Image>::result_type presult(result);
+ auto trgt_minmax = get_minmax<T>::apply();
+
switch (m_ct) {
- case pc_copy:
- a = 1.0;
- mx = 0.0;
- my = 0.0;
- break;
+ case pc_copy: {
+ // fast copy if output type fully contains value range of input type;
+ const bool equal_signedness = std::is_signed<S>::value == std::is_signed<T>::value;
+ if (can_fast_copy<S, T, equal_signedness>::apply()) {
+ std::copy(src.begin(), src.end(), result->begin());
+ return presult;
+ }else{
+ a = 1.0;
+ mx = 0.0;
+ my = 0.0;
+ break;
+ }
+ }
case pc_range: {
auto src_minmax = get_minmax<S>::apply();
- auto trgt_minmax = get_minmax<T>::apply();
cvdebug() << "src_minmax = (" << src_minmax.first << ", " << src_minmax.second << ")\n";
cvdebug() << "trgt_minmax = (" << trgt_minmax.first << ", " << trgt_minmax.second << ")\n";
@@ -125,7 +151,6 @@ typename TConvert<Image>::result_type TConvert<Image>::convert(const Data<S>& sr
break;
}
case pc_opt: {
- auto trgt_minmax = get_minmax<T>::apply();
auto src_minmax = ::boost::minmax_element(src.begin(), src.end());
cvdebug() << "src_minmax = (" << *src_minmax.first << ", " << *src_minmax.second << ")\n";
@@ -143,7 +168,6 @@ typename TConvert<Image>::result_type TConvert<Image>::convert(const Data<S>& sr
break;
}
case pc_opt_stat: {
- const auto trgt_minmax = get_minmax<T>::apply();
const double q_trgt_range = 0.25 * (trgt_minmax.second - trgt_minmax.first);
const auto meanvar = mean_var(src.begin(), src.end());
if (meanvar.second > 0)
@@ -162,7 +186,7 @@ typename TConvert<Image>::result_type TConvert<Image>::convert(const Data<S>& sr
std::transform(src.begin(), src.end(), result->begin(), cv);
- return typename TConvert<Image>::result_type(result);
+ return presult;
}
template <class Image>
diff --git a/mia/template/convert.hh b/mia/template/convert.hh
index de4b256..0311ddc 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 db4e96a..b226a33 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 a10a40d..245cc17 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 c289df8..d5aebd0 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 f5c253f..51f3a48 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 ab2abd0..3e7b578 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 9dafb7c..9414454 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 6f795af..1bd5c4f 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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.hh b/mia/template/fullcost.hh
index a35536d..648b60f 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 93a35f9..7f6dc73 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 256aa94..3259fff 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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
index c35cd72..f3c06b5 100644
--- a/mia/template/labelmap.cxx
+++ b/mia/template/labelmap.cxx
@@ -1,7 +1,7 @@
/* -*- mia-c++ -*-
*
* This file is part of MIA - a toolbox for medical image analysis
- * Copyright (c) Leipzig, Madrid 1999-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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.hh b/mia/template/labelmap.hh
index 437f23d..1bf708f 100644
--- a/mia/template/labelmap.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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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/lsd.hh b/mia/template/lsd.hh
index e4cfde1..7affce2 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 bdfc4eb..1a26b85 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 697a501..74a0c07 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 c29b76c..2c12f25 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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_masked.cxx b/mia/template/mi_masked.cxx
index 2919d72..dd8135d 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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_masked.hh b/mia/template/mi_masked.hh
index 864d246..165e245 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 de2fceb..e15e2f2 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 7dd7586..49076d5 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 27214ba..8c26cd3 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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.hh b/mia/template/nonrigidregister.hh
index 2d3e3d3..6f64041 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 2e53b68..16b4df7 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 6fa90af..dd86c47 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 79f31cc..d4b91dd 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 dca578e..b7b05db 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 e7a3974..a2ae0e4 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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.hh b/mia/template/ssd-automask.hh
index a3cb785..9fab36a 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 f944990..8f5eac6 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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.cxx b/mia/template/ssd_masked.cxx
index 5212020..76a1f5a 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 1ae2dee..e2626c8 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 587c42d..caafb53 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -84,7 +84,7 @@ void TTrackPoint<Transformation>::print(std::ostream& os) const
template <typename Transformation>
void TTrackPoint<Transformation>::move(float timestep, const Transformation& t)
{
- m_pos -= timestep * t.apply(m_pos);
+ m_pos -= timestep * t.get_displacement_at(m_pos);
m_time += timestep;
}
diff --git a/mia/template/trackpoint.hh b/mia/template/trackpoint.hh
index 305f6be..3ae92b7 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 b8ca43e..3bcd9bf 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 5ec4493..479b51a 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; 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 2b8c47b..1efc62c 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/mia/test/testhelpers.hh b/mia/test/testhelpers.hh
index 3920022..134e0b2 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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 ff4cf6c..2fa94ad 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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 be1e0c8..96aa70e 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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 81cabdf..b20e91a 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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 7710cd9..2177b04 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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 e0acfa8..7a51109 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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 b0f7c83..903697f 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -160,7 +160,7 @@ int do_main( int argc, char *argv[] )
options.set_group("\nFile-IO");
options.add(make_opt( in_filename, "in-file", 'i',
"input point set, if this parameter is given a sparse evaluation "
- "of the quantity will be done, otherwise the quantity is evalutated "
+ "of the quantity will be done, otherwise the quantity is evaluated "
"for each grid point of the transformation range.", CCmdOptionFlags::required_input));
options.add(make_opt( out_filename, "out-file", 'o',
"output strains file, for a format description see above.", CCmdOptionFlags::required_output));
diff --git a/src/2dfluid-syn-registration.cc b/src/2dfluid-syn-registration.cc
new file mode 100644
index 0000000..199fa19
--- /dev/null
+++ b/src/2dfluid-syn-registration.cc
@@ -0,0 +1,464 @@
+/* -*- mia-c++ -*-
+ *
+ * This file is part of MIA - a toolbox for medical image analysis
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
+ *
+ * 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/main.hh>
+#include <mia/template/filter_chain.hh>
+#include <mia/core/cmdlineparser.hh>
+#include <mia/core/msgstream.hh>
+#include <mia/core/filter.hh>
+#include <mia/core/convergence_measure.hh>
+#include <mia/core/paramarray.hh>
+#include <mia/core/watch.hh>
+#include <mia/2d/imageio.hh>
+#include <mia/2d/filter.hh>
+#include <mia/2d/transformio.hh>
+#include <mia/2d/transformfactory.hh>
+#include <mia/2d/vfregularizer.hh>
+#include <mia/2d/cost.hh>
+#include <mia/2d/deformer.hh>
+
+
+NS_MIA_USE;
+using namespace std;
+
+const SProgramDescription g_description = {
+ {pdi_group, "Registration, Comparison, and Transformation of 2D images"},
+ {pdi_short, "Non-linear registration of 2D images by using a diffeomorphic SyN registration"},
+ {pdi_description, "This program implements the registration of two gray scale 2D images. "
+ "The transformation applied is a symmeric diffeomorpic fluid dynamic registration. "
+ "To work most efficiently, this program makes a few assumptions about the imput data, i.e. "
+ "the image must be of the same size, have the same voxel spacing, and any intensity "
+ "range normalization or equalization should also be done before calling this program."
+ },
+ {pdi_example_descr, "Register image test.v to image ref.v saving the transformation to transform.v "
+ "and the inverse transform to inverse-transform.v. "
+ "Use three multiresolution levels, ssd as image cost function."},
+ {pdi_example_code, "-i test.v -r ref.v -t transform.v -T inverse-transform.v -l 3 ssd"}
+};
+
+void check_number_of_levels_consistency(size_t nvalues, size_t levels, const std::string& value_name)
+{
+ if (nvalues != 1 && nvalues != levels) {
+ throw create_exception<invalid_argument>(levels, " ",
+ value_name, " values given, but ", nvalues,
+ " multiresolution levels requested");
+ }
+}
+
+
+typedef pair<P2DFVectorfield, P2DFVectorfield> TransformPair;
+
+struct C2DSymScaledRegisterParams {
+ uint32_t mg_levels;
+ P2DImageCost cost;
+ float current_step;
+ P2DVectorfieldRegularizer regularizer;
+ TPerLevelScalarParam<uint32_t> conv_count;
+ TPerLevelScalarParam<double> stop_decline_rate;
+ TPerLevelScalarParam<double> stop_cost;
+ TPerLevelScalarParam<unsigned> iterations;
+
+ C2DSymScaledRegisterParams();
+
+ void add_options(CCmdOptionList& options);
+};
+
+C2DSymScaledRegisterParams::C2DSymScaledRegisterParams():
+ mg_levels(3),
+ current_step(0.25),
+ conv_count(10),
+ stop_decline_rate(0.1),
+ stop_cost(0.1),
+ iterations(100)
+{
+}
+
+void C2DSymScaledRegisterParams::add_options(CCmdOptionList& options)
+{
+ options.set_group("Registration");
+ options.add(make_opt( mg_levels, "mg-levels", 'l', "Number of multi-resolution levels to run the "
+ "registration on. Not that some registration parameters can be given as a "
+ "coma seperated list to indicate per level values. In these cases if the "
+ "number of given values is smaller than the number of multi-resolution "
+ "levels (this parameter), the the last given value is used for all subsequest "
+ "multi-resolution levels."));
+
+ options.add(make_opt(current_step, EParameterBounds::bf_min_open | EParameterBounds::bf_max_closed,
+ {0.0f, 0.5f}, "step", 'S', "Initial step size for all levels"));
+
+ options.add(make_opt( cost, "ssd", "cost", 'c', "Image similarity function to be minimized"));
+ options.add(make_opt( regularizer, "sor:kernel=fluid,maxiter=50", "regularizer", 'R',
+ "Regularization for the force to transformation update"));
+
+
+ options.add(conv_count.
+ create_level_params_option("conv-test-interval",'T', EParameterBounds::bf_closed_interval, {4,40},
+ "Convergence test interations intervall: In order to measure "
+ "convergence the cost function value is averaged over this "
+ "amount of iterations, and the decline rate is evaluated based "
+ "on the linare regression of the cost function values in this "
+ "intervall. This parameter can be given as a coma-seperated "
+ "list with values corresponding to the multi-resolution levels, "
+ "see option --mg-levels for more information."
+ ));
+ options.add(stop_decline_rate.
+ create_level_params_option("stop-decline-rate", 'D', EParameterBounds::bf_min_closed, {0},
+ "Stopping criterium for registration based on the cost decline rate. "
+ "If the rate below this value, the iteration is stopped. "
+ "This parameter can be given as a coma-seperated list with values "
+ "corresponding to the multi-resolution levels, see option "
+ "--mg-levels for more information."
+ ));
+
+ options.add(stop_cost.
+ create_level_params_option("stop-cost", 'C',
+ "Stopping criterium for registration based on the cost value. "
+ "If the cost drops below this value, the iteration is stopped. "
+ "This parameter can be given as a coma-seperated list with values "
+ "corresponding to the multi-resolution levels, see option "
+ "--mg-levels for more information."
+ ));
+
+ options.add(iterations.
+ create_level_params_option("iter", 'I', EParameterBounds::bf_min_closed, {4},
+ "Naximum number if iterations done on each multi-resolution level. "
+ "This parameter can be given as a coma-seperated list with values "
+ "corresponding to the multi-resolution levels, see option "
+ "--mg-levels for more information."));
+}
+
+
+class C2DSymFluidRegistration {
+public:
+ C2DSymFluidRegistration(const C2DSymScaledRegisterParams& params);
+
+ TransformPair run(const C2DFImage& src, const C2DFImage& ref) const;
+private:
+ const C2DSymScaledRegisterParams& m_params;
+};
+
+P2DTransformation wrap_vectorfield_in_transformation(const C2DFVectorfield& field,
+ const C2DTransformCreator& vftcreator)
+{
+
+ // the final transformation is twice the distance
+ auto transform = vftcreator.create(field.get_size());
+ CDoubleVector buffer(transform->degrees_of_freedom(), false);
+
+ double max_transform = 0.0;
+ C2DFVector max_vec;
+
+ auto ib = buffer.begin();
+ for (auto ivf = field.begin(); ivf != field.end(); ++ivf) {
+ cvdebug() << *ivf << "\n";
+ *ib++ = 2.0f * ivf->x;
+ *ib++ = 2.0f * ivf->y;
+
+ double vm = ivf->norm();
+ if (vm > max_transform) {
+ max_transform = vm;
+ max_vec = *ivf;
+ }
+ }
+
+ cvmsg() << "Max-transform = " << max_vec << " norm=" << max_transform << "\n";
+ transform->set_parameters(buffer);
+ return transform;
+}
+
+C2DFImage get_asfloat_pixel(P2DImage image)
+{
+ if (image->get_pixel_type() != it_float)
+ image = run_filters(image, "convert:map=copy,repn=float");
+ return dynamic_cast<const C2DFImage&>(*image);
+}
+
+int do_main( int argc, char *argv[] )
+{
+ string src_filename;
+ string ref_filename;
+
+ string out_transform_filename;
+ string out_inv_transform_filename;
+
+
+ const auto& imageio = C2DImageIOPluginHandler::instance();
+ const auto& transio = C2DTransformationIOPluginHandler::instance();
+
+ CCmdOptionList options(g_description);
+ options.set_group("IO");
+ options.add(make_opt( src_filename, "in-image", 'i', "test image",
+ CCmdOptionFlags::required_input, &imageio));
+ options.add(make_opt( ref_filename, "ref-image", 'r', "reference image",
+ CCmdOptionFlags::required_input, &imageio));
+ options.add(make_opt( out_transform_filename, "transform", 'o', "output transformation",
+ CCmdOptionFlags::required_output, &transio));
+ options.add(make_opt( out_inv_transform_filename, "inverse-transform", 'O',
+ "inverse output transformation",
+ CCmdOptionFlags::required_output, &transio));
+
+ C2DSymScaledRegisterParams params;
+ params.add_options(options);
+
+
+ if (options.parse(argc, argv) != CCmdOptionList::hr_no)
+ return EXIT_SUCCESS;
+
+
+ P2DImage src = load_image2d(src_filename);
+ P2DImage ref = load_image2d(ref_filename);
+
+ C2DSymFluidRegistration registration(params);
+
+ auto result = registration.run(get_asfloat_pixel(src), get_asfloat_pixel(ref));
+
+ auto vftranscreator = produce_2dtransform_factory("vf:imgkernel=[bspline:d=1],imgboundary=zero");
+
+ P2DTransformation t_src_ref = wrap_vectorfield_in_transformation(*result.first, *vftranscreator);
+
+ if (!C2DTransformationIOPluginHandler::instance().save(out_transform_filename, *t_src_ref))
+ throw create_exception<runtime_error>( "Unable to save transformation to '",
+ out_transform_filename, "'");
+
+ P2DTransformation t_ref_src = wrap_vectorfield_in_transformation(*result.second, *vftranscreator);
+
+ if (!C2DTransformationIOPluginHandler::instance().save(out_inv_transform_filename, *t_ref_src))
+ throw create_exception<runtime_error>( "Unable to save transformation to '",
+ out_inv_transform_filename, "'");
+ return EXIT_SUCCESS;
+}
+
+
+MIA_MAIN(do_main);
+
+
+C2DSymFluidRegistration::C2DSymFluidRegistration(const C2DSymScaledRegisterParams& params):
+ m_params(params)
+{
+}
+
+P2DFVectorfield upscale( const C2DFVectorfield& vf, C2DBounds size)
+{
+ P2DFVectorfield Result(new C2DFVectorfield(size));
+ float x_mult = float(size.x) / (float)vf.get_size().x;
+ float y_mult = float(size.y) / (float)vf.get_size().y;
+ float ix_mult = 1.0f / x_mult;
+ float iy_mult = 1.0f / y_mult;
+
+ double max_defo = 0.0;
+ auto callback = [&](const C1DParallelRange& range){
+ // CThreadMsgStream thread_stream;
+
+ for (auto y = range.begin(); y != range.end();++y) {
+ auto i = Result->begin_at(0,y);
+ for (unsigned int x = 0; x < size.x; x++,++i){
+ C2DFVector help(ix_mult * x, iy_mult * y);
+ C2DFVector val = vf.get_interpol_val_at(help);
+ *i = C2DFVector(val.x * x_mult,val.y * y_mult);
+
+ double defo = i->norm();
+ if (max_defo < defo)
+ max_defo = defo;
+ }
+ }
+ };
+ pfor(C1DParallelRange(0, size.y, 1), callback);
+ // race condition !!
+ cvmsg() << "max-defo at size (" << size << ")=" << max_defo << "\n";
+
+ return Result;
+}
+
+
+
+class C2DSymScaledRegister {
+public:
+ C2DSymScaledRegister(unsigned level, const C2DSymScaledRegisterParams& params);
+ void run (const C2DFImage& src, const C2DFImage& ref, TransformPair& transforms) const;
+private:
+ void deform(const C2DFImage& src, const C2DFVectorfield& t, C2DFImage& result) const;
+
+ unsigned m_level;
+ const C2DSymScaledRegisterParams& m_params;
+ C2DInterpolatorFactory m_ipfac;
+
+};
+
+TransformPair
+C2DSymFluidRegistration::run(const C2DFImage& src, const C2DFImage& ref) const
+{
+ const CWatch& watch = CWatch::instance();
+
+ double start_time_global = watch.get_seconds();
+
+ TransformPair transforms;
+
+ for (unsigned l = 0; l < m_params.mg_levels; ++l) {
+ double start_time_level = watch.get_seconds();
+ unsigned scale_block = 1 << (m_params.mg_levels - l - 1);
+
+ stringstream downscale_descr;
+ downscale_descr << "downscale:bx=" << scale_block
+ << ",by=" << scale_block;
+
+ auto downscaler =
+ C2DFilterPluginHandler::instance().produce(downscale_descr.str().c_str());
+
+ auto scaled_src_p = downscaler->filter(src);
+ auto scaled_ref_p = downscaler->filter(ref);
+
+ const C2DFImage& scaled_src = dynamic_cast<const C2DFImage&>(*scaled_src_p);
+ const C2DFImage& scaled_ref = dynamic_cast<const C2DFImage&>(*scaled_ref_p);
+
+ if (!transforms.first) {
+ transforms.first.reset(new C2DFVectorfield(scaled_src.get_size()));
+ transforms.second.reset(new C2DFVectorfield(scaled_src.get_size()));
+ }else{
+ transforms.first = upscale(*transforms.first, scaled_src.get_size());
+ transforms.second = upscale(*transforms.second, scaled_src.get_size());
+ }
+
+ C2DSymScaledRegister level_worker(l, m_params);
+
+ level_worker.run(scaled_src, scaled_ref, transforms);
+ cvmsg() << "Level " << l << " time=" << watch.get_seconds() - start_time_level << "\n";
+
+ }
+ cvmsg() << "Global run time " << watch.get_seconds() - start_time_global << "\n";
+ return transforms;
+}
+
+C2DSymScaledRegister::C2DSymScaledRegister(unsigned level, const C2DSymScaledRegisterParams& params):
+ m_level(level),
+ m_params(params),
+ m_ipfac("bspline:d=1", "zero")
+{
+
+}
+
+void C2DSymScaledRegister::run (const C2DFImage& src, const C2DFImage& ref, TransformPair& transforms) const
+{
+ TransformPair transforms_best = transforms;
+ cvmsg() << "Enter registration at level "<< m_level << " with size " << src.get_size() << "\n";
+ cvmsg() << " Running at most " << m_params.iterations[m_level] << " iterations\n";
+
+ auto current_step = m_params.current_step;
+ CConvergenceMeasure conv_measure(m_params.conv_count[m_level]);
+
+ m_params.regularizer->set_size(src.get_size());
+
+ // deform the images with the input transformations
+ C2DFImage src_tmp(src.get_size());
+ deform(src, *transforms.first, src_tmp);
+
+ C2DFImage ref_tmp(ref.get_size());
+ deform(ref, *transforms.second, ref_tmp);
+
+ // now this runs ping-pong
+ unsigned iter = 0;
+
+ C2DFVectorfield grad(src.get_size());
+ C2DFVectorfield v(src.get_size());
+
+ double decline_rate = numeric_limits<double>::max();
+ double avg_cost = numeric_limits<double>::max();
+
+ double old_cost = numeric_limits<double>::max();
+
+ while (!conv_measure.is_full_size() || (
+ decline_rate > m_params.stop_decline_rate[m_level] &&
+ avg_cost > m_params.stop_cost[m_level] &&
+ iter < m_params.iterations[m_level] &&
+ current_step > 0.0001)) {
+
+ double start_time_level = CWatch::instance().get_seconds();
+ ++iter;
+
+ m_params.cost->set_reference(ref_tmp);
+ double cost_fw = m_params.cost->evaluate_force(src_tmp, grad);
+ float max_v_fw = m_params.regularizer->run(v, grad, *transforms.first);
+ transforms.first->update_by_velocity(v, current_step / max_v_fw);
+ transforms.second->update_as_inverse_of(*transforms.first, 1e-5, 20);
+
+ deform(src, *transforms.first, src_tmp);
+ deform(ref, *transforms.second, ref_tmp);
+
+ m_params.cost->set_reference(src_tmp);
+ double cost_bw = m_params.cost->evaluate_force(ref_tmp, grad);
+ double cost_val = cost_bw + cost_fw;
+
+ // update step length
+ if ( cost_val <= old_cost ) {
+
+ transforms_best = transforms;
+
+ old_cost = cost_val;
+ conv_measure.push(cost_val);
+
+ decline_rate = - conv_measure.rate();
+ avg_cost = conv_measure.value();
+
+ cvmsg() << "[" << setw(4) << iter << "]:"
+ << "cost = "<< cost_fw + cost_bw
+ << ", step = " << current_step
+ << ", cost_avg(n="<< conv_measure.fill()<< ")=" << avg_cost
+ << ", rate=" << decline_rate
+ << ", ct=" << CWatch::instance().get_seconds() - start_time_level << "s"
+ << "\n";
+
+ }
+
+ if ( cost_val < 0.9 * old_cost ) {
+ if (current_step < 0.25) {
+ current_step *= 1.25;
+ if (current_step > 0.25)
+ current_step = 0.25;
+ }
+ }else if ( cost_val > old_cost ) {
+ current_step *= 0.5;
+ cvmsg() << "Increasing cost = " << cost_val
+ << ", Discard step and retry with step size" << current_step <<"\n";
+
+ // reset transform and re-evaluate gradient
+ transforms = transforms_best;
+ deform(src, *transforms.first, src_tmp);
+ deform(ref, *transforms.second, ref_tmp);
+ m_params.cost->set_reference(src_tmp);
+ m_params.cost->evaluate_force(ref_tmp, grad);
+ }
+
+ float max_v_bw = m_params.regularizer->run(v, grad, *transforms.second);
+
+ transforms.second->update_by_velocity(v, current_step / max_v_bw);
+ transforms.first->update_as_inverse_of(*transforms.second, 1e-5, 20);
+
+ deform(src, *transforms.first, src_tmp);
+ deform(ref, *transforms.second, ref_tmp);
+ }
+ transforms = transforms_best;
+}
+
+void C2DSymScaledRegister::deform(const C2DFImage& src, const C2DFVectorfield& t, C2DFImage& result) const
+{
+ FDeformer2D src_deformer(t, m_ipfac);
+ src_deformer(src,result);
+}
+
diff --git a/src/2dforce.cc b/src/2dforce.cc
index c42a578..848fcd1 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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 89105f1..c085480 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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 84d48b7..6f3c71d 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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 3695512..8e8fe63 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,6 @@
#include <cstdlib>
#include <mia/core.hh>
-#include <libxml++/libxml++.h>
#include <mia/2d/imageio.hh>
#include <mia/2d/filter.hh>
#include <mia/2d/ground_truth_evaluator.hh>
@@ -45,7 +44,7 @@ const SProgramDescription g_description = {
{pdi_short, "Registration of a series of 2D images"},
{pdi_description, "This program implements the non-linear registration based on Pseudo "
"Ground Thruth for motion compensation of series of myocardial perfusion images as "
- "decribed in Chao Li and Ying Sun, 'Nonrigid Registration of Myocardial Perfusion "
+ "described in Chao Li and Ying Sun, 'Nonrigid Registration of Myocardial Perfusion "
"MRI Using Pseudo Ground Truth' , In Proc. Medical Image Computing and Computer-Assisted "
"Intervention MICCAI 2009, 165-172, 2009. Note that for this nonlinear motion correction "
"a preceding linear registration step is usually required."},
@@ -237,10 +236,9 @@ int do_main( int argc, char *argv[] )
input_set.rename_base(registered_filebase);
input_set.save_images(out_filename);
- unique_ptr<xmlpp::Document> outset(input_set.write());
ofstream outfile(out_filename.c_str(), ios_base::out );
if (outfile.good())
- outfile << outset->write_to_string_formatted();
+ outfile << input_set.write().write_to_string();
return outfile.good() ? EXIT_SUCCESS : EXIT_FAILURE;
diff --git a/src/2dimagecombine-dice.cc b/src/2dimagecombine-dice.cc
index 54fd397..9feddce 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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 68ce7bd..60aafd4 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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 ef083d3..fb40aad 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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 f8c75be..5fb0f32 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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 64a2188..c275ed4 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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 dff210a..eadaf84 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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 4636ad7..2d02254 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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 31293f9..84d7322 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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 d8f37e3..e859768 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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
index c1387ff..7af4a2c 100644
--- a/src/2dimagestack-cmeans.cc
+++ b/src/2dimagestack-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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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/2dimagestats.cc b/src/2dimagestats.cc
index 31ed608..d3506a0 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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/2dlerp.cc b/src/2dlerp.cc
index 3c62f86..eda790f 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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 ba76ef6..22e9074 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,8 +19,6 @@
*/
#include <fstream>
-#include <libxml++/libxml++.h>
-#include <itpp/signal/fastica.h>
#include <boost/filesystem.hpp>
#include <mia/core/filetools.hh>
diff --git a/src/2dmulti-force.cc b/src/2dmulti-force.cc
index 20fb2e4..83adf37 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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/2dmulti-nrreg.cc b/src/2dmulti-nrreg.cc
index 6c7fdcd..a77d75b 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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 7b53718..4bd3eee 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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/2dmultiimageto3d.cc b/src/2dmultiimageto3d.cc
index 2e7ec08..edcdfe4 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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 9e3235a..3e2b43d 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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 6b98899..444fc9c 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,12 +57,9 @@ const SProgramDescription g_description = {
{pdi_example_code, "-i imageXXXX.exr -o ref -k 2 -C 5 -m -n"}
};
-
-// this needs to be replaced by a parameter
-CICAAnalysisITPPFactory icatool;
-
unique_ptr<C2DImageSeriesICA> get_ica(vector<C2DFImage>& series, bool strip_mean,
- size_t& components, bool ica_normalize, int max_iterations)
+ size_t& components, bool ica_normalize, int max_iterations,
+ const CIndepCompAnalysisFactory& icatool)
{
srand(time(NULL));
@@ -153,12 +150,12 @@ void save_coefs(const string& coefs_name, const C2DImageSeriesICA& ica)
throw create_exception<runtime_error>( "unable to save coefficients to '", coefs_name, "'");
}
-CICAAnalysis::IndexSet get_all_without_periodic(const CSlopeClassifier::Columns& curves, bool strip_mean)
+CIndepCompAnalysis::IndexSet get_all_without_periodic(const CSlopeClassifier::Columns& curves, bool strip_mean)
{
CSlopeClassifier cls(curves, strip_mean);
int periodic_index = cls.get_periodic_idx();
- CICAAnalysis::IndexSet result;
+ CIndepCompAnalysis::IndexSet result;
for (int i = 0; i < (int)curves.size(); ++i) {
if (i != periodic_index)
result.insert(i);
@@ -295,7 +292,7 @@ P2DFilter create_LV_cropper(P2DImage rvlv_feature,
}
-CICAAnalysis::IndexSet get_LV_RV_Perfusion(const CSlopeClassifier::Columns& curves)
+CIndepCompAnalysis::IndexSet get_LV_RV_Perfusion(const CSlopeClassifier::Columns& curves)
{
priority_queue<element> sorted;
@@ -308,7 +305,7 @@ CICAAnalysis::IndexSet get_LV_RV_Perfusion(const CSlopeClassifier::Columns& curv
sorted.push(e);
}
- CICAAnalysis::IndexSet result;
+ CIndepCompAnalysis::IndexSet result;
result.insert(sorted.top().second);
cvinfo() << "add " << sorted.top().first << " as " << sorted.top().second << "\n";
@@ -355,7 +352,8 @@ int do_main( int argc, char *argv[] )
string numbered_feature_image;
float LV_mask = 0.0; // no mask
int max_iterations = 0;
-
+ PIndepCompAnalysisFactory icatool;
+
const auto& imageio = C2DImageIOPluginHandler::instance();
CCmdOptionList options(g_description);
@@ -376,6 +374,7 @@ int do_main( int argc, char *argv[] )
options.add(make_opt(skip_only_periodic,"strip-periodic",'p', "strip only periodic component"));
+ options.add(make_opt( icatool, "internal", "fastica", 0, "FastICA implementationto be used"));
options.add(make_opt(max_iterations,"max-ica-iterations",'x', "max ICA solver iterations"));
options.add(make_opt( ica_normalize, "ica-normalize", 'n', "ica_normalize feature images"));
@@ -420,10 +419,10 @@ int do_main( int argc, char *argv[] )
cvmsg()<< "Got series of " << series.size() << " images\n";
// always strip mean
unique_ptr<C2DImageSeriesICA> ica =
- get_ica(series, strip_mean, components, ica_normalize, max_iterations);
+ get_ica(series, strip_mean, components, ica_normalize, max_iterations, *icatool);
CSlopeClassifier::Columns curves = ica->get_mixing_curves();
- CICAAnalysis::IndexSet component_set = skip_only_periodic ?
+ CIndepCompAnalysis::IndexSet component_set = skip_only_periodic ?
get_all_without_periodic(curves, strip_mean):
get_LV_RV_Perfusion(curves);
diff --git a/src/2dmyocard-icaseries.cc b/src/2dmyocard-icaseries.cc
index 57dd3fe..5b37af8 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,8 +28,6 @@
//#include <mia/core/fft1d_r2c.hh>
#include <queue>
-#include <libxml++/libxml++.h>
-
#include <mia/core.hh>
#include <mia/core/ica.hh>
@@ -82,7 +80,8 @@ int do_main( int argc, char *argv[] )
float box_scale = 1.4;
size_t skip_images = 0;
size_t max_ica_iterations = 400;
- C2DPerfusionAnalysis::EBoxSegmentation segmethod=C2DPerfusionAnalysis::bs_features;
+ C2DPerfusionAnalysis::EBoxSegmentation segmethod=C2DPerfusionAnalysis::bs_features;
+ PIndepCompAnalysisFactory icatool;
CCmdOptionList options(g_description);
options.set_group("File-IO");
@@ -96,6 +95,7 @@ int do_main( int argc, char *argv[] )
"Also save the coefficients of the initial best and the final IC mixing matrix.", CCmdOptionFlags::output));
options.set_group("ICA");
+ options.add(make_opt( icatool, "internal", "fastica", 0, "FastICA implementationto be used"));
options.add(make_opt( components, "components", 'C', "ICA components 0 = automatic estimation"));
options.add(make_opt( normalize, "normalize", 0, "normalized ICs"));
options.add(make_opt( no_meanstrip, "no-meanstrip", 0,
@@ -125,11 +125,7 @@ int do_main( int argc, char *argv[] )
if (max_ica_iterations)
ica.set_max_ica_iterations(max_ica_iterations);
-
- // this needs to be replaced by a parameter
- CICAAnalysisITPPFactory icatool;
-
- if (!ica.run(series, icatool)) {
+ if (!ica.run(series, *icatool)) {
// ICA + classifictaion failed,
// save the mixing matrix if requested
if (!save_crop_feature.empty())
@@ -179,10 +175,9 @@ int do_main( int argc, char *argv[] )
input_set.rename_base(cf.string());
input_set.save_images(cropped_filename);
- unique_ptr<xmlpp::Document> test_cropset(input_set.write());
ofstream outfile(cropped_filename, ios_base::out );
if (outfile.good())
- outfile << test_cropset->write_to_string_formatted();
+ outfile << input_set.write().write_to_string();
else
throw create_exception<runtime_error>( "unable to save to '", cropped_filename, "'");
}
@@ -195,11 +190,9 @@ int do_main( int argc, char *argv[] )
input_set.rename_base(reff.filename().string());
input_set.save_images(reference_filename);
-
- unique_ptr<xmlpp::Document> test_regset(input_set.write());
ofstream outfile2(reference_filename, ios_base::out );
if (outfile2.good())
- outfile2 << test_regset->write_to_string_formatted();
+ outfile2 << input_set.write().write_to_string();
else
throw create_exception<runtime_error>( "unable to save to '", cropped_filename, "'");
}
diff --git a/src/2dmyocard-segment.cc b/src/2dmyocard-segment.cc
index f25dd7a..5be3cfe 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,8 +27,6 @@
//#include <mia/core/fft1d_r2c.hh>
#include <queue>
-#include <libxml++/libxml++.h>
-
#include <mia/core.hh>
#include <mia/core/meanvar.hh>
@@ -421,7 +419,8 @@ int do_main( int argc, char *argv[] )
bool normalize = false;
bool no_meanstrip = false;
size_t skip_images = 2;
- size_t max_ica_iterations = 400;
+ size_t max_ica_iterations = 400;
+ PIndepCompAnalysisFactory icatool;
const auto& imageio = C2DImageIOPluginHandler::instance();
@@ -435,6 +434,7 @@ int do_main( int argc, char *argv[] )
CCmdOptionFlags::output));
options.set_group("ICA");
+ options.add(make_opt( icatool, "internal", "fastica", 0, "FastICA implementationto be used"));
options.add(make_opt( components, "components", 'C', "ICA components 0 = automatic estimation testing 4 and 5"));
options.add(make_opt( normalize, "normalize", 0, "normalized ICs"));
options.add(make_opt( no_meanstrip, "no-meanstrip", 0,
@@ -467,10 +467,9 @@ int do_main( int argc, char *argv[] )
if (max_ica_iterations)
ica->set_max_ica_iterations(max_ica_iterations);
- CICAAnalysisITPPFactory icaatool;
- if (!ica->run(series, icaatool)) {
- ica->set_approach(CICAAnalysis::appr_symm);
- ica->run(series, icaatool);
+ if (!ica->run(series, *icatool)) {
+ ica->set_approach(CIndepCompAnalysis::appr_symm);
+ ica->run(series, *icatool);
}
rv_idx = ica->get_RV_idx();
diff --git a/src/2dmyocard-upsloap.cc b/src/2dmyocard-upsloap.cc
index 6c51e98..e5bfd9e 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,8 +27,6 @@
#include <queue>
-#include <libxml++/libxml++.h>
-
#include <mia/core.hh>
#include <mia/2d/imageio.hh>
@@ -95,7 +93,8 @@ int do_main( int argc, char *argv[] )
bool no_meanstrip = false;
size_t skip_images = 0;
size_t max_ica_iterations = 400;
-
+ PIndepCompAnalysisFactory icatool;
+
int reference = -1;
int nsegments = 12;
@@ -105,6 +104,7 @@ int do_main( int argc, char *argv[] )
options.add(make_opt( out_filename, "out-file", 'o', "output file with curves", CCmdOptionFlags::required_output));
options.set_group("ICA");
+ options.add(make_opt( icatool, "internal", "fastica", 0, "FastICA implementationto be used"));
options.add(make_opt( components, "components", 'C', "ICA components 0 = automatic estimation"));
options.add(make_opt( normalize, "normalize", 0, "normalized ICs"));
options.add(make_opt( no_meanstrip, "no-meanstrip", 0,
diff --git a/src/2dmyoica-full.cc b/src/2dmyoica-full.cc
index ed8376f..0292391 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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 <fstream>
-#include <itpp/signal/fastica.h>
#include <mia/core/msgstream.hh>
#include <mia/core/threadedmsg.hh>
@@ -36,7 +35,6 @@
#include <boost/filesystem/path.hpp>
-#include <libxml++/libxml++.h>
#include <mia/core/parallel.hh>
using namespace std;
@@ -221,7 +219,7 @@ void run_nonlinear_registration_passes (CSegSetWithImages& input_set,
double divcurlweight, double divcurlweight_divider,
int max_pass, const string& imagecost,
int global_reference, float min_rel_frequency,
- const CICAAnalysisFactory& icatool)
+ const CIndepCompAnalysisFactory& icatool)
{
int current_pass = 0;
bool do_continue=true;
@@ -252,7 +250,7 @@ void run_nonlinear_registration_passes (CSegSetWithImages& input_set,
input_set.get_images().end(), series.begin(), FCopy2DImageToFloatRepn());
if (!ica2.run(series, icatool)) {
- ica2.set_approach(CICAAnalysis::appr_symm);
+ ica2.set_approach(CIndepCompAnalysis::appr_symm);
ica2.run(series, icatool);
}
@@ -277,7 +275,7 @@ void run_linear_registration_passes (CSegSetWithImages& input_set,
int components, bool normalize, bool no_meanstrip, int max_ica_iterations,
int skip_images, const string& minimizer, const string& linear_transform,
size_t mg_levels, int max_pass, const string& imagecost, int global_reference,
- float min_rel_frequency, const CICAAnalysisFactory& icatool)
+ float min_rel_frequency, const CIndepCompAnalysisFactory& icatool)
{
int current_pass = 0;
bool do_continue=true;
@@ -309,7 +307,7 @@ void run_linear_registration_passes (CSegSetWithImages& input_set,
input_set.get_images().end(), series.begin(), FCopy2DImageToFloatRepn());
if (!ica2.run(series, icatool)) {
- ica2.set_approach(CICAAnalysis::appr_symm);
+ ica2.set_approach(CIndepCompAnalysis::appr_symm);
ica2.run(series, icatool);
}
@@ -365,7 +363,7 @@ float get_relative_min_breathing_frequency(const C2DImageSeries& images, int ski
double aq_time = image_end->get_attribute_as<double>(IDAcquisitionTime) -
image_begin->get_attribute_as<double>(IDAcquisitionTime);
if (aq_time < 0)
- throw create_exception<runtime_error>("Got non-postive aquisition time range ", aq_time,
+ throw create_exception<runtime_error>("Got non-postive acquisition time range ", aq_time,
", can't handle this");
double heart_rate = 60 * n_heartbeats / aq_time;
@@ -410,12 +408,12 @@ int do_main( int argc, char *argv[] )
size_t max_ica_iterations = 400;
C2DPerfusionAnalysis::EBoxSegmentation
segmethod=C2DPerfusionAnalysis::bs_features;
-
+ PIndepCompAnalysisFactory icatool;
float min_breathing_frequency = -1.0f;
size_t max_linear_passes = 3;
size_t max_nonlinear_passes = 3;
- int global_reference = -1;
+ int global_reference = -1;
CCmdOptionList options(g_description);
@@ -450,34 +448,35 @@ int do_main( int argc, char *argv[] )
options.add(make_opt(linear_transform, "linear-transform", 0,
"linear transform to be used",
CCmdOptionFlags::none, &C2DTransformCreatorHandler::instance()));
-
- options.add(make_opt(nonlinear_minimizer, "non-linear-optimizer", 'O',
- "Optimizer used for minimization in the non-linear registration.",
- CCmdOptionFlags::none, &CMinimizerPluginHandler::instance()));
- options.add(make_opt( c_rate, "start-c-rate", 'a',
- "start coefficinet rate in spines,"
- " gets divided by --c-rate-divider with every pass."));
- options.add(make_opt( c_rate_divider, "c-rate-divider", 0,
- "Cofficient rate divider for each pass."));
- options.add(make_opt( divcurlweight, "start-divcurl", 'd',
- "Start divcurl weight, gets divided by"
- " --divcurl-divider with every pass."));
- options.add(make_opt( divcurlweight_divider, "divcurl-divider", 0,
- "Divcurl weight scaling with each new pass."));
- options.add(make_opt( global_reference, "reference", 'R', "Global reference all image should be aligned to. If set "
- "to a non-negative value, the images will be aligned to this references, and the cropped "
- "output image date will be injected into the original images. Leave at -1 if "
- "you don't care. In this case all images with be registered to a mean position of the movement"));
-
- // why do I allow to set this parameter, it should always be image:cost=ssd
- options.add(make_opt( imagecost, "imagecost", 'w',
+
+ options.add(make_opt(nonlinear_minimizer, "non-linear-optimizer", 'O',
+ "Optimizer used for minimization in the non-linear registration.",
+ CCmdOptionFlags::none, &CMinimizerPluginHandler::instance()));
+ options.add(make_opt( c_rate, "start-c-rate", 'a',
+ "start coefficinet rate in spines,"
+ " gets divided by --c-rate-divider with every pass."));
+ options.add(make_opt( c_rate_divider, "c-rate-divider", 0,
+ "Cofficient rate divider for each pass."));
+ options.add(make_opt( divcurlweight, "start-divcurl", 'd',
+ "Start divcurl weight, gets divided by"
+ " --divcurl-divider with every pass."));
+ options.add(make_opt( divcurlweight_divider, "divcurl-divider", 0,
+ "Divcurl weight scaling with each new pass."));
+ options.add(make_opt( global_reference, "reference", 'R', "Global reference all image should be aligned to. If set "
+ "to a non-negative value, the images will be aligned to this references, and the cropped "
+ "output image date will be injected into the original images. Leave at -1 if "
+ "you don't care. In this case all images with be registered to a mean position of the movement"));
+
+ // why do I allow to set this parameter, it should always be image:cost=ssd
+ options.add(make_opt( imagecost, "imagecost", 'w',
"image cost, do not specify the src and ref parameters, these will be set by the program.",
CCmdOptionFlags::none, &C2DFullCostPluginHandler::instance()));
options.add(make_opt( mg_levels, "mg-levels", 'l', "multi-resolution levels"));
options.add(make_opt( max_linear_passes, "linear-passes", 'p', "linear registration passes (0 to disable)"));
options.add(make_opt( max_nonlinear_passes, "nonlinear-passes", 'P', "non-linear registration passes (0 to disable)"));
- options.set_group("ICA");
+ options.set_group("ICA");
+ options.add(make_opt( icatool, "internal", "fastica", 0, "FastICA implementationto be used"));
options.add(make_opt( components, "components", 'C', "ICA components 0 = automatic estimation"));
options.add(make_opt( normalize, "normalize", 0, "normalized ICs"));
options.add(make_opt( no_meanstrip, "no-meanstrip", 0,
@@ -493,7 +492,7 @@ int do_main( int argc, char *argv[] )
options.add(make_opt(min_breathing_frequency, "min-breathing-frequency", 'b',
"minimal mean frequency a mixing curve can have to be considered to stem from brething. "
"A healthy rest breating rate is 12 per minute. A negative value disables the test. "
- "A value 0.0 forces the series to be indentified as acquired with initial breath hold."));
+ "A value 0.0 forces the series to be identified as acquired with initial breath hold."));
if (options.parse(argc, argv) != CCmdOptionList::hr_no)
@@ -504,41 +503,41 @@ int do_main( int argc, char *argv[] )
CSegSetWithImages input_set(in_filename, true);
C2DImageSeries input_images = input_set.get_images();
- // copy the original image if the global reference it set, because in this case we
- // want the original sized data as result
-
- C2DImageSeries original_images;
- if (global_reference >= 0)
- original_images = input_set.get_images();
-
-
- float rel_min_bf = get_relative_min_breathing_frequency(input_images, skip_images, min_breathing_frequency);
-
- // now start the first ICA to run the segmentation etc.
+ // copy the original image if the global reference it set, because in this case we
+ // want the original sized data as result
+
+ C2DImageSeries original_images;
+ if (global_reference >= 0)
+ original_images = input_set.get_images();
+
+
+ float rel_min_bf = get_relative_min_breathing_frequency(input_images, skip_images, min_breathing_frequency);
+
+ // now start the first ICA to run the segmentation etc.
cvmsg() << "skipping " << skip_images << " images\n";
vector<C2DFImage> series(input_images.size() - skip_images);
- transform(input_images.begin() + skip_images, input_images.end(),
- series.begin(), FCopy2DImageToFloatRepn());
+ transform(input_images.begin() + skip_images, input_images.end(),
+ series.begin(), FCopy2DImageToFloatRepn());
- // run ICA
- unique_ptr<C2DPerfusionAnalysis> ica(new C2DPerfusionAnalysis(components, normalize, !no_meanstrip));
+ // run ICA
+ unique_ptr<C2DPerfusionAnalysis> ica(new C2DPerfusionAnalysis(components, normalize, !no_meanstrip));
if (max_ica_iterations)
- ica->set_max_ica_iterations(max_ica_iterations);
-
- if (rel_min_bf >= 0)
+ ica->set_max_ica_iterations(max_ica_iterations);
+
+ if (rel_min_bf >= 0)
ica->set_min_movement_frequency(rel_min_bf);
+
+
-
- CICAAnalysisITPPFactory icatool;
- ica->set_approach(CICAAnalysis::appr_defl);
- if (!ica->run(series, icatool)) {
+ ica->set_approach(CIndepCompAnalysis::appr_defl);
+ if (!ica->run(series, *icatool)) {
ica.reset(new C2DPerfusionAnalysis(components, normalize, !no_meanstrip));
- ica->set_approach(CICAAnalysis::appr_symm);
- if (!ica->run(series, icatool))
+ ica->set_approach(CIndepCompAnalysis::appr_symm);
+ if (!ica->run(series, *icatool))
box_scale = false;
}
-
+
if( input_set.get_RV_peak() < 0) {
if (ica->get_RV_peak_time() > 0)
input_set.set_RV_peak(ica->get_RV_peak_time() + skip_images);
@@ -577,10 +576,9 @@ int do_main( int argc, char *argv[] )
input_set.rename_base(cf.filename().string());
input_set.save_images(cropped_filename);
- unique_ptr<xmlpp::Document> test_cropset(input_set.write());
ofstream outfile(cropped_filename, ios_base::out );
if (outfile.good())
- outfile << test_cropset->write_to_string_formatted();
+ outfile << input_set.write().write_to_string();
else
throw create_exception<runtime_error>("unable to save to '", cropped_filename, "'");
@@ -591,7 +589,8 @@ int do_main( int argc, char *argv[] )
run_linear_registration_passes (input_set, references,
components, normalize, no_meanstrip, max_ica_iterations,
skip_images, linear_minimizer, linear_transform,
- mg_levels, max_linear_passes, imagecost, global_reference, rel_min_bf, icatool);
+ mg_levels, max_linear_passes, imagecost, global_reference,
+ rel_min_bf, *icatool);
if (max_nonlinear_passes > 0) {
// if we come from the linear registration, then the references must be re-generated
@@ -607,9 +606,9 @@ int do_main( int argc, char *argv[] )
transform(input_set.get_images().begin() + skip_images,
input_set.get_images().end(), series.begin(), FCopy2DImageToFloatRepn());
- if (!ica2.run(series, icatool)) {
- ica2.set_approach(CICAAnalysis::appr_symm);
- ica2.run(series, icatool);
+ if (!ica2.run(series, *icatool)) {
+ ica2.set_approach(CIndepCompAnalysis::appr_symm);
+ ica2.run(series, *icatool);
}
references_float = ica2.get_references();
@@ -622,13 +621,15 @@ int do_main( int argc, char *argv[] )
skip_images, nonlinear_minimizer,
mg_levels, c_rate, c_rate_divider,
divcurlweight, divcurlweight_divider,
- max_nonlinear_passes, imagecost, global_reference, rel_min_bf, icatool);
+ max_nonlinear_passes, imagecost, global_reference, rel_min_bf, *icatool);
}
cvmsg() << "Registration finished\n";
// copy the data back to the original images if requested
// re-insert the registered sub-images if we have a global reference
- if (global_reference >= 0 && box_scale && input_set.get_images()[0]->get_size() != original_images[0]->get_size()) {
+ if (global_reference >= 0 && box_scale &&
+ input_set.get_images()[0]->get_size() !=
+ original_images[0]->get_size()) {
cvmsg() << "Put cropped and aligned data back into the original images\n";
auto registered_images = input_set.get_images();
const FInsertData id(crop_start, crop_start + registered_images[0]->get_size());
@@ -653,10 +654,9 @@ int do_main( int argc, char *argv[] )
cvmsg() << "Save registered images\n";
input_set.save_images(out_filename);
- unique_ptr<xmlpp::Document> outset(input_set.write());
ofstream outfile(out_filename.c_str(), ios_base::out );
if (outfile.good())
- outfile << outset->write_to_string_formatted();
+ outfile << input_set.write().write_to_string();
return outfile.good() ? EXIT_SUCCESS : EXIT_FAILURE;
diff --git a/src/2dmyoica-nonrigid-parallel.cc b/src/2dmyoica-nonrigid-parallel.cc
index 0475779..c6731b7 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,8 +19,6 @@
*/
#include <fstream>
-#include <libxml++/libxml++.h>
-#include <itpp/signal/fastica.h>
#include <boost/filesystem.hpp>
#include <mia/core/msgstream.hh>
@@ -199,7 +197,7 @@ float get_relative_min_breathing_frequency(const C2DImageSeries& images, int ski
double aq_time = image_end->get_attribute_as<double>(IDAcquisitionTime) -
image_begin->get_attribute_as<double>(IDAcquisitionTime);
if (aq_time < 0)
- throw create_exception<runtime_error>("Got non-postive aquisition time range ", aq_time,
+ throw create_exception<runtime_error>("Got non-postive acquisition time range ", aq_time,
", can't handle this");
double heart_rate = 60 * n_heartbeats / aq_time;
@@ -246,7 +244,7 @@ int do_main( int argc, char *argv[] )
size_t max_ica_iterations = 400;
C2DPerfusionAnalysis::EBoxSegmentation
segmethod=C2DPerfusionAnalysis::bs_features;
-
+ PIndepCompAnalysisFactory icatool;
float min_breathing_frequency = -1.0f;
size_t current_pass = 0;
@@ -300,7 +298,8 @@ int do_main( int argc, char *argv[] )
options.add(make_opt( mg_levels, "mg-levels", 'l', "multi-resolution levels"));
options.add(make_opt( pass, "passes", 'P', "registration passes"));
- options.set_group("ICA");
+ options.set_group("ICA");
+ options.add(make_opt( icatool, "internal", "fastica", 0, "FastICA implementationto be used"));
options.add(make_opt( components, "components", 'C', "ICA components 0 = automatic estimation"));
options.add(make_opt( normalize, "normalize", 0, "normalized ICs"));
options.add(make_opt( no_meanstrip, "no-meanstrip", 0,
@@ -343,12 +342,11 @@ int do_main( int argc, char *argv[] )
if (rel_min_bf > 0)
ica->set_min_movement_frequency(rel_min_bf);
- CICAAnalysisITPPFactory icatool;
- ica->set_approach(CICAAnalysis::appr_defl);
- if (!ica->run(series, icatool)) {
+ ica->set_approach(CIndepCompAnalysis::appr_defl);
+ if (!ica->run(series, *icatool)) {
ica.reset(new C2DPerfusionAnalysis(components, normalize, !no_meanstrip));
- ica->set_approach(CICAAnalysis::appr_symm);
- if (!ica->run(series, icatool))
+ ica->set_approach(CIndepCompAnalysis::appr_symm);
+ if (!ica->run(series, *icatool))
box_scale = false;
}
@@ -390,10 +388,9 @@ int do_main( int argc, char *argv[] )
input_set.rename_base(cf.filename().string());
input_set.save_images(cropped_filename);
- unique_ptr<xmlpp::Document> test_cropset(input_set.write());
ofstream outfile(cropped_filename, ios_base::out );
if (outfile.good())
- outfile << test_cropset->write_to_string_formatted();
+ outfile << input_set.write().write_to_string();
else
throw create_exception<runtime_error>("unable to save to '", cropped_filename, "'");
@@ -422,9 +419,9 @@ int do_main( int argc, char *argv[] )
transform(input_set.get_images().begin() + skip_images,
input_set.get_images().end(), series.begin(), FCopy2DImageToFloatRepn());
- if (!ica2.run(series, icatool)) {
- ica2.set_approach(CICAAnalysis::appr_symm);
- ica2.run(series, icatool);
+ if (!ica2.run(series, *icatool)) {
+ ica2.set_approach(CIndepCompAnalysis::appr_symm);
+ ica2.run(series, *icatool);
}
if (lastpass)
break;
@@ -450,9 +447,9 @@ int do_main( int argc, char *argv[] )
transform(input_set.get_images().begin() + skip_images,
input_set.get_images().end(), series.begin(), FCopy2DImageToFloatRepn());
- if (!ica_final.run(series, icatool)) {
- ica_final.set_approach(CICAAnalysis::appr_symm);
- ica_final.run(series, icatool);
+ if (!ica_final.run(series, *icatool)) {
+ ica_final.set_approach(CIndepCompAnalysis::appr_symm);
+ ica_final.run(series, *icatool);
}
if (!save_crop_feature.empty()) {
@@ -467,10 +464,9 @@ int do_main( int argc, char *argv[] )
input_set.rename_base(registered_filebase);
input_set.save_images(out_filename);
- unique_ptr<xmlpp::Document> outset(input_set.write());
ofstream outfile(out_filename.c_str(), ios_base::out );
if (outfile.good())
- outfile << outset->write_to_string_formatted();
+ outfile << input_set.write().write_to_string();
return outfile.good() ? EXIT_SUCCESS : EXIT_FAILURE;
diff --git a/src/2dmyoica-nonrigid.cc b/src/2dmyoica-nonrigid.cc
index 0c9fc55..9e492a4 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,8 +19,6 @@
*/
#include <fstream>
-#include <libxml++/libxml++.h>
-#include <itpp/signal/fastica.h>
#include <boost/filesystem.hpp>
#include <mia/internal/main.hh>
@@ -163,7 +161,7 @@ float get_relative_min_breathing_frequency(const C2DImageSeries& images, int ski
double aq_time = image_end->get_attribute_as<double>(IDAcquisitionTime) -
image_begin->get_attribute_as<double>(IDAcquisitionTime);
if (aq_time < 0)
- throw create_exception<runtime_error>("Got non-postive aquisition time range ", aq_time,
+ throw create_exception<runtime_error>("Got non-postive acquisition time range ", aq_time,
", can't handle this");
double heart_rate = 60 * n_heartbeats / aq_time;
@@ -210,7 +208,7 @@ int do_main( int argc, char *argv[] )
size_t max_ica_iterations = 400;
C2DPerfusionAnalysis::EBoxSegmentation
segmethod=C2DPerfusionAnalysis::bs_features;
-
+ PIndepCompAnalysisFactory icatool;
float min_breathing_frequency = -1.0f;
size_t current_pass = 0;
@@ -257,7 +255,8 @@ int do_main( int argc, char *argv[] )
options.add(make_opt( mg_levels, "mg-levels", 'l', "multi-resolution levels"));
options.add(make_opt( pass, "passes", 'P', "registration passes"));
- options.set_group("ICA");
+ options.set_group("ICA");
+ options.add(make_opt( icatool, "internal", "fastica", 0, "FastICA implementationto be used"));
options.add(make_opt( components, "components", 'C', "ICA components 0 = automatic estimation"));
options.add(make_opt( normalize, "normalize", 0, "normalized ICs"));
options.add(make_opt( no_meanstrip, "no-meanstrip", 0,
@@ -297,12 +296,11 @@ int do_main( int argc, char *argv[] )
if (rel_min_bf > 0)
ica->set_min_movement_frequency(rel_min_bf);
- CICAAnalysisITPPFactory icatool;
- ica->set_approach(CICAAnalysis::appr_defl);
- if (!ica->run(series, icatool)) {
+ ica->set_approach(CIndepCompAnalysis::appr_defl);
+ if (!ica->run(series, *icatool)) {
ica.reset(new C2DPerfusionAnalysis(components, normalize, !no_meanstrip));
- ica->set_approach(CICAAnalysis::appr_symm);
- if (!ica->run(series, icatool))
+ ica->set_approach(CIndepCompAnalysis::appr_symm);
+ if (!ica->run(series, *icatool))
box_scale = false;
}
@@ -329,10 +327,9 @@ int do_main( int argc, char *argv[] )
input_set.rename_base(cf.filename().string());
input_set.save_images(cropped_filename);
- unique_ptr<xmlpp::Document> test_cropset(input_set.write());
ofstream outfile(cropped_filename, ios_base::out );
if (outfile.good())
- outfile << test_cropset->write_to_string_formatted();
+ outfile << input_set.write().write_to_string();
else
throw create_exception<runtime_error>( "unable to save to '", cropped_filename, "'");
@@ -361,9 +358,9 @@ int do_main( int argc, char *argv[] )
transform(input_set.get_images().begin() + skip_images,
input_set.get_images().end(), series.begin(), FCopy2DImageToFloatRepn());
- if (!ica2.run(series, icatool)) {
- ica2.set_approach(CICAAnalysis::appr_symm);
- ica2.run(series, icatool);
+ if (!ica2.run(series, *icatool)) {
+ ica2.set_approach(CIndepCompAnalysis::appr_symm);
+ ica2.run(series, *icatool);
}
if (lastpass)
break;
@@ -390,9 +387,9 @@ int do_main( int argc, char *argv[] )
transform(input_set.get_images().begin() + skip_images,
input_set.get_images().end(), series.begin(), FCopy2DImageToFloatRepn());
- if (!ica_final.run(series, icatool)) {
- ica_final.set_approach(CICAAnalysis::appr_symm);
- ica_final.run(series, icatool);
+ if (!ica_final.run(series, *icatool)) {
+ ica_final.set_approach(CIndepCompAnalysis::appr_symm);
+ ica_final.run(series, *icatool);
}
if( input_set.get_RV_peak() < 0)
input_set.set_RV_peak(ica_final.get_RV_peak_time() + skip_images);
@@ -413,10 +410,9 @@ int do_main( int argc, char *argv[] )
input_set.rename_base(registered_filebase);
input_set.save_images(out_filename);
- unique_ptr<xmlpp::Document> outset(input_set.write());
ofstream outfile(out_filename.c_str(), ios_base::out );
if (outfile.good())
- outfile << outset->write_to_string_formatted();
+ outfile << input_set.write().write_to_string();
return outfile.good() ? EXIT_SUCCESS : EXIT_FAILURE;
diff --git a/src/2dmyoica-nonrigid2.cc b/src/2dmyoica-nonrigid2.cc
index 0923ab3..2d8278e 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,8 +19,6 @@
*/
#include <fstream>
-#include <libxml++/libxml++.h>
-#include <itpp/signal/fastica.h>
#include <boost/filesystem.hpp>
#include <mia/core/msgstream.hh>
@@ -164,7 +162,7 @@ int do_main( int argc, char *argv[] )
size_t max_ica_iterations = 400;
C2DPerfusionAnalysis::EBoxSegmentation
segmethod=C2DPerfusionAnalysis::bs_features;
-
+ PIndepCompAnalysisFactory icatool;
size_t current_pass = 0;
size_t pass = 3;
@@ -203,7 +201,8 @@ int do_main( int argc, char *argv[] )
options.add(make_opt( mg_levels, "mg-levels", 'l', "multi-resolution levels"));
options.add(make_opt( pass, "passes", 'P', "registration passes"));
- options.set_group("\nICA");
+ options.set_group("\nICA");
+ options.add(make_opt( icatool, "internal", "fastica", 0, "FastICA implementationto be used"));
options.add(make_opt( components, "components", 'C', "ICA components 0 = automatic estimation"));
options.add(make_opt( normalize, "normalize", 0, "don't normalized ICs"));
options.add(make_opt( no_meanstrip, "no-meanstrip", 0,
@@ -240,12 +239,11 @@ int do_main( int argc, char *argv[] )
if (max_ica_iterations)
ica->set_max_ica_iterations(max_ica_iterations);
- CICAAnalysisITPPFactory icatool;
- ica->set_approach(CICAAnalysis::appr_defl);
- if (!ica->run(series, icatool)) {
+ ica->set_approach(CIndepCompAnalysis::appr_defl);
+ if (!ica->run(series, *icatool)) {
ica.reset(new C2DPerfusionAnalysis(components, normalize, !no_meanstrip));
- ica->set_approach(CICAAnalysis::appr_symm);
- if (!ica->run(series, icatool))
+ ica->set_approach(CIndepCompAnalysis::appr_symm);
+ if (!ica->run(series, *icatool))
box_scale = false;
}
@@ -268,10 +266,9 @@ int do_main( int argc, char *argv[] )
input_set.rename_base(cf.filename().string());
input_set.save_images(cropped_filename);
- unique_ptr<xmlpp::Document> test_cropset(input_set.write());
ofstream outfile(cropped_filename, ios_base::out );
if (outfile.good())
- outfile << test_cropset->write_to_string_formatted();
+ outfile << input_set.write().write_to_string();
else
throw create_exception<runtime_error>( "unable to save to '", cropped_filename, "'");
@@ -299,10 +296,10 @@ int do_main( int argc, char *argv[] )
transform(registered.begin() + skip_images,
registered.end(), series.begin(), FCopy2DImageToFloatRepn());
- if (!ica2.run(series, icatool))
- ica2.set_approach(CICAAnalysis::appr_symm);
+ if (!ica2.run(series, *icatool))
+ ica2.set_approach(CIndepCompAnalysis::appr_symm);
- ica2.run(series, icatool);
+ ica2.run(series, *icatool);
divcurlweight /= divcurlweight_divider;
if (c_rate > 1)
c_rate /= c_rate_divider;
@@ -337,10 +334,9 @@ int do_main( int argc, char *argv[] )
input_set.rename_base(registered_filebase);
input_set.save_images(out_filename);
- unique_ptr<xmlpp::Document> outset(input_set.write());
ofstream outfile(out_filename.c_str(), ios_base::out );
if (outfile.good())
- outfile << outset->write_to_string_formatted();
+ outfile << input_set.write().write_to_string();
return outfile.good() ? EXIT_SUCCESS : EXIT_FAILURE;
diff --git a/src/2dmyoicapgt.cc b/src/2dmyoicapgt.cc
index 40f8ede..09baffb 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,8 +19,6 @@
*/
#include <fstream>
-#include <itpp/signal/fastica.h>
-
#include <mia/core/msgstream.hh>
#include <mia/core/threadedmsg.hh>
#include <mia/core/cmdlineparser.hh>
@@ -34,7 +32,6 @@
#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 <mia/core/parallel.hh>
@@ -251,7 +248,7 @@ void run_linear_registration_passes (CSegSetWithImages& input_set,
int components, bool normalize, bool no_meanstrip, int max_ica_iterations,
int skip_images, const string& minimizer, const string& linear_transform,
size_t mg_levels, int max_pass, const string& imagecost, int global_reference,
- float min_rel_frequency, const CICAAnalysisITPPFactory& icatool)
+ float min_rel_frequency, const CIndepCompAnalysisFactory& icatool)
{
int current_pass = 0;
bool do_continue=true;
@@ -279,7 +276,7 @@ void run_linear_registration_passes (CSegSetWithImages& input_set,
input_set.get_images().end(), series.begin(), FCopy2DImageToFloatRepn());
if (!ica2.run(series, icatool)) {
- ica2.set_approach(CICAAnalysis::appr_symm);
+ ica2.set_approach(CIndepCompAnalysis::appr_symm);
ica2.run(series, icatool);
}
if (lastpass)
@@ -336,7 +333,7 @@ float get_relative_min_breathing_frequency(const C2DImageSeries& images, int ski
double aq_time = image_end->get_attribute_as<double>(IDAcquisitionTime) -
image_begin->get_attribute_as<double>(IDAcquisitionTime);
if (aq_time < 0)
- throw create_exception<runtime_error>("Got non-postive aquisition time range ", aq_time,
+ throw create_exception<runtime_error>("Got non-postive acquisition time range ", aq_time,
", can't handle this");
double heart_rate = 60 * n_heartbeats / aq_time;
@@ -380,9 +377,8 @@ int do_main( int argc, char *argv[] )
size_t skip_images = 0;
size_t max_ica_iterations = 400;
C2DPerfusionAnalysis::EBoxSegmentation
- segmethod=C2DPerfusionAnalysis::bs_features;
- CICAAnalysisITPPFactory icatool;
-
+ segmethod=C2DPerfusionAnalysis::bs_features;
+ PIndepCompAnalysisFactory icatool;
float min_breathing_frequency = -1.0f;
size_t max_linear_passes = 3;
@@ -454,7 +450,8 @@ int do_main( int argc, char *argv[] )
options.add(make_opt( max_linear_passes, "linear-passes", 'p', "linear registration passes (0 to disable)"));
options.add(make_opt( max_nonlinear_passes, "nonlinear-passes", 'P', "non-linear registration passes (0 to disable)"));
- options.set_group("ICA");
+ options.set_group("ICA");
+ options.add(make_opt( icatool, "internal", "fastica", 0, "FastICA implementationto be used"));
options.add(make_opt( components, "components", 'C', "ICA components 0 = automatic estimation"));
options.add(make_opt( normalize, "normalize", 0, "normalized ICs"));
options.add(make_opt( no_meanstrip, "no-meanstrip", 0,
@@ -470,7 +467,7 @@ int do_main( int argc, char *argv[] )
options.add(make_opt(min_breathing_frequency, "min-breathing-frequency", 'b',
"minimal mean frequency a mixing curve can have to be considered to stem from brething. "
"A healthy rest breating rate is 12 per minute. A negative value disables the test. "
- "A value 0.0 forces the series to be indentified as acquired with initial breath hold."));
+ "A value 0.0 forces the series to be identified as acquired with initial breath hold."));
options.set_group("\nPseudo Ground Thruth estimation");
@@ -515,11 +512,11 @@ int do_main( int argc, char *argv[] )
ica->set_min_movement_frequency(rel_min_bf);
- ica->set_approach(CICAAnalysis::appr_defl);
- if (!ica->run(series, icatool)) {
+ ica->set_approach(CIndepCompAnalysis::appr_defl);
+ if (!ica->run(series, *icatool)) {
ica.reset(new C2DPerfusionAnalysis(components, normalize, !no_meanstrip));
- ica->set_approach(CICAAnalysis::appr_symm);
- if (!ica->run(series, icatool))
+ ica->set_approach(CIndepCompAnalysis::appr_symm);
+ if (!ica->run(series, *icatool))
box_scale = false;
}
@@ -561,10 +558,9 @@ int do_main( int argc, char *argv[] )
input_set.rename_base(cf.filename().string());
input_set.save_images(cropped_filename);
- unique_ptr<xmlpp::Document> test_cropset(input_set.write());
ofstream outfile(cropped_filename, ios_base::out );
if (outfile.good())
- outfile << test_cropset->write_to_string_formatted();
+ outfile << input_set.write().write_to_string();
else
throw create_exception<runtime_error>("unable to save to '", cropped_filename, "'");
@@ -575,7 +571,7 @@ int do_main( int argc, char *argv[] )
run_linear_registration_passes (input_set, references,
components, normalize, no_meanstrip, max_ica_iterations,
skip_images, linear_minimizer, linear_transform,
- mg_levels, max_linear_passes, imagecost, global_reference, rel_min_bf, icatool);
+ mg_levels, max_linear_passes, imagecost, global_reference, rel_min_bf, *icatool);
if (max_nonlinear_passes > 0)
run_nonlinear_registration_passes (input_set, pgt_alpha, pgt_beta, pgt_rho_thresh,
@@ -612,10 +608,9 @@ int do_main( int argc, char *argv[] )
cvmsg() << "Save registered images\n";
input_set.save_images(out_filename);
- unique_ptr<xmlpp::Document> outset(input_set.write());
ofstream outfile(out_filename.c_str(), ios_base::out );
if (outfile.good())
- outfile << outset->write_to_string_formatted();
+ outfile << input_set.write().write_to_string();
if (!outfile.good())
cverr() << "Unable to saving output to '" << out_filename << "'\n";
diff --git a/src/2dmyomilles.cc b/src/2dmyomilles.cc
index ac82447..0ca0701 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,9 +19,7 @@
*/
#include <fstream>
-#include <libxml++/libxml++.h>
#include <boost/filesystem.hpp>
-#include <itpp/signal/fastica.h>
#include <mia/core/tools.hh>
#include <mia/core/msgstream.hh>
@@ -138,7 +136,7 @@ int do_main( int argc, char *argv[] )
size_t skip_images = 0;
size_t max_ica_iterations = 400;
C2DPerfusionAnalysis::EBoxSegmentation segmethod=C2DPerfusionAnalysis::bs_features;
-
+ PIndepCompAnalysisFactory icatool;
size_t current_pass = 0;
size_t pass = 2;
@@ -168,7 +166,8 @@ int do_main( int argc, char *argv[] )
options.add(make_opt( pass, "passes", 'P', "registration passes"));
- options.set_group("ICA");
+ options.set_group("ICA");
+ options.add(make_opt( icatool, "internal", "fastica", 0, "FastICA implementationto be used"));
options.add(make_opt( components, "components", 'C', "ICA components 0 = automatic estimation"));
options.add(make_opt( normalize, "normalize", 0, "normalized ICs"));
options.add(make_opt( no_meanstrip, "no-meanstrip", 0,
@@ -214,13 +213,12 @@ int do_main( int argc, char *argv[] )
if (use_guess_model)
ica.set_use_guess_model();
- CICAAnalysisITPPFactory icatool;
- if (!ica.run(series, icatool)) {
- ica.set_approach(CICAAnalysis::appr_symm);
- if (!ica.run(series, icatool) )
+ if (!ica.run(series, *icatool)) {
+ ica.set_approach(CIndepCompAnalysis::appr_symm);
+ if (!ica.run(series, *icatool) )
cvwarn() << "ICA analysis didn't converge, results might by bougus\n";
}
-
+
int RV_peak_idx = ica.get_RV_idx();
int LV_peak_idx = ica.get_LV_idx();
@@ -277,10 +275,9 @@ int do_main( int argc, char *argv[] )
input_set.rename_base(cf.filename().string());
input_set.save_images(cropped_filename);
- unique_ptr<xmlpp::Document> test_cropset(input_set.write());
ofstream outfile(cropped_filename, ios_base::out );
if (outfile.good())
- outfile << test_cropset->write_to_string_formatted();
+ outfile << input_set.write().write_to_string();
else
throw create_exception<runtime_error>( "unable to save to '", cropped_filename, "'");
@@ -301,9 +298,9 @@ int do_main( int argc, char *argv[] )
transform(input_images.begin() + skip_images,
input_images.end(), series.begin(), FCopy2DImageToFloatRepn());
- if (!ica2.run(series, icatool))
- ica2.set_approach(CICAAnalysis::appr_symm);
- if (ica2.run(series, icatool) ) {
+ if (!ica2.run(series, *icatool))
+ ica2.set_approach(CIndepCompAnalysis::appr_symm);
+ if (ica2.run(series, *icatool) ) {
references_float = ica2.get_references();
transform(references_float.begin(), references_float.end(),
@@ -349,10 +346,9 @@ int do_main( int argc, char *argv[] )
input_set.save_images(out_filename);
- unique_ptr<xmlpp::Document> outset(input_set.write());
ofstream outfile(out_filename.c_str(), ios_base::out );
if (outfile.good())
- outfile << outset->write_to_string_formatted();
+ outfile << input_set.write().write_to_string();
return outfile.good() ? EXIT_SUCCESS : EXIT_FAILURE;
diff --git a/src/2dmyoperiodic-nonrigid.cc b/src/2dmyoperiodic-nonrigid.cc
index c44bec9..8d622d4 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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 <sstream>
#include <iomanip>
#include <queue>
-#include <libxml++/libxml++.h>
#include <boost/filesystem.hpp>
#include <mia/core/msgstream.hh>
@@ -425,10 +424,9 @@ int do_main( int argc, char *argv[] )
}
input_set.set_preferred_reference(mpr.get_ref_idx() + skip);
- unique_ptr<xmlpp::Document> outset(input_set.write());
ofstream outfile(out_filename.c_str(), ios_base::out );
if (outfile.good())
- outfile << outset->write_to_string_formatted();
+ outfile << input_set.write().write_to_string();
return outfile.good() ? EXIT_SUCCESS : EXIT_FAILURE;
}
diff --git a/src/2dmyopgt-nonrigid.cc b/src/2dmyopgt-nonrigid.cc
index 212eafc..2f5b077 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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 <map>
#include <ctime>
#include <cstdlib>
-#include <libxml++/libxml++.h>
#include <mia/core.hh>
#include <mia/core/errormacro.hh>
@@ -44,7 +43,7 @@ const SProgramDescription g_description = {
{pdi_short, "Run a registration of a series of 2D images."},
{pdi_description, "This program implements the non-linear registration based on Pseudo Ground "
"Thruth for motion compensation of series of myocardial perfusion images given as a "
- "data set as decribed in Chao Li and Ying Sun, 'Nonrigid Registration of Myocardial Perfusion "
+ "data set as described in Chao Li and Ying Sun, 'Nonrigid Registration of Myocardial Perfusion "
"MRI Using Pseudo Ground Truth' , In Proc. Medical Image Computing and Computer-Assisted "
"Intervention MICCAI 2009, 165-172, 2009. Note that for this nonlinear motion correction "
"a preceding linear registration step is usually required."},
@@ -191,10 +190,9 @@ int do_main( int argc, char *argv[] )
input_set.rename_base(registered_filebase);
input_set.save_images(out_filename);
- unique_ptr<xmlpp::Document> outset(input_set.write());
ofstream outfile(out_filename.c_str(), ios_base::out );
if (outfile.good())
- outfile << outset->write_to_string_formatted();
+ outfile << input_set.write().write_to_string();
return outfile.good() ? EXIT_SUCCESS : EXIT_FAILURE;
}
diff --git a/src/2dmyoserial-nonrigid.cc b/src/2dmyoserial-nonrigid.cc
index 6cfb0bc..27d74aa 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,8 +19,6 @@
*/
#include <fstream>
-#include <libxml++/libxml++.h>
-#include <itpp/signal/fastica.h>
#include <boost/filesystem.hpp>
#include <mia/core/msgstream.hh>
@@ -156,10 +154,9 @@ int do_main( int argc, char *argv[] )
input_set.set_preferred_reference(reference);
- unique_ptr<xmlpp::Document> outset(input_set.write());
ofstream outfile(out_filename.c_str(), ios_base::out );
if (outfile.good())
- outfile << outset->write_to_string_formatted();
+ outfile << input_set.write().write_to_string();
return outfile.good() ? EXIT_SUCCESS : EXIT_FAILURE;
diff --git a/src/2dmyoseries-compdice.cc b/src/2dmyoseries-compdice.cc
index 80a180b..e41880a 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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 <libxml++/libxml++.h>
#include <mia/core/msgstream.hh>
#include <mia/internal/main.hh>
#include <mia/core/cmdlineparser.hh>
@@ -27,8 +26,6 @@
#include <ostream>
#include <fstream>
-using xmlpp::DomParser;
-
using namespace mia;
using namespace std;
@@ -89,7 +86,7 @@ int do_main( int argc, char *argv[] )
throw invalid_argument("Both series must contain the same number of frames");
if (skip >= original_frames.size())
- throw create_exception<invalid_argument>( "skip (", skip, ") must be smaller then number of availabe frames(",
+ throw create_exception<invalid_argument>( "skip (", skip, ") must be smaller then number of available frames(",
original_frames.size(), ")");
diff --git a/src/2dmyoseries-dice.cc b/src/2dmyoseries-dice.cc
index 453d9c2..1df2ae0 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,7 +18,6 @@
*
*/
-#include <libxml++/libxml++.h>
#include <mia/core/msgstream.hh>
#include <mia/core/cmdlineparser.hh>
#include <mia/internal/main.hh>
@@ -26,8 +25,6 @@
#include <ostream>
#include <fstream>
-using xmlpp::DomParser;
-
using namespace mia;
using namespace std;
diff --git a/src/2dmyoset-all2one-nonrigid.cc b/src/2dmyoset-all2one-nonrigid.cc
index f72f906..e6ed2ea 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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 <fstream>
-#include <libxml++/libxml++.h>
#include <boost/filesystem.hpp>
#include <mia/core.hh>
@@ -188,10 +187,9 @@ int do_main( int argc, char *argv[] )
input_set.set_preferred_reference(reference);
- unique_ptr<xmlpp::Document> outset(input_set.write());
ofstream outfile(out_filename.c_str(), ios_base::out );
if (outfile.good())
- outfile << outset->write_to_string_formatted();
+ outfile << input_set.write().write_to_string();
return outfile.good() ? EXIT_SUCCESS : EXIT_FAILURE;
}
diff --git a/src/2dnrreg.cc b/src/2dnrreg.cc
index 18a6608..64990f4 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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 7821a48..c05da50 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,7 +27,6 @@
#include <list>
#include <cassert>
#include <boost/filesystem.hpp>
-#include <libxml++/libxml++.h>
#include <mia/core.hh>
#include <mia/2d/segset.hh>
@@ -37,7 +36,6 @@
using namespace std;
using namespace mia;
-using xmlpp::DomParser;
namespace bfs=boost::filesystem;
@@ -51,14 +49,6 @@ const SProgramDescription g_description = {
{pdi_example_code, "-i input.set -r reference.set"}
};
-CSegSet load_segmentation(const string& s)
-{
- DomParser parser;
- parser.set_substitute_entities(); //We just want the text to be resolved/unescaped automatically.
- parser.parse_file(s);
- return CSegSet(*parser.get_document());
-}
-
int do_main(int argc, char *argv[])
{
string src_filename;
@@ -73,8 +63,8 @@ int do_main(int argc, char *argv[])
return EXIT_SUCCESS;
- CSegSet src_segset = load_segmentation(src_filename);
- CSegSet ref_segset = load_segmentation(ref_filename);
+ CSegSet src_segset(src_filename);
+ CSegSet ref_segset(ref_filename);
const CSegSet::Frames& src_frames = src_segset.get_frames();
const CSegSet::Frames& ref_frames = ref_segset.get_frames();
diff --git a/src/2dseghausdorff.cc b/src/2dseghausdorff.cc
index 5ab1709..adbcf1a 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,7 +27,6 @@
#include <list>
#include <cassert>
#include <boost/filesystem.hpp>
-#include <libxml++/libxml++.h>
#include <mia/core.hh>
#include <mia/2d/segset.hh>
@@ -38,7 +37,6 @@
using namespace std;
using namespace mia;
-using xmlpp::DomParser;
namespace bfs=boost::filesystem;
const SProgramDescription g_description = {
@@ -67,14 +65,7 @@ int do_main(int argc, char *argv[])
return EXIT_SUCCESS;
- DomParser parser;
- parser.set_substitute_entities(); //We just want the text to be resolved/unescaped automatically.
- parser.parse_file(src_filename);
-
- if (!parser)
- throw runtime_error(string("Unable to parse input file:") + src_filename);
-
- CSegSet segset(*parser.get_document());
+ CSegSet segset(src_filename);
if (skip < 0) {
// if RV peak is given in the segmentation file, use it, otherwiese use
diff --git a/src/2dsegment-ahmed.cc b/src/2dsegment-ahmed.cc
index a13df15..f5c177d 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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-fuzzyw.cc b/src/2dsegment-fuzzyw.cc
index fe20777..e6efa68 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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-local-cmeans.cc b/src/2dsegment-local-cmeans.cc
index a8a3cb4..890ddcb 100644
--- a/src/2dsegment-local-cmeans.cc
+++ b/src/2dsegment-local-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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,9 +44,9 @@ const SProgramDescription g_description = {
"in the image. The approach evaluates a global c-means clustering, and then "
"separates the image into overlapping regions where more c-means iterations "
"are run only including the locally present classes, i.e. the classes that "
- "relatively contain more pixels than a given threshhold."},
+ "relatively contain more pixels than a given threshold."},
{pdi_example_descr, "Run the segmentation on image test.png using three classes, "
- "local regions of 40 pixels (grid width 20 pixels), and a class ignore threshhold of 0.01." },
+ "local regions of 40 pixels (grid width 20 pixels), and a class ignore threshold of 0.01." },
{pdi_example_code, "-i test.png -o label.png -n 3 -g 20 -t 0.01"}
};
@@ -148,7 +148,8 @@ int do_main(int argc, char *argv[])
opts.add(make_opt( cmeans_epsilon, EParameterBounds::bf_min_open,
{0.0}, "c-means-epsilon", 'e', "c-means breaking condition for update tolerance"));
opts.add(make_opt( rel_cluster_threshold, EParameterBounds::bf_min_closed | EParameterBounds::bf_max_open,
- {0.0,1.0}, "relative-cluster-threshhold", 't', "Number of intensity classes to segment"));
+ {0.0,1.0}, "relative-cluster-threshold", 't', "threshhold to ignore classes when initializing"
+ " the local cmeans from the global one."));
if (opts.parse(argc, argv) != CCmdOptionList::hr_no)
diff --git a/src/2dsegment-local-kmeans.cc b/src/2dsegment-local-kmeans.cc
index c2a444c..dfa2a17 100644
--- a/src/2dsegment-local-kmeans.cc
+++ b/src/2dsegment-local-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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -43,9 +43,9 @@ const SProgramDescription g_description = {
"in the image. The approach evaluates a global k-means clustering, and then "
"separates the image into overlapping regions where more k-means iterations "
"are run only including the locally present classes, i.e. the classes that "
- "relatively contain more pixels than a given threshhold."},
+ "relatively contain more pixels than a given threshold."},
{pdi_example_descr, "Run the segmentation on image test.png using three classes, "
- "local regions of 40 pixels (grid width 20 pixels), and a class ignore threshhold of 0.01." },
+ "local regions of 40 pixels (grid width 20 pixels), and a class ignore threshold of 0.01." },
{pdi_example_code, "-i test.png -o label.png -n 3 -g 20 -t 0.01"}
};
@@ -110,7 +110,7 @@ int do_main(int argc, char *argv[])
opts.add(make_opt( n_classes, EParameterBounds::bf_closed_interval, {2u,127u},
"nclasses", 'n', "Number of intensity classes to segment"));
opts.add(make_opt( rel_cluster_threshold, EParameterBounds::bf_min_closed | EParameterBounds::bf_max_open,
- {0.0,1.0}, "relative-cluster-threshhold", 't', "Number of intensity classes to segment"));
+ {0.0,1.0}, "relative-cluster-threshold", 't', "Number of intensity classes to segment"));
diff --git a/src/2dsegment-per-pixel-kmeans.cc b/src/2dsegment-per-pixel-kmeans.cc
index 1098e37..40dfc31 100644
--- a/src/2dsegment-per-pixel-kmeans.cc
+++ b/src/2dsegment-per-pixel-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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,9 +45,9 @@ const SProgramDescription g_description = {
"in the image. The approach evaluates a global k-means clustering, and then "
"separates the image into overlapping regions where more k-means iterations "
"are run only including the locally present classes, i.e. the classes that "
- "relatively contain more pixels than a given threshhold."},
+ "relatively contain more pixels than a given threshold."},
{pdi_example_descr, "Run the segmentation on image test.png using three classes, "
- "local regions of 40 pixels (grid width 20 pixels), and a class ignore threshhold of 0.01." },
+ "local regions of 40 pixels (grid width 20 pixels), and a class ignore threshold of 0.01." },
{pdi_example_code, "-i test.png -o label.png -n 3 -g 20 -t 0.01"}
};
@@ -106,7 +106,7 @@ int do_main(int argc, char *argv[])
opts.add(make_opt( n_classes, EParameterBounds::bf_closed_interval, {2u,127u},
"nclasses", 'n', "Number of intensity classes to segment"));
opts.add(make_opt( rel_cluster_threshold, EParameterBounds::bf_min_closed | EParameterBounds::bf_max_open,
- {0.0,1.0}, "relative-cluster-threshhold", 't', "Number of intensity classes to segment"));
+ {0.0,1.0}, "relative-cluster-threshold", 't', "Number of intensity classes to segment"));
diff --git a/src/2dsegmentcropbox.cc b/src/2dsegmentcropbox.cc
index 8572522..ff17d1e 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,7 +27,6 @@
#include <list>
#include <cassert>
#include <boost/filesystem.hpp>
-#include <libxml++/libxml++.h>
#include <mia/core.hh>
#include <mia/2d/segsetwithimages.hh>
@@ -38,7 +37,6 @@
using namespace std;
using namespace mia;
-using xmlpp::DomParser;
namespace bfs=boost::filesystem;
const SProgramDescription g_description = {
@@ -122,12 +120,9 @@ int do_main(int argc, char *argv[])
++iimages;
}
- // save output
- unique_ptr<xmlpp::Document> outset(cropped.write());
-
ofstream outfile(out_filename.c_str(), ios_base::out );
if (outfile.good())
- outfile << outset->write_to_string_formatted();
+ outfile << cropped.write().write_to_string();
return outfile.good() ? EXIT_SUCCESS : EXIT_FAILURE;
}
diff --git a/src/2dsegseriesstats.cc b/src/2dsegseriesstats.cc
index b616564..dbf144c 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,7 +18,6 @@
*
*/
-#include <libxml++/libxml++.h>
#include <mia/core/msgstream.hh>
#include <mia/core/cmdlineparser.hh>
#include <mia/2d/segsetwithimages.hh>
@@ -26,8 +25,6 @@
#include <ostream>
#include <fstream>
-using xmlpp::DomParser;
-
using namespace mia;
using namespace std;
@@ -116,7 +113,7 @@ int do_main( int argc, char *argv[] )
" -3: Middle of the series\n"
" -2: prefererred reference\n"
" -1: LV peak\n"
- "if any of the above is not available or the value is < -3, use the last frame of the series."));
+ " if any of the above is not available or the value is < -3, use the last frame of the series."));
options.add(make_opt( curves_filename, "curves", 'c', "region average value curves, "
"The output files each comprises a table in plain-text format that contains three columns "
"for each section of the LV myocardium: The first column contains the values obtained by "
@@ -171,7 +168,6 @@ int do_main( int argc, char *argv[] )
vector<vector<SResult> > curves;
vector<vector<SResult> > varcurves;
-
C2DUBImage org_mask = original_frames[reference].get_section_masks(n_sections);
C2DUBImage reg_mask = registered_frames[reference].get_section_masks(n_sections);
for (size_t i = skip; i < original_frames.size(); ++i) {
diff --git a/src/2dsegshift.cc b/src/2dsegshift.cc
index d9839c1..6fb2bda 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,7 +27,6 @@
#include <list>
#include <cassert>
#include <boost/filesystem.hpp>
-#include <libxml++/libxml++.h>
#include <mia/core.hh>
#include <mia/2d/segset.hh>
@@ -37,7 +36,6 @@
using namespace std;
using namespace mia;
-using xmlpp::DomParser;
namespace bfs=boost::filesystem;
@@ -56,14 +54,6 @@ const SProgramDescription g_description = {
};
-CSegSet load_segmentation(const string& s)
-{
- DomParser parser;
- parser.set_substitute_entities(); //We just want the text to be resolved/unescaped automatically.
- parser.parse_file(s);
- return CSegSet(*parser.get_document());
-}
-
int do_main(int argc, char *argv[])
{
string src_filename;
@@ -88,16 +78,14 @@ int do_main(int argc, char *argv[])
return EXIT_SUCCESS;
- CSegSet src_segset = load_segmentation(src_filename);
+ CSegSet src_segset(src_filename);
cvinfo() << "shift by " << shift << ", skip " << skip << " and rename to base " << shift_filename << "\n";
CSegSet shifted = src_segset.shift_and_rename(skip, shift, shift_filename);
- unique_ptr<xmlpp::Document> outset(shifted.write());
-
ofstream outfile(out_filename.c_str(), ios_base::out );
if (outfile.good())
- outfile << outset->write_to_string_formatted();
+ outfile << shifted.write().write_to_string();
return outfile.good() ? EXIT_SUCCESS : EXIT_FAILURE;
}
diff --git a/src/2dsegshiftperslice.cc b/src/2dsegshiftperslice.cc
index 521d64c..65afb98 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,7 +27,6 @@
#include <list>
#include <cassert>
#include <boost/filesystem.hpp>
-#include <libxml++/libxml++.h>
#include <mia/core.hh>
#include <mia/2d/segset.hh>
@@ -37,7 +36,6 @@
using namespace std;
using namespace mia;
-using xmlpp::DomParser;
namespace bfs=boost::filesystem;
const SProgramDescription g_description = {
@@ -56,14 +54,6 @@ const SProgramDescription g_description = {
{pdi_example_code, "-i segment.set -o shifted.set -g shifted -S shift"},
};
-CSegSet load_segmentation(const string& s)
-{
- DomParser parser;
- parser.set_substitute_entities(); //We just want the text to be resolved/unescaped automatically.
- parser.parse_file(s);
- return CSegSet(*parser.get_document());
-}
-
static string get_number(const string& fname)
{
bfs::path f(fname);
@@ -96,7 +86,7 @@ int do_main(int argc, char *argv[])
return EXIT_SUCCESS;
- CSegSet src_segset = load_segmentation(src_filename);
+ CSegSet src_segset(src_filename);
CSegSet::Frames& frames = src_segset.get_frames();
for (auto i = frames.begin(); i != frames.end(); ++i) {
@@ -110,11 +100,11 @@ int do_main(int argc, char *argv[])
}
- unique_ptr<xmlpp::Document> outset(src_segset.write());
+ auto outset = src_segset.write();
ofstream outfile(out_filename.c_str(), ios_base::out );
if (outfile.good())
- outfile << outset->write_to_string_formatted();
+ outfile << outset.write_to_string();
return outfile.good() ? EXIT_SUCCESS : EXIT_FAILURE;
}
diff --git a/src/2dseries-mincorr.cc b/src/2dseries-mincorr.cc
index 9328e4b..9f4aadd 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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 86a63f7..7f86a6a 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,7 +27,6 @@
#include <list>
#include <cassert>
#include <boost/filesystem.hpp>
-#include <libxml++/libxml++.h>
#include <mia/core.hh>
#include <mia/2d/segset.hh>
@@ -37,7 +36,6 @@
using namespace std;
using namespace mia;
-using xmlpp::DomParser;
namespace bfs=boost::filesystem;
@@ -50,14 +48,6 @@ const SProgramDescription g_description = {
{pdi_example_code, "-i segment.set -f 20 -o mask20.png"}
};
-CSegSet load_segmentation(const string& s)
-{
- DomParser parser;
- parser.set_substitute_entities(); //We just want the text to be resolved/unescaped automatically.
- parser.parse_file(s);
- return CSegSet(*parser.get_document());
-}
-
int do_main(int argc, char *argv[])
{
string src_filename;
@@ -73,7 +63,7 @@ int do_main(int argc, char *argv[])
return EXIT_SUCCESS;
- CSegSet src_segset = load_segmentation(src_filename);
+ CSegSet src_segset(src_filename);
const CSegSet::Frames& src_frames = src_segset.get_frames();
if (frame >= src_frames.size())
diff --git a/src/2dseries-segdistance.cc b/src/2dseries-segdistance.cc
index 1364216..81a7982 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,7 +27,6 @@
#include <list>
#include <cassert>
#include <boost/filesystem.hpp>
-#include <libxml++/libxml++.h>
#include <mia/core.hh>
#include <mia/internal/main.hh>
@@ -39,7 +38,6 @@
using namespace std;
using namespace mia;
-using xmlpp::DomParser;
namespace bfs=boost::filesystem;
const SProgramDescription g_description = {
diff --git a/src/2dseries2dordermedian.cc b/src/2dseries2dordermedian.cc
index 18555b2..6e56c62 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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 e7220af..c33861e 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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 <fstream>
-#include <libxml++/libxml++.h>
#include <mia/core/cmdlineparser.hh>
#include <mia/core/attribute_names.hh>
#include <mia/2d/imageio.hh>
@@ -41,9 +40,9 @@ const SProgramDescription g_description = {
"Used information is the z-location of the slice and the acquisition number. "
"The code is taylored to used the according descriptors defined in the DICOM standard. "
"All images with the same slice location will be grouped together in one segmentation "
- "set and ordered according to their aquisition number. "
+ "set and ordered according to their acquisition number. "
"Slice locations are rounded to three digits accuracy to make proper comparison "
- "of floating point values feasable."},
+ "of floating point values feasible."},
{pdi_example_descr, "Create the segmentation sets from a series of DICOM images and "
"copy the files to the output directory (copying is the default)."},
{pdi_example_code, "-o /home/user/series /net/dicoms/patient1/series1/*.dcm"}
@@ -60,8 +59,8 @@ vector<C2DImageVectorWithName> separate_slices(const C2DImageVectorWithName &ima
// collect series
// \todo maybe one should also look for SeriesNumber
typedef map<int, SImage> InstanceSeries;
- typedef map<int, InstanceSeries> AquisitionSeries;
- map<float, AquisitionSeries> series;
+ typedef map<int, InstanceSeries> AcquisitionSeries;
+ map<float, AcquisitionSeries> series;
int aq_number = 0;
int is_number = 0;
for (auto i = images.begin(); i != images.end(); ++i) {
@@ -74,10 +73,10 @@ vector<C2DImageVectorWithName> separate_slices(const C2DImageVectorWithName &ima
}
if (series.find(slice_location) == series.end()) {
cvmsg() << "Add location " << slice_location << "\n";
- series[slice_location] = AquisitionSeries();
+ series[slice_location] = AcquisitionSeries();
}
- AquisitionSeries& aqs = series[slice_location];
+ AcquisitionSeries& aqs = series[slice_location];
auto pAcquisitionNumber = dynamic_cast<const CIntAttribute *>(i->first->get_attribute(IDAcquisitionNumber).get());
if (pAcquisitionNumber) {
@@ -85,7 +84,7 @@ vector<C2DImageVectorWithName> separate_slices(const C2DImageVectorWithName &ima
}else {
++aq_number;
}
- cvmsg() << "Add aquisition " << aq_number << "\n";
+ cvmsg() << "Add acquisition " << aq_number << "\n";
if (aqs.find(aq_number) == aqs.end()) {
aqs[aq_number] = InstanceSeries();
@@ -102,7 +101,7 @@ vector<C2DImageVectorWithName> separate_slices(const C2DImageVectorWithName &ima
cvmsg() << "Add instance " << is_number << "\n";
if (is.find(is_number) != is.end()) {
- cvwarn() << "got duplicate slice aquisition/instance/location = "
+ cvwarn() << "got duplicate slice acquisition/instance/location = "
<< aq_number << "/" << is_number << "/" << slice_location
<< ", Ignoring this slice\n";
}else {
@@ -153,11 +152,11 @@ bool save_series(int index, const C2DImageVectorWithName& series, const string&
fname << "segment" << index << ".set";
bfs::path outfilename = bfs::path(out_directory) / bfs::path(fname.str());
-
- unique_ptr<xmlpp::Document> outset(set.write());
+
+ auto outset = set.write();
ofstream outfile(outfilename.string().c_str(), ios_base::out );
if (outfile.good())
- outfile << outset->write_to_string_formatted();
+ outfile << outset.write_to_string();
else
cverr() << "Unable to open file '" << outfilename.string() << "'\n";
return outfile.good();
diff --git a/src/2dseriescorr.cc b/src/2dseriescorr.cc
index 68b38b0..1740764 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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 b7ca57e..b3df5b2 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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 7afdeef..0d597bc 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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 80a5969..201081e 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,7 +27,6 @@
#include <list>
#include <cassert>
#include <boost/filesystem.hpp>
-#include <libxml++/libxml++.h>
#include <mia/core.hh>
#include <mia/2d/segset.hh>
@@ -36,7 +35,6 @@
using namespace std;
using namespace mia;
-using xmlpp::DomParser;
namespace bfs=boost::filesystem;
const SProgramDescription g_description = {
@@ -64,23 +62,8 @@ int do_main(int argc, char *argv[])
if (options.parse(argc, argv) != CCmdOptionList::hr_no)
return EXIT_SUCCESS;
-
- DomParser parser;
- parser.set_substitute_entities(); //We just want the text to be resolved/unescaped automatically.
- parser.parse_file(src_filename);
-
- DomParser parser2;
- parser2.set_substitute_entities(); //We just want the text to be resolved/unescaped automatically.
- parser2.parse_file(ref_filename);
-
- if (!parser)
- throw runtime_error(string("Unable to parse input file:") + src_filename);
-
- if (!parser2)
- throw runtime_error(string("Unable to parse input file:") + ref_filename);
-
- CSegSet srcset(*parser.get_document());
- CSegSet refset(*parser2.get_document());
+ CSegSet srcset(src_filename);
+ CSegSet refset(ref_filename);
const auto& src_frames = srcset.get_frames();
const auto& ref_frames = refset.get_frames();
diff --git a/src/2dseriessmoothgradMAD.cc b/src/2dseriessmoothgradMAD.cc
index bffa290..4420d86 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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 6d8d944..79bf088 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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 <list>
#include <cassert>
#include <boost/filesystem.hpp>
-#include <libxml++/libxml++.h>
#include <mia/core.hh>
#include <mia/2d/segsetwithimages.hh>
@@ -40,7 +39,6 @@
using namespace std;
using namespace mia;
-using xmlpp::DomParser;
namespace bfs=boost::filesystem;
diff --git a/src/2dstack-cmeans-presegment.cc b/src/2dstack-cmeans-presegment.cc
index e218034..676258d 100644
--- a/src/2dstack-cmeans-presegment.cc
+++ b/src/2dstack-cmeans-presegment.cc
@@ -1,7 +1,7 @@
/* -*- mia-c++ -*-
*
* This file is part of MIA - a toolbox for medical image analysis
- * Copyright (c) Leipzig, Madrid 1999-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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/2dstackfilter.cc b/src/2dstackfilter.cc
index 21db469..43a430e 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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 a7b87c0..f273d79 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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 45e76ca..528da61 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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 ed0dd25..c62a8bc 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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 fa2d044..36864b8 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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 310c6d2..efe7783 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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 8da0935..9bbe441 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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 b379145..fcb1c07 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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
index 64b5342..8fa029f 100644
--- a/src/3dcombine-imageseries.cc
+++ b/src/3dcombine-imageseries.cc
@@ -1,7 +1,7 @@
/* -*- mia-c++ -*-
*
* This file is part of MIA - a toolbox for medical image analysis
- * Copyright (c) Leipzig, Madrid 1999-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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-mr-segmentations.cc b/src/3dcombine-mr-segmentations.cc
index 04635f1..dc11a64 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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 9f6c7f4..1ef7edd 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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 28960e7..6ac0198 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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 98a955e..c5fd6a1 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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 93afc6a..c89eba4 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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 4f14c90..878fe4f 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -50,7 +50,7 @@ const SProgramDescription g_description = {
" cat(result)\n"
" }\n\n"
},
- {pdi_example_descr, "Evaluate the distances for each label availabe in image.v to the "
+ {pdi_example_descr, "Evaluate the distances for each label available in image.v to the "
"corresponding labels in the image reference.v ans store the result "
"a coma separated list of values, i.e. distances.csv."},
{pdi_example_code, "-i image.v -r reference.v -o distances.csv" }
diff --git a/src/3ddistance.cc b/src/3ddistance.cc
index 17ea7f9..cc70261 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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 ff96582..b6f438f 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -160,7 +160,7 @@ int do_main( int argc, char *argv[] )
options.set_group("\nFile-IO");
options.add(make_opt( in_filename, "in-file", 'i',
"input point set, if this parameter is given a sparse evaluation "
- "of the quantity will be done, otherwise the quantity is evalutated "
+ "of the quantity will be done, otherwise the quantity is evaluated "
"for each grid point of the transformation range.", CCmdOptionFlags::input));
options.add(make_opt( out_filename, "out-file", 'o',
"output strains file, for a format description see above.", CCmdOptionFlags::required_output));
diff --git a/src/3dfield2norm.cc b/src/3dfield2norm.cc
index 283aae9..e1aa0ac 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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/3dfluid-syn-registration.cc b/src/3dfluid-syn-registration.cc
new file mode 100644
index 0000000..576ae8b
--- /dev/null
+++ b/src/3dfluid-syn-registration.cc
@@ -0,0 +1,464 @@
+/* -*- mia-c++ -*-
+ *
+ * This file is part of MIA - a toolbox for medical image analysis
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
+ *
+ * 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/main.hh>
+#include <mia/template/filter_chain.hh>
+#include <mia/core/cmdlineparser.hh>
+#include <mia/core/msgstream.hh>
+#include <mia/core/filter.hh>
+#include <mia/core/convergence_measure.hh>
+#include <mia/core/paramarray.hh>
+#include <mia/core/watch.hh>
+#include <mia/3d/imageio.hh>
+#include <mia/3d/filter.hh>
+#include <mia/3d/transformio.hh>
+#include <mia/3d/transformfactory.hh>
+#include <mia/3d/vfregularizer.hh>
+#include <mia/3d/cost.hh>
+#include <mia/3d/deformer.hh>
+
+
+NS_MIA_USE;
+using namespace std;
+
+const SProgramDescription g_description = {
+ {pdi_group, "Registration, Comparison, and Transformation of 3D images"},
+ {pdi_short, "Non-linear registration of 3D images by using a diffeomorphic SyN registration"},
+ {pdi_description, "This program implements the registration of two gray scale 3D images. "
+ "The transformation applied is a symmeric diffeomorpic fluid dynamic registration. "
+ "To work most efficiently, this program makes a few assumptions about the imput data, i.e. "
+ "the image must be of the same size, have the same voxel spacing, and any intensity "
+ "range normalization or equalization should also be done before calling this program."
+ },
+ {pdi_example_descr, "Register image test.v to image ref.v saving the transformation to transform.v "
+ "and the inverse transform to inverse-transform.v. "
+ "Use three multiresolution levels, ssd as image cost function."},
+ {pdi_example_code, "-i test.v -r ref.v -t transform.v -T inverse-transform.v -l 3 ssd"}
+};
+
+void check_number_of_levels_consistency(size_t nvalues, size_t levels, const std::string& value_name)
+{
+ if (nvalues != 1 && nvalues != levels) {
+ throw create_exception<invalid_argument>(levels, " ",
+ value_name, " values given, but ", nvalues,
+ " multiresolution levels requested");
+ }
+}
+
+
+typedef pair<P3DFVectorfield, P3DFVectorfield> TransformPair;
+
+struct C3DSymScaledRegisterParams {
+ uint32_t mg_levels;
+ P3DImageCost cost;
+ float current_step;
+ P3DVectorfieldRegularizer regularizer;
+ TPerLevelScalarParam<uint32_t> conv_count;
+ TPerLevelScalarParam<double> stop_decline_rate;
+ TPerLevelScalarParam<double> stop_cost;
+ TPerLevelScalarParam<unsigned> iterations;
+
+ C3DSymScaledRegisterParams();
+
+ void add_options(CCmdOptionList& options);
+};
+
+C3DSymScaledRegisterParams::C3DSymScaledRegisterParams():
+ mg_levels(3),
+ current_step(0.25),
+ conv_count(10),
+ stop_decline_rate(0.1),
+ stop_cost(0.1),
+ iterations(100)
+{
+}
+
+void C3DSymScaledRegisterParams::add_options(CCmdOptionList& options)
+{
+ options.set_group("Registration");
+ options.add(make_opt( mg_levels, "mg-levels", 'l', "Number of multi-resolution levels to run the registration on. "
+ "Not that some registration parameters can be given as a coma seperated list to "
+ "indicate per level values. In these cases if the number of given values is smaller "
+ "than the number of multi-resolution levels (this parameter), the the last given value "
+ "is used for all subsequest multi-resolution levels."));
+
+ options.add(make_opt(current_step, EParameterBounds::bf_min_open | EParameterBounds::bf_max_closed,
+ {0.0f, 0.5f}, "step", 'S', "Initial step size for all levels"));
+
+ options.add(make_opt( cost, "ssd", "cost", 'c', "Image similarity function to be minimized"));
+ options.add(make_opt( regularizer, "sor:kernel=fluid,maxiter=50", "regularizer", 'R',
+ "Regularization for the force to transformation update"));
+
+
+ options.add(conv_count.
+ create_level_params_option("conv-test-interval",'T', EParameterBounds::bf_closed_interval, {4,40},
+ "Convergence test interations intervall: In order to measure "
+ "convergence the cost function value is averaged over this "
+ "amount of iterations, and the decline rate is evaluated based on the "
+ "linare regression of the cost function values in this intervall. "
+ "This parameter can be given as a coma-seperated list with values corresponding "
+ "to the multi-resolution levels, see option --mg-levels for more information."
+ ));
+ options.add(stop_decline_rate.
+ create_level_params_option("stop-decline-rate", 'D', EParameterBounds::bf_min_closed, {0},
+ "Stopping criterium for registration based on the cost decline rate. "
+ "If the rate below this value, the iteration is stopped. "
+ "This parameter can be given as a coma-seperated list with values corresponding "
+ "to the multi-resolution levels, see option --mg-levels for more information."
+ ));
+
+ options.add(stop_cost.
+ create_level_params_option("stop-cost", 'C',
+ "Stopping criterium for registration based on the cost value. "
+ "If the cost drops below this value, the iteration is stopped. "
+ "This parameter can be given as a coma-seperated list with values corresponding "
+ "to the multi-resolution levels, see option --mg-levels for more information."
+ ));
+
+ options.add(iterations.
+ create_level_params_option("iter", 'I', EParameterBounds::bf_min_closed, {4},
+ "Naximum number if iterations done on each multi-resolution level. "
+ "This parameter can be given as a coma-seperated list with values corresponding "
+ "to the multi-resolution levels, see option --mg-levels for more information."));
+}
+
+
+class C3DSymFluidRegistration {
+public:
+ C3DSymFluidRegistration(const C3DSymScaledRegisterParams& params);
+
+ TransformPair run(const C3DFImage& src, const C3DFImage& ref) const;
+private:
+ const C3DSymScaledRegisterParams& m_params;
+};
+
+P3DTransformation wrap_vectorfield_in_transformation(const C3DFVectorfield& field,
+ const C3DTransformCreator& vftcreator)
+{
+
+ // the final transformation is twice the distance
+ auto transform = vftcreator.create(field.get_size());
+ CDoubleVector buffer(transform->degrees_of_freedom(), false);
+
+ double max_transform = 0.0;
+ C3DFVector max_vec;
+
+ auto ib = buffer.begin();
+ for (auto ivf = field.begin(); ivf != field.end(); ++ivf) {
+ cvdebug() << *ivf << "\n";
+ *ib++ = 2.0f * ivf->x;
+ *ib++ = 2.0f * ivf->y;
+ *ib++ = 2.0f * ivf->z;
+
+ double vm = ivf->norm();
+ if (vm > max_transform) {
+ max_transform = vm;
+ max_vec = *ivf;
+ }
+ }
+
+ cvmsg() << "Max-transform = " << max_vec << " norm=" << max_transform << "\n";
+ transform->set_parameters(buffer);
+ return transform;
+}
+
+C3DFImage get_asfloat_pixel(P3DImage image)
+{
+ if (image->get_pixel_type() != it_float)
+ image = run_filters(image, "convert:map=copy,repn=float");
+ return dynamic_cast<const C3DFImage&>(*image);
+}
+
+int do_main( int argc, char *argv[] )
+{
+ string src_filename;
+ string ref_filename;
+
+ string out_transform_filename;
+ string out_inv_transform_filename;
+
+
+ const auto& imageio = C3DImageIOPluginHandler::instance();
+ const auto& transio = C3DTransformationIOPluginHandler::instance();
+
+ CCmdOptionList options(g_description);
+ options.set_group("IO");
+ options.add(make_opt( src_filename, "in-image", 'i', "test image",
+ CCmdOptionFlags::required_input, &imageio));
+ options.add(make_opt( ref_filename, "ref-image", 'r', "reference image",
+ CCmdOptionFlags::required_input, &imageio));
+ options.add(make_opt( out_transform_filename, "transform", 'o', "output transformation",
+ CCmdOptionFlags::required_output, &transio));
+ options.add(make_opt( out_inv_transform_filename, "inverse-transform", 'O',
+ "inverse output transformation",
+ CCmdOptionFlags::required_output, &transio));
+
+ C3DSymScaledRegisterParams params;
+ params.add_options(options);
+
+
+ if (options.parse(argc, argv) != CCmdOptionList::hr_no)
+ return EXIT_SUCCESS;
+
+
+ P3DImage src = load_image3d(src_filename);
+ P3DImage ref = load_image3d(ref_filename);
+
+ C3DSymFluidRegistration registration(params);
+
+ auto result = registration.run(get_asfloat_pixel(src), get_asfloat_pixel(ref));
+
+ auto vftranscreator = produce_3dtransform_factory("vf:imgkernel=[bspline:d=1],imgboundary=zero");
+
+ P3DTransformation t_src_ref = wrap_vectorfield_in_transformation(*result.first, *vftranscreator);
+
+ if (!C3DTransformationIOPluginHandler::instance().save(out_transform_filename, *t_src_ref))
+ throw create_exception<runtime_error>( "Unable to save transformation to '",
+ out_transform_filename, "'");
+
+ P3DTransformation t_ref_src = wrap_vectorfield_in_transformation(*result.second, *vftranscreator);
+
+ if (!C3DTransformationIOPluginHandler::instance().save(out_inv_transform_filename, *t_ref_src))
+ throw create_exception<runtime_error>( "Unable to save transformation to '",
+ out_inv_transform_filename, "'");
+ return EXIT_SUCCESS;
+}
+
+
+MIA_MAIN(do_main);
+
+
+C3DSymFluidRegistration::C3DSymFluidRegistration(const C3DSymScaledRegisterParams& params):
+ m_params(params)
+{
+}
+
+P3DFVectorfield upscale( const C3DFVectorfield& vf, C3DBounds size)
+{
+ P3DFVectorfield Result(new C3DFVectorfield(size));
+ float x_mult = float(size.x) / (float)vf.get_size().x;
+ float y_mult = float(size.y) / (float)vf.get_size().y;
+ float z_mult = float(size.z) / (float)vf.get_size().z;
+ float ix_mult = 1.0f / x_mult;
+ float iy_mult = 1.0f / y_mult;
+ float iz_mult = 1.0f / z_mult;
+
+ double max_defo = 0.0;
+ auto callback = [&](const C1DParallelRange& range){
+ // CThreadMsgStream thread_stream;
+
+ for (auto z = range.begin(); z != range.end();++z) {
+ auto i = Result->begin_at(0,0,z);
+ for (unsigned int y = 0; y < size.y; y++)
+ for (unsigned int x = 0; x < size.x; x++,++i){
+ C3DFVector help(ix_mult * x, iy_mult * y, iz_mult * z);
+ C3DFVector val = vf.get_interpol_val_at(help);
+ *i = C3DFVector(val.x * x_mult,val.y * y_mult, val.z * z_mult);
+
+ double defo = i->norm();
+ if (max_defo < defo)
+ max_defo = defo;
+ }
+ }
+ };
+ pfor(C1DParallelRange(0, size.z, 1), callback);
+ // race condition !!
+ cvmsg() << "max-defo at size (" << size << ")=" << max_defo << "\n";
+
+ return Result;
+}
+
+
+
+class C3DSymScaledRegister {
+public:
+ C3DSymScaledRegister(unsigned level, const C3DSymScaledRegisterParams& params);
+ void run (const C3DFImage& src, const C3DFImage& ref, TransformPair& transforms) const;
+private:
+ void deform(const C3DFImage& src, const C3DFVectorfield& t, C3DFImage& result) const;
+
+ unsigned m_level;
+ const C3DSymScaledRegisterParams& m_params;
+ C3DInterpolatorFactory m_ipfac;
+
+};
+
+TransformPair
+C3DSymFluidRegistration::run(const C3DFImage& src, const C3DFImage& ref) const
+{
+ const CWatch& watch = CWatch::instance();
+
+ double start_time_global = watch.get_seconds();
+
+ TransformPair transforms;
+
+ for (unsigned l = 0; l < m_params.mg_levels; ++l) {
+ double start_time_level = watch.get_seconds();
+ unsigned scale_block = 1 << (m_params.mg_levels - l - 1);
+
+ stringstream downscale_descr;
+ downscale_descr << "downscale:bx=" << scale_block
+ << ",by=" << scale_block
+ << ",bz=" << scale_block;
+
+ auto downscaler =
+ C3DFilterPluginHandler::instance().produce(downscale_descr.str().c_str());
+
+ auto scaled_src_p = downscaler->filter(src);
+ auto scaled_ref_p = downscaler->filter(ref);
+
+ const C3DFImage& scaled_src = dynamic_cast<const C3DFImage&>(*scaled_src_p);
+ const C3DFImage& scaled_ref = dynamic_cast<const C3DFImage&>(*scaled_ref_p);
+
+ if (!transforms.first) {
+ transforms.first.reset(new C3DFVectorfield(scaled_src.get_size()));
+ transforms.second.reset(new C3DFVectorfield(scaled_src.get_size()));
+ }else{
+ transforms.first = upscale(*transforms.first, scaled_src.get_size());
+ transforms.second = upscale(*transforms.second, scaled_src.get_size());
+ }
+
+ C3DSymScaledRegister level_worker(l, m_params);
+
+ level_worker.run(scaled_src, scaled_ref, transforms);
+ cvmsg() << "Level " << l << " time=" << watch.get_seconds() - start_time_level << "\n";
+
+ }
+ cvmsg() << "Global run time " << watch.get_seconds() - start_time_global << "\n";
+ return transforms;
+}
+
+C3DSymScaledRegister::C3DSymScaledRegister(unsigned level, const C3DSymScaledRegisterParams& params):
+ m_level(level),
+ m_params(params),
+ m_ipfac("bspline:d=1", "zero")
+{
+
+}
+
+void C3DSymScaledRegister::run (const C3DFImage& src, const C3DFImage& ref, TransformPair& transforms) const
+{
+ TransformPair transforms_best = transforms;
+ cvmsg() << "Enter registration at level "<< m_level << " with size " << src.get_size() << "\n";
+ cvmsg() << " Running at most " << m_params.iterations[m_level] << " iterations\n";
+
+ auto current_step = m_params.current_step;
+ CConvergenceMeasure conv_measure(m_params.conv_count[m_level]);
+
+ m_params.regularizer->set_size(src.get_size());
+
+ // deform the images with the input transformations
+ C3DFImage src_tmp(src.get_size());
+ deform(src, *transforms.first, src_tmp);
+
+ C3DFImage ref_tmp(ref.get_size());
+ deform(ref, *transforms.second, ref_tmp);
+
+ // now this runs ping-pong
+ unsigned iter = 0;
+
+ C3DFVectorfield grad(src.get_size());
+ C3DFVectorfield v(src.get_size());
+
+ double decline_rate = numeric_limits<double>::max();
+ double avg_cost = numeric_limits<double>::max();
+
+ double old_cost = numeric_limits<double>::max();
+
+ while (!conv_measure.is_full_size() || (
+ decline_rate > m_params.stop_decline_rate[m_level] &&
+ avg_cost > m_params.stop_cost[m_level] &&
+ iter < m_params.iterations[m_level] &&
+ current_step > 0.0001)) {
+
+ double start_time_level = CWatch::instance().get_seconds();
+ ++iter;
+
+ m_params.cost->set_reference(ref_tmp);
+ double cost_fw = m_params.cost->evaluate_force(src_tmp, grad);
+ float max_v_fw = m_params.regularizer->run(v, grad, *transforms.first);
+ transforms.first->update_by_velocity(v, current_step / max_v_fw);
+ transforms.second->update_as_inverse_of(*transforms.first, 1e-5, 20);
+
+ deform(src, *transforms.first, src_tmp);
+ deform(ref, *transforms.second, ref_tmp);
+
+ m_params.cost->set_reference(src_tmp);
+ double cost_bw = m_params.cost->evaluate_force(ref_tmp, grad);
+ double cost_val = cost_bw + cost_fw;
+
+ // update step length
+ if ( cost_val <= old_cost ) {
+
+ transforms_best = transforms;
+
+ old_cost = cost_val;
+ conv_measure.push(cost_val);
+
+ decline_rate = - conv_measure.rate();
+ avg_cost = conv_measure.value();
+
+ cvmsg() << "[" << setw(4) << iter << "]:"
+ << "cost = "<< cost_fw + cost_bw
+ << ", step = " << current_step
+ << ", cost_avg(n="<< conv_measure.fill()<< ")=" << avg_cost
+ << ", rate=" << decline_rate
+ << ", ct=" << CWatch::instance().get_seconds() - start_time_level << "s"
+ << "\n";
+
+ }
+
+ if ( cost_val < 0.9 * old_cost ) {
+ if (current_step < 0.25) {
+ current_step *= 1.25;
+ if (current_step > 0.25)
+ current_step = 0.25;
+ }
+ }else if ( cost_val > old_cost ) {
+ current_step *= 0.5;
+ cvmsg() << "Increasing cost = " << cost_val
+ << ", Discard step and retry with step size" << current_step <<"\n";
+
+ // reset transform and re-evaluate gradient
+ transforms = transforms_best;
+ deform(src, *transforms.first, src_tmp);
+ deform(ref, *transforms.second, ref_tmp);
+ m_params.cost->set_reference(src_tmp);
+ m_params.cost->evaluate_force(ref_tmp, grad);
+ }
+
+ float max_v_bw = m_params.regularizer->run(v, grad, *transforms.second);
+
+ transforms.second->update_by_velocity(v, current_step / max_v_bw);
+ transforms.first->update_as_inverse_of(*transforms.second, 1e-5, 20);
+
+ deform(src, *transforms.first, src_tmp);
+ deform(ref, *transforms.second, ref_tmp);
+ }
+ transforms = transforms_best;
+}
+
+void C3DSymScaledRegister::deform(const C3DFImage& src, const C3DFVectorfield& t, C3DFImage& result) const
+{
+ FDeformer3D src_deformer(t, m_ipfac);
+ src_deformer(src,result);
+}
+
diff --git a/src/3dforce.cc b/src/3dforce.cc
index 3d5a19a..11abd8e 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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 5003e63..685b232 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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 ab23865..2ea6530 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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 7d37937..695a00d 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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 9560736..3f27ec9 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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 3462052..0d5e10c 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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/3dimagecreator.cc b/src/3dimagecreator.cc
index cce60b2..d46b149 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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 82bbe20..e9fd5bd 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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 a74d170..d4a498a 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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 140caec..3346f28 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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
index 2cbf2cc..cf90647 100644
--- a/src/3dimagestatistics-in-mask.cc
+++ b/src/3dimagestatistics-in-mask.cc
@@ -2,7 +2,7 @@
*
* This file is part of MIA - a toolbox for medical image analysis
*
- * Copyright (c) Leipzig, Madrid 1999-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
*
* pez-tools is free software; you can redistribute it and/or modify
diff --git a/src/3dimagestats.cc b/src/3dimagestats.cc
index d59f278..234f236 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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 2f1aed8..bfbb749 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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 @@ const SProgramDescription g_description = {
{pdi_description,
"Evaluate Euclidian distances between the corresponding landmarks in two landmark sets. "
- "The programs prints out only values for landmarks that are availabe and have location "
+ "The programs prints out only values for landmarks that are available and have location "
"values in both sets "},
{pdi_example_descr,
diff --git a/src/3dlandmarks-transform.cc b/src/3dlandmarks-transform.cc
index 203c84c..9c5ffe1 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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 8ea4f07..1387bbf 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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 f075849..b5acd71 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,8 +19,6 @@
*/
#include <fstream>
-#include <libxml++/libxml++.h>
-#include <itpp/signal/fastica.h>
#include <boost/filesystem.hpp>
#include <mia/core/filetools.hh>
diff --git a/src/3dmaskseeded.cc b/src/3dmaskseeded.cc
index 636d9a8..932ff33 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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 fcd0123..9f49356 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,8 +19,6 @@
*/
#include <fstream>
-#include <libxml++/libxml++.h>
-#include <itpp/signal/fastica.h>
#include <boost/filesystem.hpp>
#include <mia/core/msgstream.hh>
@@ -180,7 +178,8 @@ int do_main( int argc, char *argv[] )
bool no_normalize = false;
bool no_meanstrip = false;
size_t skip_images = 0;
- size_t max_ica_iterations = 400;
+ size_t max_ica_iterations = 400;
+ PIndepCompAnalysisFactory icatool;
size_t current_pass = 0;
size_t pass = 3;
@@ -218,7 +217,8 @@ int do_main( int argc, char *argv[] )
options.add(make_opt( mg_levels, "mg-levels", 'l', "multi-resolution levels"));
options.add(make_opt( pass, "passes", 'P', "registration passes"));
- options.set_group("ICA");
+ options.set_group("ICA");
+ options.add(make_opt( icatool, "internal", "fastica", 0, "FastICA implementationto be used"));
options.add(make_opt( components, "components", 'C', "ICA components 0 = automatic estimation"));
options.add(make_opt( no_normalize, "no-normalize", 0, "don't normalized ICs"));
options.add(make_opt( no_meanstrip, "no-meanstrip", 0,
@@ -254,12 +254,11 @@ int do_main( int argc, char *argv[] )
// run ICA
- CICAAnalysisITPPFactory icatool;
- C3DImageSeriesICA ica(icatool, series, false);
+ C3DImageSeriesICA ica(*icatool, series, false);
if (max_ica_iterations)
ica.set_max_iterations(max_ica_iterations);
if (!ica.run(components, !no_meanstrip, !no_normalize)) {
- ica.set_approach(CICAAnalysis::appr_symm);
+ ica.set_approach(CIndepCompAnalysis::appr_symm);
if (!ica.run(components, !no_meanstrip, !no_normalize))
cvwarn() << "ICA not converged, but the SYMM approach has given something to work with ...\n";
}
@@ -317,11 +316,11 @@ int do_main( int argc, char *argv[] )
- C3DImageSeriesICA ica2(icatool, series, false);
+ C3DImageSeriesICA ica2(*icatool, series, false);
if (max_ica_iterations)
ica2.set_max_iterations(max_ica_iterations);
if (!ica2.run(components, !no_meanstrip, !no_normalize)) {
- ica2.set_approach(CICAAnalysis::appr_symm);
+ ica2.set_approach(CIndepCompAnalysis::appr_symm);
ica2.run(components, !no_meanstrip, !no_normalize);
}
diff --git a/src/3dmulti-nrreg.cc b/src/3dmulti-nrreg.cc
index 1a97c30..9f0ef16 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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 643942c..3e1d179 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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 9ff69ab..8c635fe 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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 d328d1d..5f2c415 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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 2133077..db6ba18 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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 <sstream>
#include <iomanip>
#include <queue>
-#include <libxml++/libxml++.h>
#include <boost/filesystem.hpp>
#include <mia/core/msgstream.hh>
diff --git a/src/3dpropose-boundingbox.cc b/src/3dpropose-boundingbox.cc
index 33791c7..7e8020d 100644
--- a/src/3dpropose-boundingbox.cc
+++ b/src/3dpropose-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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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/3drigidreg.cc b/src/3drigidreg.cc
index f5357a1..15e7a51 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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 83fee79..9714014 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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-local-cmeans.cc b/src/3dsegment-local-cmeans.cc
new file mode 100644
index 0000000..0129edf
--- /dev/null
+++ b/src/3dsegment-local-cmeans.cc
@@ -0,0 +1,561 @@
+/* -*- mia-c++ -*-
+ *
+ * This file is part of MIA - a toolbox for medical image analysis
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
+ *
+ * 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/>.
+ *
+ */
+
+/*
+ Todo:
+ - adaptive filter sizes?
+ - Consider different tresholds for larger filter width
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <mia/core/histogram.hh>
+#include <mia/core/cmdlineparser.hh>
+#include <mia/core/cmeans.hh>
+#include <mia/core/parallel.hh>
+#include <mia/core/threadedmsg.hh>
+#include <mia/3d.hh>
+
+#include <memory>
+#include <vector>
+#include <numeric>
+
+using namespace mia;
+using namespace std;
+
+typedef vector<C3DFImage> C3DFImageVec;
+
+const SProgramDescription g_description = {
+ {pdi_group, "Analysis, filtering, combining, and segmentation of 3D images"},
+ {pdi_short, "Run a c-means segmentation of a 3D image."},
+ {pdi_description, "This program runs the segmentation of a 3D image by applying "
+ "a localized c-means approach that helps to overcome intensity inhomogeneities "
+ "in the image. The approach evaluates a global c-means clustering, and then "
+ "separates the image into overlapping regions where more c-means iterations "
+ "are run only including the locally present classes, i.e. the classes that "
+ "relatively contain more pixels than a given threshold."},
+ {pdi_example_descr, "Run the segmentation on image test.png using three classes, "
+ "local regions of 40 pixels (grid width 20 pixels), and a class ignore threshold of 0.01." },
+ {pdi_example_code, "-i test.png -o label.png -n 3 -g 20 -t 0.01"}
+};
+
+class FRunHistogram : public TFilter<void> {
+public:
+ template <typename T>
+ void operator()(const T3DImage<T>& image);
+
+ CSparseHistogram::Compressed get_histogram() const;
+
+private:
+ CSparseHistogram m_sparse_histogram;
+};
+
+struct ProtectedProbBuffer {
+ CMutex mutex;
+ vector<C3DFDatafield> probmap;
+
+ ProtectedProbBuffer(int n_classes, const C3DBounds& size);
+
+ ProtectedProbBuffer(const ProtectedProbBuffer& orig);
+};
+
+
+class FLocalCMeans: public TFilter<void> {
+public:
+ typedef map<int, CMeans::DVector> Probmap;
+
+
+ FLocalCMeans(float epsilon, const vector<double>& global_class_centers,
+ const C3DBounds& start, const C3DBounds& end,
+ const Probmap& global_probmap,
+ float rel_cluster_threshold,
+ const map<int, unsigned>& segmap,
+ ProtectedProbBuffer& prob_buffer,
+ bool partition_with_background);
+
+ template <typename T>
+ void operator()(const T3DImage<T>& image);
+private:
+
+ const float m_epsilon;
+ const vector<double>& m_global_class_centers;
+ const C3DBounds m_start;
+ const C3DBounds m_end;
+ const Probmap& m_global_probmap;
+ const float m_rel_cluster_threshold;
+ const map<int, unsigned>& m_segmap;
+
+ ProtectedProbBuffer& m_prob_buffer;
+ size_t m_count;
+ bool m_partition_with_background;
+};
+
+class FCrispSeg: public TFilter<P3DImage> {
+public:
+ FCrispSeg(const map<int, unsigned>& segmap):
+ m_segmap(segmap)
+ {
+ }
+
+ template <typename T>
+ P3DImage operator()(const T3DImage<T>& image) const {
+ P3DImage out_image = make_shared<C3DUBImage>(image.get_size());
+ C3DUBImage *help = static_cast<C3DUBImage*>(out_image.get());
+ transform(image.begin(), image.end(), help->begin(),
+ [this](T x){return m_segmap.at(x);});
+ return out_image;
+ }
+private:
+ const map<int, unsigned>& m_segmap;
+};
+
+
+
+int do_main(int argc, char *argv[])
+{
+
+ string in_filename;
+ string out_filename;
+ string out_filename2;
+ string cls_filename;
+ string debug_filename;
+
+ int blocksize = 15;
+ double rel_cluster_threshold = 0.02;
+
+ float cmeans_epsilon = 0.0001;
+ float class_label_thresh = 0.0f;
+
+ bool ignore_partition_with_background = false;
+
+ CMeans::PInitializer class_center_initializer;
+
+ 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( out_filename, "out-file", 'o', "class label image based on "
+ "merging local labels", CCmdOptionFlags::output, &image3dio ));
+
+ opts.add(make_opt( out_filename2, "out-global-crisp", 'G', "class label image based on "
+ "global segmentation", CCmdOptionFlags::output, &image3dio ));
+ opts.add(make_opt( cls_filename, "class-prob", 'C', "class probability image file, filetype "
+ "must support floating point multi-frame images", CCmdOptionFlags::output, &image3dio ));
+
+ opts.set_group("Parameters");
+ opts.add(make_opt( blocksize, EParameterBounds::bf_min_closed, {3},
+ "grid-spacing", 'g', "Spacing of the grid used to modulate "
+ "the intensity inhomogeneities"));
+ opts.add(make_opt( class_center_initializer, "kmeans:nc=3",
+ "cmeans", 'c', "c-means initializer"));
+ opts.add(make_opt( cmeans_epsilon, EParameterBounds::bf_min_open,
+ {0.0}, "c-means-epsilon", 'e', "c-means breaking condition for update tolerance"));
+ opts.add(make_opt( rel_cluster_threshold, EParameterBounds::bf_min_closed | EParameterBounds::bf_max_open,
+ {0.0,1.0}, "relative-cluster-threshold", 't', "threshhold to ignore classes when initializing"
+ " the local cmeans from the global one."));
+ opts.add(make_opt(ignore_partition_with_background, "ignore-background", 'B',
+ "Don't take background probablities into account when desiding whether classes are to be ignored"));
+ opts.add(make_opt(class_label_thresh,
+ EParameterBounds::bf_min_closed | EParameterBounds::bf_max_closed,
+ {0.0f, 1.0f},
+ "label-threshold", 'L',
+ "for values <= 0.5: create segmentation based on highest class probability, "
+ "labels start at 0. For values >0.5: create labels only for voxels with a "
+ "class probability higher than the given value, labels start at 1 and voxels "
+ "without an according class probability are set to 0; this output is suitable "
+ "for the seeded watershed filter."));
+
+ if (opts.parse(argc, argv) != CCmdOptionList::hr_no)
+ return EXIT_SUCCESS;
+
+ if (out_filename.empty() && out_filename2.empty()) {
+ throw invalid_argument("You must specify at least one output file");
+ }
+
+ auto in_image = load_image3d(in_filename);
+
+ FRunHistogram global_histogram;
+
+ mia::accumulate(global_histogram, *in_image);
+
+ CMeans globale_cmeans(cmeans_epsilon, class_center_initializer);
+
+ auto gh = global_histogram.get_histogram();
+
+ CMeans::DVector global_class_centers;
+ auto global_sparse_probmap = globale_cmeans.run(gh, global_class_centers, false);
+
+ cvinfo() << "Histogram range: [" << gh[0].first << ", " << gh[gh.size()-1].first << "]\n";
+ cvmsg() << "Global class centers: " << global_class_centers << "\n";
+ cvinfo() << "Probmap size = " << global_sparse_probmap.size()
+ << " weight number " << global_sparse_probmap[0].second.size() << "\n";
+
+ const unsigned n_classes = global_class_centers.size();
+
+ // need the normalized class centers
+
+
+
+ map<int, unsigned> segmap;
+ for_each(global_sparse_probmap.begin(), global_sparse_probmap.end(),
+ [&segmap](const CMeans::SparseProbmap::value_type& x) {
+ int c = 0;
+ float max_prob = 0.0f;
+ for (unsigned i = 0; i< x.second.size(); ++i) {
+ auto f = x.second[i];
+ if (f > max_prob) {
+ max_prob = f;
+ c = i;
+ };
+ }
+ segmap[x.first] = c;
+ });
+
+
+ FLocalCMeans::Probmap global_probmap;
+ for (auto k : global_sparse_probmap) {
+ global_probmap[k.first] = k.second;
+ };
+
+ if (!out_filename2.empty()) {
+ FCrispSeg cs(segmap);
+ auto crisp_global_seg = mia::filter(cs, *in_image);
+ if (!save_image (out_filename2, crisp_global_seg)) {
+ cverr() << "Unable to save to '" << out_filename2 << "'\n";
+ }
+ }
+
+ int nx = (in_image->get_size().x + blocksize - 1) / blocksize + 1;
+ int ny = (in_image->get_size().y + blocksize - 1) / blocksize + 1;
+ int nz = (in_image->get_size().z + blocksize - 1) / blocksize + 1;
+ int start_x = - static_cast<int>(nx * blocksize - in_image->get_size().x) / 2;
+ int start_y = - static_cast<int>(ny * blocksize - in_image->get_size().y) / 2;
+ int start_z = - static_cast<int>(nz * blocksize - in_image->get_size().z) / 2;
+
+ cvdebug() << "Start at " << start_x << ", " << start_y << ", " << start_z << "\n";
+
+
+ int max_threads = CMaxTasks::get_max_tasks();
+ assert(max_threads > 0);
+
+ CMutex current_probbuffer_mutex;
+ int current_probbuffer = 0;
+
+ vector<ProtectedProbBuffer> prob_buffers(max_threads,
+ ProtectedProbBuffer(global_class_centers.size(),
+ in_image->get_size()));
+
+ auto block_runner = [&](const C1DParallelRange& z_range) -> void {
+ CThreadMsgStream msg_stream;
+ current_probbuffer_mutex.lock();
+ int my_prob_buffer = current_probbuffer++;
+ if (current_probbuffer >= max_threads)
+ current_probbuffer = 0;
+ current_probbuffer_mutex.unlock();
+
+ for (int i = z_range.begin(); i < z_range.end(); ++i) {
+ int iz_base = start_z + i * blocksize;
+ unsigned iz = iz_base < 0 ? 0 : iz_base;
+
+ /* Work around the case that the image size (k*blocksize+1) */
+ if (iz >= in_image->get_size().z)
+ break;
+ unsigned iz_end = iz_base + 2 * blocksize;
+ if (iz_end > in_image->get_size().z)
+ iz_end = in_image->get_size().z;
+
+ cvmsg() << "Run slices " << iz_base << " - " << iz_end
+ << " with buffer " << my_prob_buffer << "\n";
+
+ for (int iy_base = start_y; iy_base < (int)in_image->get_size().y; iy_base += blocksize) {
+ unsigned iy = iy_base < 0 ? 0 : iy_base;
+ unsigned iy_end = iy_base + 2 * blocksize;
+ if (iy_end > in_image->get_size().y)
+ iy_end = in_image->get_size().y;
+
+ for (int ix_base = start_x; ix_base < (int)in_image->get_size().x; ix_base += blocksize) {
+ unsigned ix = ix_base < 0 ? 0 : ix_base;
+ unsigned ix_end = ix_base + 2 * blocksize;
+ if (ix_end > in_image->get_size().x)
+ ix_end = in_image->get_size().x;
+
+
+ FLocalCMeans lcm(cmeans_epsilon, global_class_centers,
+ C3DBounds(ix, iy, iz),
+ C3DBounds(ix_end, iy_end, iz_end),
+ global_probmap,
+ rel_cluster_threshold,
+ segmap,
+ prob_buffers[my_prob_buffer],
+ !ignore_partition_with_background);
+
+ mia::accumulate(lcm, *in_image);
+ }
+ }
+ }
+
+ };
+
+ pfor(C1DParallelRange(0, nz, 1), block_runner);
+
+
+ // sum the probabilities
+ for (unsigned i = 1; i < prob_buffers.size(); ++i) {
+ for (unsigned c = 0; c < n_classes; ++c) {
+ transform(prob_buffers[i].probmap[c].begin(), prob_buffers[i].probmap[c].end(),
+ prob_buffers[0].probmap[c].begin(), prob_buffers[0].probmap[c].begin(),
+ [](float x, float y){return x+y;});
+ }
+ }
+
+
+ // normalize probability images
+ vector<C3DFDatafield>& prob_buffer = prob_buffers[0].probmap;
+
+ C3DFImage sum(prob_buffer[0]);
+ for (unsigned c = 1; c < n_classes; ++c) {
+ transform(sum.begin(), sum.end(), prob_buffer[c].begin(), sum.begin(),
+ [](float x, float y){return x+y;});
+ }
+ for (unsigned c = 0; c < n_classes; ++c) {
+ transform(sum.begin(), sum.end(), prob_buffer[c].begin(), prob_buffer[c].begin(),
+ [](float s, float p){return p/s;});
+ }
+ if (!cls_filename.empty()) {
+ C3DImageIOPluginHandler::Instance::Data classes;
+
+ for (unsigned c = 0; c < n_classes; ++c)
+ classes.push_back(make_shared<C3DFImage>(prob_buffer[c]));
+
+ if (!C3DImageIOPluginHandler::instance().save(cls_filename, classes))
+ cverr() << "Error writing class images to '" << cls_filename << "'\n";
+ }
+
+
+ // now for each pixel we have a probability sum that should take inhomogeinities
+ // into account
+
+ C3DUBImage out_image(in_image->get_size(), *in_image);
+ fill(out_image.begin(), out_image.end(), 0);
+
+ if (class_label_thresh <= 0.5f) {
+
+ for (unsigned c = 1; c < n_classes; ++c) {
+ auto iout = out_image.begin();
+ auto eout = out_image.end();
+
+ auto itest = prob_buffer[0].begin();
+ auto iprob = prob_buffer[c].begin();
+
+ while ( iout != eout ){
+ if (*itest < *iprob) {
+ *itest = *iprob;
+ *iout = c;
+ }
+ ++iout; ++itest; ++iprob;
+ }
+ }
+ }else{
+ for (unsigned c = 0; c < n_classes; ++c) {
+ auto iout = out_image.begin();
+ auto eout = out_image.end();
+ auto iprob = prob_buffer[c].begin();
+
+ while ( iout != eout ){
+ if (class_label_thresh < *iprob) {
+ *iout = c +1;
+ }
+ ++iout; ++iprob;
+ }
+ }
+ }
+ return save_image(out_filename, out_image) ? EXIT_SUCCESS : EXIT_FAILURE;
+}
+
+
+ProtectedProbBuffer::ProtectedProbBuffer(int n_classes, const C3DBounds& size):
+ probmap(n_classes, C3DFDatafield(size))
+{
+}
+
+ProtectedProbBuffer::ProtectedProbBuffer(const ProtectedProbBuffer& orig):
+ probmap(orig.probmap)
+{
+}
+
+template <typename T>
+void FRunHistogram::operator()(const T3DImage<T>& image)
+{
+ m_sparse_histogram(image.begin(), image.end());
+}
+
+CSparseHistogram::Compressed FRunHistogram::get_histogram() const
+{
+ return m_sparse_histogram.get_compressed_histogram();
+}
+
+
+FLocalCMeans::FLocalCMeans(float epsilon, const vector<double>& global_class_centers,
+ const C3DBounds& start, const C3DBounds& end,
+ const Probmap& global_probmap,
+ float rel_cluster_threshold,
+ const map<int, unsigned>& segmap,
+ ProtectedProbBuffer& prob_buffer,
+ bool partition_with_background):
+ m_epsilon(epsilon),
+ m_global_class_centers(global_class_centers),
+ m_start(start),
+ m_end(end),
+ m_global_probmap(global_probmap),
+ m_rel_cluster_threshold(rel_cluster_threshold),
+ m_segmap(segmap),
+ m_prob_buffer(prob_buffer),
+ m_count((m_end - m_start).product()),
+ m_partition_with_background(partition_with_background)
+{
+}
+
+
+
+template <typename T>
+void FLocalCMeans::operator()(const T3DImage<T>& image)
+{
+ cvinfo() << "Run subrange ["<< m_start << "]-["<< m_end<<"]\n";
+
+
+ // obtain the histogram for the current patch
+ CSparseHistogram histogram;
+ histogram(image.begin_range(m_start, m_end),
+ image.end_range(m_start, m_end));
+ auto ch = histogram.get_compressed_histogram();
+
+ // calculate the class avaliability in the patch
+ vector<double> partition(m_global_class_centers.size());
+
+ for (auto idx: ch) {
+ const double n = idx.second;
+ auto v = m_global_probmap.at(idx.first);
+ transform(partition.begin(), partition.end(), v.begin(),
+ partition.begin(), [n](double p, double value){return p + n * value;});
+ }
+
+ // don't count background class in partition
+ int start_class = m_partition_with_background ? 0 : 1;
+
+ auto part_thresh = std::accumulate(partition.begin() + start_class, partition.end(), 0.0) * m_rel_cluster_threshold;
+
+ cvinfo() << "Partition=" << partition
+ << ", thresh=" << part_thresh
+ << "\n";
+
+ // select the classes that should be used further on
+ vector<double> retained_class_centers;
+ vector<unsigned> used_classed;
+ for (unsigned i = 0; i < partition.size(); ++i) {
+ if (partition[i] >= part_thresh) {
+ retained_class_centers.push_back(m_global_class_centers[i]);
+ used_classed.push_back(i);
+ }
+ }
+
+
+ // prepare linear interpolation summing
+ auto center = C3DFVector((m_end + m_start)) / 2.0f;
+ auto max_distance = C3DFVector((m_end - m_start)) / 2.0f;
+
+
+ if (retained_class_centers.size() > 1) {
+
+ ostringstream cci_descr;
+ cci_descr << "predefined:cc=[" << retained_class_centers<<"]";
+ cvinfo() << "Initializing local cmeans with '" << cci_descr.str()
+ << " for retained classes " << used_classed << "'\n";
+ auto cci = CMeansInitializerPluginHandler::instance().produce(cci_descr.str());
+
+
+ // remove data that was globally assigned to now unused class
+ CSparseHistogram::Compressed cleaned_histogram;
+ cleaned_histogram.reserve(ch.size());
+
+ // copy used intensities
+ for (auto c: used_classed) {
+ for (auto ich: ch) {
+ if ( m_segmap.at(ich.first) == c) {
+ cleaned_histogram.push_back(ich);
+ }
+ }
+ }
+
+ // evluate the local c-means classification
+ CMeans local_cmeans(m_epsilon, cci);
+ auto local_map = local_cmeans.run(cleaned_histogram, retained_class_centers);
+
+ // create a lookup map intensity -> probability vector
+ map<unsigned short, CMeans::DVector> mapper;
+ for (auto i: local_map) {
+ mapper[i.first] = i.second;
+ }
+
+
+ // now add the new probabilities to the global maps.
+ auto ii = image.begin_range(m_start, m_end);
+ auto ie = image.end_range(m_start, m_end);
+ CScopedLock prob_lock(m_prob_buffer.mutex);
+ while (ii != ie) {
+ auto probs = mapper.find(*ii);
+ auto delta = (C3DFVector(ii.pos()) - center) / max_distance;
+ float lin_scale = (1.0 - std::fabs(delta.x))* (1.0 - std::fabs(delta.y));
+
+ if (probs != mapper.end()) {
+ for (unsigned c = 0; c < used_classed.size(); ++c) {
+ m_prob_buffer.probmap[used_classed[c]](ii.pos()) += lin_scale * probs->second[c];
+ }
+ }else{ // not in local map: retain global probabilities
+ auto v = m_global_probmap.at(*ii);
+ for (unsigned c = 0; c < v.size(); ++c) {
+ m_prob_buffer.probmap[c](ii.pos()) += lin_scale * v[c];
+ }
+ }
+ ++ii;
+ }
+
+
+ }else{// only one class retained, add 1.0 to probabilities, linearly smoothed
+ cvinfo() << "Only one class used:" << used_classed[0] << "\n";
+ auto ii = m_prob_buffer.probmap[used_classed[0]].begin_range(m_start, m_end);
+ auto ie = m_prob_buffer.probmap[used_classed[0]].end_range(m_start, m_end);
+ CScopedLock prob_lock(m_prob_buffer.mutex);
+ while (ii != ie) {
+ auto delta = (C3DFVector(ii.pos()) - center) / max_distance;
+ *ii += (1.0 - std::fabs(delta.x))* (1.0 - std::fabs(delta.y)); ;
+ ++ii;
+ }
+
+ }
+ cvinfo() << "Done subrange ["<< m_start << "]-["<< m_end<<"]\n";
+}
+
+#include <mia/internal/main.hh>
+MIA_MAIN(do_main);
+
diff --git a/src/3dserial-nonrigid.cc b/src/3dserial-nonrigid.cc
index f21df8e..2226fac 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,8 +19,6 @@
*/
#include <fstream>
-#include <libxml++/libxml++.h>
-#include <itpp/signal/fastica.h>
#include <boost/filesystem.hpp>
#include <mia/core/filetools.hh>
diff --git a/src/3dseries-track-intensity.cc b/src/3dseries-track-intensity.cc
index 270ebb8..792fb16 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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 aec67a3..90d5808 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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 a1c2fc8..f7fa727 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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 94e147c..199bfed 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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 c833e43..774ba36 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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 12b06b6..b58e3c9 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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 7ccb9dc..b5668f8 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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 55bb09d..24b1415 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -67,6 +67,7 @@ DEFEXE(2dimagefullstats mia2d )
DEFEXE(2dbinarycombine mia2d )
DEFEXE(2dtransformation-to-strain mia2d)
DEFEXE(2dimageseries-maximum-intensity-projection mia2d)
+DEFEXE(2dfluid-syn-registration mia2d)
DEFCHKEXE(2dlerp mia2d )
@@ -99,19 +100,18 @@ DEFEXE(2dmyopgt-nonrigid mia2dmyocardperf )
DEFEXE(2dmany2one-nonrigid mia2dmyocardperf )
DEFEXE(2dmyoset-all2one-nonrigid mia2dmyocardperf )
-IF(ITPP_FOUND)
- DEFEXE(2dmyocard-segment mia2dmyocardperf )
- DEFEXE(2dmyoica-full mia2dmyocardperf )
- DEFEXE(2dmyoicapgt mia2dmyocardperf )
- DEFEXE(2dmyomilles mia2dmyocardperf )
- DEFEXE(2dmyocard-ica mia2dmyocardperf )
- DEFEXE(2dmyocard-icaseries mia2dmyocardperf )
- DEFEXE(2dmyoica-nonrigid mia2dmyocardperf )
- DEFEXE(2dmyoica-nonrigid-parallel mia2dmyocardperf )
- DEFEXE(2dmyoica-nonrigid2 mia2dmyocardperf )
- SET(PERF_AND_3D_LIBS mia3d mia2dmyocardperf)
- DEFEXE(2dseriestovolume "${PERF_AND_3D_LIBS}")
-ENDIF(ITPP_FOUND)
+
+DEFEXE(2dmyocard-segment mia2dmyocardperf )
+DEFEXE(2dmyoica-full mia2dmyocardperf )
+DEFEXE(2dmyoicapgt mia2dmyocardperf )
+DEFEXE(2dmyomilles mia2dmyocardperf )
+DEFEXE(2dmyocard-ica mia2dmyocardperf )
+DEFEXE(2dmyocard-icaseries mia2dmyocardperf )
+DEFEXE(2dmyoica-nonrigid mia2dmyocardperf )
+DEFEXE(2dmyoica-nonrigid-parallel mia2dmyocardperf )
+DEFEXE(2dmyoica-nonrigid2 mia2dmyocardperf )
+SET(PERF_AND_3D_LIBS mia3d mia2dmyocardperf)
+DEFEXE(2dseriestovolume "${PERF_AND_3D_LIBS}")
DEFEXE(2dgrayimage-combine-to-rgb mia2d)
DEFEXE(2deval-transformquantity mia2d)
@@ -163,10 +163,12 @@ DEFEXE(3dvfcompare mia3d )
DEFEXE(3deval-transformquantity mia3d)
DEFEXE(3dcost-translatedgrad mia3d)
DEFEXE(3dsegment-ahmed mia3d)
+DEFEXE(3dsegment-local-cmeans mia3d )
DEFEXE(3dcombine-mr-segmentations mia3d)
DEFEXE(3dcombine-imageseries mia3d)
DEFEXE(3dpropose-boundingbox mia3d)
DEFEXE(3dimagestatistics-in-mask mia3d)
+DEFEXE(3dfluid-syn-registration mia3d)
DEFEXE(3dlandmarks-transform mia3d)
DEFEXE(3dlandmarks-distances mia3d)
diff --git a/src/cmeans.cc b/src/cmeans.cc
index 088160f..8df785e 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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 ad74cca..bc0ad3d 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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 3c04181..6726bc6 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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 03c30e6..2f59240 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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 cec18b3..3c50f03 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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 410d82d..d8d9b14 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -198,7 +198,6 @@ void TElastReg::work(C2DFVectorfield *Shift, const C2DInterpolatorFactory& ipfac
// init displacement field
u = *Shift;
- Shift->make_single_ref();
Template = C2DFImage(Model.get_size());
{
FDeformer2D deformer(*Shift, ipfac);
@@ -245,7 +244,6 @@ void TElastReg::work(C2DFVectorfield *Shift, const C2DInterpolatorFactory& ipfac
float delta = dmin - diff;
cvdebug() << " delta cost " << delta << "\n";
usave = u;
- u.make_single_ref();
if (delta < 100)
break;
diff --git a/src/fluid2d/elast.hh b/src/fluid2d/elast.hh
index 178e4ef..a4c37b3 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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 64ed760..88b476f 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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 495ba69..290182b 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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 3b57caa..e327659 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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 29406d0..899518f 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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 8bd5747..5257b9a 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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 33059b5..0b4703d 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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 31522b2..4e7bc8b 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,4 +39,5 @@ TFluidHomogenSolver::TFluidHomogenSolver(int _max_steps, float _rel_res, float _
c = 1/(6*a+2*b);
a_b = a + b;
b_4 = b * 0.25;
+
}
diff --git a/src/fluid3d/eqn_solver.hh b/src/fluid3d/eqn_solver.hh
index 30032ab..792f799 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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 4cb57b2..f53a055 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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 @@ enum TMethod { meth_sor,
const TDictMap<TMethod>::Table method_dict[] = {
- {"sor", meth_sor, "succesive overrelaxation"}
+ {"sor", meth_sor, "successive overrelaxation"}
,{"sora",meth_sorex, "Gauss Southwell relexation"}
// ,{"sorap",meth_sorap}
,{NULL, meth_sor, ""}
@@ -139,7 +139,7 @@ int do_main(int argc, char *argv[])
options.add(make_opt( params.InitialStepsize, "step", 0, "Initial stepsize"));
options.add(make_opt( interpolator_kernel, "bspline:d=3", "interpolator", 'p', "image interpolator kernel"));
options.add(make_opt( params.Overrelaxation, "relax", 0, "overrelaxation factor vor method sor"));
- options.add(make_opt( params.maxiter, "maxiter", 0, "maxium iterations"));
+ options.add(make_opt( params.maxiter, "maxiter", 0, "maximum iterations"));
options.add(make_opt( params.factor, "epsilon", 0, "truncation condition"));
options.add(make_opt( params.matter_threshold, "matter", 0, "intensity above which real "
"matter is assumed (experimental)"));
@@ -160,7 +160,7 @@ int do_main(int argc, char *argv[])
std::shared_ptr<TLinEqnSolver > ensure_solver_delete(solver);
- g_start = Clock.get_seconds();
+ g_start = CWatch::instance().get_seconds();
P3DFVectorfield result = fluid_transform(params,solver,!disable_multigrid,
!disable_fullres,&g_MeasureList, ipf);
diff --git a/src/fluid3d/sor_solver.cc b/src/fluid3d/sor_solver.cc
index ee27674..d3b38c2 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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 cfb4f23..01d3de2 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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 1f85b10..31bc28a 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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 f88b8d3..01c48e7 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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,7 +41,6 @@
NS_MIA_USE
-CWatch Clock;
int STARTSIZE=16;
using namespace std;
@@ -421,11 +420,11 @@ void TFluidReg::ApplyShift()
void TFluidReg::solvePDE()
{
- float t_start = Clock.get_seconds();
+ float t_start = CWatch::instance().get_seconds();
Measurement.PDEEval++;
solver->solve(*B,V);
Measurement.niter = -1;
- Measurement.PDETime += Clock.get_seconds() - t_start;
+ Measurement.PDETime += CWatch::instance().get_seconds() - t_start;
}
double g_start;
@@ -480,7 +479,7 @@ static P3DFVectorfield do_transform(const TFluidRegParams& params,
break;
}
}
- Measure.allovertime = Clock.get_seconds() - g_start;
+ Measure.allovertime = CWatch::instance().get_seconds() - g_start;
cvmsg() << "time: " << Measure.allovertime << endl;
measure_list->insert(measure_list->end(),Measure);
diff --git a/src/fluid3d/vfluid.hh b/src/fluid3d/vfluid.hh
index b83324b..71be66f 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -71,8 +71,6 @@ mia::P3DFVectorfield fluid_transform(const TFluidRegParams& params,TLinEqnSolver
const mia::C3DInterpolatorFactory& ipf
);
-extern mia::CWatch Clock;
-
class TFluidReg {
diff --git a/src/isosurface/CMakeLists.txt b/src/isosurface/CMakeLists.txt
index 1ed6682..eaba2ab 100644
--- a/src/isosurface/CMakeLists.txt
+++ b/src/isosurface/CMakeLists.txt
@@ -26,7 +26,7 @@ IF(WITH_GTS)
IF(STRICT_DEPENDECIES)
pkg_check_modules(GTS gts REQUIRED)
ELSE(STRICT_DEPENDECIES)
- pkg_check_modules(GTS gts REQUIRED)
+ pkg_check_modules(GTS gts)
ENDIF(STRICT_DEPENDECIES)
ENDIF(WITH_GTS)
@@ -52,4 +52,4 @@ IF(GTS_FOUND)
# add GTS IO plug-in
-ENDIF(GTS_FOUND)
\ No newline at end of file
+ENDIF(GTS_FOUND)
diff --git a/src/isosurface/iso.cc b/src/isosurface/iso.cc
index 0ba675f..24b56cd 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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_backend.cc b/src/isosurface/iso_backend.cc
index 0cf80d5..c7faf9b 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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 b77becb..d882382 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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 9e869d1..8356b47 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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 73ee689..92ec588 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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
index ad9684e..a8afe14 100644
--- a/src/mesh-deformable-model.cc
+++ b/src/mesh-deformable-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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -121,8 +121,7 @@ PTriangleMesh DeformableModel::run(const CTriangleMesh& mesh, const C3DFImage& r
C3DInterpolatorFactory ipf("bspline:d=1", "zero");
unique_ptr<T3DConvoluteInterpolator<float>> R(ipf.create(reference.data()));
- const auto gradient = get_gradient(reference);
-
+ C3DLinearVectorfieldInterpolator gradient(get_gradient(reference));
PTriangleMesh result(new CTriangleMesh(mesh));
if (m_reorient_mesh) {
diff --git a/src/mesh-to-maskimage.cc b/src/mesh-to-maskimage.cc
index ffec078..30915e1 100644
--- a/src/mesh-to-maskimage.cc
+++ b/src/mesh-to-maskimage.cc
@@ -1,7 +1,7 @@
/* -*- mia-c++ -*-
*
* This file is part of MIA - a toolbox for medical image analysis
- * Copyright (c) Leipzig, Madrid 1999-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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/meshdistance-to-stackmask.cc b/src/meshdistance-to-stackmask.cc
index 747a3c7..63c62b2 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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 2eb98e3..54229b3 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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 1fb360e..0962f7c 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -185,7 +185,7 @@ int do_main( int argc, char *argv[] )
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, set to zero to create a bin for "
- "each intensity value availabe in the input data. In this case the histogram "
+ "each intensity value available in the input data. In this case the histogram "
"range is also evaluated automatically"));
if (options.parse(argc, argv) != CCmdOptionList::hr_no)
diff --git a/src/multiimage-cmeans.cc b/src/multiimage-cmeans.cc
index 2971de3..d046fab 100644
--- a/src/multiimage-cmeans.cc
+++ b/src/multiimage-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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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/myowavelettest.cc b/src/myowavelettest.cc
index 657b4d0..f073102 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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 24768c4..be751dd 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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 @@ NS_MIA_USE;
const SProgramDescription description = {
{pdi_group, "Help"},
{pdi_short, "Print help about plug-in groups"},
- {pdi_description, "This program is used to print out help about the availabel plug-ins\n"},
+ {pdi_description, "This program is used to print out help about the available plug-ins\n"},
{pdi_example_descr, "Print out the help about the 2D filter plugins .\n"},
{pdi_example_code, "filter/2d"}
};
diff --git a/src/raw2image.cc b/src/raw2image.cc
index e1dfcab..977c83b 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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 aeb9f58..baf0191 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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 7c885d4..2c6b8a6 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free 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/wavelettrans.cc b/src/wavelettrans.cc
index 5e30a44..172d65b 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-2016 Gert Wollny
+ * Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* 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