Orfeo Toolbox  3.16
itkBinaryCrossStructuringElement.txx
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Insight Segmentation & Registration Toolkit
4  Module: $RCSfile: itkBinaryCrossStructuringElement.txx,v $
5  Language: C++
6  Date: $Date: 2006-03-18 20:10:36 $
7  Version: $Revision: 1.3 $
8 
9  Copyright (c) Insight Software Consortium. All rights reserved.
10  See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
11 
12  This software is distributed WITHOUT ANY WARRANTY; without even
13  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14  PURPOSE. See the above copyright notices for more information.
15 
16 =========================================================================*/
17 #ifndef __itkBinaryCrossStructuringElement_txx
18 #define __itkBinaryCrossStructuringElement_txx
20 
21 #include "itkNumericTraits.h"
22 
23 namespace itk
24 {
25 
26 // Create the structuring element
27 template <class TPixel, unsigned int VDimension, class TAllocator>
28 void
31 {
32  // Structuring element is defined to be 3x3x3...
33  RadiusType radius;
34  radius.Fill(1);
35  this->SetRadius(radius);
36 
37  //
38  // Zero out the neighborhood
39  //
40  Iterator kernel_it;
41  for (kernel_it=this->Begin(); kernel_it != this->End(); ++kernel_it)
42  {
43  *kernel_it = NumericTraits<TPixel>::Zero;
44  }
45 
46  //
47  // Set the face connected neighbors
48  //
49  unsigned int d;
51  OffsetType offset;
52  offset.Fill(0);
53  (*this)[offset] = NumericTraits<TPixel>::One;
54  for (d=0; d < VDimension; ++d)
55  {
56  for (i=-1; i<=1; i+=2)
57  {
58  offset[d] = i;
59  // a neighbor pixel in dimension d
60  (*this)[offset] = NumericTraits<TPixel>::One;
61  }
62  offset[d] = 0;
63  }
64 }
65 
66 } // namespace itk
67 
68 #endif

Generated at Sat Feb 2 2013 23:26:00 for Orfeo Toolbox with doxygen 1.8.1.1