ITK 6.0.0
Insight Toolkit
 
Loading...
Searching...
No Matches
itkScalarImageKmeansImageFilter.h
Go to the documentation of this file.
1/*=========================================================================
2 *
3 * Copyright NumFOCUS
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 * https://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
29
31
32#include <vector>
33
34namespace itk
35{
64template <typename TInputImage, typename TOutputImage = Image<unsigned char, TInputImage::ImageDimension>>
65class ITK_TEMPLATE_EXPORT ScalarImageKmeansImageFilter : public ImageToImageFilter<TInputImage, TOutputImage>
66{
67public:
68 ITK_DISALLOW_COPY_AND_MOVE(ScalarImageKmeansImageFilter);
69
71 static constexpr unsigned int ImageDimension = TInputImage::ImageDimension;
72
74 using InputImageType = TInputImage;
75 using OutputImageType = TOutputImage;
76
82
84 itkNewMacro(Self);
85
87 itkOverrideGetNameOfClassMacro(ScalarImageKmeansImageFilter);
88
90 using InputPixelType = typename InputImageType::PixelType;
91 using OutputPixelType = typename OutputImageType::PixelType;
92
95
98
101
105
107
110
112
117
119
120 using ImageRegionType = typename InputImageType::RegionType;
121
123
125 void
127
129 itkGetConstReferenceMacro(FinalMeans, ParametersType);
130
136 itkSetMacro(UseNonContiguousLabels, bool);
137 itkGetConstReferenceMacro(UseNonContiguousLabels, bool);
138 itkBooleanMacro(UseNonContiguousLabels);
140
142 void
144
146 itkGetConstReferenceMacro(ImageRegion, ImageRegionType);
147
148 itkConceptMacro(InputHasNumericTraitsCheck, (Concept::HasNumericTraits<InputPixelType>));
149
150protected:
152 ~ScalarImageKmeansImageFilter() override = default;
153 void
154 PrintSelf(std::ostream & os, Indent indent) const override;
155
161 void
162 GenerateData() override;
163
164 /* See superclass for doxygen. This methods additionally checks that
165 * the number of means is not 0. */
166 void
167 VerifyPreconditions() const override;
168
169private:
170 using MeansContainer = std::vector<RealPixelType>;
171
173
175
177
179
180 bool m_ImageRegionDefined{ false };
181};
182} // end namespace itk
183
184#ifndef ITK_MANUAL_INSTANTIATION
185# include "itkScalarImageKmeansImageFilter.hxx"
186#endif
187
188#endif
An image region represents a structured region of data.
Control indentation during Print() invocation.
Definition itkIndent.h:50
Extract a region of interest from the input image.
itk::Statistics::KdTreeBasedKmeansEstimator< TreeType > EstimatorType
typename EstimatorType::ParametersType ParametersType
typename InputImageType::RegionType ImageRegionType
itk::Statistics::DistanceToCentroidMembershipFunction< MeasurementVectorType > MembershipFunctionType
typename TreeGeneratorType::KdTreeType TreeType
typename OutputImageType::PixelType OutputPixelType
void VerifyPreconditions() const override
Verifies that the process object has been configured correctly, that all required inputs are set,...
itk::Statistics::ImageToListSampleAdaptor< InputImageType > AdaptorType
typename ClassifierType::MembershipFunctionVectorType MembershipFunctionVectorType
~ScalarImageKmeansImageFilter() override=default
itk::Statistics::SampleClassifierFilter< AdaptorType > ClassifierType
itk::Statistics::WeightedCentroidKdTreeGenerator< AdaptorType > TreeGeneratorType
void AddClassWithInitialMean(RealPixelType mean)
typename AdaptorType::MeasurementVectorType MeasurementVectorType
typename ClassifierType::ClassLabelVectorType ClassLabelVectorType
void PrintSelf(std::ostream &os, Indent indent) const override
typename InputImageType::PixelType InputPixelType
typename MembershipFunctionType::CentroidType MembershipFunctionOriginType
typename NumericTraits< InputPixelType >::RealType RealPixelType
void SetImageRegion(const ImageRegionType &region)
ImageToImageFilter< InputImageType, OutputImageType > Superclass
typename MembershipFunctionType::Pointer MembershipFunctionPointer
itk::Statistics::MinimumDecisionRule DecisionRuleType
RegionOfInterestImageFilter< InputImageType, InputImageType > RegionOfInterestFilterType
Implements transparent reference counting.
DistanceToCentroidMembershipFunction models class membership using a distance metric.
This class provides ListSample interface to ITK Image.
typename MeasurementPixelTraitsType::MeasurementVectorType MeasurementVectorType
fast k-means algorithm implementation using k-d tree structure
A decision rule that returns the class label with the smallest discriminant score.
std::vector< MembershipFunctionPointer > MembershipFunctionVectorType
This class generates a KdTree object with centroid information.
#define itkConceptMacro(name, concept)
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....