00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __itkSpatialObjectToImageStatisticsCalculator_h
00018 #define __itkSpatialObjectToImageStatisticsCalculator_h
00019
00020 #include "itkObject.h"
00021 #include "itkObjectFactory.h"
00022 #include "itkFloodFilledSpatialFunctionConditionalConstIterator.h"
00023
00024 namespace itk
00025 {
00026
00031 template <class TInputImage, class TInputSpatialObject, unsigned int TSampleDimension=1>
00032 class ITK_EXPORT SpatialObjectToImageStatisticsCalculator : public Object
00033 {
00034 public:
00036 typedef SpatialObjectToImageStatisticsCalculator Self;
00037 typedef Object Superclass;
00038 typedef SmartPointer<Self> Pointer;
00039 typedef SmartPointer<const Self> ConstPointer;
00040
00042 itkNewMacro(Self);
00043
00045 itkTypeMacro(SpatialObjectToImageStatisticsCalculator, Object);
00046
00048 typedef TInputImage ImageType;
00049 typedef typename TInputImage::Pointer ImagePointer;
00050 typedef typename TInputImage::ConstPointer ImageConstPointer;
00051 typedef typename TInputImage::PixelType PixelType;
00052 typedef typename TInputImage::IndexType IndexType;
00053
00054 itkStaticConstMacro(ImageDimension, unsigned int,
00055 ImageType::ImageDimension);
00056
00057 itkStaticConstMacro(SampleDimension, unsigned int,
00058 TSampleDimension);
00059
00060 itkStaticConstMacro(ObjectDimension, unsigned int,
00061 TInputSpatialObject::ObjectDimension);
00062
00063
00065 typedef TInputSpatialObject SpatialObjectType;
00066 typedef typename SpatialObjectType::Pointer SpatialObjectPointer;
00067 typedef typename SpatialObjectType::ConstPointer SpatialObjectConstPointer;
00068
00070 typedef itk::FloodFilledSpatialFunctionConditionalConstIterator<ImageType,
00071 SpatialObjectType> IteratorType;
00072
00074 typedef Vector< double, TSampleDimension> VectorType;
00075 typedef Matrix< double, TSampleDimension, TSampleDimension > MatrixType ;
00076
00078 itkSetMacro(SampleDirection,unsigned int);
00079 itkGetMacro(SampleDirection,unsigned int);
00080
00082 itkSetConstObjectMacro(Image,ImageType);
00083
00085 itkSetObjectMacro(SpatialObject,SpatialObjectType);
00086
00088 const VectorType & GetMean() const {return m_Mean;}
00089
00091 const MatrixType & GetCovarianceMatrix() const {return m_CovarianceMatrix;}
00092
00094 void Update(void);
00095
00096 protected:
00097 SpatialObjectToImageStatisticsCalculator();
00098 virtual ~SpatialObjectToImageStatisticsCalculator() {};
00099 void PrintSelf(std::ostream& os, Indent indent) const;
00100
00101 private:
00102 SpatialObjectToImageStatisticsCalculator(const Self&);
00103 void operator=(const Self&);
00104
00105 ImageConstPointer m_Image;
00106 SpatialObjectPointer m_SpatialObject;
00107 VectorType m_Mean;
00108 MatrixType m_CovarianceMatrix;
00109 unsigned int m_SampleDirection;
00110 unsigned long m_InternalImageTime;
00111 unsigned long m_InternalSpatialObjectTime;
00112 TimeStamp m_ModifiedTime;
00113 };
00114
00115 }
00116
00117
00118 #ifndef ITK_MANUAL_INSTANTIATION
00119 #include "itkSpatialObjectToImageStatisticsCalculator.txx"
00120 #endif
00121
00122 #endif