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 "itkImage.h"
00022
00023 namespace itk
00024 {
00054 template <class TInputImage, class TOutputImage >
00055 class ITK_EXPORT DiscreteGaussianImageFilter :
00056 public ImageToImageFilter< TInputImage, TOutputImage >
00057 {
00058 public:
00060 typedef DiscreteGaussianImageFilter Self;
00061 typedef ImageToImageFilter< TInputImage, TOutputImage > Superclass;
00062 typedef SmartPointer<Self> Pointer;
00063 typedef SmartPointer<const Self> ConstPointer;
00064
00066 itkNewMacro(Self);
00067
00069 itkTypeMacro(DiscreteGaussianImageFilter, ImageToImageFilter);
00070
00072 typedef TInputImage InputImageType;
00073 typedef TOutputImage OutputImageType;
00074
00077 typedef typename TOutputImage::PixelType OutputPixelType;
00078 typedef typename TOutputImage::InternalPixelType OutputInternalPixelType;
00079 typedef typename TInputImage::PixelType InputPixelType;
00080 typedef typename TInputImage::InternalPixelType InputInternalPixelType;
00081
00084 itkStaticConstMacro(ImageDimension, unsigned int,
00085 TOutputImage::ImageDimension);
00086
00092 itkSetVectorMacro(Variance, double, ImageDimension);
00093 itkSetVectorMacro(Variance, float, ImageDimension);
00094 itkGetVectorMacro(Variance, const double, ImageDimension);
00095
00099 itkSetVectorMacro(MaximumError, double, ImageDimension);
00100 itkSetVectorMacro(MaximumError, float, ImageDimension);
00101 itkGetVectorMacro(MaximumError, const double, ImageDimension);
00102
00105 itkGetMacro(MaximumKernelWidth, int);
00106 itkSetMacro(MaximumKernelWidth, int);
00107
00108 itkGetMacro(FilterDimensionality, unsigned int);
00109 itkSetMacro(FilterDimensionality, unsigned int);
00110
00113 void SetVariance(const double v)
00114 {
00115 double vArray[ImageDimension];
00116 for (unsigned int i = 0; i<ImageDimension; ++i) { vArray[i] = v; }
00117 this->SetVariance(vArray);
00118 }
00119 void SetMaximumError(const double v)
00120 {
00121 double vArray[ImageDimension];
00122 for (unsigned int i = 0; i<ImageDimension; ++i) { vArray[i] = v; }
00123 this->SetMaximumError(vArray);
00124 }
00125
00128 void SetVariance(const float v)
00129 {
00130 double vArray[ImageDimension];
00131 for (unsigned int i = 0; i<ImageDimension; ++i) { vArray[i] = static_cast<double>(v); }
00132 this->SetVariance(vArray);
00133 }
00134 void SetMaximumError(const float v)
00135 {
00136 double vArray[ImageDimension];
00137 for (unsigned int i = 0; i<ImageDimension; ++i) { vArray[i] = static_cast<double>(v); }
00138 this->SetMaximumError(vArray);
00139 }
00140
00144 void SetUseImageSpacingOn()
00145 { this->SetUseImageSpacing(true); }
00146
00149 void SetUseImageSpacingOff()
00150 { this->SetUseImageSpacing(false); }
00151
00154 itkSetMacro(UseImageSpacing, bool);
00155 itkGetMacro(UseImageSpacing, bool);
00156
00163 virtual void GenerateInputRequestedRegion() throw(InvalidRequestedRegionError);
00164
00165 protected:
00166 DiscreteGaussianImageFilter()
00167 {
00168 unsigned int i;
00169 for (i = 0; i < ImageDimension; i++)
00170 {
00171 m_Variance[i] = 0.0f;
00172 m_MaximumError[i] = 0.01f;
00173 m_MaximumKernelWidth = 32;
00174 }
00175 m_UseImageSpacing = true;
00176 m_FilterDimensionality = ImageDimension;
00177 }
00178 virtual ~DiscreteGaussianImageFilter() {}
00179 void PrintSelf(std::ostream& os, Indent indent) const;
00180
00186 void GenerateData();
00187
00188
00189 private:
00190 DiscreteGaussianImageFilter(const Self&);
00191 void operator=(const Self&);
00192
00194 double m_Variance[ImageDimension];
00195
00199 double m_MaximumError[ImageDimension];
00200
00203 int m_MaximumKernelWidth;
00204
00206 unsigned int m_FilterDimensionality;
00207
00209 bool m_UseImageSpacing;
00210 };
00211
00212 }
00213
00214 #ifndef ITK_MANUAL_INSTANTIATION
00215 #include "itkDiscreteGaussianImageFilter.txx"
00216 #endif
00217
00218 #endif