\hypertarget{a00059}{
\section{mln::accu::count\_\-labels$<$ L $>$ Struct Template Reference}
\label{d3/d8b/a00059}\index{mln::accu::count\_\-labels@{mln::accu::count\_\-labels}}
}


Count the number of different labels in an image.  




{\ttfamily \#include $<$count\_\-labels.hh$>$}



Inherits base$<$ unsigned, count\_\-labels$<$ L $>$ $>$.

\subsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
bool \hyperlink{a00059_aefd68cdfd6fbc55fdf6f7c1daa7a29ea}{is\_\-valid} () const 
\begin{DoxyCompactList}\small\item\em Check whether this accu is able to return a result. \item\end{DoxyCompactList}\item 
void \hyperlink{a00026_a745794a4ef16926d3c09ebbaa8b6b557}{take\_\-as\_\-init} (const T \&t)
\begin{DoxyCompactList}\small\item\em Take as initialization the value {\ttfamily t}. \item\end{DoxyCompactList}\item 
void \hyperlink{a00026_a138e094daa1a85f345bbdfd852c9fc67}{take\_\-n\_\-times} (unsigned n, const T \&t)
\begin{DoxyCompactList}\small\item\em Take {\ttfamily n} times the value {\ttfamily t}. \item\end{DoxyCompactList}\item 
unsigned \hyperlink{a00059_a28485accf695d45ab016b93bbb132070}{to\_\-result} () const 
\begin{DoxyCompactList}\small\item\em Get the value of the accumulator. \item\end{DoxyCompactList}\end{DoxyCompactItemize}
\begin{Indent}{\bf }\par
{\em \label{_amgrpd41d8cd98f00b204e9800998ecf8427e}
 }\begin{DoxyCompactItemize}
\item 
void \hyperlink{a00059_ae7445d32702e936f542066b05063c50c}{init} ()
\begin{DoxyCompactList}\small\item\em Manipulators. \item\end{DoxyCompactList}\item 
void \hyperlink{a00059_abda1905017c8f5b9462f9ccc073c61e1}{set\_\-value} (unsigned c)
\begin{DoxyCompactList}\small\item\em Force the value of the counter to {\itshape c\/}. \item\end{DoxyCompactList}\end{DoxyCompactItemize}
\end{Indent}


\subsection{Detailed Description}
\subsubsection*{template$<$typename L$>$ struct mln::accu::count\_\-labels$<$ L $>$}

Count the number of different labels in an image. The parameter {\itshape L\/} is the label type to be count. 

Definition at line 52 of file count\_\-labels.hh.



\subsection{Member Function Documentation}
\hypertarget{a00059_ae7445d32702e936f542066b05063c50c}{
\index{mln::accu::count\_\-labels@{mln::accu::count\_\-labels}!init@{init}}
\index{init@{init}!mln::accu::count_labels@{mln::accu::count\_\-labels}}
\subsubsection[{init}]{\setlength{\rightskip}{0pt plus 5cm}template$<$typename L $>$ void {\bf mln::accu::count\_\-labels}$<$ L $>$::init (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}inline\mbox{]}}}}
\label{d3/d8b/a00059_ae7445d32702e936f542066b05063c50c}


Manipulators. 



Definition at line 113 of file count\_\-labels.hh.

\hypertarget{a00059_aefd68cdfd6fbc55fdf6f7c1daa7a29ea}{
\index{mln::accu::count\_\-labels@{mln::accu::count\_\-labels}!is\_\-valid@{is\_\-valid}}
\index{is\_\-valid@{is\_\-valid}!mln::accu::count_labels@{mln::accu::count\_\-labels}}
\subsubsection[{is\_\-valid}]{\setlength{\rightskip}{0pt plus 5cm}template$<$typename L $>$ bool {\bf mln::accu::count\_\-labels}$<$ L $>$::is\_\-valid (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
) const\hspace{0.3cm}{\ttfamily  \mbox{[}inline\mbox{]}}}}
\label{d3/d8b/a00059_aefd68cdfd6fbc55fdf6f7c1daa7a29ea}


