Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
itkLocalVariationImageFilter.h
Go to the documentation of this file.
1 /*============================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
13 #ifndef itkLocalVariationImageFilter_h
14 #define itkLocalVariationImageFilter_h
15 
16 #include <itkImage.h>
17 #include <itkImageToImageFilter.h>
18 
19 namespace itk
20 {
34  template <class TPixelType>
36  {
37  public:
43  static double Calc(TPixelType p);
44  };
45 
71  template <class TInputImage, class TOutputImage>
72  class LocalVariationImageFilter : public ImageToImageFilter<TInputImage, TOutputImage>
73  {
74  public:
76  itkStaticConstMacro(InputImageDimension, unsigned int, TInputImage::ImageDimension);
77  itkStaticConstMacro(OutputImageDimension, unsigned int, TOutputImage::ImageDimension);
78 
80  typedef TInputImage InputImageType;
81  typedef TOutputImage OutputImageType;
82 
85  typedef ImageToImageFilter<InputImageType, OutputImageType> Superclass;
88 
90  itkFactorylessNewMacro(Self);
91  itkCloneMacro(Self);
92 
94  itkTypeMacro(LocalVariationImageFilter, ImageToImageFilter);
95 
97  typedef typename InputImageType::PixelType InputPixelType;
98  typedef typename OutputImageType::PixelType OutputPixelType;
99 
100  typedef typename InputImageType::RegionType InputImageRegionType;
101  typedef typename OutputImageType::RegionType OutputImageRegionType;
102 
103  typedef typename InputImageType::SizeType InputSizeType;
104 
118 
119  protected:
122  void PrintSelf(std::ostream &os, Indent indent) const override;
123 
134  void ThreadedGenerateData(const OutputImageRegionType &outputRegionForThread, ThreadIdType threadId) override;
135 
136  private:
137  LocalVariationImageFilter(const Self &); // purposely not implemented
138  void operator=(const Self &); // purposely not implemented
139  };
140 
141 } // end namespace itk
142 
143 #ifndef ITK_MANUAL_INSTANTIATION
144 #include <itkLocalVariationImageFilter.tpp>
145 #endif
146 
147 #endif // LocalVariationImageFilter
Calculates the local variation in each pixel.
void ThreadedGenerateData(const OutputImageRegionType &outputRegionForThread, ThreadIdType threadId) override
InputImageType::RegionType InputImageRegionType
itkStaticConstMacro(InputImageDimension, unsigned int, TInputImage::ImageDimension)
OutputImageType::RegionType OutputImageRegionType
OutputImageType::PixelType OutputPixelType
ImageToImageFilter< InputImageType, OutputImageType > Superclass
itkStaticConstMacro(OutputImageDimension, unsigned int, TOutputImage::ImageDimension)
void GenerateInputRequestedRegion() override
Generates the input requested region, padded by a radius of 1.
void PrintSelf(std::ostream &os, Indent indent) const override
Computes the squared Euclidean metric for a given pixel value.
static double Calc(TPixelType p)
Compute the squared Euclidean metric of a pixel value.