Main Page   Groups   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Concepts

itkBilateralImageFilter.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkBilateralImageFilter.h,v $
00005   Language:  C++
00006   Date:      $Date: 2002/09/16 16:44:17 $
00007   Version:   $Revision: 1.7 $
00008 
00009   Copyright (c) 2002 Insight Consortium. All rights reserved.
00010   See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
00011 
00012      This software is distributed WITHOUT ANY WARRANTY; without even 
00013      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00014      PURPOSE.  See the above copyright notices for more information.
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&); //purposely not implemented
00186   void operator=(const Self&); //purposely not implemented
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 } // end namespace itk
00204 
00205 #ifndef ITK_MANUAL_INSTANTIATION
00206 #include "itkBilateralImageFilter.txx"
00207 #endif
00208 
00209 #endif

Generated at Wed Mar 12 01:12:48 2003 for ITK by doxygen 1.2.15 written by Dimitri van Heesch, © 1997-2000