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);
00099
00103 itkSetMacro(MaximumError, ArrayType);
00104 itkGetMacro(MaximumError, const ArrayType);
00106
00109 itkGetMacro(MaximumKernelWidth, int);
00110 itkSetMacro(MaximumKernelWidth, int);
00112
00118 itkGetMacro(FilterDimensionality, unsigned int);
00119 itkSetMacro(FilterDimensionality, unsigned int);
00121
00124 void SetVariance (const typename ArrayType::ValueType v)
00125 {
00126 m_Variance.Fill(v);
00127 }
00128
00129 void SetMaximumError (const typename ArrayType::ValueType v)
00130 {
00131 m_MaximumError.Fill(v);
00132 }
00133
00134 void SetVariance (const double *v)
00135 {
00136 ArrayType dv;
00137 for (unsigned int i = 0; i < ImageDimension; i++)
00138 {
00139 dv[i] = v[i];
00140 }
00141 this->SetVariance(dv);
00142 }
00143
00144 void SetVariance (const float *v)
00145 {
00146 ArrayType dv;
00147 for (unsigned int i = 0; i < ImageDimension; i++)
00148 {
00149 dv[i] = v[i];
00150 }
00151 this->SetVariance(dv);
00152 }
00153
00154 void SetMaximumError (const double *v)
00155 {
00156 ArrayType dv;
00157 for (unsigned int i = 0; i < ImageDimension; i++)
00158 {
00159 dv[i] = v[i];
00160 }
00161 this->SetMaximumError(dv);
00162 }
00163
00164 void SetMaximumError (const float *v)
00165 {
00166 ArrayType dv;
00167 for (unsigned int i = 0; i < ImageDimension; i++)
00168 {
00169 dv[i] = v[i];
00170 }
00171 this->SetMaximumError(dv);
00172 }
00173
00177 void SetUseImageSpacingOn()
00178 { this->SetUseImageSpacing(true); }
00179
00182 void SetUseImageSpacingOff()
00183 { this->SetUseImageSpacing(false); }
00184
00187 itkSetMacro(UseImageSpacing, bool);
00188 itkGetMacro(UseImageSpacing, bool);
00190
00197 virtual void GenerateInputRequestedRegion() throw(InvalidRequestedRegionError);
00198
00199 #ifdef ITK_USE_CONCEPT_CHECKING
00200
00201 itkConceptMacro(OutputHasNumericTraitsCheck,
00202 (Concept::HasNumericTraits<OutputPixelType>));
00203
00205 #endif
00206
00207 protected:
00208 DiscreteGaussianImageFilter()
00209 {
00210 m_Variance.Fill(0.0);
00211 m_MaximumError.Fill(0.01);
00212 m_MaximumKernelWidth = 32;
00213 m_UseImageSpacing = true;
00214 m_FilterDimensionality = ImageDimension;
00215 }
00216 virtual ~DiscreteGaussianImageFilter() {}
00217 void PrintSelf(std::ostream& os, Indent indent) const;
00218
00224 void GenerateData();
00225
00226
00227 private:
00228 DiscreteGaussianImageFilter(const Self&);
00229 void operator=(const Self&);
00230
00232 ArrayType m_Variance;
00233
00237 ArrayType m_MaximumError;
00238
00241 int m_MaximumKernelWidth;
00242
00244 unsigned int m_FilterDimensionality;
00245
00247 bool m_UseImageSpacing;
00248 };
00249
00250 }
00251
00252 #ifndef ITK_MANUAL_INSTANTIATION
00253 #include "itkDiscreteGaussianImageFilter.txx"
00254 #endif
00255
00256 #endif
00257