ITK  5.0.0
Insight Segmentation and Registration Toolkit
itkFastApproximateRankImageFilter.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
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 >
46  public MiniPipelineSeparableImageFilter< TInputImage, TOutputImage,
47  RankImageFilter< TInputImage, TInputImage,
48  FlatStructuringElement< TInputImage::ImageDimension > > >
49 {
50 public:
51  ITK_DISALLOW_COPY_AND_ASSIGN(FastApproximateRankImageFilter);
52 
55  using Superclass = MiniPipelineSeparableImageFilter< TInputImage, TOutputImage,
56  RankImageFilter< TInputImage, TInputImage,
58 
61 
63  itkNewMacro(Self);
64 
67 
69  using InputImageType = TInputImage;
71  using SizeType = typename TInputImage::SizeType;
73  using PixelType = typename TInputImage::PixelType;
74  using OffsetType = typename TInputImage::OffsetType;
76 
78  static constexpr unsigned int ImageDimension = TInputImage::ImageDimension;
79 
82 
83  void SetRank(float rank)
84  {
85  if ( m_Rank != rank )
86  {
87  m_Rank = rank;
88  for ( unsigned i = 0; i < TInputImage::ImageDimension - 1; i++ )
89  {
90  this->m_Filters[i]->SetRank(m_Rank);
91  }
92  this->Modified();
93  }
94  }
95 
96  itkGetConstMacro(Rank, float);
97 
98 protected:
100  {
101  // to avoid valgrind warning
102  m_Rank = 0.0;
103  this->SetRank(0.5);
104  }
105 
107 
108  void PrintSelf(std::ostream & os, Indent indent) const override
109  {
110  Superclass::PrintSelf(os, indent);
111  os << indent << "Rank: " << m_Rank << std::endl;
112  }
113 
114 private:
115  float m_Rank;
116 };
117 }
118 
119 #endif
typename TInputImage::SizeType RadiusType
Rank filter of a greyscale image.
typename TInputImage::IndexType IndexType
typename TInputImage::RegionType RegionType
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.
void PrintSelf(std::ostream &os, Indent indent) const override
typename TInputImage::OffsetType OffsetType
void PrintSelf(std::ostream &os, Indent indent) const override
typename TInputImage::SizeType SizeType
A class to support a variety of flat structuring elements, including versions created by decompositio...
Control indentation during Print() invocation.
Definition: itkIndent.h:49
A separable filter for filter which are using radius.