
Hand-made message, because Vcs wouldn't let me send it for obscure diff reasons. Fix and generate more images for the Applications. * article.sty (areaclosing): New operator. Use it... * article.tex: ..here. (section{Applications}): Simplify the chain. Adjust listing, and show actual code. Add more images. Reorganize. * apps/chain.hh: Move the computation of the gradient out of the chain. * apps/image2d.cc: Adjust. * apps/complex.cc: Start to adjust (unfinished work). * apps/chain.lst: New. * apps/lena-g.png: New. * apps/graph.cc, * apps/graph.neato, apps/graph.pdf, * apps/graph-g.nato, apps/graph-g.pdf, * apps/graph-s.neato, apps/graph-s.pdf: New. * pics/graph.cc: Fix a previous patch by adding a missing #include. * apps/new/: New directory. * apps/new/m283.gcl, apps/new/m283.off, apps/new/m283.png * apps/new/m283-c.gcl, apps/new/m283-c.off, apps/new/m283-c.png * apps/new/m283-s.gcl, apps/new/m283-s.off, apps/new/m283-s.png: New. * Makefile (IMAGES): Add apps/lena-g.png. Move old images... (IMAGES_OLD): ...here (new). (article.pdf): Depend on apps/chain.lst. (apps/graph-s.neato): New target. (%-g.gcl, %-c.gcl): New targets. (%-s.off): Disable target. * apps/old/: New directory. * apps/m283.gcl, apps/m283.off, apps/m283.png, * apps/m283-s.off, apps/m283-s.png: Move... * apps/old/m283.gcl, apps/old/m283.off, apps/old/m283.png, * apps/old/m283-s.off, apps/old/m283-s.png: ...here. Index: article.sty =================================================================== --- article.sty (revision 3417) +++ article.sty (revision 3418) @@ -11,6 +11,7 @@ \RequirePackage{amsopn} \DeclareMathOperator{\attrclosing}{attribute-closing} +\DeclareMathOperator{\areaclosing}{area-closing} \DeclareMathOperator{\gradientnorm}{gradient-norm} \DeclareMathOperator{\wst}{wst} Index: article.tex =================================================================== --- article.tex (revision 3417) +++ article.tex (revision 3418) @@ -782,28 +782,24 @@ \section{Applications} \label{sec:applications} -\fixme{Remove the gradient step: $G$ should be our input.} +In this part, we consider a simple, classical image processing chain +(\autoref{fig:chain-diagram}): from an image $I$ (e.g., the magnitude +of a gradient), compute an area closing $C$ using criterion value +$\lambda$; then, perform a \ac{wst} on $C$ to obtain a segmentation +$S$. -In this part, we consider a simple, classical image processing chain: -from an image $I$, produce an image of the magnitude of the gradient -$G$; then compute an attribute closing $C$ using an attribute $\alpha$ -and a criterion value $\lambda$; last, perform a \ac{wst} on $C$ to -obtain a segmentation $S$. - \begin{figure} \centering \begin{tikzpicture} \tikzstyle{im}=[minimum height=0.6cm] \tikzstyle{op}=[rectangle, minimum height=0.6cm] - \node[im] (i) at ( 0.0,2) {$I$}; - \node[op] (closing) at ( 2.0,2) [draw] {$\gradientnorm$}; - \node[im] (c) at ( 4.0,2) {$G$}; - \node[op] (gradient) at ( 6.5,2) [draw] {$\attrclosing$ $(\alpha, \lambda)$}; - \node[im] (g) at ( 9.0,2) {$C$}; + \node[im] (i) at ( 5.0,2) {$I$}; + \node[op] (closing) at ( 7.0,2) [draw] {$\areaclosing$ $(\lambda)$}; + \node[im] (c) at ( 9.0,2) {$C$}; \node[op] (wst) at (10.0,2) [draw] {$\wst$}; \node[im] (s) at (11.0,2) {$S$}; - \foreach \from/\to in {i/closing,closing/c,c/gradient,gradient/g,g/wst,wst/s} + \foreach \from/\to in {i/closing,closing/c,c/wst,wst/s} \draw[->] (\from) -- (\to); \end{tikzpicture} \caption{A generic morphological image processing chain.} @@ -813,7 +809,7 @@ \fixme{More.} % -------------------------------------------------------------------- -\subsubsection{Implementation in Milena} +\subsection{Implementation in Milena} \label{sec:apps-impl} \fixme{Merge this section into the previous one?} @@ -830,63 +826,38 @@ catchments basins (with the special label `0' for watershed sites).}: % -\fixme{Is the remark on \code{mln\_ch\_value} too much? We could use - an abstract type \code{output} for \code{wst} and mask this - detail.}% +\fixme{Is the remark on \code{mln\_ch\_value} too much? If not, + explain \code{mln\_concrete} as well.}% % -%% Actual Milena code is admittedly different. We should converge -%% toward a unique implementation. -\begin{lstlisting}[% +\lstinputlisting[% mathescape, % Identifiers. emph={[1]c,s,ima,nbh,lambda,nbasins},% emphstyle={[1]\color{darkgreen}\bfseries},% % More types. - morekeywords={[2]image}] - // Compute $G$. - image g = gradient(ima, nbh); - // Compute $C$. - image c = attribute_closing<alpha>(g, nbh, lambda); - // Holds the number of basins (to be computed by the Watershed Transform). - unsigned int nbasins; - // Compute $S$. - mln_ch_value(image, unsigned int) s = wst(c, nbh, nbasins); -\end{lstlisting} + morekeywords={[2]I,N,L}]{apps/chain.lst} -\fixme{The \code{gradient} algorithm might be different according to - the application.} -\fixme{Even if this chain is generic, working on edges requires a - slightly different code!} - -\subsubsection{Regular 2-Dimensional Image} -\label{sec:apps-image2d} - -In the classical regular 2-D image, $\Dom$ is a subset of $\Z$ and is -expressed as a 2-D bounding box. Therefore, the notion of -neighborhood does not depend on the site, and neighbors can be -expressed as a set of vectors. For instance a 4-connectivity -neighborhood is the set of 2-D vectors $\{(-1, 0), (0, -1), (0, 1), (1, - 0) \}$. In Milena, such vectors are called \emph{delta-points}, -since they encode a difference between two sites. \fixme{Careful: point - vs. site (?)} - -\fixme{Continue.} - -\subsubsection{Graph-Based Image} -\label{sec:apps-graph} - -\subsubsection{Simplicial Complex-Based Image} -\label{sec:apps-complex} - \begin{figure} \centering \subfigure[Regular 2-Dimensional Image]{ - \includegraphics[width=0.45\textwidth]{apps/lena} + \includegraphics[width=0.30\textwidth]{apps/lena} \label{fig:chain-images:lena} } + % FIXME: Improve dependencies in Makefile. + % * apps/lena-g.pgm (and then apps/lena-g.png) was generated as a + % side effect of apps/image2d with: + % make apps/lena-s.png + \subfigure[Morphological gradient image of + \ref{fig:chain-images:lena}]{ + \includegraphics[width=0.30\textwidth]{apps/lena-g} + \label{fig:chain-images:lena-g} + } + % * apps/lena-s.png (and then apps/lena-s.png) was generated using + % apps/image2d with: + % make apps/lena-s.png \subfigure[Result of the image processing chain on - \ref{fig:chain-images:lena}]{ - \includegraphics[width=0.45\textwidth]{apps/lena-s} + \ref{fig:chain-images:lena-g}]{ + \includegraphics[width=0.30\textwidth]{apps/lena-s} \label{fig:chain-images:lena-s} } @@ -915,23 +886,90 @@ %% \label{fig:chain-images:m272-pinv-curv-s} %% } - \subfigure[FIXME: Caption.]{ - \fbox{\includegraphics[width=0.45\textwidth]{apps/m283}} + \subfigure[Graph-Based Image]{ + \fbox{\includegraphics[width=0.29\textwidth]{apps/graph}} + \label{fig:chain-images:graph} } - \subfigure[FIXME: Caption.]{ - \fbox{\includegraphics[width=0.45\textwidth]{apps/m283-s}} + % FIXME: Improve dependencies in Makefile. + % * apps/graph-g.neato (and then apps/graph-g.pdf) was generated as + % a side effect of apps/graph with: + % make apps/graph-s.neato + \subfigure[Morphological gradient of \ref{fig:chain-images:graph}]{ + \fbox{\includegraphics[width=0.29\textwidth]{apps/graph-g}} + \label{fig:chain-images:graph-g} } + % * apps/graph-s.png (and then apps/graph-s.png) was generated using + % apps/graph with: + % make apps/graph-s.png + \subfigure[Result of the image processing chain on + \ref{fig:chain-images:graph-g}]{ + \fbox{\includegraphics[width=0.29\textwidth]{apps/graph-s}} + \label{fig:chain-images:graph-s} + } + \subfigure[Simplicial Complex-Based Image]{ + \fbox{\includegraphics[width=0.29\textwidth]{apps/new/m283}} + \label{fig:chain-images:new-m283} + } + % FIXME: Turn this into a Make rule (and break the dependency with + % milena/apps/statues). + % * new/m283-c.off was generated with the (Trimesh-based) command: + % milena/apps/statues/mesh-max-curv m283.off new/m283-c.off + \subfigure[Maximum surface curvature computed on + \ref{fig:chain-images:new-m283}]{ + \fbox{\includegraphics[width=0.29\textwidth]{apps/new/m283-c}} + \label{fig:chain-images:new-m283-c} + } + % FIXME: Turn this into a Make rule (and break the dependency with + % milena/apps/statues). + % * new/m283-s.off generated with the command: + % milena/apps/statues/mesh-complex-segm new/m283-c.off 200 new/m283-s.off + \subfigure[Result of the image processing chain on a gradient image + computed on the edges of \ref{fig:chain-images:new-m283-c}]{ + \fbox{\includegraphics[width=0.29\textwidth]{apps/new/m283-s}} + \label{fig:chain-images:new-m283-s} + } + \caption{Results of the image processing chain from \autoref{fig:chain-diagram} applied to various inputs.} \label{fig:chain-images} \end{figure} -\fixme{Careful, \file{apps/m283-s.png} has been generated using - \file{apps/statues/mesh-complex-max-curv-segm.cc} from Milena.} +% FIXME: Remove these subsections' titles? +% -------------------------------------------------------------------- +\subsection{Regular 2-Dimensional Image} +\label{sec:apps-image2d} +In the classical regular 2-D image, $\Dom$ is a subset of $\Z$ and is +expressed as a 2-D bounding box. Therefore, the notion of +neighborhood does not depend on the site, and neighbors can be +expressed as a set of vectors. For instance a 4-connectivity +neighborhood is the set of 2-D vectors $\{(-1, 0), (0, -1), (0, 1), (1, + 0) \}$. In Milena, such vectors are called \emph{delta-points}, +since they encode a difference between two sites. \fixme{Careful: point + vs. site (?)} + +\fixme{Continue.} + +% -------------------------------------------------------------------- +\subsection{Graph-Based Image} +\label{sec:apps-graph} + +% -------------------------------------------------------------------- +\subsection{Simplicial Complex-Based Image} +\label{sec:apps-complex} + +\fixme[inline]{Explain what a max curvature is.} +\fixme[inline]{Explain why the gradient image is not depicted.} + +\cite{alcoverro.08.3dtv} + +% -------------------------------------------------------------------- +\subsection{Other images and possibilities} +\label{sec:apps-other} + \fixme[inline]{Mention other possibilities: color image + gradient as - distance in a color space, etc.} + distance in a color space, gradient on edges etc.} % ==================================================================== @@ -962,8 +1000,6 @@ \cite{duret.00.gcse} (?) % Other libraries. \cite{yoo.04.book} - % Applications. - \cite{alcoverro.08.3dtv} } Index: apps/m283.gcl =================================================================== --- apps/m283.gcl (revision 3417) +++ apps/m283.gcl (revision 3418) @@ -1,10 +0,0 @@ -(load apps/m283.off geometry) -# `g1' is the first loaded (and sole) object. -(bbox-draw g1 no) -# `c0' is the initial camera. -(backcolor c0 1 1 1) -# `g0' is ``the World''. Rotation is expressed in radians around each axis. -(transform g0 g0 focus rotate 0.0 2.3 0.0) -(zoom c0 1.5) -(snapshot c0 apps/m283.ppm) -(quit) Index: apps/m283-s.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: apps/m283.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: apps/chain.hh =================================================================== --- apps/chain.hh (revision 3417) +++ apps/chain.hh (revision 3418) @@ -1,35 +1,18 @@ -#include <mln/morpho/gradient.hh> -#include <mln/morpho/closing_area.hh> -#include <mln/morpho/meyer_wst.hh> - #ifndef CHAIN_HH # define CHAIN_HH -template <typename I, typename N, typename W, typename L> +#include <mln/morpho/closing_area.hh> +#include <mln/morpho/meyer_wst.hh> + +template <typename I, typename N, typename L> mln_ch_value(I, L) chain(const mln::Image<I>& ima, const mln::Neighborhood<N>& nbh, - const mln::Window<W>& win, unsigned lambda, L& nbasins) + unsigned lambda, L& nbasins) { using namespace mln; - - /* FIXME: Unfortunately, we cannot write - - morpho::gradient(ima, win) - - here, since MM only uses windows (yet?), not neighborhoods. And - we cannot either write - - morpho::gradient(ima, nbh.win()), - - since that window would not contain the center site... - Therefore, this function asks for a window WIN matching the - neighborhood NBH, plus the center site. - - A neighborhood `n' should provide a method `win_p()' returning a - window corresponding to `n' plus the center site. */ - mln_concrete(I) g = morpho::gradient(ima, win); // FIXME: alpha (the criterion) is not changeable here! Change this. - mln_concrete(I) c = morpho::closing_area(g, nbh, lambda); + mln_concrete(I) c = morpho::closing_area(ima, nbh, lambda); + // FIXME: Use morpho::watershed::flooding instead? mln_ch_value(I, L) s = morpho::meyer_wst(c, nbh, nbasins); return s; } Index: apps/chain.lst =================================================================== --- apps/chain.lst (revision 0) +++ apps/chain.lst (revision 3418) @@ -0,0 +1,8 @@ +template <typename I, typename N, typename L> +mln_ch_value(I, L) +chain(const I& ima, const N& nbh, unsigned lambda, L& nbasins) +{ + mln_concrete(I) c = morpho::closing_area(ima, nbh, lambda); // Compute $C$. + mln_ch_value(I, L) s = morpho::wst(c, nbh, nbasins); // Compute $S$. + return s; +} Index: apps/lena-g.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: apps/lena-g.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Index: apps/complex.cc =================================================================== --- apps/complex.cc (revision 3417) +++ apps/complex.cc (revision 3418) @@ -47,6 +47,11 @@ down. */ input ima; io::off::load(ima, input_filename); - output s = chain(ima, nbh, win, lambda, nbasins); + + // FIXME: gradient_on_edges is not implemented; extract it from + // apps/statues/mesh-complex-max-curv-segm.cc. + + input g = morpho::gradient_on_edges(ima, win); + output s = chain(ima, nbh, lambda, nbasins); io::off::save(debug::colorize(value::rgb8(), s, nbasins), output_filename); } Index: apps/image2d.cc =================================================================== --- apps/image2d.cc (revision 3417) +++ apps/image2d.cc (revision 3418) @@ -9,7 +9,10 @@ #include <mln/value/int_u8.hh> #include <mln/value/label_8.hh> +#include <mln/morpho/gradient.hh> + #include <mln/io/pgm/load.hh> +#include <mln/io/pgm/save.hh> #include <mln/io/ppm/save.hh> #include <mln/debug/colorize.hh> @@ -43,6 +46,28 @@ // Load, process, save. input ima = io::pgm::load<val>(input_filename); - output s = chain(ima, nbh, win, lambda, nbasins); + // Gradient. + /* FIXME: Unfortunately, we cannot write + + morpho::gradient(ima, win) + + here, since MM only uses windows (yet?), not neighborhoods. And + we cannot either write + + morpho::gradient(ima, nbh.win()), + + since that window would not contain the center site... + Therefore, this function asks for a window WIN matching the + neighborhood NBH, plus the center site. + + A neighborhood `n' should provide a method `win_p()' returning a + window corresponding to `n' plus the center site. */ + input g = morpho::gradient(ima, win); + + // FIXME: get the name as argument. + io::pgm::save(g, "apps/lena-g.pgm"); + + // Chain. + output s = chain(g, nbh, lambda, nbasins); io::ppm::save(debug::colorize(value::rgb8(), s, nbasins), output_filename); } Index: apps/graph.cc =================================================================== --- apps/graph.cc (revision 0) +++ apps/graph.cc (revision 3418) @@ -0,0 +1,495 @@ +// Copyright (C) 2008, 2009 EPITA Research and Development Laboratory (LRDE) +// +// 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. + +#include <iostream> +#include <iomanip> + +#include <vector> + +#include <mln/core/image/image2d.hh> +#include <mln/core/routine/duplicate.hh> +#include <mln/core/alias/neighb2d.hh> +#include <mln/core/site_set/p_queue_fast.hh> +#include <mln/labeling/blobs.hh> +#include <mln/io/pgm/load.hh> +#include <mln/debug/println.hh> +#include <mln/draw/line.hh> +#include <mln/pw/all.hh> +#include <mln/binarization/threshold.hh> + +#include <mln/value/int_u8.hh> +#include <mln/core/alias/point2d.hh> + +#include <mln/core/site_set/p_faces.hh> +#include <mln/core/image/complex_image.hh> +#include <mln/core/alias/complex_geometry.hh> +#include <mln/core/alias/complex_image.hh> + +// FIXME: Include these elsewhere? (In complex_image.hh?) +#include <mln/core/image/complex_neighborhoods.hh> +#include <mln/core/image/complex_neighborhood_piter.hh> +#include <mln/core/image/complex_windows.hh> + +#include <mln/data/fill.hh> +#include <mln/morpho/gradient.hh> +#include <mln/debug/colorize.hh> + +#include "chain.hh" + + +// FIXME: Copied and adjusted from pics/graph.cc; factor. + +namespace mln +{ + + template <typename I, typename N> + mln_concrete(I) + influence_zones(const I& input, const N& nbh) + { + mln_concrete(I) output = duplicate(input); + + p_queue_fast<mln_site(I)> q; + + { + // Initialization. + mln_piter(I) p(input.domain()); + mln_niter(N) n(nbh, p); + for_all(p) + if (input(p) != 0) + for_all(n) if (input.has(n)) + if (input(n) == 0) + { + q.push(p); + break; + } + } + { + // Body. + mln_site(I) p; + mln_niter(N) n(nbh, p); + while (! q.is_empty()) + { + p = q.pop_front(); + mln_invariant(output(p) != 0); + for_all(n) if (input.has(n)) + if (output(n) == 0) + { + output(n) = output(p); + q.push(n); + } + } + } + + return output; + + } + + + namespace io + { + + namespace neato + { + + /* FIXME: This is just the gray-level version. Handle other value + types as well. */ + void + save(const complex_image<1, discrete_plane_1complex_geometry, + value::int_u8>& ima, + const std::string& filename, + const std::string& bgcolor = "#0000C0", + const std::string& fontcolor = "#0000C0", + bool empty_vertex_label = true) + { + typedef value::int_u8 V; + typedef complex_image<1, discrete_plane_1complex_geometry, V> I; + const unsigned D = 1; + typedef discrete_plane_1complex_geometry G; + + std::ofstream g(filename.c_str()); + g << "graph wst" << std::endl + << "{" << std::endl + << " graph [bgcolor = \"" << bgcolor << "\"]" << std::endl + << " edge [color = \"#FFFFFF\"]" << std::endl + << " node [color = \"#FFFFFF\", height=\"5\", width=\"5\"," + << " fontsize=\"100\", fontcolor = \"" << fontcolor << "\"]" + << std::endl; + + // Vertices. + p_n_faces_fwd_piter<D, G> v(ima.domain(), 0); + typedef complex_higher_neighborhood<D, G> e_nbh_t; + e_nbh_t e_nbh; + for_all(v) + { + V vertex_color = ima(v); + std::ostringstream vertex_color_str; + // FIXME: Only valid for gray-level images. + vertex_color_str << '#' + << std::hex + << std::setfill('0') + << std::setw(2) << vertex_color + << std::setw(2) << vertex_color + << std::setw(2) << vertex_color + << std::dec; + + g << " v" << v.unproxy_().face_id() + << " [pos = \"" + << std::fixed << std::setprecision(1) + << (float)v.to_site().front()[1] << ", " + << -(float)v.to_site().front()[0] + << "\", color = \"" << vertex_color_str.str() + << "\", fillcolor = \"" << vertex_color_str.str() + << "\", pin = \"true\", style=\"filled,setlinewidth(3)\""; + if (empty_vertex_label) + g << ", label = \"\""; + g << "];" + << std::endl; + } + + // Edges. + p_n_faces_fwd_piter<D, G> e(ima.domain(), 1); + typedef complex_lower_neighborhood<D, G> v_nbh_t; + v_nbh_t v_nbh; + mln_niter_(v_nbh_t) adj_v(v_nbh, e); + for_all(e) + { + V edge_color = ima(e); + std::ostringstream edge_color_str; + edge_color_str << '#' + << std::hex + << std::setfill('0') + << std::setw(2) << edge_color + << std::setw(2) << edge_color + << std::setw(2) << edge_color + << std::dec; + + // Adjacent vertices. + adj_v.start(); + topo::face<1> v1 = adj_v.unproxy_().face(); + point2d p1 = adj_v.to_site().front(); + adj_v.next(); + topo::face<1> v2 = adj_v.unproxy_().face(); + point2d p2 = adj_v.to_site().front(); + adj_v.next(); + mln_invariant(!adj_v.is_valid()); + + g << " v" << v1.face_id() << " -- v" << v2.face_id() << " "; + g << "[color = \"" << edge_color_str.str() + << "\", style=\"setlinewidth(10)\"];" << std::endl; + } + + g << "}" << std::endl; + g.close(); + } + + // FIXME: Factor with the previous version. + void + save(const complex_image<1, discrete_plane_1complex_geometry, + value::rgb8>& ima, + const std::string& filename, + const std::string& bgcolor = "#0000C0", + const std::string& fontcolor = "#0000C0", + bool empty_vertex_label = true) + { + typedef value::rgb8 V; + typedef complex_image<1, discrete_plane_1complex_geometry, V> I; + const unsigned D = 1; + typedef discrete_plane_1complex_geometry G; + + std::ofstream g(filename.c_str()); + g << "graph wst" << std::endl + << "{" << std::endl + << " graph [bgcolor = \"" << bgcolor << "\"]" << std::endl + << " edge [color = \"#FFFFFF\"]" << std::endl + << " node [color = \"#FFFFFF\", height=\"5\", width=\"5\"," + << " fontsize=\"100\", fontcolor = \"" << fontcolor << "\"]" + << std::endl; + + // Vertices. + p_n_faces_fwd_piter<D, G> v(ima.domain(), 0); + typedef complex_higher_neighborhood<D, G> e_nbh_t; + e_nbh_t e_nbh; + for_all(v) + { + V vertex_color = ima(v); + std::ostringstream vertex_color_str; + // FIXME: Only valid for gray-level images. + vertex_color_str << '#' + << std::hex + << std::setfill('0') + << std::setw(2) << vertex_color.red() + << std::setw(2) << vertex_color.green() + << std::setw(2) << vertex_color.blue() + << std::dec; + + g << " v" << v.unproxy_().face_id() + << " [pos = \"" + << std::fixed << std::setprecision(1) + << (float)v.to_site().front()[1] << ", " + << -(float)v.to_site().front()[0] + << "\", color = \"" << vertex_color_str.str() + << "\", fillcolor = \"" << vertex_color_str.str() + << "\", pin = \"true\", style=\"filled,setlinewidth(3)\""; + if (empty_vertex_label) + g << ", label = \"\""; + g << "];" + << std::endl; + } + + // Edges. + p_n_faces_fwd_piter<D, G> e(ima.domain(), 1); + typedef complex_lower_neighborhood<D, G> v_nbh_t; + v_nbh_t v_nbh; + mln_niter_(v_nbh_t) adj_v(v_nbh, e); + for_all(e) + { + V edge_color = ima(e); + std::ostringstream edge_color_str; + edge_color_str << '#' + << std::hex + << std::setfill('0') + << std::setw(2) << edge_color.red() + << std::setw(2) << edge_color.green() + << std::setw(2) << edge_color.blue() + << std::dec; + + // Adjacent vertices. + adj_v.start(); + topo::face<1> v1 = adj_v.unproxy_().face(); + point2d p1 = adj_v.to_site().front(); + adj_v.next(); + topo::face<1> v2 = adj_v.unproxy_().face(); + point2d p2 = adj_v.to_site().front(); + adj_v.next(); + mln_invariant(!adj_v.is_valid()); + + g << " v" << v1.face_id() << " -- v" << v2.face_id() << " "; + g << "[color = \"" << edge_color_str.str() + << "\", style=\"setlinewidth(10)\"];" << std::endl; + } + + g << "}" << std::endl; + g.close(); + } + + } // end of namespace mln::io::neato + + } // end of namespace mln::io + +} // end of namespace mln + + +// FIXME: Clean up and move into Milena? +mln::int_u8_1complex_image2d +make_complex_image(const mln::image2d<mln::value::int_u8>& input) +{ + using namespace mln; + using mln::value::int_u8; + + /*----------------------------------------. + | Complex + complex geometry (location). | + `----------------------------------------*/ + + border::thickness = 0; + + unsigned nlabels; + image2d<unsigned> label = + labeling::blobs(mln::binarization::threshold(input, 1), c4(), nlabels); + + std::cout << "n seeds = " << nlabels << std::endl; + { + image2d<int_u8> lab(label.domain()); + data::paste(label, lab); + } + + image2d<unsigned> iz = influence_zones(label, c4()); + { + image2d<int_u8> IZ(iz.domain()); + data::paste(iz, IZ); + } + + + // Make graph/complex. + + std::vector< std::vector<bool> > adj(nlabels + 1); + for (unsigned l = 1; l <= nlabels; ++l) + adj[l].resize(nlabels + 1, false); + + { + box2d::piter p(iz.domain()); + for_all(p) + { + point2d r = p + right, b = p + down; + if (iz.has(r) && iz(p) != iz(r)) + { + if (iz(p) <= iz(r)) + adj[iz(p)][iz(r)] = true; + else + adj[iz(r)][iz(p)] = true; + } + if (iz.has(b) && iz(p) != iz(b)) + { + if (iz(p) <= iz(b)) + adj[iz(p)][iz(b)] = true; + else + adj[iz(b)][iz(p)] = true; + } + } + } + + // end of mk_graph + + + const unsigned D = 1; + + topo::complex<D> c; + + typedef point2d P; + typedef geom::complex_geometry<D, P> G; + G geom; + + // Convenience typedefs. + typedef topo::n_face<0, D> vertex; + typedef topo::n_face<1, D> edge; + + { + + // 0-faces (vertices). + std::vector<vertex> v; + { + box2d::piter p(label.domain()); + for_all(p) + if (label(p) != 0) + { + geom.add_location(p); + v.push_back(c.add_face()); + } + } + + std::cout << "v size = " << v.size() << std::endl; + + // 1-faces (edges). + std::vector<edge> e; + { + for (unsigned l = 1; l <= nlabels; ++l) + for (unsigned ll = l + 1; ll <= nlabels; ++ll) + if (adj[l][ll]) + e.push_back( c.add_face(-v[l-1] + v[ll-1]) ); + } + + std::cout << "e size = " << e.size() << std::endl; + + } + + + /*---------------------. + | Complex-based pset. | + `---------------------*/ + + p_complex<D, G> pc(c, geom); + + /*----------------------. + | Complex-based image. | + `----------------------*/ + + // An image type built on a 1-complex with unsigned values on each + // face (both vertices and edges). + typedef complex_image<D, G, int_u8> output_t; + + // Create and initialize an image based on PC. + output_t output(pc); + + // Color OUTPUT's vertices with INPUT's values. + p_n_faces_fwd_piter<D, G> v(output.domain(), 0); + for_all(v) + output(v) = input(v.to_site().front()); + + // Use a medium gray to color edges. + p_n_faces_fwd_piter<D, G> e(output.domain(), 1); + for_all(e) + output(e) = 128; + + return output; +} + + +// FIXME: Move to Milena? +template <unsigned D, typename G, typename V> +mln::complex_higher_dim_connected_n_face_window_p<D, G> +make_elt_win(const mln::complex_image<D, G, V>& ima) +{ + return mln::complex_higher_dim_connected_n_face_window_p<D, G>(); +} + +// FIXME: Move to Milena? +template <unsigned D, typename G, typename V> +mln::complex_higher_dim_connected_n_face_neighborhood<D, G> +make_elt_nbh(const mln::complex_image<D, G, V>& ima) +{ + return mln::complex_higher_dim_connected_n_face_neighborhood<D, G>(); +} + + +int main(int argc, char* argv[]) +{ + if (argc != 4) + { + std::cerr << "usage: " << argv[0] << " seeds.pgm lambda output.neato" + << std::endl; + std::exit(1); + } + std::string input_filename = argv[1]; + unsigned lambda = atoi(argv[2]); + std::string output_filename = argv[3]; + + using namespace mln; + using mln::value::int_u8; + // Use clearer names. + typedef int_u8_1complex_image2d int_u8_graph_image2d; + + typedef int_u8_graph_image2d input; + typedef value::label_8 label; + typedef mln_ch_value_(input, label) output; + label nbasins; + + // Seeds. + image2d<int_u8> seeds = io::pgm::load<int_u8>(input_filename); + // Input image computed from the graph of influence zones (IZ) of seeds. + typedef int_u8_graph_image2d ima_t; + ima_t ima = make_complex_image(seeds); + io::neato::save(ima, "apps/graph.neato"); + + // Gradient. + input g = morpho::gradient(ima, make_elt_win(ima)); + + // FIXME: get the name as argument. + io::neato::save(g, "apps/graph-g.neato"); + + // Chain. + output s = chain(g, make_elt_nbh(g), lambda, nbasins); + io::neato::save(debug::colorize(value::rgb8(), s, nbasins), output_filename); +} Index: apps/new/m283-c.gcl =================================================================== --- apps/new/m283-c.gcl (revision 0) +++ apps/new/m283-c.gcl (revision 3418) @@ -0,0 +1,10 @@ +(load apps/new/m283-g.off geometry) +# `g1' is the first loaded (and sole) object. +(bbox-draw g1 no) +# `c0' is the initial camera. +(backcolor c0 1 1 1) +# `g0' is ``the World''. Rotation is expressed in radians around each axis. +(transform g0 g0 focus rotate 0.0 2.3 0.0) +(zoom c0 1.5) +(snapshot c0 apps/new/m283-g.ppm) +(quit) Property changes on: apps/new/m283-c.gcl ___________________________________________________________________ Added: svn:mergeinfo Index: apps/new/m283-s.gcl =================================================================== --- apps/new/m283-s.gcl (revision 0) +++ apps/new/m283-s.gcl (revision 3418) @@ -0,0 +1,10 @@ +(load apps/new/m283-s.off geometry) +# `g1' is the first loaded (and sole) object. +(bbox-draw g1 no) +# `c0' is the initial camera. +(backcolor c0 1 1 1) +# `g0' is ``the World''. Rotation is expressed in radians around each axis. +(transform g0 g0 focus rotate 0.0 2.3 0.0) +(zoom c0 1.5) +(snapshot c0 apps/new/m283-s.ppm) +(quit) Index: apps/new/m283.gcl =================================================================== --- apps/new/m283.gcl (revision 0) +++ apps/new/m283.gcl (revision 3418) @@ -0,0 +1,10 @@ +(load apps/new/m283.off geometry) +# `g1' is the first loaded (and sole) object. +(bbox-draw g1 no) +# `c0' is the initial camera. +(backcolor c0 1 1 1) +# `g0' is ``the World''. Rotation is expressed in radians around each axis. +(transform g0 g0 focus rotate 0.0 2.3 0.0) +(zoom c0 1.5) +(snapshot c0 apps/new/m283.ppm) +(quit) Property changes on: apps/new/m283.gcl ___________________________________________________________________ Added: svn:mergeinfo Index: apps/graph-g.neato =================================================================== --- apps/graph-g.neato (revision 0) +++ apps/graph-g.neato (revision 3418) @@ -0,0 +1,67 @@ +graph wst +{ + graph [bgcolor = "#0000C0"] + edge [color = "#FFFFFF"] + node [color = "#FFFFFF", height="5", width="5", fontsize="100", fontcolor = "#0000C0"] + v0 [pos = "44.0, -11.0", color = "#878787", fillcolor = "#878787", pin = "true", style="filled,setlinewidth(3)", label = ""]; + v1 [pos = "26.0, -12.0", color = "#c0c0c0", fillcolor = "#c0c0c0", pin = "true", style="filled,setlinewidth(3)", label = ""]; + v2 [pos = "12.0, -15.0", color = "#9f9f9f", fillcolor = "#9f9f9f", pin = "true", style="filled,setlinewidth(3)", label = ""]; + v3 [pos = "56.0, -17.0", color = "#adadad", fillcolor = "#adadad", pin = "true", style="filled,setlinewidth(3)", label = ""]; + v4 [pos = "33.0, -19.0", color = "#eeeeee", fillcolor = "#eeeeee", pin = "true", style="filled,setlinewidth(3)", label = ""]; + v5 [pos = "20.0, -24.0", color = "#cdcdcd", fillcolor = "#cdcdcd", pin = "true", style="filled,setlinewidth(3)", label = ""]; + v6 [pos = "39.0, -24.0", color = "#eeeeee", fillcolor = "#eeeeee", pin = "true", style="filled,setlinewidth(3)", label = ""]; + v7 [pos = "10.0, -28.0", color = "#898989", fillcolor = "#898989", pin = "true", style="filled,setlinewidth(3)", label = ""]; + v8 [pos = "50.0, -31.0", color = "#e3e3e3", fillcolor = "#e3e3e3", pin = "true", style="filled,setlinewidth(3)", label = ""]; + v9 [pos = "32.0, -36.0", color = "#e3e3e3", fillcolor = "#e3e3e3", pin = "true", style="filled,setlinewidth(3)", label = ""]; + v10 [pos = "16.0, -37.0", color = "#a5a5a5", fillcolor = "#a5a5a5", pin = "true", style="filled,setlinewidth(3)", label = ""]; + v11 [pos = "26.0, -41.0", color = "#ededed", fillcolor = "#ededed", pin = "true", style="filled,setlinewidth(3)", label = ""]; + v12 [pos = "43.0, -44.0", color = "#8d8d8d", fillcolor = "#8d8d8d", pin = "true", style="filled,setlinewidth(3)", label = ""]; + v13 [pos = "18.0, -46.0", color = "#838383", fillcolor = "#838383", pin = "true", style="filled,setlinewidth(3)", label = ""]; + v14 [pos = "10.0, -47.0", color = "#606060", fillcolor = "#606060", pin = "true", style="filled,setlinewidth(3)", label = ""]; + v15 [pos = "34.0, -47.0", color = "#ededed", fillcolor = "#ededed", pin = "true", style="filled,setlinewidth(3)", label = ""]; + v16 [pos = "55.0, -48.0", color = "#727272", fillcolor = "#727272", pin = "true", style="filled,setlinewidth(3)", label = ""]; + v17 [pos = "23.0, -54.0", color = "#868686", fillcolor = "#868686", pin = "true", style="filled,setlinewidth(3)", label = ""]; + v18 [pos = "45.0, -57.0", color = "#727272", fillcolor = "#727272", pin = "true", style="filled,setlinewidth(3)", label = ""]; + v0 -- v1 [color = "#000000", style="setlinewidth(10)"]; + v0 -- v3 [color = "#000000", style="setlinewidth(10)"]; + v0 -- v4 [color = "#000000", style="setlinewidth(10)"]; + v0 -- v6 [color = "#000000", style="setlinewidth(10)"]; + v1 -- v2 [color = "#000000", style="setlinewidth(10)"]; + v1 -- v4 [color = "#000000", style="setlinewidth(10)"]; + v1 -- v5 [color = "#000000", style="setlinewidth(10)"]; + v2 -- v5 [color = "#000000", style="setlinewidth(10)"]; + v2 -- v7 [color = "#000000", style="setlinewidth(10)"]; + v3 -- v6 [color = "#000000", style="setlinewidth(10)"]; + v3 -- v8 [color = "#000000", style="setlinewidth(10)"]; + v4 -- v5 [color = "#000000", style="setlinewidth(10)"]; + v4 -- v6 [color = "#000000", style="setlinewidth(10)"]; + v4 -- v9 [color = "#000000", style="setlinewidth(10)"]; + v5 -- v7 [color = "#000000", style="setlinewidth(10)"]; + v5 -- v9 [color = "#000000", style="setlinewidth(10)"]; + v5 -- v10 [color = "#000000", style="setlinewidth(10)"]; + v5 -- v11 [color = "#000000", style="setlinewidth(10)"]; + v6 -- v8 [color = "#000000", style="setlinewidth(10)"]; + v6 -- v9 [color = "#000000", style="setlinewidth(10)"]; + v7 -- v10 [color = "#000000", style="setlinewidth(10)"]; + v8 -- v9 [color = "#000000", style="setlinewidth(10)"]; + v8 -- v12 [color = "#000000", style="setlinewidth(10)"]; + v8 -- v16 [color = "#000000", style="setlinewidth(10)"]; + v9 -- v11 [color = "#000000", style="setlinewidth(10)"]; + v9 -- v12 [color = "#000000", style="setlinewidth(10)"]; + v9 -- v15 [color = "#000000", style="setlinewidth(10)"]; + v10 -- v11 [color = "#000000", style="setlinewidth(10)"]; + v10 -- v13 [color = "#000000", style="setlinewidth(10)"]; + v10 -- v14 [color = "#000000", style="setlinewidth(10)"]; + v11 -- v13 [color = "#000000", style="setlinewidth(10)"]; + v11 -- v15 [color = "#000000", style="setlinewidth(10)"]; + v11 -- v17 [color = "#000000", style="setlinewidth(10)"]; + v12 -- v15 [color = "#000000", style="setlinewidth(10)"]; + v12 -- v16 [color = "#000000", style="setlinewidth(10)"]; + v12 -- v18 [color = "#000000", style="setlinewidth(10)"]; + v13 -- v14 [color = "#000000", style="setlinewidth(10)"]; + v13 -- v17 [color = "#000000", style="setlinewidth(10)"]; + v14 -- v17 [color = "#000000", style="setlinewidth(10)"]; + v15 -- v17 [color = "#000000", style="setlinewidth(10)"]; + v15 -- v18 [color = "#000000", style="setlinewidth(10)"]; + v16 -- v18 [color = "#000000", style="setlinewidth(10)"]; +} Index: apps/graph-g.pdf =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: apps/graph-g.pdf ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Index: apps/graph-s.neato =================================================================== --- apps/graph-s.neato (revision 0) +++ apps/graph-s.neato (revision 3418) @@ -0,0 +1,67 @@ +graph wst +{ + graph [bgcolor = "#0000C0"] + edge [color = "#FFFFFF"] + node [color = "#FFFFFF", height="5", width="5", fontsize="100", fontcolor = "#0000C0"] + v0 [pos = "44.0, -11.0", color = "#356d6b", fillcolor = "#356d6b", pin = "true", style="filled,setlinewidth(3)", label = ""]; + v1 [pos = "26.0, -12.0", color = "#000000", fillcolor = "#000000", pin = "true", style="filled,setlinewidth(3)", label = ""]; + v2 [pos = "12.0, -15.0", color = "#e8329e", fillcolor = "#e8329e", pin = "true", style="filled,setlinewidth(3)", label = ""]; + v3 [pos = "56.0, -17.0", color = "#356d6b", fillcolor = "#356d6b", pin = "true", style="filled,setlinewidth(3)", label = ""]; + v4 [pos = "33.0, -19.0", color = "#000000", fillcolor = "#000000", pin = "true", style="filled,setlinewidth(3)", label = ""]; + v5 [pos = "20.0, -24.0", color = "#e8329e", fillcolor = "#e8329e", pin = "true", style="filled,setlinewidth(3)", label = ""]; + v6 [pos = "39.0, -24.0", color = "#356d6b", fillcolor = "#356d6b", pin = "true", style="filled,setlinewidth(3)", label = ""]; + v7 [pos = "10.0, -28.0", color = "#e8329e", fillcolor = "#e8329e", pin = "true", style="filled,setlinewidth(3)", label = ""]; + v8 [pos = "50.0, -31.0", color = "#000000", fillcolor = "#000000", pin = "true", style="filled,setlinewidth(3)", label = ""]; + v9 [pos = "32.0, -36.0", color = "#000000", fillcolor = "#000000", pin = "true", style="filled,setlinewidth(3)", label = ""]; + v10 [pos = "16.0, -37.0", color = "#000000", fillcolor = "#000000", pin = "true", style="filled,setlinewidth(3)", label = ""]; + v11 [pos = "26.0, -41.0", color = "#000000", fillcolor = "#000000", pin = "true", style="filled,setlinewidth(3)", label = ""]; + v12 [pos = "43.0, -44.0", color = "#7db4bd", fillcolor = "#7db4bd", pin = "true", style="filled,setlinewidth(3)", label = ""]; + v13 [pos = "18.0, -46.0", color = "#b7da2c", fillcolor = "#b7da2c", pin = "true", style="filled,setlinewidth(3)", label = ""]; + v14 [pos = "10.0, -47.0", color = "#b7da2c", fillcolor = "#b7da2c", pin = "true", style="filled,setlinewidth(3)", label = ""]; + v15 [pos = "34.0, -47.0", color = "#000000", fillcolor = "#000000", pin = "true", style="filled,setlinewidth(3)", label = ""]; + v16 [pos = "55.0, -48.0", color = "#7db4bd", fillcolor = "#7db4bd", pin = "true", style="filled,setlinewidth(3)", label = ""]; + v17 [pos = "23.0, -54.0", color = "#b7da2c", fillcolor = "#b7da2c", pin = "true", style="filled,setlinewidth(3)", label = ""]; + v18 [pos = "45.0, -57.0", color = "#7db4bd", fillcolor = "#7db4bd", pin = "true", style="filled,setlinewidth(3)", label = ""]; + v0 -- v1 [color = "#5cc33d", style="setlinewidth(10)"]; + v0 -- v3 [color = "#e38416", style="setlinewidth(10)"]; + v0 -- v4 [color = "#7d7a52", style="setlinewidth(10)"]; + v0 -- v6 [color = "#56bed5", style="setlinewidth(10)"]; + v1 -- v2 [color = "#6c4b6c", style="setlinewidth(10)"]; + v1 -- v4 [color = "#ea6114", style="setlinewidth(10)"]; + v1 -- v5 [color = "#48bc27", style="setlinewidth(10)"]; + v2 -- v5 [color = "#164eaf", style="setlinewidth(10)"]; + v2 -- v7 [color = "#4b691f", style="setlinewidth(10)"]; + v3 -- v6 [color = "#bda486", style="setlinewidth(10)"]; + v3 -- v8 [color = "#4d75ee", style="setlinewidth(10)"]; + v4 -- v5 [color = "#39581f", style="setlinewidth(10)"]; + v4 -- v6 [color = "#c58d18", style="setlinewidth(10)"]; + v4 -- v9 [color = "#c6c59c", style="setlinewidth(10)"]; + v5 -- v7 [color = "#baac2a", style="setlinewidth(10)"]; + v5 -- v9 [color = "#6917a8", style="setlinewidth(10)"]; + v5 -- v10 [color = "#768368", style="setlinewidth(10)"]; + v5 -- v11 [color = "#7d7375", style="setlinewidth(10)"]; + v6 -- v8 [color = "#6545ae", style="setlinewidth(10)"]; + v6 -- v9 [color = "#376d19", style="setlinewidth(10)"]; + v7 -- v10 [color = "#4c8f22", style="setlinewidth(10)"]; + v8 -- v9 [color = "#91719b", style="setlinewidth(10)"]; + v8 -- v12 [color = "#a1c621", style="setlinewidth(10)"]; + v8 -- v16 [color = "#1c1c89", style="setlinewidth(10)"]; + v9 -- v11 [color = "#5d29cc", style="setlinewidth(10)"]; + v9 -- v12 [color = "#45e28e", style="setlinewidth(10)"]; + v9 -- v15 [color = "#df5ab0", style="setlinewidth(10)"]; + v10 -- v11 [color = "#e0e66c", style="setlinewidth(10)"]; + v10 -- v13 [color = "#401ce9", style="setlinewidth(10)"]; + v10 -- v14 [color = "#51edd6", style="setlinewidth(10)"]; + v11 -- v13 [color = "#4744e1", style="setlinewidth(10)"]; + v11 -- v15 [color = "#554c49", style="setlinewidth(10)"]; + v11 -- v17 [color = "#981b79", style="setlinewidth(10)"]; + v12 -- v15 [color = "#9f9527", style="setlinewidth(10)"]; + v12 -- v16 [color = "#4946cf", style="setlinewidth(10)"]; + v12 -- v18 [color = "#9892ed", style="setlinewidth(10)"]; + v13 -- v14 [color = "#4b243a", style="setlinewidth(10)"]; + v13 -- v17 [color = "#db49c8", style="setlinewidth(10)"]; + v14 -- v17 [color = "#c56d31", style="setlinewidth(10)"]; + v15 -- v17 [color = "#677028", style="setlinewidth(10)"]; + v15 -- v18 [color = "#4557cb", style="setlinewidth(10)"]; + v16 -- v18 [color = "#7f6634", style="setlinewidth(10)"]; +} Index: apps/graph.neato =================================================================== --- apps/graph.neato (revision 0) +++ apps/graph.neato (revision 3418) @@ -0,0 +1,67 @@ +graph wst +{ + graph [bgcolor = "#0000C0"] + edge [color = "#FFFFFF"] + node [color = "#FFFFFF", height="5", width="5", fontsize="100", fontcolor = "#0000C0"] + v0 [pos = "44.0, -11.0", color = "#010101", fillcolor = "#010101", pin = "true", style="filled,setlinewidth(3)", label = ""]; + v1 [pos = "26.0, -12.0", color = "#222222", fillcolor = "#222222", pin = "true", style="filled,setlinewidth(3)", label = ""]; + v2 [pos = "12.0, -15.0", color = "#c1c1c1", fillcolor = "#c1c1c1", pin = "true", style="filled,setlinewidth(3)", label = ""]; + v3 [pos = "56.0, -17.0", color = "#757575", fillcolor = "#757575", pin = "true", style="filled,setlinewidth(3)", label = ""]; + v4 [pos = "33.0, -19.0", color = "#888888", fillcolor = "#888888", pin = "true", style="filled,setlinewidth(3)", label = ""]; + v5 [pos = "20.0, -24.0", color = "#383838", fillcolor = "#383838", pin = "true", style="filled,setlinewidth(3)", label = ""]; + v6 [pos = "39.0, -24.0", color = "#0c0c0c", fillcolor = "#0c0c0c", pin = "true", style="filled,setlinewidth(3)", label = ""]; + v7 [pos = "10.0, -28.0", color = "#aeaeae", fillcolor = "#aeaeae", pin = "true", style="filled,setlinewidth(3)", label = ""]; + v8 [pos = "50.0, -31.0", color = "#aeaeae", fillcolor = "#aeaeae", pin = "true", style="filled,setlinewidth(3)", label = ""]; + v9 [pos = "32.0, -36.0", color = "#efefef", fillcolor = "#efefef", pin = "true", style="filled,setlinewidth(3)", label = ""]; + v10 [pos = "16.0, -37.0", color = "#626262", fillcolor = "#626262", pin = "true", style="filled,setlinewidth(3)", label = ""]; + v11 [pos = "26.0, -41.0", color = "#858585", fillcolor = "#858585", pin = "true", style="filled,setlinewidth(3)", label = ""]; + v12 [pos = "43.0, -44.0", color = "#d4d4d4", fillcolor = "#d4d4d4", pin = "true", style="filled,setlinewidth(3)", label = ""]; + v13 [pos = "18.0, -46.0", color = "#090909", fillcolor = "#090909", pin = "true", style="filled,setlinewidth(3)", label = ""]; + v14 [pos = "10.0, -47.0", color = "#0e0e0e", fillcolor = "#0e0e0e", pin = "true", style="filled,setlinewidth(3)", label = ""]; + v15 [pos = "34.0, -47.0", color = "#888888", fillcolor = "#888888", pin = "true", style="filled,setlinewidth(3)", label = ""]; + v16 [pos = "55.0, -48.0", color = "#acacac", fillcolor = "#acacac", pin = "true", style="filled,setlinewidth(3)", label = ""]; + v17 [pos = "23.0, -54.0", color = "#020202", fillcolor = "#020202", pin = "true", style="filled,setlinewidth(3)", label = ""]; + v18 [pos = "45.0, -57.0", color = "#626262", fillcolor = "#626262", pin = "true", style="filled,setlinewidth(3)", label = ""]; + v0 -- v1 [color = "#808080", style="setlinewidth(10)"]; + v0 -- v3 [color = "#808080", style="setlinewidth(10)"]; + v0 -- v4 [color = "#808080", style="setlinewidth(10)"]; + v0 -- v6 [color = "#808080", style="setlinewidth(10)"]; + v1 -- v2 [color = "#808080", style="setlinewidth(10)"]; + v1 -- v4 [color = "#808080", style="setlinewidth(10)"]; + v1 -- v5 [color = "#808080", style="setlinewidth(10)"]; + v2 -- v5 [color = "#808080", style="setlinewidth(10)"]; + v2 -- v7 [color = "#808080", style="setlinewidth(10)"]; + v3 -- v6 [color = "#808080", style="setlinewidth(10)"]; + v3 -- v8 [color = "#808080", style="setlinewidth(10)"]; + v4 -- v5 [color = "#808080", style="setlinewidth(10)"]; + v4 -- v6 [color = "#808080", style="setlinewidth(10)"]; + v4 -- v9 [color = "#808080", style="setlinewidth(10)"]; + v5 -- v7 [color = "#808080", style="setlinewidth(10)"]; + v5 -- v9 [color = "#808080", style="setlinewidth(10)"]; + v5 -- v10 [color = "#808080", style="setlinewidth(10)"]; + v5 -- v11 [color = "#808080", style="setlinewidth(10)"]; + v6 -- v8 [color = "#808080", style="setlinewidth(10)"]; + v6 -- v9 [color = "#808080", style="setlinewidth(10)"]; + v7 -- v10 [color = "#808080", style="setlinewidth(10)"]; + v8 -- v9 [color = "#808080", style="setlinewidth(10)"]; + v8 -- v12 [color = "#808080", style="setlinewidth(10)"]; + v8 -- v16 [color = "#808080", style="setlinewidth(10)"]; + v9 -- v11 [color = "#808080", style="setlinewidth(10)"]; + v9 -- v12 [color = "#808080", style="setlinewidth(10)"]; + v9 -- v15 [color = "#808080", style="setlinewidth(10)"]; + v10 -- v11 [color = "#808080", style="setlinewidth(10)"]; + v10 -- v13 [color = "#808080", style="setlinewidth(10)"]; + v10 -- v14 [color = "#808080", style="setlinewidth(10)"]; + v11 -- v13 [color = "#808080", style="setlinewidth(10)"]; + v11 -- v15 [color = "#808080", style="setlinewidth(10)"]; + v11 -- v17 [color = "#808080", style="setlinewidth(10)"]; + v12 -- v15 [color = "#808080", style="setlinewidth(10)"]; + v12 -- v16 [color = "#808080", style="setlinewidth(10)"]; + v12 -- v18 [color = "#808080", style="setlinewidth(10)"]; + v13 -- v14 [color = "#808080", style="setlinewidth(10)"]; + v13 -- v17 [color = "#808080", style="setlinewidth(10)"]; + v14 -- v17 [color = "#808080", style="setlinewidth(10)"]; + v15 -- v17 [color = "#808080", style="setlinewidth(10)"]; + v15 -- v18 [color = "#808080", style="setlinewidth(10)"]; + v16 -- v18 [color = "#808080", style="setlinewidth(10)"]; +} Index: apps/graph-s.pdf =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: apps/graph-s.pdf ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Index: apps/graph.pdf =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: apps/graph.pdf ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Index: apps/old/m283-s.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: apps/old/m283-s.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: svn:mergeinfo Index: apps/old/m283.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: apps/old/m283.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: svn:mergeinfo Index: apps/old/m283.gcl =================================================================== --- apps/old/m283.gcl (revision 0) +++ apps/old/m283.gcl (revision 3418) @@ -0,0 +1,10 @@ +(load apps/old/m283.off geometry) +# `g1' is the first loaded (and sole) object. +(bbox-draw g1 no) +# `c0' is the initial camera. +(backcolor c0 1 1 1) +# `g0' is ``the World''. Rotation is expressed in radians around each axis. +(transform g0 g0 focus rotate 0.0 2.3 0.0) +(zoom c0 1.5) +(snapshot c0 apps/old/m283.ppm) +(quit) Property changes on: apps/old/m283.gcl ___________________________________________________________________ Added: svn:mergeinfo Property changes on: apps ___________________________________________________________________ Modified: svn:ignore - *.dSYM image2d complex + *.dSYM image2d graph complex Index: Makefile =================================================================== --- Makefile (revision 3417) +++ Makefile (revision 3418) @@ -20,18 +20,23 @@ CLEANFILES = article.pdf $(BASE).pdf -## apps/m283-s.png is not part of IMAGES since the tool that generated -## it is outside this repository (it is located in Milena's -## apps/statues directory). +## apps/old/m283-s.png is not part of IMAGES since the tools that +## generated it (milena/apps/statues/mesh-complex-max-curv-segm) is +## outside this repository (it is located in Milena's apps/statues +## directory). Note that I do not remember the values of lambda. IMAGES = \ pics/picasso.png pics/picasso-dil.png \ \ pics/graph.neato pics/graph-dil.neato \ pics/graph.png pics/graph-dil.png \ \ + apps/lena.png apps/lena-g.png apps/lena-s.png \ \ - apps/lena.png apps/lena-s.png \ - \ + apps/graph.neato apps/graph.pdf \ + apps/graph-g.neato apps/graph-g.pdf \ + apps/graph-s.neato apps/graph-s.pdf + +IMAGES_OLD = \ apps/m272.png \ apps/m272-max-curv.png \ apps/m272-max-curv-s.off apps/m272-max-curv-s.png \ @@ -51,7 +56,7 @@ article.pdf: article.sty rev.sty # FIXME: Use another extension: these files are not (La)TeX ones. -article.pdf: pics/picasso.lst pics/graph.lst +article.pdf: pics/picasso.lst pics/graph.lst apps/chain.lst ## -------- ## ## Images. ## @@ -98,6 +103,10 @@ # Generate for the 3-D output (*-s.off) a file similar to the one used # to capture the 3-D input (*.off), so that both snapshots show the # same view. +%-g.gcl: %.gcl + sed "s,$*,$*-g,g" $< >$@ +%-c.gcl: %.gcl + sed "s,$*,$*-c,g" $< >$@ %-s.gcl: %.gcl sed "s,$*,$*-s,g" $< >$@ # Likewise for other derived meshes. @@ -123,10 +132,13 @@ apps/image2d: apps/chain.hh # Generate *-s.off from *.off using apps/complex. -%-s.off: %.off apps/complex - apps/complex $< 100 $@ -apps/complex: apps/chain.hh +# FIXME: Disabled. +## %-s.off: %.off apps/complex +## apps/complex $< 100 $@ +## apps/complex: apps/chain.hh +apps/graph-s.neato: pics/seeds.pgm apps/graph + apps/graph $< 2 $@ ## --------- ## ## Install. ## Index: pics/graph.cc =================================================================== --- pics/graph.cc (revision 3417) +++ pics/graph.cc (revision 3418) @@ -45,8 +45,9 @@ #include <mln/core/alias/point2d.hh> #include <mln/core/site_set/p_faces.hh> +#include <mln/core/image/complex_image.hh> #include <mln/core/alias/complex_geometry.hh> -#include <mln/core/image/complex_image.hh> +#include <mln/core/alias/complex_image.hh> // FIXME: Include these elsewhere? (In complex_image.hh?) #include <mln/core/image/complex_neighborhoods.hh> Property changes on: . ___________________________________________________________________ Modified: svn:externals - share -r 3413 https://svn.lrde.epita.fr/svn/lrde-publis/trunk/share + share -r 3417 https://svn.lrde.epita.fr/svn/lrde-publis/trunk/share