ITK  5.0.0
Insight Segmentation and Registration Toolkit
itkVoronoiSegmentationRGBImageFilter.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 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_ASSIGN(VoronoiSegmentationRGBImageFilter);
59 
65 
69 
71  itkNewMacro(Self);
72 
74  using BinaryObjectImage = typename Superclass::BinaryObjectImage;
75  using IndexList = typename Superclass::IndexList;
76  using IndexType = typename Superclass::IndexType;
78  using PixelType = typename Superclass::PixelType;
79  using InputImagePointer = typename Superclass::InputImagePointer;
80  using InputImageType = typename Superclass::InputImageType;
83 
85  void SetMeanPercentError(double x[6]);
86  void SetSTDPercentError(double x[6]);
87  void GetMeanPercentError(double x[6]){ for ( int i = 0; i < 6; i++ ) { x[i] = m_MeanPercentError[i]; } }
88  void GetSTDPercentError(double x[6]){ for ( int i = 0; i < 6; i++ ) { x[i] = m_STDPercentError[i]; } }
89  void GetMean(double x[6]){ for ( int i = 0; i < 6; i++ ) { x[i] = m_Mean[i]; } }
90  void GetSTD(double x[6]){ for ( int i = 0; i < 6; i++ ) { x[i] = m_STD[i]; } }
91  void SetMean(double x[6]){ for ( int i = 0; i < 6; i++ ) { m_Mean[i] = x[i]; } }
92  void SetSTD(double x[6]){ for ( int i = 0; i < 6; i++ ) { m_STD[i] = x[i]; } }
93  void GetMeanTolerance(double x[6]){ for ( int i = 0; i < 6; i++ ) { x[i] = m_MeanTolerance[i]; } }
94  void GetSTDTolerance(double x[6]){ for ( int i = 0; i < 6; i++ ) { x[i] = m_STDTolerance[i]; } }
96 
100  itkSetMacro(MaxValueOfRGB, double);
101  itkGetConstMacro(MaxValueOfRGB, double);
103 
106  void SetTestMean(unsigned int t1, unsigned int t2, unsigned int t3)
107  {
108  m_TestMean[0] = t1;
109  m_TestMean[1] = t2;
110  m_TestMean[2] = t3;
111  }
112 
113  void SetTestSTD(unsigned int t1, unsigned int t2, unsigned int t3)
114  {
115  m_TestSTD[0] = t1;
116  m_TestSTD[1] = t2;
117  m_TestSTD[2] = t3;
118  }
119 
120  void GetTestMean(unsigned int x[3])
121  {
122  x[0] = m_TestMean[0]; x[1] = m_TestMean[1]; x[2] = m_TestMean[2];
123  }
124 
125  void GetTestSTD(unsigned int x[3])
126  {
127  x[0] = m_TestSTD[0]; x[1] = m_TestSTD[1]; x[2] = m_TestSTD[2];
128  }
129 
130  void TakeAPrior(const BinaryObjectImage *aprior) override;
131 
132  using Superclass::SetInput;
133  void SetInput(const InputImageType *input) override;
134 
135  void SetInput(unsigned int, const InputImageType *image) override;
136 
138  static constexpr unsigned int InputImageDimension = TInputImage::ImageDimension;
139  static constexpr unsigned int OutputImageDimension = TOutputImage::ImageDimension;
140 
141 #ifdef ITK_USE_CONCEPT_CHECKING
142  // Begin concept checking
143  itkConceptMacro( SameDimensionCheck,
145  itkConceptMacro( IntConvertibleToOutputCheck,
147  itkConceptMacro( PixelDimensionCheck,
149  // End concept checking
150 #endif
151 
152 protected:
154  ~VoronoiSegmentationRGBImageFilter() override = default;
155  void PrintSelf(std::ostream & os, Indent indent) const override;
156 
157 private:
158  double m_Mean[6];
159  double m_STD[6];
160  double m_MeanTolerance[6];
161  double m_STDTolerance[6];
162  double m_MeanPercentError[6];
163  double m_STDPercentError[6];
165  unsigned int m_TestMean[3];
166  unsigned int m_TestSTD[3];
168 
169  bool TestHomogeneity(IndexList & Plist) override;
170 };
171 } //end namespace
172 
173 #ifndef ITK_MANUAL_INSTANTIATION
174 #include "itkVoronoiSegmentationRGBImageFilter.hxx"
175 #endif
176 
177 #endif
Base class for VoronoiSegmentationImageFilter.
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 SetTestMean(unsigned int t1, unsigned int t2, unsigned int t3)
typename Superclass::BinaryObjectImage BinaryObjectImage
typename InputImageType::Pointer InputImagePointer
A templated class holding a n-Dimensional vector.
Definition: itkVector.h:62
void SetTestSTD(unsigned int t1, unsigned int t2, unsigned int t3)
Control indentation during Print() invocation.
Definition: itkIndent.h:49
#define itkConceptMacro(name, concept)
Templated n-dimensional image class.
Definition: itkImage.h:75