ITK  4.1.0
Insight Segmentation and Registration Toolkit
itkLandweberDeconvolutionImageFilter.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 __itkLandweberDeconvolutionImageFilter_h
00019 #define __itkLandweberDeconvolutionImageFilter_h
00020 
00021 #include "itkIterativeDeconvolutionImageFilter.h"
00022 
00023 #include "itkComplexConjugateImageAdaptor.h"
00024 #include "itkTernaryFunctorImageFilter.h"
00025 
00026 namespace itk
00027 {
00028 namespace Functor
00029 {
00034 template< class TInput1, class TInput2, class TInput3, class TOutput >
00035 class LandweberMethod
00036 {
00037 public:
00038   LandweberMethod() {}
00039   ~LandweberMethod() {}
00040 
00041   bool operator!=(const LandweberMethod &) const
00042   {
00043     return false;
00044   }
00045 
00046   bool operator==(const LandweberMethod & other) const
00047   {
00048     return !( *this != other );
00049   }
00050 
00051   inline TOutput operator()(const TInput1 & estimateFT,
00052                             const TInput2 & kernelFT,
00053                             const TInput2 & inputFT) const
00054   {
00055     return m_Alpha * std::conj( kernelFT ) * inputFT +
00056       ( 1.0 - m_Alpha * std::norm( kernelFT ) ) * estimateFT;
00057   }
00058 
00059   typename TInput1::value_type m_Alpha;
00060 
00061 };
00062 } // end namespace Functor
00063 
00100 template< class TInputImage, class TKernelImage=TInputImage, class TOutputImage=TInputImage >
00101 class ITK_EXPORT LandweberDeconvolutionImageFilter :
00102     public IterativeDeconvolutionImageFilter< TInputImage, TKernelImage, TOutputImage >
00103 {
00104 public:
00106   typedef LandweberDeconvolutionImageFilter                 Self;
00107   typedef IterativeDeconvolutionImageFilter< TInputImage,
00108                                              TKernelImage,
00109                                              TOutputImage > Superclass;
00110   typedef SmartPointer< Self >                              Pointer;
00111   typedef SmartPointer< const Self >                        ConstPointer;
00112 
00114   typedef TInputImage  InputImageType;
00115   typedef TKernelImage KernelImageType;
00116   typedef TOutputImage OutputImageType;
00117 
00119   typedef typename Superclass::InternalImageType               InternalImageType;
00120   typedef typename Superclass::InternalImagePointerType        InternalImagePointerType;
00121   typedef typename Superclass::InternalComplexType             InternalComplexType;
00122   typedef typename Superclass::InternalComplexImageType        InternalComplexImageType;
00123   typedef typename Superclass::InternalComplexImagePointerType InternalComplexImagePointerType;
00124 
00126   itkNewMacro(Self);
00127 
00129   itkTypeMacro(LandweberDeconvolutionImageFilter,
00130                IterativeDeconvolutionImageFilter);
00131 
00133   itkSetMacro(Alpha, double);
00134   itkGetMacro(Alpha, double);
00136 
00137 protected:
00138   LandweberDeconvolutionImageFilter();
00139   virtual ~LandweberDeconvolutionImageFilter();
00140 
00141   virtual void Initialize(ProgressAccumulator * progress,
00142                           float progressWeight,
00143                           float iterationProgressWeight);
00144 
00145   virtual void Iteration(ProgressAccumulator * progress,
00146                          float iterationProgressWeight);
00147 
00148   virtual void Finish(ProgressAccumulator *progress, float progressWeight);
00149 
00150   typedef typename Superclass::FFTFilterType  FFTFilterType;
00151   typedef typename Superclass::IFFTFilterType IFFTFilterType;
00152 
00153   virtual void PrintSelf(std::ostream & os, Indent indent) const;
00154 
00155 private:
00156   LandweberDeconvolutionImageFilter(const Self &); // purposely not implemented
00157   void operator=(const Self &);                    //purposely not implemented
00158 
00159   double m_Alpha;
00160 
00161   InternalComplexImagePointerType m_TransformedInput;
00162 
00163   typedef Functor::LandweberMethod< InternalComplexType,
00164                                     InternalComplexType,
00165                                     InternalComplexType,
00166                                     InternalComplexType > LandweberFunctor;
00167   typedef TernaryFunctorImageFilter< InternalComplexImageType,
00168                                      InternalComplexImageType,
00169                                      InternalComplexImageType,
00170                                      InternalComplexImageType,
00171                                      LandweberFunctor >   LandweberFilterType;
00172 
00173   typename LandweberFilterType::Pointer  m_LandweberFilter;
00174   typename IFFTFilterType::Pointer       m_IFFTFilter;
00175 };
00176 
00177 } // end namespace itk
00178 
00179 #ifndef ITK_MANUAL_INSTANTIATION
00180 #include "itkLandweberDeconvolutionImageFilter.hxx"
00181 #endif
00182 
00183 #endif
00184