
https://svn.lrde.epita.fr/svn/oln/trunk/olena Suitability to d'ornellas pattern in morphological algorithms ----------------- P = Parrallel | S = Sequential | Q = Queued ----------------- erosion/dilatation P S Q conditionnal erosion/dilation P S Q distance transform S Q geodesic distance transform S Q opening/closing P S Q center filter S alternate sequential filtering (ASF) S area opening/closing Q opening/closing/ASF by reconstruction S Q inf/sup -reconstruction S Q regional minima-maxima S Q valley/peak removal S Q minima imposition S Q hole filling S Q edge off S Q opening/closing top-hat S open/close by reconstruction top-hat S Q ultimate erosion S Q morphological skeleton P S Q sup/inf -generating (hit-miss) P thinning/thickening P conditionnal thinning/thickening P SKIZ (SKeleton by Influence Zone) P Watersheds Q Index: ChangeLog from Ugo Jardonnet <ugo.jardonnet@lrde.epita.fr> Add dOrnellas morphological canvas + Reconstruction. * oln/morpho/binary_reconstruction_v0.hh: Remove useless code. * oln/morpho/binary_reconstruction_v2.hh: Impl with canvas reconstruction. * oln/morpho/cc_tarjan_v1.hh: Minor modification. * oln/morpho/binary_reconstruction_v1.hh: Draft sequential canvas. * oln/morpho/cc_tarjan_v3.hh: cc with auxiliary data canvas. * oln/level/apply_local.hh: whitespaces. * oln/canvas/reconstruction.hh: Canvas reconstruction. * oln/canvas/queue_based.hh: dOrnellas canvas. * oln/canvas/sequential.hh: dOrnellas canvas. * oln/canvas/parallel.hh: dOrnellas canvas. * oln/canvas/two_pass_until_stability.hh: Fix. * oln/canvas/two_pass.hh: Remove useless code. canvas/parallel.hh | 25 ++++++- canvas/queue_based.hh | 41 +++++++++--- canvas/reconstruction.hh | 89 ++++++++++++++++++++++++++ canvas/sequential.hh | 96 ++++++++++++++++++++++++++++ canvas/two_pass.hh | 67 ++----------------- canvas/two_pass_until_stability.hh | 29 +++++--- morpho/binary_reconstruction_v0.hh | 27 -------- morpho/binary_reconstruction_v1.hh | 86 +++++++++++++++---------- morpho/binary_reconstruction_v2.hh | 124 +++++++++++++++++++++++++++++++++++++ morpho/cc_tarjan_v1.hh | 3 morpho/cc_tarjan_v3.hh | 94 +++++++++++++++------------- 11 files changed, 495 insertions(+), 186 deletions(-) Index: oln/morpho/binary_reconstruction_v0.hh --- oln/morpho/binary_reconstruction_v0.hh (revision 976) +++ oln/morpho/binary_reconstruction_v0.hh (working copy) @@ -55,29 +55,6 @@ template <typename I, typename J> oln_plain(I) - binary_reconstruction_loop(const Image_with_Nbh<I>& marker, - const Binary_Image<J>& mask) - { - oln_plain(I) output; - prepare(output, with, marker); - - accumulator::max_<oln_value(I)> max; - - // first pass - oln_fwd_piter(I) p(marker.points()); - for_all(p) - output(p) = level::local_sup(max, marker, p) and mask(p); - - // second pass - oln_bkd_piter(I) p2(marker.points()); - for_all(p2) - output(p2) = level::local_inf(max, marker, p2) and mask(p2); - - return output; - } - - template <typename I , typename J> - oln_plain(I) binary_reconstruction_(const Image_with_Nbh<I>& marker, const Binary_Image<J>& mask) { @@ -108,11 +85,11 @@ } // end of namespace oln::morpho::impl template <typename I , typename J> - void + oln_plain(I) binary_reconstruction(Binary_Image<I>& marker, const Binary_Image<J>& mask) { - impl::binary_reconstruction_(marker + c4, mask); + return impl::binary_reconstruction_(marker + c4, mask); } # endif // ! OLN_INCLUDE_ONLY Index: oln/morpho/binary_reconstruction_v2.hh --- oln/morpho/binary_reconstruction_v2.hh (revision 0) +++ oln/morpho/binary_reconstruction_v2.hh (revision 0) @@ -0,0 +1,124 @@ +// Copyright (C) 2007 EPITA Research and Development Laboratory +// Copyright (C) 2007 EPITA Research and Development Laboratory +// +// This file is part of the Olena Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License version 2 as published by the +// Free Software Foundation. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 51 Franklin Street, Fifth Floor, +// Boston, MA 02111-1307, USA. +// +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +#ifndef OLN_MORPHO_BINARY_RECONSTRUCTION_HH +# define OLN_MORPHO_BINARY_RECONSTRUCTION_HH + +# include <oln/core/concept/image.hh> +# include <oln/accumulator/max.hh> +# include <oln/level/clone.hh> +# include <oln/level/fill.hh> +# include <oln/level/compare.hh> +# include <oln/level/local_inf.hh> +# include <oln/level/local_sup.hh> +# include <oln/core/internal/f_ch_value.hh> // FIXME : could be auto + // included ? + +# include <oln/canvas/reconstruction.hh> + +namespace oln +{ + + namespace morpho + { + + template <typename I , typename J> + oln_plain(I) + binary_reconstruction(const Image_with_Nbh<I>& marker, + const Binary_Image<J>& mask); + +# ifndef OLN_INCLUDE_ONLY + + namespace impl + { + + template <typename I, typename J> + struct binary_reconstruction_ + { + typedef I Ima; + const I& marker; + const J& mask; + I output, memo; + + accumulator::max_<oln_value(I)> accu; + + binary_reconstruction_(const Binary_Image<I>& marker, + const J& mask) + : marker(exact(marker)), mask(mask) + { + } + + void init() + { + } + + bool condition_fwd(const oln_point(I) p) + { + return mask(p); + } + + bool condition_bkd(const oln_point(I)& p) + { + return mask(p); + } + + bool is_stable() + { + return output == memo; + } + + void re_loop() + { + } + + void final() + { + } + + }; + + } // end of namespace oln::morpho::impl + + template <typename I , typename J> + oln_plain(I) + binary_reconstruction(const Image_with_Nbh<I>& marker, + const Binary_Image<J>& mask) + { + impl::binary_reconstruction_<I,J> run(exact(marker), exact(mask)); + canvas::reconstruction(run); + return run.output; + } + +# endif // ! OLN_INCLUDE_ONLY + + } // end of namespace oln::morpho + +} // end of namespace oln + + +#endif // ! OLN_MORPHO_BINARY_RECONSTRUCTION_HH Index: oln/morpho/cc_tarjan_v1.hh --- oln/morpho/cc_tarjan_v1.hh (revision 976) +++ oln/morpho/cc_tarjan_v1.hh (working copy) @@ -29,7 +29,6 @@ # define OLN_MORPHO_CC_TARJAN_HH # include <oln/core/concept/image.hh> - # include <oln/canvas/two_pass.hh> # include <oln/level/fill.hh> # include <oln/core/internal/f_ch_value.hh> @@ -143,9 +142,7 @@ cc_tarjan(const Image_with_Nbh<I>& f, unsigned& nlabels) { impl::cc_tarjan_<I> run(exact(f)); - std::cout << run.output.is_empty() << std::endl; canvas::v1::two_pass(run); - std::cout << run.output.is_empty() << std::endl; nlabels = run.nlabels; oln_plain_value(I, unsigned) tmp = run.output; return tmp; Index: oln/morpho/binary_reconstruction_v1.hh --- oln/morpho/binary_reconstruction_v1.hh (revision 976) +++ oln/morpho/binary_reconstruction_v1.hh (working copy) @@ -1,4 +1,5 @@ // Copyright (C) 2007 EPITA Research and Development Laboratory +// Copyright (C) 2007 EPITA Research and Development Laboratory // // This file is part of the Olena Library. This library is free // software; you can redistribute it and/or modify it under the terms @@ -32,8 +33,12 @@ # include <oln/accumulator/max.hh> # include <oln/level/clone.hh> # include <oln/level/fill.hh> +# include <oln/level/compare.hh> # include <oln/level/local_inf.hh> # include <oln/level/local_sup.hh> +# include <oln/core/internal/f_ch_value.hh> // FIXME : could be auto + // included ? + namespace oln { @@ -52,61 +57,72 @@ { template <typename I> - bool - stability(const Image_with_Nbh<I>& marker, - oln_plain(I)& tmp) - { - oln_piter(I) p(marker.points()); - for_all(p) - if (marker(p) != tmp(p)) - return false; - return true; - } + struct binary_reconstruction_ + { + accumulator::max_<oln_value(I)> accu; - template <typename I, typename J> - oln_plain(I) - binary_reconstruction_loop(const Image_with_Nbh<I>& marker, - const Binary_Image<J>& mask) + oln_plain(I) output, memo; + const I& f; + + binary_reconstruction_(const I& f) + : f(f) { - oln_plain(I) output; - prepare(output, with, marker); + } - accumulator::max_<oln_value(I)> max; + void init() + { + prepare(output, with, f); + output = level::clone(marker); + } - // first pass - oln_fwd_piter(I) p(marker.points()); - for_all(p) - output(p) = level::local_sup(max, marker, p) and mask(p); + void forward_scan(const oln_point(I)& p, + const oln_point(I)& n) + { + accu(fun.f(n)); + } - // second pass - oln_bkd_piter(I) p2(marker.points()); - for_all(p2) - output(p2) = level::local_inf(max, marker, p2) and mask(p2); + void backward_scan(const oln_point(I)& p, + const oln_point(I)& n) + { + accu(fun.f(n)); + } - return output; } template <typename I , typename J> - void // FIXME : Slow impl. + oln_plain(I) binary_reconstruction_(const Image_with_Nbh<I>& marker, const Binary_Image<J>& mask) { - oln_plain(I) tmp = level::clone(marker); + accumulator::max_<oln_value(I)> max; + oln_plain(I) + output = level::clone(marker), + memo; - while ( not stability(marker, tmp) ) + do { - level::fill(inplace(exact(marker).image()), tmp); - tmp = binary_reconstruction_loop(marker, mask); - } + memo = level::clone(output); + + // first pass + oln_fwd_piter(I) p1(marker.points()); + for_all(p1) + output(p1) = level::local_sup(max, output, p1) and mask(p1); - level::fill(inplace(exact(marker).image()), tmp); + // second pass + oln_bkd_piter(I) p2(marker.points()); + for_all(p2) + output(p2) = level::local_inf(max, output, p2) and mask(p2); + + } while (output != memo); + + return output; } } // end of namespace oln::morpho::impl template <typename I , typename J> - void - binary_reconstruction(Binary_Image<I>& marker, + oln_plain(I) + binary_reconstruction(const Binary_Image<I>& marker, const Binary_Image<J>& mask) { impl::binary_reconstruction_(marker + c4, mask); Index: oln/morpho/cc_tarjan_v3.hh --- oln/morpho/cc_tarjan_v3.hh (revision 976) +++ oln/morpho/cc_tarjan_v3.hh (working copy) @@ -29,9 +29,9 @@ # define OLN_MORPHO_CC_TARJAN_HH # include <oln/core/concept/image.hh> - # include <oln/canvas/two_pass.hh> # include <oln/level/fill.hh> +# include <oln/core/internal/f_ch_value.hh> namespace oln { @@ -47,78 +47,87 @@ namespace impl { - template <typename I> - struct cc_tarjan_ + + template <typename T> + struct data_ { - const I& input; - oln_plain_value(I, unsigned) output; + typedef T I; + const I& f; + oln_plain_value(I, unsigned) output; oln_plain(I) is_processed; oln_plain_value(I, oln_point(I)) parent; - cc_tarjan_(const I& in) - : input(in) + data_(const I& f) + : f(f) + { + } + }; + + template <typename Data> + struct cc_tarjan_ + { + cc_tarjan_() { - prepare(is_processed, with, in); - prepare(output, with, in); - prepare(parent, with, in); } - oln_point(I) - find_root(const I& ima, - const oln_point(I)& x, - oln_plain_value(I, oln_point(I))& parent) + oln_point(Data::I) + find_root(Data& data, + const oln_point(Data::I)& x) { - if (parent(x) != x) + if (data.parent(x) != x) { - parent(x) = find_root(ima, parent(x), parent); - return parent(x); + data.parent(x) = find_root(data, data.parent(x)); + return data.parent(x); } return x; } void - do_union(const I& ima, - const oln_point(I)& n, - const oln_point(I)& p, - oln_plain_value(I, oln_point(I))& parent) + do_union(Data& data, + const oln_point(Data::I)& n, + const oln_point(Data::I)& p) { - oln_point(I) r = find_root(ima, n, parent); + oln_point(Data::I) r = find_root(data, n); if (r != p) - parent(r) = p; + data.parent(r) = p; } - void init() + void init(Data& data) { - level::fill(inplace(is_processed), false); + prepare(data.is_processed, with, data.f); + prepare(data.output, with, data.f); + prepare(data.parent, with, data.f); + level::fill(inplace(data.is_processed), false); } - void first_pass_body(const oln_point(I)& p) + void first_pass_body(const oln_point(Data::I)& p, + Data& data) { - parent(p) = p; - if ( input(p) ) + data.parent(p) = p; + if ( data.f(p) ) { - oln_niter(I) n(input, p); + oln_niter(Data::I) n(data.f, p); for_all(n) { - if ( input(n) == true and is_processed(n) ) - do_union(input, n, p, parent); + if ( data.f(n) == true and data.is_processed(n) ) + do_union(data, n, p); } - is_processed(p) = true; + data.is_processed(p) = true; } - } - void second_pass_body(const oln_point(I)& p) + void second_pass_body(const oln_point(Data::I)& p, + Data& data) { unsigned current_label = 0; - if ( input(p) == true and parent(p) == p ) - output(p) = ++current_label; + if ( data.f(p) == true and data.parent(p) == p ) + data.output(p) = ++current_label; else - output(p) = output(parent(p)); + data.output(p) = data.output(data.parent(p)); } - void final() + void final(Data&) { } @@ -132,9 +141,12 @@ oln_plain_value(I, unsigned) cc_tarjan(const Image_with_Nbh<I>& input) { - impl::cc_tarjan_<I> f(exact(input)); - canvas::v1::two_pass(f); - return f.output; + typedef impl::data_<I> data_t; + + data_t data(exact(input)); + impl::cc_tarjan_< impl::data_<I> > f; + canvas::v3::two_pass(f, data); + return data.output; } # endif // ! OLN_INCLUDE_ONLY Index: oln/level/apply_local.hh Index: oln/canvas/reconstruction.hh --- oln/canvas/reconstruction.hh (revision 0) +++ oln/canvas/reconstruction.hh (revision 0) @@ -0,0 +1,89 @@ +// Copyright (C) 2007 EPITA Research and Development Laboratory +// +// This file is part of the Olena Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License version 2 as published by the +// Free Software Foundation. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have receiv a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 51 Franklin Street, Fifth Floor, +// Boston, MA 02111-1307, USA. +// +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +#ifndef OLN_CANVAS_RECONSTRUCTION_HH +# define OLN_CANVAS_RECONSTRUCTION_HH + +# include <oln/level/clone.hh> +# include <oln/level/local_sup.hh> +# include <oln/level/local_inf.hh> + +// FIXME : similar to two_pass_until_stability + +namespace oln +{ + + namespace canvas + { + + template <typename F> + void reconstruction(F& fun) + { + typedef typename F::Ima I; + + bool stability; + fun.output = level::clone(fun.marker); + + fun.init(); + + do + { + fun.memo = level::clone(fun.output); + + // Forward Scan + oln_fwd_piter(I) p1(fun.marker.points()); + for_all(p1) + { + if ( fun.condition_fwd(p1) ) + fun.output(p1) = level::local_sup(fun.accu, fun.output, p1); + } + + // Backward Scan + oln_bkd_piter(I) p2(fun.marker.points()); + for_all(p2) + { + if ( fun.condition_bkd(p2) ) + fun.output(p2) = level::local_sup(fun.accu, fun.output, p2); + } + + // stability check + stability = fun.is_stable(); + if (stability) + break; + + // prepare a new loop iteration + fun.re_loop(); + } while (true); + + fun.final(); + } + + } // end of namespace canva + +} // end of namespace oln + +#endif // ! OLN_CANVAS_RECONSTRUCTION_HH Index: oln/canvas/queue_based.hh --- oln/canvas/queue_based.hh (revision 976) +++ oln/canvas/queue_based.hh (working copy) @@ -28,27 +28,48 @@ #ifndef OLN_CANVAS_QUEUE_BASED_HH # define OLN_CANVAS_QUEUE_BASED_HH +namespace oln +{ + namespace canvas { - template <typename F, typename I> - void queue_based(F f, I input) + template <template <class> class F, + typename I, typename Queue> + void queue_based(F<I>& fun) { - queue q; + Queue q; - f.init(input); + fun.init(); - oln_piter(I) p1(input.points()); + // initialization + oln_piter(I) p1(fun.f.points()); for_all(p1) - f.enqueue(p1, q, input); + if ( fun.condition1() ) // FIXME : part of the canvas or not ? + q.enqueue(p1); - while ( !q.empty() ) do + // Data-driven Propagation + oln_piter(I) p; + while ( !q.empty() ) + { + p = q.deq(); + oln_niter(I) n(fun.f, p); + for_all(n) + { + if ( fun.condition2(p, n) ) { - oln_piter(I) p = q.deq(); - f.loop(p, input); + fun.process(p, n); + // region settings + q.enqueue(n); + } + } } - f.final(input); + fun.final(); } + } // end of namespace canvas + +} // end of namespace oln + #endif // ! OLN_CANVAS_QUEUE_BASED_HH Index: oln/canvas/sequential.hh --- oln/canvas/sequential.hh (revision 0) +++ oln/canvas/sequential.hh (revision 0) @@ -0,0 +1,96 @@ +// Copyright (C) 2007 EPITA Research and Development Laboratory +// +// This file is part of the Olena Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License version 2 as published by the +// Free Software Foundation. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have receiv a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 51 Franklin Street, Fifth Floor, +// Boston, MA 02111-1307, USA. +// +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +#ifndef OLN_CANVAS_SEQUENTIAL_HH +# define OLN_CANVAS_SEQUENTIAL_HH + +// FIXME : similar to two_pass_until_stability + +namespace oln +{ + + namespace canvas + { + + template <template <class> class F, + typename I> + void sequential(F<I>& fun) + { + bool stability; + + fun.init(); + + for (;;) + { + + // Forward Scan + oln_fwd_piter(I) p1(fun.f.points()); + oln_niter(I) n1(fun.f, p1); + for_all(p1) + { + fun.accu.init_with( fun.f(p1) ); + for_all(n1) + { + if (n1 < p1) + fun.forward_scan(p1, n1); + } + fun.output(p1) = fun.accu.value(); + //fun.accu.reload(); // FIXME : need reload + } + + // Backward Scan + oln_bkd_piter(I) p2(fun.f.points()); + oln_niter(I) n2(fun.f, p2); + for_all(p2) + { + fun.accu.init_with(fun.f(p2)); + for_all(n2) + { + if (n2 >= p2) + fun.backward_scan(p2, n2); + } + fun.output(p2) = fun.accu.value(); + //fun.accu.reload(); + } + + // stability check + stability = fun.is_stable(); + if (stability) + break; + + // prepare a new loop iteration + fun.re_loop(); + } + + fun.final(); + } + + } // end of namespace canva + +} // end of namespace oln + +#endif // ! OLN_CANVAS_SEQUENTIAL_HH Index: oln/canvas/parallel.hh --- oln/canvas/parallel.hh (revision 976) +++ oln/canvas/parallel.hh (working copy) @@ -28,15 +28,36 @@ #ifndef OLN_CANVAS_PARALLEL_HH # define OLN_CANVAS_PARALLEL_HH +// FIXME : ~~same code as apply_local + +namespace oln +{ + namespace canvas { - template <typename F, typename I> - void parallel(F f, I input) + template <template <class> class F, + typename I> + void parallel(F<I>& fun) { + fun.init(); + oln_piter(I) p(fun.f.points()); + oln_niter(I) n(fun.f, p); + for_all(p) + { + for_all(n) + { + fun.process(p, n); } + } + + fun.final(); } + } // end of namespace canvas + +} // end of namespace oln + #endif // ! OLN_CANVAS_PARALLEL_HH Index: oln/canvas/two_pass_until_stability.hh --- oln/canvas/two_pass_until_stability.hh (revision 976) +++ oln/canvas/two_pass_until_stability.hh (working copy) @@ -28,42 +28,47 @@ #ifndef OLN_CANVAS_TWO_PASS_UNTIL_STABILITY_HH # define OLN_CANVAS_TWO_PASS_UNTIL_STABILITY_HH +namespace oln +{ + namespace canvas { - template <typename F, typename I> - void two_pass_until_stability(F f, I input) + template <template <class> class F, + typename I> + void two_pass_until_stability(F<I>& fun) { bool stability; - f.init(input); + fun.init(); for (;;) { // first pass - oln_fwd_piter(I) p1(input.points()); + oln_fwd_piter(I) p1(fun.f.points()); for_all(p1) - f.first_pass_body(p1, input); + fun.first_pass_body(p1); // second pass - oln_bkd_piter(I) p2(input.points()); + oln_bkd_piter(I) p2(fun.f.points()); for_all(p2) - f.second_pass_body(p2, input); + fun.second_pass_body(p2); // stability check - stability = f.is_stable(input); // Oblige de posseder output. + stability = fun.is_stable(); // Oblige de posseder output. if (stability) - return; + break; // prepare a new loop iteration - f.re_loop(input); + fun.re_loop(input); } - f.final(input); + fun.final(input); } + } // end of namespace canvas -} +} // end of namespace oln #endif // ! OLN_CANVAS_TWO_PASS_UNTIL_STABILITY_HH Index: oln/canvas/two_pass.hh --- oln/canvas/two_pass.hh (revision 976) +++ oln/canvas/two_pass.hh (working copy) @@ -86,24 +86,24 @@ namespace v3 // Auxiliar data given as argument. { - template <typename F, typename I, typename A> - void two_pass(F& fun, I& f, A& aux) + template <typename F, typename D> + void two_pass(F& fun, D& data) { - mlc::assert_< mlc_is_a(I, Image) >::check(); + mlc::assert_< mlc_is_a(typename D::I, Image) >::check(); - f.init(f, aux); + fun.init(data); // first pass - oln_bkd_piter(I) p1(f.points()); + oln_bkd_piter(D::I) p1(data.f.points()); for_all(p1) - f.first_pass_body(p1, f, aux); + fun.first_pass_body(p1, data); // second pass - oln_fwd_piter(I) p2(f.points()); + oln_fwd_piter(D::I) p2(data.f.points()); for_all(p2) - f.second_pass_body(p2, f, aux); + fun.second_pass_body(p2, data); - f.final(f, aux); + fun.final(data); } } @@ -166,55 +166,6 @@ }; } - - namespace v5 - { - template<typename I, typename Exact> - struct two_pass - { - const I& f; - - void init() - { - assert(0 && "'void init()' not implemented."); - } - - void final() - { - assert(0 && "'void final()' not implemented."); - } - - void first_pass_body(const oln_point(I)&) - { - assert(0 && "'void first_pass_body(const oln_point(I)& p)' not implemented."); - } - - void second_pass_body(const oln_point(I)&) - { - assert(0 && "'void second_pass_body(const oln_point(I)& p)' not implemented."); - } - - void run() - { - init(); - - // first pass - oln_bkd_piter(I) p1(f.points()); - for_all(p1) - first_pass_body(p1); - - // second pass - oln_fwd_piter(I) p2(f.points()); - for_all(p2) - second_pass_body(p2); - - typename Exact::final(); - } - - }; - - } // end of namespace v5 - } // end of namespace morpho } // end of namespace oln