ITK  5.0.0
Insight Segmentation and Registration Toolkit
itkSpatialObjectToImageStatisticsCalculator.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
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 {
35 template< typename TInputImage, typename TInputSpatialObject, unsigned int TSampleDimension = 1 >
36 class ITK_TEMPLATE_EXPORT SpatialObjectToImageStatisticsCalculator:public Object
37 {
38 public:
39  ITK_DISALLOW_COPY_AND_ASSIGN(SpatialObjectToImageStatisticsCalculator);
40 
43  using Superclass = Object;
46 
48  itkNewMacro(Self);
49 
52 
54  using ImageType = TInputImage;
55  using ImagePointer = typename TInputImage::Pointer;
56  using ImageConstPointer = typename TInputImage::ConstPointer;
57  using PixelType = typename TInputImage::PixelType;
61  using SizeType = typename RegionType::SizeType;
62 
64 
65  static constexpr unsigned int ImageDimension = ImageType::ImageDimension;
66 
67  static constexpr unsigned int SampleDimension = TSampleDimension;
68 
69  static constexpr unsigned int ObjectDimension = TInputSpatialObject::ObjectDimension;
70 
72  using SpatialObjectType = TInputSpatialObject;
73  using SpatialObjectPointer = typename SpatialObjectType::Pointer;
74  using SpatialObjectConstPointer = typename SpatialObjectType::ConstPointer;
75 
79 
82 
84  itkSetMacro(SampleDirection, unsigned int);
85  itkGetConstMacro(SampleDirection, unsigned int);
87 
89  itkSetConstObjectMacro(Image, ImageType);
90 
92  itkSetObjectMacro(SpatialObject, SpatialObjectType);
93 
95  const VectorType & GetMean() const { return m_Mean; }
96 
98  const MatrixType & GetCovarianceMatrix() const { return m_CovarianceMatrix; }
99 
101  AccumulateType GetSum() const { return m_Sum; }
102 
104  itkGetConstMacro(NumberOfPixels, SizeValueType);
105 
107  void Update();
108 
109 protected:
111  ~SpatialObjectToImageStatisticsCalculator() override = default;
112  void PrintSelf(std::ostream & os, Indent indent) const override;
113 
114  bool ComputeStatistics();
115 
116 private:
123  unsigned int m_SampleDirection;
127 
129 };
130 } // end namespace itk
131 
132 #ifndef ITK_MANUAL_INSTANTIATION
133 #include "itkSpatialObjectToImageStatisticsCalculator.hxx"
134 #endif
135 
136 #endif /* itkSpatialObjectToImageStatisticsCalculator_h */
Light weight base class for most itk classes.
Define numeric traits for std::vector.
unsigned long SizeValueType
Definition: itkIntTypes.h:83
Implementation of the composite pattern.
Generate a unique, increasing time value.
Definition: itkTimeStamp.h:60
unsigned long ModifiedTimeType
Definition: itkIntTypes.h:104
typename NumericTraits< PixelType >::AccumulateType AccumulateType
This class is the native implementation of the a Sample with an STL container.
Definition: itkListSample.h:51
Control indentation during Print() invocation.
Definition: itkIndent.h:49
Base class for most ITK classes.
Definition: itkObject.h:60
Templated n-dimensional image class.
Definition: itkImage.h:75