ITK  4.13.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:
63 
67 
69  itkNewMacro(Self);
70 
72  typedef typename Superclass::BinaryObjectImage BinaryObjectImage;
73  typedef typename Superclass::IndexList IndexList;
74  typedef typename Superclass::IndexType IndexType;
75  typedef typename Superclass::RegionType RegionType;
76  typedef typename Superclass::PixelType PixelType;
77  typedef typename Superclass::InputImagePointer InputImagePointer;
78  typedef typename Superclass::InputImageType InputImageType;
81 
83  void SetMeanPercentError(double x[6]);
84  void SetSTDPercentError(double x[6]);
85  void GetMeanPercentError(double x[6]){ for ( int i = 0; i < 6; i++ ) { x[i] = m_MeanPercentError[i]; } }
86  void GetSTDPercentError(double x[6]){ for ( int i = 0; i < 6; i++ ) { x[i] = m_STDPercentError[i]; } }
87  void GetMean(double x[6]){ for ( int i = 0; i < 6; i++ ) { x[i] = m_Mean[i]; } }
88  void GetSTD(double x[6]){ for ( int i = 0; i < 6; i++ ) { x[i] = m_STD[i]; } }
89  void SetMean(double x[6]){ for ( int i = 0; i < 6; i++ ) { m_Mean[i] = x[i]; } }
90  void SetSTD(double x[6]){ for ( int i = 0; i < 6; i++ ) { m_STD[i] = x[i]; } }
91  void GetMeanTolerance(double x[6]){ for ( int i = 0; i < 6; i++ ) { x[i] = m_MeanTolerance[i]; } }
92  void GetSTDTolerance(double x[6]){ for ( int i = 0; i < 6; i++ ) { x[i] = m_STDTolerance[i]; } }
94 
98  itkSetMacro(MaxValueOfRGB, double);
99  itkGetConstMacro(MaxValueOfRGB, double);
101 
104  void SetTestMean(unsigned int t1, unsigned int t2, unsigned int t3)
105  {
106  m_TestMean[0] = t1;
107  m_TestMean[1] = t2;
108  m_TestMean[2] = t3;
109  }
110 
111  void SetTestSTD(unsigned int t1, unsigned int t2, unsigned int t3)
112  {
113  m_TestSTD[0] = t1;
114  m_TestSTD[1] = t2;
115  m_TestSTD[2] = t3;
116  }
117 
118  void GetTestMean(unsigned int x[3])
119  {
120  x[0] = m_TestMean[0]; x[1] = m_TestMean[1]; x[2] = m_TestMean[2];
121  }
122 
123  void GetTestSTD(unsigned int x[3])
124  {
125  x[0] = m_TestSTD[0]; x[1] = m_TestSTD[1]; x[2] = m_TestSTD[2];
126  }
127 
128  void TakeAPrior(const BinaryObjectImage *aprior) ITK_OVERRIDE;
129 
130  using Superclass::SetInput;
131  virtual void SetInput(const InputImageType *input) ITK_OVERRIDE;
132 
133  virtual void SetInput(unsigned int, const InputImageType *image) ITK_OVERRIDE;
134 
136  itkStaticConstMacro(InputImageDimension, unsigned int,
137  TInputImage::ImageDimension);
138  itkStaticConstMacro(OutputImageDimension, unsigned int,
139  TOutputImage::ImageDimension);
141 
142 #ifdef ITK_USE_CONCEPT_CHECKING
143  // Begin concept checking
144  itkConceptMacro( SameDimensionCheck,
146  itkConceptMacro( IntConvertibleToOutputCheck,
148  itkConceptMacro( PixelDimensionCheck,
150  // End concept checking
151 #endif
152 
153 protected:
155  ~VoronoiSegmentationRGBImageFilter() ITK_OVERRIDE;
156  void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
157 
158 private:
159  double m_Mean[6];
160  double m_STD[6];
161  double m_MeanTolerance[6];
162  double m_STDTolerance[6];
163  double m_MeanPercentError[6];
164  double m_STDPercentError[6];
165  double m_MaxValueOfRGB;
166  unsigned int m_TestMean[3];
167  unsigned int m_TestSTD[3];
168  typename RGBHCVImage::Pointer m_WorkingImage;
169 
170  virtual bool TestHomogeneity(IndexList & Plist) ITK_OVERRIDE;
171 
172 private:
173  ITK_DISALLOW_COPY_AND_ASSIGN(VoronoiSegmentationRGBImageFilter);
174 };
175 } //end namespace
176 
177 #ifndef ITK_MANUAL_INSTANTIATION
178 #include "itkVoronoiSegmentationRGBImageFilter.hxx"
179 #endif
180 
181 #endif
Base class for VoronoiSegmentationImageFilter.
Base class for all process objects that output image data.
void SetTestMean(unsigned int t1, unsigned int t2, unsigned int t3)
A templated class holding a n-Dimensional vector.
Definition: itkVector.h:62
void SetTestSTD(unsigned int t1, unsigned int t2, unsigned int t3)
VoronoiSegmentationImageFilterBase< TInputImage, TOutputImage > Superclass
Control indentation during Print() invocation.
Definition: itkIndent.h:49
#define itkConceptMacro(name, concept)
Templated n-dimensional image class.
Definition: itkImage.h:75