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)
124 auto sigmas = MakeFilled<SigmaArrayType>(sigma);
125 this->SetSigmas(sigmas);
130 itkSetMacro(Amount, TInternalPrecision);
131 itkGetConstMacro(Amount, TInternalPrecision);
136 itkSetMacro(Threshold, TInternalPrecision);
137 itkGetConstMacro(Threshold, TInternalPrecision);
142 itkSetMacro(Clamp,
bool);
143 itkGetConstMacro(Clamp,
bool);
144 itkBooleanMacro(Clamp);
159 GenerateInputRequestedRegion()
override;
162 VerifyPreconditions()
const override;
164 GenerateData()
override;
167 PrintSelf(std::ostream & os,
Indent indent)
const override;
171 TInternalPrecision m_Amount{};
172 TInternalPrecision m_Threshold{};
176 template <
typename InPixelType,
typename FunctorRealType = TInternalPrecision,
typename OutPixelType = InPixelType>
182 bool m_Clamp{
false };
193 , m_Threshold(threshold)
196 assert(m_Threshold >= 0.0);
208 operator()(
const InPixelType & v,
const FunctorRealType & s)
const
210 FunctorRealType diff = v - s;
211 FunctorRealType result;
212 if (diff > m_Threshold)
214 result = v + (diff - m_Threshold) * m_Amount;
216 else if (-diff > m_Threshold)
218 result = v + (diff + m_Threshold) * m_Amount;
237 return static_cast<OutPixelType>(result);
243 #ifndef ITK_MANUAL_INSTANTIATION
244 # include "itkUnsharpMaskImageFilter.hxx"