Check whether this accu is able to return a result. 

Always true here. 

Definition at line 163 of file count\_\-labels.hh.

\hypertarget{a00059_abda1905017c8f5b9462f9ccc073c61e1}{
\index{mln::accu::count\_\-labels@{mln::accu::count\_\-labels}!set\_\-value@{set\_\-value}}
\index{set\_\-value@{set\_\-value}!mln::accu::count_labels@{mln::accu::count\_\-labels}}
\subsubsection[{set\_\-value}]{\setlength{\rightskip}{0pt plus 5cm}template$<$typename L $>$ void {\bf mln::accu::count\_\-labels}$<$ L $>$::set\_\-value (
\begin{DoxyParamCaption}
\item[{unsigned}]{ c}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}inline\mbox{]}}}}
\label{d3/d8b/a00059_abda1905017c8f5b9462f9ccc073c61e1}


Force the value of the counter to {\itshape c\/}. 



Definition at line 155 of file count\_\-labels.hh.

\hypertarget{a00026_a745794a4ef16926d3c09ebbaa8b6b557}{
\index{mln::accu::count\_\-labels@{mln::accu::count\_\-labels}!take\_\-as\_\-init@{take\_\-as\_\-init}}
\index{take\_\-as\_\-init@{take\_\-as\_\-init}!mln::accu::count_labels@{mln::accu::count\_\-labels}}
\subsubsection[{take\_\-as\_\-init}]{\setlength{\rightskip}{0pt plus 5cm}void {\bf mln::Accumulator}$<$ {\bf count\_\-labels}$<$ L $>$  $>$::take\_\-as\_\-init (
\begin{DoxyParamCaption}
\item[{const T \&}]{ t}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}inherited\mbox{]}}}}
\label{d6/d5b/a00026_a745794a4ef16926d3c09ebbaa8b6b557}


Take as initialization the value {\ttfamily t}. 

Dev note: this is a final method; override if needed by take\_\-as\_\-init\_\- (ending with '\_\-'). \hypertarget{a00026_a138e094daa1a85f345bbdfd852c9fc67}{
\index{mln::accu::count\_\-labels@{mln::accu::count\_\-labels}!take\_\-n\_\-times@{take\_\-n\_\-times}}
\index{take\_\-n\_\-times@{take\_\-n\_\-times}!mln::accu::count_labels@{mln::accu::count\_\-labels}}
\subsubsection[{take\_\-n\_\-times}]{\setlength{\rightskip}{0pt plus 5cm}void {\bf mln::Accumulator}$<$ {\bf count\_\-labels}$<$ L $>$  $>$::take\_\-n\_\-times (
\begin{DoxyParamCaption}
\item[{unsigned}]{ n, }
\item[{const T \&}]{ t}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}inherited\mbox{]}}}}
\label{d6/d5b/a00026_a138e094daa1a85f345bbdfd852c9fc67}


Take {\ttfamily n} times the value {\ttfamily t}. 

Dev note: this is a final method; override if needed by take\_\-as\_\-init\_\- (ending with '\_\-'). \hypertarget{a00059_a28485accf695d45ab016b93bbb132070}{
\index{mln::accu::count\_\-labels@{mln::accu::count\_\-labels}!to\_\-result@{to\_\-result}}
\index{to\_\-result@{to\_\-result}!mln::accu::count_labels@{mln::accu::count\_\-labels}}
\subsubsection[{to\_\-result}]{\setlength{\rightskip}{0pt plus 5cm}template$<$typename L $>$ unsigned {\bf mln::accu::count\_\-labels}$<$ L $>$::to\_\-result (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
) const\hspace{0.3cm}{\ttfamily  \mbox{[}inline\mbox{]}}}}
\label{d3/d8b/a00059_a28485accf695d45ab016b93bbb132070}


Get the value of the accumulator. 



Definition at line 146 of file count\_\-labels.hh.

