18 #ifndef itkUnsharpMaskImageFilter_h
19 #define itkUnsharpMaskImageFilter_h
54 template <
typename TInputImage,
typename TOutputImage = TInputImage,
typename TInternalPrecision =
float>
75 static constexpr
unsigned int ImageDimension = TOutputImage::ImageDimension;
76 static constexpr
unsigned int InputImageDimension = TInputImage::ImageDimension;
103 #ifdef ITK_USE_CONCEPT_CHECKING
122 SetSigma(
const typename SigmaArrayType::ValueType sigma)
126 this->SetSigmas(sigmas);
131 itkSetMacro(Amount, TInternalPrecision);
132 itkGetConstMacro(Amount, TInternalPrecision);
137 itkSetMacro(Threshold, TInternalPrecision);
138 itkGetConstMacro(Threshold, TInternalPrecision);
143 itkSetMacro(Clamp,
bool);
144 itkGetConstMacro(Clamp,
bool);
145 itkBooleanMacro(Clamp);
160 GenerateInputRequestedRegion()
override;
163 VerifyPreconditions() ITKv5_CONST override;
165 GenerateData() override;
168 PrintSelf(std::ostream & os,
Indent indent) const override;
172 TInternalPrecision m_Amount;
173 TInternalPrecision m_Threshold;
177 template <typename InPixelType, typename FunctorRealType = TInternalPrecision, typename OutPixelType = InPixelType>
183 bool m_Clamp{
false };
194 , m_Threshold(threshold)
197 assert(m_Threshold >= 0.0);
209 return !(*
this == other);
213 operator()(
const InPixelType & v,
const FunctorRealType & s)
const
215 FunctorRealType diff = v - s;
216 FunctorRealType result;
217 if (diff > m_Threshold)
219 result = v + (diff - m_Threshold) * m_Amount;
221 else if (-diff > m_Threshold)
223 result = v + (diff + m_Threshold) * m_Amount;
242 return static_cast<OutPixelType>(result);
248 #ifndef ITK_MANUAL_INSTANTIATION
249 # include "itkUnsharpMaskImageFilter.hxx"