https://svn.lrde.epita.fr/svn/oln/trunk/milena
Index: ChangeLog
from Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
Fix delta_index in image3d.
* mln/core/image/image3d.hh (delta_index): Fix.
* mln/morpho/elementary/gradient.hh
(gradient_on_function): Handle extension.
(todo): Remove; done.
core/image/image3d.hh | 3 ++-
morpho/elementary/gradient.hh | 12 +++++++-----
2 files changed, 9 insertions(+), 6 deletions(-)
Index: mln/core/image/image3d.hh
--- mln/core/image/image3d.hh (revision 3227)
+++ mln/core/image/image3d.hh (working copy)
@@ -560,7 +560,8 @@
image3d<T>::delta_index(const dpoint3d& dp) const
{
mln_precondition(this->is_valid());
- int o = dp[0];
+ int o = (dp[0] * this->data_->vb_.len(1)
+ + dp[1]) * this->data_->vb_.len(2) + dp[2];
return o;
}
Index: mln/morpho/elementary/gradient.hh
--- mln/morpho/elementary/gradient.hh (revision 3227)
+++ mln/morpho/elementary/gradient.hh (working copy)
@@ -32,8 +32,6 @@
/// \file mln/morpho/elementary/gradient.hh
///
/// \todo Add fastest version for sets.
-///
-/// \todo Replace .domain().has() by .has()!
# include <mln/morpho/includes.hh>
# include <mln/accu/min_max.hh>
@@ -87,6 +85,8 @@
accu::min_max<mln_value(I)> a;
+ extension::adjust_duplicate(input, nbh);
+
mln_concrete(I) output;
initialize(output, input);
@@ -95,7 +95,7 @@
for_all(p)
{
a.take_as_init(input(p));
- for_all(n) if (input.domain().has(n))
+ for_all(n) if (input.has(n))
a.take(input(n));
output(p) = a.second() - a.first();
}
@@ -114,6 +114,8 @@
const N& nbh = exact(nbh_);
internal::gradient_tests(input, nbh);
+ extension::adjust_duplicate(input, nbh);
+
mln_concrete(I) output;
initialize(output, input);
data::fill(output, false);
@@ -123,7 +125,7 @@
for_all(p)
if (input(p) == true)
{
- for_all(n) if (input.domain().has(n))
+ for_all(n) if (input.has(n))
if (input(n) == false)
{
output(p) = true;
@@ -132,7 +134,7 @@
}
else // input(p) == false
{
- for_all(n) if (input.domain().has(n))
+ for_all(n) if (input.has(n))
if (input(n) == true)
{
output(p) = true;