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 "itkNeighborhoodIterator.h"
00023 #include "itkConstSmartNeighborhoodIterator.h"
00024 #include "itkNeighborhood.h"
00025
00026 namespace itk
00027 {
00067 template <class TInputImage, class TOutputImage >
00068 class ITK_EXPORT BilateralImageFilter :
00069 public ImageToImageFilter< TInputImage, TOutputImage >
00070 {
00071 public:
00073 typedef BilateralImageFilter Self;
00074 typedef ImageToImageFilter< TInputImage, TOutputImage > Superclass;
00075 typedef SmartPointer<Self> Pointer;
00076 typedef SmartPointer<const Self> ConstPointer;
00077
00079 itkNewMacro(Self);
00080
00082 itkTypeMacro(BilateralImageFilter, ImageToImageFilter);
00083
00085 typedef TInputImage InputImageType;
00086 typedef TOutputImage OutputImageType;
00087
00089 typedef typename Superclass::OutputImageRegionType OutputImageRegionType;
00090
00093 typedef typename TOutputImage::PixelType OutputPixelType;
00094 typedef typename TOutputImage::InternalPixelType OutputInternalPixelType;
00095 typedef typename NumericTraits<OutputPixelType>::RealType OutputPixelRealType;
00096 typedef typename TInputImage::PixelType InputPixelType;
00097 typedef typename TInputImage::InternalPixelType InputInternalPixelType;
00098
00101 itkStaticConstMacro(ImageDimension, unsigned int,
00102 TOutputImage::ImageDimension);
00103
00105 typedef ConstNeighborhoodIterator<TInputImage>
00106 NeighborhoodIteratorType ;
00107 typedef ConstSmartNeighborhoodIterator<TInputImage>
00108 SmartNeighborhoodIteratorType ;
00109
00111 typedef
00112 Neighborhood<double, itkGetStaticConstMacro(ImageDimension)> KernelType;
00113
00115 typedef typename KernelType::Iterator KernelIteratorType ;
00116 typedef typename KernelType::ConstIterator KernelConstIteratorType ;
00117
00119 typedef
00120 Image<double, itkGetStaticConstMacro(ImageDimension)> GaussianImageType;
00121
00125 itkSetVectorMacro(DomainSigma, double, ImageDimension);
00126 itkSetVectorMacro(DomainSigma, float, ImageDimension);
00127 itkGetVectorMacro(DomainSigma, const double, ImageDimension);
00128 itkSetMacro(RangeSigma, double);
00129 itkGetMacro(RangeSigma, double);
00130 itkGetMacro(FilterDimensionality, unsigned int);
00131 itkSetMacro(FilterDimensionality, unsigned int);
00132
00135 void SetDomainSigma(const double v)
00136 {
00137 double vArray[ImageDimension];
00138 for (unsigned int i = 0; i<ImageDimension; ++i) { vArray[i] = v; }
00139 this->SetDomainSigma(vArray);
00140 }
00141
00144 void SetDomainSigma(const float v)
00145 {
00146 double vArray[ImageDimension];
00147 for (unsigned int i = 0; i<ImageDimension; ++i) { vArray[i] = static_cast<double>(v); }
00148 this->SetDomainSigma(vArray);
00149 }
00150
00157 virtual void GenerateInputRequestedRegion() throw(InvalidRequestedRegionError);
00158
00159 protected:
00162 BilateralImageFilter()
00163 {
00164 unsigned int i;
00165 for (i = 0; i < ImageDimension; i++)
00166 {
00167 m_DomainSigma[i] = 4.0f;
00168 }
00169 m_RangeSigma = 50.0f;
00170 m_FilterDimensionality = ImageDimension;
00171 }
00172 virtual ~BilateralImageFilter() {}
00173 void PrintSelf(std::ostream& os, Indent indent) const;
00174
00176 void BeforeThreadedGenerateData();
00177
00180 void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread,
00181 int threadId);
00182
00183
00184 private:
00185 BilateralImageFilter(const Self&);
00186 void operator=(const Self&);
00187
00190 double m_RangeSigma;
00191
00194 double m_DomainSigma[ImageDimension];
00195
00197 unsigned int m_FilterDimensionality;
00198
00200 KernelType m_GaussianKernel;
00201 };
00202
00203 }
00204
00205 #ifndef ITK_MANUAL_INSTANTIATION
00206 #include "itkBilateralImageFilter.txx"
00207 #endif
00208
00209 #endif