ITK  4.2.0
Insight Segmentation and Registration Toolkit
itkWatershedBoundaryResolver.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 __itkWatershedBoundaryResolver_h
19 #define __itkWatershedBoundaryResolver_h
20 
21 
22 #include "itkWatershedSegmenter.h"
23 
24 namespace itk
25 {
26 namespace watershed
27 {
63 template< class TPixelType, unsigned int TDimension >
64 class ITK_EXPORT BoundaryResolver:public ProcessObject
65 {
66 public:
72  itkNewMacro(Self);
73  itkTypeMacro(WatershedBoundaryResolver, ProcessObject);
75 
77  itkStaticConstMacro(ImageDimension, unsigned int, TDimension);
78 
80  typedef TPixelType PixelType;
85 
87  void SetBoundaryA(BoundaryType *bd)
88  { this->ProcessObject::SetNthInput(0, bd); }
89  typename BoundaryType::Pointer GetBoundaryA()
90  { return static_cast< BoundaryType * >( this->GetInput(0) ); }
92 
94  void SetBoundaryB(BoundaryType *bd)
95  { this->ProcessObject::SetNthInput(1, bd); }
96  typename BoundaryType::Pointer GetBoundaryB()
97  { return static_cast< BoundaryType * >( this->GetInput(1) ); }
99 
102  itkSetMacro(Face, unsigned short);
103  itkGetConstMacro(Face, unsigned short);
105 
109  void SetEquivalencyTable(EquivalencyTableType::Pointer a)
110  { this->ProcessObject::SetNthOutput( 0, a.GetPointer() ); }
111  EquivalencyTableType::Pointer GetEquivalencyTable()
112  {
113  return static_cast< EquivalencyTableType * >
114  ( this->ProcessObject::GetOutput(0) );
115  }
117 
119  void GenerateData();
120 
123  using Superclass::MakeOutput;
124  virtual DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx);
125 
126 protected:
127  BoundaryResolver():m_Face(0)
128  {
130  static_cast< EquivalencyTable * >( this->MakeOutput(0).GetPointer() );
131 
132  this->SetNumberOfRequiredOutputs(1);
133  this->ProcessObject::SetNthOutput( 0, eq.GetPointer() );
134  }
135 
136  virtual ~BoundaryResolver() {}
137  BoundaryResolver(const Self &) {}
138  void operator=(const Self &) {}
139  void PrintSelf(std::ostream & os, Indent indent) const;
140 
141  unsigned short m_Face;
142  void GenerateOutputRequestedRegion(DataObject *output);
143 };
144 } // end namespace watershed
145 } // end namespace itk
146 
147 #ifndef ITK_MANUAL_INSTANTIATION
148 #include "itkWatershedBoundaryResolver.hxx"
149 #endif
150 
151 #endif
152