Commit f19b924a authored by Roland Levillain's avatar Roland Levillain
Browse files

* oln/core/abstract/image/dimension/1d.hh

	* oln/core/abstract/image/dimension/2d.hh
	* oln/core/abstract/image/dimension/3d.hh
	* oln/core/abstract/image/dimension/hierarchy.hh
	* oln/core/1d/grid1d.hh, oln/core/2d/grid2d.hh,
	* oln/core/3d/grid3d.hh, oln/core/2d/array2d.hh,
	* oln/core/2d/dpoint2d.hh, oln/core/2d/point2d.hh,
	* tests/image1d.cc, tests/image2d.cc, tests/image3d.cc,
	* tests/image_entry.cc, tests/io_pnm.cc, tests/Makefile.am:
	Aesthetic changes.


git-svn-id: https://svn.lrde.epita.fr/svn/oln/trunk@622 4aad255d-cdde-0310-9447-f3009e2ae8c0
parent d6c43300
2006-10-12 Roland Levillain <roland@lrde.epita.fr>
* oln/core/abstract/image/dimension/1d.hh
* oln/core/abstract/image/dimension/2d.hh
* oln/core/abstract/image/dimension/3d.hh
* oln/core/abstract/image/dimension/hierarchy.hh
* oln/core/1d/grid1d.hh, oln/core/2d/grid2d.hh,
* oln/core/3d/grid3d.hh, oln/core/2d/array2d.hh,
* oln/core/2d/dpoint2d.hh, oln/core/2d/point2d.hh,
* tests/image1d.cc, tests/image2d.cc, tests/image3d.cc,
* tests/image_entry.cc, tests/io_pnm.cc, tests/Makefile.am:
Aesthetic changes.
2006-10-12 Roland Levillain <roland@lrde.epita.fr> 2006-10-12 Roland Levillain <roland@lrde.epita.fr>
Add static assertions to oln::topo_bbox_ and oln::topo_lbbox_. Add static assertions to oln::topo_bbox_ and oln::topo_lbbox_.
......
...@@ -48,7 +48,7 @@ namespace oln ...@@ -48,7 +48,7 @@ namespace oln
typedef mlc::uint_<1> dimvalue_type; typedef mlc::uint_<1> dimvalue_type;
}; };
/// A 1-dimension grid. /// A 1D grid.
struct grid1d : public stc_get_supers(grid1d) struct grid1d : public stc_get_supers(grid1d)
{ {
protected: protected:
......
...@@ -43,9 +43,7 @@ namespace oln ...@@ -43,9 +43,7 @@ namespace oln
public: public:
/// Ctor. /// Ctor.
array2d(coord_t imin, coord_t jmin, array2d(coord_t imin, coord_t jmin, coord_t imax, coord_t jmax);
coord_t imax, coord_t jmax);
/// Ctor. /// Ctor.
array2d(coord_t ilen, coord_t jlen); array2d(coord_t ilen, coord_t jlen);
...@@ -53,7 +51,6 @@ namespace oln ...@@ -53,7 +51,6 @@ namespace oln
~array2d(); ~array2d();
value_t operator()(coord_t i, coord_t j) const; value_t operator()(coord_t i, coord_t j) const;
value_t& operator()(coord_t i, coord_t j); value_t& operator()(coord_t i, coord_t j);
bool has(coord_t i, coord_t j) const; bool has(coord_t i, coord_t j) const;
...@@ -70,13 +67,11 @@ namespace oln ...@@ -70,13 +67,11 @@ namespace oln
private: private:
void allocate_(); void allocate_();
void deallocate_(); void deallocate_();
}; };
# ifndef OLN_INCLUDE_ONLY # ifndef OLN_INCLUDE_ONLY
template <typename value_t, typename coord_t> template <typename value_t, typename coord_t>
...@@ -94,7 +89,6 @@ namespace oln ...@@ -94,7 +89,6 @@ namespace oln
} }
template <typename value_t, typename coord_t> template <typename value_t, typename coord_t>
/// Ctor.
array2d<value_t, coord_t>::array2d(coord_t ilen, coord_t jlen) : array2d<value_t, coord_t>::array2d(coord_t ilen, coord_t jlen) :
imin_(0), imin_(0),
jmin_(0), jmin_(0),
...@@ -108,7 +102,6 @@ namespace oln ...@@ -108,7 +102,6 @@ namespace oln
} }
template <typename value_t, typename coord_t> template <typename value_t, typename coord_t>
/// Dtor.
array2d<value_t, coord_t>::~array2d() array2d<value_t, coord_t>::~array2d()
{ {
deallocate_(); deallocate_();
......
...@@ -91,6 +91,7 @@ namespace oln ...@@ -91,6 +91,7 @@ namespace oln
}; };
# ifndef OLN_INCLUDE_ONLY # ifndef OLN_INCLUDE_ONLY
template <typename C> template <typename C>
......
...@@ -48,7 +48,7 @@ namespace oln ...@@ -48,7 +48,7 @@ namespace oln
typedef mlc::uint_<2> dimvalue_type; typedef mlc::uint_<2> dimvalue_type;
}; };
/// A 2-dimension rectangular grid. /// A 2D rectangular grid.
struct grid2d : public stc_get_supers(grid2d) struct grid2d : public stc_get_supers(grid2d)
{ {
protected: protected:
......
...@@ -91,7 +91,7 @@ namespace oln ...@@ -91,7 +91,7 @@ namespace oln
/// Ctor. /// Ctor.
point2d_(const xtd::vec<2,C>& v); point2d_(const xtd::vec<2,C>& v);
///Dtor. /// Dtor.
~point2d_() ~point2d_()
{ {
} }
...@@ -124,22 +124,17 @@ namespace oln ...@@ -124,22 +124,17 @@ namespace oln
{ {
} }
// template <typename C>
// point2d_<C>::~point2d_()
// {
// }
template <typename C> template <typename C>
C point2d_<C>::row() const { return v_[0]; } C point2d_<C>::row() const { return v_[0]; }
template <typename C> template <typename C>
C& point2d_<C>::row() { return v_[0]; } C& point2d_<C>::row() { return v_[0]; }
template <typename C> template <typename C>
C point2d_<C>::col() const { return v_[1]; } C point2d_<C>::col() const { return v_[1]; }
template <typename C> template <typename C>
C& point2d_<C>::col() { return v_[1]; } C& point2d_<C>::col() { return v_[1]; }
# endif # endif
......
...@@ -47,7 +47,7 @@ namespace oln ...@@ -47,7 +47,7 @@ namespace oln
typedef mlc::uint_<3> dimvalue_type; typedef mlc::uint_<3> dimvalue_type;
}; };
/// A 3-dimension cubic grid. /// A 3D cubic grid.
struct grid3d : public stc_get_supers(grid3d) struct grid3d : public stc_get_supers(grid3d)
{ {
protected: protected:
......
...@@ -37,7 +37,7 @@ namespace oln ...@@ -37,7 +37,7 @@ namespace oln
namespace abstract namespace abstract
{ {
/// Class of 1-D images. /// Class of 1D images.
template <typename E> template <typename E>
struct image1d : struct image1d :
public virtual image<E>, public virtual image<E>,
......
...@@ -37,7 +37,7 @@ namespace oln ...@@ -37,7 +37,7 @@ namespace oln
namespace abstract namespace abstract
{ {
/// Class of 2-D images. /// Class of 2D images.
template <typename E> template <typename E>
struct image2d : struct image2d :
public virtual image<E>, public virtual image<E>,
......
...@@ -37,7 +37,7 @@ namespace oln ...@@ -37,7 +37,7 @@ namespace oln
namespace abstract namespace abstract
{ {
/// Class of 3-D images. /// Class of 3D images.
template <typename E> template <typename E>
struct image3d : struct image3d :
public virtual image<E>, public virtual image<E>,
......
...@@ -91,7 +91,7 @@ namespace oln ...@@ -91,7 +91,7 @@ namespace oln
class grid2d; class grid2d;
class grid3d; class grid3d;
/// 1-D case. /// 1D case.
template <typename E> template <typename E>
struct case_< image_hierarchy_wrt_dimension, E, 1 > : struct case_< image_hierarchy_wrt_dimension, E, 1 > :
where_< mlc::eq_< oln_type_of(E, grid), oln::grid1d > > where_< mlc::eq_< oln_type_of(E, grid), oln::grid1d > >
...@@ -99,7 +99,7 @@ namespace oln ...@@ -99,7 +99,7 @@ namespace oln
typedef abstract::image1d<E> ret; typedef abstract::image1d<E> ret;
}; };
/// 2-D case. /// 2D case.
template <typename E> template <typename E>
struct case_< image_hierarchy_wrt_dimension, E, 2 > : struct case_< image_hierarchy_wrt_dimension, E, 2 > :
where_< mlc::eq_< oln_type_of(E, grid), oln::grid2d > > where_< mlc::eq_< oln_type_of(E, grid), oln::grid2d > >
...@@ -107,7 +107,7 @@ namespace oln ...@@ -107,7 +107,7 @@ namespace oln
typedef abstract::image2d<E> ret; typedef abstract::image2d<E> ret;
}; };
/// 3-D case. /// 3D case.
template <typename E> template <typename E>
struct case_< image_hierarchy_wrt_dimension, E, 3 > : struct case_< image_hierarchy_wrt_dimension, E, 3 > :
where_< mlc::eq_< oln_type_of(E, grid), oln::grid3d > > where_< mlc::eq_< oln_type_of(E, grid), oln::grid3d > >
......
...@@ -46,6 +46,9 @@ image3d_SOURCES = image3d.cc ...@@ -46,6 +46,9 @@ image3d_SOURCES = image3d.cc
npoints_SOURCES = npoints.cc npoints_SOURCES = npoints.cc
window2d_SOURCES = window2d.cc window2d_SOURCES = window2d.cc
# I/O.
io_pnm_SOURCES = io_pnm.cc
# Morphers. # Morphers.
identity_morpher_SOURCES = identity_morpher.cc identity_morpher_SOURCES = identity_morpher.cc
add_neighborhood_morpher_SOURCES = add_neighborhood_morpher.cc add_neighborhood_morpher_SOURCES = add_neighborhood_morpher.cc
...@@ -53,7 +56,6 @@ morphers_SOURCES = morphers.cc ...@@ -53,7 +56,6 @@ morphers_SOURCES = morphers.cc
# Algorithms. # Algorithms.
fill_SOURCES = fill.cc fill_SOURCES = fill.cc
io_pnm_SOURCES = io_pnm.cc
TESTS = $(check_PROGRAMS) TESTS = $(check_PROGRAMS)
...@@ -36,18 +36,18 @@ ...@@ -36,18 +36,18 @@
int int
main() main()
{ {
// Fill a 1-d image using its iterator. // Fill a 1D image using its iterator.
oln::image1d<char> ima1(3); oln::image1d<char> ima1(3);
oln_type_of_(oln::image1d<char>, piter) p1(ima1.topo()); oln_type_of_(oln::image1d<char>, piter) p1(ima1.topo());
for_all(p1) for_all(p1)
ima1(p1) = 1; ima1(p1) = 1;
// Fill a 1-d image using a classic loop. // Fill a 1D image using a classic loop.
oln::image1d<int> ima2(ima1.topo()); oln::image1d<int> ima2(ima1.topo());
for (unsigned i = 0; i < 3; ++i) for (unsigned i = 0; i < 3; ++i)
ima2(oln::point1d(i)) = 2; ima2(oln::point1d(i)) = 2;
// Fill a 1-d image using the routine oln::level::fill. // Fill a 1D image using the routine oln::level::fill.
oln::image1d<long> ima3(ima1.topo()); oln::image1d<long> ima3(ima1.topo());
oln::level::fill(ima3, 3); oln::level::fill(ima3, 3);
......
...@@ -36,19 +36,19 @@ ...@@ -36,19 +36,19 @@
int int
main() main()
{ {
// Fill a 2-d image using its iterator. // Fill a 2D image using its iterator.
oln::image2d<char> ima1(3, 3); oln::image2d<char> ima1(3, 3);
oln_type_of_(oln::image2d<char>, piter) p1(ima1.topo()); oln_type_of_(oln::image2d<char>, piter) p1(ima1.topo());
for_all(p1) for_all(p1)
ima1(p1) = 1; ima1(p1) = 1;
// Fill a 2-d image using a classic loop. // Fill a 2D image using a classic loop.
oln::image2d<int> ima2(ima1.topo()); oln::image2d<int> ima2(ima1.topo());
for (unsigned i = 0; i < 3; ++i) for (unsigned i = 0; i < 3; ++i)
for (unsigned j = 0; j < 3; ++j) for (unsigned j = 0; j < 3; ++j)
ima2(oln::point2d(i, j)) = 2; ima2(oln::point2d(i, j)) = 2;
// Fill a 2-d image using the routine oln::level::fill. // Fill a 2D image using the routine oln::level::fill.
oln::image2d<long> ima3(ima1.topo()); oln::image2d<long> ima3(ima1.topo());
oln::level::fill(ima3, 3); oln::level::fill(ima3, 3);
......
...@@ -36,20 +36,20 @@ ...@@ -36,20 +36,20 @@
int int
main() main()
{ {
// Fill a 3-d image using its iterator. // Fill a 3D image using its iterator.
oln::image3d<char> ima1(3, 3, 3); oln::image3d<char> ima1(3, 3, 3);
oln_type_of_(oln::image3d<char>, piter) p1(ima1.topo()); oln_type_of_(oln::image3d<char>, piter) p1(ima1.topo());
for_all(p1) for_all(p1)
ima1(p1) = 1; ima1(p1) = 1;
// Fill a 3-d image using a classic loop. // Fill a 3D image using a classic loop.
oln::image3d<int> ima2(ima1.topo()); oln::image3d<int> ima2(ima1.topo());
for (unsigned i = 0; i < 3; ++i) for (unsigned i = 0; i < 3; ++i)
for (unsigned j = 0; j < 3; ++j) for (unsigned j = 0; j < 3; ++j)
for (unsigned k = 0; k < 3; ++k) for (unsigned k = 0; k < 3; ++k)
ima2(oln::point3d(i, j, k)) = 2; ima2(oln::point3d(i, j, k)) = 2;
// Fill a 3-d image using the routine oln::level::fill. // Fill a 3D image using the routine oln::level::fill.
oln::image3d<long> ima3(ima1.topo()); oln::image3d<long> ima3(ima1.topo());
oln::level::fill(ima3, 3); oln::level::fill(ima3, 3);
......
...@@ -72,7 +72,7 @@ namespace oln ...@@ -72,7 +72,7 @@ namespace oln
namespace my namespace my
{ {
// A very simple 1-D image. // A very simple 1D image.
class image : public oln::get_super_types<my::image>::ret class image : public oln::get_super_types<my::image>::ret
{ {
public: public:
......
...@@ -34,7 +34,6 @@ ...@@ -34,7 +34,6 @@
int int
main() main()
{ {
// Fill a 2-d image using its iterator.
oln::image2d<bool> ima = oln::io::load_pbm("../img/chien.pbm"); oln::image2d<bool> ima = oln::io::load_pbm("../img/chien.pbm");
oln::image2d<unsigned char> ima2 = oln::io::load_pgm("../img/lena32.pgm"); oln::image2d<unsigned char> ima2 = oln::io::load_pgm("../img/lena32.pgm");
} }
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment