ITK  4.4.0
Insight Segmentation and Registration Toolkit
itkScalarImageKmeansImageFilter.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 __itkScalarImageKmeansImageFilter_h
19 #define __itkScalarImageKmeansImageFilter_h
20 
21 
22 #include "itkKdTree.h"
25 
28 #include "itkMinimumDecisionRule.h"
29 
31 
32 #include <vector>
33 
34 namespace itk
35 {
62 template< class TInputImage,
63  class TOutputImage = Image< unsigned char, TInputImage::ImageDimension > >
65  public ImageToImageFilter< TInputImage, TOutputImage >
66 {
67 public:
69  itkStaticConstMacro(ImageDimension, unsigned int,
70  TInputImage::ImageDimension);
71 
73  typedef TInputImage InputImageType;
74  typedef TOutputImage OutputImageType;
75 
81 
83  itkNewMacro(Self);
84 
87 
89  typedef typename InputImageType::PixelType InputPixelType;
90  typedef typename OutputImageType::PixelType OutputPixelType;
91 
94 
97 
100 
104 
106 
109 
111 
116 
118 
119  typedef typename InputImageType::RegionType ImageRegionType;
120 
124 
126  void AddClassWithInitialMean(RealPixelType mean);
127 
129  itkGetConstReferenceMacro(FinalMeans, ParametersType);
130 
136  itkSetMacro(UseNonContiguousLabels, bool);
137  itkGetConstReferenceMacro(UseNonContiguousLabels, bool);
138  itkBooleanMacro(UseNonContiguousLabels);
140 
142  void SetImageRegion(const ImageRegionType & region);
143 
145  itkGetConstReferenceMacro(ImageRegion, ImageRegionType);
146 
147 #ifdef ITK_USE_CONCEPT_CHECKING
148 
149  itkConceptMacro( InputHasNumericTraitsCheck,
151 
153 #endif
154 
155 protected:
158  void PrintSelf(std::ostream & os, Indent indent) const;
159 
165  void GenerateData();
166 
167  /* See superclass for doxygen. This methods additionally checks that
168  * the number of means is not 0. */
169  virtual void VerifyPreconditions();
170 
171 private:
172  ScalarImageKmeansImageFilter(const Self &); //purposely not implemented
173  void operator=(const Self &); //purposely not implemented
174 
175  typedef std::vector< RealPixelType > MeansContainer;
176 
178 
180 
182 
184 
186 };
187 } // end namespace itk
188 
189 #ifndef ITK_MANUAL_INSTANTIATION
190 #include "itkScalarImageKmeansImageFilter.hxx"
191 #endif
192 
193 #endif
194