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: 2010-06-09 15:25:22 $
00007   Version:   $Revision: 1.42 $
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 
00201   itkSetMacro(InternalNumberOfStreamDivisions,unsigned int);
00202   itkGetConstReferenceMacro(InternalNumberOfStreamDivisions,unsigned int);
00203   
00210   virtual void GenerateInputRequestedRegion() throw(InvalidRequestedRegionError);
00211 
00212 #ifdef ITK_USE_CONCEPT_CHECKING
00213 
00214   itkConceptMacro(OutputHasNumericTraitsCheck,
00215     (Concept::HasNumericTraits<OutputPixelType>));
00216 
00218 #endif
00219 
00220 protected:
00221   DiscreteGaussianImageFilter()
00222     {
00223     m_Variance.Fill(0.0);
00224     m_MaximumError.Fill(0.01);
00225     m_MaximumKernelWidth = 32;
00226     m_UseImageSpacing = true;
00227     m_FilterDimensionality = ImageDimension;
00228     m_InternalNumberOfStreamDivisions = ImageDimension*ImageDimension;
00229     }
00230   virtual ~DiscreteGaussianImageFilter() {}
00231   void PrintSelf(std::ostream& os, Indent indent) const;
00232 
00238   void GenerateData();
00239 
00240   
00241 private:
00242   DiscreteGaussianImageFilter(const Self&); //purposely not implemented
00243   void operator=(const Self&); //purposely not implemented
00244 
00246   ArrayType m_Variance;
00247 
00251   ArrayType m_MaximumError;
00252 
00255   int m_MaximumKernelWidth;
00256 
00258   unsigned int m_FilterDimensionality;
00259 
00261   bool m_UseImageSpacing;
00262 
00265   unsigned int m_InternalNumberOfStreamDivisions;
00266 };
00267 
00268 } // end namespace itk
00269 
00270 #ifndef ITK_MANUAL_INSTANTIATION
00271 #include "itkDiscreteGaussianImageFilter.txx"
00272 #endif
00273 
00274 #endif
00275 

Generated at Mon Jul 12 2010 18:14:16 for ITK by doxygen 1.7.1 written by Dimitri van Heesch, © 1997-2000