ITK  4.4.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< class TInputImage, class TInputSpatialObject, unsigned int TSampleDimension = 1 >
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;
57  typedef typename TInputImage::IndexType IndexType;
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(void);
111 
112 protected:
115  void PrintSelf(std::ostream & os, Indent indent) const;
116 
117  bool ComputeStatistics();
118 
119 private:
120  SpatialObjectToImageStatisticsCalculator(const Self &); //purposely not
121  // implemented
122  void operator=(const Self &); //purposely not
123 
124  // implemented
125 
132  unsigned int m_SampleDirection;
136 
138 };
139 } // end namespace itk
140 
141 #ifndef ITK_MANUAL_INSTANTIATION
142 #include "itkSpatialObjectToImageStatisticsCalculator.hxx"
143 #endif
144 
145 #endif /* __itkSpatialObjectToImageStatisticsCalculator_h */
146