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
00110 itkGetMacro(FilterDimensionality, unsigned int);
00111 itkSetMacro(FilterDimensionality, unsigned int);
00112
00115 void SetVariance (const typename ArrayType::ValueType v)
00116 {
00117 m_Variance.Fill(v);
00118 }
00119
00120 void SetMaximumError (const typename ArrayType::ValueType v)
00121 {
00122 m_MaximumError.Fill(v);
00123 }
00124
00125 void SetVariance (const double *v)
00126 {
00127 ArrayType dv;
00128 for (unsigned int i = 0; i < ImageDimension; i++)
00129 {
00130 dv[i] = v[i];
00131 }
00132 this->SetVariance(dv);
00133 }
00134
00135 void SetVariance (const float *v)
00136 {
00137 ArrayType dv;
00138 for (unsigned int i = 0; i < ImageDimension; i++)
00139 {
00140 dv[i] = v[i];
00141 }
00142 this->SetVariance(dv);
00143 }
00144
00145 void SetMaximumError (const double *v)
00146 {
00147 ArrayType dv;
00148 for (unsigned int i = 0; i < ImageDimension; i++)
00149 {
00150 dv[i] = v[i];
00151 }
00152 this->SetMaximumError(dv);
00153 }
00154
00155 void SetMaximumError (const float *v)
00156 {
00157 ArrayType dv;
00158 for (unsigned int i = 0; i < ImageDimension; i++)
00159 {
00160 dv[i] = v[i];
00161 }
00162 this->SetMaximumError(dv);
00163 }
00164
00168 void SetUseImageSpacingOn()
00169 { this->SetUseImageSpacing(true); }
00170
00173 void SetUseImageSpacingOff()
00174 { this->SetUseImageSpacing(false); }
00175
00178 itkSetMacro(UseImageSpacing, bool);
00179 itkGetMacro(UseImageSpacing, bool);
00180
00187 virtual void GenerateInputRequestedRegion() throw(InvalidRequestedRegionError);
00188
00189 protected:
00190 DiscreteGaussianImageFilter()
00191 {
00192 m_Variance.Fill(0.0);
00193 m_MaximumError.Fill(0.01);
00194 m_MaximumKernelWidth = 32;
00195 m_UseImageSpacing = true;
00196 m_FilterDimensionality = ImageDimension;
00197 }
00198 virtual ~DiscreteGaussianImageFilter() {}
00199 void PrintSelf(std::ostream& os, Indent indent) const;
00200
00206 void GenerateData();
00207
00208
00209 private:
00210 DiscreteGaussianImageFilter(const Self&);
00211 void operator=(const Self&);
00212
00214 ArrayType m_Variance;
00215
00219 ArrayType m_MaximumError;
00220
00223 int m_MaximumKernelWidth;
00224
00226 unsigned int m_FilterDimensionality;
00227
00229 bool m_UseImageSpacing;
00230 };
00231
00232 }
00233
00234 #ifndef ITK_MANUAL_INSTANTIATION
00235 #include "itkDiscreteGaussianImageFilter.txx"
00236 #endif
00237
00238 #endif