ITK  4.6.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< typename TInputImage,
63  typename 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 
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  // Begin concept checking
149  itkConceptMacro( InputHasNumericTraitsCheck,
151  // End concept checking
152 #endif
153 
154 protected:
157  void PrintSelf(std::ostream & os, Indent indent) const;
158 
164  void GenerateData();
165 
166  /* See superclass for doxygen. This methods additionally checks that
167  * the number of means is not 0. */
168  virtual void VerifyPreconditions();
169 
170 private:
171  ScalarImageKmeansImageFilter(const Self &); //purposely not implemented
172  void operator=(const Self &); //purposely not implemented
173 
174  typedef std::vector< RealPixelType > MeansContainer;
175 
177 
179 
181 
183 
185 };
186 } // end namespace itk
187 
188 #ifndef ITK_MANUAL_INSTANTIATION
189 #include "itkScalarImageKmeansImageFilter.hxx"
190 #endif
191 
192 #endif
void PrintSelf(std::ostream &os, Indent indent) const
itk::Statistics::MinimumDecisionRule DecisionRuleType
fast k-means algorithm implementation using k-d tree structure
NumericTraits< InputPixelType >::RealType RealPixelType
itk::Statistics::ImageToListSampleAdaptor< InputImageType > AdaptorType
An image region represents a structured region of data.
Base class for all process objects that output image data.
A decision rule that returns the class label with the smallest discriminant score.
ClassifierType::MembershipFunctionVectorType MembershipFunctionVectorType
itk::Statistics::KdTreeBasedKmeansEstimator< TreeType > EstimatorType
This class generates a KdTree object with centroid information.
itk::Statistics::DistanceToCentroidMembershipFunction< MeasurementVectorType > MembershipFunctionType
virtual void VerifyPreconditions()
Verifies that the process object has been configured correctly, that all required inputs are set...
MeasurementPixelTraitsType::MeasurementVectorType MeasurementVectorType
void SetImageRegion(const ImageRegionType &region)
std::vector< MembershipFunctionPointer > MembershipFunctionVectorType
itk::Statistics::SampleClassifierFilter< AdaptorType > ClassifierType
Classifies the intensity values of a scalar image using the K-Means algorithm.
ClassifierType::ClassLabelVectorType ClassLabelVectorType
Extract a region of interest from the input image.
RegionOfInterestImageFilter< InputImageType, InputImageType > RegionOfInterestFilterType
DistanceToCentroidMembershipFunction models class membership using a distance metric.
std::vector< ClassLabelType > ClassLabelVectorType
Base class for filters that take an image as input and produce an image as output.
Control indentation during Print() invocation.
Definition: itkIndent.h:49
void AddClassWithInitialMean(RealPixelType mean)
ImageToImageFilter< InputImageType, OutputImageType > Superclass
Define additional traits for native types such as int or float.
This class provides ListSample interface to ITK Image.
#define itkConceptMacro(name, concept)
AdaptorType::MeasurementVectorType MeasurementVectorType
MembershipFunctionType::CentroidType MembershipFunctionOriginType
itk::Statistics::WeightedCentroidKdTreeGenerator< AdaptorType > TreeGeneratorType
MembershipFunctionType::Pointer MembershipFunctionPointer