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 "itkConstNeighborhoodIterator.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
00109 typedef
00110 Neighborhood<double, itkGetStaticConstMacro(ImageDimension)> KernelType;
00111
00113 typedef typename KernelType::Iterator KernelIteratorType ;
00114 typedef typename KernelType::ConstIterator KernelConstIteratorType ;
00115
00117 typedef
00118 Image<double, itkGetStaticConstMacro(ImageDimension)> GaussianImageType;
00119
00123 itkSetVectorMacro(DomainSigma, double, ImageDimension);
00124 itkSetVectorMacro(DomainSigma, float, ImageDimension);
00125 itkGetVectorMacro(DomainSigma, const double, ImageDimension);
00126 itkSetMacro(RangeSigma, double);
00127 itkGetMacro(RangeSigma, double);
00128 itkGetMacro(FilterDimensionality, unsigned int);
00129 itkSetMacro(FilterDimensionality, unsigned int);
00130
00133 void SetDomainSigma(const double v)
00134 {
00135 double vArray[ImageDimension];
00136 for (unsigned int i = 0; i<ImageDimension; ++i) { vArray[i] = v; }
00137 this->SetDomainSigma(vArray);
00138 }
00139
00142 void SetDomainSigma(const float v)
00143 {
00144 double vArray[ImageDimension];
00145 for (unsigned int i = 0; i<ImageDimension; ++i) { vArray[i] = static_cast<double>(v); }
00146 this->SetDomainSigma(vArray);
00147 }
00148
00155 virtual void GenerateInputRequestedRegion() throw(InvalidRequestedRegionError);
00156
00157 protected:
00160 BilateralImageFilter()
00161 {
00162 unsigned int i;
00163 for (i = 0; i < ImageDimension; i++)
00164 {
00165 m_DomainSigma[i] = 4.0f;
00166 }
00167 m_RangeSigma = 50.0f;
00168 m_FilterDimensionality = ImageDimension;
00169 }
00170 virtual ~BilateralImageFilter() {}
00171 void PrintSelf(std::ostream& os, Indent indent) const;
00172
00174 void BeforeThreadedGenerateData();
00175
00178 void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread,
00179 int threadId);
00180
00181
00182 private:
00183 BilateralImageFilter(const Self&);
00184 void operator=(const Self&);
00185
00188 double m_RangeSigma;
00189
00192 double m_DomainSigma[ImageDimension];
00193
00195 unsigned int m_FilterDimensionality;
00196
00198 KernelType m_GaussianKernel;
00199 };
00200
00201 }
00202
00203 #ifndef ITK_MANUAL_INSTANTIATION
00204 #include "itkBilateralImageFilter.txx"
00205 #endif
00206
00207 #endif