ITK  5.2.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  * 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 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 
27 namespace itk
28 {
36 template <typename TInputImage, typename TInputSpatialObject, unsigned int TSampleDimension = 1>
37 class ITK_TEMPLATE_EXPORT SpatialObjectToImageStatisticsCalculator : public Object
38 {
39 public:
40  ITK_DISALLOW_COPY_AND_ASSIGN(SpatialObjectToImageStatisticsCalculator);
41 
44  using Superclass = Object;
47 
49  itkNewMacro(Self);
50 
53 
55  using ImageType = TInputImage;
56  using ImagePointer = typename TInputImage::Pointer;
57  using ImageConstPointer = typename TInputImage::ConstPointer;
58  using PixelType = typename TInputImage::PixelType;
62  using SizeType = typename RegionType::SizeType;
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;
74  using SpatialObjectPointer = typename SpatialObjectType::Pointer;
75  using SpatialObjectConstPointer = typename SpatialObjectType::ConstPointer;
76 
80 
83 
85  itkSetMacro(SampleDirection, unsigned int);
86  itkGetConstMacro(SampleDirection, unsigned int);
88 
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
121  Update();
122 
123 protected:
125  ~SpatialObjectToImageStatisticsCalculator() override = default;
126  void
127  PrintSelf(std::ostream & os, Indent indent) const override;
128 
129  bool
130  ComputeStatistics();
131 
132 private:
139  unsigned int m_SampleDirection;
143 
145 };
146 } // end namespace itk
147 
148 #ifndef ITK_MANUAL_INSTANTIATION
149 # include "itkSpatialObjectToImageStatisticsCalculator.hxx"
150 #endif
151 
152 #endif /* itkSpatialObjectToImageStatisticsCalculator_h */
itk::SpatialObjectToImageStatisticsCalculator::SpatialObjectType
TInputSpatialObject SpatialObjectType
Definition: itkSpatialObjectToImageStatisticsCalculator.h:73
itk::SpatialObjectToImageStatisticsCalculator::GetSum
AccumulateType GetSum() const
Definition: itkSpatialObjectToImageStatisticsCalculator.h:111
itk::SpatialObjectToImageStatisticsCalculator::GetCovarianceMatrix
const MatrixType & GetCovarianceMatrix() const
Definition: itkSpatialObjectToImageStatisticsCalculator.h:104
itk::ModifiedTimeType
SizeValueType ModifiedTimeType
Definition: itkIntTypes.h:102
itkMatrix.h
itk::GTest::TypedefsAndConstructors::Dimension2::PointType
ImageBaseType::PointType PointType
Definition: itkGTestTypedefsAndConstructors.h:51
itk::Vector< double, TSampleDimension >
itk::SpatialObjectToImageStatisticsCalculator::m_SampleDirection
unsigned int m_SampleDirection
Definition: itkSpatialObjectToImageStatisticsCalculator.h:139
itk::SpatialObjectToImageStatisticsCalculator::m_CovarianceMatrix
MatrixType m_CovarianceMatrix
Definition: itkSpatialObjectToImageStatisticsCalculator.h:138
itk::GTest::TypedefsAndConstructors::Dimension2::SizeType
ImageBaseType::SizeType SizeType
Definition: itkGTestTypedefsAndConstructors.h:49
itk::Statistics::ListSample
This class is the native implementation of the a Sample with an STL container.
Definition: itkListSample.h:51
itk::SpatialObjectToImageStatisticsCalculator::SizeType
typename RegionType::SizeType SizeType
Definition: itkSpatialObjectToImageStatisticsCalculator.h:62
itk::SmartPointer< Self >
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::SpatialObjectToImageStatisticsCalculator::ImageConstPointer
typename TInputImage::ConstPointer ImageConstPointer
Definition: itkSpatialObjectToImageStatisticsCalculator.h:57
itk::GTest::TypedefsAndConstructors::Dimension2::IndexType
ImageBaseType::IndexType IndexType
Definition: itkGTestTypedefsAndConstructors.h:50
itk::SpatialObjectToImageStatisticsCalculator::PointType
typename TInputImage::PointType PointType
Definition: itkSpatialObjectToImageStatisticsCalculator.h:60
itk::LightObject
Light weight base class for most itk classes.
Definition: itkLightObject.h:59
itk::SpatialObjectToImageStatisticsCalculator::SpatialObjectPointer
typename SpatialObjectType::Pointer SpatialObjectPointer
Definition: itkSpatialObjectToImageStatisticsCalculator.h:74
itk::SpatialObjectToImageStatisticsCalculator
Definition: itkSpatialObjectToImageStatisticsCalculator.h:37
itk::SpatialObjectToImageStatisticsCalculator::m_InternalSpatialObjectTime
ModifiedTimeType m_InternalSpatialObjectTime
Definition: itkSpatialObjectToImageStatisticsCalculator.h:141
itk::SpatialObjectToImageStatisticsCalculator::AccumulateType
typename NumericTraits< PixelType >::AccumulateType AccumulateType
Definition: itkSpatialObjectToImageStatisticsCalculator.h:64
itk::GTest::TypedefsAndConstructors::Dimension2::RegionType
ImageBaseType::RegionType RegionType
Definition: itkGTestTypedefsAndConstructors.h:54
itk::SpatialObjectToImageStatisticsCalculator::m_Sum
AccumulateType m_Sum
Definition: itkSpatialObjectToImageStatisticsCalculator.h:136
itk::SpatialObjectToImageStatisticsCalculator::GetMean
const VectorType & GetMean() const
Definition: itkSpatialObjectToImageStatisticsCalculator.h:97
itk::SpatialObject
Implementation of the composite pattern.
Definition: itkSpatialObject.h:57
itk::TimeStamp
Generate a unique, increasing time value.
Definition: itkTimeStamp.h:60
itk::SpatialObjectToImageStatisticsCalculator::m_ModifiedTime
TimeStamp m_ModifiedTime
Definition: itkSpatialObjectToImageStatisticsCalculator.h:142
itkListSample.h
itk::Matrix< double, TSampleDimension, TSampleDimension >
itk::SpatialObjectToImageStatisticsCalculator::m_InternalImageTime
ModifiedTimeType m_InternalImageTime
Definition: itkSpatialObjectToImageStatisticsCalculator.h:140
itk::NumericTraits
Define additional traits for native types such as int or float.
Definition: itkNumericTraits.h:58
itk::SpatialObjectToImageStatisticsCalculator::SpatialObjectConstPointer
typename SpatialObjectType::ConstPointer SpatialObjectConstPointer
Definition: itkSpatialObjectToImageStatisticsCalculator.h:75
itk::SpatialObjectToImageStatisticsCalculator::ImagePointer
typename TInputImage::Pointer ImagePointer
Definition: itkSpatialObjectToImageStatisticsCalculator.h:56
itkObject.h
itk::SpatialObjectToImageStatisticsCalculator::IndexType
typename TInputImage::IndexType IndexType
Definition: itkSpatialObjectToImageStatisticsCalculator.h:59
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itkVector.h
itk::SpatialObjectToImageStatisticsCalculator::m_Image
ImageConstPointer m_Image
Definition: itkSpatialObjectToImageStatisticsCalculator.h:133
itk::Object
Base class for most ITK classes.
Definition: itkObject.h:60
itk::SpatialObjectToImageStatisticsCalculator::RegionType
typename TInputImage::RegionType RegionType
Definition: itkSpatialObjectToImageStatisticsCalculator.h:61
itkNumericTraits.h
itk::SpatialObjectToImageStatisticsCalculator::m_SpatialObject
SpatialObjectPointer m_SpatialObject
Definition: itkSpatialObjectToImageStatisticsCalculator.h:134
itk::Image
Templated n-dimensional image class.
Definition: itkImage.h:86
itk::SpatialObjectToImageStatisticsCalculator::PixelType
typename TInputImage::PixelType PixelType
Definition: itkSpatialObjectToImageStatisticsCalculator.h:58
itk::SpatialObjectToImageStatisticsCalculator::m_Sample
SampleType::Pointer m_Sample
Definition: itkSpatialObjectToImageStatisticsCalculator.h:144
itk::SpatialObjectToImageStatisticsCalculator::m_Mean
VectorType m_Mean
Definition: itkSpatialObjectToImageStatisticsCalculator.h:135
itk::SpatialObjectToImageStatisticsCalculator::ImageType
TInputImage ImageType
Definition: itkSpatialObjectToImageStatisticsCalculator.h:55
itk::SpatialObjectToImageStatisticsCalculator::m_NumberOfPixels
SizeValueType m_NumberOfPixels
Definition: itkSpatialObjectToImageStatisticsCalculator.h:137
itk::SizeValueType
unsigned long SizeValueType
Definition: itkIntTypes.h:83