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: 2003/12/08 02:38:31 $
00007   Version:   $Revision: 1.15 $
00008 
00009   Copyright (c) Insight Software 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 "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   
00117   typedef typename KernelType::Iterator KernelIteratorType ;
00118   typedef typename KernelType::ConstIterator KernelConstIteratorType ;
00119 
00121   typedef
00122   Image<double, itkGetStaticConstMacro(ImageDimension)> GaussianImageType;
00123   
00127   itkSetMacro(DomainSigma, ArrayType);
00128   itkGetMacro(DomainSigma, const ArrayType);
00129   itkSetMacro(RangeSigma, double);
00130   itkGetMacro(RangeSigma, double);
00131   itkGetMacro(FilterDimensionality, unsigned int);
00132   itkSetMacro(FilterDimensionality, unsigned int);
00133   
00136   void SetDomainSigma(const double v)
00137   {
00138     m_DomainSigma.Fill(v);
00139   }
00140   
00144   itkSetMacro(NumberOfRangeGaussianSamples, unsigned long);
00145   itkGetMacro(NumberOfRangeGaussianSamples, unsigned long);
00146   
00147 protected:
00150   BilateralImageFilter()
00151   {
00152     m_DomainSigma.Fill(4.0);
00153     m_RangeSigma = 50.0;
00154     m_FilterDimensionality = ImageDimension;
00155     m_NumberOfRangeGaussianSamples = 100;
00156     m_DynamicRange = 0.0;
00157     m_DynamicRangeUsed = 0.0;
00158     m_DomainMu = 2.5;  // keep small to keep kernels small
00159     m_RangeMu = 4.0;   // can be bigger then DomainMu since we only
00160                        // index into a single table
00161 
00162   }
00163   virtual ~BilateralImageFilter() {}
00164   void PrintSelf(std::ostream& os, Indent indent) const;
00165 
00167   void BeforeThreadedGenerateData();
00168   
00171   void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread,
00172                             int threadId); 
00173 
00180   virtual void GenerateInputRequestedRegion() throw(InvalidRequestedRegionError);
00181 
00182   
00183 private:
00184   BilateralImageFilter(const Self&); //purposely not implemented
00185   void operator=(const Self&); //purposely not implemented
00186 
00189   double m_RangeSigma;
00190   
00193   ArrayType m_DomainSigma;
00194 
00197   double m_DomainMu;
00198   double m_RangeMu;
00199 
00201   unsigned int m_FilterDimensionality;
00202 
00204   KernelType m_GaussianKernel;
00205 
00207   unsigned long m_NumberOfRangeGaussianSamples;
00208   double m_DynamicRange;
00209   double m_DynamicRangeUsed;
00210   std::vector<double> m_RangeGaussianTable;
00211 };
00212   
00213 } // end namespace itk
00214 
00215 #ifndef ITK_MANUAL_INSTANTIATION
00216 #include "itkBilateralImageFilter.txx"
00217 #endif
00218 
00219 #endif

Generated at Sun Jan 25 13:19:29 2004 for ITK by doxygen 1.3.3 written by Dimitri van Heesch, © 1997-2000