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 
26 namespace itk
27 {
28 namespace Statistics
29 {
35 {
36 public:
41  enum class TextureFeature : uint8_t
42  {
43  Energy,
44  Entropy,
47  Inertia,
52  };
53 };
54 // Define how to print enumeration
55 extern ITKStatistics_EXPORT std::ostream &
57 
131 template <typename THistogram>
132 class ITK_TEMPLATE_EXPORT HistogramToTextureFeaturesFilter : public ProcessObject
133 {
134 public:
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 
183  const MeasurementObjectType *
184  GetEnergyOutput() const;
185 
188  GetEntropy() const;
189 
190  const MeasurementObjectType *
191  GetEntropyOutput() const;
192 
195  GetCorrelation() const;
196 
197  const MeasurementObjectType *
198  GetCorrelationOutput() const;
199 
202  GetInverseDifferenceMoment() const;
203 
204  const MeasurementObjectType *
205  GetInverseDifferenceMomentOutput() const;
206 
209  GetInertia() const;
210 
211  const MeasurementObjectType *
212  GetInertiaOutput() const;
213 
216  GetClusterShade() const;
217 
218  const MeasurementObjectType *
219  GetClusterShadeOutput() const;
220 
223  GetClusterProminence() const;
224 
225  const MeasurementObjectType *
226  GetClusterProminenceOutput() const;
227 
230  GetHaralickCorrelation() const;
231 
232  const MeasurementObjectType *
233  GetHaralickCorrelationOutput() const;
234 
236 #if !defined(ITK_LEGACY_REMOVE)
237 
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 
251  GetFeature(TextureFeatureEnum feature);
252 
253 protected:
255  ~HistogramToTextureFeaturesFilter() override = default;
256  void
257  PrintSelf(std::ostream & os, Indent indent) const override;
258 
261  using Superclass::MakeOutput;
263 
264  void
265  GenerateData() override;
266 
267 private:
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
Pointer
SmartPointer< Self > Pointer
Definition: itkAddImageFilter.h:93
itk::SimpleDataObjectDecorator
Decorates any "simple" data type (data types without smart pointers) with a DataObject API.
Definition: itkSimpleDataObjectDecorator.h:66
ConstPointer
SmartPointer< const Self > ConstPointer
Definition: itkAddImageFilter.h:94
itk::Statistics::HistogramToTextureFeaturesFilterEnums::TextureFeature::InvalidFeatureName
itk::Statistics::HistogramToTextureFeaturesFilterEnums::TextureFeature::Correlation
itk::Statistics::HistogramToTextureFeaturesFilter::RelativeFrequencyType
typename HistogramType::RelativeFrequencyType RelativeFrequencyType
Definition: itkHistogramToTextureFeaturesFilter.h:156
itk::Statistics::HistogramToTextureFeaturesFilterEnums::TextureFeature::ClusterProminence
itk::Statistics::HistogramToTextureFeaturesFilter::HistogramType
THistogram HistogramType
Definition: itkHistogramToTextureFeaturesFilter.h:149
itk::Statistics::HistogramToTextureFeaturesFilter::MeasurementVectorType
typename HistogramType::MeasurementVectorType MeasurementVectorType
Definition: itkHistogramToTextureFeaturesFilter.h:153
itk::Statistics::HistogramToTextureFeaturesFilter::MeasurementType
typename HistogramType::MeasurementType MeasurementType
Definition: itkHistogramToTextureFeaturesFilter.h:152
itk::SmartPointer< Self >
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::ProcessObject::DataObjectPointerArraySizeType
DataObjectPointerArray::size_type DataObjectPointerArraySizeType
Definition: itkProcessObject.h:194
itk::Statistics::HistogramToTextureFeaturesFilterEnums::TextureFeature::Entropy
itk::Statistics::operator<<
ITKStatistics_EXPORT std::ostream & operator<<(std::ostream &out, const ExpectationMaximizationMixtureModelEstimatorEnums::TERMINATION_CODE value)
itk::Statistics::HistogramToTextureFeaturesFilterEnums::TextureFeature::Energy
itk::Statistics::HistogramToTextureFeaturesFilter::HistogramConstPointer
typename HistogramType::ConstPointer HistogramConstPointer
Definition: itkHistogramToTextureFeaturesFilter.h:151
itk::Statistics::HistogramToTextureFeaturesFilterEnums::TextureFeature::HaralickCorrelation
itk::GTest::TypedefsAndConstructors::Dimension2::IndexType
ImageBaseType::IndexType IndexType
Definition: itkGTestTypedefsAndConstructors.h:50
itk::Statistics::HistogramToTextureFeaturesFilter::IndexType
typename HistogramType::IndexType IndexType
Definition: itkHistogramToTextureFeaturesFilter.h:154
itk::LightObject
Light weight base class for most itk classes.
Definition: itkLightObject.h:55
itkHistogram.h
itk::Statistics::HistogramToTextureFeaturesFilter::RelativeFrequencyContainerType
std::vector< RelativeFrequencyType > RelativeFrequencyContainerType
Definition: itkHistogramToTextureFeaturesFilter.h:163
itkMacro.h
itk::Statistics::HistogramToTextureFeaturesFilter::TotalAbsoluteFrequencyType
typename HistogramType::TotalAbsoluteFrequencyType TotalAbsoluteFrequencyType
Definition: itkHistogramToTextureFeaturesFilter.h:158
itk::Statistics::HistogramToTextureFeaturesFilterEnums::TextureFeature::InverseDifferenceMoment
itkProcessObject.h
itk::Statistics::HistogramToTextureFeaturesFilter
This class computes texture feature coefficients from a grey level co-occurrence matrix.
Definition: itkHistogramToTextureFeaturesFilter.h:132
itk::Statistics::HistogramToTextureFeaturesFilter::AbsoluteFrequencyType
typename HistogramType::AbsoluteFrequencyType AbsoluteFrequencyType
Definition: itkHistogramToTextureFeaturesFilter.h:155
itk::Statistics::HistogramToTextureFeaturesFilter::HistogramPointer
typename HistogramType::Pointer HistogramPointer
Definition: itkHistogramToTextureFeaturesFilter.h:150
itk::Statistics::HistogramToTextureFeaturesFilterEnums::TextureFeature
TextureFeature
Definition: itkHistogramToTextureFeaturesFilter.h:41
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnatomicalOrientation.h:29
itk::Statistics::HistogramToTextureFeaturesFilterEnums
This class contains all enum classes used by HistogramToTextureFeaturesFilter class.
Definition: itkHistogramToTextureFeaturesFilter.h:34
itk::ProcessObject
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
Definition: itkProcessObject.h:139
itk::Statistics::HistogramToTextureFeaturesFilter::TotalRelativeFrequencyType
typename HistogramType::TotalRelativeFrequencyType TotalRelativeFrequencyType
Definition: itkHistogramToTextureFeaturesFilter.h:160
itk::ProcessObject
class ITK_FORWARD_EXPORT ProcessObject
Definition: itkDataObject.h:41
itkSimpleDataObjectDecorator.h
itk::Statistics::HistogramToTextureFeaturesFilterEnums::TextureFeature::ClusterShade
itk::Statistics::HistogramToTextureFeaturesFilterEnums::TextureFeature::Inertia
itk::DataObject::Pointer
SmartPointer< Self > Pointer
Definition: itkDataObject.h:301