18#ifndef itkUnsharpMaskImageFilter_h
19#define itkUnsharpMaskImageFilter_h
54template <
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);
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"
Base class for filters that take an image as input and produce an image as output.
Control indentation during Print() invocation.
Light weight base class for most itk classes.
Define additional traits for native types such as int or float.
static constexpr T NonpositiveMin()
static constexpr T max(const T &)
Computes the smoothing of an image by convolution with the Gaussian kernels implemented as IIR filter...
OutPixelType operator()(const InPixelType &v, const FunctorRealType &s) const
FunctorRealType m_Threshold
ITK_UNEQUAL_OPERATOR_MEMBER_FUNCTION(UnsharpMaskingFunctor)
UnsharpMaskingFunctor(FunctorRealType amount, FunctorRealType threshold, bool clamp)
bool operator==(const UnsharpMaskingFunctor &other) const
typename GaussianType::SigmaArrayType SigmaArrayType
typename TOutputImage::PixelType OutputPixelType
~UnsharpMaskImageFilter() override=default
typename TInputImage::InternalPixelType InputInternalPixelType
typename TInputImage::RegionType InputImageRegionType
TInternalPrecision InternalPrecisionType
void GenerateData() override
void SetSigma(const typename SigmaArrayType::ValueType sigma)
typename InputImageType::Pointer InputImagePointer
typename TInputImage::PixelType InputPixelType
typename TOutputImage::InternalPixelType OutputInternalPixelType
TOutputImage OutputImageType
void GenerateInputRequestedRegion() override
typename TOutputImage::RegionType OutputImageRegionType
TInputImage InputImageType
void PrintSelf(std::ostream &os, Indent indent) const override
void VerifyPreconditions() const override
Verifies that the process object has been configured correctly, that all required inputs are set,...
SmartPointer< Self > Pointer
#define itkConceptMacro(name, concept)
ImageBaseType::RegionType RegionType
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....