aimstil  5.0.5
connectedComponents3D.h
Go to the documentation of this file.
1 #ifndef TIL_CONNECTEDCOMPONENTS3D_H
2 #define TIL_CONNECTEDCOMPONENTS3D_H
3 
6 
7 // Standard library includes
8 #include <iostream>
9 
10 // Local includes
11 #include "til/til_common.h"
12 #include "til/EquivalenceChain.h"
13 #include "til/ImageExtrapolator.h"
14 #include "til/Neighborhood.h"
15 #include "til/neighborhoodTools.h"
16 
17 
18 // macro used inside connected components
19 // It puts the neighbor label inside neighborLabels and increase
20 // nLabeledNeighbors accordingly
21 // To be undefined at the end of the file
22 #define SPAN_NEIGHBORS(i,j,k) \
23  if (nh.template isNeighbor<(i),(j),(k)>() && \
24  ((neighborLabels[COFFSET(i,j,k)] = iIm.template getValue<TExtrapolator,(i),(j),(k)>()) != 0)) \
25  ++nLabeledNeighbors;
26 
27 namespace til
28 {
29 
30  //---------------------------------------------------------------------------
31 
34  template < typename TImage, typename TNeighborhood, typename TExtrapolator >
35  int connectedComponents(TImage &im, const TNeighborhood &nh);
36 
37  //---------------------------------------------------------------------------
38 
42  // TODO: this has to change: extrapolation of zero by default??? Remove #include "extrapol"
43  template < typename TImage, typename TNeighborhood >
44  int connectedComponents(TImage &im, const TNeighborhood &nh)
45  {
46  return connectedComponents<TImage, TNeighborhood, ZeroExtrapolator>(im,nh);
47  }
48 
49  //---------------------------------------------------------------------------
50 
51 } // namespace til
52 
53 // Undefine local macros
54 #undef SPAN_NEIGHBORS
55 
56 // package include
57 #include "connected_components.tpp"
58 
59 #endif
60 
Belongs to package Box Do not include directly, include til/Box.h instead.
Definition: Accumulator.h:10
General macros, definitions and functions.
int connectedComponents(TImage &im, const TNeighborhood &nh)
Label the connected components of image im.