ITK  4.2.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< class TInputImage, class TOutputImage >
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);
129 
130  using Superclass::SetInput;
131  virtual void SetInput(const InputImageType *input);
132 
133  virtual void SetInput(unsigned int, const InputImageType *image);
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 
144  itkConceptMacro( SameDimensionCheck,
146  itkConceptMacro( IntConvertibleToOutputCheck,
148 
150 #endif
151 protected:
154  void PrintSelf(std::ostream & os, Indent indent) const;
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  virtual bool TestHomogeneity(IndexList & Plist);
170 
171 private:
172  VoronoiSegmentationRGBImageFilter(const Self &); //purposely not implemented
173  void operator=(const Self &); //purposely not implemented
174 };
175 } //end namespace
176 
177 #ifndef ITK_MANUAL_INSTANTIATION
178 #include "itkVoronoiSegmentationRGBImageFilter.hxx"
179 #endif
180 
181 #endif
182