18 #ifndef itkUnsharpMaskImageFilter_h
19 #define itkUnsharpMaskImageFilter_h
54 template<
typename TInputImage,
typename TOutputImage = TInputImage,
typename TInternalPrecision =
float >
76 static constexpr
unsigned int ImageDimension = TOutputImage::ImageDimension;
77 static constexpr
unsigned int InputImageDimension = TInputImage::ImageDimension;
104 #ifdef ITK_USE_CONCEPT_CHECKING
125 void SetSigma(
const typename SigmaArrayType::ValueType sigma)
129 this->SetSigmas(sigmas);
134 itkSetMacro(Amount, TInternalPrecision);
135 itkGetConstMacro(Amount, TInternalPrecision);
140 itkSetMacro(Threshold, TInternalPrecision);
141 itkGetConstMacro(Threshold, TInternalPrecision);
146 itkSetMacro(Clamp,
bool);
147 itkGetConstMacro(Clamp,
bool);
148 itkBooleanMacro(Clamp);
162 void GenerateInputRequestedRegion()
override;
164 void VerifyPreconditions() ITKv5_CONST override;
165 void GenerateData() override;
167 void 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>
194 m_Threshold(threshold),
197 assert(m_Threshold >= 0.0);
209 return !(*
this == other);
212 inline OutPixelType
operator()(
const InPixelType & v,
const FunctorRealType & s)
const
214 FunctorRealType diff = v - s;
215 FunctorRealType result;
216 if (diff > m_Threshold)
218 result = v + (diff - m_Threshold)*m_Amount;
220 else if (-diff > m_Threshold)
222 result = v + (diff + m_Threshold)*m_Amount;
231 if (result < itk::NumericTraits< OutPixelType >::NonpositiveMin())
233 return itk::NumericTraits< OutPixelType >::NonpositiveMin();
235 else if (result > itk::NumericTraits< OutPixelType >::max())
237 return itk::NumericTraits< OutPixelType >::max();
241 return static_cast<OutPixelType
>(result);
247 #ifndef ITK_MANUAL_INSTANTIATION
248 #include "itkUnsharpMaskImageFilter.hxx"
typename TInputImage::InternalPixelType InputInternalPixelType
OutPixelType operator()(const InPixelType &v, const FunctorRealType &s) const
typename TInputImage::PixelType InputPixelType
typename TOutputImage::PixelType OutputPixelType
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
Base class for all process objects that output image data.
TInputImage InputImageType
typename TOutputImage::InternalPixelType OutputInternalPixelType
bool operator==(const UnsharpMaskingFunctor &other)
void SetSigma(const typename SigmaArrayType::ValueType sigma)
typename InputImageType::Pointer InputImagePointer
bool operator!=(const Index< VDimension > &one, const Index< VDimension > &two)
FunctorRealType m_Threshold
typename OutputImageType::RegionType OutputImageRegionType
UnsharpMaskingFunctor(FunctorRealType amount, FunctorRealType threshold, bool clamp)
TOutputImage OutputImageType
Computes the smoothing of an image by convolution with the Gaussian kernels implemented as IIR filter...
typename InputImageType::RegionType InputImageRegionType
TInternalPrecision InternalPrecisionType
Base class for filters that take an image as input and produce an image as output.
Control indentation during Print() invocation.
ImageBaseType::RegionType RegionType
#define itkConceptMacro(name, concept)
Templated n-dimensional image class.
typename GaussianType::SigmaArrayType SigmaArrayType