18 #ifndef __itkConnectedComponentAlgorithm_h
19 #define __itkConnectedComponentAlgorithm_h
26 template<
typename TIterator >
30 typename TIterator::OffsetType offset;
31 it->ClearActiveList();
32 if ( !fullyConnected )
37 for (
unsigned int d = 0; d < TIterator::Dimension; ++d )
40 it->ActivateOffset(offset);
42 it->ActivateOffset(offset);
50 unsigned int centerIndex = it->GetCenterNeighborhoodIndex();
51 for (
unsigned int d = 0; d < centerIndex * 2 + 1; d++ )
53 offset = it->GetOffset(d);
54 it->ActivateOffset(offset);
57 it->DeactivateOffset(offset);
62 template<
typename TIterator >
67 typename TIterator::OffsetType offset;
68 it->ClearActiveList();
69 if ( !fullyConnected )
74 for (
unsigned int d = 0; d < TIterator::Dimension; ++d )
77 it->ActivateOffset(offset);
85 unsigned int centerIndex = it->GetCenterNeighborhoodIndex();
86 for (
unsigned int d = 0; d < centerIndex; d++ )
88 offset = it->GetOffset(d);
89 it->ActivateOffset(offset);
92 it->DeactivateOffset(offset);
97 template<
typename TIterator >
102 typename TIterator::OffsetType offset;
103 it->ClearActiveList();
104 if ( !fullyConnected )
109 for (
unsigned int d = 0; d < TIterator::Dimension; ++d )
112 it->ActivateOffset(offset);
120 unsigned int centerIndex = it->GetCenterNeighborhoodIndex();
121 for (
unsigned int d = centerIndex + 1; d < 2 * centerIndex + 1; d++ )
123 offset = it->GetOffset(d);
124 it->ActivateOffset(offset);
127 it->DeactivateOffset(offset);
TIterator * setConnectivityPrevious(TIterator *it, bool fullyConnected=false)
TIterator * setConnectivity(TIterator *it, bool fullyConnected=false)
TIterator * setConnectivityLater(TIterator *it, bool fullyConnected=false)