Orfeo Toolbox  3.16
itkWatershedImageFilter.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Insight Segmentation & Registration Toolkit
4  Module: $RCSfile: itkWatershedImageFilter.h,v $
5  Language: C++
6  Date: $Date: 2009-04-23 03:53:37 $
7  Version: $Revision: 1.45 $
8 
9  Copyright (c) Insight Software Consortium. All rights reserved.
10  See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
11 
12  This software is distributed WITHOUT ANY WARRANTY; without even
13  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14  PURPOSE. See the above copyright notices for more information.
15 
16 =========================================================================*/
17 #ifndef __itkWatershedImageFilter_h
18 #define __itkWatershedImageFilter_h
19 
20 #if defined(_MSC_VER)
21 #pragma warning ( disable : 4786 )
22 #endif
23 
24 #include "itkImageToImageFilter.h"
25 #include "itkImage.h"
26 #include "itkWatershedSegmenter.h"
28 #include "itkWatershedRelabeler.h"
30 
31 namespace itk
32 {
151 template <class TInputImage>
153  public ImageToImageFilter< TInputImage, Image<unsigned long,
154  ::itk::GetImageDimension<TInputImage>::ImageDimension> >
155 {
156 public:
159 
161  typedef TInputImage InputImageType;
162 
164  itkStaticConstMacro (ImageDimension, unsigned int,
165  TInputImage::ImageDimension);
166 
169 
171  typedef typename InputImageType::RegionType RegionType;
172  typedef typename InputImageType::SizeType SizeType;
173  typedef typename InputImageType::IndexType IndexType;
174 
177 
179  typedef typename InputImageType::PixelType ScalarType;
180 
183 
186 
188  itkNewMacro(Self);
189 
191  void GenerateData();
192 
195  void SetInput(const InputImageType *input)
196  {
197  // if the input is changed, we'll need to clear the cached tree
198  // when we execute
199  if (input != this->GetInput(0))
200  {
201  m_InputChanged = true;
202  }
203 
204  // processObject is not const-correct so a const_cast is needed here
205  this->ProcessObject::SetNthInput(0, const_cast<InputImageType *>(input));
206  m_Segmenter->SetInputImage( const_cast<InputImageType *>( input ) );
207  }
208 
209  virtual void SetInput( unsigned int i, const TInputImage * image)
210  {
211  if (i != 0)
212  { itkExceptionMacro(<< "Filter has only one input."); }
213  else
214  { this->SetInput(image); }
215  }
218  void SetThreshold(double);
219  itkGetConstMacro(Threshold, double);
220 
223  void SetLevel(double);
224  itkGetConstMacro(Level, double);
225 
228  GetBasicSegmentation()
229  {
230  m_Segmenter->Update();
231  return m_Segmenter->GetOutputImage();
232  }
233 
236  GetSegmentTree()
237  {
238  return m_TreeGenerator->GetOutputSegmentTree();
239  }
240 
241  // Override since the filter produces all of its output
242  void EnlargeOutputRequestedRegion(DataObject *data);
243 
244 #ifdef ITK_USE_CONCEPT_CHECKING
245 
246  itkConceptMacro(InputEqualityComparableCheck,
248  itkConceptMacro(InputAdditiveOperatorsCheck,
250  itkConceptMacro(DoubleInputMultiplyOperatorCheck,
252  itkConceptMacro(InputLessThanComparableCheck,
255 #endif
256 
257 protected:
261  void operator=(const Self&) {}
262  void PrintSelf(std::ostream& os, Indent indent) const;
263 
266  virtual void PrepareOutputs();
267 
268 private:
272  double m_Threshold;
273 
278  double m_Level;
279 
288 
289  unsigned long m_ObserverTag;
290 
294 
296 };
297 
298 } // end namespace itk
299 
300 #ifndef ITK_MANUAL_INSTANTIATION
302 #endif
303 
304 #endif

Generated at Sun Feb 3 2013 00:14:43 for Orfeo Toolbox with doxygen 1.8.1.1