00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __itkBilateralImageFilter_h
00018 #define __itkBilateralImageFilter_h
00019
00020 #include "itkImageToImageFilter.h"
00021 #include "itkImage.h"
00022 #include "itkFixedArray.h"
00023 #include "itkNeighborhoodIterator.h"
00024 #include "itkConstNeighborhoodIterator.h"
00025 #include "itkNeighborhood.h"
00026
00027 namespace itk
00028 {
00068 template <class TInputImage, class TOutputImage >
00069 class ITK_EXPORT BilateralImageFilter :
00070 public ImageToImageFilter< TInputImage, TOutputImage >
00071 {
00072 public:
00074 typedef BilateralImageFilter Self;
00075 typedef ImageToImageFilter< TInputImage, TOutputImage > Superclass;
00076 typedef SmartPointer<Self> Pointer;
00077 typedef SmartPointer<const Self> ConstPointer;
00078
00080 itkNewMacro(Self);
00081
00083 itkTypeMacro(BilateralImageFilter, ImageToImageFilter);
00084
00086 typedef TInputImage InputImageType;
00087 typedef TOutputImage OutputImageType;
00088
00090 typedef typename Superclass::OutputImageRegionType OutputImageRegionType;
00091
00094 typedef typename TOutputImage::PixelType OutputPixelType;
00095 typedef typename TOutputImage::InternalPixelType OutputInternalPixelType;
00096 typedef typename NumericTraits<OutputPixelType>::RealType OutputPixelRealType;
00097 typedef typename TInputImage::PixelType InputPixelType;
00098 typedef typename TInputImage::InternalPixelType InputInternalPixelType;
00099
00102 itkStaticConstMacro(ImageDimension, unsigned int,
00103 TOutputImage::ImageDimension);
00104
00106 typedef FixedArray<double, itkGetStaticConstMacro(ImageDimension)> ArrayType;
00107
00109 typedef ConstNeighborhoodIterator<TInputImage>
00110 NeighborhoodIteratorType ;
00111
00113 typedef
00114 Neighborhood<double, itkGetStaticConstMacro(ImageDimension)> KernelType;
00115 typedef typename KernelType::SizeType SizeType;
00116
00118 typedef typename KernelType::Iterator KernelIteratorType ;
00119 typedef typename KernelType::ConstIterator KernelConstIteratorType ;
00120
00122 typedef
00123 Image<double, itkGetStaticConstMacro(ImageDimension)> GaussianImageType;
00124
00128 itkSetMacro(DomainSigma, ArrayType);
00129 itkGetMacro(DomainSigma, const ArrayType);
00130 itkSetMacro(RangeSigma, double);
00131 itkGetMacro(RangeSigma, double);
00132 itkGetMacro(FilterDimensionality, unsigned int);
00133 itkSetMacro(FilterDimensionality, unsigned int);
00134
00137 void SetDomainSigma(const double v)
00138 {
00139 m_DomainSigma.Fill(v);
00140 }
00141
00147 itkBooleanMacro(AutomaticKernelSize);
00148 itkGetMacro(AutomaticKernelSize, bool);
00149 itkSetMacro(AutomaticKernelSize, bool);
00150
00153 void SetRadius(const unsigned long);
00154 itkSetMacro(Radius, SizeType);
00155 itkGetConstReferenceMacro(Radius, SizeType);
00156
00157
00161 itkSetMacro(NumberOfRangeGaussianSamples, unsigned long);
00162 itkGetMacro(NumberOfRangeGaussianSamples, unsigned long);
00163
00164 protected:
00167 BilateralImageFilter()
00168 {
00169 m_Radius.Fill(1);
00170 m_AutomaticKernelSize = true;
00171 m_DomainSigma.Fill(4.0);
00172 m_RangeSigma = 50.0;
00173 m_FilterDimensionality = ImageDimension;
00174 m_NumberOfRangeGaussianSamples = 100;
00175 m_DynamicRange = 0.0;
00176 m_DynamicRangeUsed = 0.0;
00177 m_DomainMu = 2.5;
00178 m_RangeMu = 4.0;
00179
00180
00181 }
00182 virtual ~BilateralImageFilter() {}
00183 void PrintSelf(std::ostream& os, Indent indent) const;
00184
00186 void BeforeThreadedGenerateData();
00187
00190 void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread,
00191 int threadId);
00192
00199 virtual void GenerateInputRequestedRegion() throw(InvalidRequestedRegionError);
00200
00201
00202 private:
00203 BilateralImageFilter(const Self&);
00204 void operator=(const Self&);
00205
00208 double m_RangeSigma;
00209
00212 ArrayType m_DomainSigma;
00213
00216 double m_DomainMu;
00217 double m_RangeMu;
00218
00220 unsigned int m_FilterDimensionality;
00221
00223 KernelType m_GaussianKernel;
00224 SizeType m_Radius;
00225 bool m_AutomaticKernelSize;
00226
00228 unsigned long m_NumberOfRangeGaussianSamples;
00229 double m_DynamicRange;
00230 double m_DynamicRangeUsed;
00231 std::vector<double> m_RangeGaussianTable;
00232 };
00233
00234 }
00235
00236 #ifndef ITK_MANUAL_INSTANTIATION
00237 #include "itkBilateralImageFilter.txx"
00238 #endif
00239
00240 #endif