ITK  6.0.0
Insight Toolkit
itkSpatialObjectToImageStatisticsCalculator.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 itkSpatialObjectToImageStatisticsCalculator_h
19#define itkSpatialObjectToImageStatisticsCalculator_h
20
21#include "itkObject.h"
22#include "itkMatrix.h"
23#include "itkNumericTraits.h"
24#include "itkListSample.h"
25#include "itkVector.h"
26
27namespace itk
28{
36template <typename TInputImage, typename TInputSpatialObject, unsigned int TSampleDimension = 1>
37class ITK_TEMPLATE_EXPORT SpatialObjectToImageStatisticsCalculator : public Object
38{
39public:
40 ITK_DISALLOW_COPY_AND_MOVE(SpatialObjectToImageStatisticsCalculator);
41
47
49 itkNewMacro(Self);
50
52 itkOverrideGetNameOfClassMacro(SpatialObjectToImageStatisticsCalculator);
53
55 using ImageType = TInputImage;
58 using PixelType = typename TInputImage::PixelType;
63
65
66 static constexpr unsigned int ImageDimension = ImageType::ImageDimension;
67
68 static constexpr unsigned int SampleDimension = TSampleDimension;
69
70 static constexpr unsigned int ObjectDimension = TInputSpatialObject::ObjectDimension;
71
73 using SpatialObjectType = TInputSpatialObject;
76
80
83
85 itkSetMacro(SampleDirection, unsigned int);
86 itkGetConstMacro(SampleDirection, unsigned int);
90 itkSetConstObjectMacro(Image, ImageType);
91
93 itkSetObjectMacro(SpatialObject, SpatialObjectType);
94
96 const VectorType &
97 GetMean() const
98 {
99 return m_Mean;
100 }
101
103 const MatrixType &
105 {
106 return m_CovarianceMatrix;
107 }
108
110 AccumulateType
111 GetSum() const
112 {
113 return m_Sum;
114 }
115
117 itkGetConstMacro(NumberOfPixels, SizeValueType);
118
120 void
122
123protected:
126 void
127 PrintSelf(std::ostream & os, Indent indent) const override;
128
130 bool
132
133private:
135 SpatialObjectPointer m_SpatialObject{};
136 VectorType m_Mean{};
138 SizeValueType m_NumberOfPixels{};
139 MatrixType m_CovarianceMatrix{};
140 unsigned int m_SampleDirection{};
141 ModifiedTimeType m_InternalImageTime{};
142 ModifiedTimeType m_InternalSpatialObjectTime{};
143 TimeStamp m_ModifiedTime{};
144
145 typename SampleType::Pointer m_Sample{};
146};
147} // end namespace itk
148
149#ifndef ITK_MANUAL_INSTANTIATION
150# include "itkSpatialObjectToImageStatisticsCalculator.hxx"
151#endif
152
153#endif /* itkSpatialObjectToImageStatisticsCalculator_h */
Templated n-dimensional image class.
Definition: itkImage.h:89
Control indentation during Print() invocation.
Definition: itkIndent.h:50
Light weight base class for most itk classes.
A templated class holding a M x N size Matrix.
Definition: itkMatrix.h:53
Define additional traits for native types such as int or float.
Base class for most ITK classes.
Definition: itkObject.h:62
typename NumericTraits< PixelType >::AccumulateType AccumulateType
~SpatialObjectToImageStatisticsCalculator() override=default
void PrintSelf(std::ostream &os, Indent indent) const override
Implementation of the composite pattern.
This class is the native implementation of the a Sample with an STL container.
Definition: itkListSample.h:52
Generate a unique, increasing time value.
Definition: itkTimeStamp.h:61
A templated class holding a n-Dimensional vector.
Definition: itkVector.h:63
SmartPointer< const Self > ConstPointer
SmartPointer< Self > Pointer
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
SizeValueType ModifiedTimeType
Definition: itkIntTypes.h:105
unsigned long SizeValueType
Definition: itkIntTypes.h:86