ITK  5.4.0
Insight Toolkit
itkHistogramToTextureFeaturesFilter.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 itkHistogramToTextureFeaturesFilter_h
19#define itkHistogramToTextureFeaturesFilter_h
20
21#include "itkHistogram.h"
22#include "itkMacro.h"
23#include "itkProcessObject.h"
25
26namespace itk
27{
28namespace Statistics
29{
35{
36public:
42 enum class TextureFeature : uint8_t
43 {
44 Energy,
45 Entropy,
46 Correlation,
47 InverseDifferenceMoment,
48 Inertia,
49 ClusterShade,
50 ClusterProminence,
51 HaralickCorrelation,
52 InvalidFeatureName
53 };
54};
55// Define how to print enumeration
56extern ITKStatistics_EXPORT std::ostream &
58
132template <typename THistogram>
133class ITK_TEMPLATE_EXPORT HistogramToTextureFeaturesFilter : public ProcessObject
134{
135public:
136 ITK_DISALLOW_COPY_AND_MOVE(HistogramToTextureFeaturesFilter);
137
143
145 itkOverrideGetNameOfClassMacro(HistogramToTextureFeaturesFilter);
146
148 itkNewMacro(Self);
149
150 using HistogramType = THistogram;
153 using MeasurementType = typename HistogramType::MeasurementType;
154 using MeasurementVectorType = typename HistogramType::MeasurementVectorType;
156 using AbsoluteFrequencyType = typename HistogramType::AbsoluteFrequencyType;
157 using RelativeFrequencyType = typename HistogramType::RelativeFrequencyType;
158
159 using TotalAbsoluteFrequencyType = typename HistogramType::TotalAbsoluteFrequencyType;
160
161 using TotalRelativeFrequencyType = typename HistogramType::TotalRelativeFrequencyType;
162
164 using RelativeFrequencyContainerType = std::vector<RelativeFrequencyType>;
165
167 using Superclass::SetInput;
168 void
169 SetInput(const HistogramType * histogram);
170
171 const HistogramType *
172 GetInput() const;
173
176
179
182 GetEnergy() const;
183
186
189 GetEntropy() const;
190
193
197
200
204
207
210 GetInertia() const;
211
214
218
221
225
228
232
235
237#if !defined(ITK_LEGACY_REMOVE)
239 static constexpr TextureFeatureEnum Energy = TextureFeatureEnum::Energy;
240 static constexpr TextureFeatureEnum Entropy = TextureFeatureEnum::Entropy;
241 static constexpr TextureFeatureEnum Correlation = TextureFeatureEnum::Correlation;
242 static constexpr TextureFeatureEnum InverseDifferenceMoment = TextureFeatureEnum::InverseDifferenceMoment;
243 static constexpr TextureFeatureEnum Inertia = TextureFeatureEnum::Inertia;
244 static constexpr TextureFeatureEnum ClusterShade = TextureFeatureEnum::ClusterShade;
245 static constexpr TextureFeatureEnum ClusterProminence = TextureFeatureEnum::ClusterProminence;
246 static constexpr TextureFeatureEnum HaralickCorrelation = TextureFeatureEnum::HaralickCorrelation;
247 static constexpr TextureFeatureEnum InvalidFeatureName = TextureFeatureEnum::InvalidFeatureName;
248#endif
249
253
254protected:
257 void
258 PrintSelf(std::ostream & os, Indent indent) const override;
259
262 using Superclass::MakeOutput;
264
265 void
266 GenerateData() override;
267
268private:
269 void
270 ComputeMeansAndVariances(double & pixelMean,
271 double & marginalMean,
272 double & marginalDevSquared,
273 double & pixelVariance);
274
275 RelativeFrequencyContainerType m_RelativeFrequencyContainer{};
276};
277} // end of namespace Statistics
278} // end of namespace itk
279
280#ifndef ITK_MANUAL_INSTANTIATION
281# include "itkHistogramToTextureFeaturesFilter.hxx"
282#endif
283
284#endif
SmartPointer< Self > Pointer
Control indentation during Print() invocation.
Definition: itkIndent.h:50
Light weight base class for most itk classes.
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
DataObjectPointerArray::size_type DataObjectPointerArraySizeType
Decorates any "simple" data type (data types without smart pointers) with a DataObject API.
This class contains all enum classes used by HistogramToTextureFeaturesFilter class.
This class computes texture feature coefficients from a grey level co-occurrence matrix.
typename HistogramType::TotalAbsoluteFrequencyType TotalAbsoluteFrequencyType
DataObjectPointer MakeOutput(DataObjectPointerArraySizeType) override
Make a DataObject of the correct type to used as the specified output.
const MeasurementObjectType * GetHaralickCorrelationOutput() const
const MeasurementObjectType * GetEnergyOutput() const
typename HistogramType::AbsoluteFrequencyType AbsoluteFrequencyType
void SetInput(const HistogramType *histogram)
void PrintSelf(std::ostream &os, Indent indent) const override
const MeasurementObjectType * GetInertiaOutput() const
typename HistogramType::TotalRelativeFrequencyType TotalRelativeFrequencyType
const MeasurementObjectType * GetCorrelationOutput() const
const MeasurementObjectType * GetClusterShadeOutput() const
MeasurementType GetFeature(TextureFeatureEnum feature)
const MeasurementObjectType * GetClusterProminenceOutput() const
void ComputeMeansAndVariances(double &pixelMean, double &marginalMean, double &marginalDevSquared, double &pixelVariance)
const MeasurementObjectType * GetInverseDifferenceMomentOutput() const
typename HistogramType::MeasurementVectorType MeasurementVectorType
const MeasurementObjectType * GetEntropyOutput() const
typename HistogramType::RelativeFrequencyType RelativeFrequencyType
SmartPointer< const Self > ConstPointer
SmartPointer< Self > Pointer
ITKStatistics_EXPORT std::ostream & operator<<(std::ostream &out, const ExpectationMaximizationMixtureModelEstimatorEnums::TERMINATION_CODE value)
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
class ITK_FORWARD_EXPORT ProcessObject
Definition: itkDataObject.h:41