ITK  4.1.0
Insight Segmentation and Registration Toolkit
itkLaplacianRecursiveGaussianImageFilter.h
Go to the documentation of this file.
00001 /*=========================================================================
00002  *
00003  *  Copyright Insight Software Consortium
00004  *
00005  *  Licensed under the Apache License, Version 2.0 (the "License");
00006  *  you may not use this file except in compliance with the License.
00007  *  You may obtain a copy of the License at
00008  *
00009  *         http://www.apache.org/licenses/LICENSE-2.0.txt
00010  *
00011  *  Unless required by applicable law or agreed to in writing, software
00012  *  distributed under the License is distributed on an "AS IS" BASIS,
00013  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00014  *  See the License for the specific language governing permissions and
00015  *  limitations under the License.
00016  *
00017  *=========================================================================*/
00018 #ifndef __itkLaplacianRecursiveGaussianImageFilter_h
00019 #define __itkLaplacianRecursiveGaussianImageFilter_h
00020 
00021 #include "itkRecursiveGaussianImageFilter.h"
00022 #include "itkImage.h"
00023 #include "itkCommand.h"
00024 
00025 namespace itk
00026 {
00042 template< typename TInputImage,
00043           typename TOutputImage = TInputImage >
00044 class ITK_EXPORT LaplacianRecursiveGaussianImageFilter:
00045   public ImageToImageFilter< TInputImage, TOutputImage >
00046 {
00047 public:
00049   typedef LaplacianRecursiveGaussianImageFilter           Self;
00050   typedef ImageToImageFilter< TInputImage, TOutputImage > Superclass;
00051   typedef SmartPointer< Self >                            Pointer;
00052   typedef SmartPointer< const Self >                      ConstPointer;
00053 
00055   typedef TInputImage                        InputImageType;
00056   typedef typename InputImageType::PixelType PixelType;
00057 
00059   itkStaticConstMacro(ImageDimension, unsigned int,
00060                       TInputImage::ImageDimension);
00061 
00062   typedef typename NumericTraits< PixelType >::RealType RealType;
00063 
00067   typedef float InternalRealType;
00068   typedef Image< InternalRealType,
00069                  itkGetStaticConstMacro(ImageDimension) >   RealImageType;
00070 
00072   typedef RecursiveGaussianImageFilter<
00073     RealImageType,
00074     RealImageType
00075     >    GaussianFilterType;
00076 
00078   typedef RecursiveGaussianImageFilter<
00079     InputImageType,
00080     RealImageType
00081     >    DerivativeFilterType;
00082 
00084   typedef typename GaussianFilterType::Pointer GaussianFilterPointer;
00085 
00087   typedef typename DerivativeFilterType::Pointer DerivativeFilterPointer;
00088 
00090   typedef typename TOutputImage::Pointer OutputImagePointer;
00091 
00093   typedef TOutputImage                                 OutputImageType;
00094   typedef typename          OutputImageType::PixelType OutputPixelType;
00095 
00096 
00098   typedef          MemberCommand< Self > CommandType;
00099   typedef typename CommandType::Pointer  CommandPointer;
00100 
00102   itkNewMacro(Self);
00103 
00105   itkTypeMacro(LaplacianRecursiveGaussianImageFilter,
00106                ImageToImageFilter);
00107 
00109   void SetSigma(RealType sigma);
00110 
00114   void SetNormalizeAcrossScale(bool normalizeInScaleSpace);\
00115   itkGetConstMacro(NormalizeAcrossScale, bool);
00117 
00118 protected:
00119   LaplacianRecursiveGaussianImageFilter();
00120   virtual ~LaplacianRecursiveGaussianImageFilter() {}
00121   void PrintSelf(std::ostream & os, Indent indent) const;
00122 
00124   void GenerateData(void);
00125 
00126   // Override since the filter produces the entire dataset
00127   void EnlargeOutputRequestedRegion(DataObject *output);
00128 
00129 private:
00130   LaplacianRecursiveGaussianImageFilter(const Self &); //purposely not
00131                                                        // implemented
00132   void operator=(const Self &);                        //purposely not
00133                                                        // implemented
00134 
00135   // special binary functor to perform A+B*ConstValue
00136   //
00137   // Where A is the cumulativeImage, B is the last filter, and
00138   // ConstValue is the spacing scalling
00139   class AddMultConstFunctor
00140   {
00141   public:
00142     typedef AddMultConstFunctor Self;
00143 
00144     AddMultConstFunctor( void ) : m_Value( NumericTraits<PixelType>::One ) {}
00145 
00146     bool operator!=( const Self &other ) const { return !(*this==other); }
00147     bool operator==( const Self &other ) const { return m_Value == other.m_Value; }
00148 
00149     inline InternalRealType operator()( const InternalRealType &a, const InternalRealType &b ) const
00150     {
00151       return static_cast<InternalRealType>( a + b*m_Value );
00152     }
00153 
00154     RealType m_Value;
00155   };
00156 
00157   GaussianFilterPointer   m_SmoothingFilters[ImageDimension - 1];
00158   DerivativeFilterPointer m_DerivativeFilter;
00159 
00161   bool m_NormalizeAcrossScale;
00162 };
00163 } // end namespace itk
00164 
00165 #ifndef ITK_MANUAL_INSTANTIATION
00166 #include "itkLaplacianRecursiveGaussianImageFilter.hxx"
00167 #endif
00168 
00169 #endif
00170