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: 2009-04-25 12:27:11 $
00007   Version:   $Revision: 1.21 $
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> NeighborhoodIteratorType;
00110 
00112   typedef
00113   Neighborhood<double, itkGetStaticConstMacro(ImageDimension)> KernelType;
00114   typedef typename KernelType::SizeType                        SizeType;
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   itkGetConstMacro(DomainSigma, const ArrayType);
00129   itkSetMacro(RangeSigma, double);
00130   itkGetConstMacro(RangeSigma, double);
00131   itkGetConstMacro(FilterDimensionality, unsigned int);
00132   itkSetMacro(FilterDimensionality, unsigned int);
00134 
00137   void SetDomainSigma(const double v)
00138     {
00139     m_DomainSigma.Fill(v);
00140     }
00141 
00147   itkBooleanMacro(AutomaticKernelSize);
00148   itkGetConstMacro(AutomaticKernelSize, bool);
00149   itkSetMacro(AutomaticKernelSize, bool);
00151 
00154   void SetRadius(const unsigned long);
00155   itkSetMacro(Radius, SizeType);
00156   itkGetConstReferenceMacro(Radius, SizeType);
00158 
00159   
00163   itkSetMacro(NumberOfRangeGaussianSamples, unsigned long);
00164   itkGetConstMacro(NumberOfRangeGaussianSamples, unsigned long);
00166 
00167 #ifdef ITK_USE_CONCEPT_CHECKING
00168 
00169   itkConceptMacro(OutputHasNumericTraitsCheck,
00170                   (Concept::HasNumericTraits<OutputPixelType>));
00171 
00173 #endif
00174 
00175 protected:
00178   BilateralImageFilter()
00179     {
00180     m_Radius.Fill(1);
00181     m_AutomaticKernelSize = true;
00182     m_DomainSigma.Fill(4.0);
00183     m_RangeSigma = 50.0;
00184     m_FilterDimensionality = ImageDimension;
00185     m_NumberOfRangeGaussianSamples = 100;
00186     m_DynamicRange = 0.0;
00187     m_DynamicRangeUsed = 0.0;
00188     m_DomainMu = 2.5;  // keep small to keep kernels small
00189     m_RangeMu = 4.0;   // can be bigger then DomainMu since we only
00190                        // index into a single table
00192 
00193     }
00194   virtual ~BilateralImageFilter() {}
00195   void PrintSelf(std::ostream& os, Indent indent) const;
00196 
00198   void BeforeThreadedGenerateData();
00199 
00202   void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread,
00203                             int threadId); 
00204 
00211   virtual void GenerateInputRequestedRegion() throw(InvalidRequestedRegionError);
00212 
00213   
00214 private:
00215   BilateralImageFilter(const Self&); //purposely not implemented
00216   void operator=(const Self&); //purposely not implemented
00217 
00220   double m_RangeSigma;
00221 
00224   ArrayType m_DomainSigma;
00225 
00228   double m_DomainMu;
00229   double m_RangeMu;
00230 
00232   unsigned int m_FilterDimensionality;
00233 
00235   KernelType m_GaussianKernel;
00236   SizeType   m_Radius;
00237   bool       m_AutomaticKernelSize;
00238 
00240   unsigned long       m_NumberOfRangeGaussianSamples;
00241   double              m_DynamicRange;
00242   double              m_DynamicRangeUsed;
00243   std::vector<double> m_RangeGaussianTable;
00244 };
00245 
00246 } // end namespace itk
00247 
00248 #ifndef ITK_MANUAL_INSTANTIATION
00249 #include "itkBilateralImageFilter.txx"
00250 #endif
00251 
00252 #endif
00253 

Generated at Mon Jul 12 2010 17:46:39 for ITK by doxygen 1.7.1 written by Dimitri van Heesch, © 1997-2000