* mln/data/stretch.hh: Fix an invalid test.
* mln/data/stretch_inplace.hh: Fix an invalid test and re-indent.
---
milena/ChangeLog | 8 ++++++
milena/mln/data/stretch.hh | 2 +-
milena/mln/data/stretch_inplace.hh | 48 +++++++++++++++++------------------
3 files changed, 32 insertions(+), 26 deletions(-)
diff --git a/milena/ChangeLog b/milena/ChangeLog
index d9a8d2b..6e75bc4 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,3 +1,11 @@
+2013-04-26 Guillaume Lazzara <z(a)lrde.epita.fr>
+
+ Fix an invalid test in data::stretch* routines.
+
+ * mln/data/stretch.hh: Fix an invalid test.
+
+ * mln/data/stretch_inplace.hh: Fix an invalid test and re-indent.
+
2013-04-17 Guillaume Lazzara <z(a)lrde.epita.fr>
Add a labeling routine working on grayscale images.
diff --git a/milena/mln/data/stretch.hh b/milena/mln/data/stretch.hh
index 1738341..e8a6d09 100644
--- a/milena/mln/data/stretch.hh
+++ b/milena/mln/data/stretch.hh
@@ -91,7 +91,7 @@ namespace mln
mln_value(I) min_, max_;
estim::min_max(input, min_, max_);
- if (max_ != min_ && (mln_max(V)>max_ || mln_min(V)>min_))
+ if (max_ != min_ && (mln_max(V) > max_ || mln_min(V) < min_))
{
//FIXME: we would like to use float instead of double but we
//can't for precision reasons. See ticket #179.
diff --git a/milena/mln/data/stretch_inplace.hh b/milena/mln/data/stretch_inplace.hh
index a4579f1..c0630e1 100644
--- a/milena/mln/data/stretch_inplace.hh
+++ b/milena/mln/data/stretch_inplace.hh
@@ -1,5 +1,4 @@
-// Copyright (C) 2013 EPITA Research and
-// Development Laboratory (LRDE)
+// Copyright (C) 2013 EPITA Research and Development Laboratory (LRDE)
//
// This file is part of Olena.
//
@@ -54,7 +53,6 @@ namespace mln
*
* \param[in,out] ima The input image.
*
- *
* \pre input.is_valid
*
* \ingroup mlndata
@@ -67,7 +65,7 @@ namespace mln
* stored inplace.
*
* \param[in,out] ima The input image.
- * \param[out] stretched The image has changed.
+ * \param[out] stretched The image has changed.
*
* \pre input.is_valid
*
@@ -81,19 +79,19 @@ namespace mln
# ifndef MLN_INCLUDE_ONLY
- template <typename I>
- inline
- void
- stretch_inplace(Image<I>& ima, bool& stretched)
+ template <typename I>
+ inline
+ void
+ stretch_inplace(Image<I>& ima, bool& stretched)
+ {
+ mln_trace("data::stretch_inplace");
+ typedef mln_value(I) V;
+ mln_precondition(exact(ima).is_valid());
+
+ V min_, max_;
+ estim::min_max(ima, min_, max_);
+ if (max_ != min_ && (mln_max(V) > max_ || mln_min(V) < min_))
{
- mln_trace("data::stretch_inplace");
- typedef mln_value(I) V;
- mln_precondition(exact(ima).is_valid());
-
- V min_, max_;
- estim::min_max(ima, min_, max_);
- if (max_ != min_ && (mln_max(V)>max_ || mln_min(V)>min_))
- {
//FIXME: we would like to use float instead of double but we
//can't for precision reasons. See ticket #179.
double
@@ -104,16 +102,16 @@ namespace mln
m = 0.0f - 0.5f + epsilon,
a = (M - m) / (max - min),
b = (m * max - M * min) / (max - min);
- fun::v2v::linear_sat<V, double, V> f(a, b);
- data::transform_inplace(ima, f);
- stretched = true;
- }
- else
- {
- stretched = false;
- mln_trace_warning("output has no significative data!");
- }
+ fun::v2v::linear_sat<V, double, V> f(a, b);
+ data::transform_inplace(ima, f);
+ stretched = true;
+ }
+ else
+ {
+ stretched = false;
+ mln_trace_warning("output has no significative data!");
}
+ }
template <typename I>
void
--
1.7.2.5