00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef __itkWarpHarmonicEnergyCalculator_h
00019 #define __itkWarpHarmonicEnergyCalculator_h
00020
00021 #include "itkObject.h"
00022 #include "itkObjectFactory.h"
00023 #include "itkConstNeighborhoodIterator.h"
00024 #include "itkImage.h"
00025 #include "itkVector.h"
00026
00027 namespace itk
00028 {
00029
00045 template <class TInputImage>
00046 class ITK_EXPORT WarpHarmonicEnergyCalculator : public Object
00047 {
00048 public:
00050 typedef WarpHarmonicEnergyCalculator Self;
00051 typedef Object Superclass;
00052 typedef SmartPointer<Self> Pointer;
00053 typedef SmartPointer<const Self> ConstPointer;
00054
00056 itkNewMacro(Self);
00057
00059 itkTypeMacro(WarpHarmonicEnergyCalculator, Object);
00060
00062 typedef TInputImage ImageType;
00063
00065 typedef typename TInputImage::Pointer ImagePointer;
00066
00068 typedef typename TInputImage::ConstPointer ImageConstPointer;
00069
00071 typedef typename TInputImage::PixelType PixelType;
00072
00074 typedef typename TInputImage::IndexType IndexType;
00075
00077 typedef typename TInputImage::RegionType RegionType;
00078
00080 itkStaticConstMacro(ImageDimension, unsigned int,
00081 TInputImage::ImageDimension);
00082
00084 itkStaticConstMacro(VectorDimension, unsigned int,
00085 PixelType::Dimension);
00086
00089 typedef ConstNeighborhoodIterator<ImageType> ConstNeighborhoodIteratorType;
00090 typedef typename ConstNeighborhoodIteratorType::RadiusType RadiusType;
00091
00095 void SetUseImageSpacingOn()
00096 {
00097 this->SetUseImageSpacing(true);
00098 }
00099
00103 void SetUseImageSpacingOff()
00104 {
00105 this->SetUseImageSpacing(false);
00106 }
00107
00110 void SetUseImageSpacing(bool);
00111 itkGetMacro(UseImageSpacing, bool);
00113
00116 void SetDerivativeWeights(double data[]);
00117 itkGetVectorMacro(DerivativeWeights, const double, ::itk::GetImageDimension<TInputImage>::ImageDimension);
00119
00121 itkSetConstObjectMacro(Image,ImageType);
00122
00124 void Compute(void);
00125
00127 itkGetMacro(HarmonicEnergy,double);
00128
00130 void SetRegion( const RegionType & region );
00131
00132 protected:
00133 WarpHarmonicEnergyCalculator();
00134 virtual ~WarpHarmonicEnergyCalculator() {};
00135 void PrintSelf(std::ostream& os, Indent indent) const;
00136
00138 itkGetConstReferenceMacro( NeighborhoodRadius, RadiusType );
00139 itkSetMacro( NeighborhoodRadius, RadiusType );
00141
00142 double EvaluateAtNeighborhood( ConstNeighborhoodIteratorType &it ) const;
00143
00144 private:
00145 WarpHarmonicEnergyCalculator(const Self&);
00146 void operator=(const Self&);
00147
00148 double m_HarmonicEnergy;
00149 ImageConstPointer m_Image;
00150
00151 RegionType m_Region;
00152 bool m_RegionSetByUser;
00153
00154 bool m_UseImageSpacing;
00155
00157 double m_DerivativeWeights[::itk::GetImageDimension<TInputImage>::ImageDimension];
00158
00159 RadiusType m_NeighborhoodRadius;
00160 };
00161
00162 }
00163
00164 #ifndef ITK_MANUAL_INSTANTIATION
00165 #include "itkWarpHarmonicEnergyCalculator.txx"
00166 #endif
00167
00168 #endif
00169