Orfeo Toolbox  4.0
itkWatershedImageFilter.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 __itkWatershedImageFilter_h
19 #define __itkWatershedImageFilter_h
20 
21 
22 #include "itkImageToImageFilter.h"
24 #include "itkWatershedRelabeler.h"
26 
27 namespace itk
28 {
149 template< typename TInputImage >
151  public ImageToImageFilter< TInputImage, Image< IdentifierType,
152  TInputImage::ImageDimension > >
153 {
154 public:
157 
159  typedef TInputImage InputImageType;
160 
162  itkStaticConstMacro (ImageDimension, unsigned int,
163  TInputImage::ImageDimension);
164 
167 
169  typedef typename InputImageType::RegionType RegionType;
170  typedef typename InputImageType::SizeType SizeType;
171  typedef typename InputImageType::IndexType IndexType;
172 
175 
177  typedef typename InputImageType::PixelType ScalarType;
178 
181 
184 
186  itkNewMacro(Self);
187 
189  void GenerateData();
190 
193  using Superclass::SetInput;
194  void SetInput(const InputImageType *input)
195  {
196  // if the input is changed, we'll need to clear the cached tree
197  // when we execute
198  if ( input != this->GetInput(0) )
199  {
200  m_InputChanged = true;
201  }
202 
203  // processObject is not const-correct so a const_cast is needed here
204  this->ProcessObject::SetNthInput( 0, const_cast< InputImageType * >( input ) );
205  m_Segmenter->SetInputImage( const_cast< InputImageType * >( input ) );
206  }
207 
208  virtual void SetInput(unsigned int i, const TInputImage *image)
209  {
210  if ( i != 0 )
211  { itkExceptionMacro(<< "Filter has only one input."); }
212  else
213  { this->SetInput(image); }
214  }
215 
218  void SetThreshold(double);
219 
220  itkGetConstMacro(Threshold, double);
221 
224  void SetLevel(double);
225 
226  itkGetConstMacro(Level, double);
227 
231  {
232  m_Segmenter->Update();
233  return m_Segmenter->GetOutputImage();
234  }
235 
239  {
241  }
242 
243  // Override since the filter produces all of its output
245 
246 #ifdef ITK_USE_CONCEPT_CHECKING
247  // Begin concept checking
248  itkConceptMacro( InputEqualityComparableCheck,
250  itkConceptMacro( InputAdditiveOperatorsCheck,
252  itkConceptMacro( DoubleInputMultiplyOperatorCheck,
254  itkConceptMacro( InputLessThanComparableCheck,
256  // End concept checking
257 #endif
258 
259 protected:
262  void PrintSelf(std::ostream & os, Indent indent) const;
263 
266  virtual void PrepareOutputs();
267 
268 private:
269  WatershedImageFilter(const Self &); //purposely not implemented
270  void operator=(const Self &); //purposely not implemented
271 
275  double m_Threshold;
276 
281  double m_Level;
282 
288 
290 
292 
293  unsigned long m_ObserverTag;
294 
298 
300 };
301 } // end namespace itk
302 
303 #ifndef ITK_MANUAL_INSTANTIATION
305 #endif
306 
307 #endif

Generated at Sat Mar 8 2014 15:46:45 for Orfeo Toolbox with doxygen 1.8.3.1