Commit cf88d225 authored by Guillaume Lazzara's avatar Guillaume Lazzara
Browse files

Rename point_at_index, delta_index and index_of_point.

	* mln/accu/line.hh,
	* mln/accu/transform_line.hh,
	* mln/border/duplicate.hh,
	* mln/border/fill.hh,
	* mln/convert/to_qimage.hh,
	* mln/core/concept/doc/image_fastest.hh,
	* mln/core/concept/window.hh,
	* mln/core/dpoints_pixter.hh,
	* mln/core/image/image1d.hh,
	* mln/core/image/image2d.hh,
	* mln/core/image/image3d.hh,
	* mln/core/internal/check/image_fastest.hh,
	* mln/core/internal/image_identity.hh,
	* mln/core/internal/pixel_impl.hh,
	* mln/core/pixel.hh,
	* mln/data/fill_with_value.spe.hh,
	* mln/data/memset_.hh,
	* mln/io/magick/load.hh,
	* mln/io/magick/save.hh,
	* mln/labeling/value_and_compute.hh,
	* mln/linear/gaussian_directional_2d.hh,
	* mln/subsampling/antialiased.hh,
	* mln/trait/image/props.hh,
	* mln/transform/internal/closest_point_functor.hh,
	* mln/world/binary_2d/subsample.hh: Rename point_at_index,
	delta_index and index_of_point to point_at_offset, delta_offset
	and offset_of_point.
parent 3a65b8d1
2012-05-11 Guillaume Lazzara <z@lrde.epita.fr>
Rename point_at_index, delta_index and index_of_point.
* mln/accu/line.hh,
* mln/accu/transform_line.hh,
* mln/border/duplicate.hh,
* mln/border/fill.hh,
* mln/convert/to_qimage.hh,
* mln/core/concept/doc/image_fastest.hh,
* mln/core/concept/window.hh,
* mln/core/dpoints_pixter.hh,
* mln/core/image/image1d.hh,
* mln/core/image/image2d.hh,
* mln/core/image/image3d.hh,
* mln/core/internal/check/image_fastest.hh,
* mln/core/internal/image_identity.hh,
* mln/core/internal/pixel_impl.hh,
* mln/core/pixel.hh,
* mln/data/fill_with_value.spe.hh,
* mln/data/memset_.hh,
* mln/io/magick/load.hh,
* mln/io/magick/save.hh,
* mln/labeling/value_and_compute.hh,
* mln/linear/gaussian_directional_2d.hh,
* mln/subsampling/antialiased.hh,
* mln/trait/image/props.hh,
* mln/transform/internal/closest_point_functor.hh,
* mln/world/binary_2d/subsample.hh: Rename point_at_index,
delta_index and index_of_point to point_at_offset, delta_offset
and offset_of_point.
2012-05-10 Guillaume Lazzara <z@lrde.epita.fr>
 
