ITK  5.4.0
Insight Toolkit
itkVoronoiSegmentationRGBImageFilter.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 itkVoronoiSegmentationRGBImageFilter_h
19 #define itkVoronoiSegmentationRGBImageFilter_h
20 
22 
23 namespace itk
24 {
53 template <typename TInputImage, typename TOutputImage>
54 class ITK_TEMPLATE_EXPORT VoronoiSegmentationRGBImageFilter
55  : public VoronoiSegmentationImageFilterBase<TInputImage, TOutputImage>
56 {
57 public:
58  ITK_DISALLOW_COPY_AND_MOVE(VoronoiSegmentationRGBImageFilter);
59 
65 
67  itkOverrideGetNameOfClassMacro(VoronoiSegmentationRGBImageFilter);
68 
70  itkNewMacro(Self);
71 
73  using typename Superclass::BinaryObjectImage;
74  using typename Superclass::IndexList;
75  using typename Superclass::IndexType;
76  using typename Superclass::RegionType;
77  using typename Superclass::PixelType;
78  using typename Superclass::InputImagePointer;
79  using typename Superclass::InputImageType;
82 
84  void
85  SetMeanPercentError(const double x[6]);
86  void
87  SetSTDPercentError(const double x[6]);
88  void
89  GetMeanPercentError(double x[6])
90  {
91  for (int i = 0; i < 6; ++i)
92  {
93  x[i] = m_MeanPercentError[i];
94  }
95  }
96  void
97  GetSTDPercentError(double x[6])
98  {
99  for (int i = 0; i < 6; ++i)
100  {
101  x[i] = m_STDPercentError[i];
102  }
103  }
104  void
105  GetMean(double x[6])
106  {
107  for (int i = 0; i < 6; ++i)
108  {
109  x[i] = m_Mean[i];
110  }
111  }
112  void
113  GetSTD(double x[6])
114  {
115  for (int i = 0; i < 6; ++i)
116  {
117  x[i] = m_STD[i];
118  }
119  }
120  void
121  SetMean(const double x[6])
122  {
123  for (int i = 0; i < 6; ++i)
124  {
125  m_Mean[i] = x[i];
126  }
127  }
128  void
129  SetSTD(const double x[6])
130  {
131  for (int i = 0; i < 6; ++i)
132  {
133  m_STD[i] = x[i];
134  }
135  }
136  void
137  GetMeanTolerance(double x[6])
138  {
139  for (int i = 0; i < 6; ++i)
140  {
141  x[i] = m_MeanTolerance[i];
142  }
143  }
144  void
145  GetSTDTolerance(double x[6])
146  {
147  for (int i = 0; i < 6; ++i)
148  {
149  x[i] = m_STDTolerance[i];
150  }
151  }
157  itkSetMacro(MaxValueOfRGB, double);
158  itkGetConstMacro(MaxValueOfRGB, double);
163  void
164  SetTestMean(unsigned int t1, unsigned int t2, unsigned int t3)
165  {
166  m_TestMean[0] = t1;
167  m_TestMean[1] = t2;
168  m_TestMean[2] = t3;
169  }
170 
171  void
172  SetTestSTD(unsigned int t1, unsigned int t2, unsigned int t3)
173  {
174  m_TestSTD[0] = t1;
175  m_TestSTD[1] = t2;
176  m_TestSTD[2] = t3;
177  }
178 
179  void
180  GetTestMean(unsigned int x[3])
181  {
182  x[0] = m_TestMean[0];
183  x[1] = m_TestMean[1];
184  x[2] = m_TestMean[2];
185  }
186 
187  void
188  GetTestSTD(unsigned int x[3])
189  {
190  x[0] = m_TestSTD[0];
191  x[1] = m_TestSTD[1];
192  x[2] = m_TestSTD[2];
193  }
194 
195  void
196  TakeAPrior(const BinaryObjectImage * aprior) override;
197 
198  using Superclass::SetInput;
199  void
200  SetInput(const InputImageType * input) override;
201 
202  void
203  SetInput(unsigned int, const InputImageType * input) override;
204 
206  static constexpr unsigned int InputImageDimension = TInputImage::ImageDimension;
207  static constexpr unsigned int OutputImageDimension = TOutputImage::ImageDimension;
208 
209 #ifdef ITK_USE_CONCEPT_CHECKING
210  // Begin concept checking
214  // End concept checking
215 #endif
216 
217 protected:
219  ~VoronoiSegmentationRGBImageFilter() override = default;
220  void
221  PrintSelf(std::ostream & os, Indent indent) const override;
222 
223 private:
224  double m_Mean[6]{};
225  double m_STD[6]{};
226  double m_MeanTolerance[6]{};
227  double m_STDTolerance[6]{};
228  double m_MeanPercentError[6]{};
229  double m_STDPercentError[6]{};
230  double m_MaxValueOfRGB{};
231  unsigned int m_TestMean[3]{};
232  unsigned int m_TestSTD[3]{};
233  typename RGBHCVImage::Pointer m_WorkingImage{};
234 
235  bool
236  TestHomogeneity(IndexList & Plist) override;
237 };
238 } // namespace itk
239 
240 #ifndef ITK_MANUAL_INSTANTIATION
241 # include "itkVoronoiSegmentationRGBImageFilter.hxx"
242 #endif
243 
244 #endif
itk::VoronoiSegmentationRGBImageFilter::GetSTDTolerance
void GetSTDTolerance(double x[6])
Definition: itkVoronoiSegmentationRGBImageFilter.h:145
itk::VoronoiSegmentationRGBImageFilter
Definition: itkVoronoiSegmentationRGBImageFilter.h:54
itk::VoronoiSegmentationRGBImageFilter::GetMeanPercentError
void GetMeanPercentError(double x[6])
Definition: itkVoronoiSegmentationRGBImageFilter.h:89
itk::VoronoiSegmentationRGBImageFilter::GetSTD
void GetSTD(double x[6])
Definition: itkVoronoiSegmentationRGBImageFilter.h:113
itkVoronoiSegmentationImageFilterBase.h
itk::VoronoiSegmentationRGBImageFilter::GetSTDPercentError
void GetSTDPercentError(double x[6])
Definition: itkVoronoiSegmentationRGBImageFilter.h:97
itk::Vector
A templated class holding a n-Dimensional vector.
Definition: itkVector.h:62
itk::SmartPointer< Self >
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::VoronoiSegmentationRGBImageFilter::GetTestSTD
void GetTestSTD(unsigned int x[3])
Definition: itkVoronoiSegmentationRGBImageFilter.h:188
itk::VoronoiSegmentationRGBImageFilter::GetMeanTolerance
void GetMeanTolerance(double x[6])
Definition: itkVoronoiSegmentationRGBImageFilter.h:137
itk::Concept::SameDimension
Definition: itkConceptChecking.h:694
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::VoronoiSegmentationImageFilterBase
Base class for VoronoiSegmentationImageFilter.
Definition: itkVoronoiSegmentationImageFilterBase.h:59
itk::GTest::TypedefsAndConstructors::Dimension2::RegionType
ImageBaseType::RegionType RegionType
Definition: itkGTestTypedefsAndConstructors.h:54
itk::VoronoiSegmentationRGBImageFilter::SetTestSTD
void SetTestSTD(unsigned int t1, unsigned int t2, unsigned int t3)
Definition: itkVoronoiSegmentationRGBImageFilter.h:172
itk::VoronoiSegmentationRGBImageFilter::SetTestMean
void SetTestMean(unsigned int t1, unsigned int t2, unsigned int t3)
Definition: itkVoronoiSegmentationRGBImageFilter.h:164
itkConceptMacro
#define itkConceptMacro(name, concept)
Definition: itkConceptChecking.h:65
itk::VoronoiSegmentationRGBImageFilter::GetMean
void GetMean(double x[6])
Definition: itkVoronoiSegmentationRGBImageFilter.h:105
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:139
itk::VoronoiSegmentationRGBImageFilter::SetSTD
void SetSTD(const double x[6])
Definition: itkVoronoiSegmentationRGBImageFilter.h:129
itk::Concept::Convertible
Definition: itkConceptChecking.h:216
itk::Image
Templated n-dimensional image class.
Definition: itkImage.h:88
itk::VoronoiSegmentationRGBImageFilter::GetTestMean
void GetTestMean(unsigned int x[3])
Definition: itkVoronoiSegmentationRGBImageFilter.h:180
itk::VoronoiSegmentationRGBImageFilter::SetMean
void SetMean(const double x[6])
Definition: itkVoronoiSegmentationRGBImageFilter.h:121