ITK  5.2.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  * http://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 {
44 template <typename TInputImage, typename TOutputImage>
47  TInputImage,
48  TOutputImage,
49  RankImageFilter<TInputImage, TInputImage, FlatStructuringElement<TInputImage::ImageDimension>>>
50 {
51 public:
52  ITK_DISALLOW_COPY_AND_ASSIGN(FastApproximateRankImageFilter);
53 
57  TInputImage,
58  TOutputImage,
60 
63 
65  itkNewMacro(Self);
66 
69 
71  using InputImageType = TInputImage;
73  using SizeType = typename TInputImage::SizeType;
75  using PixelType = typename TInputImage::PixelType;
76  using OffsetType = typename TInputImage::OffsetType;
78 
80  static constexpr unsigned int ImageDimension = TInputImage::ImageDimension;
81 
84 
85  void
86  SetRank(float rank)
87  {
88  if (m_Rank != rank)
89  {
90  m_Rank = rank;
91  for (unsigned i = 0; i < TInputImage::ImageDimension - 1; i++)
92  {
93  this->m_Filters[i]->SetRank(m_Rank);
94  }
95  this->Modified();
96  }
97  }
98 
99  itkGetConstMacro(Rank, float);
100 
101 protected:
103  {
104  // to avoid valgrind warning
105  m_Rank = 0.0;
106  this->SetRank(0.5);
107  }
108 
109  ~FastApproximateRankImageFilter() override = default;
110 
111  void
112  PrintSelf(std::ostream & os, Indent indent) const override
113  {
114  Superclass::PrintSelf(os, indent);
115  os << indent << "Rank: " << m_Rank << std::endl;
116  }
117 
118 private:
119  float m_Rank;
120 };
121 } // namespace itk
122 
123 #endif
itk::RankImageFilter
Rank filter of a greyscale image.
Definition: itkRankImageFilter.h:71
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:112
itk::FastApproximateRankImageFilter::FastApproximateRankImageFilter
FastApproximateRankImageFilter()
Definition: itkFastApproximateRankImageFilter.h:102
itk::MiniPipelineSeparableImageFilter
A separable filter for filter which are using radius.
Definition: itkMiniPipelineSeparableImageFilter.h:50
itk::BoxImageFilter::PrintSelf
void PrintSelf(std::ostream &os, Indent indent) const override
itk::FastApproximateRankImageFilter::SetRank
void SetRank(float rank)
Definition: itkFastApproximateRankImageFilter.h:86
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::FastApproximateRankImageFilter::FilterType
typename Superclass::FilterType FilterType
Definition: itkFastApproximateRankImageFilter.h:77
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:80
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:45
itk::FastApproximateRankImageFilter::m_Rank
float m_Rank
Definition: itkFastApproximateRankImageFilter.h:119
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itk::ProcessObject
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
Definition: itkProcessObject.h:138
itk::MiniPipelineSeparableImageFilter::FilterType
TFilter FilterType
Definition: itkMiniPipelineSeparableImageFilter.h:78
itk::MiniPipelineSeparableImageFilter< TInputImage, TOutputImage, RankImageFilter< TInputImage, TInputImage, FlatStructuringElement< TInputImage::ImageDimension > > >::m_Filters
FilterType::Pointer m_Filters[ImageDimension]
Definition: itkMiniPipelineSeparableImageFilter.h:110
itk::BoxImageFilter::SizeType
typename TInputImage::SizeType SizeType
Definition: itkBoxImageFilter.h:60
itkRankImageFilter.h
itk::FastApproximateRankImageFilter::PixelType
typename TInputImage::PixelType PixelType
Definition: itkFastApproximateRankImageFilter.h:75
itk::BoxImageFilter::RegionType
typename TInputImage::RegionType RegionType
Definition: itkBoxImageFilter.h:59