Go to the documentation of this file.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
00097 itkSetMacro(Variance, ArrayType);
00098 itkGetConstMacro(Variance, const ArrayType);
00100
00104 itkSetMacro(MaximumError, ArrayType);
00105 itkGetConstMacro(MaximumError, const ArrayType);
00107
00110 itkGetConstMacro(MaximumKernelWidth, int);
00111 itkSetMacro(MaximumKernelWidth, int);
00113
00119 itkGetConstMacro(FilterDimensionality, unsigned int);
00120 itkSetMacro(FilterDimensionality, unsigned int);
00122
00125 void SetVariance (const typename ArrayType::ValueType v)
00126 {
00127 m_Variance.Fill(v);
00128 }
00129
00130 void SetMaximumError (const typename ArrayType::ValueType v)
00131 {
00132 m_MaximumError.Fill(v);
00133 }
00134
00135 void SetVariance (const double *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 SetVariance (const float *v)
00146 {
00147 ArrayType dv;
00148 for (unsigned int i = 0; i < ImageDimension; i++)
00149 {
00150 dv[i] = v[i];
00151 }
00152 this->SetVariance(dv);
00153 }
00154
00155 void SetMaximumError (const double *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
00165 void SetMaximumError (const float *v)
00166 {
00167 ArrayType dv;
00168 for (unsigned int i = 0; i < ImageDimension; i++)
00169 {
00170 dv[i] = v[i];
00171 }
00172 this->SetMaximumError(dv);
00173 }
00174
00178 void SetUseImageSpacingOn()
00179 { this->SetUseImageSpacing(true); }
00180
00183 void SetUseImageSpacingOff()
00184 { this->SetUseImageSpacing(false); }
00185
00188 itkSetMacro(UseImageSpacing, bool);
00189 itkGetConstMacro(UseImageSpacing, bool);
00191
00201 itkSetMacro(InternalNumberOfStreamDivisions,unsigned int);
00202 itkGetConstReferenceMacro(InternalNumberOfStreamDivisions,unsigned int);
00203
00210 virtual void GenerateInputRequestedRegion() throw(InvalidRequestedRegionError);
00211
00212 #ifdef ITK_USE_CONCEPT_CHECKING
00213
00214 itkConceptMacro(OutputHasNumericTraitsCheck,
00215 (Concept::HasNumericTraits<OutputPixelType>));
00216
00218 #endif
00219
00220 protected:
00221 DiscreteGaussianImageFilter()
00222 {
00223 m_Variance.Fill(0.0);
00224 m_MaximumError.Fill(0.01);
00225 m_MaximumKernelWidth = 32;
00226 m_UseImageSpacing = true;
00227 m_FilterDimensionality = ImageDimension;
00228 m_InternalNumberOfStreamDivisions = ImageDimension*ImageDimension;
00229 }
00230 virtual ~DiscreteGaussianImageFilter() {}
00231 void PrintSelf(std::ostream& os, Indent indent) const;
00232
00238 void GenerateData();
00239
00240
00241 private:
00242 DiscreteGaussianImageFilter(const Self&);
00243 void operator=(const Self&);
00244
00246 ArrayType m_Variance;
00247
00251 ArrayType m_MaximumError;
00252
00255 int m_MaximumKernelWidth;
00256
00258 unsigned int m_FilterDimensionality;
00259
00261 bool m_UseImageSpacing;
00262
00265 unsigned int m_InternalNumberOfStreamDivisions;
00266 };
00267
00268 }
00269
00270 #ifndef ITK_MANUAL_INSTANTIATION
00271 #include "itkDiscreteGaussianImageFilter.txx"
00272 #endif
00273
00274 #endif
00275