ITK  4.6.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:
53  typedef MiniPipelineSeparableImageFilter< TInputImage, TOutputImage,
54  RankImageFilter< TInputImage, TInputImage,
56 
59 
61  itkNewMacro(Self);
62 
65 
67  typedef TInputImage InputImageType;
68  typedef typename TInputImage::RegionType RegionType;
69  typedef typename TInputImage::SizeType SizeType;
70  typedef typename TInputImage::IndexType IndexType;
71  typedef typename TInputImage::PixelType PixelType;
72  typedef typename TInputImage::OffsetType OffsetType;
74 
76  itkStaticConstMacro(ImageDimension, unsigned int,
77  TInputImage::ImageDimension);
78 
80  typedef typename TInputImage::SizeType RadiusType;
81 
82  void SetRank(float rank)
83  {
84  if ( m_Rank != rank )
85  {
86  m_Rank = rank;
87  for ( unsigned i = 0; i < TInputImage::ImageDimension - 1; i++ )
88  {
89  this->m_Filters[i]->SetRank(m_Rank);
90  }
91  this->Modified();
92  }
93  }
94 
95  itkGetConstMacro(Rank, float);
96 
97 protected:
99  {
100  // to avoid valgrind warning
101  m_Rank = 0.0;
102  this->SetRank(0.5);
103  }
104 
106 
107  void PrintSelf(std::ostream & os, Indent indent) const
108  {
109  Superclass::PrintSelf(os, indent);
110  os << indent << "Rank: " << m_Rank << std::endl;
111  }
112 
113 private:
114  FastApproximateRankImageFilter(const Self &); //purposely not implemented
115  void operator=(const Self &); //purposely not implemented
116 
117  float m_Rank;
118 };
119 }
120 
121 #endif
Rank filter of a greyscale image.
Base class for all process objects that output image data.
void PrintSelf(std::ostream &os, Indent indent) const
MiniPipelineSeparableImageFilter< TInputImage, TOutputImage, RankImageFilter< TInputImage, TInputImage, FlatStructuringElement< TInputImage::ImageDimension > > > Superclass
A class to support a variety of flat structuring elements, including versions created by decompositio...
Control indentation during Print() invocation.
Definition: itkIndent.h:49
virtual void PrintSelf(std::ostream &os, Indent indent) const
A separable filter for filter which are using radius.