[med-svn] [mia] 01/04: Imported Upstream version 2.2.1
Gert Wollny
gert-guest at moszumanska.debian.org
Thu Sep 18 09:38:50 UTC 2014
This is an automated email from the git hooks/post-receive script.
gert-guest pushed a commit to branch master
in repository mia.
commit bc318b32176d18fea674cf3f1d3afacaddf08131
Author: Gert Wollny <gw.fossdev at gmail.com>
Date: Wed Sep 17 16:52:59 2014 +0200
Imported Upstream version 2.2.1
---
CMakeLists.txt | 6 +++---
ChangeLog | 47 ++++++++++++++++++++++++------------------
addons/hdf5/hdf5mia.cc | 13 ++++++------
addons/nifti/niftiimage.cc | 3 +++
mia/2d/filter/mean.cc | 3 ++-
mia/2d/filter/median.cc | 3 ++-
mia/2d/fullcost/maskedimage.hh | 1 -
mia/2d/io/bmp.cc | 2 +-
mia/2d/segframe.cc | 3 +++
mia/3d/fullcost/maskedimage.hh | 1 -
mia/3d/image.cc | 2 +-
mia/3d/test_stackdisttrans.cc | 4 ++--
mia/core/factory.hh | 2 ++
mia/core/ica.cc | 4 ++++
mia/core/iohandler.cxx | 2 +-
mia/core/slopestatistics.cc | 1 +
mia/mesh/io/off.cc | 10 ++++-----
model_coverty.cpp | 26 +++++++++++++++++++++++
src/2dmyoica-full.cc | 5 +++--
src/2dsegment-ahmed.cc | 2 +-
src/3dsegment-ahmed.cc | 2 +-
21 files changed, 95 insertions(+), 47 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6396709..b44245a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -41,9 +41,9 @@ SET(VENDOR "Gert Wollny")
SET(PACKAGE_NAME "mia")
SET(MAJOR_VERSION 2)
SET(MINOR_VERSION 2)
-SET(MICRO_VERSION 0)
-SET(INTERFACE_AGE 0)
-SET(BINARY_AGE 0)
+SET(MICRO_VERSION 1)
+SET(INTERFACE_AGE 1)
+SET(BINARY_AGE 1)
SET(PACKAGE_VERSION "${MAJOR_VERSION}.${MINOR_VERSION}.${MICRO_VERSION}")
SET(VERSION "${MAJOR_VERSION}.${MINOR_VERSION}")
diff --git a/ChangeLog b/ChangeLog
index 3093872..e0f606f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,21 +1,28 @@
+2.2.1
+
+ * fixes for potential bugs discovered by Coverity
+ * src/2dmyoica-full.cc: fixes and error in the order of
+ parameters passed
+
2.2.0
- New features:
-
- * Major ABI changes
- * Add support for HDF5 and NIFTI1 IO
- * Support for masked cost functions in voxel based image registration
+ New features:
+
+ * Major ABI changes
+ * Add support for HDF5 and NIFTI1 IO
+ * Support for masked cost functions in voxel based image registration
* Use Eigen3 for the 3D matrix eigenvalue/eigenvector evaluation
- * More C++11, minimal requirement is now g++ >= 4.7
- * Keep track of orientations
- * Add perfusion motion eompensation programs that are specifically designed to use a global
- reference even if the algorithm doesn't dictate this
- * automatically set C++11 compiler flag by cmake
+ * More C++11, minimal requirement is now g++ >= 4.7
+ * Keep track of orientations
+ * Add perfusion motion compensation programs that are specifically
+ designed to use a global reference even if the algorithm doesn't
+ dictate this
+ * automatically set C++11 compiler flag by cmake
Fixes for tracked issues:
- * #4 add 2D/3D filters that actually run a combiner,
- * #12 add basic support for loading and stroring nifti
+ * #4 add 2D/3D filters that actually run a combiner,
+ * #12 add basic support for loading and stroring nifti
* #14 load and store ImageOrientationPatient and ImagePositionPatient related
* #19 Add positional information to C3DTransform::const_iterator
* #49 Parallize the 3D scale filter
@@ -23,10 +30,10 @@
* #76 Remove the old divcurl penalty interface in 2D Closes
* #90 Add voxel/pixel size attribute to vector field
* #100 Make the 3D image combiner similar to the 2D combiner
- * #108
+ * #108 Change segmentation set IO to possible make use of plug-ins
* #117 Add support to query minimal image size for transformations
* #123 Correct handling of ica instance when RV/LV classification fails in all cases,
- * #124 Add attribute to indicate the pixel size is from the imager
+ * #124 Add attribute to indicate the pixel size is from the imager
* #125 Make slicelocation and slicespacing non-obligatory
* #126 Correct plug-in file suffix mapping for 2D and 3D images.
* #127 Correct documentation and output to refer to 2D data.
@@ -44,10 +51,10 @@
* #144 Parallelize the prefiltering in the 3D interpolator
* #145 make sure the interpolator output range always includes zero
- * #147 Add function to override interpolator once.
+ * #147 Add function to override interpolator once.
* #152 add 3 label-voting downscale filter
* #153 Add traits for the range iterators
- * #156 add additional flags to to the XML document creation CStringParameter,
+ * #156 add additional flags to to the XML document creation CStringParameter,
* #157 split range iterator in version with and without boundary flags.
* #158 Consistently implement the lncc metric for masked and unmasked images
* #159 Add option to chain filters into one entity.
@@ -56,14 +63,14 @@
Additional fixes:
* make all source files lowercase
- * correct compilation with visibility=hidden
- * handles signed and unsigned pixel values in DICOM
- * let the xml-help write to a file instead of stdout
+ * correct compilation with visibility=hidden
+ * handles signed and unsigned pixel values in DICOM
+ * let the xml-help write to a file instead of stdout
* Correct default suffix for 2D transforms.
* add attributes to boost::serialization transform IO
* Add the _1 quaternion that corresponds to no rotation
* Add printing of CAttributedData for testing
- * Add an affine matrix with OpenGL like layout
+ * Add an affine matrix with OpenGL like layout
* add a program to evaluate the pixel wise maximum intensity of number of images
* add support for setting the minimum number of digits in the output file names.
* Add SSD cost function with automasking baswed on intensity thresholds.
diff --git a/addons/hdf5/hdf5mia.cc b/addons/hdf5/hdf5mia.cc
index d815a49..1d5dfe4 100644
--- a/addons/hdf5/hdf5mia.cc
+++ b/addons/hdf5/hdf5mia.cc
@@ -411,13 +411,14 @@ H5Dataset H5Dataset::create(const H5Base& parent, const char *name, hid_t type_i
if (status < 0) {
cvwarn() << "HDF5 gzip should be supported, but failed, store uncompressed\n";
id = H5Dcreate(p, relative_name.c_str(), type_id, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ }else{
+ // we compress the whole data in one chunk
+ auto chunk_size = space.get_size();
+ status = H5Pset_chunk (dcpl, chunk_size.size(), &chunk_size[0]);
+ id = H5Dcreate (p, relative_name.c_str(), type_id, space, H5P_DEFAULT, dcpl,
+ H5P_DEFAULT);
+ cvdebug() << "HDF5: Dataset '"<< name <<"' created with gzip compression enabled\n";
}
- // we compress the whole data in one chunk
- auto chunk_size = space.get_size();
- status = H5Pset_chunk (dcpl, chunk_size.size(), &chunk_size[0]);
- id = H5Dcreate (p, relative_name.c_str(), type_id, space, H5P_DEFAULT, dcpl,
- H5P_DEFAULT);
- cvdebug() << "HDF5: Dataset '"<< name <<"' created with gzip compression enabled\n";
}else {
id = H5Dcreate(p, relative_name.c_str(), type_id, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
}
diff --git a/addons/nifti/niftiimage.cc b/addons/nifti/niftiimage.cc
index 41213cb..80d0766 100644
--- a/addons/nifti/niftiimage.cc
+++ b/addons/nifti/niftiimage.cc
@@ -347,6 +347,9 @@ bool CNifti3DImageIOPlugin::do_save(const std::string& fname, const Data& data)
// todo: re-check how this qfac is actually used
output->qfac = 1;
switch (image.get_orientation()) {
+ // Coverty complains here.
+ // flipped needs to sent an extra parameter and
+ // then fall through to the next case
case ior_xyz_flipped: output->qfac = -1;
case ior_undefined:
case ior_xyz: {
diff --git a/mia/2d/filter/mean.cc b/mia/2d/filter/mean.cc
index 4d541e9..2e1e29e 100644
--- a/mia/2d/filter/mean.cc
+++ b/mia/2d/filter/mean.cc
@@ -121,7 +121,8 @@ P2DImage C2DMean::do_filter(const C2DImage& image) const
}
C2DMeanFilterPlugin::C2DMeanFilterPlugin():
- C2DFilterPlugin("mean")
+ C2DFilterPlugin("mean"),
+ m_hw(1)
{
add_parameter("w", new CIntParameter(m_hw, 0, numeric_limits<int>::max(), false, "half filter width"));
}
diff --git a/mia/2d/filter/median.cc b/mia/2d/filter/median.cc
index e4111fe..f4ec78e 100644
--- a/mia/2d/filter/median.cc
+++ b/mia/2d/filter/median.cc
@@ -101,7 +101,8 @@ P2DImage C2DMedian::do_filter(const C2DImage& image) const
C2DMedianFilterPluginFactory::C2DMedianFilterPluginFactory():
- C2DFilterPlugin("median")
+ C2DFilterPlugin("median"),
+ m_hw(1)
{
add_parameter("w", new CIntParameter(m_hw, 0, numeric_limits<int>::max(), false, "half filter width"));
}
diff --git a/mia/2d/fullcost/maskedimage.hh b/mia/2d/fullcost/maskedimage.hh
index f11bc81..92f3c2a 100644
--- a/mia/2d/fullcost/maskedimage.hh
+++ b/mia/2d/fullcost/maskedimage.hh
@@ -72,7 +72,6 @@ private:
C2DBitImage *m_ref_mask_scaled_bit;
P2DMaskedImageCost m_cost_kernel;
- bool m_debug;
};
NS_MIA_END
diff --git a/mia/2d/io/bmp.cc b/mia/2d/io/bmp.cc
index 7a3e011..e1e6041 100644
--- a/mia/2d/io/bmp.cc
+++ b/mia/2d/io/bmp.cc
@@ -384,7 +384,7 @@ CBMP2DImageIO::PData CBMP2DImageIO::do_load(string const& filename)const
// the tainted variables.
size_t h = info_header.height;
size_t w = info_header.width;
- if (h > numeric_limits<size_t>::max() || w > numeric_limits<size_t>::max())
+ if (h > numeric_limits<unsigned>::max() || w > numeric_limits<unsigned>::max())
throw create_exception<runtime_error>("CBMP2DImageIO::load: Image has too big",
" width=", info_header.width, ", height=",
info_header.height);
diff --git a/mia/2d/segframe.cc b/mia/2d/segframe.cc
index 6104227..61f1a9c 100644
--- a/mia/2d/segframe.cc
+++ b/mia/2d/segframe.cc
@@ -40,6 +40,9 @@ namespace bfs=boost::filesystem;
CSegFrame::CSegFrame():
m_has_star(false),
+ m_quality(0),
+ m_brightness(0),
+ m_contrast(0),
m_version(0)
{
}
diff --git a/mia/3d/fullcost/maskedimage.hh b/mia/3d/fullcost/maskedimage.hh
index 7e03af9..3bd4682 100644
--- a/mia/3d/fullcost/maskedimage.hh
+++ b/mia/3d/fullcost/maskedimage.hh
@@ -79,7 +79,6 @@ private:
C3DBitImage *m_ref_mask_scaled_bit;
P3DMaskedImageCost m_cost_kernel;
- bool m_debug;
};
NS_MIA_END
diff --git a/mia/3d/image.cc b/mia/3d/image.cc
index 75ccc25..041ced4 100644
--- a/mia/3d/image.cc
+++ b/mia/3d/image.cc
@@ -479,8 +479,8 @@ bool C3DValueAttributeTranslator<T>::register_for(const std::string& key)
{
C3DValueAttributeTranslator *me = new C3DValueAttributeTranslator();
if (!me->do_register(key)) {
- return false;
delete me;
+ return false;
}
return true;
}
diff --git a/mia/3d/test_stackdisttrans.cc b/mia/3d/test_stackdisttrans.cc
index 36ef5d3..38186d8 100644
--- a/mia/3d/test_stackdisttrans.cc
+++ b/mia/3d/test_stackdisttrans.cc
@@ -154,9 +154,9 @@ BOOST_AUTO_TEST_CASE( test_anisotropic_data )
BOOST_REQUIRE(result0.size() == ref_result.size());
for( auto test = result0.begin(), ref = ref_result.begin(); test != result0.end();
++test, ++ref) {
- BOOST_CHECK_EQUAL(*test, *ref);
+ BOOST_CHECK_EQUAL(test->point, ref->point);
+ BOOST_CHECK_CLOSE(test->distance, ref->distance, 0.1);
}
}
-
diff --git a/mia/core/factory.hh b/mia/core/factory.hh
index 51a6f10..d8c5560 100644
--- a/mia/core/factory.hh
+++ b/mia/core/factory.hh
@@ -311,11 +311,13 @@ struct create_plugin<Handler, ProductChained, true> {
cvdebug() << "print help\n";
cvmsg() << "\n";
h.print_help(cverb);
+ delete result;
return nullptr;
}
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(), "'");
}
diff --git a/mia/core/ica.cc b/mia/core/ica.cc
index c11c487..1f6edb4 100644
--- a/mia/core/ica.cc
+++ b/mia/core/ica.cc
@@ -399,6 +399,9 @@ CICAAnalysisImpl::CICAAnalysisImpl(size_t rows, size_t length):
}
CICAAnalysisImpl::CICAAnalysisImpl(const itpp::mat& ic, const itpp::mat& mix, const std::vector<float>& 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
m_Signal(mix.cols(), ic.rows()),
m_ICs(ic),
m_Mix(mix),
@@ -409,6 +412,7 @@ CICAAnalysisImpl::CICAAnalysisImpl(const itpp::mat& ic, const itpp::mat& mix, co
m_max_iterations(0),
m_approach(FICA_APPROACH_DEFL)
{
+ TRACE_FUNCTION;
}
void CICAAnalysis::normalize_ICs()
diff --git a/mia/core/iohandler.cxx b/mia/core/iohandler.cxx
index 3caec35..f62eb17 100644
--- a/mia/core/iohandler.cxx
+++ b/mia/core/iohandler.cxx
@@ -32,12 +32,12 @@ TIOPluginHandler<I>::TIOPluginHandler():
m_pool_plugin(new CDatapoolPlugin())
{
TRACE_FUNCTION;
+ this->add_plugin(m_pool_plugin);
}
template <typename I>
void TIOPluginHandler<I>::do_initialise()
{
- this->add_plugin(m_pool_plugin);
for (const_iterator i = this->begin(); i != this->end(); ++i)
i->second->add_suffixes(m_suffixmap);
diff --git a/mia/core/slopestatistics.cc b/mia/core/slopestatistics.cc
index 32203de..9572b2a 100644
--- a/mia/core/slopestatistics.cc
+++ b/mia/core/slopestatistics.cc
@@ -159,6 +159,7 @@ CSlopeStatisticsImpl::CSlopeStatisticsImpl(const vector<float>& series, int inde
m_start_movement(-1),
m_gradient_peak_valid(false),
m_wt_valid(false),
+ m_max_freq_slot(0),
m_wt_peak_coefficient(0),
m_wt_mean_wt_level(0),
m_wt_energy(0),
diff --git a/mia/mesh/io/off.cc b/mia/mesh/io/off.cc
index 8c8749b..eff9dd5 100644
--- a/mia/mesh/io/off.cc
+++ b/mia/mesh/io/off.cc
@@ -751,18 +751,18 @@ bool COffMeshIO::do_save(string const & filename, const CTriangleMesh& data)con
if (flags & CTriangleMesh::ed_normal) {
const CTriangleMesh::normal_type& n = data.normal_at(i);
- written = fprintf(f, " %f %f %f",n.x,n.y, n.z);
+ written += fprintf(f, " %f %f %f",n.x,n.y, n.z);
}
if (flags & CTriangleMesh::ed_color && flags & CTriangleMesh::ed_scale) {
const CTriangleMesh::color_type& c = data.color_at(i);
- written = fprintf(f, " %f %f %f %f",c.x,c.y, c.z, data.scale_at(i));
+ written += fprintf(f, " %f %f %f %f",c.x,c.y, c.z, data.scale_at(i));
}else if (flags & CTriangleMesh::ed_color && !(flags & CTriangleMesh::ed_scale)) {
const CTriangleMesh::color_type& c = data.color_at(i);
- written = fprintf(f, " %f %f %f 1.0",c.x,c.y, c.z);
+ written += fprintf(f, " %f %f %f 1.0",c.x,c.y, c.z);
}else if ( !(flags & CTriangleMesh::ed_color) && flags & CTriangleMesh::ed_scale) {
- written = fprintf(f, "1.0 1.0 1.0");
+ written += fprintf(f, "1.0 1.0 1.0");
}
- written = fprintf(f,"\n");
+ written += fprintf(f,"\n");
}
CTriangleMesh::const_triangle_iterator tb = data.triangles_begin();
diff --git a/model_coverty.cpp b/model_coverty.cpp
new file mode 100644
index 0000000..6fc3896
--- /dev/null
+++ b/model_coverty.cpp
@@ -0,0 +1,26 @@
+/***/
+
+namespace std {
+
+template <typename T>
+swap(T* &a, T* &b) {
+ return;
+}
+
+}
+
+void BOOST_REQUIRE(bool x)
+{
+ if (!x)
+ __coverity_panic__();
+
+}
+
+
+void BOOST_REQUIRE(const void *x)
+{
+ if (!x)
+ __coverity_panic__();
+
+}
+
diff --git a/src/2dmyoica-full.cc b/src/2dmyoica-full.cc
index 72adefe..2d9a057 100644
--- a/src/2dmyoica-full.cc
+++ b/src/2dmyoica-full.cc
@@ -216,7 +216,8 @@ void run_registration_pass(CSegSetWithImages& input_set,
void run_nonlinear_registration_passes (CSegSetWithImages& input_set,
C2DImageSeries& references,
- int skip_images, int components, bool normalize, bool no_meanstrip, int max_ica_iterations,
+ int components, bool normalize, bool no_meanstrip, int max_ica_iterations,
+ int skip_images,
const string& minimizer,
size_t mg_levels, double c_rate, double c_rate_divider,
double divcurlweight, double divcurlweight_divider,
@@ -616,7 +617,7 @@ int do_main( int argc, char *argv[] )
}
run_nonlinear_registration_passes (input_set, references,
- components, normalize, no_meanstrip, max_ica_iterations,
+ components, normalize, no_meanstrip, max_ica_iterations,
skip_images, nonlinear_minimizer,
mg_levels, c_rate, c_rate_divider,
divcurlweight, divcurlweight_divider,
diff --git a/src/2dsegment-ahmed.cc b/src/2dsegment-ahmed.cc
index bb48b7b..ec86988 100644
--- a/src/2dsegment-ahmed.cc
+++ b/src/2dsegment-ahmed.cc
@@ -182,7 +182,7 @@ CSegment2d::result_type CSegment2d::operator()(const T2DImage<T>& image)
THistogram<THistogramFeeder<T> > histogram(THistogramFeeder<T>(_M_minh, _M_maxh, 256));
histogram.push_range(image.begin(), image.end());
- float thresh = (image.size() - histogram[0]) / _M_nClasses;
+ float thresh = static_cast<float>(image.size() - histogram[0]) / _M_nClasses;
float hit = 0.0;
size_t i = 1;
float val = _M_minh + step;
diff --git a/src/3dsegment-ahmed.cc b/src/3dsegment-ahmed.cc
index b3bb4d3..0a6853c 100644
--- a/src/3dsegment-ahmed.cc
+++ b/src/3dsegment-ahmed.cc
@@ -182,7 +182,7 @@ CSegment3d::result_type CSegment3d::operator()(const T3DImage<T>& image)
THistogram<THistogramFeeder<T> > histogram(THistogramFeeder<T>(_M_minh, _M_maxh, 256));
histogram.push_range(image.begin(), image.end());
- float thresh = (image.size() - histogram[0]) / _M_nClasses;
+ float thresh = static_cast<float>(image.size() - histogram[0]) / _M_nClasses;
float hit = 0.0;
size_t i = 1;
float val = _M_minh + step;
--
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