ITK  4.1.0
Insight Segmentation and Registration Toolkit
itkHessianRecursiveGaussianImageFilter.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 __itkHessianRecursiveGaussianImageFilter_h
00019 #define __itkHessianRecursiveGaussianImageFilter_h
00020 
00021 #include "itkRecursiveGaussianImageFilter.h"
00022 #include "itkNthElementImageAdaptor.h"
00023 #include "itkImage.h"
00024 #include "itkSymmetricSecondRankTensor.h"
00025 #include "itkPixelTraits.h"
00026 
00027 namespace itk
00028 {
00041 // NOTE that the typename macro has to be used here in lieu
00042 // of "typename" because VC++ doesn't like the typename keyword
00043 // on the defaults of template parameters
00044 template< typename TInputImage,
00045           typename TOutputImage = Image< SymmetricSecondRankTensor<
00046                                            typename NumericTraits< typename TInputImage::PixelType >::RealType,
00047                                            ::itk::GetImageDimension< TInputImage >::ImageDimension >,
00048                                          ::itk::GetImageDimension< TInputImage >::ImageDimension > >
00049 class ITK_EXPORT HessianRecursiveGaussianImageFilter:
00050   public ImageToImageFilter< TInputImage, TOutputImage >
00051 {
00052 public:
00054   typedef HessianRecursiveGaussianImageFilter             Self;
00055   typedef ImageToImageFilter< TInputImage, TOutputImage > Superclass;
00056   typedef SmartPointer< Self >                            Pointer;
00057   typedef SmartPointer< const Self >                      ConstPointer;
00058 
00060   typedef TInputImage                                   InputImageType;
00061   typedef typename TInputImage::PixelType               PixelType;
00062   typedef typename NumericTraits< PixelType >::RealType RealType;
00063 
00065   itkStaticConstMacro(ImageDimension, unsigned int,
00066                       ::itk::GetImageDimension< TInputImage >::ImageDimension);
00067 
00069   itkStaticConstMacro(NumberOfSmoothingFilters, unsigned int,
00070                       ::itk::GetImageDimension< TInputImage >::ImageDimension - 2);
00071 
00076   typedef float InternalRealType;
00077   typedef Image<
00078     InternalRealType,
00079     ::itk::GetImageDimension< TInputImage >::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     >    DerivativeFilterAType;
00101 
00102   typedef RecursiveGaussianImageFilter<
00103     RealImageType,
00104     RealImageType
00105     >    DerivativeFilterBType;
00106 
00108   typedef typename GaussianFilterType::Pointer GaussianFilterPointer;
00109   typedef std::vector< GaussianFilterPointer > GaussianFiltersArray;
00110 
00112   typedef typename DerivativeFilterAType::Pointer DerivativeFilterAPointer;
00113   typedef typename DerivativeFilterBType::Pointer DerivativeFilterBPointer;
00114 
00116   typedef typename TOutputImage::Pointer OutputImagePointer;
00117 
00119   typedef TOutputImage                                       OutputImageType;
00120   typedef typename          OutputImageType::PixelType       OutputPixelType;
00121   typedef typename PixelTraits< OutputPixelType >::ValueType OutputComponentType;
00122 
00124   itkTypeMacro(HessianRecursiveGaussianImageFilter, ImageToImageFilter);
00125 
00127   itkNewMacro(Self);
00128 
00130   void SetSigma(RealType sigma);
00131 
00135   void SetNormalizeAcrossScale(bool normalizeInScaleSpace);
00136   itkGetConstMacro(NormalizeAcrossScale, bool);
00138 
00144   virtual void GenerateInputRequestedRegion()
00145   throw( InvalidRequestedRegionError );
00146 
00147 #ifdef ITK_USE_CONCEPT_CHECKING
00148 
00149   itkConceptMacro( InputHasNumericTraitsCheck,
00150                    ( Concept::HasNumericTraits< PixelType > ) );
00151   itkConceptMacro( OutputHasPixelTraitsCheck,
00152                    ( Concept::HasPixelTraits< OutputPixelType > ) );
00153 
00155 #endif
00156 protected:
00157 
00158   HessianRecursiveGaussianImageFilter();
00159   virtual ~HessianRecursiveGaussianImageFilter() {}
00160   void PrintSelf(std::ostream & os, Indent indent) const;
00161 
00163   void GenerateData(void);
00164 
00165   // Override since the filter produces the entire dataset
00166   void EnlargeOutputRequestedRegion(DataObject *output);
00167 
00168 private:
00169 
00170   HessianRecursiveGaussianImageFilter(const Self &); //purposely not implemented
00171   void operator=(const Self &);                      //purposely not implemented
00172 
00173   GaussianFiltersArray      m_SmoothingFilters;
00174   DerivativeFilterAPointer  m_DerivativeFilterA;
00175   DerivativeFilterBPointer  m_DerivativeFilterB;
00176   OutputImageAdaptorPointer m_ImageAdaptor;
00177 
00179   bool m_NormalizeAcrossScale;
00180 };
00181 } // end namespace itk
00182 
00183 #ifndef ITK_MANUAL_INSTANTIATION
00184 #include "itkHessianRecursiveGaussianImageFilter.hxx"
00185 #endif
00186 
00187 #endif
00188