ITK  4.0.0
Insight Segmentation and Registration Toolkit
itkGradientRecursiveGaussianImageFilter.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 __itkGradientRecursiveGaussianImageFilter_h
00019 #define __itkGradientRecursiveGaussianImageFilter_h
00020 
00021 #include "itkRecursiveGaussianImageFilter.h"
00022 #include "itkNthElementImageAdaptor.h"
00023 #include "itkImage.h"
00024 #include "itkCovariantVector.h"
00025 #include "itkPixelTraits.h"
00026 #include "itkProgressAccumulator.h"
00027 #include <vector>
00028 
00029 namespace itk
00030 {
00046 // NOTE that the typename macro has to be used here in lieu
00047 // of "typename" because VC++ doesn't like the typename keyword
00048 // on the defaults of template parameters
00049 template< typename TInputImage,
00050           typename TOutputImage = Image< CovariantVector<
00051                                            typename NumericTraits< typename TInputImage::PixelType >::RealType,
00052                                            ::itk::GetImageDimension< TInputImage >::ImageDimension >,
00053                                          ::itk::GetImageDimension< TInputImage >::ImageDimension > >
00054 class ITK_EXPORT GradientRecursiveGaussianImageFilter:
00055   public ImageToImageFilter< TInputImage, TOutputImage >
00056 {
00057 public:
00059   typedef GradientRecursiveGaussianImageFilter            Self;
00060   typedef ImageToImageFilter< TInputImage, TOutputImage > Superclass;
00061   typedef SmartPointer< Self >                            Pointer;
00062   typedef SmartPointer< const Self >                      ConstPointer;
00063 
00065   typedef TInputImage                                   InputImageType;
00066   typedef typename TInputImage::PixelType               PixelType;
00067   typedef typename NumericTraits< PixelType >::RealType RealType;
00068 
00070   itkStaticConstMacro(ImageDimension, unsigned int,
00071                       TInputImage::ImageDimension);
00072 
00077   typedef float InternalRealType;
00078   typedef Image< InternalRealType,
00079                  itkGetStaticConstMacro(ImageDimension) >   RealImageType;
00080 
00085   typedef NthElementImageAdaptor< TOutputImage,
00086                                   InternalRealType >  OutputImageAdaptorType;
00087 
00088   typedef typename OutputImageAdaptorType::Pointer OutputImageAdaptorPointer;
00089 
00091   typedef RecursiveGaussianImageFilter<
00092     RealImageType,
00093     RealImageType
00094     >    GaussianFilterType;
00095 
00097   typedef RecursiveGaussianImageFilter<
00098     InputImageType,
00099     RealImageType
00100     >    DerivativeFilterType;
00101 
00103   typedef typename GaussianFilterType::Pointer GaussianFilterPointer;
00104 
00106   typedef typename DerivativeFilterType::Pointer DerivativeFilterPointer;
00107 
00109   typedef typename TOutputImage::Pointer OutputImagePointer;
00110 
00112   typedef TOutputImage                                       OutputImageType;
00113   typedef typename          OutputImageType::PixelType       OutputPixelType;
00114   typedef typename PixelTraits< OutputPixelType >::ValueType OutputComponentType;
00115 
00117   itkNewMacro(Self);
00118 
00120   itkTypeMacro(GradientRecursiveGaussianImageFilter,
00121                ImageToImageFilter);
00122 
00124   void SetSigma(RealType sigma);
00125 
00129   void SetNormalizeAcrossScale(bool normalizeInScaleSpace);
00130   itkGetConstMacro(NormalizeAcrossScale, bool);
00132 
00138   virtual void GenerateInputRequestedRegion()
00139   throw( InvalidRequestedRegionError );
00140 
00151   itkSetMacro(UseImageDirection, bool);
00152   itkGetConstMacro(UseImageDirection, bool);
00153   itkBooleanMacro(UseImageDirection);
00155 
00156 #ifdef ITK_USE_CONCEPT_CHECKING
00157 
00158   itkConceptMacro( InputHasNumericTraitsCheck,
00159                    ( Concept::HasNumericTraits< PixelType > ) );
00160   itkConceptMacro( OutputHasPixelTraitsCheck,
00161                    ( Concept::HasPixelTraits< OutputPixelType > ) );
00162 
00164 #endif
00165 protected:
00166   GradientRecursiveGaussianImageFilter();
00167   virtual ~GradientRecursiveGaussianImageFilter() {}
00168   void PrintSelf(std::ostream & os, Indent indent) const;
00170 
00172   void GenerateData(void);
00173 
00174   // Override since the filter produces the entire dataset
00175   void EnlargeOutputRequestedRegion(DataObject *output);
00176 
00177 private:
00178   GradientRecursiveGaussianImageFilter(const Self &); //purposely not
00179                                                       // implemented
00180   void operator=(const Self &);                       //purposely not
00181 
00182   // implemented
00183 
00184   std::vector< GaussianFilterPointer > m_SmoothingFilters;
00185   DerivativeFilterPointer              m_DerivativeFilter;
00186   OutputImageAdaptorPointer            m_ImageAdaptor;
00187 
00189   bool m_NormalizeAcrossScale;
00190 
00192   bool m_UseImageDirection;
00193 };
00194 } // end namespace itk
00195 
00196 #ifndef ITK_MANUAL_INSTANTIATION
00197 #include "itkGradientRecursiveGaussianImageFilter.hxx"
00198 #endif
00199 
00200 #endif
00201