![]() |
ITK
4.2.0
Insight Segmentation and Registration Toolkit
|
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 __itkInverseDeconvolutionImageFilter_h 00019 #define __itkInverseDeconvolutionImageFilter_h 00020 00021 #include "itkFFTConvolutionImageFilter.h" 00022 00023 namespace itk 00024 { 00053 template< class TInputImage, class TKernelImage = TInputImage, class TOutputImage = TInputImage, class TInternalPrecision=double > 00054 class ITK_EXPORT InverseDeconvolutionImageFilter : 00055 public FFTConvolutionImageFilter< TInputImage, TKernelImage, TOutputImage, TInternalPrecision > 00056 { 00057 public: 00058 typedef InverseDeconvolutionImageFilter Self; 00059 typedef FFTConvolutionImageFilter< TInputImage, 00060 TKernelImage, 00061 TOutputImage, 00062 TInternalPrecision > Superclass; 00063 typedef SmartPointer< Self > Pointer; 00064 typedef SmartPointer< const Self > ConstPointer; 00065 00067 itkNewMacro(Self); 00068 00070 itkTypeMacro(InverseDeconvolutionImageFilter, FFTConvolutionImageFilter); 00071 00073 itkStaticConstMacro(ImageDimension, unsigned int, 00074 TInputImage::ImageDimension); 00075 00076 typedef TInputImage InputImageType; 00077 typedef TOutputImage OutputImageType; 00078 typedef TKernelImage KernelImageType; 00079 typedef typename Superclass::InputPixelType InputPixelType; 00080 typedef typename Superclass::OutputPixelType OutputPixelType; 00081 typedef typename Superclass::KernelPixelType KernelPixelType; 00082 typedef typename Superclass::InputIndexType InputIndexType; 00083 typedef typename Superclass::OutputIndexType OutputIndexType; 00084 typedef typename Superclass::KernelIndexType KernelIndexType; 00085 typedef typename Superclass::InputSizeType InputSizeType; 00086 typedef typename Superclass::OutputSizeType OutputSizeType; 00087 typedef typename Superclass::KernelSizeType KernelSizeType; 00088 typedef typename Superclass::SizeValueType SizeValueType; 00089 typedef typename Superclass::InputRegionType InputRegionType; 00090 typedef typename Superclass::OutputRegionType OutputRegionType; 00091 typedef typename Superclass::KernelRegionType KernelRegionType; 00092 00094 typedef typename Superclass::InternalImageType InternalImageType; 00095 typedef typename Superclass::InternalImagePointerType InternalImagePointerType; 00096 typedef typename Superclass::InternalComplexType InternalComplexType; 00097 typedef typename Superclass::InternalComplexImageType InternalComplexImageType; 00098 typedef typename Superclass::InternalComplexImagePointerType InternalComplexImagePointerType; 00099 00103 itkSetMacro(KernelZeroMagnitudeThreshold, double); 00104 itkGetConstMacro(KernelZeroMagnitudeThreshold, double); 00106 00107 protected: 00108 InverseDeconvolutionImageFilter(); 00109 ~InverseDeconvolutionImageFilter() {} 00110 00112 void GenerateData(); 00113 00114 virtual void PrintSelf(std::ostream & os, Indent indent) const; 00115 00116 private: 00117 InverseDeconvolutionImageFilter(const Self &); //purposely not implemented 00118 void operator=(const Self &); //purposely not implemented 00119 00120 double m_KernelZeroMagnitudeThreshold; 00121 }; 00122 00123 namespace Functor 00124 { 00125 template< class TInput1, class TInput2, class TOutput > 00126 class InverseDeconvolutionFunctor 00127 { 00128 public: 00129 InverseDeconvolutionFunctor() { m_KernelZeroMagnitudeThreshold = 0.0; } 00130 ~InverseDeconvolutionFunctor() {} 00131 00132 bool operator!=( const InverseDeconvolutionFunctor & ) const 00133 { 00134 return false; 00135 } 00136 bool operator==( const InverseDeconvolutionFunctor & other) const 00137 { 00138 return !(*this != other); 00139 } 00140 inline TOutput operator()(const TInput1 & I, const TInput2 & H) const 00141 { 00142 double absH = std::abs( H ); 00143 TOutput value = NumericTraits< TOutput >::ZeroValue(); 00144 if ( absH >= m_KernelZeroMagnitudeThreshold ) 00145 { 00146 value = static_cast< TOutput >( I / H ); 00147 } 00148 return value; 00149 } 00150 00153 void SetKernelZeroMagnitudeThreshold(double mu) 00154 { 00155 m_KernelZeroMagnitudeThreshold = mu; 00156 } 00157 double GetKernelZeroMagnitudeThreshold() const 00158 { 00159 return m_KernelZeroMagnitudeThreshold; 00160 } 00162 00163 private: 00164 double m_KernelZeroMagnitudeThreshold; 00165 }; 00166 } //namespace Functor 00167 00168 } 00169 00170 #ifndef ITK_MANUAL_INSTANTIATION 00171 #include "itkInverseDeconvolutionImageFilter.hxx" 00172 #endif 00173 00174 #endif 00175
1.7.6.1