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: 2006/03/24 16:03:16 $
00007   Version:   $Revision: 1.19 $
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   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);
00135 
00138   void SetDomainSigma(const double v)
00139   {
00140     m_DomainSigma.Fill(v);
00141   }
00142 
00148   itkBooleanMacro(AutomaticKernelSize);
00149   itkGetMacro(AutomaticKernelSize, bool);
00150   itkSetMacro(AutomaticKernelSize, bool);
00152 
00155   void SetRadius(const unsigned long);
00156   itkSetMacro(Radius, SizeType);
00157   itkGetConstReferenceMacro(Radius, SizeType);
00159 
00160   
00164   itkSetMacro(NumberOfRangeGaussianSamples, unsigned long);
00165   itkGetMacro(NumberOfRangeGaussianSamples, unsigned long);
00167 
00168 #ifdef ITK_USE_CONCEPT_CHECKING
00169 
00170   itkConceptMacro(OutputHasNumericTraitsCheck,
00171                   (Concept::HasNumericTraits<OutputPixelType>));
00172 
00174 #endif
00175 
00176 protected:
00179   BilateralImageFilter()
00180   {
00181     m_Radius.Fill(1);
00182     m_AutomaticKernelSize = true;
00183     m_DomainSigma.Fill(4.0);
00184     m_RangeSigma = 50.0;
00185     m_FilterDimensionality = ImageDimension;
00186     m_NumberOfRangeGaussianSamples = 100;
00187     m_DynamicRange = 0.0;
00188     m_DynamicRangeUsed = 0.0;
00189     m_DomainMu = 2.5;  // keep small to keep kernels small
00190     m_RangeMu = 4.0;   // can be bigger then DomainMu since we only
00191                        // index into a single table
00193 
00194   }
00195   virtual ~BilateralImageFilter() {}
00196   void PrintSelf(std::ostream& os, Indent indent) const;
00197 
00199   void BeforeThreadedGenerateData();
00200 
00203   void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread,
00204                             int threadId); 
00205 
00212   virtual void GenerateInputRequestedRegion() throw(InvalidRequestedRegionError);
00213 
00214   
00215 private:
00216   BilateralImageFilter(const Self&); //purposely not implemented
00217   void operator=(const Self&); //purposely not implemented
00218 
00221   double m_RangeSigma;
00222 
00225   ArrayType m_DomainSigma;
00226 
00229   double m_DomainMu;
00230   double m_RangeMu;
00231 
00233   unsigned int m_FilterDimensionality;
00234 
00236   KernelType m_GaussianKernel;
00237   SizeType   m_Radius;
00238   bool       m_AutomaticKernelSize;
00239 
00241   unsigned long m_NumberOfRangeGaussianSamples;
00242   double m_DynamicRange;
00243   double m_DynamicRangeUsed;
00244   std::vector<double> m_RangeGaussianTable;
00245 };
00246 
00247 } // end namespace itk
00248 
00249 #ifndef ITK_MANUAL_INSTANTIATION
00250 #include "itkBilateralImageFilter.txx"
00251 #endif
00252 
00253 #endif
00254 

Generated at Tue Jul 29 19:08:58 2008 for ITK by doxygen 1.5.1 written by Dimitri van Heesch, © 1997-2000