ITK  5.4.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
24namespace itk
25{
43template <typename TInputImage, typename TOutputImage>
46 TInputImage,
47 TOutputImage,
48 RankImageFilter<TInputImage, TInputImage, FlatStructuringElement<TInputImage::ImageDimension>>>
49{
50public:
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;
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
100protected:
102 {
103 // to avoid valgrind warning
104 m_Rank = 0.0;
105 this->SetRank(0.5);
106 }
107
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
117private:
118 float m_Rank{};
119};
120} // namespace itk
121
122#endif
void PrintSelf(std::ostream &os, Indent indent) const override
typename TInputImage::RegionType RegionType
typename TInputImage::SizeType SizeType
typename TInputImage::SizeType RadiusType
typename TInputImage::IndexType IndexType
typename TInputImage::OffsetType OffsetType
~FastApproximateRankImageFilter() override=default
void PrintSelf(std::ostream &os, Indent indent) const override
Base class for all process objects that output image data.
Control indentation during Print() invocation.
Definition: itkIndent.h:50
A separable filter for filter which are using radius.
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
Rank filter of a greyscale image.
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....