00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __itkDiscreteGaussianImageFilter_h
00018 #define __itkDiscreteGaussianImageFilter_h
00019
00020 #include "itkImageToImageFilter.h"
00021 #include "itkFixedArray.h"
00022 #include "itkImage.h"
00023
00024 namespace itk
00025 {
00055 template <class TInputImage, class TOutputImage >
00056 class ITK_EXPORT DiscreteGaussianImageFilter :
00057 public ImageToImageFilter< TInputImage, TOutputImage >
00058 {
00059 public:
00061 typedef DiscreteGaussianImageFilter Self;
00062 typedef ImageToImageFilter< TInputImage, TOutputImage > Superclass;
00063 typedef SmartPointer<Self> Pointer;
00064 typedef SmartPointer<const Self> ConstPointer;
00065
00067 itkNewMacro(Self);
00068
00070 itkTypeMacro(DiscreteGaussianImageFilter, ImageToImageFilter);
00071
00073 typedef TInputImage InputImageType;
00074 typedef TOutputImage OutputImageType;
00075
00078 typedef typename TOutputImage::PixelType OutputPixelType;
00079 typedef typename TOutputImage::InternalPixelType OutputInternalPixelType;
00080 typedef typename TInputImage::PixelType InputPixelType;
00081 typedef typename TInputImage::InternalPixelType InputInternalPixelType;
00082
00085 itkStaticConstMacro(ImageDimension, unsigned int,
00086 TOutputImage::ImageDimension);
00087
00089 typedef FixedArray<double, itkGetStaticConstMacro(ImageDimension)> ArrayType;
00090
00096 itkSetMacro(Variance, ArrayType);
00097 itkGetMacro(Variance, const ArrayType);
00098
00102 itkSetMacro(MaximumError, ArrayType);
00103 itkGetMacro(MaximumError, const ArrayType);
00104
00107 itkGetMacro(MaximumKernelWidth, int);
00108 itkSetMacro(MaximumKernelWidth, int);
00109
00115 itkGetMacro(FilterDimensionality, unsigned int);
00116 itkSetMacro(FilterDimensionality, unsigned int);
00117
00120 void SetVariance (const typename ArrayType::ValueType v)
00121 {
00122 m_Variance.Fill(v);
00123 }
00124
00125 void SetMaximumError (const typename ArrayType::ValueType v)
00126 {
00127 m_MaximumError.Fill(v);
00128 }
00129
00130 void SetVariance (const double *v)
00131 {
00132 ArrayType dv;
00133 for (unsigned int i = 0; i < ImageDimension; i++)
00134 {
00135 dv[i] = v[i];
00136 }
00137 this->SetVariance(dv);
00138 }
00139
00140 void SetVariance (const float *v)
00141 {
00142 ArrayType dv;
00143 for (unsigned int i = 0; i < ImageDimension; i++)
00144 {
00145 dv[i] = v[i];
00146 }
00147 this->SetVariance(dv);
00148 }
00149
00150 void SetMaximumError (const double *v)
00151 {
00152 ArrayType dv;
00153 for (unsigned int i = 0; i < ImageDimension; i++)
00154 {
00155 dv[i] = v[i];
00156 }
00157 this->SetMaximumError(dv);
00158 }
00159
00160 void SetMaximumError (const float *v)
00161 {
00162 ArrayType dv;
00163 for (unsigned int i = 0; i < ImageDimension; i++)
00164 {
00165 dv[i] = v[i];
00166 }
00167 this->SetMaximumError(dv);
00168 }
00169
00173 void SetUseImageSpacingOn()
00174 { this->SetUseImageSpacing(true); }
00175
00178 void SetUseImageSpacingOff()
00179 { this->SetUseImageSpacing(false); }
00180
00183 itkSetMacro(UseImageSpacing, bool);
00184 itkGetMacro(UseImageSpacing, bool);
00185
00192 virtual void GenerateInputRequestedRegion() throw(InvalidRequestedRegionError);
00193
00194 protected:
00195 DiscreteGaussianImageFilter()
00196 {
00197 m_Variance.Fill(0.0);
00198 m_MaximumError.Fill(0.01);
00199 m_MaximumKernelWidth = 32;
00200 m_UseImageSpacing = true;
00201 m_FilterDimensionality = ImageDimension;
00202 }
00203 virtual ~DiscreteGaussianImageFilter() {}
00204 void PrintSelf(std::ostream& os, Indent indent) const;
00205
00211 void GenerateData();
00212
00213
00214 private:
00215 DiscreteGaussianImageFilter(const Self&);
00216 void operator=(const Self&);
00217
00219 ArrayType m_Variance;
00220
00224 ArrayType m_MaximumError;
00225
00228 int m_MaximumKernelWidth;
00229
00231 unsigned int m_FilterDimensionality;
00232
00234 bool m_UseImageSpacing;
00235 };
00236
00237 }
00238
00239 #ifndef ITK_MANUAL_INSTANTIATION
00240 #include "itkDiscreteGaussianImageFilter.txx"
00241 #endif
00242
00243 #endif