Rely on Argument-Dependent Lookup (ADL) in from_to_ overloads.
// Copyright (C) 2007, 2008, 2009, 2011 EPITA Research and Development
// Laboratory (LRDE)
// Copyright (C) 2007, 2008, 2009, 2011, 2012 EPITA Research and
// Development Laboratory (LRDE)
//
// This file is part of Olena.
//
......@@ -240,7 +240,7 @@ namespace mln
mln_delta(P) dp = literal::zero;
dp[Dir] = 1;
unsigned offset = input.delta_index(dp);
unsigned offset = input.delta_offset(dp);
A a; // Accumulator.
a.init();
......
// Copyright (C) 2008, 2009 EPITA Research and Development Laboratory
// (LRDE)
// Copyright (C) 2008, 2009, 2012 EPITA Research and Development
// Laboratory (LRDE)
//
// This file is part of Olena.
//
......@@ -230,18 +230,18 @@ namespace mln
P p = pmin; // Starting point.
def::coord& p_dir = p[dir];
// Step.
mln_delta(P) dp(literal::zero);
dp[dir] = 1;
int step = input.delta_index(dp);
int step = input.delta_offset(dp);
do
{
// Start the line.
// ---------------
unsigned o_p = input.index_of_point(p);
unsigned o_p = input.offset_of_point(p);
unsigned o_qt = o_p - (length / 2) * step;
unsigned o_qu = o_qt;
a.init();
......@@ -293,7 +293,7 @@ namespace mln
}
} while (p != pmin);
trace::exiting("accu::impl::transform_line_fastest");
return output;
}
......@@ -331,17 +331,17 @@ namespace mln
// Step.
mln_delta(P) dp(literal::zero);
dp[dir] = 1;
int step = input.delta_index(dp);
int step = input.delta_offset(dp);
do
{
// Start the line.
// ---------------
unsigned o_p = input.index_of_point(p);
unsigned o_p = input.offset_of_point(p);
unsigned o_qt = o_p;
unsigned o_qu = o_p;
a.init();
// Causal part.
......@@ -363,7 +363,7 @@ namespace mln
{
a.take(input.element(o_qt));
o_qt += step;
++p_dir;
o_p += step;
output.element(o_p) = a.to_result();
......@@ -397,7 +397,7 @@ namespace mln
{
a.untake(input.element(o_qu));
o_qu += step;
o_p += step;
output.element(o_p) = a.to_result();
}
......@@ -420,7 +420,7 @@ namespace mln
}
} while (p != pmin);
trace::exiting("accu::impl::transform_line_fastest_without_border");
return output;
}
......@@ -534,7 +534,7 @@ namespace mln
A_ a_ = accu::unmeta(exact(a), mln_value(I)());
internal::transform_line_tests(a_, input);
mln_ch_value(I, mln_result(A_)) output;
output = internal::transform_line_dispatch(a_, input, length, dir);
......
// Copyright (C) 2007, 2008, 2009, 2011 EPITA Research and Development
// Laboratory (LRDE)
// Copyright (C) 2007, 2008, 2009, 2011, 2012 EPITA Research and
// Development Laboratory (LRDE)
//
// This file is part of Olena.
//
......@@ -101,7 +101,7 @@ namespace mln
// Duplicate
for_all (pl)
{
st = ima.index_of_point (pl);
st = ima.offset_of_point (pl);
for (unsigned i = 1; i <= border; ++i)
opt::element(ima, st - i) = opt::element(ima, st);
st = st + len_c - 1;
......@@ -152,7 +152,7 @@ namespace mln
// Duplicate
for (unsigned j = 0; j < len_r; ++j)
{
st = ima.index_of_point (pl);
st = ima.offset_of_point (pl);
for (unsigned i = 1; i <= border; ++i)
opt::element(ima, st - i) = opt::element(ima, st);
st = st + len_c - 1;
......
// Copyright (C) 2007, 2008, 2009, 2011 EPITA Research and Development
// Laboratory (LRDE)
// Copyright (C) 2007, 2008, 2009, 2011, 2012 EPITA Research and
// Development Laboratory (LRDE)
//
// This file is part of Olena.
//
......@@ -97,7 +97,7 @@ namespace mln
for_all (pl)
{
unsigned end = ima.index_of_point (pl);
unsigned end = ima.offset_of_point (pl);
if (st < end)
std::memset((void*)&opt::element(ima, st),
*(const int*)(&v),
......@@ -129,7 +129,7 @@ namespace mln
for_all (pl)
{
unsigned end = ima.index_of_point (pl);
unsigned end = ima.offset_of_point (pl);
for (unsigned i = st; i < end; ++i)
opt::element(ima, i) = v;
st = end + len_r;
......
// Copyright (C) 2010 EPITA Research and Development Laboratory (LRDE)
// Copyright (C) 2010, 2012 EPITA Research and Development Laboratory
// (LRDE)
//
// This file is part of Olena.
//
......@@ -97,7 +98,7 @@ namespace mln
# endif // ! QT_VERSION
const mln_value(I)* ptr_ima = &ima(ima.domain().pmin());
unsigned offset = ima.delta_index(dpoint2d(+1, - ncols));
unsigned offset = ima.delta_offset(dpoint2d(+1, - ncols));
// Data is stored as ABGR so we skip the first value which is ignored.
for (unsigned row = 0; row < nrows; ++row, ptr_ima += offset)
......@@ -137,7 +138,7 @@ namespace mln
QImage qima(ncols, nrows, QImage::Format_RGB32);
uchar * ptr_qima = qima.scanLine(0);
const mln_value(I)* ptr_ima = &ima(ima.domain().pmin());
unsigned offset = ima.delta_index(dpoint2d(+1, - ncols));
unsigned offset = ima.delta_offset(dpoint2d(+1, - ncols));
for (unsigned row = 0; row < nrows; ++row, ptr_ima += offset)
{
......@@ -183,7 +184,7 @@ namespace mln
mln::border::resize(ima, 0);
unsigned
offset = ima.delta_index(DP(+1, 0)),
offset = ima.delta_offset(DP(+1, 0)),
line_offset = 0;
QImage qima(ncols, nrows, QImage::Format_RGB888);
......
// Copyright (C) 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE)
// Copyright (C) 2007, 2008, 2009, 2012 EPITA Research and Development
// Laboratory (LRDE)
//
// This file is part of Olena.
//
......@@ -49,7 +50,7 @@ namespace mln
*
* \pre The image has to be initialized.
*/
int delta_index(const dpoint& dp);
int delta_offset(const dpoint& dp);
/*! \brief Give the point at offset \p o.
......@@ -59,12 +60,12 @@ namespace mln
* \pre The image has to be initialized.
* \pre o < nelements()
*/
point point_at_index(unsigned o) const;
point point_at_offset(unsigned o) const;
/*! \brief Give a hook to the value buffer.
*
*
*
*
* \pre The image has to be initialized.
*/
......
......@@ -357,7 +357,7 @@ namespace mln
unsigned n = win.size();
for (unsigned i = 0; i < n; ++i)
arr.append(ima.delta_index(win.dp(i)));
arr.append(ima.delta_offset(win.dp(i)));
return arr;
}
......@@ -380,7 +380,7 @@ namespace mln
for (unsigned i = 0; i < n; ++i)
{
int offset = ima.delta_index(win.dp(i));
int offset = ima.delta_offset(win.dp(i));
if (offset > 0)
arr.append(offset);
}
......@@ -406,7 +406,7 @@ namespace mln
for (unsigned i = 0; i < n; ++i)
{
int offset = ima.delta_index(win.dp(i));
int offset = ima.delta_offset(win.dp(i));
if (offset < 0)
arr.append(offset);
}
......
// Copyright (C) 2007, 2008, 2009, 2011 EPITA Research and Development
// Laboratory (LRDE)
// Copyright (C) 2007, 2008, 2009, 2011, 2012 EPITA Research and
// Development Laboratory (LRDE)
//
// This file is part of Olena.
//
......@@ -270,7 +270,7 @@ namespace mln
dpoints_fwd_pixter<I>::init_(const Dps& dps)
{
for (unsigned i = 0; i < dps.size(); ++i)
offset_.push_back(this->image_.delta_index(dps.dp(i)));
offset_.push_back(this->image_.delta_offset(dps.dp(i)));
// offset_[0] is absolute
// other offsets are relative:
if (dps.size() > 1)
......@@ -381,7 +381,7 @@ namespace mln
dpoints_bkd_pixter<I>::init_(const Dps& dps)
{
for (unsigned i = 0; i < dps.size(); ++i)
offset_.push_back(this->image_.delta_index(dps.dp(i)));
offset_.push_back(this->image_.delta_offset(dps.dp(i)));
// offset_[size() - 1] is absolute
// other offsets are relative:
if (dps.size() > 1)
......
......@@ -189,27 +189,27 @@ namespace mln
// Specific methods:
// -----------------
/// Read-only access to the image value located at (\p index).
const T& at_(def::coord index) const;
/// Read-only access to the image value located at (\p offset).
const T& at_(def::coord offset) const;
/// Read-write access to the image value located at (\p index).
T& at_(def::coord index);
/// Read-write access to the image value located at (\p offset).
T& at_(def::coord offset);
/// Give the number of indexes.
/// Give the number of offsets.
unsigned ninds() const;
/// Fast Image method
// Give the index of a point.
using super_::index_of_point;
// Give the offset of a point.
using super_::offset_of_point;
/// Give the offset corresponding to the delta-point \p dp.
int delta_index(const dpoint1d& dp) const;
int delta_offset(const dpoint1d& dp) const;
/// Give the point corresponding to the offset \p o.
point1d point_at_index(unsigned i) const;
point1d point_at_offset(unsigned i) const;
/// Give a hook to the value buffer.
const T* buffer() const;
......@@ -450,10 +450,10 @@ namespace mln
template <typename T>
inline
const T&
image1d<T>::at_(def::coord index) const
image1d<T>::at_(def::coord offset) const
{
mln_precondition(this->has(point1d(index)));
return this->data_->array_[index];
mln_precondition(this->has(point1d(offset)));
return this->data_->array_[offset];
}
template <typename T>
......@@ -468,10 +468,10 @@ namespace mln
template <typename T>
inline
T&
image1d<T>::at_(def::coord index)
image1d<T>::at_(def::coord offset)
{
mln_precondition(this->has(point1d(index)));
return this->data_->array_[index];
mln_precondition(this->has(point1d(offset)));
return this->data_->array_[offset];
}
......@@ -514,7 +514,7 @@ namespace mln
template <typename T>
inline
int
image1d<T>::delta_index(const dpoint1d& dp) const
image1d<T>::delta_offset(const dpoint1d& dp) const
{
mln_precondition(this->is_valid());
int o = dp[0];
......@@ -524,7 +524,7 @@ namespace mln
template <typename T>
inline
point1d
image1d<T>::point_at_index(unsigned i) const
image1d<T>::point_at_offset(unsigned i) const
{
mln_precondition(i < nelements());
def::coord ind = static_cast<def::coord>(i + this->data_->vb_.min_ind());
......
// Copyright (C) 2007, 2008, 2009, 2011 EPITA Research and Development
// Laboratory (LRDE)
// Copyright (C) 2007, 2008, 2009, 2011, 2012 EPITA Research and
// Development Laboratory (LRDE)
//
// This file is part of Olena.
//
......@@ -31,9 +31,6 @@
/// Definition of the basic mln::image2d class.
///
/// \todo Re-activate include at EOF when make::image2d is up again.
///
/// \todo Rename delta_index and point_at_index as offset and
/// point_at_offset.
# include <mln/core/internal/image_primary.hh>
# include <mln/core/internal/fixme.hh>
......@@ -226,8 +223,8 @@ namespace mln
// As a fastest image:
// -------------------
// Give the index of a point.
using super_::index_of_point;
// Give the offset of a point.
using super_::offset_of_point;
/// Give the border thickness.
unsigned border() const;
......@@ -235,17 +232,17 @@ namespace mln
/// Give the number of elements (points including border ones).
unsigned nelements() const;
/// Read-only access to the image value located at index \p i.
/// Read-only access to the image value located at offset \p i.
const T& element(unsigned i) const;
/// Read-write access to the image value located at index \p i.
/// Read-write access to the image value located at offset \p i.
T& element(unsigned i);
/// Give the delta-index corresponding to the delta-point \p dp.
int delta_index(const dpoint2d& dp) const;
/// Give the delta-offset corresponding to the delta-point \p dp.
int delta_offset(const dpoint2d& dp) const;
/// Give the point corresponding to the index \p i.
point2d point_at_index(unsigned i) const;
/// Give the point corresponding to the offset \p i.
point2d point_at_offset(unsigned i) const;
/// Give a hook to the value buffer.
const T* buffer() const;
......@@ -571,7 +568,7 @@ namespace mln
template <typename T>
inline
int
image2d<T>::delta_index(const dpoint2d& dp) const
image2d<T>::delta_offset(const dpoint2d& dp) const
{
mln_precondition(this->is_valid());
int o = dp[0] * this->data_->vb_.len(1) + dp[1];
......@@ -581,7 +578,7 @@ namespace mln
template <typename T>
inline
point2d
image2d<T>::point_at_index(unsigned i) const
image2d<T>::point_at_offset(unsigned i) const
{
mln_precondition(i < nelements());
def::coord
......
// Copyright (C) 2007, 2008, 2009, 2010, 2011 EPITA Research and
// Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012 EPITA Research and
// Development Laboratory (LRDE)
//
// This file is part of Olena.
......@@ -163,7 +163,7 @@ namespace mln
/// 3).
image3d(const box3d& b, unsigned bdr = border::thickness);
/// Constructor with the numbers of indexes and the
/// Constructor with the numbers of offsets and the
/// border thickness.
image3d(int nslis, int nrows, int ncols, unsigned bdr = border::thickness);
......@@ -196,10 +196,10 @@ namespace mln
/// Read-write access to the image value located at point \p p.
T& operator()(const point3d& p);
/// Read-only access to the image value located at index \p i.
/// Read-only access to the image value located at offset \p i.
const T& element(unsigned i) const;
/// Read-write access to the image value located at index \p i.
/// Read-write access to the image value located at offset \p i.
T& element(unsigned i);
/// Read-only access to the image value located at (\p sli, \p
......@@ -224,10 +224,10 @@ namespace mln
/// Fast Image method
/// Give the offset corresponding to the delta-point \p dp.
int delta_index(const dpoint3d& dp) const;
int delta_offset(const dpoint3d& dp) const;
/// Give the point corresponding to the offset \p o.
point3d point_at_index(unsigned o) const;
point3d point_at_offset(unsigned o) const;
/// Give a hook to the value buffer.
const T* buffer() const;
......@@ -569,7 +569,7 @@ namespace mln
template <typename T>
inline
int
image3d<T>::delta_index(const dpoint3d& dp) const
image3d<T>::delta_offset(const dpoint3d& dp) const
{
mln_precondition(this->is_valid());
int o = (dp[0] * this->data_->vb_.len(1)
......@@ -580,7 +580,7 @@ namespace mln
template <typename T>
inline
point3d
image3d<T>::point_at_index(unsigned o) const
image3d<T>::point_at_offset(unsigned o) const
{
mln_precondition(o < nelements());
def::coord
......
// Copyright (C) 2007, 2008, 2009, 2011 EPITA Research and Development
// Laboratory (LRDE)
// Copyright (C) 2007, 2008, 2009, 2011, 2012 EPITA Research and
// Development Laboratory (LRDE)
//
// This file is part of Olena.
//
......@@ -32,7 +32,7 @@
/// \brief Class that statically checks the interface of fastest
/// images.
///
/// \todo Check and convert p in index_of_point towards E::psite.
/// \todo Check and convert p in offset_of_point towards E::psite.
# include <mln/metal/bool.hh>
# include <mln/core/macros.hh>
......@@ -62,11 +62,11 @@ namespace mln
/// \warning This method is final.
///
/// \pre The image has to be initialized and to own the point \p p.
/// \post p == point_at_index(result)
/// \post p == point_at_offset(result)
///
template <typename P>
unsigned
index_of_point(const P& p) const;
offset_of_point(const P& p) const;
protected:
image_fastest_();
......@@ -94,9 +94,9 @@ namespace mln
typedef mln_fwd_pixter(E) fwd_pixter;
typedef mln_bkd_pixter(E) bkd_pixter;
int (E::*m1)(const dpsite&) const = & E::delta_index;
int (E::*m1)(const dpsite&) const = & E::delta_offset;
(void) m1;
site (E::*m2)(unsigned) const = & E::point_at_index;
site (E::*m2)(unsigned) const = & E::point_at_offset;
(void) m2;
unsigned (E::*m3)() const = & E::border;
(void) m3;
......@@ -120,7 +120,7 @@ namespace mln
(void) m8;
# if (defined(__GNUC__) && __GNUC__ >= 3) && !defined(__INTEL_COMPILER)
unsigned (E::*m9)(const psite& p) const = & E::index_of_point;
unsigned (E::*m9)(const psite& p) const = & E::offset_of_point;
(void) m9;
# endif
......@@ -131,14 +131,14 @@ namespace mln
template <typename P>
inline
unsigned
image_fastest_<E,B>::index_of_point(const P& p) const
image_fastest_<E,B>::offset_of_point(const P& p) const
{
const E* this_ = & internal::force_exact<E>(*this);
mln_precondition(this_->is_valid());
mln_precondition(this_->has(p));
unsigned i = & this_->operator()(p) - this_->buffer();
mln_postcondition(p == this_->point_at_index(i));
mln_postcondition(p == this_->point_at_offset(i));
return i;
}
......
// Copyright (C) 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE)
// Copyright (C) 2007, 2008, 2009, 2012 EPITA Research and Development
// Laboratory (LRDE)
//
// This file is part of Olena.
//
......@@ -68,14 +69,14 @@ namespace mln
public:
int delta_index(const mln_deduce(I, psite, delta)& dp) const
int delta_offset(const mln_deduce(I, psite, delta)& dp) const
{
return del_().delta_index(dp);
return del_().delta_offset(dp);
}
mln_site(I) point_at_index(unsigned i) const
mln_site(I) point_at_offset(unsigned i) const
{
return del_().point_at_index(i);
return del_().point_at_offset(i);
}
unsigned border() const
......
// Copyright (C) 2007, 2008, 2009, 2010 EPITA Research and Development
// Laboratory (LRDE)
// Copyright (C) 2007, 2008, 2009, 2010, 2012 EPITA Research and
// Development Laboratory (LRDE)
//