ITK  4.13.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"
23 #include "itkMatrix.h"
24 #include "itkNumericTraits.h"
25 #include "itkListSample.h"
26 #include "itkVector.h"
27 
28 namespace itk
29 {
36 template< typename TInputImage, typename TInputSpatialObject, unsigned int TSampleDimension = 1 >
37 class ITK_TEMPLATE_EXPORT SpatialObjectToImageStatisticsCalculator:public Object
38 {
39 public:
42  typedef Object Superclass;
45 
47  itkNewMacro(Self);
48 
51 
53  typedef TInputImage ImageType;
54  typedef typename TInputImage::Pointer ImagePointer;
55  typedef typename TInputImage::ConstPointer ImageConstPointer;
56  typedef typename TInputImage::PixelType PixelType;
58 
60 
61  itkStaticConstMacro(ImageDimension, unsigned int,
62  ImageType::ImageDimension);
63 
64  itkStaticConstMacro(SampleDimension, unsigned int,
65  TSampleDimension);
66 
67  itkStaticConstMacro(ObjectDimension, unsigned int,
68  TInputSpatialObject::ObjectDimension);
69 
71  typedef TInputSpatialObject SpatialObjectType;
72  typedef typename SpatialObjectType::Pointer SpatialObjectPointer;
73  typedef typename SpatialObjectType::ConstPointer SpatialObjectConstPointer;
74 
78 
82 
85 
87  itkSetMacro(SampleDirection, unsigned int);
88  itkGetConstMacro(SampleDirection, unsigned int);
90 
92  itkSetConstObjectMacro(Image, ImageType);
93 
95  itkSetObjectMacro(SpatialObject, SpatialObjectType);
96 
98  const VectorType & GetMean() const { return m_Mean; }
99 
101  const MatrixType & GetCovarianceMatrix() const { return m_CovarianceMatrix; }
102 
104  AccumulateType GetSum() const { return m_Sum; }
105 
107  itkGetConstMacro(NumberOfPixels, SizeValueType);
108 
110  void Update();
111 
112 protected:
115  virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
116 
117  bool ComputeStatistics();
118 
119 private:
120  ITK_DISALLOW_COPY_AND_ASSIGN(SpatialObjectToImageStatisticsCalculator);
121 
128  unsigned int m_SampleDirection;
132 
134 };
135 } // end namespace itk
136 
137 #ifndef ITK_MANUAL_INSTANTIATION
138 #include "itkSpatialObjectToImageStatisticsCalculator.hxx"
139 #endif
140 
141 #endif /* itkSpatialObjectToImageStatisticsCalculator_h */
Light weight base class for most itk classes.
Matrix< double, TSampleDimension, TSampleDimension > MatrixType
unsigned long ModifiedTimeType
Definition: itkIntTypes.h:164
unsigned long SizeValueType
Definition: itkIntTypes.h:143
Iterates over a flood-filled spatial function with read-only access to pixels.
Implementation of the composite pattern.
Generate a unique, increasing time value.
Definition: itkTimeStamp.h:59
itk::FloodFilledSpatialFunctionConditionalConstIterator< ImageType, SpatialObjectType > IteratorType
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
Define additional traits for native types such as int or float.
Base class for most ITK classes.
Definition: itkObject.h:59
Templated n-dimensional image class.
Definition: itkImage.h:75