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

itkDiscreteGaussianImageFilter.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkDiscreteGaussianImageFilter.h,v $
00005   Language:  C++
00006   Date:      $Date: 2009-04-25 12:27:21 $
00007   Version:   $Revision: 1.41 $
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 __itkDiscreteGaussianImageFilter_h
00018 #define __itkDiscreteGaussianImageFilter_h
00019 
00020 #include "itkImageToImageFilter.h"
00021 #include "itkFixedArray.h"
00022 #include "itkImage.h"
00023 
00024 namespace itk
00025 {
00055 template <class TInputImage, class TOutputImage >
00056 class ITK_EXPORT DiscreteGaussianImageFilter :
00057     public ImageToImageFilter< TInputImage, TOutputImage > 
00058 {
00059 public:
00061   typedef DiscreteGaussianImageFilter                     Self;
00062   typedef ImageToImageFilter< TInputImage, TOutputImage > Superclass;
00063   typedef SmartPointer<Self>                              Pointer;
00064   typedef SmartPointer<const Self>                        ConstPointer;
00065 
00067   itkNewMacro(Self);
00068 
00070   itkTypeMacro(DiscreteGaussianImageFilter, ImageToImageFilter);
00071 
00073   typedef TInputImage  InputImageType;
00074   typedef TOutputImage OutputImageType;
00075 
00078   typedef typename TOutputImage::PixelType         OutputPixelType;
00079   typedef typename TOutputImage::InternalPixelType OutputInternalPixelType;
00080   typedef typename TInputImage::PixelType          InputPixelType;
00081   typedef typename TInputImage::InternalPixelType  InputInternalPixelType;
00082 
00085   itkStaticConstMacro(ImageDimension, unsigned int,
00086                       TOutputImage::ImageDimension);
00087 
00089   typedef FixedArray<double, itkGetStaticConstMacro(ImageDimension)> ArrayType;
00090 
00097   itkSetMacro(Variance, ArrayType);
00098   itkGetConstMacro(Variance, const ArrayType);
00100 
00104   itkSetMacro(MaximumError, ArrayType);
00105   itkGetConstMacro(MaximumError, const ArrayType);
00107 
00110   itkGetConstMacro(MaximumKernelWidth, int);
00111   itkSetMacro(MaximumKernelWidth, int);
00113 
00119   itkGetConstMacro(FilterDimensionality, unsigned int);
00120   itkSetMacro(FilterDimensionality, unsigned int);
00122 
00125   void SetVariance (const typename ArrayType::ValueType v)
00126     {
00127     m_Variance.Fill(v);
00128     }
00129 
00130   void SetMaximumError (const typename ArrayType::ValueType v)
00131     {
00132     m_MaximumError.Fill(v);
00133     }
00134 
00135   void SetVariance (const double *v)
00136     {
00137     ArrayType dv;
00138     for (unsigned int i = 0; i < ImageDimension; i++)
00139       {
00140       dv[i] = v[i];
00141       }
00142     this->SetVariance(dv);
00143     }
00144 
00145   void SetVariance (const float *v)
00146     {
00147     ArrayType dv;
00148     for (unsigned int i = 0; i < ImageDimension; i++)
00149       {
00150       dv[i] = v[i];
00151       }
00152     this->SetVariance(dv);
00153     }
00154 
00155   void SetMaximumError (const double *v)
00156     {
00157     ArrayType dv;
00158     for (unsigned int i = 0; i < ImageDimension; i++)
00159       {
00160       dv[i] = v[i];
00161       }
00162     this->SetMaximumError(dv);
00163     }
00164 
00165   void SetMaximumError (const float *v)
00166     {
00167     ArrayType dv;
00168     for (unsigned int i = 0; i < ImageDimension; i++)
00169       {
00170       dv[i] = v[i];
00171       }
00172     this->SetMaximumError(dv);
00173     }
00174 
00178   void SetUseImageSpacingOn()
00179     { this->SetUseImageSpacing(true); }
00180 
00183   void SetUseImageSpacingOff()
00184     { this->SetUseImageSpacing(false); }
00185 
00188   itkSetMacro(UseImageSpacing, bool);
00189   itkGetConstMacro(UseImageSpacing, bool);
00191 
00198   virtual void GenerateInputRequestedRegion() throw(InvalidRequestedRegionError);
00199 
00200 #ifdef ITK_USE_CONCEPT_CHECKING
00201 
00202   itkConceptMacro(OutputHasNumericTraitsCheck,
00203     (Concept::HasNumericTraits<OutputPixelType>));
00204 
00206 #endif
00207 
00208 protected:
00209   DiscreteGaussianImageFilter()
00210     {
00211     m_Variance.Fill(0.0);
00212     m_MaximumError.Fill(0.01);
00213     m_MaximumKernelWidth = 32;
00214     m_UseImageSpacing = true;
00215     m_FilterDimensionality = ImageDimension;
00216     }
00217   virtual ~DiscreteGaussianImageFilter() {}
00218   void PrintSelf(std::ostream& os, Indent indent) const;
00219 
00225   void GenerateData();
00226 
00227   
00228 private:
00229   DiscreteGaussianImageFilter(const Self&); //purposely not implemented
00230   void operator=(const Self&); //purposely not implemented
00231 
00233   ArrayType m_Variance;
00234 
00238   ArrayType m_MaximumError;
00239 
00242   int m_MaximumKernelWidth;
00243 
00245   unsigned int m_FilterDimensionality;
00246 
00248   bool m_UseImageSpacing;
00249 };
00250 
00251 } // end namespace itk
00252 
00253 #ifndef ITK_MANUAL_INSTANTIATION
00254 #include "itkDiscreteGaussianImageFilter.txx"
00255 #endif
00256 
00257 #endif
00258 

Generated at Tue Sep 15 02:48:46 2009 for ITK by doxygen 1.5.8 written by Dimitri van Heesch, © 1997-2000