ITK  6.0.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:
41 enum class TextureFeature : uint8_t
42 {
43 Energy,
44 Entropy,
45 Correlation,
46 InverseDifferenceMoment,
47 Inertia,
48 ClusterShade,
49 ClusterProminence,
50 HaralickCorrelation,
51 InvalidFeatureName
52 };
53};
54// Define how to print enumeration
55extern ITKStatistics_EXPORT std::ostream &
57
131template <typename THistogram>
132class ITK_TEMPLATE_EXPORT HistogramToTextureFeaturesFilter : public ProcessObject
133{
134public:
135 ITK_DISALLOW_COPY_AND_MOVE(HistogramToTextureFeaturesFilter);
136
142
144 itkOverrideGetNameOfClassMacro(HistogramToTextureFeaturesFilter);
145
147 itkNewMacro(Self);
148
149 using HistogramType = THistogram;
152 using MeasurementType = typename HistogramType::MeasurementType;
153 using MeasurementVectorType = typename HistogramType::MeasurementVectorType;
155 using AbsoluteFrequencyType = typename HistogramType::AbsoluteFrequencyType;
156 using RelativeFrequencyType = typename HistogramType::RelativeFrequencyType;
157
158 using TotalAbsoluteFrequencyType = typename HistogramType::TotalAbsoluteFrequencyType;
159
160 using TotalRelativeFrequencyType = typename HistogramType::TotalRelativeFrequencyType;
161
163 using RelativeFrequencyContainerType = std::vector<RelativeFrequencyType>;
164
166 using Superclass::SetInput;
167 void
168 SetInput(const HistogramType * histogram);
169
170 const HistogramType *
171 GetInput() const;
172
175
178
181 GetEnergy() const;
182
185
188 GetEntropy() const;
189
192
196
199
203
206
209 GetInertia() const;
210
213
217
220
224
227
231
234
236#if !defined(ITK_LEGACY_REMOVE)
238 static constexpr TextureFeatureEnum Energy = TextureFeatureEnum::Energy;
239 static constexpr TextureFeatureEnum Entropy = TextureFeatureEnum::Entropy;
240 static constexpr TextureFeatureEnum Correlation = TextureFeatureEnum::Correlation;
241 static constexpr TextureFeatureEnum InverseDifferenceMoment = TextureFeatureEnum::InverseDifferenceMoment;
242 static constexpr TextureFeatureEnum Inertia = TextureFeatureEnum::Inertia;
243 static constexpr TextureFeatureEnum ClusterShade = TextureFeatureEnum::ClusterShade;
244 static constexpr TextureFeatureEnum ClusterProminence = TextureFeatureEnum::ClusterProminence;
245 static constexpr TextureFeatureEnum HaralickCorrelation = TextureFeatureEnum::HaralickCorrelation;
246 static constexpr TextureFeatureEnum InvalidFeatureName = TextureFeatureEnum::InvalidFeatureName;
247#endif
248
252
253protected:
256 void
257 PrintSelf(std::ostream & os, Indent indent) const override;
258
261 using Superclass::MakeOutput;
263
264 void
265 GenerateData() override;
266
267private:
268 void
269 ComputeMeansAndVariances(double & pixelMean,
270 double & marginalMean,
271 double & marginalDevSquared,
272 double & pixelVariance);
273
274 RelativeFrequencyContainerType m_RelativeFrequencyContainer{};
275};
276} // end of namespace Statistics
277} // end of namespace itk
278
279#ifndef ITK_MANUAL_INSTANTIATION
280# include "itkHistogramToTextureFeaturesFilter.hxx"
281#endif
282
283#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