ITK  6.0.0
Insight Toolkit
itkFastApproximateRankImageFilter.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright NumFOCUS
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * https://www.apache.org/licenses/LICENSE-2.0.txt
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *=========================================================================*/
18 #ifndef itkFastApproximateRankImageFilter_h
19 #define itkFastApproximateRankImageFilter_h
20 
22 #include "itkRankImageFilter.h"
23 
24 namespace itk
25 {
43 template <typename TInputImage, typename TOutputImage>
46  TInputImage,
47  TOutputImage,
48  RankImageFilter<TInputImage, TInputImage, FlatStructuringElement<TInputImage::ImageDimension>>>
49 {
50 public:
51  ITK_DISALLOW_COPY_AND_MOVE(FastApproximateRankImageFilter);
52 
56  TInputImage,
57  TOutputImage,
59 
62 
64  itkNewMacro(Self);
65 
67  itkOverrideGetNameOfClassMacro(FastApproximateRankImageFilter);
68 
70  using InputImageType = TInputImage;
72  using SizeType = typename TInputImage::SizeType;
74  using PixelType = typename TInputImage::PixelType;
75  using OffsetType = typename TInputImage::OffsetType;
76  using typename Superclass::FilterType;
77 
79  static constexpr unsigned int ImageDimension = TInputImage::ImageDimension;
80 
83 
84  void
85  SetRank(float rank)
86  {
87  if (m_Rank != rank)
88  {
89  m_Rank = rank;
90  for (unsigned int i = 0; i < TInputImage::ImageDimension - 1; ++i)
91  {
92  this->m_Filters[i]->SetRank(m_Rank);
93  }
94  this->Modified();
95  }
96  }
97 
98  itkGetConstMacro(Rank, float);
99 
100 protected:
102  {
103  // to avoid valgrind warning
104  m_Rank = 0.0;
105  this->SetRank(0.5);
106  }
107 
108  ~FastApproximateRankImageFilter() override = default;
109 
110  void
111  PrintSelf(std::ostream & os, Indent indent) const override
112  {
113  Superclass::PrintSelf(os, indent);
114  os << indent << "Rank: " << m_Rank << std::endl;
115  }
116 
117 private:
118  float m_Rank{};
119 };
120 } // namespace itk
121 
122 #endif
itk::RankImageFilter
Rank filter of a greyscale image.
Definition: itkRankImageFilter.h:70
itk::MiniPipelineSeparableImageFilter< TInputImage, TOutputImage, RankImageFilter< TInputImage, TInputImage, FlatStructuringElement< TInputImage::ImageDimension > > >::Modified
void Modified() const override
itk::FastApproximateRankImageFilter::PrintSelf
void PrintSelf(std::ostream &os, Indent indent) const override
Definition: itkFastApproximateRankImageFilter.h:111
itk::FastApproximateRankImageFilter::FastApproximateRankImageFilter
FastApproximateRankImageFilter()
Definition: itkFastApproximateRankImageFilter.h:101
itk::MiniPipelineSeparableImageFilter
A separable filter for filter which are using radius.
Definition: itkMiniPipelineSeparableImageFilter.h:49
itk::BoxImageFilter::PrintSelf
void PrintSelf(std::ostream &os, Indent indent) const override
itk::FastApproximateRankImageFilter::SetRank
void SetRank(float rank)
Definition: itkFastApproximateRankImageFilter.h:85
itk::GTest::TypedefsAndConstructors::Dimension2::SizeType
ImageBaseType::SizeType SizeType
Definition: itkGTestTypedefsAndConstructors.h:49
itkMiniPipelineSeparableImageFilter.h
itk::SmartPointer< Self >
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::BoxImageFilter::RadiusType
typename TInputImage::SizeType RadiusType
Definition: itkBoxImageFilter.h:73
itk::BoxImageFilter::OffsetType
typename TInputImage::OffsetType OffsetType
Definition: itkBoxImageFilter.h:62
itk::FastApproximateRankImageFilter::ImageDimension
static constexpr unsigned int ImageDimension
Definition: itkFastApproximateRankImageFilter.h:79
itk::GTest::TypedefsAndConstructors::Dimension2::IndexType
ImageBaseType::IndexType IndexType
Definition: itkGTestTypedefsAndConstructors.h:50
itk::ImageSource
Base class for all process objects that output image data.
Definition: itkImageSource.h:67
itk::BoxImageFilter::IndexType
typename TInputImage::IndexType IndexType
Definition: itkBoxImageFilter.h:61
itk::GTest::TypedefsAndConstructors::Dimension2::RegionType
ImageBaseType::RegionType RegionType
Definition: itkGTestTypedefsAndConstructors.h:54
itk::FastApproximateRankImageFilter::~FastApproximateRankImageFilter
~FastApproximateRankImageFilter() override=default
itk::ImageToImageFilter::InputImageType
TInputImage InputImageType
Definition: itkImageToImageFilter.h:129
itk::FastApproximateRankImageFilter
A separable rank filter.
Definition: itkFastApproximateRankImageFilter.h:44
itk::FastApproximateRankImageFilter::m_Rank
float m_Rank
Definition: itkFastApproximateRankImageFilter.h:118
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnatomicalOrientation.h:29
itk::ProcessObject
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
Definition: itkProcessObject.h:139
itk::MiniPipelineSeparableImageFilter::FilterType
TFilter FilterType
Definition: itkMiniPipelineSeparableImageFilter.h:77
itk::MiniPipelineSeparableImageFilter< TInputImage, TOutputImage, RankImageFilter< TInputImage, TInputImage, FlatStructuringElement< TInputImage::ImageDimension > > >::m_Filters
FilterType::Pointer m_Filters[ImageDimension]
Definition: itkMiniPipelineSeparableImageFilter.h:109
itk::BoxImageFilter::SizeType
typename TInputImage::SizeType SizeType
Definition: itkBoxImageFilter.h:60
itkRankImageFilter.h
itk::FastApproximateRankImageFilter::PixelType
typename TInputImage::PixelType PixelType
Definition: itkFastApproximateRankImageFilter.h:74
itk::BoxImageFilter::RegionType
typename TInputImage::RegionType RegionType
Definition: itkBoxImageFilter.h:59