Le but est de permettre l'utilisation des types builtin du langage
quand c'est possible (on n'a pas envie de transformer explicitement
une valeur en int_u8 avant de l'affecter à une image).
Exemple pour une image de int_u8 en ruby:
ima = Image2d_u8.new(5, 5)
ima[2, 2] = 12
print ima[2, 2]
print ima[2, 2] + 5
ima_erosion = erosion(ima, win_c4p())
Les checks de ranges sont fait implicitement en c++, au moment de la
conversion en int_u8.
Index: olena/ChangeLog
from Nicolas Burrus <burrus_n(a)lrde.epita.fr>
* oln/io/readable.hh: Add default constructors for SWIG.
+2003-10-09 Nicolas Burrus <burrus_n(a)lrde.epita.fr>
+
* oln/utils/histogram.hh: Temporary fix for ntg::bin type.
2003-10-08 Nicolas Burrus <burrus_n(a)lrde.epita.fr>
Index: tools/swilena/ChangeLog
from Nicolas Burrus <burrus_n(a)lrde.epita.fr>
* meta/swilena_ntg.i: Use builtin value type when possible. Define
int_u8 and int_s8. Remove obsolete typemaps.
* generate_morpho_instantiations.py (write_algorithms): Add int_u8
and int_s8. Enable algorithms fixed by previous patches.
* meta/swilena_image.i: Cleanup. Use builtin value type instead of real
data type when possible.
* expand.sh: Adjust consequently.
* ruby/tests/simple1.rb: Adjust consequently.
* python/tests/simple1.py: Adjust consequently.
* doc/examples/ruby/simple.rb: Adjust consequently.
* doc/examples/python/simple.py: Adjust consequently.
Index: olena/oln/io/readable.hh
--- olena/oln/io/readable.hh Thu, 07 Aug 2003 02:37:23 +0200 burrus_n (oln/b/13_readable.h
1.11 640)
+++ olena/oln/io/readable.hh Thu, 09 Oct 2003 00:37:39 +0200 burrus_n (oln/b/13_readable.h
1.11 640)
@@ -46,6 +46,10 @@
class anything
{
public:
+ // FIXME: these constructors are required by swig
+ anything() : str_() {}
+ anything(const anything& rhs) : str_(rhs.str_) {}
+
anything(const std::string& str) : str_(str) {}
anything(const char* c) : str_(c) {}
Index: tools/swilena/expand.sh
--- tools/swilena/expand.sh Sat, 27 Sep 2003 19:02:23 +0200 burrus_n (oln/s/25_expand.sh
1.10 750)
+++ tools/swilena/expand.sh Thu, 09 Oct 2003 00:37:39 +0200 burrus_n (oln/s/25_expand.sh
1.10 750)
@@ -36,10 +36,12 @@
# int_u8s int_u16s int_u32s
# float_s rgb_8 rgb_16 rgb_32
cat >> "$SWILENA/src/swilena_image${dim}d.i" <<EOF
-make_image(image${dim}d_bin, $dim, ntg_bin)
-make_image(image${dim}d_uint, $dim, ntg_uint)
-make_image(image${dim}d_sint, $dim, ntg_sint)
-make_image(image${dim}d_float, $dim, ntg_float)
+make_image(image${dim}d_bin, $dim, ntg_bin, ntg_bin_value)
+make_image(image${dim}d_u8, $dim, ntg_int_u8, ntg_int_u8_value)
+make_image(image${dim}d_u32, $dim, ntg_int_u32, ntg_int_u32_value)
+make_image(image${dim}d_s8, $dim, ntg_int_s8, ntg_int_s8_value)
+make_image(image${dim}d_s32, $dim, ntg_int_s32, ntg_int_s32_value)
+make_image(image${dim}d_float, $dim, ntg_float, ntg_float_value)
EOF
## Morpho algorithms
MODULES="$MODULES morpho${dim}d"
Index: tools/swilena/meta/swilena_ntg.i
--- tools/swilena/meta/swilena_ntg.i Sun, 28 Sep 2003 22:01:27 +0200 burrus_n
(oln/s/33_swilena_nt 1.5 640)
+++ tools/swilena/meta/swilena_ntg.i Thu, 09 Oct 2003 15:38:43 +0200 burrus_n
(oln/s/33_swilena_nt 1.5 640)
@@ -3,6 +3,9 @@
/***** Generic class declaration for scalars ******/
+
+/* Predecls */
+
%define decl_scalar_class(Ns, Name, ValueType)
template<unsigned nbits, typename behavior>
class Name
@@ -18,23 +21,23 @@
{ *self = Ns::Name<nbits, behavior>(x); }
#if defined(SWIGPYTHON) || defined(SWIGRUBY)
- Ns::Name<nbits, behavior> operator+ (const Ns::Name<nbits, behavior>&
other) const { return (*self) + other; }
- Ns::Name<nbits, behavior> operator- (const Ns::Name<nbits, behavior>&
other) const { return (*self) - other; }
- Ns::Name<nbits, behavior> operator* (const Ns::Name<nbits, behavior>&
other) const { return (*self) * other; }
- Ns::Name<nbits, behavior> operator/ (const Ns::Name<nbits, behavior>&
other) const { return (*self) / other; }
- Ns::Name<nbits, behavior> operator+ (ValueType other) const { return (*self) +
other; }
- Ns::Name<nbits, behavior> operator- (ValueType other) const { return (*self) -
other; }
- Ns::Name<nbits, behavior> operator* (ValueType other) const { return (*self) *
other; }
- Ns::Name<nbits, behavior> operator/ (ValueType other) const { return (*self) /
other; }
+ ValueType operator+ (const Ns::Name<nbits, behavior>& other) const { return
(*self) + other; }
+ ValueType operator- (const Ns::Name<nbits, behavior>& other) const { return
(*self) - other; }
+ ValueType operator* (const Ns::Name<nbits, behavior>& other) const { return
(*self) * other; }
+ ValueType operator/ (const Ns::Name<nbits, behavior>& other) const { return
(*self) / other; }
+ ValueType operator+ (ValueType other) const { return (*self) + other; }
+ ValueType operator- (ValueType other) const { return (*self) - other; }
+ ValueType operator* (ValueType other) const { return (*self) * other; }
+ ValueType operator/ (ValueType other) const { return (*self) / other; }
#else
- Ns::Name<nbits, behavior> add (const Ns::Name<nbits, behavior>&
other) const { return (*self) + other; }
- Ns::Name<nbits, behavior> sub (const Ns::Name<nbits, behavior>&
other) const { return (*self) - other; }
- Ns::Name<nbits, behavior> mul (const Ns::Name<nbits, behavior>&
other) const { return (*self) * other; }
- Ns::Name<nbits, behavior> div (const Ns::Name<nbits, behavior>&
other) const { return (*self) / other; }
- Ns::Name<nbits, behavior> add (ValueType other) const { return (*self) + other;
}
- Ns::Name<nbits, behavior> sub (ValueType other) const { return (*self) - other;
}
- Ns::Name<nbits, behavior> mul (ValueType other) const { return (*self) * other;
}
- Ns::Name<nbits, behavior> div (ValueType other) const { return (*self) / other;
}
+ ValueType add (const Ns::Name<nbits, behavior>& other) const { return
(*self) + other; }
+ ValueType sub (const Ns::Name<nbits, behavior>& other) const { return
(*self) - other; }
+ ValueType mul (const Ns::Name<nbits, behavior>& other) const { return
(*self) * other; }
+ ValueType div (const Ns::Name<nbits, behavior>& other) const { return
(*self) / other; }
+ ValueType add (ValueType other) const { return (*self) + other; }
+ ValueType sub (ValueType other) const { return (*self) - other; }
+ ValueType mul (ValueType other) const { return (*self) * other; }
+ ValueType div (ValueType other) const { return (*self) / other; }
#endif
#if defined(SWIGPYTHON)
@@ -110,12 +113,12 @@
{ *self = Ns::Name(x); }
#if defined(SWIGPYTHON)
- Ns::Name operator| (const Ns::Name& other) const { return (*self) | other; }
- Ns::Name operator| (ValueType other) const { return (*self) | other; }
- Ns::Name operator& (const Ns::Name& other) const { return (*self) &
other; }
- Ns::Name operator& (ValueType other) const { return (*self) & other; }
- Ns::Name operator^ (const Ns::Name& other) const { return (*self) ^ other; }
- Ns::Name operator^ (ValueType other) const { return (*self) ^ other; }
+ ValueType operator| (const Ns::Name& other) const { return (*self) | other; }
+ ValueType operator| (ValueType other) const { return (*self) | other; }
+ ValueType operator& (const Ns::Name& other) const { return (*self) &
other; }
+ ValueType operator& (ValueType other) const { return (*self) & other; }
+ ValueType operator^ (const Ns::Name& other) const { return (*self) ^ other; }
+ ValueType operator^ (ValueType other) const { return (*self) ^ other; }
Ns::Name& operator|= (const Ns::Name& other) { return (*self) |= other; }
Ns::Name& operator|= (ValueType other) { return (*self) |= other; }
Ns::Name& operator&= (const Ns::Name& other) { return (*self) &=
other; }
@@ -129,12 +132,12 @@
bool operator== (ValueType other) const { return (*self) == other; }
bool operator!= (ValueType other) const { return (*self) != other; }
#else
- Ns::Name lor (const Ns::Name& other) const { return (*self) | other; }
- Ns::Name lor (ValueType other) const { return (*self) | other; }
- Ns::Name land (const Ns::Name& other) const { return (*self) & other; }
- Ns::Name land (ValueType other) const { return (*self) & other; }
- Ns::Name lxor (const Ns::Name& other) const { return (*self) ^ other; }
- Ns::Name lxor (ValueType other) const { return (*self) ^ other; }
+ ValueType lor (const Ns::Name& other) const { return (*self) | other; }
+ ValueType lor (ValueType other) const { return (*self) | other; }
+ ValueType land (const Ns::Name& other) const { return (*self) & other; }
+ ValueType land (ValueType other) const { return (*self) & other; }
+ ValueType lxor (const Ns::Name& other) const { return (*self) ^ other; }
+ ValueType lxor (ValueType other) const { return (*self) ^ other; }
Ns::Name& ilor (const Ns::Name& other) { return (*self) |= other; }
Ns::Name& ilor (ValueType other) { return (*self) |= other; }
Ns::Name& iland (const Ns::Name& other) { return (*self) &= other; }
@@ -218,34 +221,36 @@
- if another module use ntg::int_u32, operations on it won't be
possible since this module won't recognize the type ntg::int_u32.
- - ntg::int_u<32, ntg::strict> or ntg_uint should be used
+ - ntg::int_u<32, ntg::strict> or ntg_int_u32 should be used
everywhere. ntg_uint is just a convenient macro.
*/
#define ntg_bin ntg::bin
+#define ntg_bin_value bool
-%template(uint) ntg::int_u< 32, ntg::strict >;
-#define ntg_uint ntg::int_u< 32, ntg::strict >
-
-%template(sint) ntg::int_s< 32, ntg::strict >;
-#define ntg_sint ntg::int_s< 32, ntg::strict >
+%template(int_u32) ntg::int_u< 32, ntg::strict >;
+#define ntg_int_u32 ntg::int_u< 32, ntg::strict >
+#define ntg_int_u32_value unsigned long
+
+%template(int_s32) ntg::int_s< 32, ntg::strict >;
+#define ntg_int_s32 ntg::int_s< 32, ntg::strict >
+#define ntg_int_s32_value long
+
+%template(int_u8) ntg::int_u< 8, ntg::strict >;
+#define ntg_int_u8 ntg::int_u< 8, ntg::strict >
+#define ntg_int_u8_value unsigned long
+
+%template(int_s8) ntg::int_s< 8, ntg::strict >;
+#define ntg_int_s8 ntg::int_s< 8, ntg::strict >
+#define ntg_int_s8_value long
#define ntg_float ntg::float_d
+#define ntg_float_value ntg_float
%template(cplx_rect) ntg::cplx< ntg::rect, ntg_float >;
#define ntg_cplx_rect ntg::cplx< ntg::rect, ntg_float >
+#define ntg_cplx_rect_value ntg_cplx_rect
%template(cplx_polar) ntg::cplx< ntg::polar, ntg_float >;
#define ntg_cplx_polar ntg::cplx< ntg::polar, ntg_float >
-
-#if defined(SWIGPYTHON)
-%typemap(in) ntg_uint {
- $1 = ntg::int_u<32, ntg::strict>(PyLong_AsLong($input));
-}
-%typemap(in) ntg_sint {
- $1 = ntg::int_s<32, ntg::strict>(PyLong_AsLong($input));
-}
-%typemap(in) ntg_bin {
- $1 = ntg::bin(PyInt_AsLong($input));
-}
-#endif
+#define ntg_cplx_polar_value ntg_cplx_polar
Index: tools/swilena/meta/swilena_image.i
--- tools/swilena/meta/swilena_image.i Sun, 28 Sep 2003 22:01:27 +0200 burrus_n
(oln/s/36_swilena_im 1.6 640)
+++ tools/swilena/meta/swilena_image.i Thu, 09 Oct 2003 13:21:32 +0200 burrus_n
(oln/s/36_swilena_im 1.6 640)
@@ -1,18 +1,59 @@
// -*- C++ -*-
-/*----------------------.
-| oln::image structures |
-`----------------------*/
+%define decl_image(Dim)
+%include swilena_describe.i
+%include swilena_core.i
+
+%import swilena_imagesize ## Dim ## d.i
+%import swilena_point ## Dim ## d.i
+
+#if Dim == 1
+%{
+#include <oln/basics1d.hh>
+%}
+#elif Dim == 2
+%{
+#include <oln/basics2d.hh>
+%}
+#elif Dim == 3
+%{
+#include <oln/basics3d.hh>
+%}
+#endif
+
+namespace oln
+{
+ template<typename T>
+ struct image ## Dim ## d;
-%define image_methods(T, Val, Dim)
+ namespace io {
+ namespace internal {
+ struct anything {
+ anything();
+ anything(const anything& rhs);
+ };
+ }
+ ::oln::io::internal::anything load(const char*);
+ }
+}
+%enddef
+%define make_image(Name, Dim, T, ValueType)
+#define I image ## Dim ## d < T >
+
+namespace oln
+{
+
+ template <>
+ struct image ## Dim ## d < T >
+ {
// default constructor
- T();
- T(const image ## Dim ## d_size&);
- T(T& other);
+ I();
+ I(const image ## Dim ## d_size&);
+ I(const oln::io::internal::anything& any);
// operators
- T clone() const;
+ I clone() const;
void clear();
@@ -23,76 +64,77 @@
bool hold(const point ## Dim ## d&) const;
%extend {
-#if defined(SWIGPYTHON) || defined(SWIGRUBY)
- Val __getitem__(const point ## Dim ## d& p)
+
+#if defined SWIGPYTHON || defined SWIGRUBY
+ ValueType __getitem__(const point ## Dim ## d& p)
{ return (*self)[p]; }
- T& __setitem__(const point ## Dim ## d& p, Val v)
+ I& __setitem__(const point ## Dim ## d& p, ValueType v)
{ (*self)[p] = v; return *self; }
#else
- Val at(const point ## Dim ## d& p)
+ ValueType at(const point ## Dim ## d& p)
{ return (*self)[p]; }
- T& set(const point ## Dim ## d& p, Val v)
+ I& set(const point ## Dim ## d& p, ValueType v)
{ (*self)[p] = v; return *self; }
- Val& ref(const point ## Dim ## d& p)
+ T& ref(const point ## Dim ## d& p)
{ return (*self)[p]; }
#endif
}
- EXTEND_DESCRIBE(T)
+ EXTEND_DESCRIBE(I)
#if Dim == 1
- T(coord, coord border = 2);
+ I(coord, coord border = 2);
+
+ T& operator()(coord);
- Val& operator()(coord);
%extend {
-#if defined(SWIGRUBY)
- Val __getitem__(coord x)
+#if defined SWIGRUBY
+ ValueType __getitem__(coord x)
{ return (*self)(x); }
- T __setitem__(coord x, Val v)
+ I __setitem__(coord x, ValueType v)
{ (*self)(x) = v; return *self; }
#else
- Val at(coord x) { return (*self)(x); }
- T& set(coord x, Val v) { (*self)(x) = v; return *self; }
- Val& ref(coord x) { return (*self)(x); }
+ ValueType at(coord x) { return (*self)(x); }
+ I& set(coord x, ValueType v) { (*self)(x) = v; return *self; }
+ T& ref(coord x) { return (*self)(x); }
#endif
}
#elif Dim == 2
- T(coord, coord, coord border = 2);
+ I(coord, coord, coord border = 2);
+
+ T& operator()(coord, coord);
- Val& operator()(coord, coord);
%extend {
-#if defined(SWIGRUBY)
- Val __getitem__(coord x, coord y)
+#if defined SWIGRUBY
+ ValueType __getitem__(coord x, coord y)
{ return (*self)(x, y); }
- T __setitem__(coord x, coord y, Val v)
+ I __setitem__(coord x, coord y, ValueType v)
{ (*self)(x, y) = v; return *self; }
#else
- Val at(coord x, coord y)
- { return (*self)(x, y); }
- T& set(coord x, coord y, Val v)
- { (*self)(x, y) = v; return *self; }
- Val& ref(coord x, coord y)
- { return (*self)(x, y); }
+ ValueType at(coord x, coord y) { return (*self)(x, y); }
+ I& set(coord x, coord y, ValueType v) { (*self)(x, y) = v; return *self; }
+ T& ref(coord x, coord y) { return (*self)(x, y); }
#endif
}
#elif Dim == 3
- T(coord, coord, coord, coord border = 3);
+ I(coord, coord, coord, coord border = 3);
+
+ T& operator()(coord, coord, coord);
- Val& operator()(coord, coord, coord);
%extend {
-#if defined(SWIGRUBY)
- Val __getitem__(coord x, coord y, coord z)
+#if defined SWIGRUBY
+ ValueType __getitem__(coord x, coord y, coord z)
{ return (*self)(x, y, z); }
- T __setitem__(coord x, coord y, coord z, Val v)
+ I __setitem__(coord x, coord y, coord z, ValueType v)
{ (*self)(x, y, z) = v; return *self; }
#else
- Val at(coord x, coord y, coord z)
+ ValueType at(coord x, coord y, coord z)
{ return (*self)(x, y, z); }
- T& set(coord x, coord y, coord z, Val v)
+ I& set(coord x, coord y, coord z, ValueType v)
{ (*self)(x, y, z) = v; return *self; }
- Val& ref(coord x, coord y, coord z)
+ T& ref(coord x, coord y, coord z)
{ return (*self)(x, y, z); }
#endif
}
@@ -108,23 +150,6 @@
coord nslices() const;
#endif
-// border methods
-
-%extend
-{
- // FIXME: borders are in image.
-// void border_set_width(coord new_border, bool copy_border = false)
-// { oln::border::set_width(*self, new_border, copy_border); }
-// void border_adapt_width(coord new_border, bool copy_border = false)
-// { oln::border::adapt_width(*self, new_border, copy_border); }
-// void border_adapt_copy(coord min_border)
-// { oln::border::adapt_copy(*self, min_border); }
-// void border_adapt_mirror(coord min_border)
-// { oln::border::adapt_mirror(*self, min_border); }
-// void border_adapt_assign(coord min_border, Val v)
-// { oln::border::adapt_assign(*self, min_border, v); }
-}
-
// image I/O
#if Dim == 2
@@ -137,41 +162,10 @@
}
#endif
-%enddef
-
-%define decl_image(Dim)
-
-%include swilena_describe.i
-%include swilena_core.i
-
-%import swilena_imagesize ## Dim ## d.i
-%import swilena_point ## Dim ## d.i
-
-#if Dim == 1
-%{
-#include <oln/basics1d.hh>
-%}
-#elif Dim == 2
-%{
-#include <oln/basics2d.hh>
-%}
-#elif Dim == 3
-%{
-#include <oln/basics3d.hh>
-%}
-#endif
-
-namespace oln
-{
- template<typename T>
- struct image ## Dim ## d
- {
- image_methods(image ## Dim ## d<T>, T, Dim)
};
}
-%enddef
+%template(Name) oln::image ## Dim ## d< T >;
-%define make_image(name, Dim, T)
-%template(name) oln::image ## Dim ## d< T >;
+#undef I
%enddef
Index: tools/swilena/python/tests/simple1.py
--- tools/swilena/python/tests/simple1.py Sun, 28 Sep 2003 22:01:27 +0200 burrus_n
(oln/v/16_simple1.py 1.3 700)
+++ tools/swilena/python/tests/simple1.py Thu, 09 Oct 2003 15:40:22 +0200 burrus_n
(oln/v/16_simple1.py 1.3 700)
@@ -7,7 +7,7 @@
imgdir = os.environ['IMGDIR']
-lena = image2d_uint()
+lena = image2d_u8()
lena.load(imgdir + "/lena.pgm")
# FIXME: uncomment when ready
#assert(lena.has_impl())
@@ -15,5 +15,5 @@
lena.set(5, 5, 51)
lena.ref(6, 6).value(42)
-assert(lena.at(5, 5).value() == 51)
-assert(lena.at(6, 6).value() == 42)
+assert(lena.at(5, 5) == 51)
+assert(lena.at(6, 6) == 42)
Index: tools/swilena/ruby/tests/simple1.rb
--- tools/swilena/ruby/tests/simple1.rb Sun, 28 Sep 2003 22:01:27 +0200 burrus_n
(oln/v/19_simple1.rb 1.3 700)
+++ tools/swilena/ruby/tests/simple1.rb Thu, 09 Oct 2003 16:17:57 +0200 burrus_n
(oln/v/19_simple1.rb 1.3 700)
@@ -11,13 +11,12 @@
imgdir = ENV["IMGDIR"]
-lena = Image2d_uint.new
-lena.load(imgdir + "/lena.pgm")
+lena = Image2d_u8.new(load(imgdir + "/lena.pgm"))
# FIXME: uncomment when ready
#exit 1 unless lena.has_impl()
-lena[5, 5] = Uint.new(51)
-lena[6, 6] = Uint.new(42)
+lena[5, 5] = 51
+lena[6, 6] = 42
-exit 1 unless lena[5, 5].value() == 51
-exit 1 unless lena[6, 6].value() == 42
+exit 1 unless lena[5, 5] == 51
+exit 1 unless lena[6, 6] == 42
Index: tools/swilena/doc/examples/ruby/simple.rb
--- tools/swilena/doc/examples/ruby/simple.rb Sun, 28 Sep 2003 22:01:27 +0200 burrus_n
(oln/v/22_simple.rb 1.3 600)
+++ tools/swilena/doc/examples/ruby/simple.rb Thu, 09 Oct 2003 16:18:52 +0200 burrus_n
(oln/v/22_simple.rb 1.3 600)
@@ -15,11 +15,11 @@
display.tmpdir = "/tmp/swilena"
display.display_command = "display %{image_file}"
-ima = Image2d_uint.new(5,5)
+ima = Image2d_u8.new(5,5)
for i in 0..5 do
for j in 0..5 do
- ima[i, j] = Uint.new(i + j)
+ ima[i, j] = i + j
end
end
Index: tools/swilena/doc/examples/python/simple.py
--- tools/swilena/doc/examples/python/simple.py Sun, 28 Sep 2003 22:01:27 +0200 burrus_n
(oln/v/23_simple.py 1.3 600)
+++ tools/swilena/doc/examples/python/simple.py Thu, 09 Oct 2003 15:42:05 +0200 burrus_n
(oln/v/23_simple.py 1.3 600)
@@ -10,8 +10,8 @@
swilena_display.tmpdir = "/tmp/swilena"
swilena_display.display_command = "xv %{image_file}"
-ima = image2d_uint(5,5)
-print ima.at(5,5).value()
+ima = image2d_u8(5,5)
+print ima.at(5,5)
ima.set(2, 2, 2)
print ima
@@ -20,7 +20,7 @@
p.value(3)
print ima
-lena = image2d_uint();
+lena = image2d_u8();
lena.load("lena.pgm")
display_image (ima, "lena")
Index: tools/swilena/generate_morpho_instantiations.py
--- tools/swilena/generate_morpho_instantiations.py Sat, 27 Sep 2003 19:02:23 +0200
burrus_n (oln/v/24_generate_m 1.1 700)
+++ tools/swilena/generate_morpho_instantiations.py Thu, 09 Oct 2003 14:22:05 +0200
burrus_n (oln/v/24_generate_m 1.1 700)
@@ -38,7 +38,10 @@
def write_algorithms():
# Algorithms with all types and all dims
for dim in range(1, 4):
- for type in [ "ntg_bin", "ntg_uint", "ntg_sint",
"ntg_float" ]:
+ for type in [ "ntg_bin",
+ "ntg_int_u8", "ntg_int_u32",
+ "ntg_int_s8", "ntg_int_s32",
+ "ntg_float" ]:
img_type = "::oln::image%(dim)sd< %(type)s >" % vars()
win_type = "::oln::window%(dim)sd" % vars()
neighb_type = "::oln::neighborhood%(dim)sd" % vars()
@@ -86,8 +89,8 @@
instantiate(dim, "hit_or_miss_closing_bg", img_type, img_type, win_type,
win_type)
instantiate(dim, "fast_hit_or_miss_closing_bg", img_type, img_type, win_type,
win_type)
- # FIXME: these algorithms do not work with binary types
- if type != "ntg_bin" and type != "ntg_float":
+ # FIXME: these algorithms do not work with float neither binary types
+ if type != "ntg_bin":
instantiate(dim, "beucher_gradient", img_type, img_type, win_type)
instantiate(dim, "fast_beucher_gradient", img_type, img_type, win_type)
@@ -109,10 +112,10 @@
instantiate(dim, "top_hat_contrast_op", img_type, img_type, win_type)
instantiate(dim, "fast_top_hat_contrast_op", img_type, img_type, win_type)
- # FIXME: watershed only works with ntg_uint
- if type == "ntg_uint":
+ # FIXME: watershed only works with ntg_int_u8
+ if type == "ntg_int_u32":
# Watershed
- img_ret_type = "::oln::image%(dim)sd< ntg_uint >" % vars()
+ img_ret_type = "::oln::image%(dim)sd< ntg_int_u32 >" % vars()
instantiate(dim, "watershed_seg", img_ret_type, img_type, neighb_type)
instantiate(dim, "watershed_con", img_ret_type, img_type, neighb_type)
instantiate(dim, "watershed_seg_or", img_type, img_type, img_ret_type,
neighb_type)