17 #ifndef __itkNeighborhoodAlgorithm_txx
18 #define __itkNeighborhoodAlgorithm_txx
27 namespace NeighborhoodAlgorithm {
29 template<
class TImage>
30 typename ImageBoundaryFacesCalculator<TImage>::FaceListType
41 const IndexType bStart = img->GetBufferedRegion().GetIndex();
42 const SizeType bSize = img->GetBufferedRegion().GetSize();
43 const IndexType rStart = regionToProcess.GetIndex();
44 const SizeType rSize = regionToProcess.GetSize();
46 long overlapLow, overlapHigh;
51 SizeType nbSize = regionToProcess.GetSize();
52 IndexType nbStart = regionToProcess.GetIndex();
55 for (i = 0; i < ImageDimension; ++i)
57 overlapLow =
static_cast<long>((rStart[i] - radius[i]) - bStart[i]);
58 overlapHigh=
static_cast<long>((bStart[i] + bSize[i]) - (rStart[i] + rSize[i] + radius[i]));
62 for (j = 0; j < ImageDimension; ++j)
64 fStart[j] = rStart[j];
67 fSize[j] = -overlapLow;
75 if (fSize[j] > rSize[j])
82 if (fSize[i] > nbSize[i])
88 nbSize[i] -= fSize[i];
90 nbStart[i] += -overlapLow;
91 fRegion.SetIndex(fStart);
92 fRegion.SetSize(fSize);
93 faceList.push_back(fRegion);
97 for (j = 0; j < ImageDimension; ++j)
101 fStart[j] = rStart[j] +
static_cast<IndexValueType>(rSize[j]) + overlapHigh;
102 fSize[j] = -overlapHigh;
106 if (fStart[j] < rStart[j])
108 fStart[j] = rStart[j];
114 fStart[j] = rStart[j];
119 if (fSize[i] > nbSize[i])
125 nbSize[i] -= fSize[i];
127 fRegion.SetIndex(fStart);
128 fRegion.SetSize(fSize);
129 faceList.push_back(fRegion);
132 nbRegion.SetSize(nbSize);
133 nbRegion.SetIndex(nbStart);
135 faceList.push_front(nbRegion);
139 template<
class TImage>
148 for (
int i=0; i<TImage::ImageDimension; ++i)
150 ans[i] = osz[i] - isz[i];