ITK  5.2.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  * 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 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:
42  enum class TextureFeature : uint8_t
43  {
44  Energy,
45  Entropy,
48  Inertia,
53  };
54 };
55 // Define how to print enumeration
56 extern ITKStatistics_EXPORT std::ostream &
58 
131 
132 template <typename THistogram>
133 class ITK_TEMPLATE_EXPORT HistogramToTextureFeaturesFilter : public ProcessObject
134 {
135 public:
136  ITK_DISALLOW_COPY_AND_MOVE(HistogramToTextureFeaturesFilter);
137 
143 
146 
148  itkNewMacro(Self);
149 
150  using HistogramType = THistogram;
151  using HistogramPointer = typename HistogramType::Pointer;
152  using HistogramConstPointer = typename HistogramType::ConstPointer;
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 
184  const MeasurementObjectType *
185  GetEnergyOutput() const;
186 
189  GetEntropy() const;
190 
191  const MeasurementObjectType *
192  GetEntropyOutput() const;
193 
196  GetCorrelation() const;
197 
198  const MeasurementObjectType *
199  GetCorrelationOutput() const;
200 
203  GetInverseDifferenceMoment() const;
204 
205  const MeasurementObjectType *
206  GetInverseDifferenceMomentOutput() const;
207 
210  GetInertia() const;
211 
212  const MeasurementObjectType *
213  GetInertiaOutput() const;
214 
217  GetClusterShade() const;
218 
219  const MeasurementObjectType *
220  GetClusterShadeOutput() const;
221 
224  GetClusterProminence() const;
225 
226  const MeasurementObjectType *
227  GetClusterProminenceOutput() const;
228 
231  GetHaralickCorrelation() const;
232 
233  const MeasurementObjectType *
234  GetHaralickCorrelationOutput() const;
235 
237 #if !defined(ITK_LEGACY_REMOVE)
238 
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 
252  GetFeature(TextureFeatureEnum feature);
253 
254 protected:
256  ~HistogramToTextureFeaturesFilter() override = default;
257  void
258  PrintSelf(std::ostream & os, Indent indent) const override;
259 
262  using Superclass::MakeOutput;
264 
265  void
266  GenerateData() override;
267 
268 private:
269  void
270  ComputeMeansAndVariances(double & pixelMean,
271  double & marginalMean,
272  double & marginalDevSquared,
273  double & pixelVariance);
274 
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
itk::SimpleDataObjectDecorator
Decorates any "simple" data type (data types without smart pointers) with a DataObject API.
Definition: itkSimpleDataObjectDecorator.h:66
itk::uint8_t
::uint8_t uint8_t
Definition: itkIntTypes.h:29
itk::Statistics::HistogramToTextureFeaturesFilter::RelativeFrequencyType
typename HistogramType::RelativeFrequencyType RelativeFrequencyType
Definition: itkHistogramToTextureFeaturesFilter.h:157
itk::Statistics::HistogramToTextureFeaturesFilter::HistogramType
THistogram HistogramType
Definition: itkHistogramToTextureFeaturesFilter.h:150
itk::Statistics::HistogramToTextureFeaturesFilterEnums::TextureFeature
TextureFeature
Definition: itkHistogramToTextureFeaturesFilter.h:42
itk::Statistics::HistogramToTextureFeaturesFilter::MeasurementVectorType
typename HistogramType::MeasurementVectorType MeasurementVectorType
Definition: itkHistogramToTextureFeaturesFilter.h:154
itk::Statistics::HistogramToTextureFeaturesFilterEnums::TextureFeature::Energy
itk::Statistics::HistogramToTextureFeaturesFilter::MeasurementType
typename HistogramType::MeasurementType MeasurementType
Definition: itkHistogramToTextureFeaturesFilter.h:153
itk::Statistics::HistogramToTextureFeaturesFilterEnums::TextureFeature::Inertia
itk::SmartPointer< Self >
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::ProcessObject::DataObjectPointerArraySizeType
DataObjectPointerArray::size_type DataObjectPointerArraySizeType
Definition: itkProcessObject.h:193
itk::Statistics::HistogramToTextureFeaturesFilterEnums::TextureFeature::InverseDifferenceMoment
itk::Statistics::operator<<
ITKStatistics_EXPORT std::ostream & operator<<(std::ostream &out, const ExpectationMaximizationMixtureModelEstimatorEnums::TERMINATION_CODE value)
itk::Statistics::HistogramToTextureFeaturesFilterEnums::TextureFeature::ClusterProminence
itk::Statistics::HistogramToTextureFeaturesFilter::HistogramConstPointer
typename HistogramType::ConstPointer HistogramConstPointer
Definition: itkHistogramToTextureFeaturesFilter.h:152
itk::GTest::TypedefsAndConstructors::Dimension2::IndexType
ImageBaseType::IndexType IndexType
Definition: itkGTestTypedefsAndConstructors.h:50
itk::Statistics::HistogramToTextureFeaturesFilter::IndexType
typename HistogramType::IndexType IndexType
Definition: itkHistogramToTextureFeaturesFilter.h:155
itk::LightObject
Light weight base class for most itk classes.
Definition: itkLightObject.h:59
itkHistogram.h
itk::Statistics::HistogramToTextureFeaturesFilter::RelativeFrequencyContainerType
std::vector< RelativeFrequencyType > RelativeFrequencyContainerType
Definition: itkHistogramToTextureFeaturesFilter.h:164
itkMacro.h
itk::Statistics::HistogramToTextureFeaturesFilter::TotalAbsoluteFrequencyType
typename HistogramType::TotalAbsoluteFrequencyType TotalAbsoluteFrequencyType
Definition: itkHistogramToTextureFeaturesFilter.h:159
itk::Statistics::HistogramToTextureFeaturesFilterEnums::TextureFeature::InvalidFeatureName
itkProcessObject.h
itk::Statistics::HistogramToTextureFeaturesFilter
This class computes texture feature coefficients from a grey level co-occurrence matrix.
Definition: itkHistogramToTextureFeaturesFilter.h:133
itk::Statistics::HistogramToTextureFeaturesFilter::AbsoluteFrequencyType
typename HistogramType::AbsoluteFrequencyType AbsoluteFrequencyType
Definition: itkHistogramToTextureFeaturesFilter.h:156
itk::Statistics::HistogramToTextureFeaturesFilter::HistogramPointer
typename HistogramType::Pointer HistogramPointer
Definition: itkHistogramToTextureFeaturesFilter.h:151
itk::Statistics::HistogramToTextureFeaturesFilterEnums::TextureFeature::Entropy
itk::Statistics::HistogramToTextureFeaturesFilter::m_RelativeFrequencyContainer
RelativeFrequencyContainerType m_RelativeFrequencyContainer
Definition: itkHistogramToTextureFeaturesFilter.h:275
itk::Statistics::HistogramToTextureFeaturesFilterEnums::TextureFeature::HaralickCorrelation
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
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:138
itk::Statistics::HistogramToTextureFeaturesFilter::TotalRelativeFrequencyType
typename HistogramType::TotalRelativeFrequencyType TotalRelativeFrequencyType
Definition: itkHistogramToTextureFeaturesFilter.h:161
itk::ProcessObject
class ITK_FORWARD_EXPORT ProcessObject
Definition: itkDataObject.h:41
itkSimpleDataObjectDecorator.h
TextureFeature
itk::Statistics::HistogramToTextureFeaturesFilterEnums::TextureFeature::ClusterShade
itk::Statistics::HistogramToTextureFeaturesFilterEnums::TextureFeature::Correlation
itk::DataObject::Pointer
SmartPointer< Self > Pointer
Definition: itkDataObject.h:301