ITK  4.8.0
Insight Segmentation and Registration Toolkit
itkBinaryMorphologyImageFilter.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0.txt
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *=========================================================================*/
18 #ifndef itkBinaryMorphologyImageFilter_h
19 #define itkBinaryMorphologyImageFilter_h
20 
21 #include <vector>
22 #include <queue>
23 #include "itkKernelImageFilter.h"
26 #include "itkImageRegionIterator.h"
27 #include "itkConceptChecking.h"
28 
29 namespace itk
30 {
102 template< typename TInputImage, typename TOutputImage, typename TKernel >
104  public KernelImageFilter< TInputImage, TOutputImage, TKernel >
105 {
106 public:
107 
109  itkStaticConstMacro(InputImageDimension, unsigned int,
110  TInputImage::ImageDimension);
111  itkStaticConstMacro(OutputImageDimension, unsigned int,
112  TOutputImage::ImageDimension);
114 
116  itkStaticConstMacro(KernelDimension, unsigned int,
117  TKernel::NeighborhoodDimension);
118 
120  typedef TInputImage InputImageType;
121  typedef TOutputImage OutputImageType;
122 
128 
130  itkNewMacro(Self);
131 
134 
136  typedef TKernel KernelType;
137 
139  typedef typename KernelType::ConstIterator KernelIteratorType;
140 
142  typedef typename InputImageType::PixelType InputPixelType;
143  typedef typename OutputImageType::PixelType OutputPixelType;
145  typedef typename InputImageType::OffsetType OffsetType;
146  typedef typename InputImageType::IndexType IndexType;
148 
149  typedef typename InputImageType::RegionType InputImageRegionType;
150  typedef typename OutputImageType::RegionType OutputImageRegionType;
151  typedef typename InputImageType::SizeType InputSizeType;
153 
155  itkConceptMacro( ImageDimensionCheck,
156  ( Concept::SameDimension< itkGetStaticConstMacro(InputImageDimension),
157  itkGetStaticConstMacro(OutputImageDimension) > ) );
158 
162  itkSetMacro(ForegroundValue, InputPixelType);
163 
166  itkGetConstMacro(ForegroundValue, InputPixelType);
167 
172  itkSetMacro(BackgroundValue, OutputPixelType);
173 
178  itkGetConstMacro(BackgroundValue, OutputPixelType);
179 
182  itkSetMacro(BoundaryToForeground, bool);
183  itkGetConstReferenceMacro(BoundaryToForeground, bool);
184  itkBooleanMacro(BoundaryToForeground);
186 
188  void SetKernel(const KernelType & kernel) ITK_OVERRIDE;
189 
190 protected:
193  void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
194 
197  void AnalyzeKernel();
198 
200  typedef std::vector< OffsetType > NeighborIndexContainer;
201 
203  typedef std::vector< NeighborIndexContainer > NeighborIndexContainerContainer;
204 
206  typedef std::vector< OffsetType > ComponentVectorType;
207 
209  typedef typename ComponentVectorType::const_iterator
211 
215  { return m_KernelDifferenceSets[code]; }
216 
220  { return m_KernelCCVector.begin(); }
221 
225  { return m_KernelCCVector.end(); }
226 
228 
229 private:
230  BinaryMorphologyImageFilter(const Self &); //purposely not implemented
231  void operator=(const Self &); //purposely not implemented
232 
235 
238 
241 
245  std::vector< OffsetType > m_KernelCCVector;
246 };
247 } // end namespace itk
248 
249 #ifndef ITK_MANUAL_INSTANTIATION
250 #include "itkBinaryMorphologyImageFilter.hxx"
251 #endif
252 
253 #endif
std::vector< NeighborIndexContainer > NeighborIndexContainerContainer
InputImageType::IndexValueType IndexValueType
ComponentVectorConstIterator KernelCCVectorEnd()
InputImageType::SizeValueType InputSizeValueType
signed long IndexValueType
Definition: itkIntTypes.h:150
TInputImage::PixelType InputPixelType
TOutputImage::PixelType OutputPixelType
NeighborIndexContainerContainer m_KernelDifferenceSets
Base class for all process objects that output image data.
unsigned long SizeValueType
Definition: itkIntTypes.h:143
void SetKernel(const KernelType &kernel) override
NeighborIndexContainer & GetDifferenceSet(unsigned int code)
KernelImageFilter< InputImageType, OutputImageType, TKernel > Superclass
NumericTraits< InputPixelType >::RealType InputRealType
OutputImageType::RegionType OutputImageRegionType
A base class for all the filters working on an arbitrary shaped neighborhood.
void PrintSelf(std::ostream &os, Indent indent) const override
Base class for filters that take an image as input and produce an image as output.
Base class for fast binary dilation and erosion.
Control indentation during Print() invocation.
Definition: itkIndent.h:49
ComponentVectorType::const_iterator ComponentVectorConstIterator
ComponentVectorConstIterator KernelCCVectorBegin()
Define additional traits for native types such as int or float.
#define itkConceptMacro(name, concept)